This commit is contained in:
那些花儿
2025-09-11 20:01:45 +08:00
parent 32d5791c0a
commit 0777e2f4f7
23 changed files with 922 additions and 460 deletions
@@ -0,0 +1,201 @@
<template>
<div>
<div class="file-preview-container" v-if="fileList && fileList.length > 0">
<div class="file-item" v-for="item in fileList" :key="item.id">
<img
v-if="item.suffix === 'jpg' || item.suffix === 'png' || item.suffix === 'jpeg' || item.suffix === 'gif'"
:src="item.thumbnail"
@click.stop="$commonUtil.previewFile(item)"
class="file-image"
/>
<img
v-else
:src="$commonUtil.getFileItemShowIcon(item.suffix)"
@click.stop="$commonUtil.previewFile(item)"
class="file-image"
/>
<div class="file-download" @click="$downLoad(item.downloadPath)">
<i class="el-icon-download"></i>
{{ item.name }}
</div>
</div>
</div>
<div v-else class="empty-container">
<div class="empty-text">暂无</div>
</div>
</div>
</template>
<script>
module.exports = {
name: "H5Index",
props: {
files: {
type: [String, Array],
default: undefined,
required: false
},
complete_result: {
type: Boolean,
default: false,
required: false
}
},
watch: {
files: {
handler(val) {
if (val) {
this.buildEchoFileObject(val)
} else {
this.fileList = []
}
},
immediate: true
}
},
data() {
return {
fileList: []
}
},
methods: {
buildEchoFileObject(val) {
let ids = []
if (this.complete_result) {
if (Array.isArray(val)) {
ids = val.map((item) => {
if (item.response.data.includes("=")) {
return item?.response?.data.substring(item?.response?.data.lastIndexOf("=") + 1)
} else {
return item?.response?.data
}
})
} else {
try {
ids = JSON.parse(val).map((item) => {
if (item.response.data.includes("=")) {
return item?.response?.data.substring(item?.response?.data.lastIndexOf("=") + 1)
} else {
return item?.response?.data
}
})
} catch (err) {
this.fileList = []
}
}
} else {
//那就是链接 没有直接存id的吧。。
if (Array.isArray(val)) {
ids = val.map((item) => {
return item.substring(item.lastIndexOf("=") + 1)
})
} else {
ids = val.split(",").map((item) => {
return item.substring(item.lastIndexOf("=") + 1)
})
}
}
this.requestFullFile(ids)
},
requestFullFile(ids) {
this.$axios.post("/platform/sys/file/previewFileData", {ids: JSON.stringify(ids)}).then((res) => {
if (res.code === 0) {
this.fileList = res.data
}
})
}
}
}
</script>
<style scoped>
.file-preview-container {
position: relative;
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 8px;
width: 100%;
box-sizing: border-box;
}
.file-preview-container .file-item {
aspect-ratio: 1;
position: relative;
transition: all 300ms;
border-radius: 8px;
cursor: pointer;
text-align: center;
overflow: hidden;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background: #f8f9fa;
border: 1px solid #e9ecef;
}
.file-preview-container .file-item:active {
background: #e9ecef;
transform: scale(0.98);
}
.file-preview-container .file-item .file-image {
width: 60px;
height: 60px;
object-fit: cover;
border-radius: 4px;
margin-bottom: 8px;
}
.file-preview-container .file-item .file-download {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 28px;
line-height: 28px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: white;
background-color: rgba(0, 0, 0, 0.7);
border-radius: 0 0 8px 8px;
font-size: 12px;
padding: 0 8px;
box-sizing: border-box;
}
.empty-container {
display: flex;
justify-content: center;
align-items: center;
height: 120px;
color: #999;
}
.empty-text {
font-size: 14px;
}
/* 响应式设计 */
@media (max-width: 480px) {
.file-preview-container {
gap: 4px;
padding: 4px;
}
.file-preview-container .file-item .file-image {
width: 40px;
height: 40px;
}
.file-preview-container .file-item .file-download {
height: 20px;
line-height: 20px;
font-size: 10px;
}
}
</style>
@@ -39,6 +39,10 @@
<script src="${base!}/assets/platform/plugins/form-create/form-create.min.js?v=0.0.1"></script>
<script src="${base!}/assets/platform/plugins/form-create/designer/index.umd.js"></script>
<!--图片预览-->
<link rel="stylesheet" href="${base!}/assets/platform/plugins/viewerjs/viewer.css" />
<script src="${base!}/assets/platform/plugins/viewerjs/viewer.js"></script>
<script src="${base!}/components/plugins/sysDict/DictData.js"></script>
<script src="${base!}/assets/platform/js/util/commonUtil.js"></script>
<script src="${base!}/assets/platform/js/main.js"></script>
@@ -145,17 +149,20 @@
})
}
function historyBack() {
function historyBack(func) {
if (window.history.length > 1) {
window.history.back()
} else {
window.location.href = "/platform/h5/home"
}
func && func()
}
Vue.mixin({
methods: {
historyBack: historyBack
historyBack: function(func) {
historyBack(func);
}
}
})
</script>
@@ -353,6 +360,7 @@
//挂载
Vue.prototype.$moment = moment
Vue.prototype.$businessTool = businessTool
Vue.prototype.$commonUtil = commonUtil
Vue.prototype.$auth = commonUtil.authService()
Vue.prototype.$axios = commonUtil.axiosService()
Vue.prototype.$downLoad = commonUtil.downLoadService.bind(commonUtil)
@@ -371,6 +379,7 @@
Vue.component("enum-tag", httpVueLoader("/components/plugins/sysEnum/EnumTag.vue?v=" + new Date().getTime()))
Vue.component("table-list", httpVueLoader("/components/plugins/h5/TableList.vue?v=" + new Date().getTime()))
Vue.component("table-column", httpVueLoader("/components/plugins/h5/TableColumn.vue?v=" + new Date().getTime()))
Vue.component("file-preview", httpVueLoader("/components/plugins/sysFilePreview/H5Index.vue?v=" + new Date().getTime()))
</script>
</head>
<body>
@@ -49,6 +49,7 @@ layout("/layouts/platform.html"){
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
<el-dialog :visible.sync="formDialogVisible" :title="formData.id ? '编辑模块' : '添加模块'">
@@ -25,13 +25,13 @@ const PROPOSAL_INFO = {
<dict-tag :options="dict.type.PROPOSAL_CASE_FILING_RESULT"
:value="viewData.caseFilingResult"></dict-tag>
</el-descriptions-item>
<el-descriptions-item label="提案摘要" :span="3">
<div class="text-left">{{viewData.excerpt}}</div>
<el-descriptions-item label="调研情况" :span="3">
<div class="text-left">{{viewData.researchFindings}}</div>
</el-descriptions-item>
<el-descriptions-item label="提案内容" :span="3">
<el-descriptions-item label="提案案由" :span="3">
<div class="text-left" v-html="viewData.brief"></div>
</el-descriptions-item>
<el-descriptions-item label="改进建议措施" :span="3">
<el-descriptions-item label="建议措施" :span="3">
<div class="text-left" v-html="viewData.measures"></div>
</el-descriptions-item>
<el-descriptions-item label="附件" :span="3">
@@ -2,6 +2,157 @@
layout("/layouts/platform_h5.html"){
#-->
<style>
.course-cover {
width: 100%;
height: 200px;
background: linear-gradient(45deg, #f0f2f5, #e9ecef);
display: flex;
align-items: center;
justify-content: center;
}
.course-cover .van-image {
width: 100%;
height: 100%;
}
.course-info {
padding: 16px;
overflow: hidden;
}
.course-info .van-cell-group {
padding: 20px;
background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
}
.course-title {
font-size: 20px;
font-weight: 700;
color: #1a1a1a;
margin-bottom: 12px;
line-height: 1.3;
letter-spacing: 0.5px;
}
.course-desc {
font-size: 15px;
color: #555;
line-height: 1.7;
margin-bottom: 16px;
text-align: justify;
}
.course-meta {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 13px;
padding-top: 16px;
border-top: 1px solid #f0f0f0;
margin-top: 4px;
}
.course-date {
color: #888;
font-weight: 500;
}
.progress-section {
margin-bottom: 12px;
}
.progress-container {
display: flex;
align-items: center;
width: 100%;
}
.progress-container .van-progress {
flex: 1;
margin-right: 12px;
}
.progress-text {
font-size: 14px;
color: #333;
min-width: 40px;
}
.chapters-section {
margin-bottom: 16px;
}
.chapter-card {
background: #fff;
border: 1px solid #f0f0f0;
margin-bottom: 16px;
overflow: hidden;
}
.chapter-header {
padding: 16px;
background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
border-bottom: 1px solid #f0f0f0;
}
.chapter-title {
font-size: 16px;
font-weight: 600;
color: #333;
margin: 0;
}
.chapter-videos {
padding: 0;
}
.video-item {
display: flex;
align-items: center;
padding: 12px 16px;
border-bottom: 1px solid #f8f9fa;
cursor: pointer;
transition: background-color 0.2s;
}
.video-item:hover {
background-color: #f8f9fa;
}
.video-item:last-child {
border-bottom: none;
}
.video-icon {
margin-right: 12px;
flex-shrink: 0;
}
.video-content {
flex: 1;
min-width: 0;
}
.video-title {
font-size: 14px;
color: #333;
margin-bottom: 4px;
font-weight: 500;
}
.video-duration {
font-size: 12px;
color: #999;
}
.video-status {
margin-left: 8px;
flex-shrink: 0;
}
</style>
<div id="app" v-cloak>
<van-nav-bar @click-left="historyBack" left-arrow left-text="返回" title="课程详情" placeholder fixed></van-nav-bar>
@@ -17,7 +168,7 @@ layout("/layouts/platform_h5.html"){
<van-icon name="photo-fail" size="48" color="#ddd"></van-icon>
</template>
</van-image>
<van-icon v-else name="graduation" size="48" color="#ddd" ></van-icon>
<van-icon v-else name="graduation" size="48" color="#ddd"></van-icon>
</div>
<!-- 课程信息 -->
@@ -35,7 +186,7 @@ layout("/layouts/platform_h5.html"){
<van-cell>
<template #default>
<div class="progress-container">
<van-progress :percentage="progressPercentage" stroke-width="6" color="#1989fa" />
<van-progress :percentage="progressPercentage" stroke-width="6"></van-progress>
<span class="progress-text">{{ progressPercentage }}%</span>
</div>
</template>
@@ -43,227 +194,156 @@ layout("/layouts/platform_h5.html"){
</van-cell-group>
<!-- 课程章节 -->
<van-cell-group title="课程章节" class="chapters-section">
<van-collapse v-model="activeChapters">
<van-collapse-item
v-for="(chapter, index) in course.chapters"
:key="chapter.id"
:name="index"
:title="chapter.title || `第${index + 1}章`"
<div class="chapters-section">
<h3 style="margin: 0 0 16px 0; padding-left:16px;font-size: 16px; font-weight: 600; color: #333;">课程章节</h3>
<div v-if="course.chapters && course.chapters.length">
<div
v-for="(chapter, index) in course.chapters"
v-if="chapter.videos && chapter.videos.length"
:key="chapter.id"
class="chapter-card"
>
<van-cell
v-for="video in chapter.videos"
:key="video.id"
:title="video.title || '未命名视频'"
:label="formatDuration(video.duration)"
is-link
@click="playVideo(video.id, video.title)"
>
<template #icon>
<van-icon
:name="isVideoCompleted(video.id) ? 'success' : 'play-circle-o'"
:color="isVideoCompleted(video.id) ? '#07c160' : '#1989fa'"
/>
</template>
<template #right-icon v-if="isVideoCompleted(video.id)">
<van-tag type="success" size="mini">已完成</van-tag>
</template>
</van-cell>
<van-empty v-if="!chapter.videos || !chapter.videos.length" description="暂无视频" />
</van-collapse-item>
</van-collapse>
<van-empty v-if="!course.chapters || !course.chapters.length" description="暂无章节内容" />
</van-cell-group>
<div class="chapter-header">
<h4 class="chapter-title">{{ chapter.title || '第' + (index + 1) + '章' }}</h4>
</div>
<div class="chapter-videos">
<div
v-for="video in chapter.videos"
:key="video.id"
class="video-item"
@click="playVideo(video.id, video.title)"
>
<div class="video-icon">
<van-icon
:name="isVideoCompleted(video.id) ? 'success' : 'play-circle-o'"
:color="isVideoCompleted(video.id) ? '#07c160' : '#1989fa'"
size="20"
></van-icon>
</div>
<div class="video-content">
<div class="video-title">{{ video.title || '未命名视频' }}</div>
<div class="video-duration">{{ formatDuration(video.duration) }}</div>
</div>
<div class="video-status" v-if="isVideoCompleted(video.id)">
<van-tag type="success" size="mini">已完成</van-tag>
</div>
</div>
</div>
</div>
</div>
<van-empty v-else description="暂无章节内容" style="padding: 40px 20px;"></van-empty>
</div>
</div>
<van-empty v-else description="课程不存在" />
<van-empty v-else description="课程不存在"></van-empty>
</div>
<style>
.loading-container {
display: flex;
justify-content: center;
align-items: center;
height: 200px;
}
.course-cover {
width: 100%;
height: 200px;
background: linear-gradient(45deg, #f0f2f5, #e9ecef);
display: flex;
align-items: center;
justify-content: center;
}
.course-cover .van-image {
width: 100%;
height: 100%;
}
.course-info {
margin-bottom: 12px;
}
.course-info .van-cell-group {
padding: 16px;
}
.course-title {
font-size: 18px;
font-weight: 600;
color: #333;
margin-bottom: 8px;
line-height: 1.4;
}
.course-desc {
font-size: 14px;
color: #666;
line-height: 1.6;
margin-bottom: 12px;
}
.course-meta {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 12px;
padding-top: 12px;
border-top: 1px solid #eee;
}
.course-date {
color: #999;
}
.progress-section {
margin-bottom: 12px;
}
.progress-container {
display: flex;
align-items: center;
width: 100%;
}
.progress-container .van-progress {
flex: 1;
margin-right: 12px;
}
.progress-text {
font-size: 14px;
color: #333;
min-width: 40px;
}
.chapters-section {
margin-bottom: 12px;
}
</style>
<script>
const vue = new Vue({
el: "#app",
store,
data() {
return {
course: null,
loading: true,
courseId: null,
activeChapters: [],
progressData: null
}
},
computed: {
progressPercentage() {
if (!this.progressData || !this.progressData.totalVideos) return 0;
return Math.round(this.progressData.completedVideos / this.progressData.totalVideos * 100);
}
},
methods: {
historyBack,
const vue = new Vue({
el: "#app",
store,
data() {
return {
course: null,
loading: true,
courseId: null,
activeChapters: [],
progressData: null
}
},
computed: {
progressPercentage() {
if (!this.progressData || !this.progressData.totalVideos) return 0;
return Math.round(this.progressData.completedVideos / this.progressData.totalVideos * 100);
}
},
methods: {
historyBack,
// 加载课程详情
async loadCourseDetail() {
if (!this.courseId) {
this.$toast.fail('缺少课程ID参数');
this.loading = false;
return;
}
try {
const {code, data, msg} = await $.get('/platform/h5/edu/course/detail/data', {
courseId: this.courseId
});
if (code === 0 && data) {
this.course = data;
this.loadCourseProgress();
} else {
this.$toast.fail(msg || '加载课程详情失败');
}
} catch (error) {
this.$toast.fail('网络错误');
}
// 加载课程详情
async loadCourseDetail() {
if (!this.courseId) {
this.$toast.fail('缺少课程ID参数');
this.loading = false;
return;
}
},
try {
const { code, data, msg } = await $.get('/platform/h5/edu/course/detail/data', {
courseId: this.courseId
});
// 加载课程进度
async loadCourseProgress() {
try {
const {code, data} = await $.get('/platform/h5/edu/course/progress', {
courseId: this.courseId
});
if (code === 0 && data) {
this.course = data;
this.loadCourseProgress();
} else {
this.$toast.fail(msg || '加载课程详情失败');
if (code === 0 && data) {
this.progressData = data;
}
} catch (error) {
console.error('加载进度失败:', error);
}
} catch (error) {
this.$toast.fail('网络错误');
}
},
this.loading = false;
},
// 检查视频是否已完成
isVideoCompleted(videoId) {
return this.progressData &&
this.progressData.completedVideoIds &&
this.progressData.completedVideoIds.includes(videoId);
},
// 加载课程进度
async loadCourseProgress() {
try {
const { code, data } = await $.get('/platform/h5/edu/course/progress', {
courseId: this.courseId
});
// 播放视频
playVideo(videoId, videoTitle) {
pjaxReplace('/platform/h5/edu/video/play?videoId=' + videoId + '&courseId=' + this.courseId + '&title=' + encodeURIComponent(videoTitle || ''));
},
if (code === 0 && data) {
this.progressData = data;
}
} catch (error) {
console.error('加载进度失败:', error);
// 格式化日期
formatDate(dateStr) {
if (!dateStr) return '';
const date = new Date(dateStr);
return date.getFullYear() + '-' +
String(date.getMonth() + 1).padStart(2, '0') + '-' +
String(date.getDate()).padStart(2, '0');
},
// 格式化时长
formatDuration(seconds) {
if (!seconds) return '00:00';
const minutes = Math.floor(seconds / 60);
const remainingSeconds = seconds % 60;
return String(minutes).padStart(2, '0') + ':' + String(remainingSeconds).padStart(2, '0');
}
},
// 检查视频是否已完成
isVideoCompleted(videoId) {
return this.progressData &&
this.progressData.completedVideoIds &&
this.progressData.completedVideoIds.includes(videoId);
},
mounted() {
// 获取URL参数
const urlParams = new URLSearchParams(window.location.search);
this.courseId = urlParams.get('courseId');
// 播放视频
playVideo(videoId, videoTitle) {
pjaxReplace(`/platform/h5/edu/video/play?videoId=${videoId}&courseId=${this.courseId}&title=${encodeURIComponent(videoTitle || '')}`);
},
// 格式化日期
formatDate(dateStr) {
if (!dateStr) return '';
const date = new Date(dateStr);
return date.getFullYear() + '-' +
String(date.getMonth() + 1).padStart(2, '0') + '-' +
String(date.getDate()).padStart(2, '0');
},
// 格式化时长
formatDuration(seconds) {
if (!seconds) return '00:00';
const minutes = Math.floor(seconds / 60);
const remainingSeconds = seconds % 60;
return String(minutes).padStart(2, '0') + ':' + String(remainingSeconds).padStart(2, '0');
this.loadCourseDetail();
}
},
mounted() {
// 获取URL参数
const urlParams = new URLSearchParams(window.location.search);
this.courseId = urlParams.get('courseId');
this.loadCourseDetail();
}
});
});
</script>
<!--#
@@ -13,11 +13,6 @@ layout("/layouts/platform_h5.html"){
position: relative;
}
.course-item:active {
transform: translateY(2px) scale(0.98);
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}
.course-cover {
width: 100px;
height: 100px;
@@ -2,8 +2,38 @@
layout("/layouts/platform_h5.html"){
#-->
<style>
.video-container {
background: #000;
min-height: calc(100vh - 46px);
display: flex;
align-items: center;
justify-content: center;
}
.loading-container {
display: flex;
justify-content: center;
align-items: center;
height: 300px;
color: white;
}
.video-player {
width: 100%;
height: 100%;
}
.video-element {
width: 100%;
height: auto;
max-height: calc(100vh - 46px);
object-fit: contain;
}
</style>
<div id="app" v-cloak>
<van-nav-bar @click-left="historyBack" left-arrow left-text="返回" :title="videoTitle" placeholder fixed />
<van-nav-bar @click-left="pageBack" left-arrow left-text="返回" :title="videoTitle" placeholder fixed></van-nav-bar>
<div class="video-container">
<div v-if="loading" class="loading-container">
@@ -11,13 +41,14 @@ layout("/layouts/platform_h5.html"){
</div>
<div v-else-if="videoInfo" class="video-player">
<video
<video
ref="videoElement"
class="video-element"
:src="videoInfo.url"
controls
preload="metadata"
@loadedmetadata="onVideoLoaded"
@canplay="onVideoCanPlay"
@play="onVideoPlay"
@pause="onVideoPause"
@timeupdate="onTimeUpdate"
@@ -28,12 +59,12 @@ layout("/layouts/platform_h5.html"){
</video>
</div>
<van-empty v-else description="视频加载失败" />
<van-empty v-else description="视频加载失败"></van-empty>
</div>
<!-- 进度保存提示 -->
<van-toast v-model="showProgressToast" message="进度已保存" :duration="1000" />
<!-- 完成学习弹窗 -->
<van-dialog
v-model="showCompletionDialog"
@@ -43,39 +74,9 @@ layout("/layouts/platform_h5.html"){
cancel-button-text="继续观看"
confirm-button-text="返回课程"
@confirm="backToCourse"
/>
></van-dialog>
</div>
<style>
.video-container {
background: #000;
min-height: calc(100vh - 46px);
display: flex;
align-items: center;
justify-content: center;
}
.loading-container {
display: flex;
justify-content: center;
align-items: center;
height: 300px;
color: white;
}
.video-player {
width: 100%;
height: 100%;
}
.video-element {
width: 100%;
height: auto;
max-height: calc(100vh - 46px);
object-fit: contain;
}
</style>
<script>
const vue = new Vue({
el: "#app",
@@ -90,11 +91,14 @@ const vue = new Vue({
isPlaying: false,
progressSaveTimer: null,
showProgressToast: false,
showCompletionDialog: false
showCompletionDialog: false,
savedProgress: 0
}
},
methods: {
historyBack,
pageBack(){
this.historyBack(this.clearProgressSave)
},
// 加载视频信息
async loadVideoInfo() {
@@ -105,7 +109,7 @@ const vue = new Vue({
}
try {
const { code, data, msg } = await $.get('${base}/platform/h5/edu/video/detail', {
const { code, data, msg } = await this.$axios.post('/platform/h5/edu/video/detail', {
videoId: this.videoId
});
@@ -126,7 +130,14 @@ const vue = new Vue({
// 视频加载完成
onVideoLoaded() {
console.log('视频加载完成');
console.log('视频元数据加载完成');
},
// 视频可以播放
onVideoCanPlay() {
console.log('视频可以播放');
// 视频可以播放时,设置观看进度
this.setWatchProgress();
},
// 视频开始播放
@@ -143,6 +154,7 @@ const vue = new Vue({
// 时间更新
onTimeUpdate() {
console.log('时间更新')
// 可以在这里添加进度更新逻辑
},
@@ -162,31 +174,48 @@ const vue = new Vue({
if (!this.videoId || !this.courseId) return;
try {
const { code, data } = await $.get('${base}/platform/h5/edu/study/record', {
const { code, data } = await this.$axios.post('/platform/h5/edu/study/record', {
videoId: this.videoId
});
if (code === 0 && data && data.watchDuration > 0) {
const video = this.$refs.videoElement;
if (video) {
video.currentTime = data.watchDuration;
}
if (code === 0 && data && data.watchedDuration > 0) {
this.savedProgress = data.watchedDuration;
}
} catch (error) {
console.error('加载观看进度失败:', error);
}
},
// 设置观看进度
setWatchProgress() {
if (this.savedProgress > 0) {
const video = this.$refs.videoElement;
if (video && video.readyState >= 3) {
// 使用setTimeout确保DOM更新完成
setTimeout(() => {
try {
video.currentTime = this.savedProgress;
console.log('设置观看进度成功:', this.savedProgress);
} catch (error) {
console.error('设置观看进度失败:', error);
}
}, 100);
} else {
console.log('视频还未准备好,readyState:', video ? video.readyState : 'video不存在');
}
}
},
// 保存观看进度
async saveProgress() {
const video = this.$refs.videoElement;
if (!video || !this.videoId || !this.courseId) return;
try {
await $.post('${base}/platform/h5/edu/study/progress/save', {
await $.post('/platform/h5/edu/study/progress/save', {
videoId: this.videoId,
courseId: this.courseId,
watchDuration: Math.floor(video.currentTime)
watchedDuration: Math.floor(video.currentTime)
});
this.showProgressToast = true;
@@ -216,7 +245,7 @@ const vue = new Vue({
if (!this.videoId || !this.courseId) return;
try {
const { code } = await $.post('${base}/platform/h5/edu/study/complete', {
const { code } = await $.post('/platform/h5/edu/study/complete', {
videoId: this.videoId,
courseId: this.courseId
});
@@ -232,7 +261,7 @@ const vue = new Vue({
// 返回课程
backToCourse() {
if (this.courseId) {
this.$router.push(`/course/detail?courseId=${this.courseId}`);
} else {
this.historyBack();
}
@@ -259,4 +288,4 @@ const vue = new Vue({
<!--#
}
#-->
#-->
@@ -24,20 +24,18 @@ const PROPOSAL_INFO = {
<dict-tag :options="dict.type.PROPOSAL_CASE_FILING_RESULT"
:value="viewData.caseFilingResult"></dict-tag>
</van-cell>
<van-cell title="提案摘要" class="direction-column-cell">
<div v-html="viewData.excerpt"></div>
<van-cell title="调研情况" class="direction-column-cell">
<div v-html="viewData.researchFindings"></div>
</van-cell>
<van-cell title="提案内容" class="direction-column-cell">
<van-cell title="提案案由" class="direction-column-cell">
<div v-html="viewData.brief"></div>
</van-cell>
<van-cell title="可行性分析" class="direction-column-cell">
<van-cell title="建议措施" class="direction-column-cell">
<div v-html="viewData.measures"></div>
</van-cell>
<!-- <van-cell title="附件">
<div slot="label">
{{viewData.files}}
</div>
</van-cell>-->
<van-cell title="附件" class="direction-column-cell">
<file-preview :files="viewData.files" complete_result></file-preview>
</van-cell>
<!-- <van-cell title="签字">-->
<!-- <div slot="label">-->
<!-- <van-image :src="viewData.signature"-->
@@ -63,37 +61,40 @@ const PROPOSAL_INFO = {
<van-cell title="办理用户">{{ task.taskFormData.userName }}({{task.taskFormData.loginName}})
</van-cell>
<van-cell title="办理时间">{{ task.finishTime }}</van-cell>
<van-cell title="附议人" v-if="task.taskName === '85b7b9bd-d706-48cb-99a1-ef1370fb1819'" class="direction-column-cell">
<van-cell title="附议人" v-if="task.taskName === '85b7b9bd-d706-48cb-99a1-ef1370fb1819'"
class="direction-column-cell">
<el-table :data="task?.taskFormData?.seconder">
<el-table-column label="姓名" prop="userName"></el-table-column>
<el-table-column label="工号" prop="loginName"></el-table-column>
<el-table-column label="性别" prop="sex"></el-table-column>
<el-table-column label="单位" prop="unitName" show-overflow-tooltip></el-table-column>
<el-table-column label="分工会" prop="unionName" show-overflow-tooltip></el-table-column>
<el-table-column label="代表团" prop="delegationName" show-overflow-tooltip></el-table-column>
<el-table-column label="分工会" prop="unionName"
show-overflow-tooltip></el-table-column>
<el-table-column label="代表团" prop="delegationName"
show-overflow-tooltip></el-table-column>
</el-table>
<!-- <table>-->
<!-- <thead>-->
<!-- <tr>-->
<!-- <th>姓名</th>-->
<!-- <th>工号</th>-->
<!-- <th>性别</th>-->
<!-- <th>单位</th>-->
<!-- <th>分工会</th>-->
<!-- <th>代表团</th>-->
<!-- </tr>-->
<!-- </thead>-->
<!-- <tbody>-->
<!-- <tr v-for="item in task?.taskFormData?.seconder">-->
<!-- <td>{{item.userName}}</td>-->
<!-- <td>{{item.loginName}}</td>-->
<!-- <td>{{item.sex}}</td>-->
<!-- <td>{{item.unitName}}</td>-->
<!-- <td>{{item.unionName}}</td>-->
<!-- <td>{{item.delegationName}}</td>-->
<!-- </tr>-->
<!-- </tbody>-->
<!-- </table>-->
<!-- <table>-->
<!-- <thead>-->
<!-- <tr>-->
<!-- <th>姓名</th>-->
<!-- <th>工号</th>-->
<!-- <th>性别</th>-->
<!-- <th>单位</th>-->
<!-- <th>分工会</th>-->
<!-- <th>代表团</th>-->
<!-- </tr>-->
<!-- </thead>-->
<!-- <tbody>-->
<!-- <tr v-for="item in task?.taskFormData?.seconder">-->
<!-- <td>{{item.userName}}</td>-->
<!-- <td>{{item.loginName}}</td>-->
<!-- <td>{{item.sex}}</td>-->
<!-- <td>{{item.unitName}}</td>-->
<!-- <td>{{item.unionName}}</td>-->
<!-- <td>{{item.delegationName}}</td>-->
<!-- </tr>-->
<!-- </tbody>-->
<!-- </table>-->
</van-cell>
</van-cell-group>
@@ -109,7 +109,7 @@ layout("/layouts/platform_h5.html"){
},
onEdit(row) {
this.$pjaxReplace("/platform/h5/proposal/write?bizId=" + row.id + "&taskId=" + row.startTaskId)
this.$pjaxReplace("/platform/proposal/write/h5?bizId=" + row.id + "&taskId=" + (row.startTaskId || ''))
},
doSearch() {
@@ -40,9 +40,9 @@ layout("/layouts/platform_h5.html"){
</div>
<div class="action-btn" v-if="row.taskState === 10" @click="onApproval(row)">
<i class="fa fa-edit"></i>
<span>审核</span>
<span>附议</span>
</div>
<div class="action-btn delete" v-if="row.taskState === 10" @click="onRevoke(row)">
<div class="action-btn delete" v-if="row.canRevoke" @click="onRevoke(row)">
<i class="fa fa-reply"></i>
<span>撤回</span>
</div>
@@ -159,7 +159,7 @@ layout("/layouts/platform_h5.html"){
<van-field
v-model="formData.brief"
label="案由"
label="提案案由"
type="textarea"
rows="6"
autosize
@@ -184,15 +184,15 @@ layout("/layouts/platform_h5.html"){
<!-- 附件上传 -->
<van-cell-group title="附件上传" class="form-group">
<van-field label="附件" name="files" required class="direction-column-field">
<!-- <h5-file-upload-->
<!-- slot="input"-->
<!-- :value.sync="formData.files"-->
<!-- :upload_number="10"-->
<!-- upload_mode="file"-->
<!-- upload_result_category="array"-->
<!-- upload_result_type="url"-->
<!-- complete_result-->
<!-- ></h5-file-upload>-->
<h5-file-upload
slot="input"
:value.sync="formData.files"
:upload_number="10"
upload_mode="file"
upload_result_category="array"
upload_result_type="url"
complete_result
></h5-file-upload>
</van-field>
</van-cell-group>
@@ -293,7 +293,7 @@ layout("/layouts/platform_h5.html"){
this.$toast.clear();
if (res.code === 0) {
this.$toast.success(res.msg);
pjaxReplace('/platform/h5/proposal/mine')
pjaxReplace('/platform/proposal/mine/h5')
} else {
this.$toast.fail(res.msg || '保存失败');
}
@@ -337,7 +337,7 @@ layout("/layouts/platform_h5.html"){
this.$toast.clear();
if (res.code === 0) {
this.$toast.success("提交成功");
pjaxReplace('/platform/h5/proposal/mine')
pjaxReplace('/platform/proposal/mine/h5')
} else {
this.$toast.fail(res.msg || '提交失败');
}
@@ -387,7 +387,7 @@ layout("/layouts/platform_h5.html"){
if (res.code === 0) {
this.$toast.success("提交成功");
setTimeout(() => {
pjaxReplace('/platform/h5/proposal/mine')
pjaxReplace('/platform/proposal/mine/h5')
}, 1500);
} else {
this.$toast.fail(res.msg || '提交失败');
@@ -1,7 +1,7 @@
const apps = {
template: /*language=HTML*/ `
<div class="apps-container">
<van-nav-bar title="代表阅览" placeholder fixed></van-nav-bar>
<van-nav-bar title="应用中心" placeholder fixed></van-nav-bar>
<!-- 搜索栏 -->
<van-sticky offset-top="46px">
<van-search
@@ -13,14 +13,25 @@ const apps = {
></van-search>
</van-sticky>
<!-- 使用TreeSelect组件 -->
<van-tree-select
:items="treeSelectItems"
:main-active-index.sync="activeTab"
@click-nav="onClickNav"
>
<template #content>
<div class="custom-tree-select">
<!-- 左侧导航 -->
<div class="tree-nav">
<div
v-for="(category, index) in allCategories"
:key="category.id"
:class="['nav-item', { active: activeTab === index }]"
@click="onClickNav(index)"
>
<div class="nav-icon" v-if="category.icon">
<i :class="category.icon"></i>
</div>
<div class="nav-text">{{ category.name }}</div>
<div class="nav-indicator" v-if="activeTab === index"></div>
</div>
</div>
<!-- 右侧内容 -->
<div class="tree-content">
<!-- 应用列表 -->
<div class="app-list" v-if="applications.length > 0">
<div
@@ -50,15 +61,39 @@ const apps = {
:name="app.isFavorite ? 'star' : 'star-o'"
:class="['favorite-icon', app.isFavorite ? 'active' : '']"
@click.stop="toggleFavorite(app.id)"
/>
></van-icon>
</div>
</div>
</div>
<!-- 空状态 -->
<van-empty v-else description="暂无应用"></van-empty>
</template>
</van-tree-select>
</div>
</div>
<!-- 应用菜单弹框 -->
<van-popup v-model="showMenuPopup" position="bottom" :style="{ width: '100%', maxHeight: '60%' }" round>
<div class="menu-popup">
<div class="popup-header">
<div class="popup-title">{{ currentApp.name }}</div>
<van-icon name="cross" @click="showMenuPopup = false" class="close-icon"></van-icon>
</div>
<div class="menu-grid">
<div
v-for="menu in currentMenus"
:key="menu.id"
class="grid-item"
@click="navigateToMenu(menu)"
>
<div class="grid-icon">
<van-icon :name="menu.icon || 'apps-o'" size="24"></van-icon>
</div>
<div class="grid-name">{{ menu.name }}</div>
<div class="grid-desc" v-if="menu.aliasName">{{ menu.aliasName }}</div>
</div>
</div>
</div>
</van-popup>
</div>
`,
data() {
@@ -67,9 +102,9 @@ const apps = {
applications: [],
// 固定分类列表
categories: [
{id: "all", name: "全部应用", icon: "apps-o"},
{id: "favorites", name: "我的收藏", icon: "star-o"},
{id: "recommended", name: "推荐应用", icon: "like-o"}
{id: "all", name: "全部应用", icon: "fa fa-th-large"},
{id: "favorites", name: "我的收藏", icon: "fa fa-star-o"},
{id: "recommended", name: "推荐应用", icon: "fa fa-thumbs-o-up"}
],
// 动态加载的分类
dynamicCategories: [],
@@ -78,7 +113,11 @@ const apps = {
// 搜索关键词
searchKeyword: "",
// 列表相关
loading: true
loading: true,
// 弹框相关
showMenuPopup: false,
currentApp: {},
currentMenus: []
}
},
computed: {
@@ -90,13 +129,7 @@ const apps = {
currentCategoryId() {
return this.allCategories[this.activeTab]?.id || "all"
},
// TreeSelect组件所需的数据格式
treeSelectItems() {
return this.allCategories.map(category => ({
text: category.name,
className: 'category-item'
}))
}
},
mounted() {
// 页面加载时获取分类和应用数据
@@ -106,17 +139,13 @@ const apps = {
methods: {
// 加载分类数据
loadCategories() {
$.get("/platform/v4/apps/categories", {platform: "H5"})
.then((result) => {
if (result.code === 0) {
this.dynamicCategories = result.data || []
} else {
console.error("获取应用分类失败:", result.msg)
}
})
.fail((error) => {
console.error("获取应用分类异常:", error)
})
this.$axios.post("/platform/v4/apps/categories", {platform: "H5"}).then((res) => {
if (res.code === 0) {
this.dynamicCategories = res.data || []
} else {
console.error("获取应用分类失败:", res.msg)
}
})
},
// 加载应用数据
@@ -147,24 +176,19 @@ const apps = {
// 如果是"推荐应用"分类
if (this.currentCategoryId === "recommended") {
$.get("/platform/v4/apps/recommended")
.then((result) => {
if (result.code === 0) {
this.applications = result.data.list || []
} else {
console.error("获取推荐应用失败:", result.msg)
}
this.loading = false
})
.fail((error) => {
console.error("获取推荐应用异常:", error)
this.loading = false
})
this.$axios.post("/platform/v4/apps/recommended").then((result) => {
if (result.code === 0) {
this.applications = result.data.list || []
} else {
console.error("获取推荐应用失败:", result.msg)
}
this.loading = false
})
return
}
// 发送请求获取普通应用列表
$.get("/platform/v4/apps/list?" + queryString)
this.$axios.post("/platform/v4/apps/list?" + queryString)
.then((result) => {
if (result.code === 0) {
this.applications = result.data || []
@@ -173,15 +197,11 @@ const apps = {
}
this.loading = false
})
.fail((error) => {
console.error("获取应用列表异常:", error)
this.loading = false
})
},
// 加载收藏的应用
loadFavorites() {
$.get("/platform/v4/apps/favorite")
this.$axios.post("/platform/v4/apps/favorite")
.then((result) => {
if (result.code === 0) {
this.applications = result.data || []
@@ -190,10 +210,6 @@ const apps = {
}
this.loading = false
})
.fail((error) => {
console.error("获取收藏应用异常:", error)
this.loading = false
})
},
// 切换应用收藏状态
@@ -239,10 +255,48 @@ const apps = {
// 打开应用
openApp(app) {
// 储存到缓存
window.sessionStorage.setItem("zhgh_sub_app", JSON.stringify(app))
// 新标签页打开
window.open("/platform/v4/subApp?appId=" + app.id, "_blank")
this.$axios.post("/platform/sys/user/subAppMenus", {appId: app.id}).then((res) => {
if (res.code === 0) {
this.showAppMenus(app, res.data)
}
})
},
// 显示应用菜单弹框
showAppMenus(app, menus) {
if (!menus || menus.length === 0) {
this.$toast('该应用暂无可用功能')
return
}
// 如果只有一个菜单项,直接跳转
if (menus.length === 1) {
this.navigateToMenu(menus[0])
return
}
// 多个菜单项时显示popup弹框
this.currentApp = app
this.currentMenus = menus
this.showMenuPopup = true
},
// 导航到菜单
navigateToMenu(menu) {
// 关闭弹框
this.showMenuPopup = false
if (menu.href) {
// 如果是H5平台,直接跳转
if (menu.platform === 'H5') {
window.location.href = menu.href
} else {
// 其他平台可能需要特殊处理
window.open(menu.href, '_blank')
}
} else {
this.$toast('该功能暂不可用')
}
}
},
style: /*language=CSS*/ `
@@ -252,20 +306,81 @@ const apps = {
height: 100%;
}
.van-tree-select {
height: calc(100vh - 150px) !important;
/* 自定义树形选择组件样式 */
.custom-tree-select {
display: flex;
height: calc(100vh - 150px);
background: #fff;
}
.van-tree-select__nav {
.tree-nav {
flex: 0 0 90px;
background: #f7f8fa;
border-right: 1px solid #ebedf0;
overflow-y: auto;
}
.van-tree-select__content {
padding: 0;
.nav-item {
position: relative;
padding: 12px 8px;
cursor: pointer;
transition: all 0.2s ease;
border-bottom: 1px solid #ebedf0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.category-item {
font-size: 14px;
.nav-item:hover {
background: #f2f3f5;
}
.nav-item.active {
background: #fff;
color: var(--color-primary);
}
.nav-item.active::before {
content: '';
position: absolute;
left: 0;
top: 0;
bottom: 0;
width: 3px;
background: #1989fa;
}
.nav-icon {
font-size: 18px;
margin-bottom: 6px;
color: inherit;
}
.nav-text {
font-size: 12px;
font-weight: 500;
text-align: center;
line-height: 1.2;
word-break: break-all;
}
.nav-indicator {
position: absolute;
right: 0;
top: 50%;
transform: translateY(-50%);
width: 0;
height: 0;
border-left: 6px solid #1989fa;
border-top: 6px solid transparent;
border-bottom: 6px solid transparent;
}
.tree-content {
flex: 1;
overflow-y: auto;
background: #fff;
}
.app-list {
@@ -327,5 +442,107 @@ const apps = {
padding: 20px 0;
text-align: center;
}
/* 菜单弹框样式 */
::v-deep .menu-popup {
height: 100%;
display: flex;
flex-direction: column;
border-radius: 8px;
overflow: hidden;
}
::v-deep .popup-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 16px 20px;
border-bottom: 1px solid #ebedf0;
background: #fff;
}
::v-deep .popup-title {
font-size: 16px;
font-weight: 500;
color: #323233;
}
::v-deep .close-icon {
font-size: 18px;
color: #969799;
cursor: pointer;
}
::v-deep .menu-grid {
flex: 1;
overflow-y: auto;
display: grid;
grid-template-columns: repeat(3, 1fr);
}
::v-deep .grid-item {
display: flex;
flex-direction: column;
align-items: center;
padding: 20px 12px;
background: #fff;
cursor: pointer;
transition: all 0.2s ease;
min-width: 0;
}
::v-deep .grid-item:active {
transform: scale(0.95);
background: #f2f3f5;
}
::v-deep .grid-icon {
width: 48px;
height: 48px;
border-radius: 12px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 12px;
color: #fff;
}
::v-deep .grid-name {
font-size: 14px;
font-weight: 500;
color: #323233;
text-align: center;
margin-bottom: 4px;
line-height: 1.2;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 100%;
min-width: 0;
}
::v-deep .grid-desc {
font-size: 12px;
color: #969799;
text-align: center;
line-height: 1.2;
}
::v-deep .menu-name {
font-size: 16px;
color: #323233;
margin-bottom: 4px;
}
::v-deep .menu-desc {
font-size: 12px;
color: #969799;
}
::v-deep .menu-arrow {
font-size: 16px;
color: #c8c9cc;
}
`
}