Browse Source

直播页面跳转和信息填写页面

xuqiaoying 3 năm trước cách đây
mục cha
commit
7e6475db08
2 tập tin đã thay đổi với 100 bổ sung21 xóa
  1. 87 15
      pages/webview/index.vue
  2. 13 6
      pages2/verify/input.vue

+ 87 - 15
pages/webview/index.vue

@@ -1,6 +1,15 @@
 <template>
   <view class="webview">
-    <web-view :webview-styles="webviewStyles" :src="url"></web-view>
+    <template v-if="url">
+      <web-view :webview-styles="webviewStyles" :src="url"></web-view>
+    </template>
+    
+    <u-popup v-model="showAuth" mode="center" border-radius="50">
+      <view class="popCentent">
+        <view class="tips">您还没有开通直播课程,无法观看</view>
+        <view class="btns" @click="toAuth()">立即开通</view>
+      </view>
+    </u-popup>
   </view>
 </template>
 
@@ -25,8 +34,29 @@ export default {
       courseId: 0,
       sectionId: 0,
       orderGoodsId: 0,
+      paramObj: {},
+      showAuth: true,
+      checkStatus: 0, // 0没有权限,1有权限
+      checkMsg: '',
+      goodsStatus: 0, // 0未上架,1上架
+
     };
   },
+  onShareAppMessage() {
+    let item = this.paramObj
+    let moduleId = item.moduleId || 0
+    let chapterId = item.chapterId || 0
+    let sectionId = item.sectionId
+    let uuid = new Date().valueOf() + ""
+    // buyCourse 是否购买课程:1是 0否
+    let encode = encodeURIComponent(WEBVIEW_URL+'pages/live/index?token='+uni.getStorageSync('token')+'&userInfo='+JSON.stringify(this.userInfo)+'&channelId='
+    +item.liveUrl+'&gradeId='+0+'&courseId='+item.courseId+'&goodsId='+item.goodsId+'&orderGoodsId='+item.orderGoodsId+'&sectionId='+sectionId+'&chapterId='
+    +chapterId+'&moduleId='+moduleId+'&buyCourse='+item.buyCourse+'&ident='+uuid)
+		return {
+			title: '直播',
+			path: `/pages/webview/index?url=` + encode
+		};
+	},
   onLoad(option) {
     console.log('--option-', option)
     this.options = option
@@ -45,14 +75,15 @@ export default {
     if (this.optObj.a == 1) {
       this.getParam()
     } else {
-      this.url = decodeURIComponent(this.options.url);
+      this.url = decodeURIComponent(decodeURIComponent(this.options.url))
       console.log('小程序进来的url:', this.url)
-      let index = this.options.url.indexOf('?')
-      let paramArr = this.options.url.slice(index + 1).split('&')
+      let index = this.url.indexOf('?')
+      let paramArr = this.url.slice(index + 1).split('&')
       let paramObj = {}
       for (let i = 0; i < paramArr.length; i++) {
           paramObj[paramArr[i].split('=')[0]] = paramArr[i].split('=')[1]
       }
+      this.paramObj = paramObj
       console.log('paramObj', paramObj)
       this.studyLog(paramObj)
     }
@@ -75,19 +106,29 @@ export default {
       }).then((res) => {
         if (res.data.code == 200) {
           let item = res.data.data
-          let moduleId = item.moduleId || 0
-          let chapterId = item.chapterId || 0
-          let sectionId = item.sectionId
-          let uuid = new Date().valueOf() + ""
-          // buyCourse 是否购买课程:1是 0否
-          this.url = WEBVIEW_URL+'pages/live/index?token='+uni.getStorageSync('token')+'&userInfo='+JSON.stringify(this.userInfo)+'&channelId='
-          +item.channelId+'&gradeId='+0+'&courseId='+item.courseId+'&goodsId='+item.goodsId+'&orderGoodsId='+item.orderGoodsId+'&sectionId='+sectionId
-          +'&chapterId='+chapterId+'&moduleId='+moduleId+'&buyCourse='+item.buyCourse+'&ident='+uuid
-          console.log('url:', this.url)
-
-          this.studyLog(item)
+          this.paramObj = item
+          this.goodsId = item.goodsId
+          this.goodsStatus = item.goodsStatus
+          if (item.checkStatus == 1) { // 有权限
+            let moduleId = item.moduleId || 0
+            let chapterId = item.chapterId || 0
+            let sectionId = item.sectionId
+            
+            let uuid = new Date().valueOf() + ""
+            // buyCourse 是否购买课程:1是 0否
+            this.url = WEBVIEW_URL+'pages/live/index?token='+uni.getStorageSync('token')+'&userInfo='+JSON.stringify(this.userInfo)+'&channelId='
+            +item.channelId+'&gradeId='+0+'&courseId='+item.courseId+'&goodsId='+item.goodsId+'&orderGoodsId='+item.orderGoodsId+'&sectionId='+sectionId
+            +'&chapterId='+chapterId+'&moduleId='+moduleId+'&buyCourse='+item.buyCourse+'&ident='+uuid
+            console.log('url:', this.url)
+            this.studyLog(item)
+          } else {
+            this.url = ''
+            
+          }
+          
         } else {
           this.$u.toast(res.data.msg)
+
         }
       })
 
@@ -111,9 +152,40 @@ export default {
         console.log('直播的用户学习日志:', res)
       })
     },
