From 00239519ba9c0561ce7e3490e5cff27b68b5e077 Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Fri, 17 Mar 2023 11:38:02 +0800
Subject: [PATCH] 添加开始页和结束页判断
---
src/views/modules/function.vue | 55 +++++++++++++++++++++++++++++++++++++++----------------
1 files changed, 39 insertions(+), 16 deletions(-)
diff --git a/src/views/modules/function.vue b/src/views/modules/function.vue
index 4ebc722..125ffe7 100644
--- a/src/views/modules/function.vue
+++ b/src/views/modules/function.vue
@@ -24,7 +24,8 @@
<div class="func">
<!--列表展示-->
<div class="list">
- <el-tree v-if="funList.length >0" :data="funList" :props="defaultProps" node-key="id" @node-click="handleNodeClick">
+ <el-tree v-if="funList.length >0" :data="funList" :props="defaultProps" node-key="id"
+ @node-click="handleNodeClick">
<span class="custom-tree-node" slot-scope="{ node, data }">
<span>{{ data.name }}</span>
<span>
@@ -54,9 +55,9 @@
</div>
</div>
<!--内容页-->
- <div style="height: 100%;width: 100%" v-if="content.property == 2">
+ <div style="height: 100%;width: 100%" v-if="content.property == 2">
- <div style="height: 100%;width: 100%" class="manage" v-if="modelType=='管理'">
+ <div style="height: 100%;width: 100%" class="manage" v-if="modelType=='管理'">
<!--flash-->
<div v-if="content.type == 1">
<avue-form :option="flashOption" v-model="flashForm" @submit="handleSubmitFile"></avue-form>
@@ -73,23 +74,27 @@
</div>
</div>
- <div style="height: 100%;width: 100%" class="view" v-else>
+ <div style="height: 100%;width: 100%" class="view" v-if="modelType == '预览'">
<!--flash-->
- <div v-if="content.type == 1">
+ <div v-if="content.type == 1">
</div>
<!--图册-->
- <div style="height: 100%;width: 100%" v-if="content.type == 2">
- <Flipbook class="flipbook" :pages="flipConfig.pages" :startPage="flipConfig.pageNum" v-slot="flipbook" ref="flipbook">
+ <div style="height: 100%;width: 100%" v-if="content.type == 2">
+ <flipbook class="flipbook" :pages="flipConfig.pages" :startPage="flipConfig.pageNum" v-slot="flipbook"
+ ref="flipbook">
<div class="action-bar">
- <left-icon class="btn left" :class="{ disabled: !flipbook.canFlipLeft }" @click="flipbook.flipLeft"/>
+ <left-icon class="btn left" :class="{ disabled: !flipbook.canFlipLeft }"
+ @click="flipbook.flipLeft"/>
<plus-icon class="btn plus" :class="{ disabled: !flipbook.canZoomIn }" @click="flipbook.zoomIn"/>
<span class="page-num">Page {{ flipbook.page }} of {{ flipbook.numPages }}</span>
- <minus-icon class="btn minus" :class="{ disabled: !flipbook.canZoomOut }" @click="flipbook.zoomOut"/>
- <right-icon class="btn right" :class="{ disabled: !flipbook.canFlipRight }" @click="flipbook.flipRight"/>
+ <minus-icon class="btn minus" :class="{ disabled: !flipbook.canZoomOut }"
+ @click="flipbook.zoomOut"/>
+ <right-icon class="btn right" :class="{ disabled: !flipbook.canFlipRight }"
+ @click="flipbook.flipRight"/>
</div>
- </Flipbook>
+ </flipbook>
</div>
<!--视频-->
@@ -228,7 +233,7 @@
type: 'upload',
limit: 1,
drag: true,
- loadText: '模板上传中,请稍等',
+ loadText: '文件上传中,请稍等',
accept: 'image/png, image/jpeg',
propsHttp: {
res: 'data',
@@ -355,7 +360,7 @@
label: 'name'
},
content: {},
- modelType:'管理',
+ modelType: '管理',
flipConfig: {
pages: [],
@@ -363,7 +368,7 @@
hasMouse: true,
pageNum: null,
},
- iframePath:"",
+ iframePath: "",
}
},
watch: {
@@ -410,6 +415,24 @@
},
handleSubmit(form, done) {
form.modulesId = this.modules.id
+ //限制只能有一个开始页和结束页
+ if (form.property == 1 || form.property == 3) {
+ let data = this.funList
+ let filterArray = data.filter(e => {
+ return e.property == form.property
+ })
+ if (filterArray.length > 0) {
+ if (form.property == 1) {
+ this.$message.warning("开始页已存在")
+ done()
+ return
+ } else if (form.property == 3) {
+ this.$message.warning("结束页已存在")
+ done()
+ return
+ }
+ }
+ }
if (!form.id) {
add(form).then(() => {
this.getAllFunc()
@@ -542,7 +565,7 @@
left: 42%;
}
-.model-type{
+.model-type {
display: flex;
justify-content: flex-end;
}
@@ -558,7 +581,7 @@
height: 100vh;
}
-.page-num{
+.page-num {
color: white;
}
--
Gitblit v1.9.3