فهرست منبع

视频模块接入5,定位接入后

JXDS18FUJT 2 سال پیش
والد
کامیت
51bc00e6a2

+ 8 - 0
src/api/modules/user.js

@@ -87,6 +87,14 @@ const user = {
 			params
 		})
 
+	},
+	//查询当前用户考试会员列表
+	studentVipExamList(params){
+		return request({
+			url:'/student/vip/exam/list',
+			method:'GET',
+			params
+		})
 	}
 }
 

+ 25 - 17
src/otherPages/courseCatalog/components/courseCatalog.vue

@@ -3,6 +3,7 @@
     <view class="video">
       <view v-for="(item, index) in list" :key="index" class="video-item">
         <image
+          @click="goPlayVideo(item)"
           class="video-item-left"
           mode="widthFix"
           :src="item.videoCover"
@@ -37,7 +38,7 @@
     </view>
     <view class="pay">
       <view @click="buyRoadCourse" class="pay-text">
-        <text>立即支付&nbsp;&nbsp;¥{{ price/100 }}</text>
+        <text>立即支付&nbsp;&nbsp;¥{{ price / 100 }}</text>
       </view>
       <image
         style="width: 100%"
@@ -59,7 +60,7 @@
 </template>
 
 <script>
-import api from '@/api'
+import api from "@/api";
 export default {
   data() {
     return {
@@ -69,19 +70,27 @@ export default {
     };
   },
   methods: {
-    buyRoadCourse() {
-    let systemInfo = wx.getSystemInfoSync()
-    api.buy.studentWxXcxPrepareOrder({
-     examId:this.examId,
-     foreType:2,
-     phoneType:systemInfo.platform=='ios'?1:2
-
-    }).then(res=>{
-      wx.requestPayment(res.data)
+    goPlayVideo(item){
+      let queryJson = JSON.stringify({
+        url:item.videoUrl
+      })
+      uni.navigateTo({
+        url:'/otherPages/playVideo/index?query='+queryJson
+      })
 
-    })
-      
-    }
+    },
+    buyRoadCourse() {
+      let systemInfo = wx.getSystemInfoSync();
+      api.buy
+        .studentWxXcxPrepareOrder({
+          examId: this.examId,
+          foreType: 2,
+          phoneType: systemInfo.platform == "ios" ? 1 : 2,
+        })
+        .then((res) => {
+          wx.requestPayment(res.data);
+        });
+    },
   },
   props: {
     list: {
@@ -92,11 +101,10 @@ export default {
       type: Number,
       default: 0,
     },
-    examId:{
+    examId: {
       type: Number,
       default: 0,
-
-    }
+    },
   },
   onLoad(query) {
     this.query = query;

+ 55 - 24
src/otherPages/examRoadVideo/index.vue

@@ -13,23 +13,19 @@
         >
           <input
             readonly
-            v-model="provice.province"
+            v-model="province.province"
             @click="
               () => {
-                proviceShow = true;
+                provinceShow = true;
               }
             "
             placeholder="省份"
-            class="header-provice"
+            class="header-province"
             type="text"
           />
           <input
             readonly
-            @click="
-              () => {
-                cityShow = true;
-              }
-            "
+            @click="isShowCity()"
             v-model="city.city"
             placeholder="地市"
             class="header-city"
@@ -37,7 +33,7 @@
           />
         </view>
       </view>
-      <van-popup round position="bottom" :show="proviceShow">
+      <van-popup round position="bottom" :show="provinceShow">
         <van-picker
           show-toolbar
           title="考场省份"
@@ -46,7 +42,7 @@
           @confirm="getExamCityAndProviceName"
           @cancel="
             () => {
-              proviceShow = false;
+              provinceShow = false;
             }
           "
         />
@@ -68,6 +64,12 @@
     </view>
     <view class="content">
       <view class="list">
+        <van-empty
+          v-if="examRoomList.length == 0"
+          class="custom-image"
+          image="https://img.yzcdn.cn/vant/custom-empty-image.png"
+          description="该城市无视频"
+        />
         <view
           class="list-item"
           v-for="(item, index) in examRoomList"
@@ -101,18 +103,32 @@ export default {
     return {
       query: {},
       cityShow: false,
-      proviceShow: false,
+      provinceShow: false,
       examProviceList: [],
       examCityList: [],
       examRoomList: [],
-      provice: { provinceId: "", province: "" },
+      province: { provinceId: "", province: "" },
       city: { cityId: "", city: "" },
     };
   },
   methods: {
+    isShowCity() {
+      if (this.province.provinceId && this.province.province) {
+        this.cityShow = true;
+      } else {
+        uni.showToast({
+          title: "请先选择省份",
+          icon: "none",
+        });
+      }
+    },
     goCourseCatalog(item) {
       uni.navigateTo({
-        url: "/otherPages/courseCatalog/index?examId=" + item.id+'&price='+item.price,
+        url:
+          "/otherPages/courseCatalog/index?examId=" +
+          item.id +
+          "&price=" +
+          item.price,
       });
     },
     getCityName(e) {
@@ -127,8 +143,8 @@ export default {
         });
     },
     getExamCityAndProviceName(e) {
-      this.proviceShow = false;
-      this.provice = e.detail.value;
+      this.provinceShow = false;
+      this.province = e.detail.value;
       api.exam
         .studentExamInfoCityProviceId(e.detail.value.provinceId)
         .then((res) => {
@@ -139,17 +155,32 @@ export default {
   },
   onLoad(query) {
     this.query = query;
-    api.exam.studentExamInfoIp()
+    api.user.studentVipExamList().then(res=>{
+      uni.setStorageSync('examRoom',res.rows)
+
+    })
+    api.exam.studentExamInfoIp().then((res) => {
+      this.city.city = res.data.cityName;
+      this.city.cityId = Number(res.data.city);
+      this.province.province = res.data.provinceName;
+      this.province.provinceId = Number(res.data.province);
+      api.exam
+        .studentExamInfoList({
+          ...this.city,
+        })
+        .then((result) => {
+          this.examRoomList = result.rows;
+          if (result.rows.length == 0) {
+            this.city.city = "";
+            this.city.cityId = "";
+            this.province.province = "";
+            this.province.provinceId = "";
+          }
+        });
+    });
     api.exam.studentExamInfoGetProvice().then((res) => {
       this.examProviceList = res.data;
     });
-    api.exam
-      .studentExamInfoList({
-        ...this.city,
-      })
-      .then((res) => {
-        this.examRoomList = res.rows;
-      });
   },
 };
 </script>
@@ -170,7 +201,7 @@ export default {
     width: 100%;
     height: 100rpx;
   }
-  .header-provice {
+  .header-province {
     width: 336rpx;
     height: 60rpx;
     background: #fff;

+ 34 - 0
src/otherPages/playVideo/index.vue

@@ -0,0 +1,34 @@
+<template>
+    <view class="bg">
+        <video class="video" :src="query.src" show-snapshot-button object-fit="contain" >
+
+        </video>
+    </view>
+</template>
+
+<script>
+    export default {
+        data() {
+            return {
+                query:{
+                    src:''
+                }
+             
+            }
+        },
+        onLoad(query){
+            this.query =query
+            
+        }
+        
+    }
+</script>
+
+<style lang="scss" scoped>
+.bg{
+    width: 100%;
+}
+.video{
+    width: 100%;
+}
+</style>

+ 21 - 22
src/pages.json

@@ -215,19 +215,22 @@
           "path": "marked/index",
           "styles": {}
         },
+        {
+          "path": "playVideo/index",
+          "styles": {}
+        },
         {
           "path": "examRoadVideo/index",
           "styles": {
-            "navigationStyle":"custom"
+            "navigationStyle": "custom"
           }
         },
         {
           "path": "courseCatalog/index",
           "styles": {
-            "navigationStyle":"custom"
+            "navigationStyle": "custom"
           }
         },
-   
         {
           "path": "userInfoAuth/index",
           "style": {
@@ -311,7 +314,6 @@
           "path": "collection/index",
           "style": {
             "navigationBarTitleText": "错题•收藏"
-
           }
         },
         {
@@ -425,8 +427,8 @@
     "navigationBarTitleText": "",
     "navigationBarBackgroundColor": "#F8F8F8",
     "backgroundColor": "#F8F8F8",
-    // #ifdef MP-WEIXIN
     "usingComponents": {
+      "van-empty":"./wxcomponents/vant/empty/index",
       "van-overlay": "./wxcomponents/vant/overlay/index",
       "van-tabbar": "./wxcomponents/vant/tabbar/index",
       "van-tabbar-item": "./wxcomponents/vant/tabbar-item/index",
@@ -463,12 +465,9 @@
       "van-grid": "wxcomponents/vant/grid/index",
       "van-grid-item": "wxcomponents/vant/grid-item/index",
       "van-nav-bar": "wxcomponents/vant/nav-bar/index"
-    },
-    "a": ""
-    // #endif
-    // #ifdef MP-TOUTIAO
-    "usingComponents": {}
-    // #endif
+    }
+
+   
   },
   "condition": {
     //模式配置,仅开发期间生效
@@ -477,29 +476,29 @@
       {
         "path": "otherPages/classifyChoose/index",
         "name": "分类练习",
-        "query":"liceCar=1&liceTruck=&liceBus=&liceMoto=&name=&gs=xc&cert=C1/C2/C3&vehicle=轿车&subject=1&title=精选考题&sort=3"
-
+        "query": "liceCar=1&liceTruck=&liceBus=&liceMoto=&name=&gs=xc&cert=C1/C2/C3&vehicle=轿车&subject=1&title=精选考题&sort=3"
+      },
+      {
+        "path": "otherPages/examRoadVideo/index",
+        "name": "道路视频"
       },
       {
         "path": "otherPages/userInfoAuth/index",
-        "name": "用户信息授权填写" 
-
+        "name": "用户信息授权填写"
       },
       {
         "path": "pages/user/index",
-        "name": "用户" 
-
+        "name": "用户"
       },
       {
         "path": "otherPages/mockExamEnd/index",
         "name": "考试结束",
-        "query":"score=0&useTime=0:1&questionIds=&type=exam&cert=C1/C2/C3&vehicle=轿车&subject=1&title=模拟考试&liceCar=1&liceTruck=&liceBus=&liceMoto=&name=科目一&gs=xc&sort=3"
-
+        "query": "score=0&useTime=0:1&questionIds=&type=exam&cert=C1/C2/C3&vehicle=轿车&subject=1&title=模拟考试&liceCar=1&liceTruck=&liceBus=&liceMoto=&name=科目一&gs=xc&sort=3"
       },
       {
-        "path":"otherPages/mockExam/index",
-        "name":"模拟考试",
-        "query":"liceCar=1&liceTruck=&liceBus=&liceMoto=&name=&gs=xc&cert=C1/C2/C3&vehicle=轿车&subject=1&title=模拟考试&sort=3"
+        "path": "otherPages/mockExam/index",
+        "name": "模拟考试",
+        "query": "liceCar=1&liceTruck=&liceBus=&liceMoto=&name=&gs=xc&cert=C1/C2/C3&vehicle=轿车&subject=1&title=模拟考试&sort=3"
       },
       {
         "name": "模拟考试开始", //模式名称

+ 1 - 0
src/store/getters.js

@@ -71,6 +71,7 @@ const getters = {
 
 
   },
+  
   avatar: state => state.user.avatar,
   name: state => state.user.name,
   introduction: state => state.user.introduction,