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 = { ...@@ -10,5 +10,5 @@ export const ResJson = {
"name": "startScene" "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({ ...@@ -19,17 +19,20 @@ Component({
onModalClose && onModalClose(); onModalClose && onModalClose();
console.log('onModalClose') console.log('onModalClose')
}, },
onPostSelectCat() { async onPostSelectCat() {
const userInfo = API.getUserInfo().catch(res=>{ const userInfo = await API.getUserInfo().catch(res=>{
my.showToast({content:userInfo?userInfo.message:null}) my.showToast({content:res?res.message:null})
}); });
if(userInfo&&userInfo.success){ if(userInfo&&userInfo.success){
console.log("aaa",userInfo)
const { const {
onPostSelectCat onPostSelectCat
} = this.props; } = this.props;
console.log("领养完毕") console.log("领养完毕")
this.onModalClose(); this.onModalClose();
// my.__updateUserInfo__();
onPostSelectCat && onPostSelectCat(userInfo); onPostSelectCat && onPostSelectCat(userInfo);
} }
} }
}, },
......
<view disable-scroll="true" class="page-game"> <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> </canvas>
</view> </view>
......
...@@ -39,7 +39,7 @@ Page({ ...@@ -39,7 +39,7 @@ Page({
catnameModalVisible: false, catnameModalVisible: false,
recallcatModalVisible: false, recallcatModalVisible: false,
recallcatModalData: {}, recallcatModalData: {},
getcatModalVisible: false, getcatModalVisible: true,
getcatModalData: {}, getcatModalData: {},
catbackbedModalVisible: false, catbackbedModalVisible: false,
catruleModalVisible: 0 catruleModalVisible: 0
...@@ -59,12 +59,13 @@ Page({ ...@@ -59,12 +59,13 @@ Page({
}, },
onReady() { async onReady() {
console.log('on ready') console.log('on ready')
//授权和登录先搞 //授权和登录先搞
this.getAuth(); await this.getAuth();
this.initCanvas();
my.__onMessage__ = (e) => { my.__onMessage__ = (e) => {
this.onMessage(e) this.onMessage(e)
} }
...@@ -104,7 +105,7 @@ Page({ ...@@ -104,7 +105,7 @@ Page({
} }
}, },
init() { initCanvas() {
console.log('do init'); console.log('do init');
this.spark_startEngine(); this.spark_startEngine();
...@@ -266,8 +267,10 @@ Page({ ...@@ -266,8 +267,10 @@ Page({
* 获取用户授权信息 * 获取用户授权信息
*/ */
async getAuth() { async getAuth() {
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();
}); });
if (userInfo) { if (userInfo) {
console.log('授权成功 userInfo', userInfo); console.log('授权成功 userInfo', userInfo);
...@@ -277,29 +280,35 @@ Page({ ...@@ -277,29 +280,35 @@ Page({
} = userInfo; } = userInfo;
app.nickName = nickName; app.nickName = nickName;
app.avatar = avatar; app.avatar = avatar;
this.login(); await this.login();
s();
} }
})
}, },
/** /**
* 登录接口 * 登录接口
*/ */
async login() { async login() {
const { return new Promise(async (s,r)=>{
const {
nickName, nickName,
avatar avatar
} = app; } = app;
const { const {
success success
} = await API.login({ } = await API.login({
userNick: nickName, userNick: nickName,
avatar avatar
}).catch(res => { }).catch(res => {
commonToast(res && res.message); r();
}) || {}; commonToast(res && res.message);
}) || {};
if (success) { if (success) {
this.init(); s();
} }
})
}, },
/**刷新用户信息 */ /**刷新用户信息 */
updateUserInfo() { updateUserInfo() {
...@@ -370,7 +379,6 @@ Page({ ...@@ -370,7 +379,6 @@ Page({
}) })
}, },
closeGetcatModal() { closeGetcatModal() {
this.setData({ this.setData({
getcatModalVisible: false getcatModalVisible: false
}) })
......
...@@ -104,6 +104,7 @@ const request = ({ cloud, cloudName, requestType = 'cloud' }) => { ...@@ -104,6 +104,7 @@ const request = ({ cloud, cloudName, requestType = 'cloud' }) => {
// console.log('requestCloud', _cloudName, handle, params); // console.log('requestCloud', _cloudName, handle, params);
// return requestType === 'ams' ? requestAms() : requestCloud(); // return requestType === 'ams' ? requestAms() : requestCloud();
console.log(requestType);
return (requestType === 'ams' || requestType === 'yapi'|| requestType === 'local') ? requestMock() : requestCloud(); 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