+    toAuth() {
+      if (this.goodsStatus == 1) { //已上架
+        uni.navigateTo({
+          url:'/pages3/course/detail?id='+this.goodsId
+        })
+      } else {
+        uni.switchTab({
+          url:'/pages/index/index'
+        })
+      }
+    },
   },
 };
 </script>
 
 <style lang="scss" scoped>
+.popCentent {
+  width: 600rpx;
+  height: 300rpx;
+  padding: 24rpx;
+  text-align: center;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  justify-content: space-between;
+  .btns {
+    width: 500rpx;
+    height: 80rpx;
+    line-height: 80rpx;
+    text-align: center;
+    background-color: #3577E8;
+    color: #fff;
+    font-size: 24rpx;
+    border-radius: 20rpx;
+  }
+}
 </style>

+ 13 - 6
pages2/verify/input.vue

@@ -32,12 +32,11 @@
               :label="item.fieldName"
               :required="item.required"
               :label-width="auto"
-              :disabled="form.name ? true : false"
               :prop="item.required ? item.fieldKey : ''"
             >
               <u-input
-                disabled
                 v-model="form.name"
+                :disabled="disName"
                 :placeholder="`请输入${item.fieldName}`"
               />
             </u-form-item>
@@ -47,11 +46,10 @@
               :label="item.fieldName"
               :required="item.required"
               :label-width="auto"
-              :disabled="form.idcard ? true : false"
               :prop="item.required ? item.fieldKey : ''"
             >
               <u-input
-                disabled
+                :disabled="disCard"
                 v-model="form.idcard"
                 :placeholder="`请输入${item.fieldName}`"
               />
@@ -716,6 +714,8 @@ export default {
       orderGoodsId: 0,
       veryIdCard: "",
       veryIdName: "",
+      disName: false, // 姓名是否禁止输入
+      disCard: false, // 身份证是否禁止输入
     };
   },
   created() {
@@ -745,6 +745,7 @@ export default {
         this.listData.forEach((item) => {
           if (item.fieldKey == "idcard") {
             this.form.idcard = this.userInfo.idCard;
+            console.log('监听监听111')
           }
           if (item.fieldKey == "telphone") {
             this.form.telphone = this.userInfo.telphone;
@@ -752,6 +753,7 @@ export default {
 
           if (item.fieldKey == "name") {
             this.form.name = this.userInfo.realname;
+            console.log('监听监听')
           }
         });
       }
@@ -759,6 +761,9 @@ export default {
   },
   methods: {
     ...mapActions(["getUserInfo"]),
+    inputName(event) {
+      console.log('enevt', event, this.form.name)
+    },
     clickIndex(inds) {
       if (inds === 0) {
         this.uploadImgs();
@@ -1589,7 +1594,7 @@ export default {
      *  getbaseprofiletpgetInfo接口返回值result.data.data不存在的话说明是第一次填写资料
      */
     getInfo() {
-      console.log("getInfo");
+      console.log("getInfo", this.userInfo);
       return new Promise((resolve) => {
         var self = this;
         this.$api.getbaseprofiletpId(this.goodsId).then((res) => {
@@ -1601,6 +1606,7 @@ export default {
             if (item.fieldKey == "idcard") {
               console.log(this.userInfo.idCard, "this.userInfo.idCard");
               this.form.idcard = this.userInfo.idCard;
+              this.disCard = this.form.idcard ? true : false
               console.log(this.form.idcard);
             }
             if (item.fieldKey == "telphone") {
@@ -1612,7 +1618,8 @@ export default {
             if (item.fieldKey == "name") {
               console.log(this.userInfo.realname, "this.userInfo.realname");
               this.form.name = this.userInfo.realname;
-              console.log(this.form.name);
+              this.disName = this.form.name ? true : false
+              console.log('this.disName', this.form.name, this.disName);
             }
           });
           self.isRequired = self.listData.every((ims) => {