|
@@ -14,21 +14,22 @@
|
|
</view>
|
|
</view>
|
|
<view class="content">
|
|
<view class="content">
|
|
<courseDesc v-if="currentTab === 0" :paddingBottom="100" showType="image"
|
|
<courseDesc v-if="currentTab === 0" :paddingBottom="100" showType="image"
|
|
- :content="courseDetail.imgUrl?courseDetail.imgUrl:''" :payType="courseDetail.payType"></courseDesc>
|
|
|
|
|
|
+ :content="courseDetail.imgUrl?courseDetail.imgUrl:''" :hasBuy="courseDetail.hasBuy"
|
|
|
|
+ :payType="courseDetail.viewMode"></courseDesc>
|
|
<courseCredits v-if="currentTab === 1" :credit="courseDetail.courseCredits"></courseCredits>
|
|
<courseCredits v-if="currentTab === 1" :credit="courseDetail.courseCredits"></courseCredits>
|
|
<courseComment v-if="currentTab === 2" :paddingBottom="100" :commentList="commentList"></courseComment>
|
|
<courseComment v-if="currentTab === 2" :paddingBottom="100" :commentList="commentList"></courseComment>
|
|
</view>
|
|
</view>
|
|
|
|
|
|
</view>
|
|
</view>
|
|
- <view v-if="currentTab === 0" class="section-bottom" @click="toBuy">
|
|
|
|
|
|
+ <view v-if="showBuy" class="section-bottom" @click="toBuy">
|
|
<text>点击购买</text>
|
|
<text>点击购买</text>
|
|
</view>
|
|
</view>
|
|
<view v-if="currentTab === 2" class="section-bottom " style="background-color: #f2f2f2;">
|
|
<view v-if="currentTab === 2" class="section-bottom " style="background-color: #f2f2f2;">
|
|
<view class="comment-input-box">
|
|
<view class="comment-input-box">
|
|
- <u-input :custom-style="inputStyle"
|
|
|
|
- class="comment-input" v-model="comment" :border="false" placeholder="写留言" height="60" adjust-position/>
|
|
|
|
- <u-button class="comment-button" :hair-line="false"
|
|
|
|
- :custom-style="customStyle" @click="toSend">发送</u-button>
|
|
|
|
|
|
+ <u-input :custom-style="inputStyle" class="comment-input" v-model="comment" :border="false"
|
|
|
|
+ placeholder="写留言" height="60" adjust-position />
|
|
|
|
+ <u-button class="comment-button" :hair-line="false" :custom-style="customStyle"
|
|
|
|
+ @click="toSend">发送</u-button>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
@@ -39,16 +40,25 @@
|
|
import courseDesc from './component/courseDesc/courseDesc.vue';
|
|
import courseDesc from './component/courseDesc/courseDesc.vue';
|
|
import courseCredits from './component/courseCredits/courseCredits.vue';
|
|
import courseCredits from './component/courseCredits/courseCredits.vue';
|
|
import courseComment from './component/courseComment/courseComment.vue';
|
|
import courseComment from './component/courseComment/courseComment.vue';
|
|
- import { loadCourseDetail, loadCommentList, sendComment } from "@/api/edu.js"
|
|
|
|
import {
|
|
import {
|
|
- ref
|
|
|
|
|
|
+ loadCourseDetail,
|
|
|
|
+ loadCommentList,
|
|
|
|
+ sendComment
|
|
|
|
+ } from "@/api/edu.js"
|
|
|
|
+
|
|
|
|
+ import {
|
|
|
|
+ useAuthStore
|
|
|
|
+ } from '@/store/authStore'
|
|
|
|
+ const authStore = useAuthStore();
|
|
|
|
+ // const isMember = ref(false)
|
|
|
|
+
|
|
|
|
+ import {
|
|
|
|
+ ref, computed
|
|
} from 'vue'
|
|
} from 'vue'
|
|
import {
|
|
import {
|
|
onLoad
|
|
onLoad
|
|
} from '@dcloudio/uni-app'
|
|
} from '@dcloudio/uni-app'
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+
|
|
const courseDetail = ref({});
|
|
const courseDetail = ref({});
|
|
const courseId = ref(null);
|
|
const courseId = ref(null);
|
|
const items = ref(['课程简介', '课程学分', '观看评论']);
|
|
const items = ref(['课程简介', '课程学分', '观看评论']);
|
|
@@ -73,54 +83,53 @@
|
|
fontSize: '26rpx'
|
|
fontSize: '26rpx'
|
|
})
|
|
})
|
|
// 评论列表
|
|
// 评论列表
|
|
- const commentList = ref([
|
|
|
|
- {
|
|
|
|
|
|
+ const commentList = ref([{
|
|
commentId: "01",
|
|
commentId: "01",
|
|
username: "用户名123",
|
|
username: "用户名123",
|
|
iocn: "",
|
|
iocn: "",
|
|
- content:"评论内容评论内容评容,大赛冠军的",
|
|
|
|
|
|
+ content: "评论内容评论内容评容,大赛冠军的",
|
|
commentTime: "2023-10-10 19:00:00"
|
|
commentTime: "2023-10-10 19:00:00"
|
|
},
|
|
},
|
|
{
|
|
{
|
|
commentId: "02",
|
|
commentId: "02",
|
|
username: "用户名567",
|
|
username: "用户名567",
|
|
iocn: "",
|
|
iocn: "",
|
|
- content:"hajdkhd dhasjhd 等哈十九点按时鉴定会撒低级,撒谎客户端喝酒侃大山哈吉斯肯定会大会开始觉得暗黑界的是客户,大赛冠军的",
|
|
|
|
|
|
+ content: "hajdkhd dhasjhd 等哈十九点按时鉴定会撒低级,撒谎客户端喝酒侃大山哈吉斯肯定会大会开始觉得暗黑界的是客户,大赛冠军的",
|
|
commentTime: "2023-10-11 19:00:00"
|
|
commentTime: "2023-10-11 19:00:00"
|
|
},
|
|
},
|
|
{
|
|
{
|
|
commentId: "03",
|
|
commentId: "03",
|
|
username: "用户名567",
|
|
username: "用户名567",
|
|
iocn: "",
|
|
iocn: "",
|
|
- content:"hajdkhd dhasjhd ,,大赛冠军的",
|
|
|
|
|
|
+ content: "hajdkhd dhasjhd ,,大赛冠军的",
|
|
commentTime: "2023-10-12 19:00:00"
|
|
commentTime: "2023-10-12 19:00:00"
|
|
},
|
|
},
|
|
{
|
|
{
|
|
commentId: "04",
|
|
commentId: "04",
|
|
username: "用户名567",
|
|
username: "用户名567",
|
|
iocn: "",
|
|
iocn: "",
|
|
- content:"hajdkhd dhasjhd 等哈十九点按时鉴定会撒低级,撒谎客户端喝酒侃大山哈吉斯肯定会大会开始觉得暗黑界的是客户,大赛冠军的",
|
|
|
|
|
|
+ content: "hajdkhd dhasjhd 等哈十九点按时鉴定会撒低级,撒谎客户端喝酒侃大山哈吉斯肯定会大会开始觉得暗黑界的是客户,大赛冠军的",
|
|
commentTime: "2023-10-13 19:00:00"
|
|
commentTime: "2023-10-13 19:00:00"
|
|
},
|
|
},
|
|
{
|
|
{
|
|
commentId: "05",
|
|
commentId: "05",
|
|
username: "用户名567",
|
|
username: "用户名567",
|
|
iocn: "",
|
|
iocn: "",
|
|
- content:"hajdkhd dhasjhd 等哈十九点按时鉴定会撒低级,撒谎客户端喝酒侃大山哈吉斯肯定会大会开始觉得暗黑界的是客户,大赛冠军的",
|
|
|
|
|
|
+ content: "hajdkhd dhasjhd 等哈十九点按时鉴定会撒低级,撒谎客户端喝酒侃大山哈吉斯肯定会大会开始觉得暗黑界的是客户,大赛冠军的",
|
|
commentTime: "2023-10-14 19:00:00"
|
|
commentTime: "2023-10-14 19:00:00"
|
|
},
|
|
},
|
|
{
|
|
{
|
|
commentId: "06",
|
|
commentId: "06",
|
|
username: "用户名567",
|
|
username: "用户名567",
|
|
iocn: "",
|
|
iocn: "",
|
|
- content:"hajdkhd dhasjhd 等哈十九点按时鉴定会撒低级,撒谎客户端喝酒侃大山哈吉斯肯定会大会开始觉得暗黑界的是客户,大赛冠军的",
|
|
|
|
|
|
+ content: "hajdkhd dhasjhd 等哈十九点按时鉴定会撒低级,撒谎客户端喝酒侃大山哈吉斯肯定会大会开始觉得暗黑界的是客户,大赛冠军的",
|
|
commentTime: "2025-01-17 12:00:00"
|
|
commentTime: "2025-01-17 12:00:00"
|
|
},
|
|
},
|
|
{
|
|
{
|
|
commentId: "07",
|
|
commentId: "07",
|
|
username: "用户名567",
|
|
username: "用户名567",
|
|
iocn: "",
|
|
iocn: "",
|
|
- content:"hajdkhd dhasjhd 等哈十九点按时鉴定会撒低级,撒谎客户端喝酒侃大山哈吉斯肯定会大会开始觉得暗黑界的是客户,大赛冠军的",
|
|
|
|
|
|
+ content: "hajdkhd dhasjhd 等哈十九点按时鉴定会撒低级,撒谎客户端喝酒侃大山哈吉斯肯定会大会开始觉得暗黑界的是客户,大赛冠军的",
|
|
commentTime: "2025-01-17 15:30:00"
|
|
commentTime: "2025-01-17 15:30:00"
|
|
}
|
|
}
|
|
])
|
|
])
|
|
@@ -128,22 +137,24 @@
|
|
function onClickItem(e) {
|
|
function onClickItem(e) {
|
|
if (currentTab.value != e) {
|
|
if (currentTab.value != e) {
|
|
currentTab.value = e;
|
|
currentTab.value = e;
|
|
- if(e===2){
|
|
|
|
|
|
+ if (e === 2) {
|
|
getComment(courseId.value)
|
|
getComment(courseId.value)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// 初始化
|
|
// 初始化
|
|
function init(id) {
|
|
function init(id) {
|
|
- loadCourseDetail(id).then(res=>{
|
|
|
|
- if(res?.data){
|
|
|
|
|
|
+ loadCourseDetail(id).then(res => {
|
|
|
|
+ if (res?.data) {
|
|
courseDetail.value = res.data;
|
|
courseDetail.value = res.data;
|
|
|
|
+ console.log(courseDetail, "课程详情")
|
|
}
|
|
}
|
|
})
|
|
})
|
|
}
|
|
}
|
|
- function getComment(id){
|
|
|
|
- loadCommentList(id).then(res=>{
|
|
|
|
- if(res?.data){
|
|
|
|
|
|
+
|
|
|
|
+ function getComment(id) {
|
|
|
|
+ loadCommentList(id).then(res => {
|
|
|
|
+ if (res?.data) {
|
|
commentList.value = res.data;
|
|
commentList.value = res.data;
|
|
}
|
|
}
|
|
})
|
|
})
|
|
@@ -155,40 +166,61 @@
|
|
})
|
|
})
|
|
// console.log("购买该课程", courseDetail.value.id)
|
|
// console.log("购买该课程", courseDetail.value.id)
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
function toSend() {
|
|
function toSend() {
|
|
sendComment({
|
|
sendComment({
|
|
courseId: courseId.value,
|
|
courseId: courseId.value,
|
|
content: comment.value,
|
|
content: comment.value,
|
|
commentTime: formatDate(new Date())
|
|
commentTime: formatDate(new Date())
|
|
- }).then(res=>{
|
|
|
|
|
|
+ }).then(res => {
|
|
getComment(courseId.value)
|
|
getComment(courseId.value)
|
|
comment.value = ""
|
|
comment.value = ""
|
|
})
|
|
})
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
function formatDate(date) {
|
|
function formatDate(date) {
|
|
- const pad = (num) => num.toString().padStart(2, '0');
|
|
|
|
-
|
|
|
|
- const year = date.getFullYear();
|
|
|
|
- const month = pad(date.getMonth() + 1); // 月份从0开始,需加1
|
|
|
|
- const day = pad(date.getDate());
|
|
|
|
-
|
|
|
|
- const hours = pad(date.getHours());
|
|
|
|
- const minutes = pad(date.getMinutes());
|
|
|
|
- const seconds = pad(date.getSeconds());
|
|
|
|
-
|
|
|
|
- return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
|
|
|
|
+ const pad = (num) => num.toString().padStart(2, '0');
|
|
|
|
+
|
|
|
|
+ const year = date.getFullYear();
|
|
|
|
+ const month = pad(date.getMonth() + 1); // 月份从0开始,需加1
|
|
|
|
+ const day = pad(date.getDate());
|
|
|
|
+
|
|
|
|
+ const hours = pad(date.getHours());
|
|
|
|
+ const minutes = pad(date.getMinutes());
|
|
|
|
+ const seconds = pad(date.getSeconds());
|
|
|
|
+
|
|
|
|
+ return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ const showBuy = computed(()=>{
|
|
|
|
+ if (courseDetail.value.viewMode === '2' &&
|
|
|
|
+ !isMember.value &&
|
|
|
|
+ !courseDetail.value.hasBuy &&
|
|
|
|
+ currentTab.value === 0) {
|
|
|
|
+ console.log(1)
|
|
|
|
+ return true
|
|
|
|
+ }
|
|
|
|
+ // 付费,不管是不是会员,并且没买的
|
|
|
|
+ if (courseDetail.value.viewMode === '3' &&
|
|
|
|
+ !courseDetail.value.hasBuy &&
|
|
|
|
+ currentTab.value === 0) {
|
|
|
|
+ console.log(2)
|
|
|
|
+ return true
|
|
|
|
+ }
|
|
|
|
+ console.log(3)
|
|
|
|
+ return false
|
|
|
|
+ })
|
|
|
|
+ const isMember = computed(()=>{
|
|
|
|
+ return authStore.userInfo.isMember == '0' ? false : true
|
|
|
|
+ })
|
|
// 初始化页面
|
|
// 初始化页面
|
|
onLoad((option) => {
|
|
onLoad((option) => {
|
|
const {
|
|
const {
|
|
id,
|
|
id,
|
|
name
|
|
name
|
|
} = option;
|
|
} = option;
|
|
- // courseDetail.value.id = id
|
|
|
|
- // console.log(courseDetail.value, 90)
|
|
|
|
|
|
+ // isMember.value = authStore.userInfo.isMember == '0' ? false : true;
|
|
|
|
+ // console.log("是否是会员", isMember.value)
|
|
courseId.value = id
|
|
courseId.value = id
|
|
init(id)
|
|
init(id)
|
|
getComment(id)
|
|
getComment(id)
|