snow 1 year ago
parent
commit
bb40f24d8f

File diff suppressed because it is too large
+ 5 - 5
dist/static/js/0.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/app.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-libs.js


+ 2 - 0
src/config/env.company.js

@@ -2,6 +2,8 @@
 module.exports = {
   title: '采销平台',
   baseUrl: 'http://wx.wxhr.sit.futurelab.tv',
+  wechatUrl: "http://rep.test241.wanyuhengtong.com", // 微信授权地址
+  backUrl: "http://webstock3.test241.wanyuhengtong.com", // 微信授权后重定向地址
   api: {
     baseApi: 'http://stocknew.test241.wanyuhengtong.com/'
     // baseApi: 'http://stockwm.test241.wanyuhengtong.com/'

+ 2 - 0
src/config/env.development.js

@@ -1,6 +1,8 @@
 // 生产环境
 module.exports = {
   title: '采销平台',
+  wechatUrl: "http://localhost:80", // 微信授权地址
+  backUrl: "http://localhost:8080", // 微信授权后重定向地址
   baseUrl: 'http://wx.wxhr.sit.futurelab.tv',
   api: {
     baseApi: 'http://stocknew.test241.wanyuhengtong.com/'

+ 2 - 2
src/store/modules/user.js

@@ -336,9 +336,9 @@ const actions = {
         } else {
           const { level, id } = udata;
           //是否超管
-          const isSupertube = level === "1";
+          const isSupertube = String(level) === "1";
           //是否供应商
-          const isSupplier = level === "3";
+          const isSupplier = String(level) === "3";
           //保存用户信息
           commit("setUserInfo", udata);
           // const 

+ 16 - 1
src/views/login/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="login-container">
+  <div class="login-container" v-if="!isWechatEnv">
     <div class="login-form-main">
       <el-form
         ref="loginForm"
@@ -125,6 +125,7 @@ import asyncRequest from '@/apis/service/user'
 import Identify from '@/components/identify'
 import urlConfig from '@/apis/url-config'
 import resToken from '@/mixins/resToken'
+import config from '@/config'
 
 export default {
   name: 'Login',
@@ -175,6 +176,7 @@ export default {
     return {
       ver: '',
       show: false,
+      isWechatEnv:false,
       loginTitle: urlConfig.loginTitle,
       loginBeian: urlConfig.loginBeian,
       loginBeianUrl: urlConfig.loginBeianUrl,
@@ -221,6 +223,16 @@ export default {
       immediate: true
     }
   },
+  created(){
+    const ua = window.navigator.userAgent.toLowerCase();
+    this.isWechatEnv = ua.match(/micromessenger/i) == 'micromessenger' && window.location.search !== "?from=authorization";
+
+    //
+    if (this.isWechatEnv) {
+      this.wechatLogin();
+      return
+    }
+  },
   mounted() {
     this.refreshCode()
     this.bindEnterEvent()
@@ -235,6 +247,9 @@ export default {
     this.removeEnterEvent()
   },
   methods: {
+    wechatLogin(){
+      window.location.href = `${config.wechatUrl}?back=${config.backUrl}&name=${config.title}`
+    },
     bindEnterEvent() {
       window.addEventListener('keydown', this.listener)
     },

Some files were not shown because too many files changed in this diff