Commit f2a8884a authored by Edwise's avatar Edwise 🍷

Merge remote-tracking branch 'refs/remotes/origin/tianmaoxiaoyuan' into tianmaoxiaoyuan

parents ea06387f 3d035dd5
......@@ -15,7 +15,7 @@
{
"completeTimes": 0,
"rewards": 10,
"sellerId": "wwwww",
"sellerId": "oooo",
"status": 1,
"taskRateType": 1,
"taskType": "follow",
......@@ -24,7 +24,7 @@
{
"completeTimes": 0,
"rewards": 10,
"sellerId": "oooo",
"sellerId": "wwwww",
"status": 1,
"taskRateType": 1,
"taskType": "follow",
......
import cloud from '@tbmp/mp-cloud-sdk';
import tbcc from './tbcc-sdk';
const env = 'test' // 云函数环境 test 测试环境 online 线上环境
cloud.init({
env: 'test' // 云函数环境 test 测试环境 online 线上环境
env: env
});
App({
env,
requestType: 'cloud', // yapi,cloud: 云函数
// requestType: 'local', // yapi,cloud: 云函数
cloudName: 'tmallCat', // 主云函数项目名 tmallCat
......
......@@ -12,8 +12,8 @@
<image class="task_inviteicon " src={{resList['61cf4c2c-54e4-4cde-aa16-78ee5d17ab06'].url}} />
<image class="task_focusicon " src={{resList['61cf4c2c-54e4-4cde-aa16-78ee5d17ab06'].url}} />
<image class="task_readicon " src={{resList['61cf4c2c-54e4-4cde-aa16-78ee5d17ab06'].url}} />
<label class="task_title ">签到</label>
<label class="task_award ">精力 +10</label>
<label class="task_title ">{{item.title}}</label>
<label class="task_award ">精力 +{{item.rewards}}</label>
<label class="task_progress ">(10/10)</label>
</view>
</view>
......
......@@ -5,16 +5,39 @@ import API from '../../api';
const app = getApp();
const { tbcc } = app;
const { commonToast } = tbcc.tb;
const findTask = (key, list) => {
const result = list.filter(i => i.taskType == key);
if (!result || result.length == 0) throw new Error(`不存在key=${key}的任务,请检查接口`)
return result[0]
};
const findFollowTask = (key, list) => {
const result = list.filter(i => i.taskType == key);
if (!result || result.length == 0) throw new Error(`不存在key=${key}的任务,请检查接口`)
return result;
};
Component({
props: {},
data: { resList: resList, list: [
1,2,3,4
] },
data: {
resList: resList, list: []
},
async didMount() {
const { success, data, message } = await API.getTaskList().catch(res => {
commonToast(res && res.message);
}) || {};
//签到邀请关注浏览
let list = [
findTask('sign', data),
findTask('invites', data)
];
list = list.concat(findFollowTask('follow', data));
list.push(findTask('browseGoods', data));
if (success && data) {
this.setData({ list })
}
},
methods: {
......
......@@ -29,7 +29,7 @@ Page({
catType: 1,
catName: '',
recallCatInfo: {},
taskModalVisible: false,
taskModalVisible: 1,
messageModalVisible: false,
messageModalData: {},
ruleModalVisible: false,
......@@ -68,6 +68,15 @@ Page({
my.__onMessage__ = (e) => {
this.onMessage(e)
}
my.__getdata__ = (key) => {
my.__onMessage__({
data: {
netName: 'tmallCat.'+key
}
})
}
my.__showModal__ = (key, data) => {
this.onMessage({
data: {
......@@ -160,7 +169,7 @@ Page({
//接口名字
let netName = e.data.netName; //接口参数
let parameter = e.data.parameter; //暂时发现3个需要用户操作的接口
let parameter = e.data.parameter||{};
//定制的授权
if (netName.indexOf("mine") == 0) {
......@@ -223,6 +232,7 @@ Page({
parameter.activityId = app.activityId;
fc.invoke(myCloudName, parameter, handler).then(res => {
this.postMessage(netName, res);
console.log('request Cloud callback=>', handler, res, JSON.stringify(res));
});
}
},
......
......@@ -28,6 +28,7 @@ Page({
async handleClick(e) {
if (flag) return;
my.showLoading();
flag = 1;
const { item } = e.target.dataset;
const { _id, code, type } = item;
......@@ -36,6 +37,7 @@ Page({
const { success, data, message } = await API.exchangeGood(params).catch(res => {
commonToast(res && res.message);
}) || {};
my.hideLoading();
if (success && data) {
this.setData({ exchangedModalVisible: 1, exchangedModalData: item })
......
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