Kaynağa Gözat

Merge branch 'x_wx_d' into d_tid_1

谢杰标 2 yıl önce
ebeveyn
işleme
89a358029e

+ 2 - 1
pages/course/index.vue

@@ -356,6 +356,7 @@
       mode="bottom"
       border-radius="32"
       :mask-close-able="false"
+      :closeable="!!selObj.bId"
     >
       <view class="popuBox">
         <view class="popuBox-title">选择分类</view>
@@ -657,7 +658,7 @@ export default {
   computed: { ...mapGetters(["userInfo", "config"]) },
 };
 </script>
-<style >
+<style>
 ::-webkit-scrollbar {
   width: 0;
   height: 0;

+ 24 - 2
pages2/register/register.vue

@@ -41,6 +41,12 @@
               placeholder-style="color:#999999"
               placeholder="请输入登录密码"
           /></u-form-item>
+          <u-form-item prop="idcard"
+            ><u-input
+              v-model="form.idcard"
+              placeholder-style="color:#999999"
+              placeholder="请输入身份证号码"
+          /></u-form-item>
         </u-form>
       </view>
       <view style="margin: 30rpx 0">
@@ -631,6 +637,20 @@ export default {
             trigger: ["change"],
           },
         ],
+        idcard: [
+          {
+            required: true,
+            message: "请输入身份证号",
+            trigger: ["change", "blur"],
+          },
+          {
+            validator: (rule, value, callback) => {
+              return this.$u.test.idCard(value);
+            },
+            message: "身份证号不正确",
+            trigger: ["change", "blur"],
+          },
+        ],
       },
       isUse: false,
       isBack: false,
