|
@@ -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¶msMode=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)"
|
|
|
>立即支付 ¥{{ 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%;
|