Commit f054e24f authored by wildfirecode13's avatar wildfirecode13

1

parent b32a8b99
This diff is collapsed.
......@@ -23,6 +23,11 @@ const request = tbccRequest({
// api handle 列表
const apiList = {
...capi,
doHelp: {
handle: 'doHelp',
method: 'get',
isShowLoading: false
},
doFollowTask: {
handle: 'doFollowTask',
method: 'get',
......
......@@ -9,7 +9,7 @@ cloud.init({
App({
env,
requestType: 'cloud', // yapi,cloud: 云函数
requestType: 'local', // yapi,cloud: 云函数
// requestType: 'local', // yapi,cloud: 云函数
cloudName: 'tmallCat', // 主云函数项目名 tmallCat
// cloudName: 'bubbleSurviva', // 主云函数项目名 tmallCat
cloud,
......
......@@ -81,6 +81,9 @@ Component({
await this.handleGoFollow(sellerId);
await this.getTaskList();
break;
case 'invites':
my.showSharePanel();
break;
default:
console.log('handleTapGoBtn', taskType);
break;
......
import * as FYGE from "fyge-tbmini";
import * as SvgaParser from "svga-parser";
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
......@@ -16,6 +16,13 @@ const {
getSystemInfo
} = tbcc.tb;
const SHARE_CONFIG = {
title: '欧泊莱泡泡大作战',
desc: '快来领取我为你准备的超值小样吧',
imageUrl: "https://yun.duiba.com.cn/db_games/activity/pacman/share.jpg",
path: 'pages/pagecanvas/pagecanvas'
}
const checkSystem = async () => {
const {
version
......@@ -44,9 +51,27 @@ Page({
catbackbedModalVisible: false,
catruleModalVisible: 0
},
async doHelp() {
if(!app.inviteId) return;
commonToast('正在发起助力~')
const { success, data, message } = await API.doHelp({ inviteId: app.inviteId }).catch(res => {
commonToast(res && res.message);
}) || {};
onLoad(props) {
if (success) {
commonToast('助力成功~');
}
},
onLoad(query) {
this.setData({});
if (query.openId) app.inviteId = query.openId;
console.log('onload=>query', query);
// my.showToast({
// content: "query " + JSON.stringify(query),
// duration: 5000
// });
checkSystem().then(r => {
if (!r) {
......@@ -62,51 +87,51 @@ Page({
async onReady() {
console.log('on ready')
//授权和登录先搞
await this.getAuth();
this.initCanvas();
my.__onMessage__ = (e) => {
this.onMessage(e)
}
my.__getdata__ = (key) => {
my.__onMessage__({
data: {
netName: 'tmallCat.' + key
}
})
}
my.__showModal__ = (key, data) => {
this.onMessage({
data: {
netName: 'mine.showModal',
parameter: {
name: key + 'Modal',
data: data
}
}
});
}
my.__pageTo__ = (key, data) => {
this.onMessage({
data: {
netName: 'mine.navigateToPage',
parameter: {
name: key
}
}
});
}
// await this.getAuth();
// this.initCanvas();
// my.__onMessage__ = (e) => {
// this.onMessage(e)
// }
// my.__getdata__ = (key) => {
// my.__onMessage__({
// data: {
// netName: 'tmallCat.' + key
// }
// })
// }
// my.__showModal__ = (key, data) => {
// this.onMessage({
// data: {
// netName: 'mine.showModal',
// parameter: {
// name: key + 'Modal',
// data: data
// }
// }
// });
// }
// my.__pageTo__ = (key, data) => {
// this.onMessage({
// data: {
// netName: 'mine.navigateToPage',
// parameter: {
// name: key
// }
// }
// });
// }
my.__updateUserInfo__ = () => {
console.log("通知canvas刷新用户信息")
this.main && this.main.dispatchGlobalEvent("UPDATE_USERINFO")
}
setTimeout(() => {
my.__pageTo__('myprize')
}, 100);
// setTimeout(() => {
// my.__pageTo__('myprize')
// }, 100);
},
initCanvas() {
......@@ -137,14 +162,16 @@ Page({
this.main.addGlobalEvent("toast", self.showToastHandler, self);
this.main.addGlobalEvent("loading", self.showLoadingHandler, self);
this.main.addGlobalEvent("hideloading", self.hideLoadingHandler, self);
this.doHelp();
}
},
fail: () => { console.log('createCanvas fail'); }
});
},
onCanvasReady() {
console.log('onCanvasReady')
onCanvasReady(query) {
console.log('onCanvasReady',query)
//授权和登录先搞
checkSystem().then(r => {
if (r) {
......@@ -195,7 +222,8 @@ Page({
activityId: app.activityId,
nickName: app.nickName,
avatar: app.avatar,
openId: app.openId
openId: app.openId,
inviteId: app.inviteId
}
};
break;
......@@ -272,7 +300,7 @@ Page({
* 获取用户授权信息
*/
async getAuth() {
return new Promise(async (s,r)=>{
return new Promise(async (s, r) => {
const userInfo = await getAuthUserInfo().catch(err => {
console.log('未授权成功', err);
r();
......@@ -286,6 +314,7 @@ Page({
app.nickName = nickName;
app.avatar = avatar;
await this.login();
this.initCanvas();
s();
}
})
......@@ -294,13 +323,13 @@ Page({
* 登录接口
*/
async login() {
return new Promise(async (s,r)=>{
return new Promise(async (s, r) => {
const {
nickName,
avatar
} = app;
const {
success
success, data,
} = await API.login({
userNick: nickName,
avatar
......@@ -310,6 +339,7 @@ Page({
}) || {};
if (success) {
data && (app.openId = data.openId);
s();
}
})
......@@ -397,5 +427,18 @@ Page({
this.setData({
catruleModalVisible: false
})
},
onShareAppMessage() {
// 返回自定义分享信息
let { path, ...rest } = SHARE_CONFIG
if (app.openId) {
path = '/pages/pagecanvas/pagecanvas' + '?openId=' + app.openId;
}
console.log(path)
return {
...rest,
path
}
}
});
\ 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