Browse Source

视频模块接入5,地位接入前

JXDS18FUJT 2 years ago
parent
commit
cbb373ec47

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

@@ -43,6 +43,14 @@ const buy = {
 			url: "student/tt/prepareOrder",
 			method: "post"
 		})
+	},
+	//微信小程序支付下单
+	studentWxXcxPrepareOrder(data){
+		return request({
+			url: "student/wx/xcxPrepareOrder",
+			method: "post",
+			data
+		})
 	}
 
 

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

@@ -205,6 +205,14 @@ const exam = {
 			method: "get"
 		})
 
+	},
+	//根据ip获取你的大致位置
+	studentExamInfoIp(){
+		return request({
+			url: `student/exam/info/ip`,
+			method: "get"
+		})
+
 	}
 }
 

+ 4 - 2
src/api/request.js

@@ -55,7 +55,6 @@ service.interceptors.response.use(
 		const msg = errorCode[code] || res.data.msg || errorCode['default']
 		//重置Authorization时间
 		if (code !== 401) store.commit('REFRESH_TOKEN')
-
 		if (code !== 200) {
 			if (code == 500) {
 				console.log('code' + code + ':' + msg)
@@ -63,13 +62,16 @@ service.interceptors.response.use(
 					title: 'code' + code + ':系统错误',
 					icon: 'none'
 				})
-			} else if(code!==502){
+			} else if(code==502){
 				console.log('code' + code + ':' + msg)
 				wx.showToast({
 					title: msg,
 					icon: 'none'
 				})
 			}
+			else{
+				console.log('code' + code + ':' + msg)
+			}
 		}
 
 		return res.data

+ 48 - 13
src/otherPages/courseCatalog/components/courseCatalog.vue

@@ -1,18 +1,18 @@
 <template>
   <view class="bg">
     <view class="video">
-      <view class="video-item">
+      <view v-for="(item, index) in list" :key="index" class="video-item">
         <image
           class="video-item-left"
           mode="widthFix"
-          src="https://ct.zzxcx.net/ctjk/mp-wx/courseCatalog/video_poster.png"
+          :src="item.videoCover"
         ></image>
         <view class="video-item-right">
-          <view>福州 | 华威夜间模拟灯光全套 (东南V5)</view>
+          <view style="width: 100%">{{ item.videoName }}</view>
           <view class="video-item-right-icon">学习中</view>
         </view>
       </view>
-      <view class="video-item">
+      <!-- <view class="video-item">
         <image
           class="video-item-left"
           mode="widthFix"
@@ -33,40 +33,75 @@
           <view>福州 | 华威夜间模拟灯光全套 (东南V5)</view>
           <view class="video-item-right-icon">学习中</view>
         </view>
-      </view>
+      </view> -->
     </view>
     <view class="pay">
-      <view class="pay-text">
-        <text>立即支付&nbsp;&nbsp;¥35.00</text>
+      <view @click="buyRoadCourse" class="pay-text">
+        <text>立即支付&nbsp;&nbsp;¥{{ price/100 }}</text>
       </view>
       <image
         style="width: 100%"
         mode="widthFix"
         src="https://ct.zzxcx.net/ctjk/mp-wx/courseCatalog/payBg.png"
       ></image>
-       <!-- <image mode="widthFix" src="https://ct.zzxcx.net/ctjk/mp-wx/courseCatalog/alreadyPay.png"></image> -->
+      <!-- <image mode="widthFix" src="https://ct.zzxcx.net/ctjk/mp-wx/courseCatalog/alreadyPay.png"></image> -->
     </view>
     <view class="advantage">
       <view class="advantage-title"> 实拍优势</view>
-      <view class="advantage-img"> 
-        <image mode="widthFix" src="https://ct.zzxcx.net/ctjk/mp-wx/courseCatalog/advantage.png"></image>
-       
+      <view class="advantage-img">
+        <image
+          mode="widthFix"
+          src="https://ct.zzxcx.net/ctjk/mp-wx/courseCatalog/advantage.png"
+        ></image>
       </view>
     </view>
   </view>
 </template>
 
 <script>
+import api from '@/api'
 export default {
   data() {
-    return {};
+    return {
+      query: {
+        price: 0,
+      },
+    };
+  },
+  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)
+
+    })
+      
+    }
   },
   props: {
     list: {
       type: Array,
-      default: []
+      default: [],
     },
+    price: {
+      type: Number,
+      default: 0,
+    },
+    examId:{
+      type: Number,
+      default: 0,
+
+    }
+  },
+  onLoad(query) {
+    this.query = query;
   },
+  computed: {},
 };
 </script>
 

File diff suppressed because it is too large
+ 1 - 1
src/otherPages/courseCatalog/index.vue


+ 6 - 4
src/otherPages/examRoadVideo/index.vue

@@ -71,6 +71,7 @@
         <view
           class="list-item"
           v-for="(item, index) in examRoomList"
+          @click="goCourseCatalog(item)"
           :key="index"
         >
           <image mode="widthFx" :src="item.image" class="list-item-image">
@@ -109,10 +110,10 @@ export default {
     };
   },
   methods: {
-    confirmArea(e) {
-      this.provice = e.detail.values[0];
-      this.city = e.detail.values[1];
-      this.areaShow = false;
+    goCourseCatalog(item) {
+      uni.navigateTo({
+        url: "/otherPages/courseCatalog/index?examId=" + item.id+'&price='+item.price,
+      });
     },
     getCityName(e) {
       this.city = e.detail.value;
@@ -138,6 +139,7 @@ export default {
   },
   onLoad(query) {
     this.query = query;
+    api.exam.studentExamInfoIp()
     api.exam.studentExamInfoGetProvice().then((res) => {
       this.examProviceList = res.data;
     });

Some files were not shown because too many files changed in this diff