Commit 81783dd7 authored by 吴江涛's avatar 吴江涛

任务

parent 5929d98d
import { getTaskInfo } from "../../utils/db_api/index";
// packages/wm-cloud-db_index/component/task/task.js
Component({
/**
* 组件的属性列表
*/
properties: {
},
lifetimes: {
attached () {
this.getTaskList();
},
},
/**
* 组件的初始数据
*/
data: {
taskList: []
},
/**
* 组件的方法列表
*/
methods: {
/** 关闭弹窗 */
closeDialog () {
this.triggerEvent("onModalClose", 'task');
},
/** 获取任务列表 */
async getTaskList () {
// const res = await getTaskInfo();
// if (res && res.success) {
// this.setData({
// taskList: res.data.item || []
// })
// }
// return
this.setData({
taskList: Array.from({length: 7}).fill({
buttonText: "去完成",
code: "invite",
completedSize: 0,
desc: null,
extra: '{"answerTimes":1,"drawTimes":0}',
icon: "//yun.duiba.com.cn/polaris/Image2.b9419702802eff6ec5ba50ac072086df45409bfd.jpg",
id: "0l0cha7n",
index: null,
indexes: null,
intervalLimitSize: 1,
intervalType: 4,
jumpUrl: "/",
options: [
{
degree: null,
icon: null,
icon2: null,
id: "sp_draw_times",
index: null,
name: "完成任务发放答题次数占位道具",
prizeId: "sp_draw_times",
prizeType: null,
refId: null,
refType: null,
sendCount: 1,
},
],
playwayId: "task_1",
prizePendingCode: null,
prizePendingCodeList: null,
ruleId: "spPrize@sp_draw_times@1",
sendPrize: null,
subTitle: "抽奖次数+1",
taskStatus: 0,
title: "完成首购任务",
})
})
},
/** 点击去完成 */
async handleClickDoComplete (e) {
const index = e.currentTarget.dataset.value || e.target.dataset.index;
const item = this.data.taskList[index] || {};
switch (true) {
/** 跳转积分商城任务 */
case item.code.startsWith("order"): {
wx.navigateTo({
url: 'url',
})
break;
}
/** 每日登录 */
case item.code.startsWith("sign"): {
wx.navigateTo({
url: 'url',
})
break;
}
/** 分享任务 */
case item.code.startsWith("share"): {
this.triggerEvent("select", {type: "normal"})
break;
}
/** 邀请任务 */
case item.code.startsWith("invite"): {
this.triggerEvent("select", {type: "share"});
break;
}
}
}
}
})
\ No newline at end of file
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<view class="task_mask"></view>
<view class="task pop_scroll_ani">
<view class="task_bg"></view>
<view class="close_btn" bind:tap="closeDialog"></view>
<view class="task_list">
<view wx:for="{{taskList}}" class="task_item" wx:key="*this">
<!-- 待领取 -->
<button wx:if="{{item.taskStatus == 1}}" class="reveive_btn" hover-class="none"></button>
<!-- 去完成 -->
<button wx:if="{{item.taskStatus == 0}}" open-type="{{item.code == 'invite'? 'share': ''}}" class="doComplete_btn" hover-class="none" bind:tap="handleClickDoComplete" data-index="{{index}}"></button>
<!-- 已完成 -->
<button wx:if="{{item.taskStatus == 2}}" class="completed_btn" hover-class="none"></button>
<view class="task_sub_box">
<view class="task_icon"></view>
<view class="task_sub_title">{{item.subTitle}}</view>
</view>
<view class="task_title">{{item.title}}</view>
</view>
</view>
</view>
\ No newline at end of file
.task_mask {
width: 100%;
height: 100%;
left: 0;
top: 0;
position: fixed;
background-color: rgba(0, 0, 0, 0.5);
}
.task {
width: 750rpx;
height: 895rpx;
left: 0rpx;
bottom: 0;
position: fixed;
}
.task .task_bg {
width: 750rpx;
height: 795rpx;
left: 0rpx;
top: 100rpx;
position: absolute;
background-image: url("https://yun.duiba.com.cn/aurora/assets/28851014d89856dfb822a1565e8cce4384deed7c.png");
background-repeat: no-repeat;
background-size: 100% 100%;
}
.task .close_btn {
width: 66rpx;
height: 67rpx;
left: 658rpx;
top: 0rpx;
position: absolute;
background-image: url("https://yun.duiba.com.cn/aurora/assets/283ad6cca268acb2385b8283ef21f01244f0f8b8.png");
background-repeat: no-repeat;
background-size: 100% 100%;
}
.task .task_list {
width: 670rpx;
height: auto;
left: 55rpx;
top: 277rpx;
bottom: 0;
position: absolute;
overflow-y: auto;
overflow-x: hidden;
}
.task .task_list .task_item {
width: 641rpx;
height: 100rpx;
left: 0rpx;
top: 0rpx;
margin-bottom: 20rpx;
position: relative;
}
.task .task_list .task_item .reveive_btn {
width: 125rpx;
height: 49rpx;
left: 516rpx;
top: 11rpx;
position: absolute;
background-image: url("https://yun.duiba.com.cn/aurora/assets/ae32f7ab4dbc2929778c75def30d8313107ba5f7.png");
background-repeat: no-repeat;
background-size: 100% 100%;
}
.task .task_list .task_item .completed_btn {
width: 125rpx;
height: 49rpx;
left: 516rpx;
top: 11rpx;
position: absolute;
background-image: url("https://yun.duiba.com.cn/aurora/assets/8430cefdfa860d74443f62d3e840f9bcb4458d6f.png");
background-repeat: no-repeat;
background-size: 100% 100%;
}
.task .task_list .task_item .doComplete_btn {
width: 125rpx;
height: 49rpx;
left: 516rpx;
top: 11rpx;
position: absolute;
background-image: url("https://yun.duiba.com.cn/aurora/assets/b058248f7d43e611133ed15b61e93f151e2ec9cf.png");
background-repeat: no-repeat;
background-size: 100% 100%;
}
.task .task_list .task_item .task_sub_box {
width: 480rpx;
height: 25rpx;
left: 1rpx;
top: 47rpx;
position: absolute;
display: flex;
justify-content: flex-start;
align-items: center;
}
.task .task_list .task_item .task_sub_box .task_sub_title {
width: 450rpx;
height: 30rpx;
left: 10rpx;
top: 0;
position: relative;
font-size: 21rpx;
line-height: 30rpx;
color: #9e9e9e;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.task .task_list .task_item .task_sub_box .task_icon {
width: 25rpx;
height: 25rpx;
left: 0rpx;
top: 0rpx;
position: relative;
background-image: url("https://yun.duiba.com.cn/aurora/assets/573e8f658ecdeda4eeb6d20ac312d9d7aa0f2ab0.png");
background-repeat: no-repeat;
background-size: 100% 100%;
flex-shrink: 0;
flex-basis: 25rpx;
}
.task .task_list .task_item .task_title {
width: 480rpx;
height: 32rpx;
left: 0rpx;
top: 0rpx;
position: absolute;
font-size: 32rpx;
line-height: 32rpx;
color: #292929;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.pop_scroll_ani {
animation: pop_scroll_ani 500ms ease-out forwards;
}
@keyframes pop_scroll_ani {
0% {
transform: translateY(100%);
}
100% {
transform: translateY(0);
}
}
button {
background-color: transparent;
outline: none;
border: none;
}
\ No newline at end of file
......@@ -16,10 +16,13 @@ import {
apiUploadFile,
apiUserRecord,
reqDbCheckHavePower,
reqDbLogin
reqDbLogin,
getShareCode
} from "../utils/db_api/index";
const defaultAvatarUrl = 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0'
let shareType = "normal";
Page({
data: {
guideIndex: -1,
......@@ -36,11 +39,14 @@ Page({
nickName: "",
activityStatus: 0,
isPlayMusic: true,
assistErrorMsg: ""
assistErrorMsg: "",
shareCode: null
},
onLoad: async function (options) {
/** 获取邀请码 */
// this.getShareCode();
// const q = decodeURIComponent(options.q) // 获取到二维码原始链接内容
// const scancode_time = parseInt(options.scancode_time) // 获取用户扫码时间 UNIX 时间戳
......@@ -873,14 +879,49 @@ Page({
isPlayMusic: index == '0'
})
},
/** 赚负担值 */
handleClickTask() {
this.setData({
showModalType: 'task'
})
},
/** 任务分享类型选择回调 */
onSelectShareType (e) {
const type = e.detail.type;
console.log("执行了")
shareType = type;
},
/** 获取邀请码 */
async getShareCode () {
const res = await getShareCode();
if (res && res.success) {
this.setData({
shareCode: res.data.inviteCode
})
}
},
onHide() {
this.innerAudioContext.stop()
// this.innerAudioContext.stop()
},
onShow() {
if (this.innerAudioContext && this.data.isPlayMusic) {
this.innerAudioContext.play()
}
},
/** 分享 */
onShareAppMessage() {
const param = {
title: "测试标题",
path: '/packages/wm-cloud-db_index/db_index/index',
imageUrl: "https://yun.duiba.com.cn/polaris/task_icon.573e8f658ecdeda4eeb6d20ac312d9d7aa0f2ab0.png",
}
console.log("shareType", shareType)
if (shareType == "share") {
param.path = `${param.path}?shareCode=${this.data.shareCode}`
}
console.log("param", param)
return param;
},
onUnload() {
this.innerAudioContext.stop()
}
......
......@@ -12,6 +12,7 @@
"assist-reflct-modal": "../component/assistReflctModal/index",
"auth-userinfo": "../component/authUserInfo/index",
"game-guide-modal": "../component/gameGuideModal/index",
"act-rule-modal":"../component/actRuleModal/index"
"act-rule-modal":"../component/actRuleModal/index",
"task": "../component/task/task"
}
}
\ No newline at end of file
......@@ -6,7 +6,7 @@
<view class="prizebtn"></view>
<view class="logo"></view>
<view class="title"></view>
<view class="taskicon"></view>
<view class="taskicon" bind:tap="handleClickTask"></view>
<view class="drawicon"></view>
<view class="creditsbg"></view>
......@@ -40,4 +40,5 @@
<assist-suc-modal wx:if="{{showModalType == 'assistSuc'}}" catch:onModalClose="onModalClose"></assist-suc-modal>
<auth-userinfo wx:if="{{isShowAuth}}" catch:onCancelFunc="cancelFunc" catch:onSaveFunc="saveFunc"></auth-userinfo>
<act-rule-modal wx:if="{{showModalType == 'actRule'}}" catch:onModalClose="onModalClose"></act-rule-modal>
<task wx:if="{{showModalType == 'task'}}" catch:onModalClose="onModalClose" bindselect="onSelectShareType"></task>
</view>
\ No newline at end of file
......@@ -108,4 +108,18 @@ export const userRecord = {
url: "/weimocloud/projectx/userRecord",
method: "GET",
header: {}
}
// 任务接口
export const getTaskInfoParam = {
url: "/weimocloud/projectx/taskInfo",
method: "GET",
header: {}
}
// 获取邀请码
export const getShareCodeParam = {
url: "/weimocloud/projectx/getShareCode",
method: "GET",
header: {}
}
\ No newline at end of file
......@@ -11,7 +11,9 @@ import {
doAssist,
getActivityStatus,
queryOrderId,
userRecord
userRecord,
getTaskInfoParam,
getShareCodeParam
} from "./dbrequest";
import {
globalData
......@@ -129,4 +131,20 @@ export const apiUserRecord = (param) => {
...userRecord,
data: param
})
}
// 任务接口
export const getTaskInfo = (param) => {
return requestFun({
...getTaskInfoParam,
data: param
})
}
// 获取邀请码
export const getShareCode = (param) => {
return requestFun({
...getShareCodeParam,
data: param
})
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment