Jelajahi Sumber

用户未登录流程梳理v3

john.hong 2 tahun lalu
induk
melakukan
a0c24a2f46

+ 3 - 0
src/App.vue

@@ -74,6 +74,9 @@ export default {
       uni.setStorageSync('env', window.env);
       // 如果是微信小程序。初始化wss
       if (getIsMin()) {
+        if (window.location.href.indexOf('cryptojs') > -1) {
+          return
+        }
         // 保留 carList
         const carList = uni.getStorageSync('carList');
         // 每次进入页面清空 缓存数据

+ 1 - 1
src/pages/parkingFee/mixins/parkingFee.js

@@ -120,7 +120,7 @@ export default {
     }
     const member = uni.getStorageSync('member');
     // 如果用户未登录的话,返回之后,重新获取数据用户的基础数据
-    if (!member && !uni.getStorageSync('isLogin') && window?.toWXSendMsg) {
+    if (!member && window?.toWXSendMsg) {
       wxToLoginCallback('parkingFee', (options) => {
         this.$store.commit('SET_IS_INIT', false);
         // 请求 projectId

+ 1 - 1
src/pages/parkingFee/mixins/parkingFeeDetail.js

@@ -105,7 +105,7 @@ export default {
   methods: {
     // 前往支付
     async toPay() {
-      const { parkingRecord, discountInfo = {}, parkingRule } = this.orderDetail;
+      const { parkingRecord, discountInfo = {}, parkingRule = {}} = this.orderDetail;
       const { coupons, points } = discountInfo
       const { hourPrice } = parkingRule
       try {

+ 11 - 49
src/pages/parkingFee/mixins/vehicleManagement.js

@@ -49,30 +49,7 @@ export default {
   },
 
   async created() {
-    const option = this.$route.query;
-    this.options = option;
-    await this.$onLaunched;
-    this.localimgPic = this.$staticPicUrl + '/wxminilocalimg/parkingFee/';
-    // #ifdef H5
-    app.globalData.member = JSON.parse(uni.getStorageSync('member'));
-    // #endif
-    // 场景二维码记录(是否扫码进入)
-    app.globalData.paramsScene = {};
-    this.$saveSceneQrcodeDetail(
-      'page',
-      'vehicleManagement',
-      '车牌管理',
-      '',
-      '',
-      '',
-      ''
-    );
-    // 埋点本地化
-    this.preUrl = uni.getStorageSync('previousUrl');
-    uni.setStorageSync(
-      'previousUrl',
-      '/pages/parkingFee/vehicleManagement.vue'
-    );
+    this.options = this.$route.query;
   },
   async mounted() {
     setTimeout(() => {
@@ -80,42 +57,27 @@ export default {
         title: '车辆管理',
       });
     }, 300);
-    // await this.$onLaunched
-    // this.isBeijing = isCruMarketByKey('北京');
     const member = uni.getStorageSync('member');
-    console.log('member', member);
     if (member && JSON.stringify(this.member) !== '{}') {
       this.getKipMemberVehicles();
     } else {
       wxToLoginCallback('vehicleManagement', (options) => {
-        // console.log(229, options);
         if (options?.noLoginParkingFeeWebView === 'fail') {
           // 如果是用户明确拒绝登录,执行这段逻辑
-          Toast({
-            message: '您还未登录,请登录',
-            icon: 'none',
-            onClose: () => {
-              console.log(97, '后退页面');
-              this.$router.back();
-              return
-            },
-          });
+          setTimeout(() => {
+            Toast({
+              message: '您还未登录,请登录',
+              icon: 'none',
+              onClose: () => {
+                this.$router.back();
+                return
+              },
+            });
+          }, 300)
         } else {
           this.$router.back();
         }
       });
-      // const regSource = REG_SOURCE.PARKING;
-      // app.globalData.regSource = regSource;
-      // if (this.options?.regSource) {
-      //   app.globalData.regSource = REG_SOURCE[this.options?.regSource];
-      // }
-      // if (this.options?.tpName) {
-      //   app.globalData.tpName = this.options?.tpName;
-      // }
-      // // this.$refs.authorize.login('/pages/parkingFee/parkingFee', () => {
-      // //   this.getKipMemberVehicles()
-      // // })
-      // this.getKipMemberVehicles();
     }
   },
   onUnload() {

+ 5 - 2
vue.config.js

@@ -78,8 +78,11 @@ module.exports = {
         return newArgs;
       })
       .end();
-      // 编译之后清理console.log
-      config.optimization.minimizer('vue').use(TerserPlugin, [{ terserOptions: { compress: { drop_console: true } } }])
+      if ( process.env.NODE_ENV === 'production' ) {
+        // 编译之后清理console.log
+        config.optimization.minimizer('vue').use(TerserPlugin, [{ terserOptions: { compress: { drop_console: true } } }])  
+      }
+      
   },
   configureWebpack: {
     devtool: process.env.NODE_ENV === 'dev' ? 'source-map' : undefined,