tongshanglei 2 년 전
부모
커밋
2652ad2e55
4개의 변경된 파일43개의 추가작업 그리고 7개의 파일을 삭제
  1. 21 1
      src/main.js
  2. 1 1
      src/pages/kede/devices/index.vue
  3. 20 4
      src/pages/kede/login/login.vue
  4. 1 1
      src/router/index.js

+ 21 - 1
src/main.js

@@ -51,7 +51,26 @@ Vue.config.productionTip = false
  *  - 运营:yys_login 
  */
 router.beforeEach((to,from,next)=>{
-  // console.log('to.....',to);
+  console.log('to.....',to);
+  var url = window.location.href ;             //获取当前url
+
+  var dz_url = url.split('#')[0];                //获取#/之前的字符串
+
+  var cs = dz_url.split('?')[1];                //获取?之后的参数字符串
+
+  var cs_arr = cs.split('&');                    //参数字符串分割为数组
+
+  var param={};
+
+  for(var i=0;i<cs_arr.length;i++){         //遍历数组,拿到json对象
+
+    param[cs_arr[i].split('=')[0]] = cs_arr[i].split('=')[1]
+
+  }
+console.log(param)
+if(param.openid){
+  localStorage.setItem('openid', param.openid);
+}
 
   //车牌扫码校验临时
   if(to.name == 'vehicle' || to.name == 'vehicledecode'){
@@ -65,6 +84,7 @@ router.beforeEach((to,from,next)=>{
 
 
   let query = to.query || {};
+  console.log(query);
   if (query.openid) {
     localStorage.setItem('openid', query.openid);
   }

+ 1 - 1
src/pages/kede/devices/index.vue

@@ -71,7 +71,7 @@
 
  
           <template #default>
-            <van-button @click="goPage('buyInsure',{vehicle_info:item})" type="primary" size="small">购买保险</van-button>
+            <!-- <van-button @click="goPage('buyInsure',{vehicle_info:item})" type="primary" size="small">购买保险</van-button> -->
             <van-button @click="showActionSheet(item)" type="info" size="small">车辆详情</van-button>
           </template>
         </van-cell>

+ 20 - 4
src/pages/kede/login/login.vue

@@ -30,18 +30,18 @@
                 <van-button round block type="info" size="small" native-type="submit">登录</van-button>
             </div>
             <!-- 注册,团体卡牌用户无需注册 -->
-            <div style="text-align:center;" v-if="allowRegist">
+            <!-- <div style="text-align:center;" v-if="allowRegist">
                 没有账号?
                 <router-link to="register">
                     <span style="color:#2196f3;margin-left:5px">前往注册</span>
                 </router-link>
             </div>
-            <p v-else style="text-align:center;">团体卡牌用户无需注册,账号密码请咨询发卡人。</p>
+            <p v-else style="text-align:center;">团体卡牌用户无需注册,账号密码请咨询发卡人。</p> -->
             <!-- 忘记密码 -->
             <div style="text-align:center;padding-top:15px;">
                 忘记密码?
                 <router-link to="reset_pwd">
-                    <span style="color:#2196f3;margin-left:5px">前往重置</span>
+                    <span style="color:#2196f3;margin-left:5px">点击前往重置</span>
                 </router-link>
             </div>
         </van-form>
@@ -159,7 +159,23 @@ export default {
             if (openid) {
                 return openid;
             }
-            openid = this.$route.query.openid || '';
+              var url = window.location.href ;             //获取当前url
+
+                var dz_url = url.split('#')[0];                //获取#/之前的字符串
+
+                var cs = dz_url.split('?')[1];                //获取?之后的参数字符串
+
+                var cs_arr = cs.split('&');                    //参数字符串分割为数组
+
+                var param={};
+
+                for(var i=0;i<cs_arr.length;i++){         //遍历数组,拿到json对象
+
+                    param[cs_arr[i].split('=')[0]] = cs_arr[i].split('=')[1]
+
+                }
+                console.log(param)
+            openid = param.openid || '';
             if (openid) {
                 localStorage.setItem('openid', openid); 
             }

+ 1 - 1
src/router/index.js

@@ -7,7 +7,7 @@ import YysSosAlarm from '@/pages/yys/alarm/sos_alarm'
 Vue.use(Router)
 
 export default new Router({
-  mode: 'history',
+  mode: 'hash',
   routes: [
     {
       path: "/",