浏览代码

分享接口对接

lilei 4 年之前
父节点
当前提交
7b448bdcf9
共有 5 个文件被更改,包括 31 次插入1 次删除
  1. 8 0
      api/luckyDraw.js
  2. 7 0
      pagesA/luckDraw/luckDraw.vue
  3. 16 1
      pagesA/taskList/taskList.vue
  4. 0 0
      static/NEW_FIRST_DELIVER.png
  5. 0 0
      static/OLD_FIRST_DELIVER.png

+ 8 - 0
api/luckyDraw.js

@@ -59,4 +59,12 @@ export const queryWinRecord = params => {
     method: 'post',
 	data: {}
   })
+};
+
+// 抽奖任务
+export const doTask = params => {
+  return axios.request({
+    url: `luckyDrawCust/doTask/${params.luckyDrawNo}/${params.taskCode}`,
+    method: 'get',
+  })
 };

+ 7 - 0
pagesA/luckDraw/luckDraw.vue

@@ -206,6 +206,13 @@ export default {
 			weightArr: []
 		};
 	},
+	watch: {
+		showLottery(newValue, oldValue) {
+			if(!newValue){
+				this.handleInitCanvas()
+			}
+		}
+	},
 	methods: {
 		// 重新生成
 		handleInitCanvas() {

+ 16 - 1
pagesA/taskList/taskList.vue

@@ -29,18 +29,20 @@
 </template>
 
 <script>
-	import { findCustomerTask } from '@/api/luckyDraw.js'
+	import { findCustomerTask, doTask } from '@/api/luckyDraw.js'
 	export default {
 		data() {
 			return {
 				showYd: false,
 				list: [], // 任务列表
+				luckDraw: null
 			}
 		},
 		onLoad(option) {
 			if(option.id) {
 				this.getTaskList(option.id)
 			}
+			this.luckDraw = this.$store.state.vuex_LuckDraw
 		},
 		methods: {
 			// 获取任务列表
@@ -61,9 +63,21 @@
 				uni.redirectTo({
 					url: '/pages/userCenter/zhinan'
 				})
+			},
+			// 做任务
+			toDoTask(taskCode){
+				doTask({luckyDrawNo:this.luckDraw.luckyDrawNo,taskCode:taskCode}).then(res => {
+					if(res.status == 200){
+						uni.showToast({
+							icon: 'none',
+							title: '分享成功'
+						})
+					}
+				})
 			}
 		},
 		onShareAppMessage() {
+			this.toDoTask('SHARE_FRIEND')
 			return {
 			      title: '[乐色管家]年末活动来袭,幸福大转盘, 精彩好礼等你来抽!',
 			      path: '/pagesA/luckDraw/luckDraw',
@@ -71,6 +85,7 @@
 			    }
 		},
 		onShareTimeline() {
+			this.toDoTask('SHARE_FRIEND')
 			return {
 				title: '[乐色管家]年末活动来袭,幸福大转盘, 精彩好礼等你来抽!',
 				imageUrl:'/static/zpthumbr.jpg'

+ 0 - 0
static/FIRST_DELIVER.png → static/NEW_FIRST_DELIVER.png


+ 0 - 0
static/OLD_CUSTOMER_BACK.png → static/OLD_FIRST_DELIVER.png