|
@@ -9,7 +9,7 @@
|
|
|
<div class="text">
|
|
|
<p class="p1">{{ CourseData.name }}</p>
|
|
|
<!-- 机构名称 -->
|
|
|
- <p>Beijing language and Culture University</p>
|
|
|
+ <p>{{ CourseData.org_name }}</p>
|
|
|
<p>
|
|
|
{{ CourseData.teacher_list.length > 0 ? CourseData.teacher_list[0].teacher_name : '' }}
|
|
|
</p>
|
|
@@ -22,7 +22,7 @@
|
|
|
<span> {{ CourseData.end_date }} </span>
|
|
|
</p>
|
|
|
|
|
|
- <p v-if="backTime">距离关闭购买渠道还有</p>
|
|
|
+ <p v-if="backTime" class="tip">距离关闭购买渠道还有</p>
|
|
|
<div class="operation">
|
|
|
<div v-if="backTime" class="countdown">
|
|
|
<div class="time">
|
|
@@ -36,7 +36,7 @@
|
|
|
</div>
|
|
|
<div>
|
|
|
<div class="time-num">{{ backTime.minutes }}</div>
|
|
|
- <div class="time-name">分钟</div>
|
|
|
+ <div class="time-name">分</div>
|
|
|
</div>
|
|
|
<div>
|
|
|
<div class="time-num">{{ backTime.seconds }}</div>
|
|
@@ -44,15 +44,15 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div v-else>The purchase channel has been closed</div>
|
|
|
- <div>
|
|
|
+ <div v-else>购买渠道已关闭</div>
|
|
|
+
|
|
|
+ <div v-if="!readonly">
|
|
|
<span class="price">
|
|
|
¥ {{ CourseData.price }}
|
|
|
<span class="price_1" v-text="changePrice('1', CourseData.price)"></span>
|
|
|
<span class="price_2" v-text="changePrice('2', CourseData.price)"></span>
|
|
|
</span>
|
|
|
- <button v-if="!IsPurchase" class="get" @click="getPurchase">获取课程</button>
|
|
|
- <button v-else class="acquired" @click="getPurchase">ACQUIRED</button>
|
|
|
+ <button class="get" @click="getPurchase">{{ is_buy ? '去学习' : '获取课程' }}</button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -74,8 +74,9 @@
|
|
|
<span class="price_1" v-text="changePrice('1', item.book_price)"></span>
|
|
|
<span class="price_2" v-text="changePrice('2', item.book_price)"></span>
|
|
|
</span>
|
|
|
- <button v-if="!IsPurchase" class="get">购买</button>
|
|
|
- <button v-else class="acquired">ACQUIRED</button>
|
|
|
+ <button v-if="!readonly" :class="['get', is_buy ? 'acquired' : '']">
|
|
|
+ {{ is_buy ? '已' : '' }}购买
|
|
|
+ </button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -91,9 +92,7 @@
|
|
|
<div class="text">
|
|
|
<p class="p1">{{ item.teacher_name }}</p>
|
|
|
<p>{{ item.teacher_org_name }}</p>
|
|
|
- <p>
|
|
|
- 拌铍痹柔宫搏疲执胰逊持侨懈赫蜘秩锥畴陵黑阎停拢狂员棕鸟今纪秘也害棍亩疫潜,荫畜凉劈押望鹏艇从地赏果汛*隔微颊剪法震占
|
|
|
- </p>
|
|
|
+ <p></p>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -525,7 +524,7 @@
|
|
|
width="720px"
|
|
|
:before-close="closeaudit"
|
|
|
>
|
|
|
- <audit :id="id" :data="CourseData" :goods-type="$route.query.goodsType" />
|
|
|
+ <audit :id="id" :data="CourseData" :goods-type="goodsType" />
|
|
|
</el-dialog>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -533,7 +532,7 @@
|
|
|
|
|
|
<script>
|
|
|
import Audit from '@/components/payment/Audit';
|
|
|
-import { GetCourseInfoBox } from '@/api/course';
|
|
|
+import { GetCourseInfoBox, CheckMyGoodsBuyStatus } from '@/api/course';
|
|
|
|
|
|
export default {
|
|
|
components: {
|
|
@@ -542,31 +541,34 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
id: this.$route.query.id,
|
|
|
+ goodsType: this.$route.query.goodsType,
|
|
|
+ readonly: 'readonly' in this.$route.query ? this.$route.query.readonly : false,
|
|
|
enshrine: false,
|
|
|
- IsPurchase: false,
|
|
|
SelectShow: '1', // 选择展示课程资源还是下载
|
|
|
openList: [],
|
|
|
timer: null, // 获取倒计时
|
|
|
backTime: new Date(),
|
|
|
auditShow: false,
|
|
|
loading: false,
|
|
|
+ is_buy: false,
|
|
|
CourseData: null
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
// 获取课程详情
|
|
|
this.loading = true;
|
|
|
- GetCourseInfoBox({
|
|
|
- id: this.id
|
|
|
- })
|
|
|
+ CheckMyGoodsBuyStatus({ goods_type: this.goodsType, goods_id: this.id }).then(({ is_buy }) => {
|
|
|
+ this.is_buy = is_buy === 'true';
|
|
|
+ });
|
|
|
+ GetCourseInfoBox({ id: this.id })
|
|
|
.then(res => {
|
|
|
this.CourseData = res;
|
|
|
+ this.getBackTime();
|
|
|
this.loading = false;
|
|
|
})
|
|
|
.catch(() => {
|
|
|
this.loading = false;
|
|
|
});
|
|
|
- this.getBackTime();
|
|
|
},
|
|
|
// 方法集合
|
|
|
methods: {
|
|
@@ -609,10 +611,13 @@ export default {
|
|
|
// 购买 需要先加入课程 审核 审核通过之后才能购买课程
|
|
|
getPurchase() {
|
|
|
// 购买通道关闭
|
|
|
- // if (!this.backTime) {
|
|
|
- // this.$message.warning("购买渠道已关闭");
|
|
|
- // return;
|
|
|
- // }
|
|
|
+ if (this.is_buy) {
|
|
|
+ return this.$router.push('/');
|
|
|
+ }
|
|
|
+ if (!this.backTime) {
|
|
|
+ this.$message.warning('购买渠道已关闭');
|
|
|
+ return;
|
|
|
+ }
|
|
|
this.auditShow = true;
|
|
|
},
|
|
|
closeaudit() {
|
|
@@ -620,21 +625,20 @@ export default {
|
|
|
},
|
|
|
// 获取当前时间到指定时间的倒计时
|
|
|
getBackTime() {
|
|
|
- let targetTime = new Date('2021-7-30 13:00').getTime();
|
|
|
+ let targetTime = new Date(this.CourseData.end_date).getTime();
|
|
|
// 目标时间戳 - 当前时间戳 = 倒计时
|
|
|
this.timer = setInterval(() => {
|
|
|
- let currentTime = new Date().getTime();
|
|
|
- let backTime = targetTime - currentTime;
|
|
|
+ let backTime = targetTime - new Date().getTime();
|
|
|
backTime = this.formatduring(backTime);
|
|
|
this.backTime = backTime;
|
|
|
}, 1000);
|
|
|
},
|
|
|
// 倒计时时间戳转换为 天 小时 分钟 秒
|
|
|
formatduring(mss) {
|
|
|
- var days = parseInt(mss / (1000 * 60 * 60 * 24));
|
|
|
- var hours = parseInt((mss % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
|
|
|
- var minutes = parseInt((mss % (1000 * 60 * 60)) / (1000 * 60));
|
|
|
- var seconds = parseInt((mss % (1000 * 60)) / 1000);
|
|
|
+ let days = parseInt(mss / (1000 * 60 * 60 * 24));
|
|
|
+ let hours = parseInt((mss % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
|
|
|
+ let minutes = parseInt((mss % (1000 * 60 * 60)) / (1000 * 60));
|
|
|
+ let seconds = parseInt((mss % (1000 * 60)) / 1000);
|
|
|
// 如果到时间了返回false 关闭购买通道 无法购买
|
|
|
if (days <= 0 && hours <= 0 && minutes <= 0 && seconds <= 0) {
|
|
|
return false;
|
|
@@ -681,7 +685,7 @@ export default {
|
|
|
position: absolute;
|
|
|
right: 0;
|
|
|
top: 0;
|
|
|
- // text-align: right;
|
|
|
+
|
|
|
span {
|
|
|
display: inline-block;
|
|
|
color: #fff;
|
|
@@ -701,6 +705,10 @@ export default {
|
|
|
width: 1100px;
|
|
|
color: white;
|
|
|
|
|
|
+ .tip:not(.p1) {
|
|
|
+ margin-top: 36px;
|
|
|
+ }
|
|
|
+
|
|
|
p {
|
|
|
font-size: 16px;
|
|
|
}
|
|
@@ -726,7 +734,6 @@ export default {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
justify-content: space-between;
|
|
|
- margin-top: 20px;
|
|
|
|
|
|
.countdown {
|
|
|
> p {
|
|
@@ -735,7 +742,6 @@ export default {
|
|
|
// 倒计时
|
|
|
.time {
|
|
|
display: flex;
|
|
|
- margin-top: 24px;
|
|
|
|
|
|
div {
|
|
|
width: 48px;
|
|
@@ -813,11 +819,9 @@ export default {
|
|
|
.moreList {
|
|
|
width: 1300px;
|
|
|
margin: 0 auto;
|
|
|
- // margin-top: 20px;
|
|
|
display: flex;
|
|
|
flex-wrap: wrap;
|
|
|
- // overflow-y: hidden;
|
|
|
- // overflow-x: scroll;
|
|
|
+
|
|
|
.moreOne {
|
|
|
margin-right: 20px;
|
|
|
margin-top: 20px;
|
|
@@ -873,16 +877,9 @@ export default {
|
|
|
}
|
|
|
|
|
|
.acquired {
|
|
|
- width: 120px;
|
|
|
- height: 40px;
|
|
|
+ @extend .get;
|
|
|
+
|
|
|
background: #d5d5d5;
|
|
|
- border-radius: 4px;
|
|
|
- border: none;
|
|
|
- outline: none;
|
|
|
- color: white;
|
|
|
- font-size: 16px;
|
|
|
- margin-left: 30px;
|
|
|
- cursor: pointer;
|
|
|
}
|
|
|
|
|
|
.price {
|