瀏覽代碼

跟新版本

guojy 2 年之前
父節點
當前提交
64e5694cef

+ 0 - 1
src/api/configget.js

@@ -2,7 +2,6 @@
 import request from '@/utils/request'
 import {getToken} from '@/utils/auth'
 export async function allocations(body){
-    console.log("请求配置")
     if(getToken()){
         let params = {url : body}
         // let params = {url : 'https://qywx.g107.net'}

+ 2 - 2
src/api/login.js

@@ -13,6 +13,6 @@ export function get_employee_map() {
 	return request('get','/api/employee/list')
 }
 //员工详细信息
-export function get_info(token) {
-  return request('get','/api/employee/detail','','token');
+export function get_info() {
+  return request('get','/api/employee/detail');
 }

+ 2 - 2
src/components/body/statistics.vue

@@ -169,7 +169,7 @@ export default {
     const u = navigator.userAgent;
     const isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); // ios终端
     this.isIos = isIOS
-    this.$store.dispatch('get_user_info', getToken()).then(res => {
+    this.$store.dispatch('get_user_info').then(res => {
       this.getRole_three = getRole_three()
       this.getRole_two = getRole_two()
       this.getRole_four = getRole_four()
@@ -609,7 +609,7 @@ export default {
       vm.clu();
     },
     update_message_list: function (vm, data) {
-      vm.$store.dispatch('get_user_info', getToken()).then(res => {
+      vm.$store.dispatch('get_user_info').then(res => {
         vm.chat_msg_session_list(function () {})
         vm.clu();
       })

+ 2 - 2
src/components/common/DateSelectorDropdown.vue

@@ -117,7 +117,7 @@
         } else if (type === 'month') {
           return `${val}月`
         }
-        return `${val}日`
+        return `日`
       },
       deepCopyDate (date) {
         return new Date(date.getFullYear(), date.getMonth(), date.getDate())
@@ -131,7 +131,7 @@
             this.$emit('update:title', startDate.getMonth()+1 +'月')
           }
         } else {
-          this.$emit('update:title', startDate.getDate() + '日')
+          this.$emit('update:title','日')
         }
       },
       onResetDate () {

+ 1 - 1
src/components/ems/invite.vue

@@ -15,7 +15,7 @@
 import request from '@/utils/request';
 import QrcodeVue from 'qrcode.vue';
 import plusShare from '../../../static/js/plusShare.js';
-import { getToken, getUserId } from '@/utils/auth';
+import { getToken } from '@/utils/auth';
 import Vue from 'vue';
 import axios from 'axios';
 

+ 0 - 2
src/components/integral/batchList.vue

@@ -96,7 +96,6 @@
                  v-model="item.reviewer_list"
                  :multi="false"
                  :max="1"
-                 :is_filtration_creator="true"
                  :use_employee_list="true"
                  :employee_list="superior_list"
                ></EmployeeSelectorCell>
@@ -229,7 +228,6 @@
                    v-model="item.reviewer_list"
                    :multi="false"
                    :max="1"
-                   :is_filtration_creator="true"
                    :use_employee_list="true"
                    :employee_list="superior_list">
                  </EmployeeSelectorCell>

+ 1 - 1
src/components/integral/event_detail.vue

@@ -118,7 +118,7 @@ export default {
   data () {
     return {
       loading: true,
-      eventInfo: {remark: {customize: ''}},
+      eventInfo: {remark: {customize: ''},process:[]},
       types_list: {}
     }
   },

+ 2 - 1
src/components/integral/event_list.vue

@@ -36,7 +36,7 @@
               <span>{{ item.remark }}</span>
             </div>
             <div class="event-time__text">
-              <span>{{ item.create_time }}</span>
+              <span>{{ moment(item.event_time).format('YYYY-MM-DD') }}</span>
             </div>
           </div>
         </van-cell-group>
@@ -70,6 +70,7 @@ export default {
       dateItemTitle: '本月',
       deptDropdownItemTitle: '全公司',
       eventData: [],
+      moment:moment,
       searchParams: {
         dept_ids: null,
         end_day: null,

+ 4 - 2
src/components/integral/integral_entry_list.vue

@@ -23,7 +23,7 @@
             <div style="padding-left: 0.72rem; margin-left: 0.2rem; font-size: 0.32rem">
               <div class="remark re-item__status" style="font-size:0.32rem;color:#666">{{item.remark}}</div>
               <div class="clear" style="margin-top: 0.3rem; font-size: 0.28rem">
-                <span class="fl color_ccc">{{item.event_time}}</span>
+                <span class="fl color_ccc">{{moment(item.event_time).format('YYYY-MM-DD')}}</span>
                 <span v-if="item.point < 0" class="fr color_red bg">扣分成功</span>
                 <span v-else class="fr color_green bg">奖分成功</span>
                 <!-- <span class="fr color_green bg">{{item.point < 0?'扣分成功':'奖分成功'}}</span> -->
@@ -41,7 +41,7 @@
             <div style="padding-left: 0.72rem; margin-left: 0.2rem; font-size: 0.32rem">
               <div class="remark" v-show="item.remark" style="font-size:0.32rem;color:#666">{{item.remark.customize}}</div>
               <div class="clear" style="margin-top: 0.3rem; font-size: 0.24rem">
-                <span class="fl color_ccc">{{item.event_time}}</span>
+                <span class="fl color_ccc">{{moment(item.event_time).format('YYYY-MM-DD')}}</span>
                 <span class="fr color_yellow bg" v-show="item.status == 0" >待审批</span>
                 <span class="fr color_red bg" v-show="item.status == 2" >被驳回</span>
               </div>
@@ -60,6 +60,7 @@ import userImage from '@/components/common/user_image'
 import Vue from 'vue'
 import {Tab, Tabs, Search} from 'vant'
 import {_debounce} from '@/utils/auth'
+import moment from 'moment'
 Vue.use(Tab).use(Tabs).use(Search)
 export default {
   data () {
@@ -69,6 +70,7 @@ export default {
       type: 'all',
       show_list: false,
       isInfinite: true,
+      moment:moment,
       filter: {
         page: 1,
         type: 'all',

+ 26 - 32
src/components/user/login.vue

@@ -11,49 +11,43 @@
 
 <script>
 import request from '@/utils/request';
-import { getToken, setToken, cookGetToken } from '@/utils/auth';
-import { wxAuth } from '@/utils/wx-auth-two.js';
+import {getToken,setToken} from '@/utils/auth';
 
 export default {
   name: 'login',
   data() {
     return {
-      logImage: true,
-      loginButton: true
+
     };
   },
   created() {
-    let token=cookGetToken()
-    console.log('进入登录页:'+token);
-    if (token) {
-      setToken(token);
-      this.detailAxiox(1);
-    } else {
-      window.location.href = process.env.BASE_API; //重新授权
-    }
+    //初始化
+    // localStorage.clear();
+    sessionStorage.clear()
+    window.sessionStorage.setItem('__VCKEEPALIVE__', JSON.stringify(['/']));
+    window.sessionStorage.setItem('routers', '/');
+  },
+  mounted() {
+  	let token=getToken()
+  	if (token) {
+  	  setToken(token);
+  	  this.detailAxiox();
+  	}
   },
   methods: {
-    detailAxiox(add) {
-      request('get', process.env.BASE_API + '/api/employee/detail').then(res => {
-        if (res.data.code == 1) {
-          if (res.data.data.user.is_official == 0) {
-            this.$router.push({
-              path: '/noAccess',
-              query: {
-                msg: '当前用户未授权进入系统,请联系管理员为您【启用积分管理】,<br/>如需咨询客服,请到您企业专属的功道云服务群咨询'
-              }
-            });
-          } else if (add == 1) {
-            this.$store.commit('SET_USERINFO', res.data.data.user); // 设置员工信息
-            window.sessionStorage.setItem('__VCKEEPALIVE__', JSON.stringify(['/']));
-            window.sessionStorage.setItem('routers', '/');
-            // this.$router.push({
-            //   name: 'home'
-            // })
-            wxAuth(true);
-          }
+    detailAxiox() {
+      this.$store.dispatch('get_user_info').then((res) => {
+        let data=res.data.user.data
+        console.log(data)
+        if (data.is_official == 0) {
+          this.$router.push({
+            path: '/noAccess',
+            query: { msg: '当前用户未授权进入系统,请联系管理员为您【启用积分管理】,<br/>如需咨询客服,请到您企业专属的功道云服务群咨询'}
+          });
+        } else{
+          this.$router.replace({ path: '/home' });
         }
-      });
+      })
     }
   }
 };

+ 0 - 2
src/components/user/safe.vue

@@ -29,7 +29,6 @@
 </template>
 
 <script>
-  import { removeToken } from '@/utils/auth'
   export default {
     filters:{
       mobile(tel){
@@ -46,7 +45,6 @@
           title: '退出登录',
           message: '您确定要退出吗?'
         }).then(() => {
-          removeToken()
           if (window.plus) {
             plus.storage.removeItem('user_info')
           } else {

+ 1 - 4
src/components/user/user_setting.vue

@@ -31,10 +31,8 @@
 </template>
 
 <script>
-
-  import { removeToken } from '@/utils/auth'
+	
   export default {
-
     methods:{
       clear_cache(){
         let self = this
@@ -54,7 +52,6 @@
           title: '退出登录',
           message: '您确定要退出吗?'
         }).then(() => {
-          removeToken()
           if (window.plus) {
             plus.storage.removeItem('user_info')
           } else {

+ 7 - 4
src/main.js

@@ -8,8 +8,14 @@ import './utils/validator'
 import '../css/reset.css'
 import echarts from 'echarts'
 
+// wx通讯录
+import wwOpenDAtas from '@/view/wxOpendata'
+Vue.component('Wxopendata', wwOpenDAtas)
+
 import VConsole from 'vconsole'
-new VConsole()
+if (process.env.NODE_ENV === 'development') {
+  new VConsole()
+}
 
 import {
   Tabbar,Empty, TabbarItem,Grid, GridItem,Field,NavBar,Row, Col,Cell, CellGroup,Toast,Popup,Dialog,RadioGroup, Radio,Notify,
@@ -29,9 +35,6 @@ Vue.prototype.$isPt_id = isPt_id
 Vue.prototype.$echarts = echarts
 Vue.prototype.$wx = (window).wx; // 全局使用
 
-// wx通讯录
-import wwOpenDAtas from '@/view/wxOpendata'
-Vue.component('Wxopendata', wwOpenDAtas)
 
 Vue.use(Button).use(Tabbar).use(TabbarItem).use(Grid).use(GridItem).use(Field).use(NavBar).use(Row).use(Col).use(Cell).use(CellGroup).use(Toast).use(Popup).use(Dialog).use(RadioGroup).use(Radio).use(Icon).use(Notify).use(Empty)
 Vue.use(VueScroller)

+ 12 - 56
src/permission.js

@@ -3,8 +3,7 @@ import Cookies from 'js-cookie'
 import router from './router'
 import store from './store'
 import request from '@/utils/request'
-import {getToken, setToken, cookGetToken} from '@/utils/auth'
-const stopPath = ['/login', '/noAccess', '/']
+import {getToken, setToken} from '@/utils/auth'
 import { wxAuth } from "@/utils/wx-auth-two.js";
 router.beforeEach((to, from, next) => {
   if (Vue.$httpRequestList.length > 0) { //强行中断时才向下执行
@@ -17,54 +16,21 @@ router.beforeEach((to, from, next) => {
     wx.closeWindow();//关闭当前网页窗口
     return false
   }
-  if(stopPath.indexOf(to.path) !== -1){
-    next()
-  }else{
-    if (cookGetToken()){//Cook中A-Token
-      setToken(cookGetToken())
-      detailAxiox()//员工详细信息
-      Cookies.remove('Admin-Token')
-      thens(to, from, next)
-    } else if (getToken()) {//local中A-Token
-      thens(to, from, next)
+  window.document.title =window.$routes_map[to.name]? window.$routes_map[to.name].label:'管理中心'
+  if (getToken()) {
+    // 初始一些数据
+    init();
+    wxAuth('',next)
+  } else {
+    if (!window.$routes_map[to.name].need_login) { // 在免登录白名单,直接进入
+      wxAuth('',next)
     } else {
-      if (!window.$routes_map[to.name].need_login) { // 在免登录白名单,直接进入
-        if(to.name=='init'&&localStorage.getItem('init')){
-          next('/login')
-        }else{
-          if (typeof(window.$routes_map[to.name]) != 'undefined') {
-            window.document.title = window.$routes_map[to.name].label
-          }
-          next()
-        }
-      } else {
-        window.location.href = process.env.BASE_API//直接重新授权
-      }
+      next('/login')
     }
   }
 })
-
-function thens(to, from, next){
-  if(to.name !== 'home'){
-    window.document.title = window.$routes_map[to.name].label
-  }
-  if (to.path == '/login' || to.name == 'init') { // 在免登录白名单,直接进入
-    next({ name: 'home'})
-  }
-  // 初始一些数据
-  init(to);
-  // next()
-  wxAuth(false,next,to)
-}
-
-function init(to) {
-  store.dispatch('get_user_info', getToken()).then((res) => { //获取用户信息
-    if (router.history.current.name == 'login' && to.name != 'home') {
-      router.push({
-        name: 'home'
-      })
-      return false
-    }
+function init() {
+  store.dispatch('get_user_info').then((res) => { //获取用户信息
     if (store.getters.user_info.try_user == 1) { //判断是否试用账号
       store.dispatch("setBuyPopup",true);
     }else{
@@ -76,13 +42,3 @@ function init(to) {
   store.dispatch('get_employee_map').then((res) => {}); //获取人员列表
 }
 
-function detailAxiox(){
-  request('get',process.env.BASE_API+'/api/employee/detail')
-  .then(res => {
-    if(res.data.code == 1){
-      store.commit("SET_USERINFO", res.data.data.user); // 设置员工信息
-      window.sessionStorage.setItem('__VCKEEPALIVE__', JSON.stringify(['/']))
-      window.sessionStorage.setItem('routers', '/')
-    }
-  })
-}

+ 2 - 1
src/router/index.js

@@ -8,7 +8,8 @@ let routes = [
     name: 'init',
     component: () => import('@/view/init'),
     label: '初始化',
-    need_login: false
+    need_login: false,
+    redirect: "login",
   },
   {
     path: '/home',

+ 4 - 30
src/store/modules/user.js

@@ -1,5 +1,5 @@
 import {get_info, get_point_types, get_employee_map,getMenu} from '@/api/login'
-import {setToken, setUserId, getToken} from '@/utils/auth'
+import {getToken} from '@/utils/auth'
 import moment from 'moment'
 import router from '@/router'
 
@@ -28,7 +28,6 @@ const user = {
 
   mutations: {
     BUYPOPUP:(state, data)=>{
-      // console.log(data);
       state.buyPopup = data
     },
     GET_MENU:(state, data) => {
@@ -181,7 +180,7 @@ const user = {
       }
     },
     update_user_info({dispatch,commit},data){
-          dispatch('get_user_info', getToken());
+          dispatch('get_user_info');
     },
     update_point_types({dispatch}){
       if(window.plus){
@@ -313,34 +312,10 @@ const user = {
 
       })
     },
-    get_user_info({commit},token) {
+    get_user_info({commit}) {
       return new Promise((resolve, reject) => {
         let user_info = null
         let nowDate = moment().format("YYYY-MM-DD HH:mm:ss");
-        if(token=='isShow'){
-            get_info(getToken()).then(response => {
-              if(response.data.data.user.is_official == 0){
-                router.push({
-                  path: '/noAccess',
-                  query: {
-                    msg: '当前用户未授权进入系统,请联系管理员为您【启用积分管理】,<br/>如需咨询客服,请到您企业专属的功道云服务群咨询'
-                  }
-                })
-                return
-              }
-              response.data.data.user.localStorageExpire = moment().add(Math.floor(Math.random() * (120 - 60 + 1)) + 60, "second").format("YYYY-MM-DD HH:mm:ss")
-              commit('SET_USERINFO', response.data.data.user)
-              if (window.plus) {
-                plus.storage.setItem('user_info', JSON.stringify(response.data.data.user))
-              } else {
-                localStorage.setItem('user_info', JSON.stringify(response.data.data.user))
-              }
-              resolve(response.data)
-            }).catch(error => {
-              reject(error)
-            })
-            return;
-        }
         if (window.plus) {
           user_info = JSON.parse(plus.storage.getItem('user_info'))
         } else {
@@ -350,8 +325,7 @@ const user = {
           commit('SET_USERINFO', user_info.data)
           resolve({code: 1, msg: '', data: {user: user_info}})
         }else{
-          if(typeof(token) == 'undefined'){ return false}
-          get_info(token).then(response => {
+          get_info().then(response => {
             response.data.data.user.localStorageExpire = moment().add(Math.floor(Math.random() * (120 - 60 + 1)) + 60, "second").format("YYYY-MM-DD HH:mm:ss");
             commit('SET_USERINFO', response.data.data.user)
             if (window.plus) {

+ 23 - 88
src/utils/auth.js

@@ -5,20 +5,14 @@ import store from '@/store';
 
 // 获取当前用户详情
 export function getUserData() {
-  let data='';
-  if(window.plus){
-    if(plus.storage.getItem('user_info')){
-        data=JSON.parse(plus.storage.getItem('user_info')).data
-    }
-  }else{
-    if(localStorage.getItem('user_info')){
-       data=JSON.parse(localStorage.getItem('user_info')).data
-    }
+  let data=localStorage.getItem('user_info');
+  if(data){
+     data=JSON.parse(data).data
   }
   if(!data){
     data=store.getters.user_info;
   }
-  return  data
+  return data
 }
 
 // 获取积分类型
@@ -34,88 +28,36 @@ export function getTypes(id) {
   }
 }
 
-export function getToken() {
-  if (window.plus) {
-    return plus.storage.getItem(TokenKey)
-  } else {
-    return localStorage.getItem(TokenKey)
+export const checkPlatform = function() {
+  if (/android/i.test(navigator.userAgent)) {
+    return '1'
   }
-}
-export function cookGetToken() {
-  // return Cookies.get(TokenKey)|| getToken(TokenKey)
-  return Cookies.get(TokenKey)|| 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOm51bGwsImlhdCI6MTY3NTczNzEzOSwiZXhwIjoxNjc2MzM3MTM5LCJuYmYiOjE2NzU3MzcxMzksImp0aSI6InZZbmtIUHpFZ3JzS2lkWWkiLCJzdWIiOjc0LCJwcnYiOiJjYTY0ODlkNTBmMjQwN2E2NzgzMGU4MDkwZDAxNDg4MzU2ODU5NjJiIiwicm9sZSI6ImVtcGxveWVlIn0.Omz7v07Iox44cuTAPgflBjA-4GtT9aN8uf4619DoGzw'
-}
-
-export function getUserId() {
-  if (window.plus) {
-    return plus.storage.getItem(UserIdKey)
-  } else {
-    return localStorage.getItem(UserIdKey)
+  if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
+    return '2'
   }
 }
 
 export function setToken(token) {
-  if (window.plus) {
-    var timestamp = parseInt((new Date()).valueOf() / 1000)
-    plus.storage.setItem('token-expire', timestamp + 7200)
-    return plus.storage.setItem(TokenKey, token)
-  } else {
-    var timestamp = parseInt((new Date()).valueOf() / 1000)
-    localStorage.setItem('token-expire', timestamp + 7200)
-    return localStorage.setItem(TokenKey, token)
-  }
+  setCache(TokenKey,token)
+  Cookies.set(TokenKey, token)
 }
-
-export function setUserId(token) {
-  if (window.plus) {
-    return plus.storage.setItem(UserIdKey, token)
-  } else {
-    return localStorage.setItem(UserIdKey, token)
-  }
+export function getToken() {
+  return Cookies.get(TokenKey)|| getCache(TokenKey)
 }
 
-export function removeToken() {
-  if (window.plus) {
-    plus.storage.removeItem('user_info')
-    return plus.storage.removeItem(TokenKey)
-  } else {
-    localStorage.removeItem('user_info')
-    return localStorage.removeItem(TokenKey)
-  }
+// 获取缓存
+export function getCache(key) {
+  
+  let tas="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOm51bGwsImlhdCI6MTY4MTk1OTcxMSwiZXhwIjoxNjgyNTU5NzExLCJuYmYiOjE2ODE5NTk3MTEsImp0aSI6Ijg3TEliV0NDOE1DSFlyQWQiLCJzdWIiOjc0LCJwcnYiOiJjYTY0ODlkNTBmMjQwN2E2NzgzMGU4MDkwZDAxNDg4MzU2ODU5NjJiIiwicm9sZSI6ImVtcGxveWVlIn0.2iALty8DawnjA-ImsapozVxHHu5e3Rc6ArAkydGRl1c"
+  return JSON.parse(localStorage.getItem(key))
 }
-
-export function removeUserId() {
-  if (window.plus) {
-    return plus.storage.removeItem(UserIdKey)
-  } else {
-    return localStorage.removeItem(UserIdKey)
-  }
+// 设置缓存
+export function setCache(key,data) {
+  localStorage.setItem(key, JSON.stringify(data))
 }
 
-export const checkPlatform = function() {
-  if (/android/i.test(navigator.userAgent)) {
-    return '1'
-  }
-  if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
-    return '2'
-  }
-}
 
-// cache
-export function set_cache(key, data) {
-  if (window.plus) {
-    return plus.storage.getItem(key, data)
-  } else {
-    return localStorage.getItem(key, JSON.stringify(data))
-  }
-}
-export function get_cache(key) {
-  if (window.plus) {
-    return plus.storage.getItem(key)
-  } else {
-    return JSON.parse(localStorage.getItem(key))
-  }
-}
+
 // 创始人:creator
 // 公司管理员:admin
 // 积分管理员:point_manager
@@ -212,6 +154,7 @@ export function _throttle(fn, interval=500) {
     }
   }
 }
+
 export function isPt_id(item){
   switch (item){
     case 1:
@@ -225,11 +168,3 @@ export function isPt_id(item){
       break;
   }
 }
-// 获取缓存
-export function getCache(key) {
-  return JSON.parse(localStorage.getItem(key))
-}
-// 设置缓存
-export function setCache(key,data) {
-   localStorage.setItem(key, JSON.stringify(data))
-}

+ 1 - 5
src/utils/request.js

@@ -1,10 +1,6 @@
 import axios from 'axios'
 import router from '@/router'
-import {
-  getToken,
-  getUserId,
-  setToken
-} from '@/utils/auth'
+import {getToken,setToken} from '@/utils/auth'
 import qs from 'qs'
 import Vue from 'vue'
 import Cookies from 'js-cookie'

+ 22 - 64
src/utils/wx-auth-two.js

@@ -1,48 +1,25 @@
 import Vue from 'vue';
 import {allocations} from '@/api/configget';
 import Router from '@/router'
-import {
-  getToken
-} from '@/utils/auth'
-let isfot = false
-export const wxAuth = async (ifHome, next, to) => {
-  if (isfot) return
+import {getToken} from '@/utils/auth'
+
+export const wxAuth = (pushindex, next) => {
   const wechatConfigUrl = location.href.split('#')[0]
-  if (window.wechatConfigUrl === wechatConfigUrl && window.WWOpenData) {
-    if (getToken()) {
-      if (ifHome) {
-        Router.push({
-          name: 'home'
-        })
-      } else {
-        if (next) {
-          next()
-        }
-      }
-    }
-    return Promise.resolve()
-  } else {
-    try {
-      await wxConfigByCorp(ifHome, wechatConfigUrl, next)
-      window.wechatConfigUrl = wechatConfigUrl
-      return Promise.resolve()
-    } catch (error) {
-      return Promise.reject(error)
-    }
+  if(!window.WWOpenData){
+    console.log('url:'+wechatConfigUrl)
+    wxConfigByCorp(wechatConfigUrl, pushindex, next)
+  }else{
+    next();
   }
 }
 
-async function wxConfigByCorp(ifHome, body, next) {
-  isfot = true
+async function wxConfigByCorp(url, pushindex, next) {
   var data;
-  await allocations(body).then((res) => {
-    if (res.data.code == 1) {
-      data = res.data.data
-    }
-  }).catch(() => {})
+  await allocations(url).then((res) => {data = res.data.data})
   const wxConfigParams = data.config
   const appSignature = data.agentConfig
-  await Vue.prototype.$wx.config({ // 鉴权(企业的身份与权限)
+
+  Vue.prototype.$wx.config({ // 鉴权(企业的身份与权限)
     beta: true, // 必须这么写,否则wx.invoke调用形式的jsapi会有问题
     debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
     appId: wxConfigParams.appId, // 必填,企业微信的corpID
@@ -57,9 +34,11 @@ async function wxConfigByCorp(ifHome, body, next) {
       'invoke',
       'hideOptionMenu',
       'showOptionMenu'
-    ] // 必填,需要使用的JS接口列表,凡是要调用的接口都需要传进来
+    ]
   });
-  await Vue.prototype.$wx.ready(function() {
+
+
+  Vue.prototype.$wx.ready(function() {
     const u = navigator.userAgent;
     const isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; // 安卓
     const isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); // ios终端
@@ -72,19 +51,9 @@ async function wxConfigByCorp(ifHome, body, next) {
         signature: appSignature.signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
         jsApiList: ['selectExternalContact'], //必填
         success: function(res) { // 回调  //  wx.agentConfig成功回调后,WWOpenData 才会注入到 window 对象上面
-          isfot = false
-          if (next) {
-            next()
-          }
-          if (ifHome) {
-            console.log('--跳转首页--')
-            Router.push({
-              name: 'home'
-            })
-          }
+          if (next){next()}
         },
         fail: function(res) {
-          console.log('fail'+res)
           if (res.errMsg.indexOf('function not exist') > -1) {
             alert('版本过低请升级')
           }
@@ -98,25 +67,11 @@ async function wxConfigByCorp(ifHome, body, next) {
         timestamp: appSignature.timestamp, // 必填,生成签名的时间戳
         nonceStr: appSignature.nonceStr, // 必填,生成签名的随机串
         signature: appSignature.signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
-        jsApiList: [
-          'openUserProfile',
-          'previewFile'
-        ], // 必填
+        jsApiList: ['openUserProfile','previewFile'], // 必填
         success(res) {
-          console.log('agentConfig', res);
-          isfot = false
-          if (next) {
-            next()
-          }
-          if (ifHome) {
-            console.log('跳转首页')
-            Router.push({
-              name: 'home'
-            })
-          }
+          if (next) {next()}
         },
         fail(res) {
-          console.log('err', res);
           if (res.errMsg.indexOf('function not exist') > -1) {
             alert('版本过低请升级');
           }
@@ -124,4 +79,7 @@ async function wxConfigByCorp(ifHome, body, next) {
       });
     }
   });
+  Vue.prototype.$wx.error(function(res){
+      console.log('$wx.error'+res);
+  });
 }

+ 1 - 1
src/view/init.vue

@@ -14,7 +14,7 @@ export default {
     // this.$router.replace({name: 'login'})
   },
   activated(){
-    this.$router.replace({name: 'login'})
+    // this.$router.replace({name: 'login'})
   },
   methods: {
   }