yujialong 1 year ago
parent d40a254096
commit 4544cb7d95
  1. 31
      package-lock.json
  2. 2
      package.json
  3. 113
      src/components/quill/index.vue
  4. 13
      src/pages/product/list/index.vue
  5. 58
      src/pages/product/show/index.vue
  6. 2
      src/setting.js

31
package-lock.json generated

@ -3435,6 +3435,11 @@
"integrity": "sha512-MsCAG1z9lPdoO/IUMLSBWBSVxVtJ1395VGIQ+Fc2gNdkQ1hNDnQdw3YhA71WJCBW1vdwA0cAnk/DnW6bqoEUYg==", "integrity": "sha512-MsCAG1z9lPdoO/IUMLSBWBSVxVtJ1395VGIQ+Fc2gNdkQ1hNDnQdw3YhA71WJCBW1vdwA0cAnk/DnW6bqoEUYg==",
"dev": true "dev": true
}, },
"cssfilter": {
"version": "0.0.10",
"resolved": "https://registry.npmjs.org/cssfilter/-/cssfilter-0.0.10.tgz",
"integrity": "sha512-FAaLDaplstoRsDR8XGYH51znUN0UY7nMc6Z9/fvE8EXGwvJE9hu7W2vHwx1+bd6gCYnln9nLbzxFTrcO9YQDZw=="
},
"cssnano": { "cssnano": {
"version": "4.1.10", "version": "4.1.10",
"resolved": "https://registry.npmjs.org/cssnano/-/cssnano-4.1.10.tgz", "resolved": "https://registry.npmjs.org/cssnano/-/cssnano-4.1.10.tgz",
@ -6592,12 +6597,8 @@
"highlight.js": { "highlight.js": {
"version": "9.16.2", "version": "9.16.2",
"resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-9.16.2.tgz", "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-9.16.2.tgz",
"integrity": "sha512-feMUrVLZvjy0oC7FVJQcSQRqbBq9kwqnYE4+Kj9ZjbHh3g+BisiPgF49NyQbVLNdrL/qqZr3Ca9yOKwgn2i/tw==" "integrity": "sha512-feMUrVLZvjy0oC7FVJQcSQRqbBq9kwqnYE4+Kj9ZjbHh3g+BisiPgF49NyQbVLNdrL/qqZr3Ca9yOKwgn2i/tw==",
}, "dev": true
"highlight.js-async-webpack": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/highlight.js-async-webpack/-/highlight.js-async-webpack-1.0.4.tgz",
"integrity": "sha1-wGtnv5nwSQRdYrdW5YVbCRLsYWw="
}, },
"hmac-drbg": { "hmac-drbg": {
"version": "1.0.1", "version": "1.0.1",
@ -7993,12 +7994,11 @@
} }
}, },
"mavon-editor": { "mavon-editor": {
"version": "2.7.7", "version": "2.10.4",
"resolved": "https://registry.npmjs.org/mavon-editor/-/mavon-editor-2.7.7.tgz", "resolved": "https://registry.npmjs.org/mavon-editor/-/mavon-editor-2.10.4.tgz",
"integrity": "sha512-lXnYe+dztKepbv8bi2nedRqG/AwyUDF8gmkv9lHD3fpVJ1+pzAS6YILRIryKCvO9qPIOPEThHsda2DxtlzRsZA==", "integrity": "sha512-CFsBLkgt/KZBDg+SJYe2fyYv4zClY149PiwpH0rDAiiP4ae1XNs0GC8nBsoTeipsHcebDLN1QMkt3bUsnMDjQw==",
"requires": { "requires": {
"highlight.js": "^9.11.0", "xss": "^1.0.6"
"highlight.js-async-webpack": "^1.0.4"
} }
}, },
"md5.js": { "md5.js": {
@ -13304,6 +13304,15 @@
"async-limiter": "~1.0.0" "async-limiter": "~1.0.0"
} }
}, },
"xss": {
"version": "1.0.14",
"resolved": "https://registry.npmjs.org/xss/-/xss-1.0.14.tgz",
"integrity": "sha512-og7TEJhXvn1a7kzZGQ7ETjdQVS2UfZyTlsEdDOqvQF7GoxNfY+0YLCzBy1kPdsDDx4QuNAonQPddpsn6Xl/7sw==",
"requires": {
"commander": "^2.20.3",
"cssfilter": "0.0.10"
}
},
"xtend": { "xtend": {
"version": "4.0.2", "version": "4.0.2",
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",

@ -15,7 +15,7 @@
"element-theme": "^2.0.1", "element-theme": "^2.0.1",
"element-ui": "^2.13.0", "element-ui": "^2.13.0",
"js-cookie": "^2.2.1", "js-cookie": "^2.2.1",
"mavon-editor": "^2.6.17", "mavon-editor": "^2.10.4",
"postcss-px2rem": "^0.3.0", "postcss-px2rem": "^0.3.0",
"px2rem-loader": "^0.1.9", "px2rem-loader": "^0.1.9",
"sortablejs": "^1.14.0", "sortablejs": "^1.14.0",

@ -1,17 +1,38 @@
<template> <template>
<div class="quill" ref="quill" :class="classes"> <div>
<div ref="editor" :style="styles" v-loading="loading"></div> <el-radio-group v-if="!readonly"
class="type-radio"
v-model="type"
@change="typeChange">
<el-radio :label="0">富文本</el-radio>
<el-radio :label="1">markdown</el-radio>
</el-radio-group>
<div v-show="!type"
class="quill"
ref="quill"
:class="classes">
<div ref="editor"
:style="styles"
v-loading="loading"></div>
<el-upload <el-upload :headers="headers"
:headers="headers"
:action="this.api.fileupload" :action="this.api.fileupload"
:before-upload="beforeUpload" :before-upload="beforeUpload"
:on-success="editorUploadSuccess" :on-success="editorUploadSuccess"
style="display: none" style="display: none">
> <el-button :id="'editorUpload' + index"
<el-button :id="'editorUpload' + index" type="primary">点击上传</el-button> type="primary">点击上传</el-button>
</el-upload> </el-upload>
</div> </div>
<mavon-editor class="md"
v-model="mdVal"
v-show="type"
ref="md"
:ishljs="true"
:subfield="false"
@change="mdChange"
@imgAdd="imgAdd" />
</div>
</template> </template>
<script> <script>
@ -22,9 +43,15 @@ import "quill/dist/quill.core.css";
import "quill/dist/quill.snow.css"; import "quill/dist/quill.snow.css";
import "quill/dist/quill.bubble.css"; import "quill/dist/quill.bubble.css";
import toolbarOptions from "./options"; import toolbarOptions from "./options";
import axios from 'axios'
import { mavonEditor } from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'
export default { export default {
name: "quill", name: "quill",
components: {
mavonEditor
},
props: { props: {
value: { value: {
type: String, type: String,
@ -61,12 +88,14 @@ export default {
default: 0 default: 0
}, },
}, },
data() { data () {
const that = this const that = this
return { return {
headers: { headers: {
token: util.local.get(Setting.tokenKey) token: util.local.get(Setting.tokenKey)
}, },
type: 0,
mdVal: '',
Quill: null, Quill: null,
currentValue: "", currentValue: "",
options: { options: {
@ -77,7 +106,7 @@ export default {
toolbar: { toolbar: {
container: toolbarOptions, container: toolbarOptions,
handlers: { handlers: {
"image": function(value) { "image": function (value) {
if (value) { if (value) {
// iview // iview
document.querySelector("#editorUpload" + that.index).click(); document.querySelector("#editorUpload" + that.index).click();
@ -95,14 +124,14 @@ export default {
}; };
}, },
computed: { computed: {
classes() { classes () {
return [ return [
{ {
"quill-no-border": !this.border "quill-no-border": !this.border
} }
]; ];
}, },
styles() { styles () {
let style = {}; let style = {};
if (this.minHeight) { if (this.minHeight) {
style.minHeight = `${this.minHeight}px`; style.minHeight = `${this.minHeight}px`;
@ -116,20 +145,23 @@ export default {
}, },
watch: { watch: {
value: { value: {
handler(val) { handler (val) {
if (!this.type) {
if (val !== this.currentValue) { if (val !== this.currentValue) {
this.currentValue = val; this.currentValue = val;
if (this.Quill) { if (this.Quill) {
this.Quill.pasteHTML(this.value); this.Quill.pasteHTML(this.value);
} }
} }
if (!this.mdVal) this.mdVal = val
}
}, },
immediate: true immediate: true
} }
}, },
created() { created () {
}, },
mounted() { mounted () {
this.init(); this.init();
// //
if (this.elseRead === "true") { if (this.elseRead === "true") {
@ -140,11 +172,16 @@ export default {
children.borderTop = "0"; children.borderTop = "0";
} }
}, },
beforeDestroy() { beforeDestroy () {
// //
this.Quill = null; this.Quill = null;
}, },
methods: { methods: {
//
typeChange (val) {
if (!this.mdVal) this.mdVal = this.value
},
init () { init () {
const editor = this.$refs.editor; const editor = this.$refs.editor;
// //
@ -152,9 +189,9 @@ export default {
const ins = this.Quill const ins = this.Quill
// //
ins.pasteHTML(this.currentValue); ins.pasteHTML(this.currentValue);
if(this.toTop){ if (this.toTop) {
this.$nextTick(() => { this.$nextTick(() => {
window.scrollTo(0,0) window.scrollTo(0, 0)
}) })
} }
// //
@ -201,15 +238,16 @@ export default {
// //
ins.setSelection(range.index + 1) ins.setSelection(range.index + 1)
} }
}).catch(res => {}) }).catch(res => { })
}); });
} }
}, false) }, false)
}, },
beforeUpload(file) { beforeUpload (file) {
this.loading = true; this.loading = true;
}, },
editorUploadSuccess(res) { // quill
editorUploadSuccess (res) {
// //
let quill = this.Quill; let quill = this.Quill;
// //
@ -224,11 +262,37 @@ export default {
util.successMsg("图片插入失败"); util.successMsg("图片插入失败");
} }
this.loading = false; this.loading = false;
} },
//
mdChange (val) {
this.$emit('input', val)
},
// markdown
imgAdd (pos, $file) {
let $vm = this.$refs.md
// ..
const formData = new FormData();
formData.append('file', $file);
axios({
url: this.api.fileupload,
method: 'post',
data: formData,
headers: {
token: this.token,
'Content-Type': 'multipart/form-data'
},
}).then((res) => {
$vm.$img2Url(pos, res.data.data.filesResult.fileUrl);
})
},
} }
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.type-radio {
margin-bottom: 20px;
}
.quill-no-border { .quill-no-border {
.ql-toolbar.ql-snow { .ql-toolbar.ql-snow {
border: none; border: none;
@ -257,5 +321,10 @@ export default {
transform: translateY(10px); transform: translateY(10px);
} }
} }
.md {
max-height: 300px;
}
/deep/.v-note-wrapper .v-note-panel {
min-height: 200px;
}
</style> </style>

@ -1,14 +1,13 @@
<template> <template>
<div class="wrap"> <div class="wrap">
<el-carousel :interval="6000" <el-carousel :interval="6000"
:height="carouselHeight"> height="354px">
<template v-for="(item, i) in banners"> <template v-for="(item, i) in banners">
<el-carousel-item :key="i"> <el-carousel-item :key="i">
<div :class="['banner-item', {'cursor-pointer': item.url}]" <div :class="['banner-item', {'cursor-pointer': item.url}]"
@click="openLink(item)"> @click="openLink(item)">
<img :src="item.banner" <img :src="item.banner"
alt="" alt="">
:style="{height: carouselHeight}">
<!-- <img src="https://huoran.oss-cn-shenzhen.aliyuncs.com/20230726/png/1684091617063493632.png" <!-- <img src="https://huoran.oss-cn-shenzhen.aliyuncs.com/20230726/png/1684091617063493632.png"
alt="" alt=""
:style="{height: carouselHeight}"> --> :style="{height: carouselHeight}"> -->
@ -548,7 +547,7 @@ export default {
position: relative; position: relative;
img { img {
width: 100%; width: 100%;
height: 100%; height: 354px;
} }
.texts { .texts {
position: absolute; position: absolute;
@ -559,10 +558,10 @@ export default {
} }
h6 { h6 {
margin-bottom: 25px; margin-bottom: 25px;
font-size: 44px; font-size: 36px;
} }
.sub { .sub {
font-size: 22px; font-size: 24px;
} }
} }
.inner-wrap { .inner-wrap {
@ -749,7 +748,7 @@ export default {
} }
img { img {
width: 100%; width: 100%;
height: 140px; height: 155px;
transition: 0.3s; transition: 0.3s;
} }
.my-school { .my-school {

@ -9,23 +9,19 @@
</el-card> </el-card>
<div class="inner"> <div class="inner">
<div class="top"> <div class="top">
<div class="pics" <el-carousel class="pics"
v-if="form.mall.coverDrawing"> :interval="6000"
<el-image :class="['cover', {full: !form.interfaceDiagrams}]" height="278px"
:src="form.mall.coverDrawing" :arrow="form.pics.length > 1 ? 'hover' : 'never'"
:preview-src-list="form.pics"> :indicator-position="form.pics.length > 1 ? '' : 'none'">
</el-image> <el-carousel-item v-for="(item, i) in form.pics"
<div v-if="form.interfaceDiagrams"
class="interface">
<div class="pic"
v-for="(pic, i) in form.interfaceDiagrams"
:key="i"> :key="i">
<el-image :src="pic" <el-image class="pic"
:src="item"
:preview-src-list="form.pics"> :preview-src-list="form.pics">
</el-image> </el-image>
</div> </el-carousel-item>
</div> </el-carousel>
</div>
<div class="right" <div class="right"
id="fields"> id="fields">
<h6>{{ form.mall.productName }}</h6> <h6>{{ form.mall.productName }}</h6>
@ -224,6 +220,7 @@ export default {
}, },
], ],
form: { form: {
pics: [],
classificationIds: [], classificationIds: [],
mall: { mall: {
coverDrawing: '' coverDrawing: ''
@ -393,33 +390,12 @@ export default {
background-color: #fff; background-color: #fff;
border-radius: 10px; border-radius: 10px;
.pics { .pics {
display: flex; width: 484px;
flex-wrap: wrap;
width: 502px;
margin-right: 20px; margin-right: 20px;
.cover {
width: 370px;
height: 278px;
margin-right: 10px;
border-radius: 8px;
overflow: hidden;
&.full {
width: 100%;
}
}
.pic { .pic {
width: 114px;
height: 86px;
margin-bottom: 10px;
border-radius: 8px;
overflow: hidden;
.el-image {
width: 100%; width: 100%;
height: 100%; height: 100%;
} border-radius: 8px;
&:last-child {
margin-bottom: 0;
}
} }
} }
.right { .right {
@ -494,6 +470,8 @@ export default {
} }
} }
.tab { .tab {
position: sticky;
// top: 120px;
display: inline-flex; display: inline-flex;
margin-left: 10px; margin-left: 10px;
li { li {
@ -521,7 +499,7 @@ export default {
display: flex; display: flex;
margin-top: 20px; margin-top: 20px;
.detail { .detail {
width: 835px; width: calc(100% - 294px);
padding: 20px 24px; padding: 20px 24px;
background-color: #fff; background-color: #fff;
border-radius: 10px; border-radius: 10px;
@ -579,7 +557,7 @@ export default {
} }
} }
.products { .products {
width: 295px; width: 270px;
margin-left: 24px; margin-left: 24px;
& > h6 { & > h6 {
font-size: 14px; font-size: 14px;
@ -598,7 +576,7 @@ export default {
overflow: hidden; overflow: hidden;
img { img {
width: 100%; width: 100%;
height: 140px; height: 155px;
transition: 0.3s; transition: 0.3s;
} }
.my-school { .my-school {

@ -27,7 +27,7 @@ if (isPro) {
host = "http://121.37.12.51/"; // 中台测试服 host = "http://121.37.12.51/"; // 中台测试服
// host = 'https://www.occupationlab.com/' // 正式服 // host = 'https://www.occupationlab.com/' // 正式服
// host = "http://192.168.31.217:9000/"; // 榕 // host = "http://192.168.31.217:9000/"; // 榕
host = 'http://192.168.31.51:9000/'; // 赓 // host = 'http://192.168.31.51:9000/'; // 赓
} }
const Setting = { const Setting = {

Loading…
Cancel
Save