瀏覽代碼

新增道路视频

JXDS18FUJT 2 年之前
父節點
當前提交
e01efdaedc

+ 1 - 1
src/App.vue

@@ -29,7 +29,7 @@ export default {
                 // 新的版本下载失败
                 title: "已经有新版本了哟~",
                 content:
-                  "新版本已经上线啦~,请您删除当前小程序,重新搜索(极速生活圈)打开哟~",
+                  "新版本已经上线啦~,请您删除当前小程序,重新搜索(财仝驾考)打开哟~",
               });
             });
           } else {

+ 1 - 0
src/api/modules/exam.js

@@ -289,6 +289,7 @@ const exam = {
 		
 		})
 	}
+	//
 }
 
 export default exam

+ 1 - 1
src/api/modules/user.js

@@ -104,7 +104,7 @@ const user = {
 			params
 		})
 
-	}
+	},
 }
 
 export default user

二進制
src/assets/img/try_angle.png


二進制
src/assets/img/vip_angle.png


+ 0 - 1
src/manifest.json

@@ -8,7 +8,6 @@
   "mp-weixin": {
     "appid": "wx97bbc22daac9362a",
     "optimization":{"subPackages":true},
-    "lazyCodeLoading":"requiredComponents",
     "setting": {
       "urlCheck": false,
       "es6": true,

+ 119 - 22
src/otherPages/courseCatalog/components/courseCatalog.vue

@@ -1,9 +1,23 @@
 <template>
   <view class="bg">
     <view class="video">
-      <view   @click="isPlayVideo(item)" v-for="(item, index) in list" :key="index" class="video-item">
+      <view
+        @click="playRoadExamVideo(item)"
+        v-for="(item, index) in list"
+        :key="index"
+        class="video-item"
+      >
+        <image
+          v-if="item.permission == 1"
+          class="video-item-angle"
+          :src="try_angle"
+        ></image>
+        <image
+          v-if="item.permission == 2"
+          class="video-item-angle"
+          :src="vip_angle"
+        ></image>
         <image
-        
           class="video-item-left"
           mode="widthFix"
           :src="item.videoCover"
@@ -36,28 +50,61 @@
         </view>
       </view> -->
     </view>
-    <view class="pay">
-      <view @click="buyRoadCourse" class="pay-text">
-        <text v-if="!examIds.includes(examId)"
+    <view
+      v-if="!roadExamIds.includes(examId)"
+      style="width: 100%; padding-left: 30rpx"
+    >
+      <van-checkbox-group :value="userAgreement" @change="changeUserAgreement">
+        <van-checkbox name="userAgree">
+          <span
+            >开通前请阅读
+            <navigator
+              url="/pages/extraWeb/index?src=https://ndata.zzxcx.net/agreement/ctjk-sf.html&paramsMode=1"
+              style="color: #498ef5; display: inline"
+              >《用户服务协议》</navigator
+            ></span
+          ></van-checkbox
+        >
+      </van-checkbox-group>
+
+      <!-- <checkbox-group @change="changeUserAgreement">
+        <label class="radio">
+          <checkbox
+            value="userAgree"
+            v-model="userAgree"
+            color="#498EF5"
+            :checked="false"
+          />
+
+      
+        </label>
+      </checkbox-group> -->
+    </view>
+    <view
+      @click="!roadExamIds.includes(examId) ? buyRoadCourse() : ''"
+      class="pay"
+    >
+      <view class="pay-text">
+        <text v-if="!roadExamIds.includes(examId)"
           >立即支付&nbsp;&nbsp;¥{{ price / 100 }}</text
         >
         <icon
-          v-if="examIds.includes(examId)"
+          v-if="roadExamIds.includes(examId)"
           type="success_no_circle"
           color="#ffffff"
           size="16"
-          style="margin-right:15rpx;"
+          style="margin-right: 15rpx"
         ></icon>
-        <text v-if="examIds.includes(examId)">已购买</text>
+        <text v-if="roadExamIds.includes(examId)">已购买</text>
       </view>
       <image
-        v-if="!examIds.includes(examId)"
+        v-if="!roadExamIds.includes(examId)"
         style="width: 100%"
         mode="widthFix"
         src="https://ndata.zzxcx.net/ctjk/mp-wx/courseCatalog/payBg.png"
       ></image>
       <image
-        v-if="examIds.includes(examId)"
+        v-if="roadExamIds.includes(examId)"
         mode="widthFix"
         src="https://ndata.zzxcx.net/ctjk/mp-wx/courseCatalog/alreadyPay.png"
       ></image>
@@ -77,31 +124,48 @@
 <script>
 import api from "@/api";
 import { mapGetters } from "vuex";
+import vip_angle from "@/assets/img/vip_angle.png";
+import try_angle from "@/assets/img/try_angle.png";
 export default {
   data() {
     return {
       query: {
         price: 0,
       },
+      vip_angle,
+      try_angle,
+      userAgreement: [],
+      userAgree: false,
     };
   },
   methods: {
-    isPlayVideo(item) {
-      if(!this.examIds.includes(this.examId)){
+    changeUserAgreement(e) {
+      console.log(e, "..");
+      this.userAgreement = e.detail;
+      console.log(this.userAgreement);
+    },
+    playRoadExamVideo(item) {
+      if (!this.roadExamIds.includes(this.examId)) {
         uni.showToast({
-          title:"请购买",
-          icon:'none'
-        })
-        return
+          title: "请购买",
+          icon: "none",
+        });
+        return;
       }
-      let queryJson = JSON.stringify({
-        url: item.videoUrl,
-      });
+      uni.setStorageSync("storageWebSrc", item.videoUrl);
       uni.navigateTo({
-        url: "/otherPages/playUrlVideo/index?query=" + queryJson,
+        url: "/otherPages/playStorageWebSrc/index",
       });
     },
     buyRoadCourse() {
+      let that = this;
+      if (this.userAgreement.length == 0) {
+        uni.showToast({
+          title: "开通前请同意用户服务协议",
+          icon: "none",
+        });
+        return;
+      }
       let systemInfo = wx.getSystemInfoSync();
       api.buy
         .studentWxXcxPrepareOrder({
@@ -111,7 +175,27 @@ export default {
           phoneType: systemInfo.platform == "ios" ? 1 : 2,
         })
         .then((res) => {
-          wx.requestPayment(res.data);
+          wx.requestPayment({
+            ...res.data,
+            complete: (res) => {
+              console.log(res);
+              if (res.errMsg.includes("ok")) {
+                uni.showLoading({
+                  title: "购买中",
+                });
+                setTimeout(() => {
+                  that.$store.dispatch("GetRoadExamVip");
+                  uni.hideLoading();
+                }, 3000);
+              } else if (res.errMsg.includes("fail")) {
+              } else {
+                setTimeout(() => {
+                  that.$store.dispatch("GetRoadExamVip");
+                  uni.hideLoading();
+                }, 3000);
+              }
+            },
+          });
         });
     },
   },
@@ -133,7 +217,7 @@ export default {
     this.query = query;
   },
   computed: {
-    ...mapGetters(["examIds"]),
+    ...mapGetters(["roadExamIds"]),
   },
 };
 </script>
@@ -153,6 +237,14 @@ export default {
       width: 100%;
       display: flex;
       margin-bottom: 40rpx;
+      position: relative;
+    }
+    .video-item-angle {
+      width: 60rpx;
+      height: 60rpx;
+      position: absolute;
+      top: 0;
+      left: 0;
     }
     .video-item-left {
       width: 250rpx;
@@ -176,12 +268,17 @@ export default {
       line-height: 40rpx;
       text-align: center;
     }
+    .video-item-right-icon_vip {
+      background: rgba(255, 77, 83, 0.3);
+      color: rgba(255, 77, 83, 1);
+    }
   }
   .pay {
     padding: 0 30rpx;
     position: relative;
     display: flex;
     justify-content: center;
+    flex-wrap: wrap;
     .pay-text {
       position: absolute;
       top: 50%;

+ 2 - 2
src/otherPages/courseCatalog/index.vue

@@ -82,14 +82,14 @@ export default {
   onLoad(query){
 
     this.query = query
-    this.$store.dispatch('getOpenExamRoom')
+    this.$store.dispatch('GetRoadExamVip')
     api.carVideo.studentVipVideoList(this.query).then(res=>{
       this.examRoadList = res.rows
     })
 
   },
   computed: {
-   ...mapGetters(['examIds'])
+   ...mapGetters(['roadExamIds'])
   },
 };
 </script>

+ 56 - 27
src/otherPages/examRoadVideo/index.vue

@@ -3,10 +3,10 @@
     <view class="header">
       <view class="rect">
         <van-search
-          :value="value"
           shape="round"
           background=""
-          placeholder="输入系列课标题"
+          placeholder="输入考场名称"
+          @search="searchRoadExamRoom"
         />
         <view
           style="display: flex; padding: 30rpx; justify-content: space-between"
@@ -93,8 +93,6 @@
         </view>
       </view>
     </view>
-    <button @click="getCurrentCity">获取位置</button>
-    
   </view>
 </template>
 
@@ -110,20 +108,35 @@ export default {
       examProviceList: [],
       examCityList: [],
       examRoomList: [],
-      province: { provinceId: "", province: "" },
-      city: { cityId: "", city: "" },
+      province: uni.getStorageSync("roadExamProvince") || {
+        provinceId: "",
+        province: "",
+      },
+      city: uni.getStorageSync("roadExamCity") || {
+        cityId: "",
+        city: "",
+      },
     };
   },
   methods: {
+    searchRoadExamRoom(e) {
+      console.log(e.detail);
+      api.exam
+        .studentExamInfoList({
+          name: e.detail,
+        })
+        .then((res) => {
+          this.examRoomList = res.rows;
+        });
+    },
     getCurrentCity(e) {
-      console.log(e)
+      console.log(e);
       // uni.choosePoi({
       //   success(res){
       //     console.log(res)
       //   }
 
       // })
-   
     },
     isShowCity() {
       if (this.province.provinceId && this.province.province) {
@@ -146,6 +159,7 @@ export default {
     },
     getCityName(e) {
       this.city = e.detail.value;
+      uni.setStorageSync("roadExamCity", e.detail.value);
       this.cityShow = false;
       api.exam
         .studentExamInfoList({
@@ -158,6 +172,7 @@ export default {
     getExamCityAndProviceName(e) {
       this.provinceShow = false;
       this.province = e.detail.value;
+      uni.setStorageSync("roadExamProvince", e.detail.value);
       api.exam
         .studentExamInfoCityProviceId(e.detail.value.provinceId)
         .then((res) => {
@@ -168,31 +183,45 @@ export default {
   },
   onLoad(query) {
     this.query = query;
-    api.user.studentVipExamList().then((res) => {
-      uni.setStorageSync("examRoom", res.rows);
+    // 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.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);
+    if (this.city.cityId && this.province.provinceId) {
+      api.exam
+        .studentExamInfoCityProviceId(this.province.provinceId)
+        .then((res) => {
+         this.examCityList = res.data;
+        });
       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 = "";
-          }
+        .then((res) => {
+          this.examRoomList = res.rows;
         });
-    });
-    api.exam.studentExamInfoGetProvice().then((res) => {
-      this.examProviceList = res.data;
-    });
+    }
   },
 };
 </script>

+ 1 - 1
src/otherPages/playStorageVideo/index.vue

@@ -18,7 +18,7 @@
         },
         onLoad(query){
             
-            this.query.src =uni.getStorageSync('storageVideoUrl')
+            this.query.src =uni.getStorageSync('storageWebSrc')
             
         }
         

+ 35 - 0
src/otherPages/playStorageWebSrc/index.vue

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

+ 18 - 4
src/otherPages/threeExam/index.vue

@@ -371,7 +371,9 @@
             <view class="tip2-bottom">
               <!-- <view class="tip2-bottom-1">试试答题技巧,提分更快</view> -->
               <view
-                @click="goPath('/otherPages/threeExamScore/index?score='+score)"
+                @click="
+                  goPath('/otherPages/threeExamScore/index?score=' + score)
+                "
                 class="tip2-bottom-2"
                 >现在交卷</view
               >
@@ -543,9 +545,21 @@ export default {
         title: "是否交卷",
         success(res) {
           if (res.confirm) {
-            uni.navigateTo({
-              url: "/otherPages/threeExamScore/index?score=" + that.score,
-            });
+            api.exam
+              .studentScoreInfo({
+                type: "三力测试",
+                score: Number(that.score),
+              })
+              .then((result) => {
+                uni.navigateTo({
+                  url: "/otherPages/threeExamScore/index?score=" + that.score,
+                });
+              })
+              .catch((error) => {
+                uni.navigateTo({
+                  url: "/otherPages/threeExamScore/index?score=" + that.score,
+                });
+              });
           }
         },
       });

+ 17 - 12
src/otherPages/threeExamScore/index.vue

@@ -32,6 +32,7 @@
       </view>
       <view class="content">
         <ec-canvas
+          class="uni-ec-canvas"
           :ec="ec"
           :init-chart="initChart"
           canvasId="line-canvas1"
@@ -60,7 +61,7 @@ export default {
   onLoad(query) {
     this.query = {
       ...query,
-      score: Number(query.score||0),
+      score: Number(query.score || 0),
     };
     //登记成绩
     // api.exam.studentScoreInfo({
@@ -89,7 +90,7 @@ export default {
       });
   },
   methods: {
-    initChart: async function initChart(canvas, width, height, dpr) {
+    initChart: async function (canvas, width, height, dpr) {
       let that = this;
       const chart = echarts.init(canvas, null, {
         width: width,
@@ -99,12 +100,11 @@ export default {
       canvas.setChart(chart);
       let res = await api.exam.studentScoreInfoList({
         type: "三力测试",
-        
       });
-      let optionSeriesData0 = res.rows.map(item=>{
-        return item.score
-      })
-      optionSeriesData0.reverse()
+      let optionSeriesData0 = res.rows.map((item) => {
+        return item.score;
+      });
+      optionSeriesData0.reverse();
       console.log(res);
       var option = {
         color: ["#01C18D", "#00DDFF", "#37A2FF", "#FF0087", "#FFBF00"],
@@ -117,10 +117,10 @@ export default {
           top: 0,
           feature: {
             dataZoom: {
-              type:'inside',
+              type: "inside",
               xAxisIndex: 0,
-              start:0,
-              end:100
+              start: 0,
+              end: 100,
             },
           },
         },
@@ -285,7 +285,7 @@ export default {
       ctx.fillText("分", x1 + scoreWidth + 30, y1);
 
       ctx.textAlign = "center";
-      ctx.font = "18px sans-serif";
+      ctx.font = "14px sans-serif";
       ctx.fillStyle = "#333333";
       ctx.fillText(
         that.query.score >= 90 ? "恭喜你,成绩合格!" : "很遗憾,考试不合格!",
@@ -299,7 +299,7 @@ export default {
 </script>
 
 <style lang="less" scoped>
-.vh100{
+.vh100 {
   height: 100vh;
 }
 .top {
@@ -355,5 +355,10 @@ export default {
     height: 500rpx;
     padding: 15rpx;
   }
+  .uni-ec-canvas {
+    width: 100%;
+    height: 100%;
+    display: block;
+  }
 }
 </style>

+ 9 - 2
src/pages.json

@@ -237,6 +237,12 @@
             "navigationBarTitleText": "播放视频"
           }
         },
+        {
+          "path": "playStorageWebSrc/index",
+          "style": {
+            "navigationBarTitleText": ""
+          }
+        },
         {
           "path": "playUrlVideo/index",
           "style": {
@@ -532,8 +538,9 @@
         "query": "liceCar=1&liceTruck=&liceBus=&liceMoto=&name=&gs=xc&cert=C1/C2/C3&vehicle=轿车&subject=1&title=精选考题&sort=3"
       },
       {
-        "path": "otherPages/threeExamScore/index?Score=90",
-        "name": "三力测试结果页"
+        "path": "otherPages/threeExamScore/index",
+        "name": "三力测试结果页",
+        "query":"score=90"
       },
       {
         "path": "otherPages/beforeThreeExam/index",

+ 1 - 0
src/pages/carVideo/index.vue

@@ -549,6 +549,7 @@ export default {
           //   })
         });
       });
+      this.$store.dispatch("GetRoadExamVip");
     });
 
     // api.user.getInfo().then(res => {

+ 2 - 2
src/pages/teacherVideo/index.vue

@@ -1,6 +1,6 @@
 <template>
   <view class="">
-    <!-- <view class="road">
+    <view class="road">
       <view class="nav"
         ><view class="left">科目三真实考场</view
         ><view class="right" @click="goPath('/otherPages/examRoadVideo/index')">
@@ -24,7 +24,7 @@
           <view  @click="goPath('/otherPages/examRoadVideo/index')" class="look">去看考场</view>
         </view>
       </view>
-    </view> -->
+    </view>
     <view class="subject">
       <view v-for="(item, index) in kemu" :key="index" class="list">
         <navigator :url="'/otherPages/videoSubjectList/index?subject='+(index+1)">

+ 1 - 1
src/store/getters.js

@@ -71,7 +71,7 @@ const getters = {
 
 
   },
-  examIds:state=>state.user.openExamRoom.map(item=>{
+  roadExamIds:state=>state.user.roadExamList.map(item=>{
     return item.examId
   }),
   avatar: state => state.user.avatar,

+ 17 - 8
src/store/modules/user.js

@@ -9,7 +9,8 @@ const user = {
 		jpcjUserInfo: {
 
 		},
-		openExamRoom:[],
+		roadExamList:[],
+		openExamRoom: [],
 		userInfo: '',
 		name: '',
 		avatar: '',
@@ -28,7 +29,10 @@ const user = {
 		}
 	},
 	mutations: {
-		SET_OPENEXAMROOM:(state,openExamRoom)=>{
+		SET_ROADEXAMLIST:(state,roadExamList)=>{
+			state.roadExamList = roadExamList
+		},
+		SET_OPENEXAMROOM: (state, openExamRoom) => {
 			state.openExamRoom = openExamRoom
 		},
 		SET_TOKENOBJ: (state, tokenObj) => {
@@ -43,7 +47,7 @@ const user = {
 				state.tokenObj.date = new Date().getTime()
 		},
 		SET_USERINFO: (state, userInfo) => {
-		
+
 			return state.userInfo = userInfo
 		},
 		SET_NAME: (state, name) => {
@@ -84,7 +88,7 @@ const user = {
 			wx.hideLoading()
 
 			//#ifdef MP-TOUTIAO
-			uni.setStorageSync('unionid',res.data.thirdResult.data.unionid)
+			uni.setStorageSync('unionid', res.data.thirdResult.data.unionid)
 			//#endif
 			return res
 		},
@@ -104,6 +108,11 @@ const user = {
 				return res.data && res.data.token
 			}
 		},
+		async GetRoadExamVip(store) {
+			let res =await userApi.studentVipExamList()
+			let rows = res.rows
+			store.commit('SET_ROADEXAMLIST',rows)
+		},
 		/**
 		 * 获取用户信息
 		 * @param {Object} store
@@ -120,10 +129,10 @@ const user = {
 			store.commit('SET_USERINFO', res.data)
 			return res
 		},
-		async getOpenExamRoom(store){
-			
-			userApi.studentVipExamList().then(res=>{
-				store.commit('SET_OPENEXAMROOM',res.rows)
+		async getOpenExamRoom(store) {
+
+			userApi.studentVipExamList().then(res => {
+				store.commit('SET_OPENEXAMROOM', res.rows)
 			})
 			console.log(store.state.openExamRoom)