Browse Source

'初始化版本0.0.02'

哥哥玩剑魂呢 4 years ago
parent
commit
ff8b0ad970

+ 3 - 1
config/dev.env.js

@@ -3,9 +3,11 @@ module.exports = {
   ENV_CONFIG: '"dev"',
   // BASE_API: '"https://new.gdy.g107.com"',
   // SERVE_AD: '"https://nkaoqin.g107.net"'
-  BASE_API: '"http://192.168.0.88:8888"',
+  BASE_API: '"http://test.qywx.g107.net"',
   SERVE_AD: '"https://nkaoqin.g107.net"',
   APPID: '"ww4065f0d4bb232a6a"',
+  // APPID: '"ww1d41fd7a34ed1a64"',//测试
+  REDIRECT_URI: '"http%3A%2F%2Fwechatdings.vaiwan.com"',
   // BASE_API: '"https://oa.g107.com"',
   // SERVE_AD:'"https://ad.g107.com"'
 }

+ 1 - 1
src/permission.js

@@ -15,7 +15,7 @@ function hasPermission(roles, permissionRoles) {
   return roles.some(role => permissionRoles.indexOf(role) >= 0)
 }
 // 免登名单
-const whiteList = ['/invite_new_company', '/create_company', '/login','/noAccess' , '/loginbytoken', '/reg', '/forgetPwd', '/resetPwd', '/android', '/demo', '/swiperShow','/autoLogin' ]// no redirect whitelist
+const whiteList = ['/invite_new_company', '/create_company', '/login' , '/loginTransfer' ,'/noAccess' , '/loginbytoken', '/reg', '/forgetPwd', '/resetPwd', '/android', '/demo', '/swiperShow','/autoLogin' ]// no redirect whitelist
 
 router.beforeEach((to, from, next) => {
   if(Vue.$httpRequestList.length>0){        //强行中断时才向下执行

+ 6 - 0
src/router/index.js

@@ -25,6 +25,12 @@ export const constantRouterMap = [
     hidden: true,
     meta: { pushindex : true},
   },
+  {
+    path: '/loginTransfer',
+    name: 'loginTransfer',
+    component: () => import('@/views/login/loginTransfer'),
+    hidden: true,
+  },
   // {
   //   path: '/login',
   //   name: 'login',

+ 1 - 1
src/utils/wxconfiguration.js

@@ -3,7 +3,7 @@ export function withoutCodeLoad() {
   console.log(process.env.APPID)
   let appid, redirect_uri, response_type, scope, state, wechat, agentid
   appid = process.env.APPID
-  redirect_uri = 'http%3A%2F%2Fwechatdings.vaiwan.com'
+  redirect_uri = process.env.REDIRECT_URI
   response_type = 'code'
   scope = 'snsapi_privateinfo'
   state = 'a'

+ 38 - 35
src/views/login/index1.vue

@@ -12,10 +12,8 @@
         </transition>
       </div>
     </div>
+    <pastDue></pastDue>
   </div>
-
-
-
 </template>
 
 <script>
@@ -23,12 +21,7 @@
   import axios from 'axios'
   import pastDue from "@/views/common/pastDue.vue"
   import QRCode  from "qrcodejs2"
-  import {isvalidUsername} from '@/utils/validate'
   import {getToken, setToken, getUser, getPasw, setUser, setPasw,} from '@/utils/auth' // getToken from cookie
-  import requests from '@/utils/request-user'
-  import { constants } from 'fs'
-  import { timestamps } from '@/utils/index'
-  import {allocation} from '@/api/configget'
   import { wxAuth } from '@/utils/wx-auth-two.js'; 
   import {withoutCodeLoad} from '@/utils/wxconfiguration.js'
 
@@ -44,14 +37,14 @@
     watch:{
     },
     created() {
-      if(/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
-        this.appPC = "手机"
-        window.alert("手机")
-        window.location.href = process.env.BASE_API+'/m'
-      } else {
-        this.appPC = "PC端"
-        // window.alert("PC端")
-      }
+      // if(/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
+      //   this.appPC = "手机"
+      //   window.alert("手机")
+      //   window.location.href = process.env.BASE_API+'/m'
+      // } else {
+      //   this.appPC = "PC端"
+      //   // window.alert("PC端")
+      // }
       this.$store.dispatch('setLanguage', 'zh')
       localStorage.setItem('login_code','0')
 
@@ -77,29 +70,39 @@
         }
       }
 
-      if(!codesif){//url没有code就放出登录按钮
+      if(!codesif){
         this.logImage = true
         this.loginButton = true
       }else{
-        let params = { code: codes }
-        axios.get(process.env.BASE_API+'/api/wechat/minAuth', { params: params })
-        .then(res => {
-          if(res.data.code == 1){
-            if(res.data.data.user.is_official == 1){
-              setToken(res.data.data.token)
-              this.$store.commit('SET_TOKEN', res.data.data.token)
-              localStorage.setItem('Experience_data',JSON.stringify({if:false,name:''}))
-              console.log(getToken())
-              wxAuth(true)
-            }else if(res.data.data.user.is_official == 0){
-              this.$router.push({path: '/noAccess'})
+        if (/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
+          window.location.href = 'http://wechatgdym.vaiwan.com?code='+codes+'&';
+        } else {
+          let params = { code: codes }
+          axios.get(process.env.BASE_API+'/api/wechat/minAuth', { params: params })
+          .then(res => {
+            if(res.data.code == 1){
+              if(res.data.data.user.is_official == 1){
+                setToken(res.data.data.token)
+                this.$store.commit('SET_TOKEN', res.data.data.token)
+                localStorage.setItem('Experience_data',JSON.stringify({if:false,name:''}))
+                console.log(getToken())
+                wxAuth(true)
+              }else if(res.data.data.user.is_official == 0){
+                this.$router.push({path: '/noAccess'})
+              }
+            }else if(res.data.code == 4444){
+              this.$store.state.user.pastDue = true
+              this.logButText = '重新登录'
+              this.loginButton = true
+              this.logImage = true
+            }else{
+              this.logButText = '重新登录'
+              this.loginButton = true
+              this.logImage = true
             }
-          }else{
-            this.logButText = '重新登录'
-            this.loginButton = true
-            this.logImage = true
-          }
-        })
+          })
+        }
+        
       }
     },
     mounted(){

+ 35 - 0
src/views/login/loginTransfer.vue

@@ -0,0 +1,35 @@
+<template>
+  <div class="">
+  </div>
+</template>
+
+<script>
+export default {
+  data() {
+    return {};
+  },
+  created() {
+    // window.location.href = 'http://wechatgdym.vaiwan.com';
+    // let url = window.location.href
+    // alert(url)
+    // if(url.split('#')[0] == 'http://wechatgdym.vaiwan.com/'){
+    //   this.$router.push({path: '/login'})
+    // }else{
+    //   window.location.href = 'http://wechatgdym.vaiwan.com';
+    // }
+    if (/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
+      window.alert("手机"+process.env.BASE_API+":8082");
+      // window.location.href = process.env.BASE_API;
+      // window.location.href = process.env.BASE_API+":8082";
+      window.location.href = 'http://wechatgdym.vaiwan.com';
+    } else {
+    //   window.alert("PC");
+      this.$router.push({path: '/login'})
+    }
+  },
+  mounted() {},
+  methods: {}
+};
+</script>
+
+<style type="text/css" scoped></style>