This commit is contained in:
@fawn-nine
2024-08-19 17:23:50 +08:00
parent 80a066df95
commit adc44128a2
4 changed files with 1558 additions and 1179 deletions

View File

@@ -378,7 +378,7 @@
"path": "pages/course/chapterDetailAndorid", "path": "pages/course/chapterDetailAndorid",
"style": { "style": {
"navigationBarTitleText": "章节详情", "navigationBarTitleText": "章节详情",
"enablePullDownRefresh": true "enablePullDownRefresh": false
} }
}, },
{ {

View File

@@ -1,116 +1,161 @@
<template> <template>
<view class="container commonPageBox commonDetailPage"> <view class="">
<!-- 公共组件-每个页面必须引入 --> <!-- 公共组件-每个页面必须引入 -->
<public-module></public-module> <public-module></public-module>
<template v-show="!screenLoading"> <template v-show="!screenLoading">
<z-nav-bar bgColor="#333" fontColor="#fff" title="教学内容"></z-nav-bar> <z-nav-bar bgColor="#333" fontColor="#fff" title="教学内容"></z-nav-bar>
<!-- <view class="contentBox curriculum_box" :style="`height:calc(100% - ${60 + statusBarHeight}px !important; -->
<view <view
class="contentBox curriculum_box" class="contentBox curriculum_box"
:style="`height:calc(100% - ${60 + statusBarHeight}px !important; overflow-x: hidden; ${ :style="`height:calc(100% - ${60 + statusBarHeight}px !important; width:100%; overflow-x: hidden; ${
isFullScreen ? 'background:#000' : '' isFullScreen ? 'background:#000' : ''
}`" }`"
> >
<!-- 加密视频 --> <!-- 加密视频 -->
<view :style="`background:#000`"> <view style="background:#000; position: fixed; top: 120rpx; left: 0; width: 100%;">
<common-video <common-video @changeScreen="changeScreen" @changeScreenLoading="changeScreenLoading"
@changeScreen="changeScreen" @hideNextVideo="hideNextVideo" @startNextVideoCountDown="startNextVideoCountDown"
@changeScreenLoading="changeScreenLoading" @unlockChangeVideo="unlockChangeVideo" v-if="isfresh " ref="commonVideo"
@hideNextVideo="hideNextVideo" :secondCountDown="secondCountDown"  :videoTitle="curriculumData.title"
@startNextVideoCountDown = "startNextVideoCountDown" :currentVideo="currentVideo" :noRecored="noRecored" :currentVideoList="videoArray">
@unlockChangeVideo="unlockChangeVideo"
v-if="isfresh"
ref="commonVideo"
:secondCountDown="secondCountDown"
 :videoTitle="curriculumData.title"
:currentVideo="currentVideo"
:noRecored = "noRecored"
:currentVideoList="videoArray"
>
</common-video> </common-video>
<view style="height: 200px" v-else></view> <view style="height: 200px" v-else></view>
</view> </view>
<scroll-view <!-- <scroll-view :style="`height:calc(100% - 200px - 40rpx) ;`" scroll-y="true" class="scroll-Y" style="background-color: #fff"> -->
:style="`height:calc(100% - 200px - 40rpx) ;`" <view class="PM_font" style="padding: 20rpx; font-size: 40rpx; color: #2979ff; margin-top: 320rpx;">视频教学</view>
scroll-y="true"
class="scroll-Y"
style="background-color: #fff"
>
<view
class="PM_font"
style="padding: 20rpx; font-size: 40rpx; color: #2979ff"
>视频教学</view
>
<view class="scroll-view-item"> <view class="scroll-view-item">
<view style="padding: 20rpx; font-size: 26rpx"> <view style="padding: 20rpx; font-size: 26rpx">
课程{{ options.navTitle }} 课程{{ options.navTitle }}
</view> </view>
<view <view style="padding: 20rpx; margin-bottom: 40rpx; font-size: 26rpx">
style="padding: 20rpx; margin-bottom: 40rpx; font-size: 26rpx"
>
章节{{ curriculumData.title }} 章节{{ curriculumData.title }}
</view> </view>
<common-curriculum-video <common-curriculum-video v-if="videoArray && videoArray.length > 0" :detailInfo="curriculumData"
v-if="videoArray && videoArray.length > 0" :currentVideo="currentVideo" :dataList="videoArray" @open="changeVideo"
:detailInfo="curriculumData" :changeVideoLock="changeVideoLock">
:currentVideo="currentVideo"
:dataList="videoArray"
@open="changeVideo"
:changeVideoLock="changeVideoLock"
>
</common-curriculum-video> </common-curriculum-video>
</view> </view>
<view class="" style="border-top: 2px solid #2979ff;">
<view <view class="coursePart flexbox" v-if="tabList.length > 1">
class="PM_font" <view :class="['item','flex_box',curTab == index ? 'active': '' ]"
style="padding: 20rpx; font-size: 40rpx; color: #333" v-for="(item, index) in tabList" :key="index" @click="tabClick(item,index)">
>文章简介</view <view class=""><text>{{item.name}}</text></view>
> </view>
</view>
</view>
<view v-show="curTab == 0">
<!-- <scroll-view :style="`height:calc(100% - 200px - 40rpx) ;`" scroll-y="true" class="scroll-Y" style="background-color: #fff"> -->
<view class="PM_font" style="padding: 20rpx; font-size: 40rpx; color: #333">章节简介</view>
<view class="scroll-view-item"> <view class="scroll-view-item">
<common-rich-detail :detailInfo="{ ...curriculumData, title: '' }"> <common-rich-detail :detailInfo="{ ...curriculumData, title: '' }">
<template #richHeadImg> <template #richHeadImg>
<image <image v-if="curriculumData.imgUrl" @click="previewImage(curriculumData.imgUrl)"
v-if="curriculumData.imgUrl" :src="curriculumData.imgUrl" mode="widthFix" class="headImage"></image>
@click="previewImage(curriculumData.imgUrl)"
:src="curriculumData.imgUrl"
mode="widthFix"
class="headImage"
></image>
<!-- <image :src="detailInfo.imgUrl" v-if="detailInfo.imgUrl" mode="widthFix" class="headImage"></image> --> <!-- <image :src="detailInfo.imgUrl" v-if="detailInfo.imgUrl" mode="widthFix" class="headImage"></image> -->
</template> </template>
</common-rich-detail> </common-rich-detail>
</view> </view>
</scroll-view> <!-- </scroll-view> -->
<p class="aui-text-danger" style="text-align: center"> <p class="aui-text-danger" style="text-align: center">
本课程版权归天津众妙之门科技有限公司所有翻版必究! 本课程版权归天津众妙之门科技有限公司所有翻版必究!
</p> </p>
</view>
<view v-show="curTab == 1" style="padding: 20rpx;">
<view class="">
<view class="PM_font" style="padding: 20rpx; font-size: 40rpx; color: #333">题目内容</view>
<view v-if="curriculumData.questions != ''" class="" v-html="curriculumData.questions">
</view> </view>
<view class="" v-else>
<u-divider text="暂无思考题"></u-divider>
</view>
</view>
{{myAnswer}}
<view class="answerBox">
<view class="PM_font" style="padding: 20rpx; font-size: 40rpx; color: #333">答案提交</view>
<template>
<view class="container">
<view class="page-body">
<view class='wrapper'>
<view class="editor-wrapper">
<editor id="editor" class="ql-container" placeholder="请输入您的答案..."
show-img-size show-img-toolbar show-img-resize
@statuschange="onStatusChange" :read-only="readOnly"
@ready="onEditorReady">
</editor>
</view>
</view>
</view>
</view>
</template>
<uni-forms :modelValue="answerForm" :rules="rules" ref="form">
<!-- <view class="input_box">
<uni-forms-item label="" name="content" label-width="0">
<text class="input_tit"><i>*</i>内容:<span
style="font-weight: normal; color: #999; font-size: 26rpx;">(600字以内)</span></text>
<view class="in">
<view class="uni-textarea">
<textarea placeholder-style="font-size:26rpx" v-model="form.content" maxlength="600"
auto-height placeholder="请输入内容" />
</view>
</view>
</uni-forms-item>
</view> -->
<view class="input_box">
<text class="input_tit">上传图片:</text>
<view class="in" style="border: none;" @click="checkPermision">
<u-upload :fileList="fileList1" @afterRead="addPic" @delete="deletePic" multiple
:maxCount="4" width="40" height="40" :previewFullImage="true">
</u-upload>
<!-- <text style="font-size: 24rpx; color: #999;">可上传4张问题截图</text> -->
</view>
<!-- <input type="password" maxlength="8" v-model="confirmPassword" placeholder="请确认密码" /> -->
</view>
<view class="input_box">
<radio-group @change="radioChange" class="flex_box">
<view class="" style="margin-right:20rpx ;">
<radio value="0" :checked="0 == answerForm.display" />他人不可见</label>
</view>
<view class="">
<radio value="1" :checked="1 == answerForm.display" />他人可见</label>
</view>
</radio-group>
<span
style="color: #999; font-size: 28rpx; margin-top: 20rpx; display: block;">不勾选时班级管理员以外的人看不见提交的内容</span>
</view>
</uni-forms>
<view class="btn_box"><button @click="onSubmit"> </button></view>
</view>
</view>
</view>
</template> </template>
<view <view style="
style="
background-color: red; background-color: red;
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
" " v-show="screenLoading">
v-show="screenLoading"
>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import permission from "@/js_sdk/wa-permission/permission.js"
import courseDescription from "@/pages/component/commonComponents/list"; import courseDescription from "@/pages/component/commonComponents/list";
import curriculumMp3 from "./mp3Detail.vue"; import curriculumMp3 from "./mp3Detail.vue";
import price from "./price/index.vue"; import price from "./price/index.vue";
import $http from "@/config/requestConfig.js"; import $http from "@/config/requestConfig.js";
import { mapState } from "vuex"; import {
mapState
} from "vuex";
export default { export default {
components: { components: {
courseDescription, //课程说明 courseDescription, //课程说明
@@ -119,6 +164,44 @@ export default {
}, },
data() { data() {
return { return {
answerForm:{
relationId: undefined,
type: "1", //类型0任务1课后题
display: "1", //0不展示1展示
content: "",
img: "",
id:undefined
},
fileList1:[],
tabList: [{
name: '章节介绍',
id: '0'
},
{
name: '思考题',
id: '2'
}
],
rules: {
content: {
rules: [{
required: true,
errorMessage: '请输入回答内容',
}
]
},
},
activeStyle: {
color: '#333',
fontWeight: 'bold',
// transform: 'scale(1.2)',
backgroundColor: '#fff !important'
},
curTab: 0,
changeVideoLock: false, // 切换键锁 changeVideoLock: false, // 切换键锁
isFullScreen: false, isFullScreen: false,
screenLoading: false, screenLoading: false,
@@ -158,8 +241,7 @@ export default {
playData: {}, playData: {},
taiHuClassInfo: {}, taiHuClassInfo: {},
searchValue: "", searchValue: "",
ordersTabs: [ ordersTabs: [{
{
name: "视频教学", name: "视频教学",
type: "1", type: "1",
@@ -189,26 +271,35 @@ export default {
detail: "sociology/course/getCourseCatalogueChapterDetail", detail: "sociology/course/getCourseCatalogueChapterDetail",
curriculumInfo: "app/phone.do?getCourseInfo", curriculumInfo: "app/phone.do?getCourseInfo",
}, },
readOnly: false,
formats: {},
myAnswer:{}, // 我的思考题回答
}; };
}, },
onLoad(options) { onLoad(options) {
// #ifdef APP-PLUS // #ifdef APP-PLUS
plus.screen.lockOrientation("default"); plus.screen.lockOrientation("default");
// #endif // #endif
this.answerForm.relationId = options.id
this.options = options; this.options = options;
this.noRecored = options.noRecored this.noRecored = options.noRecored
console.log('this.noRecored=>', this.noRecored) console.log('this.noRecored=>', this.noRecored)
this.screenLoading = false; this.screenLoading = false;
this.currentCateIndex = this.options.videoIndex this.currentCateIndex = this.options.videoIndex ?
? this.options.videoIndex this.options.videoIndex :
: 0; 0;
// #ifdef APP-PLUS // #ifdef APP-PLUS
plus.screen.unlockOrientation(); // 解除锁定屏幕方向 plus.screen.unlockOrientation(); // 解除锁定屏幕方向
plus.screen.lockOrientation("portrait-primary"); plus.screen.lockOrientation("portrait-primary");
this.getCourseDescriptionData(); this.getCourseDescriptionData();
this.getMyQuestAnswer(options.id)
uni.loadFontFace({
family: 'Pacifico',
source: 'url("https://sungd.github.io/Pacifico.ttf")'
})
// this.getUserInfo() // this.getUserInfo()
// this.getCateList() // this.getCateList()
}, },
@@ -224,6 +315,9 @@ export default {
// this.showSearchList = false // this.showSearchList = false
// this.searchList = [] // this.searchList = []
}, },
onPullDownRefresh(){
uni.stopPullDownRefresh();
},
onShow() { onShow() {
// #endif // #endif
}, },
@@ -231,6 +325,230 @@ export default {
...mapState(["userInfo"]), ...mapState(["userInfo"]),
}, },
methods: { methods: {
getMyQuestAnswer(chapterId){
$http.request({
url: "/common/class/getQuesReplyInfo",
method: "POST",
data:{
"relationId": chapterId,
"userId": this.userInfo.id
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then(res => {
if(res.code == 0 && res.classTaskAndQuesReply != null){
this.myAnswer = res.classTaskAndQuesReply
this.answerForm = res.classTaskAndQuesReply
this.editorCtx = res.classTaskAndQuesReply.content
}else{
this.myAnswer = {}
this.answerForm = {}
this.editorCtx = ''
}
console.log('我的思考题提交情况',res);
}).catch(e => {
console.log('我的思考题提交情况报错',e);
// uni.showToast({
// title: '操作失败',
// icon: 'error'
// })
});
},
async checkPermision() {
var result = await permission.premissionCheck("CAMERA_EXTERNAL_STORAGE")
if (result != 1) {
return false
}
},
addPic(e) {
let that = this;
console.log("添加图片", that.fileList1);
for (var i = 0; i < e.file.length; i++) {
console.log(i,e.file[i].url)
uni.uploadFile({
url: this.$baseUrl + "oss/fileoss",
filePath: e.file[i].url,
//files:e.file,
name: "file",
formData: {},
success: (res) => {
// console.log("添加图片", this.fileList1);
that.fileList1.push({
url: JSON.parse(res.data).url,
});
console.log(that.fileList1, "that.uploadPicLIst");
},
fail: (error) => {
console.log("上传失败", error);
},
});
}
},
deletePic(event) {
this.fileList1.splice(event.index, 1)
},
radioChange(e){
if(this.answerForm.display == e.detail.value) {return}
this.answerForm.display = e.detail.value
},
async onSubmit(){
let data = await this.getHtml();
var _data = data.html.replace(/<.*?>/g,"")
if(!_data || _data == ''){
uni.showToast({
title:'请输入您的答案',
icon:'none'
})
return
}
this.answerForm.content = data.html
if (this.fileList1.length > 0) {
let _list = this.fileList1
_list = _list.map(item => item.url)
// console.log('this.fileList1',_list);
this.answerForm.img = _list.join(',')
}else{
this.answerForm.img = ''
}
var _url = ""
this.answerForm.id ? _url =
'common/class/editClassTaskAndQuesReply' : _url = 'common/class/addClassTaskAndQuesReply'
// this.form.id ? _url =
// 'common/class/editClassTaskReply' : _url = 'common/class/addClassTaskReply'
var data1 = {
"relationId": this.answerForm.id ? undefined : this.curriculumData.id,
"id": this.answerForm.id,
"type": this.answerForm.type, //类型0任务1课后题
"display": this.answerForm.display, //0不展示1展示
"content": this.answerForm.content,
"img": this.answerForm.img
}
console.log('data',data1);
$http.request({
url: _url,
method: "POST",
data:data1,
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then(res => {
uni.showToast({
title: '操作成功!',
icon: 'success'
})
this.fileList1 = []
// this.closePup()
setTimeout(()=>{
this.getMyQuestAnswer(this.curriculumData.id)
// this.pPage = 0
// this.zuoyeList = []
// this.getTaskInfo()
// this.getZuoyeList()
},200)
}).catch(e => {
uni.showToast({
title: '操作失败',
icon: 'error'
})
});
// console.log('data',data.html.replace(/<.*?>/g,""));
},
getHtml() {
return new Promise((resolve, reject) => {
this.editorCtx.getContents({
success: (res) => {
resolve(res);
},
fail: (error) => {
reject(err);
},
});
});
},
readOnlyChange() {
this.readOnly = !this.readOnly
},
onEditorReady() {
// #ifdef APP-PLUS || MP-WEIXIN || H5
uni.createSelectorQuery().select('#editor').context((res) => {
this.editorCtx = res.context
if(this.myAnswer.content == '') return
res.context.setContents({
html:this.myAnswer.content
})
}).exec()
// #endif
},
undo() {
this.editorCtx.undo()
},
redo() {
this.editorCtx.redo()
},
// format(e) {
// let {
// name,
// value
// } = e.target.dataset
// if (!name) return
// // console.log('format', name, value)
// this.editorCtx.format(name, value)
// },
onStatusChange(e) {
const formats = e.detail
this.formats = formats
},
// clear() {
// uni.showModal({
// title: '清空编辑器',
// content: '确定清空编辑器全部内容?',
// success: res => {
// if (res.confirm) {
// this.editorCtx.clear({
// success: function(res) {
// console.log("clear success")
// }
// })
// }
// }
// })
// },
// removeFormat() {
// this.editorCtx.removeFormat()
// },
insertImage() {
uni.chooseImage({
count: 1,
success: (res) => {
this.editorCtx.insertImage({
src: res.tempFilePaths[0],
alt: '图像',
success: function() {
console.log('insert image success')
}
})
}
})
},
tabClick(item, index) {
if (this.curTab == index) {
return
}
this.curTab = index
if (this.curTab == 1) {
uni.loadFontFace({
family: 'Pacifico',
source: 'url("https://sungd.github.io/Pacifico.ttf")'
})
}
},
unlockChangeVideo() { unlockChangeVideo() {
this.changeVideoLock = false this.changeVideoLock = false
}, },
@@ -406,14 +724,15 @@ export default {
(e) => e.id == res.data.current (e) => e.id == res.data.current
); );
console.log( console.log(
"isHaveHistorySeekVideo at line 522:", "获取课程章节详情",
isHaveHistorySeekVideo isHaveHistorySeekVideo, that.curriculumData
); );
that.currentCateIndex = that.currentCateIndex =
isHaveHistorySeekVideo != -1 ? isHaveHistorySeekVideo : 0; isHaveHistorySeekVideo != -1 ? isHaveHistorySeekVideo : 0;
if (that.videoArray.length > 0) { if (that.videoArray.length > 0) {
this.currentVideo = that.videoArray[that.currentCateIndex]; this.currentVideo = that.videoArray[that.currentCateIndex];
console.log('默认播放的index',that.currentCateIndex, this.currentVideo.id,that.videoArray); console.log('默认播放的index', that.currentCateIndex, this.currentVideo.id, that
.videoArray);
this.initVideo(); this.initVideo();
} }
var videoArray = []; var videoArray = [];
@@ -603,7 +922,9 @@ export default {
transformData(inputData) { transformData(inputData) {
const result = {}; const result = {};
inputData.forEach((item) => { inputData.forEach((item) => {
const { letter } = item; const {
letter
} = item;
if (!result[letter]) { if (!result[letter]) {
result[letter] = []; result[letter] = [];
} }
@@ -773,6 +1094,52 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
@import "@/style/mixin.scss"; @import "@/style/mixin.scss";
// .page-body {
// height: calc(100vh - var(--window-top) - var(--status-bar-height));
// }
// .wrapper {
// height: 100%;
// }
// .editor-wrapper {
// height: calc(100vh - var(--window-top) - var(--status-bar-height) - 140px);
// background: #fff;
// }
// .iconfont {
// display: inline-block;
// padding: 8px 8px;
// width: 24px;
// height: 24px;
// cursor: pointer;
// font-size: 20px;
// }
// .toolbar {
// box-sizing: border-box;
// border-bottom: 0;
// font-family: 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;
// }
.ql-container {
box-sizing: border-box;
// padding: 12px 15px;
width: 100%;
min-height: 30vh;
min-height: 300rpx;
font-size: 14px;
font-style: normal !important;
line-height: 1.5;
overflow-y: scroll;
border:1px solid #eee
}
.ql-active {
color: #06c;
}
.u-grid-list { .u-grid-list {
// height: 40rpx; // height: 40rpx;
@@ -854,6 +1221,63 @@ export default {
} }
} }
.coursePart {
margin-top: 20rpx;
@include ptop_bottm(10px);
border-radius: 20rpx 20rpx 0 0;
@include pleft_right(10px);
align-items: flex-end;
// @include mshadow(10px, 1);
margin-top: 20rpx;
padding: 0 20rpx;
padding-top: 20rpx;
// background-color: $themeColor;
.item {
justify-content: center;
align-items: center;
color: #fff;
width: 100%;
text-align: center;
padding: 16rpx 0;
margin-right: 10rpx;
border-radius: 20rpx 20rpx 0 0;
border: 1px solid #fff;
border-bottom: none;
background-color: rgba(0, 0, 0, .4);
text {
font-size: 30rpx;
}
}
.item:last-child {
margin-right: 0;
}
.item.active {
// background-color: #fbfbff;
background-color: $themeColor;
color: #fff;
padding: 20rpx 0 !important;
text {
font-size: 36rpx !important;
}
}
}
.btn_box {
margin-top: 70rpx;
padding-bottom: 20rpx;
button {
font-size: 32rpx;
@include theme('btn_bg') color: #fff;
height: 80rpx;
line-height: 80rpx;
border-radius: 50rpx;
}
}
.search_box { .search_box {
margin: 0 auto; margin: 0 auto;
overflow: hidden; overflow: hidden;
@@ -954,8 +1378,7 @@ export default {
// height: 400rpx !important; // height: 400rpx !important;
} }
.commonDetailPage { .commonDetailPage {}
}
.curriulum_box { .curriulum_box {
margin-top: 20rpx; margin-top: 20rpx;

View File

@@ -462,47 +462,7 @@
fatherIndex: null, fatherIndex: null,
supportFlag: false, supportFlag: false,
selectGoodsData: {}, selectGoodsData: {},
<<<<<<< .mine
buyOptions: [], buyOptions: [],
=======
buyOptions: [
// {
// icon: 'chat',
// text: '客服'
// },
// {
// icon: 'shop',
// text: '店铺',
// // info: 2,
// infoBackgroundColor: '#007aff',
// infoColor: "#f5f5f5"
// },
// {
// icon: 'cart',
// text: '购物车',
// info: 2
// }
],
>>>>>>> .theirs
customButtonGroup1: [{ customButtonGroup1: [{
with: 200, with: 200,
text: "立即购买", text: "立即购买",
@@ -769,13 +729,8 @@
if (res.code == 0) { if (res.code == 0) {
this.getCourseDescriptionData(); this.getCourseDescriptionData();
// this.$commonJS.showToast(""); // this.$commonJS.showToast("");
<<<<<<< .mine
} }
=======
}
>>>>>>> .theirs
this.$forceUpdate(); this.$forceUpdate();
}); });
} else { } else {

View File

@@ -141,6 +141,7 @@
</template> </template>
<script> <script>
import permission from "@/js_sdk/wa-permission/permission.js"
import $http from '@/config/requestConfig.js'; import $http from '@/config/requestConfig.js';
import { import {
mapState mapState