Commit 0c78f968 authored by mqf_0707's avatar mqf_0707

浏览等页面更新接收数据返回参数

parent d51c4044
......@@ -6,7 +6,7 @@ cloud.init({
});
App({
requestType: 'tornadoAPI', // cloud: 云函数, yapi: yapi 接口, ams: ams接口,tornadoAPI: 风驰台接口
requestType: 'yapi', // cloud: 云函数, yapi: yapi 接口, ams: ams接口,tornadoAPI: 风驰台接口
cloudName: 'CommonToC', // 主云函数项目名
tornadoAPI: 'https://tornado.duibadev.com.cn/tbServer/api?db=xxx&proxyIp=xxx', // 新增:当requestType: 'tornadoAPI'时,找服务端提供地址
cloud,
......
......@@ -11,31 +11,31 @@
<!-- 复制按钮 -->
<image class="my-prize-copy" data-text="{{item._id}}" onTap="handleCopyId" src="{{task.image.copyIcon}}" />
</view>
<view class="my-prize-tip" a:if="{{item.drawStatus === PRIZE_DRAW_STATUS_MAP.FAILURE}}">{{item.remark}}</view>
<view class="my-prize-tip" a:if="{{item.drawStatus === PRIZE_DRAW_STATUS_MAP.REPEAT || (item.drawStatus === PRIZE_DRAW_STATUS_MAP.RECEIVE)}}">请于{{endTime}}前领取</view>
<view class="my-prize-tip" a:if="{{item.drawStatus === PRIZE_DRAW_STATUS_MAP.FINISHED }}">奖品已过期失效</view>
<view class="my-prize-tip" a:if="{{item.drawStatus === DRAW_STATUS.FAIL}}">{{item.remark}}</view>
<view class="my-prize-tip" a:if="{{item.drawStatus === DRAW_STATUS.RETRY || (item.drawStatus === DRAW_STATUS.WAITAWARD)}}">请于{{endTime}}前领取</view>
<view class="my-prize-tip" a:if="{{item.drawStatus === DRAW_STATUS.EXPIRED }}">奖品已过期失效</view>
</view>
<view class="prize-status" style="{{task.btnStyle}}">
<!-- 未领取 -->
<block a:if="{{item.drawStatus===PRIZE_DRAW_STATUS_MAP.RECEIVE}}">
<block a:if="{{item.drawStatus===DRAW_STATUS.WAITAWARD}}">
<!-- 实物填写地址 -->
<image a:if="{{item.type === PRIZE_TYPE_MAP.ENTITY}}" onTap="handleClick" data-item="{{item}}" src="{{task.image.addressBth}}" />
<image a:if="{{item.type === PRIZE_TYPE.OBJECT}}" onTap="handleClick" data-item="{{item}}" src="{{task.image.addressBth}}" />
<!-- 优惠券立即领取 -->
<image a:else onTap="handleClick" data-item="{{item}}" src="{{task.image.getBth}}" />
</block>
<!-- 已领取 -->
<block a:if="{{item.drawStatus===PRIZE_DRAW_STATUS_MAP.SUCCESS}}">
<block a:if="{{item.drawStatus===DRAW_STATUS.SUCCESS}}">
<!-- 实物查看物流 -->
<image a:if="{{item.type === PRIZE_TYPE_MAP.ENTITY}}" onTap="handleView" data-item="{{item}}" src="{{task.image.logisticsBth}}" />
<image a:if="{{item.type === PRIZE_TYPE.OBJECT}}" onTap="handleView" data-item="{{item}}" src="{{task.image.logisticsBth}}" />
<!-- 优惠券去使用 -->
<image a:else onTap="handleTouse" data-item="{{item}}" src="{{task.image.useBtn}}" />
</block>
<!-- 重新领取 -->
<image a:if="{{item.drawStatus===PRIZE_DRAW_STATUS_MAP.REPEAT}}" onTap="handleClick" data-item="{{item}}" src="{{task.image.getAgainBtn}}" />
<image a:if="{{item.drawStatus===DRAW_STATUS.RETRY}}" onTap="handleClick" data-item="{{item}}" src="{{task.image.getAgainBtn}}" />
<!-- 已失效 -->
<image a:if="{{item.drawStatus===PRIZE_DRAW_STATUS_MAP.FINISHED}}" src="{{task.image.invalidBtn}}" />
<image a:if="{{item.drawStatus===DRAW_STATUS.EXPIRED}}" src="{{task.image.invalidBtn}}" />
<!-- 领取失败 -->
<image a:if="{{item.drawStatus===PRIZE_DRAW_STATUS_MAP.FAILURE}}" src="{{task.image.failBth}}" />
<image a:if="{{item.drawStatus===DRAW_STATUS.FAIL}}" src="{{task.image.failBth}}" />
</view>
</view>
</view>
......
......@@ -2,12 +2,12 @@
const app = getApp();
const { tbcc } = app;
const { commonToast, navigateToOutside, getUserAddress, setClipboard } = tbcc.tb;
const { PRIZE_TYPE_MAP, PRIZE_DRAW_STATUS_MAP } = tbcc.constants;
const { PRIZE_TYPE, DRAW_STATUS } = tbcc.constants;
Component({
mixins: [],
data: {
PRIZE_TYPE_MAP,
PRIZE_DRAW_STATUS_MAP,
PRIZE_TYPE,
DRAW_STATUS,
currentPrize: {},
isLogistic: false,
},
......
......@@ -7,6 +7,11 @@
"version": "1.3.4",
"resolved": "https://registry.npm.taobao.org/@tbmp/mp-cloud-sdk/download/@tbmp/mp-cloud-sdk-1.3.4.tgz",
"integrity": "sha1-+1HCYryYfVc0kze0SOWv1oL6xgk="
},
"crypto": {
"version": "1.0.1",
"resolved": "https://registry.npm.taobao.org/crypto/download/crypto-1.0.1.tgz",
"integrity": "sha1-KvG3ytgXXSTIobB3glV5SiGAMDc="
}
}
}
......@@ -6,5 +6,5 @@
onCompleteTask="onCompleteTask" />
<!-- 倒计时 -->
<count-down-modal a:if="{{isShowCountdown}}" percent="{{percent}}" hasPercent="{{(10 - usePercent)}}" styleType="{{'01'}}" />
<count-down-modal a:if="{{isShowCountdown && completeType == 1}}" percent="{{percent}}" hasPercent="{{(10 - usePercent)}}" styleType="{{'01'}}" />
</view>
\ No newline at end of file
......@@ -14,15 +14,16 @@
* color: //商品名称:文字颜色
* }
*/
import API from '../../api';
const app = getApp();
const { tbcc } = app;
const { commonToast } = tbcc.tb;
import API from '../../api';
const completeType = 1 // 1 浏览完成 2 点击任意商品完成
Page({
completeType: '01',//01:浏览完成 02点击任意商品完成
timer: null,
data: {
completeType: completeType,
usePercent: 0, // 已进行的进度条
percent: 0,// 进度条
isShowCountdown: true, // 是否显示倒计时
......@@ -36,7 +37,7 @@ Page({
},
onShow() {
//重新回到页面开启倒计时
if(!this.timer && this.completeType == '01') {
if(!this.timer && completeType == 1) {
this.setData({ usePercent: this.data.percent })
this.browseGoodsTimes()
console.log(10 - this.usePercent)
......@@ -80,7 +81,7 @@ Page({
res && commonToast(res)
}) || {}
if(success) {
this.setData({ goodsList: data || [] })
this.setData({ goodsList: data.list || [] })
}
},
//任务完成
......@@ -97,7 +98,7 @@ Page({
* 跳转商品详情页
*/
onOpenDetail(itemId = '') {
if(this.completeType == '01') {
if(completeType == 1) {
this.setData({
percent: this.data.usePercent,
}, () => {
......
......@@ -57,7 +57,7 @@ Page({
res && commonToast(res)
}) || {}
if(success) {
this.setData({ goodsList: data || [] })
this.setData({ goodsList: data.list || [] })
}
},
//任务完成 616444374083
......
......@@ -5,12 +5,12 @@ const app = getApp();
const { tbcc } = app;
const { commonToast, navigateToOutside, getUserAddress, setClipboard } = tbcc.tb;
const { dateFormatter, throttleHandle } = tbcc.utils;
const { PRIZE_TYPE_MAP, PRIZE_DRAW_STATUS_MAP } = tbcc.constants;
const { PRIZE_TYPE, DRAW_STATUS } = tbcc.constants;
Page({
data: {
PRIZE_TYPE_MAP,
PRIZE_DRAW_STATUS_MAP,
PRIZE_TYPE,
DRAW_STATUS,
myPrizeList: null, //我的奖品
endTime: null,//到期时间
task: {
......@@ -85,11 +85,11 @@ Page({
handleClick: throttleHandle(async function(e) {
const { item } = e.target.dataset;
// 领取权益
if (item.type === PRIZE_TYPE_MAP.EQUITY) return this.handleGetEquity(e)
if (item.type === PRIZE_TYPE.ENAME) return this.handleGetEquity(e)
// 领取实物
if (item.type === PRIZE_TYPE_MAP.ENTITY) return this.handleGetEntity(e)
if (item.type === PRIZE_TYPE.OBJECT) return this.handleGetEntity(e)
// 领取积分
if (item.type === PRIZE_TYPE_MAP.INTEGRATION) return this.handleGetIntergation(e)
if (item.type === PRIZE_TYPE.CREDITS) return this.handleGetIntergation(e)
},1000),
// 优惠券
async handleGetEquity(e) {
......
......@@ -58,7 +58,7 @@ Page({
res && commonToast(res)
}) || {}
if(success) {
this.setData({ goodsList: data || [] })
this.setData({ goodsList: data.list || [] })
}
},
});
......@@ -8,10 +8,10 @@ const capi = {
receiveEnamePrize: { method: 'GET', handle: 'receiveEnamePrize' },
getItemListByItemIds: { method: 'GET', handle: 'getItemListByItemIds' },
getCollectGoodsList: { method: 'GET', handle: 'getCollectGoodsList' },
doCollectGoodsTask: { method: 'GET', handle: 'doCompleteTask', dedaultParams: { taskType: 'collectGoods'} },
doBrowseGoodsTask: { method: 'GET', handle: 'doCompleteTask', dedaultParams: { taskType: 'browseGoods'} },
doJumpLinkTask: { method: 'GET', handle: 'doCompleteTask', dedaultParams: { taskType: 'jumpLink'} },
doExchangeCreditsTask: { method: 'GET', handle: 'doCompleteTask', dedaultParams: { taskType: 'exchangeCredits'} },
doCollectGoodsTask: { method: 'GET', handle: 'doCompleteTask', defaultParams: { taskType: 'collectGoods'} },
doBrowseGoodsTask: { method: 'GET', handle: 'doCompleteTask', defaultParams: { taskType: 'browseGoods'} },
doJumpLinkTask: { method: 'GET', handle: 'doCompleteTask', defaultParams: { taskType: 'jumpLink'} },
doExchangeCreditsTask: { method: 'GET', handle: 'doCompleteTask', defaultParams: { taskType: 'exchangeCredits'} },
getVipInfo: { method: 'GET', handle: 'getVipInfo' }
};
......
......@@ -34,21 +34,4 @@ export const PRIZE_TYPE = {
CREDITS: 2,
OBJECT: 3,
THANKS: 5
};
// 我的奖品状态
export const PRIZE_DRAW_STATUS_MAP = {
RECEIVE: 1, // 待领取
DEALING: 2, // 处理中
SUCCESS: 3, // 领取成功
FAILURE: 4, // 领取失败
FINISHED: 5, // 已过期
REPEAT: 6, // 重新领取
}
// 奖品类型
export const PRIZE_TYPE_MAP = {
EQUITY: 1, // 权益
INTEGRATION: 2, // 积分
ENTITY: 3, // 实物
THANKS: 5 // 谢谢参与
}
\ No newline at end of file
};
\ No newline at end of file
......@@ -68,11 +68,11 @@ export const getRequestParams = value => {
ext: {}
}
} else if (typeof value === 'object') {
const { handle, method = 'POST', dedaultParams = {}, ...ext } = value;
const { handle, method = 'POST', defaultParams = {}, ...ext } = value;
return {
handle,
method,
dedaultParams,
defaultParams,
ext: { ...ext }
}
} else {
......
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