diff --git a/src/assets/img/info-bg1.png b/src/assets/img/info-bg1.png index fcc91d9..7ef01ad 100644 Binary files a/src/assets/img/info-bg1.png and b/src/assets/img/info-bg1.png differ diff --git a/src/assets/img/info-bg2.png b/src/assets/img/info-bg2.png index f03f1df..e0bdb46 100644 Binary files a/src/assets/img/info-bg2.png and b/src/assets/img/info-bg2.png differ diff --git a/src/components/breadcrumb/index.vue b/src/components/breadcrumb/index.vue index 3cb746e..6b86a61 100644 --- a/src/components/breadcrumb/index.vue +++ b/src/components/breadcrumb/index.vue @@ -2,12 +2,19 @@ <!-- 面包屑 --> <div class="breadcrumb"> <el-breadcrumb separator=">"> - <el-breadcrumb-item - v-for="(item, index) in pages" - :key="index" - :to="{ path: index == pages.length - 1 ? '.' : route }"> - {{item}} - </el-breadcrumb-item> + <template v-for="(item, index) in pages"> + <el-breadcrumb-item + v-if="index != pages.length - 1" + :key="index" + :to="{ path: route }"> + {{item}} + </el-breadcrumb-item> + <el-breadcrumb-item + v-else + :key="index"> + {{item}} + </el-breadcrumb-item> + </template> </el-breadcrumb> </div> </template> diff --git a/src/components/quill/index.vue b/src/components/quill/index.vue index 6806bc1..6d19589 100644 --- a/src/components/quill/index.vue +++ b/src/components/quill/index.vue @@ -1,15 +1,22 @@ <template> - <div class="quill" :class="classes"> + <div class="quill" ref="quill" :class="classes"> <div ref="editor" :style="styles" v-loading="loading"></div> - <el-upload :action="this.api.fileupload" :before-upload="beforeUpload" :on-success="editorUploadSuccess" - style="display: none"> - <el-button class="editorUpload" size="small" type="primary">点击上传</el-button> + <el-upload + :headers="headers" + :action="this.api.fileupload" + :before-upload="beforeUpload" + :on-success="editorUploadSuccess" + style="display: none" + > + <el-button class="editorUpload" type="primary">点击上传</el-button> </el-upload> </div> </template> <script> +import util from "@/libs/util"; +import Setting from "@/setting"; import Quill from "quill"; import "quill/dist/quill.core.css"; import "quill/dist/quill.snow.css"; @@ -40,10 +47,20 @@ export default { }, minHeight: { type: Number + }, + /* + * 原本的readOnly失效,对比其他项目,发现是quill版本不同导致, + * 使用props传入elseRead = 'true',手动隐藏工具栏 + */ + elseRead: { + type: String, default: "false" } }, data() { return { + headers: { + token: util.local.get(Setting.tokenKey) + }, Quill: null, currentValue: "", options: { @@ -89,6 +106,7 @@ export default { } return style; } + }, watch: { value: { @@ -103,47 +121,84 @@ export default { immediate: true } }, + created() { + }, mounted() { this.init(); + // 处理工具栏隐藏样式 + if (this.elseRead === "true") { + let children = this.$refs.quill.children[0].style; + children.padding = "0"; + children.overflow = "hidden"; + children.height = "0"; + children.borderTop = "0"; + } }, beforeDestroy() { // 在组件销毁后销毁实例 this.Quill = null; }, methods: { - init() { + init () { const editor = this.$refs.editor; // 初始化编辑器 this.Quill = new Quill(editor, this.options); + const ins = this.Quill // 默认值 - this.Quill.pasteHTML(this.currentValue); - if (this.toTop) { + ins.pasteHTML(this.currentValue); + if(this.toTop){ this.$nextTick(() => { - window.scrollTo(0, 0); - }); + window.scrollTo(0,0) + }) } // 绑定事件 - this.Quill.on("text-change", (delta, oldDelta, source) => { + ins.on('text-change', (delta, oldDelta, source) => { const html = this.$refs.editor.children[0].innerHTML; - const text = this.Quill.getText(); + const text = ins.getText(); const quill = this.Quill; // 更新内部的值 this.currentValue = html; // 发出事件 v-model - this.$emit("input", html); + this.$emit('input', html); // 发出事件 - this.$emit("on-change", { html, text, quill }); + this.$emit('on-change', { html, text, quill }); }); // 将一些 quill 自带的事件传递出去 - this.Quill.on("text-change", (delta, oldDelta, source) => { - this.$emit("on-text-change", delta, oldDelta, source); + ins.on('text-change', (delta, oldDelta, source) => { + this.$emit('on-text-change', delta, oldDelta, source); }); - this.Quill.on("selection-change", (range, oldRange, source) => { - this.$emit("on-selection-change", range, oldRange, source); + ins.on('selection-change', (range, oldRange, source) => { + this.$emit('on-selection-change', range, oldRange, source); }); - this.Quill.on("editor-change", (eventName, ...args) => { - this.$emit("on-editor-change", eventName, ...args); + ins.on('editor-change', (eventName, ...args) => { + this.$emit('on-editor-change', eventName, ...args); }); + // 监听粘贴事件 + ins.root.addEventListener('paste', evt => { + if (evt.clipboardData && evt.clipboardData.files && evt.clipboardData.files.length) { + evt.preventDefault(); + // 检测是否粘贴的是图片 + [].forEach.call(evt.clipboardData.files, file => { + if (!file.type.match(/^image\/(gif|jpe?g|a?png|bmp)/i)) { + return + } + const param = new FormData() + param.append('file', file) + // 把图片上传到服务器,不然会直接把base64存到数据库 + this.$post(this.api.fileupload, param, { + headers: { "Content-Type": "multipart/form-data" } + }).then(res => { + var range = ins.getSelection() + if (range) { + // 在当前光标位置插入图片 + ins.insertEmbed(range.index, 'image', res.data.filesResult.fileUrl) + // 将光标移动到图片后面 + ins.setSelection(range.index + 1) + } + }).catch(res => {}) + }); + } + }, false) }, beforeUpload(file) { this.loading = true; @@ -160,7 +215,7 @@ export default { // 调整光标到最后 quill.setSelection(length + 1); } else { - this.$message.success("图片插入失败"); + util.successMsg("图片插入失败"); } this.loading = false; } @@ -178,4 +233,23 @@ export default { border: none; } } + +.else { + .ql-toolbar.ql-snow { + height: 0; + overflow: hidden; + padding: 0; + border-top: 0; + } +} +/deep/.ql-snow { + position: relative; + .ql-tooltip { + position: absolute !important; + top: 10px !important; + left: 10px !important; + transform: translateY(10px); + } +} + </style> diff --git a/src/layouts/header/index.vue b/src/layouts/header/index.vue index 79876fc..a2fc7eb 100644 --- a/src/layouts/header/index.vue +++ b/src/layouts/header/index.vue @@ -1,14 +1,14 @@ <template> <div class="header"> <a class="logo" @click="toIndex"> - <template v-if="token"> + <img v-if="isIndex" src="@/assets/img/logo.png" alt=""> + <template v-else> <img :src="logoUrl" width="50" height="50" /> <span class="title">{{title}}</span> </template> - <img v-else src="@/assets/img/logo.png" alt=""> </a> <div class="inner"> - <navbar ref="nav" style="height: 64px;"></navbar> + <navbar class="nav-wrap" ref="nav"></navbar> <div class="user-wrap"> <template v-if="token"> <div class="user" @click="toPersonal"> @@ -34,7 +34,8 @@ import navbar from "../navbar"; export default { data() { return { - token: util.local.get(Setting.tokenKey) + token: util.local.get(Setting.tokenKey), + isIndex: Setting.whiteList.find(e => e === this.$route.path) // 是否是在白名单页面 }; }, components: { @@ -74,7 +75,9 @@ export default { this.$router.push("/setting/person"); }, toIndex() { - this.$router.push('/index') + this.$refs.nav.jump({ + index: this.isIndex ? '/index/list' : '/station/list' + }) } } }; @@ -115,6 +118,9 @@ $height: 64px; font-size: 18px; font-weight: bold; } + .nav-wrap { + height: 64px; + } .user-wrap { display: inline-flex; align-items: center; @@ -154,4 +160,14 @@ $height: 64px; } } } +@media (max-width: 1430px) { + .header { + .inner { + padding-right: 20px; + } + .logo { + left: 40px; + } + } +} </style> diff --git a/src/layouts/navbar/index.vue b/src/layouts/navbar/index.vue index 55c245d..40417e1 100644 --- a/src/layouts/navbar/index.vue +++ b/src/layouts/navbar/index.vue @@ -49,7 +49,7 @@ export default { touristMenu: [ { index: "/index/list", - title: "实验台" + title: "首页" }, { index: "/cityPartner/list", @@ -103,4 +103,9 @@ export default { } } } +@media (max-width: 1430px) { + .nav { + left: 200px; + } +} </style> \ No newline at end of file diff --git a/src/pages/account/login/index.vue b/src/pages/account/login/index.vue index b9ec107..7a21783 100644 --- a/src/pages/account/login/index.vue +++ b/src/pages/account/login/index.vue @@ -435,7 +435,7 @@ export default { &:hover img { opacity: .9; } - &.active span { + &.active p { background-color: #9278ff; } } diff --git a/src/pages/cityPartner/list/index.vue b/src/pages/cityPartner/list/index.vue index ac4835f..ffe48ff 100644 --- a/src/pages/cityPartner/list/index.vue +++ b/src/pages/cityPartner/list/index.vue @@ -125,8 +125,8 @@ export default { position: relative; background-color: #fff; .banner { - height: 420px; - padding: 140px 0 0 180px; + height: 350px; + padding: 100px 0 0 180px; background: url(../../../assets/img/city/banner2.png) top right/auto no-repeat, url(../../../assets/img/city/banner1.png) 0 0/100% 100% no-repeat; h6 { diff --git a/src/pages/course/list/index.vue b/src/pages/course/list/index.vue index 3da379a..b006452 100644 --- a/src/pages/course/list/index.vue +++ b/src/pages/course/list/index.vue @@ -9,7 +9,7 @@ </div> <!-- 课程筛选 --> <div class="filter"> - <div class="wrap-inner"> + <div class="wrap-inner" style="padding-bottom: 0"> <dl> <dt>课程分类:</dt> <dd v-for="(item, index) in classificationList" :key="index" :class="{active: classificationId == item.id}" @click="changeType(item.id)">{{ item.name }}</dd> @@ -130,12 +130,12 @@ export default { <style lang="scss" scoped> .search { position: relative; - padding: 121px 0 167px; + padding: 100px 0 130px; text-align: center; background: url(../../../assets/img/course-bg.png) 0 0/100% 100% no-repeat; h6 { margin-bottom: 25px; - font-size: 32px; + font-size: 26px; color: #fff; } .input { @@ -163,7 +163,6 @@ export default { .wrap { .filter { width: 100%; - margin-bottom: 10px; background-color: #fff; dl { display: flex; @@ -185,6 +184,7 @@ export default { } } .courses { + padding-top: 10px; ul { display: flex; flex-wrap: wrap; diff --git a/src/pages/devPlatform/list/index.vue b/src/pages/devPlatform/list/index.vue index 44a92db..a4bf94c 100644 --- a/src/pages/devPlatform/list/index.vue +++ b/src/pages/devPlatform/list/index.vue @@ -85,8 +85,8 @@ export default { position: relative; background-color: #fff; .banner { - height: 420px; - padding: 140px 0 0 180px; + height: 350px; + padding: 100px 0 0 180px; background: url(../../../assets/img/dev/banner2.png) (90% 32px)/auto no-repeat, url(../../../assets/img/dev/banner1.png) 0 0/100% 100% no-repeat; h6 { diff --git a/src/pages/index/list/index.vue b/src/pages/index/list/index.vue index 1390b44..4d67209 100644 --- a/src/pages/index/list/index.vue +++ b/src/pages/index/list/index.vue @@ -1,7 +1,7 @@ <template> <div class="wrap index"> <div class="banner"> - <el-carousel height="420px" :autoplay="false"> + <el-carousel height="350px" :autoplay="false"> <el-carousel-item> <div class="bg banner-bg1"></div> <img class="text" src="@/assets/img/index/banner1-text.png" alt=""> diff --git a/src/pages/info/list/index.vue b/src/pages/info/list/index.vue index 1821f10..0d93357 100644 --- a/src/pages/info/list/index.vue +++ b/src/pages/info/list/index.vue @@ -191,14 +191,15 @@ export default { <style lang="scss" scoped> .wrap { .banner { - height: 420px; - padding: 140px 0 0 180px; + height: 350px; + padding: 100px 0 0 180px; background: url(../../../assets/img/info-bg.png) 0 0/100% 100% no-repeat; } } .main{ - background: url(../../../assets/img/info-bg1.png) (0px 179px)/auto auto no-repeat, - url(../../../assets/img/info-bg2.png) (bottom right)/auto auto no-repeat; + min-height: calc(100vh - 524px); + background: url(../../../assets/img/info-bg1.png) (0px 179px)/(190px 171px) no-repeat, + url(../../../assets/img/info-bg2.png) (bottom right)/(407px 273px) no-repeat; .center-wrap { display: flex; justify-content: center; diff --git a/src/pages/match/details/index.vue b/src/pages/match/details/index.vue index b91f666..f12c1ed 100644 --- a/src/pages/match/details/index.vue +++ b/src/pages/match/details/index.vue @@ -103,8 +103,8 @@ export default { <style lang="scss" scoped> .banner{ width: 100%; - height: 400px; - background-size: 100vw 400px; + height: 350px; + background-size: 100vw 350px; background-repeat: no-repeat; } .main .center-wrap { diff --git a/src/pages/match/list/index.vue b/src/pages/match/list/index.vue index a4f4a62..89af3a2 100644 --- a/src/pages/match/list/index.vue +++ b/src/pages/match/list/index.vue @@ -329,14 +329,14 @@ export default { <style lang="scss" scoped> .search { position: relative; - padding: 121px 0 167px; + padding: 100px 0 130px; text-align: center; background: url(../../../assets/img/match-bg4.png) (72px 180px)/auto no-repeat, url(../../../assets/img/match-bg5.png) (90% 172px)/auto no-repeat, url(../../../assets/img/match-bg3.png) 0 0/100% 100% no-repeat; h6 { margin-bottom: 25px; - font-size: 32px; + font-size: 26px; color: #fff; } .input { diff --git a/src/pages/record/list/index.vue b/src/pages/record/list/index.vue index 9b6a663..7652433 100644 --- a/src/pages/record/list/index.vue +++ b/src/pages/record/list/index.vue @@ -152,6 +152,10 @@ export default { </script> <style lang="scss" scoped> +.main .view { + width: 1280px; + padding: 12px 0 20px; +} .block { padding: 16px; margin-bottom: 20px; @@ -176,7 +180,7 @@ export default { } .item { flex: 1; - padding: 26px 27px; + padding: 27px; margin-right: 19px; background-size: 100% 100%; background-repeat: no-repeat; diff --git a/src/pages/record/show/index.vue b/src/pages/record/show/index.vue index ccbe456..a2853e7 100644 --- a/src/pages/record/show/index.vue +++ b/src/pages/record/show/index.vue @@ -130,8 +130,10 @@ <img src="@/assets/img/report5.png" alt=""> 实验总结与体会 </h6> - <el-input v-if="editing" type="textarea" v-model="form.summarize"></el-input> + <quill v-if="editing" :border="true" v-model="form.summarize" :minHeight="150" :height="150" /> <div v-else class="pre-wrap" v-html="form.summarize"></div> + <!-- <el-input v-if="editing" type="textarea" v-model="form.summarize"></el-input> + <div v-else class="pre-wrap" v-html="form.summarize"></div> --> </div> </div> </div> @@ -144,7 +146,7 @@ import html2Canvas from "html2canvas"; import JsPDF from "jspdf"; import util from "@/libs/util"; import breadcrumb from '@/components/breadcrumb' - +import quill from "@/components/quill"; export default { data() { return { @@ -166,7 +168,8 @@ export default { }; }, components: { - breadcrumb + breadcrumb, + quill }, mounted() { this.getData(); diff --git a/src/pages/station/list/index.vue b/src/pages/station/list/index.vue index 6c36868..9ed434c 100644 --- a/src/pages/station/list/index.vue +++ b/src/pages/station/list/index.vue @@ -50,12 +50,12 @@ export default { <style lang="scss" scoped> .search { position: relative; - padding: 121px 0 167px; + padding: 100px 0 130px; text-align: center; background: url(../../../assets/img/station-bg.png) 0 0/100% 100% no-repeat; h6 { margin-bottom: 25px; - font-size: 32px; + font-size: 26px; color: #fff; } .input { diff --git a/src/pages/station/preview/index.vue b/src/pages/station/preview/index.vue index 013a3c1..1cd6b4c 100644 --- a/src/pages/station/preview/index.vue +++ b/src/pages/station/preview/index.vue @@ -330,6 +330,7 @@ $height: 700px; } .cover{ flex: 1; + background-color: #252528; img{ border-radius: 8px; } diff --git a/src/plugins/requests/index.js b/src/plugins/requests/index.js index 015d1a8..4258f15 100644 --- a/src/plugins/requests/index.js +++ b/src/plugins/requests/index.js @@ -1,6 +1,6 @@ import axios from "axios"; import util from "@/libs/util"; -import router from "@/router/index"; +import router from "@/router"; import Setting from "@/setting"; const service = axios.create({ @@ -21,7 +21,7 @@ service.interceptors.request.use(config => { util.errorMsg({ message: "退出登陆", onClose: function() { - router.push({ name: "/index" }); + router.push({ name: "/login" }); } }); return Promise.reject(err); @@ -54,7 +54,7 @@ service.interceptors.response.use( util.errorMsg("登录过期,请重新登录"); setTimeout(() => { router.replace({ - path: "/index" + path: "/login" }); }, 1000); break; @@ -74,7 +74,7 @@ service.interceptors.response.use( // 跳转登录页面,并将要浏览的页面fullPath传过去,登录成功后跳转需要访问的页面 setTimeout(() => { router.replace({ - path: "/index" + path: "/login" }); }, 1000); break; diff --git a/src/router/permission.js b/src/router/permission.js index aa85ef4..32e4f92 100644 --- a/src/router/permission.js +++ b/src/router/permission.js @@ -7,7 +7,7 @@ router.beforeEach((to, from, next) => { document.title = Setting.titleSuffix; const role = util.local.get(Setting.tokenKey); if (!role && !whiteList.includes(to.path)) { - next('/index/list') + next('/login') } else if(role && to.path === '/login') { next('/station') } else {