Commit f054e24f authored by wildfirecode13's avatar wildfirecode13

1

parent b32a8b99
This diff is collapsed.
...@@ -23,6 +23,11 @@ const request = tbccRequest({ ...@@ -23,6 +23,11 @@ const request = tbccRequest({
// api handle 列表 // api handle 列表
const apiList = { const apiList = {
...capi, ...capi,
doHelp: {
handle: 'doHelp',
method: 'get',
isShowLoading: false
},
doFollowTask: { doFollowTask: {
handle: 'doFollowTask', handle: 'doFollowTask',
method: 'get', method: 'get',
......
...@@ -9,7 +9,7 @@ cloud.init({ ...@@ -9,7 +9,7 @@ cloud.init({
App({ App({
env, env,
requestType: 'cloud', // yapi,cloud: 云函数 requestType: 'cloud', // yapi,cloud: 云函数
requestType: 'local', // yapi,cloud: 云函数 // requestType: 'local', // yapi,cloud: 云函数
cloudName: 'tmallCat', // 主云函数项目名 tmallCat cloudName: 'tmallCat', // 主云函数项目名 tmallCat
// cloudName: 'bubbleSurviva', // 主云函数项目名 tmallCat // cloudName: 'bubbleSurviva', // 主云函数项目名 tmallCat
cloud, cloud,
......
...@@ -81,6 +81,9 @@ Component({ ...@@ -81,6 +81,9 @@ Component({
await this.handleGoFollow(sellerId); await this.handleGoFollow(sellerId);
await this.getTaskList(); await this.getTaskList();
break; break;
case 'invites':
my.showSharePanel();
break;
default: default:
console.log('handleTapGoBtn', taskType); console.log('handleTapGoBtn', taskType);
break; break;
......
import * as FYGE from "fyge-tbmini"; import * as FYGE from "fyge-tbmini";
import * as SvgaParser from "svga-parser";
(function webpackUniversalModuleDefinition(root, factory) { (function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object') if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(); module.exports = factory();
...@@ -16,6 +16,13 @@ const { ...@@ -16,6 +16,13 @@ const {
getSystemInfo getSystemInfo
} = tbcc.tb; } = 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 checkSystem = async () => {
const { const {
version version
...@@ -44,9 +51,27 @@ Page({ ...@@ -44,9 +51,27 @@ Page({
catbackbedModalVisible: false, catbackbedModalVisible: false,
catruleModalVisible: 0 catruleModalVisible: 0
}, },
async doHelp() {
onLoad(props) { if(!app.inviteId) return;
commonToast('正在发起助力~')
const { success, data, message } = await API.doHelp({ inviteId: app.inviteId }).catch(res => {
commonToast(res && res.message);
}) || {};
if (success) {
commonToast('助力成功~');
}
},
onLoad(query) {
this.setData({}); 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 => { checkSystem().then(r => {
if (!r) { if (!r) {
...@@ -61,52 +86,52 @@ Page({ ...@@ -61,52 +86,52 @@ Page({
async onReady() { async onReady() {
console.log('on ready') console.log('on ready')
//授权和登录先搞 //授权和登录先搞
await this.getAuth(); // await this.getAuth();
this.initCanvas();
my.__onMessage__ = (e) => { // this.initCanvas();
this.onMessage(e) // my.__onMessage__ = (e) => {
} // this.onMessage(e)
// }
my.__getdata__ = (key) => {
my.__onMessage__({ // my.__getdata__ = (key) => {
data: { // my.__onMessage__({
netName: 'tmallCat.' + key // data: {
} // netName: 'tmallCat.' + key
}) // }
} // })
// }
my.__showModal__ = (key, data) => {
this.onMessage({ // my.__showModal__ = (key, data) => {
data: { // this.onMessage({
netName: 'mine.showModal', // data: {
parameter: { // netName: 'mine.showModal',
name: key + 'Modal', // parameter: {
data: data // name: key + 'Modal',
} // data: data
} // }
}); // }
} // });
my.__pageTo__ = (key, data) => { // }
this.onMessage({ // my.__pageTo__ = (key, data) => {
data: { // this.onMessage({
netName: 'mine.navigateToPage', // data: {
parameter: { // netName: 'mine.navigateToPage',
name: key // parameter: {
} // name: key
} // }
}); // }
} // });
// }
my.__updateUserInfo__ = () => { my.__updateUserInfo__ = () => {
console.log("通知canvas刷新用户信息") console.log("通知canvas刷新用户信息")
this.main && this.main.dispatchGlobalEvent("UPDATE_USERINFO") this.main && this.main.dispatchGlobalEvent("UPDATE_USERINFO")
} }
setTimeout(() => { // setTimeout(() => {
my.__pageTo__('myprize') // my.__pageTo__('myprize')
}, 100); // }, 100);
}, },
initCanvas() { initCanvas() {
...@@ -137,14 +162,16 @@ Page({ ...@@ -137,14 +162,16 @@ Page({
this.main.addGlobalEvent("toast", self.showToastHandler, self); this.main.addGlobalEvent("toast", self.showToastHandler, self);
this.main.addGlobalEvent("loading", self.showLoadingHandler, self); this.main.addGlobalEvent("loading", self.showLoadingHandler, self);
this.main.addGlobalEvent("hideloading", self.hideLoadingHandler, self); this.main.addGlobalEvent("hideloading", self.hideLoadingHandler, self);
this.doHelp();
} }
}, },
fail: () => { console.log('createCanvas fail'); } fail: () => { console.log('createCanvas fail'); }
}); });
}, },
onCanvasReady() { onCanvasReady(query) {
console.log('onCanvasReady') console.log('onCanvasReady',query)
//授权和登录先搞 //授权和登录先搞
checkSystem().then(r => { checkSystem().then(r => {
if (r) { if (r) {
...@@ -195,7 +222,8 @@ Page({ ...@@ -195,7 +222,8 @@ Page({
activityId: app.activityId, activityId: app.activityId,
nickName: app.nickName, nickName: app.nickName,
avatar: app.avatar, avatar: app.avatar,
openId: app.openId openId: app.openId,
inviteId: app.inviteId
} }
}; };
break; break;
...@@ -272,35 +300,36 @@ Page({ ...@@ -272,35 +300,36 @@ Page({
* 获取用户授权信息 * 获取用户授权信息
*/ */
async getAuth() { async getAuth() {
return new Promise(async (s,r)=>{ return new Promise(async (s, r) => {
const userInfo = await getAuthUserInfo().catch(err => { const userInfo = await getAuthUserInfo().catch(err => {
console.log('未授权成功', err); console.log('未授权成功', err);
r(); r();
}); });
if (userInfo) { if (userInfo) {
console.log('授权成功 userInfo', userInfo); console.log('授权成功 userInfo', userInfo);
const { const {
nickName, nickName,
avatar avatar
} = userInfo; } = userInfo;
app.nickName = nickName; app.nickName = nickName;
app.avatar = avatar; app.avatar = avatar;
await this.login(); await this.login();
s(); this.initCanvas();
} s();
}) }
})
}, },
/** /**
* 登录接口 * 登录接口
*/ */
async login() { async login() {
return new Promise(async (s,r)=>{ return new Promise(async (s, r) => {
const { const {
nickName, nickName,
avatar avatar
} = app; } = app;
const { const {
success success, data,
} = await API.login({ } = await API.login({
userNick: nickName, userNick: nickName,
avatar avatar
...@@ -310,10 +339,11 @@ Page({ ...@@ -310,10 +339,11 @@ Page({
}) || {}; }) || {};
if (success) { if (success) {
data && (app.openId = data.openId);
s(); s();
} }
}) })
}, },
/**刷新用户信息 */ /**刷新用户信息 */
updateUserInfo() { updateUserInfo() {
...@@ -397,5 +427,18 @@ Page({ ...@@ -397,5 +427,18 @@ Page({
this.setData({ this.setData({
catruleModalVisible: false 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