Commit 0e8b37f6 authored by wildfirecode13's avatar wildfirecode13

Merge branch 'tianmaoxiaoyuan' of gitlab2.dui88.com:wanghongyuan/new_taobao into tianmaoxiaoyuan

parents e3abc2d7 e0110573
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
......@@ -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