Commit 78a7a259 authored by Edwise's avatar Edwise 🍷

2134

parent 05ee7ee4
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -10,5 +10,5 @@ export const ResJson = {
"name": "startScene"
}
],
"path": "https://yun.duiba.com.cn/db_games/activity/babycare_xiaoxiao/1600936371/resource/"
"path": "https://yun.duiba.com.cn/db_games/activity/babycare_xiaoxiao/1601003410/resource/"
}
\ No newline at end of file
......@@ -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,
......
......@@ -19,17 +19,20 @@ Component({
onModalClose && onModalClose();
console.log('onModalClose')
},
onPostSelectCat() {
const userInfo = API.getUserInfo().catch(res=>{
my.showToast({content:userInfo?userInfo.message:null})
async onPostSelectCat() {
const userInfo = await API.getUserInfo().catch(res=>{
my.showToast({content:res?res.message:null})
});
if(userInfo&&userInfo.success){
console.log("aaa",userInfo)
const {
onPostSelectCat
} = this.props;
console.log("领养完毕")
this.onModalClose();
// my.__updateUserInfo__();
onPostSelectCat && onPostSelectCat(userInfo);
}
}
},
......
<view disable-scroll="true" class="page-game">
<canvas disable-scroll="true" id="canvas" type="2d" class="canvas" onTouchStart="onMouseEvent" onTouchMove="onMouseEvent" onTouchEnd="onMouseEvent" onReady="onCanvasReady">
<canvas disable-scroll="true" id="canvas" class="canvas" onTouchStart="onMouseEvent" onTouchMove="onMouseEvent" onTouchEnd="onMouseEvent" onReady="onCanvasReady">
</canvas>
</view>
......
......@@ -39,7 +39,7 @@ Page({
catnameModalVisible: false,
recallcatModalVisible: false,
recallcatModalData: {},
getcatModalVisible: false,
getcatModalVisible: true,
getcatModalData: {},
catbackbedModalVisible: false,
catruleModalVisible: 0
......@@ -59,12 +59,13 @@ Page({
},
onReady() {
async onReady() {
console.log('on ready')
//授权和登录先搞
this.getAuth();
await this.getAuth();
this.initCanvas();
my.__onMessage__ = (e) => {
this.onMessage(e)
}
......@@ -104,7 +105,7 @@ Page({
}
},
init() {
initCanvas() {
console.log('do init');
this.spark_startEngine();
......@@ -266,8 +267,10 @@ Page({
* 获取用户授权信息
*/
async getAuth() {
return new Promise(async (s,r)=>{
const userInfo = await getAuthUserInfo().catch(err => {
console.log('未授权成功', err);
r();
});
if (userInfo) {
console.log('授权成功 userInfo', userInfo);
......@@ -277,29 +280,35 @@ Page({
} = userInfo;
app.nickName = nickName;
app.avatar = avatar;
this.login();
await this.login();
s();
}
})
},
/**
* 登录接口
*/
async login() {
const {
return new Promise(async (s,r)=>{
const {
nickName,
avatar
} = app;
const {
success
} = await API.login({
userNick: nickName,
avatar
}).catch(res => {
commonToast(res && res.message);
}) || {};
} = app;
const {
success
} = await API.login({
userNick: nickName,
avatar
}).catch(res => {
r();
commonToast(res && res.message);
}) || {};
if (success) {
this.init();
}
if (success) {
s();
}
})
},
/**刷新用户信息 */
updateUserInfo() {
......@@ -370,7 +379,6 @@ Page({
})
},
closeGetcatModal() {
this.setData({
getcatModalVisible: false
})
......
......@@ -104,6 +104,7 @@ const request = ({ cloud, cloudName, requestType = 'cloud' }) => {
// console.log('requestCloud', _cloudName, handle, params);
// return requestType === 'ams' ? requestAms() : requestCloud();
console.log(requestType);
return (requestType === 'ams' || requestType === 'yapi'|| requestType === 'local') ? requestMock() : requestCloud();
};
......
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