Commit ce3dbf48 authored by Facius's avatar Facius

超级用户存到storage

parent 364faa82
......@@ -17,7 +17,7 @@
<u-icon class="tel-arrow-icon" name="arrow-up-fill"></u-icon>
</view>
</view>
<view v-if="showSuperButton" class="super-button"><u-button@click="$u.throttle(handleSuperButton, 500)">切换用户</u-button></view>
<view v-if="isSuperuser" class="super-button"><u-button@click="$u.throttle(handleSuperButton, 500)">切换用户</u-button></view>
</view>
<view class="header-right-view" @click="$u.throttle(handleClickSetting, 500)">
<image :src="shezhiImage" class="right-image-view"></image>
......@@ -62,7 +62,7 @@
data() {
return {
serviceTel: '18124099271',
showSuperButton: false,
// showSuperButton: false,
show: false,
content: '是否确认退出该账户?',
wodebeijingImage: '',
......@@ -181,12 +181,15 @@
},
shezhiImage() {
return process.uniEnv.qn_base_url + 'shezhi.png'
},
isSuperuser() {
return this.vuex_superuser
}
},
async onLoad() {
onLoad() {
app.trackPage('我的首页')
if(this.vuex_token ) {
if (!this.showSuperButton) {
if (!this.isSuperuser) {
this.allowLogin()
}
......@@ -234,10 +237,10 @@
login.setUserData({}, this);
app.globalData.logout = true
},
async allowLogin() {
async allowLogin() { // 超级用户,显示登录按钮
let res = await this.$u.api.allowLogin()
if (res && res.code == 200) {
this.showSuperButton = res.data === true
if (res && res.code == 200) {
this.$u.vuex('vuex_superuser', res.data);
}
},
......
......@@ -12,7 +12,7 @@ try {
}
// 需要永久存储,且下次APP启动需要取出的,在state中的变量名
let saveStateKeys = ['vuex_user', 'vuex_wx_uid', 'vuex_token', 'vuex_cache', 'uploadTask'];
let saveStateKeys = ['vuex_user', 'vuex_wx_uid', 'vuex_token', 'vuex_cache', 'uploadTask', 'vuex_superuser'];
// 保存变量到本地存储中
const saveLifeData = function(key, value) {
......@@ -33,6 +33,7 @@ const store = new Vuex.Store({
vuex_user: lifeData.vuex_user ? lifeData.vuex_user : {},
vuex_token: lifeData.vuex_token ? lifeData.vuex_token : '',
vuex_cache: lifeData.vuex_cache ? lifeData.vuex_cache : {},
vuex_superuser: lifeData.vuex_superuser || false,
vuex_version: '1.0.1',
vuex_config: {},
// 入驻信息
......
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