更新:增加课程“复读”功能
This commit is contained in:
@@ -20,10 +20,8 @@
|
||||
v-if="catalogueList.length > 0"
|
||||
:catalogues="catalogueList"
|
||||
:userVip="userVip"
|
||||
@getFreeCourse="handleGetFreeCourse"
|
||||
@purchase="handlePurchase"
|
||||
@toVip="goToVip"
|
||||
@renew="handleRenew"
|
||||
@loadPageData="loadPageData"
|
||||
@toDetail="handleToDetail"
|
||||
/>
|
||||
|
||||
@@ -89,55 +87,14 @@
|
||||
/>
|
||||
</view> -->
|
||||
|
||||
<!-- 商品选择器 -->
|
||||
<GoodsSelector
|
||||
:show="showGoodsSelector"
|
||||
:goods="goodsList"
|
||||
:isFudu="isFudu"
|
||||
@select="handleGoodsSelect"
|
||||
@confirm="handleGoodsConfirm"
|
||||
@close="closeGoodsSelector"
|
||||
/>
|
||||
|
||||
<!-- 购买协议弹窗 -->
|
||||
<wd-popup v-model="showProtocol" position="center">
|
||||
<view class="protocol-popup">
|
||||
<view class="protocol-title">温馨提示</view>
|
||||
<view class="protocol-content">
|
||||
<text>
|
||||
用户您好,本软件对于一个用户名及密码仅允许一部电子设备登陆,多部设备使用同一用户名操作软件的行为属于违规操作,发现违规一次将提出警告,再次违规您的用户名将被封号,无法正常登陆,如因此对您使用带来不便,敬请谅解。
|
||||
</text>
|
||||
<text>
|
||||
课程购买之后一年内不打开,此一年内不会计算有效学习时间,一年后会自动开始计算有效学习时间。
|
||||
</text>
|
||||
<text>
|
||||
本课程一经购买,暂不支持退款,敬请谅解。
|
||||
</text>
|
||||
<view style="color: red; font-weight: bold"> 注: </view>
|
||||
<view>
|
||||
1.手机、pad、电脑均为可登陆电子设备,均有唯一标识码,一个用户名仅允许在一个手机或一个ipad或一个电脑登陆,请根据您的使用习惯自行选择。<br />
|
||||
2.如若申请变更登陆设备请联系客服,<br />
|
||||
客服电话:021-08371305<br />
|
||||
客服微信号:yilujiankangkefu<br />
|
||||
3.如因违反上述使用规定...概不退款,本公司保留追究用户相关法律责任的权利。<br />
|
||||
4.点击“同意”按钮即表示您同意遵守以上条款。
|
||||
</view>
|
||||
</view>
|
||||
<view class="protocol-actions">
|
||||
<wd-button type="info" plain @click="showProtocol = false">不同意</wd-button>
|
||||
<wd-button type="primary" @click="confirmPurchase">同意</wd-button>
|
||||
</view>
|
||||
</view>
|
||||
</wd-popup>
|
||||
|
||||
<!-- 评论编辑器 -->
|
||||
<CommentEditor
|
||||
<!-- <CommentEditor
|
||||
:show="showEditor"
|
||||
:parentComment="replyComment"
|
||||
type="course"
|
||||
@submit="handleCommentSubmit"
|
||||
@close="closeCommentEditor"
|
||||
/>
|
||||
/> -->
|
||||
|
||||
<!-- 返回顶部 -->
|
||||
<wd-backtop :scrollTop="scrollTop" custom-class="back-top">
|
||||
@@ -153,7 +110,6 @@ import { useUserStore } from '@/stores/user'
|
||||
import { courseApi } from '@/api/modules/course'
|
||||
import CourseInfo from './components/CourseInfo.vue'
|
||||
import CatalogueList from './components/CatalogueList.vue'
|
||||
import GoodsSelector from '@/components/order/GoodsSelector.vue'
|
||||
import CommentList from '@/components/comment/CommentList.vue'
|
||||
import CommentEditor from '@/components/comment/CommentEditor.vue'
|
||||
import type { ICourseDetail, ICatalogue, IChapter, IVipInfo } from '@/types/course'
|
||||
@@ -172,14 +128,6 @@ const vipModuleList = ref<string[]>([])
|
||||
const learningProgress = ref(0)
|
||||
const relatedBooks = ref<IGoods[]>([])
|
||||
|
||||
// 商品选择
|
||||
const showGoodsSelector = ref(false)
|
||||
const goodsList = ref<IGoods[]>([])
|
||||
const selectedGoods = ref<IGoods | null>(null)
|
||||
const showProtocol = ref(false)
|
||||
const isFudu = ref(false)
|
||||
const fuduCatalogueId = ref<number>(0)
|
||||
|
||||
// 评论相关
|
||||
const commentList = ref<IComment[]>([])
|
||||
const commentsLoading = ref(false)
|
||||
@@ -301,92 +249,6 @@ const goToVip = () => {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 领取免费课程
|
||||
*/
|
||||
const handleGetFreeCourse = async (catalogue: ICatalogue) => {
|
||||
if (!catalogue) return
|
||||
|
||||
const res = await courseApi.startStudyForMF(catalogue.id)
|
||||
if (res.code === 0) {
|
||||
uni.showToast({ title: '领取成功', icon: 'success' })
|
||||
// 刷新页面数据
|
||||
loadPageData()
|
||||
} else {
|
||||
uni.showToast({ title: res.msg || '领取失败', icon: 'none' })
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 购买课程
|
||||
*/
|
||||
const handlePurchase = async (catalogue: ICatalogue) => {
|
||||
if (!catalogue) return
|
||||
|
||||
isFudu.value = false
|
||||
const res = await courseApi.getProductListForCourse(catalogue.id)
|
||||
if (res.code === 0 && res.productList.length > 0) {
|
||||
goodsList.value = res.productList
|
||||
showGoodsSelector.value = true
|
||||
} else {
|
||||
uni.showToast({ title: '此课程暂无购买方式', icon: 'none' })
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 续费/复读
|
||||
*/
|
||||
const handleRenew = async () => {
|
||||
// if (!currentCatalogue.value) return
|
||||
|
||||
// isFudu.value = true
|
||||
// fuduCatalogueId.value = currentCatalogue.value.id
|
||||
// const res = await courseApi.getRenewProductList(currentCatalogue.value.id)
|
||||
// if (res.code === 0 && res.productList.length > 0) {
|
||||
// goodsList.value = res.productList
|
||||
// showGoodsSelector.value = true
|
||||
// } else {
|
||||
// uni.showToast({ title: '暂无复读方案', icon: 'none' })
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择商品
|
||||
*/
|
||||
const handleGoodsSelect = (goods: IGoods) => {
|
||||
selectedGoods.value = goods
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认购买
|
||||
*/
|
||||
const handleGoodsConfirm = () => {
|
||||
showGoodsSelector.value = false
|
||||
showProtocol.value = true
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭商品选择器
|
||||
*/
|
||||
const closeGoodsSelector = () => {
|
||||
showGoodsSelector.value = false
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认购买协议
|
||||
*/
|
||||
const confirmPurchase = () => {
|
||||
showProtocol.value = false
|
||||
if (!selectedGoods.value) return
|
||||
|
||||
showProtocol.value = false
|
||||
|
||||
// 跳转到确认订单页
|
||||
uni.navigateTo({
|
||||
url: `/pages/order/goodsConfirm?goods=${selectedGoods.value.productId}`
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到书籍详情
|
||||
*/
|
||||
@@ -740,40 +602,6 @@ onReachBottom(() => {
|
||||
}
|
||||
}
|
||||
|
||||
.protocol-popup {
|
||||
width: 600rpx;
|
||||
padding: 40rpx;
|
||||
background-color: #fff;
|
||||
border-radius: 12rpx;
|
||||
|
||||
.protocol-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
text-align: center;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.protocol-content {
|
||||
max-height: 60vh;
|
||||
overflow-y: auto;
|
||||
font-size: 26rpx;
|
||||
line-height: 1.8;
|
||||
color: #666;
|
||||
margin-bottom: 30rpx;
|
||||
|
||||
text {
|
||||
display: block;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.protocol-actions {
|
||||
display: flex;
|
||||
gap: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.back-top) {
|
||||
background-color: #fff !important;
|
||||
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
|
||||
|
||||
Reference in New Issue
Block a user