Browse Source

fix all

voice
刘嘉炜 4 years ago
parent
commit
2b21a68a57
  1. 2
      src/js/server.js
  2. 3
      src/pages/employee/authority_select/authority_select.vue
  3. 58
      src/pages/index/index.vue
  4. 2
      src/pages/message/list/list.vue
  5. 2
      src/pages/turnover/turnover.vue

2
src/js/server.js

@ -1,6 +1,6 @@
import util from '../utils/util';
// import { app as vm } from '../main';
const islog = true;
const islog = false;
export class Server {
request(url,data,method,header,isDefaultGet,failMsg){

3
src/pages/employee/authority_select/authority_select.vue

@ -194,7 +194,8 @@ export default {
util.previousPageFunction({
fnName: 'refreshEmployList',
query: null
})
});
util.routeTo();
},1200)
}else{
util.showNone(res.data.message || '操作失败!');

58
src/pages/index/index.vue

@ -126,6 +126,7 @@
const uniLogin = util.promisify(uni.login);
const uniGetUserInfo= util.promisify(uni.getUserInfo);
const app = getApp();
const APPID = uni.getAccountInfoSync().miniProgram.appId;
export default {
computed: {
@ -139,9 +140,19 @@
}
},
async onLoad() {
await this.checkUserAuthor();
this.isLogin = app.isLogin();
if(!!app.isLogin())this.getIndexInfo();
try{
util.showLoad();
await this.checkUserAuthor();
util.hideLoad();
this.$nextTick(_=>this.isLogin = app.isLogin());
if(!!app.isLogin())this.getIndexInfo();
}catch(err){
util.hideLoad();
uni.removeStorageSync('token');
this.$nextTick(_=>this.isLogin = app.isLogin());
util.showNone(err.message || '身份校验失败!');
console.log('onLoad err',err);
}
},
onShow(){
let { indexData } = this;
@ -181,17 +192,45 @@
try{
let setting;
try{setting = await uniGetSetting({})}catch(err){console.error(err)};
if(setting&&setting.authSetting&&setting.authSetting['scope.userInfo'] === true){
let [ loginRes, userRes ] = await Promise.all([uniLogin(), uniGetUserInfo()]);
console.log(codeRes);
console.log(userInfo);
return servers.post({
url: API.wechatMiniAppLoginAndSync,
data: {
appid: APPID,
code: loginRes.code,
encryptedData: userRes.encryptedData,
iv: userRes.iv,
is_details: 1,
},
isDefaultGet: false,
})
.then(res=>{
util.hideLoad();
if(res.data.code == 0){
let _data = res.data.data;
if(_data.user.role == ''){
uni.removeStorageSync('token');
return util.routeTo(`/pages/merchant_login/merchant_login`,'rL');
}
uni.setStorageSync('token',_data.token);
return _data;
}else{
throw res.data || {};
}
})
.catch(err=>{
throw err;
})
}else{
uni.removeStorageSync('token');
throw 'author err';
}
}catch(err){
throw err;
}
},
showAuthor(){
@ -214,7 +253,6 @@
this.closeAuthor();
return util.showNone('获取登陆凭证失败!稍后重试');
}
const APPID = uni.getAccountInfoSync().miniProgram.appId;
util.showLoad();

2
src/pages/message/list/list.vue

@ -1,7 +1,7 @@
<template>
<view class="message-list">
<view class="ml-list">
<view class="ml-item" v-for="(e,i) in mesList" :key="e" @click="toDetail(i)">
<view class="ml-item" v-for="(e,i) in mesList" :key="i" @click="toDetail(i)">
<view>
<text>{{e.title || '-'}}</text>
<view v-if="e.is_view == 0"></view>

2
src/pages/turnover/turnover.vue

@ -398,7 +398,7 @@ export default {
color: #9c9c9f;
}
.td-price{
margin-bottom: 130upx;
margin-bottom: 50upx;
padding: 0 24upx;
line-height: 90upx;
font-size: 76upx;

Loading…
Cancel
Save