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