Commit ffbd7daf authored by Edwise's avatar Edwise 🍷

爱德2021年5月份迭代,加入light接口。

parent 1ef87837
...@@ -983,24 +983,38 @@ export class NetManager extends ABNetManager { ...@@ -983,24 +983,38 @@ export class NetManager extends ABNetManager {
} }
public yyh_index(callback: Function): void { public yyh_index(callback: Function): void {
const param: any = { const param: any = {
appID:window["appId"] appID: window["appId"]
}; };
const net: INetData = { const net: INetData = {
name: 'yyh_index', name: 'yyh_index',
uri: '/projectx/'+window['projectID']+'/lightenYun/join.do?_=' +new Date().getTime(),//'/projectx/'+window['projectID']+'/join_1/join.do?_=' +new Date().getTime(), uri: '/projectx/' + window['projectID'] + '/lightenYun/join.do?_=' + new Date().getTime(),//'/projectx/'+window['projectID']+'/join_1/join.do?_=' +new Date().getTime(),
type: 'get', type: 'get',
dataType: 'json', dataType: 'json',
param: param, param: param,
callback: callback, callback: callback,
hideMsg:true hideMsg: true
}; };
this.send(net); this.send(net);
} }
public yyh_light(param,callback: Function): void {
console.log("调用点亮")
const net: INetData = {
name: 'yyh_index',
uri: '/projectx/' + window['projectID'] + '/lightYun/light.do?_=' + new Date().getTime(),//'/projectx/'+window['projectID']+'/join_1/join.do?_=' +new Date().getTime(),
type: 'get',
dataType: 'json',
param: param,
callback: callback,
hideMsg: true
};
this.getToken(net);
}
public getProjectUserInfo(callback: Function): void { public getProjectUserInfo(callback: Function): void {
const param: any = { const param: any = {
}; };
const net: INetData = { const net: INetData = {
name: 'getProjectUserInfo', name: 'getProjectUserInfo',
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<e:Image id="line2" source="start选中_png" x="60" y="72" visible="false"/> <e:Image id="line2" source="start选中_png" x="60" y="72" visible="false"/>
</e:Group> </e:Group>
</e:Group> </e:Group>
<e:Label id="tips" text="我完成的活动1个" y="408" textColor="0x2d2d2d" right="38" size="28" /> <e:Label id="tips" text="我完成的活动1个" y="408" textColor="0x2d2d2d" right="38" size="28" visible="false"/>
<e:Scroller id="scroll" width="698" y="479" height="675" scrollPolicyH="off" scrollPolicyV="on" x="29"> <e:Scroller id="scroll" width="698" y="479" height="675" scrollPolicyH="off" scrollPolicyV="on" x="29">
<e:Group> <e:Group>
<e:List id="list" width="698" itemRendererSkinName="ItemSkin"> <e:List id="list" width="698" itemRendererSkinName="ItemSkin">
......
export function getToken() {
console.log('尝试获取token');
return new Promise((s, j) => {
if (window.location.port == '8080') {
s('dev-token');
} else {
if (window['getPxToken']) {
window['getPxToken'](function (e, token) {
switch (e) {
case 'net error':
// showToast(`getToken: ${e}`);
s(null);
break;
case 'need login':
// showToast(`getToken: ${e}`);
s(null);
break;
case 'state invalid':
// showToast(`getToken: ${e}`);
s(null);
break;
default:
if (token) {
s(token);
} else {
// showToast(`getToken: invalid key`);
s(null);
}
break;
}
});
} else {
// showToast(`getToken: no ready`);
s(null);
}
}
})
}
\ No newline at end of file
import { showToast } from "../../libs/new_wx/ctrls/toastCtrl";
import getSkinPath from "../../libs/new_wx/utils/getSkinPath"; import getSkinPath from "../../libs/new_wx/utils/getSkinPath";
import { DataManager } from "../../libs/tw/manager/DataManager";
import { NetManager } from "../../libs/tw/manager/NetManager";
import { getToken } from "../const";
export default class StartItem extends eui.ItemRenderer { export default class StartItem extends eui.ItemRenderer {
...@@ -6,32 +10,71 @@ export default class StartItem extends eui.ItemRenderer { ...@@ -6,32 +10,71 @@ export default class StartItem extends eui.ItemRenderer {
super(); super();
this.skinName = getSkinPath('Item'); this.skinName = getSkinPath('Item');
} }
/**
* activityStatus:
* 0:未开始
* 1:进行中
* 2:已结束
*/
dataChanged() { dataChanged() {
if(this.data.activityStatus!=0){ this.touchChildren = false;
this.addEventListener(egret.TouchEvent.TOUCH_TAP,()=>{ if (this.data.activityStatus != 0) {
location.href = this.data.activityUrl; if (this.hasEventListener(egret.TouchEvent.TOUCH_TAP)) return;
},this); this.addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
this.touchEnabled = false;
setTimeout(() => {
if (this) this.touchEnabled = true;
}, 2000)
console.log("点击了", parseInt(this.data.activityId))
if (this.data.activityStatus == 2) {
console.log("跳转了")
location.href = this.data.activityUrl;
} else {
let activityId = parseInt(this.data.activityId);
const { data } = DataManager.ins.getData('yyh_index');
if (activityId >= 3 && !isNaN(activityId) && data.lighten != 1) {
getToken().then((token) => {
if (!token) {
showToast('网络异常,请稍后重试');
return;
}
NetManager.ins.yyh_light({ activityId: this.data.activityId, token: token }, (success, res) => {
console.log("调接口跳转了,,,-->>", res)
if (!success) {
showToast('网络异常,请稍后重试')
return;
}
location.href = this.data.activityUrl;
})
}).catch(() => {
showToast('网络异常,请稍后重试')
})
} else {
location.href = this.data.activityUrl;
}
}
}, this);
} }
this['img0'].visible=false;
this['img2'].visible=false;
this['img1'].visible=false;
this['status0'].visible=false;
this['status1'].visible=false;
this['status2'].visible=false;
this['status3'].visible=false;
this[`status${this.data.userStatus}`].visible=true; this['img0'].visible = false;
this[`img${this.data.activityStatus}`].visible=true; this['img2'].visible = false;
this['img1'].visible = false;
this['status0'].visible = false;
this['status1'].visible = false;
this['status2'].visible = false;
this['status3'].visible = false;
this[`status${this.data.userStatus}`].visible = true;
this[`img${this.data.activityStatus}`].visible = true;
if(this.data.userStatus==3) { if (this.data.userStatus == 3) {
this[`img${this.data.activityStatus}`].visible=false; this[`img${this.data.activityStatus}`].visible = false;
} }
if(this.data.activityStatus == 2||this.data.activityStatus == 0) { if (this.data.activityStatus == 2 || this.data.activityStatus == 0) {
if(this.data.userStatus!=3) if (this.data.userStatus != 3)
this[`status${this.data.userStatus}`].visible=false; this[`status${this.data.userStatus}`].visible = false;
} }
} }
} }
\ No newline at end of file
...@@ -18,7 +18,7 @@ export default class Start1Scene extends Scene { ...@@ -18,7 +18,7 @@ export default class Start1Scene extends Scene {
console.error("显示xxx",data); console.error("显示xxx",data);
this['notLightImg'].visible = !data.lighten; this['notLightImg'].visible = !data.lighten;
this['lightImg'].visible = data.lighten; this['lightImg'].visible = data.lighten;
this['tips'].text = `我完成的活动${data.completeCount}个`; // this['tips'].text = `我完成的活动${data.completeCount}个`;
this.list.itemRenderer = StartItem; this.list.itemRenderer = StartItem;
this.list.dataProvider = new eui.ArrayCollection(data.activityList); this.list.dataProvider = new eui.ArrayCollection(data.activityList);
......
...@@ -6,6 +6,9 @@ const config = { ...@@ -6,6 +6,9 @@ const config = {
'/projectx/p0a89d550/lightenYun/join.do': { '/projectx/p0a89d550/lightenYun/join.do': {
data: './esports/index.json' data: './esports/index.json'
}, },
'/projectx/p0a89d550/lightYun/light.do': {
data: './esports/light.json'
},
'/customActivity/esports/recentlyGetJoinTimes': { '/customActivity/esports/recentlyGetJoinTimes': {
data: './esports/recentlyGetJoinTimes.json' data: './esports/recentlyGetJoinTimes.json'
}, },
......
...@@ -5,10 +5,10 @@ ...@@ -5,10 +5,10 @@
"activityList": [{ "activityList": [{
"activityId": "", "activityId": "",
"activityUrl": "https://campaign.geely.com/special/2019/10/dhmls?userId=", "activityUrl": "https://campaign.geely.com/special/2019/10/dhmls?userId=",
"userStatus": 0, "userStatus": 1,
"sourceType": 1, "sourceType": 1,
"activityName": "吉利向上马拉松", "activityName": "吉利向上马拉松",
"activityStatus": 2, "activityStatus": 1,
"banner": "https://yun.duiba.com.cn/db_games/jldhlogo.png", "banner": "https://yun.duiba.com.cn/db_games/jldhlogo.png",
"completeTime": 0, "completeTime": 0,
"startTime": 1572624000, "startTime": 1572624000,
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
}, { }, {
"activityId": "", "activityId": "",
"activityUrl": "http://aghzapi.zjkczn.com/h5/pages/luckyActivity/#/", "activityUrl": "http://aghzapi.zjkczn.com/h5/pages/luckyActivity/#/",
"userStatus": 0, "userStatus": 1,
"sourceType": 1, "sourceType": 1,
"activityName": "中国移动高校迎光跑", "activityName": "中国移动高校迎光跑",
"activityStatus": 0, "activityStatus": 0,
......
{
"code": "commodo quis consequat velit",
"message": "fugiat commodo dolore officia",
"success": true
}
\ No newline at end of file
This diff is collapsed.
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