2024-02-29 09:27:59 +08:00

106 lines
1.7 KiB
JavaScript

import { imageBasUrl } from '../../utils/config';
import { myToPathList, myToHistroy } from "../../utils/constData";
const { httpRequest } = getApp();
Page({
data: {
imageBasUrl,
userInfo: {},
myToPathList: myToPathList,
myToHistroy: myToHistroy,
popupShow: false
},
onShow() {
this.setData({
userInfo: getApp().globalData.userInfo,
systemInfo: getApp().globalData.systemInfo,
})
},
async isGetUserInfo(showFlag = true) {
if (showFlag) {
my.showLoading({
content: '刷新中...',
});
}
const paramenter = {
path: '/user',
method: 'GET',
}
const res = await httpRequest(paramenter);
my.hideLoading({
page: this,
});
if (res.status == 1) {
my.showToast({
type: 'none',
content: '刷新成功',
duration: 2000,
});
this.setData({
userInfo: res.data.info,
})
getApp().globalData.userInfo = res.data.info;
my.setStorageSync({
key: 'userInfo',
data: {
userInfo: res.data.info
}
})
}
},
toPathOtherPage(event) {
const item = event.target.dataset.item;
if (item.id == 4) {
my.tb.openMessage({
sellerNick: "湖南秦九",
success: (res) => {
console.log(res, 'success');
},
fail: (res) => {
console.log(res, 'fail');
},
})
} else {
my.navigateTo({
url: item.toPath
});
}
},
goIndex() {
my.switchTab({
url: '/pages/index/index',
})
},
getPayG() {
my.hideTabBar({
animation: true,
complete: () => {
this.setData({
popupShow: true
})
}
})
},
onClosePopup(mi) {
this.setData({
popupShow: false
})
setTimeout(() => {
my.showTabBar({
animation: true
})
}, 300)
if (mi.resultCode == 9000) {
this.isGetUserInfo(false);
}
}
})