四端上传
This commit is contained in:
1 parent
25bbb5f9c8
commit
c6e2cb4d5b
276 files changed
+17812
-3
No files matched your search
@@ -0,0 +1,85 @@
|
||||
// pages/wode/wode.js
|
||||
const api = require('../../utils/api');
|
||||
const store = require('../../utils/store');
|
||||
const config = require('../../config/index');
|
||||
|
||||
const app = getApp();
|
||||
|
||||
Page({
|
||||
data: {
|
||||
showCode: false,
|
||||
headiconUrl: '',
|
||||
isLoggedIn: false,
|
||||
userNameText: '未登录',
|
||||
loginBtnText: '登录注册',
|
||||
version: '',
|
||||
qrcodeUrl: '',
|
||||
text2: '',
|
||||
text3: '',
|
||||
text4: '',
|
||||
text5: '',
|
||||
text6: '',
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
app.ready().then(() => {
|
||||
this.applyConfig();
|
||||
this.applyUser();
|
||||
});
|
||||
},
|
||||
|
||||
onShow() {
|
||||
if (store.getSiteConfig() && Object.keys(store.getSiteConfig()).length) this.applyConfig();
|
||||
this.applyUser();
|
||||
},
|
||||
|
||||
applyConfig() {
|
||||
const qrcodeName = store.cfg('profile.qrcode_image', '');
|
||||
this.setData({
|
||||
version: store.cfg('site.version', 'V0.0.9'),
|
||||
text2: store.cfg('profile.menu.change_info', '修改资料'),
|
||||
text3: store.cfg('profile.menu.share', '好友分享'),
|
||||
text4: store.cfg('profile.menu.contact', '在线沟通'),
|
||||
text5: store.cfg('profile.menu.wechat', '添加微信:叶雷讲数学'),
|
||||
text6: store.cfg('profile.qrcode_caption', '长按识别二维码'),
|
||||
qrcodeUrl: qrcodeName ? config.STATIC_BASE_URL + '/Images/WXCode/' + qrcodeName + '.png' : '',
|
||||
});
|
||||
},
|
||||
|
||||
applyUser() {
|
||||
const user = store.getUser();
|
||||
// 已登录 = 有 token 且设置过昵称;未设置昵称的仍是游客,与旧版语义一致
|
||||
const registered = !!(user && user.nickname);
|
||||
this.setData({
|
||||
isLoggedIn: registered,
|
||||
userNameText: registered ? user.nickname : '未登录',
|
||||
loginBtnText: registered ? '退出登录' : '登录注册',
|
||||
headiconUrl: user && user.headiconUrl ? user.headiconUrl : config.STATIC_BASE_URL + config.PLACEHOLDER.USER,
|
||||
});
|
||||
},
|
||||
|
||||
toLoginOrOut() {
|
||||
wx.navigateTo({ url: '/pages/LoginOrOutDetails/LoginOrOutDetails' });
|
||||
},
|
||||
|
||||
toChangeUserInfo() {
|
||||
if (!this.data.isLoggedIn) {
|
||||
wx.showToast({ mask: true, icon: 'error', title: '请先登录' });
|
||||
return;
|
||||
}
|
||||
wx.navigateTo({ url: '/pages/ChangeUserInfo/ChangeUserInfo' });
|
||||
},
|
||||
|
||||
showQrcode() {
|
||||
this.setData({ showCode: true });
|
||||
},
|
||||
|
||||
onCodeClose() {
|
||||
this.setData({ showCode: false });
|
||||
},
|
||||
|
||||
onShareAppMessage() {
|
||||
return { title: '叶雷讲数学', path: '/pages/index/index' };
|
||||
},
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user