@@ -669,6 +689,7 @@ export default {
             tel: this.form.tel,
             code: this.form.code,
             pwd: this.form.pwd,
+            idcard: this.form.idcard,
           };
           if (uni.getStorageSync("newUser_sc")) {
             datas["shareCode"] = uni.getStorageSync("newUser_sc");
@@ -720,6 +741,7 @@ export default {
                               // if (this.scanCode) { // pc扫码进来登录成功
                               // 	this.submitCode()
                               // } else
+                              // !that.isBack
                               if (!that.isBack) {
                                 uni.reLaunch({
                                   url: "/pages/index/index",
@@ -857,7 +879,7 @@ export default {
 }
 .login_box {
   width: 100%;
-  height: 500rpx;
+  height: 580rpx;
   background: #ffffff;
   box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(1, 99, 235, 0.1);
   border-radius: 24rpx;
@@ -959,4 +981,4 @@ export default {
     }
   }
 }
-</style>
+</style>

+ 9 - 2
pages4/login/login.vue

@@ -261,7 +261,7 @@ export default {
         });
       } else {
         uni.navigateTo({
-          url: "/pages2/register/register?isBack=" + false,
+          url: "/pages2/register/register",
         });
       }
     },
@@ -278,6 +278,13 @@ export default {
           if (res.data.code == 200) {
             this.loginCallback(res, "wxlogin");
           } else {
+            if (res.data.code == 666) {
+              this.$u.toast(res.data.msg);
+              setTimeout(() => {
+                this.toRegister();
+              }, 500);
+              return;
+            }
             this.getwxCode(); // code用完一次就会过期,防止用户点击取消后再点微信登录后code过期
             // this.$u.toast(res.data.msg);
           }
@@ -639,4 +646,4 @@ export default {
   position: absolute;
   left: 30rpx;
 }
-</style>
+</style>

+ 149 - 120
pages4/login/pcLogin.vue

@@ -1,135 +1,164 @@
 <template>
-    <view class="pcLogins">
-        <u-navbar :is-back="false" title="登录" :border-bottom="false"  title-color="#333333" back-icon-color="#ffffff">
-        </u-navbar>
-        <u-line color="#D6D6DB" />
-        <view class="contents">
-            <!-- 正文内容 -->
-            <image class="logo" :src="SCAN_LOGO" style="width: 360rpx;height: 72rpx;"></image>
-            <text>登录后您可在网页端继续浏览课程</text>
-            <!-- <view class="login_bt" @click="pcLogin()">微信登录</view> -->
-            <button type="default" open-type="getPhoneNumber" @getphonenumber="wxLogin" class="login_bt">微信登录</button>
-        </view>
+  <view class="pcLogins">
+    <u-navbar
+      :is-back="false"
+      title="登录"
+      :border-bottom="false"
+      title-color="#333333"
+      back-icon-color="#ffffff"
+    >
+    </u-navbar>
+    <u-line color="#D6D6DB" />
+    <view class="contents">
+      <!-- 正文内容 -->
+      <image
+        class="logo"
+        :src="SCAN_LOGO"
+        style="width: 360rpx; height: 72rpx"
+      ></image>
+      <text>登录后您可在网页端继续浏览课程</text>
+      <!-- <view class="login_bt" @click="pcLogin()">微信登录</view> -->
+      <button
+        type="default"
+        open-type="getPhoneNumber"
+        @getphonenumber="wxLogin"
+        class="login_bt"
+      >
+        微信登录
+      </button>
     </view>
+  </view>
 </template>
 
 <script>
-import config from '@/common/config'
+import config from "@/common/config";
 export default {
-    data() {
-        return {
-            SCAN_LOGO:config.SCAN_LOGO,
-            scanCode: '', // 获取扫码的路径最后面的6位标识码
-            code: '',
+  data() {
+    return {
+      SCAN_LOGO: config.SCAN_LOGO,
+      scanCode: "", // 获取扫码的路径最后面的6位标识码
+      code: "",
+    };
+  },
+  onLoad(query) {
+    const q = decodeURIComponent(query.q);
+    this.scanCode = q.substring(q.length - 6);
+    console.log("扫描后得:", q, this.scanCode);
+    // 扫描二维码后调用,小程序已扫码
+    if (this.scanCode) {
+      this.$api.scanhasCode({ scanCode: this.scanCode }).then((res) => {
+        console.log("调用扫码接口返回的:", res);
+        if (res.data.code == 200) {
+          console.log();
         }
+      });
+    }
+  },
+  onShow() {
+    // 获取code
+    this.getwxCode();
+  },
+  methods: {
+    getwxCode() {
+      uni.login({
+        provider: "weixin",
+        success: (loginRes) => {
+          this.code = loginRes.code;
+          console.log("获取的code:", this.code);
+        },
+      });
+    },
+    wxLogin(e) {
+      this.$api
+        .wxLogin({
+          code: this.code,
+          encryptedData: e.detail.encryptedData,
+          iv: e.detail.iv,
+        })
+        .then((res) => {
+          if (res.data.code == 200) {
+            this.loginCallback(res);
+          } else {
+            if (res.data.code == 666) {
+              this.$u.toast(res.data.msg); 
+              setTimeout(() => {
+                uni.navigateTo({
+                  url: "/pages2/register/register" ,
+                });
+              }, 500);
+              return;
+            }
+            this.getwxCode(); // code用完一次就会过期,防止用户点击取消后再点微信登录后code过期
+          }
+        });
     },
-    onLoad(query) {
-        const q = decodeURIComponent(query.q)
-        this.scanCode = q.substring(q.length - 6)
-        console.log('扫描后得:', q, this.scanCode)
-        // 扫描二维码后调用,小程序已扫码
-        if (this.scanCode) {
-            this.$api.scanhasCode({scanCode: this.scanCode}).then((res) => {
-                console.log('调用扫码接口返回的:', res)
-                if (res.data.code == 200) {
-                    console.log()
-                }
-            })
+    // 微信登录成功的回调
+    loginCallback(res) {
+      // console.log('登录后的回调',res)
+      // if(res.data.data && res.data.data.full_info){
+      //信息完善,直接进入页面
+      uni.setStorageSync("user_account", res.data.data.user_account);
+      uni.setStorageSync("token", res.data.data.token);
+      // /app/user/getInfo 登录用户信息// fromPlat来源平台 1小程序 2PC网站
+      this.$api.getInfo({ fromPlat: 1 }).then((resdata) => {
+        if (resdata.data.code == 200) {
+          this.$store.state.userInfo = resdata.data.data;
+
+          this.submitCode();
         }
-	},
-    onShow() {
-		// 获取code
-		this.getwxCode()
-	},
-    methods: {
-        getwxCode() {
-			uni.login({
-				provider: 'weixin',
-				success: (loginRes) => {
-					this.code = loginRes.code
-					console.log('获取的code:', this.code)
-				}
-			})
-		},
-        wxLogin(e) {
-			this.$api.wxLogin({
-				code: this.code,
-				encryptedData: e.detail.encryptedData,
-				iv:  e.detail.iv
-			}).then(res => {
-				if (res.data.code == 200) {
-					this.loginCallback(res)
-				} else {
-					this.getwxCode() // code用完一次就会过期,防止用户点击取消后再点微信登录后code过期
-				}
-			})
-		},
-        // 微信登录成功的回调
-		loginCallback(res) {
-			// console.log('登录后的回调',res)
-			// if(res.data.data && res.data.data.full_info){
-				//信息完善,直接进入页面
-				uni.setStorageSync('user_account', res.data.data.user_account);
-				uni.setStorageSync('token', res.data.data.token);
-				// /app/user/getInfo 登录用户信息// fromPlat来源平台 1小程序 2PC网站
-				this.$api.getInfo({ fromPlat: 1 }).then(resdata => {
-					if(resdata.data.code == 200){
-						this.$store.state.userInfo = resdata.data.data;
-						
-                        this.submitCode()
-					}
-					
-				});
-			// } else {
-			// 	//未完善信息,存为临时信息
-			// 	uni.setStorageSync('user_account_temp', res.data.data.user_account);
-			// 	uni.setStorageSync('token_temp', res.data.data.token);
-            //     this.$navTo.togo('/pages2/register/bind', {scanCode: this.scanCode})
-			// }	
-		},
-		// scanLoginCheck小程序校验PC登录二维码,执行登录获取到令牌,然后把扫码的路径最后面的6位标识码提交给后台就行
-		submitCode() {
-			this.$api.scanLoginCheck({
-				scanCode: this.scanCode
-			}).then((res) => {
-				if (res.data.code == 200) {
-					uni.navigateTo({
-						url: '/pages4/login/pcLoginSuccess'
-					})
-				} else {
-					this.$u.toast(res.data.msg)
-				}
-			})
-		},
-    }
-}
+      });
+      // } else {
+      // 	//未完善信息,存为临时信息
+      // 	uni.setStorageSync('user_account_temp', res.data.data.user_account);
+      // 	uni.setStorageSync('token_temp', res.data.data.token);
+      //     this.$navTo.togo('/pages2/register/bind', {scanCode: this.scanCode})
+      // }
+    },
+    // scanLoginCheck小程序校验PC登录二维码,执行登录获取到令牌,然后把扫码的路径最后面的6位标识码提交给后台就行
+    submitCode() {
+      this.$api
+        .scanLoginCheck({
+          scanCode: this.scanCode,
+        })
+        .then((res) => {
+          if (res.data.code == 200) {
+            uni.navigateTo({
+              url: "/pages4/login/pcLoginSuccess",
+            });
+          } else {
+            this.$u.toast(res.data.msg);
+          }
+        });
+    },
+  },
+};
 </script>
 
 <style lang="scss" scoped>
 .contents {
-    width: 100%;
-    height: 100%;
+  width: 100%;
+  height: 100%;
+  text-align: center;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  .logo {
+    margin: 90rpx 0rpx 250rpx;
+  }
+  > text {
+    font-size: 22rpx;
+    color: #666;
+  }
+  .login_bt {
+    width: 400rpx;
+    height: 70rpx;
+    line-height: 70rpx;
     text-align: center;
-    display: flex;
-    flex-direction: column;
-    align-items: center;
-    .logo {
-        margin: 90rpx 0rpx 250rpx;
-    }
-    >text {
-        font-size: 22rpx;
-        color: #666;
-    }
-    .login_bt {
-        width: 400rpx;
-        height: 70rpx;
-        line-height: 70rpx;
-        text-align: center;
-        background: #09ba08;
-        color: #fff;
-        font-size: 28rpx;
-        border-radius: 35rpx;
-        margin-top: 20rpx;
-    }
+    background: #09ba08;
+    color: #fff;
+    font-size: 28rpx;
+    border-radius: 35rpx;
+    margin-top: 20rpx;
+  }
 }
-</style>
+</style>