yujialong 4 months ago
parent 3177837409
commit b5e7d41a0f
  1. 2
      public/styles/css/editor.css
  2. 16
      src/components/editor.js
  3. 13
      src/components/modules/module.vue
  4. 45
      src/pages/article/add/editor.js
  5. 18
      src/pages/seo/index.vue
  6. 2
      src/setting.js
  7. 3
      src/styles/common.scss

@ -131,4 +131,4 @@
margin-right: 8px; margin-right: 8px;
background: #1583ff; background: #1583ff;
border-radius: 4px; border-radius: 4px;
} }

@ -2,6 +2,7 @@ import Axios from 'axios'
import Api from '@/api' import Api from '@/api'
import Setting from '@/setting' import Setting from '@/setting'
import Util from '@/libs/util' import Util from '@/libs/util'
import store from '@/store'
export default { export default {
//skin:'oxide-dark', //skin:'oxide-dark',
language: 'zh_CN', language: 'zh_CN',
@ -318,6 +319,7 @@ export default {
// 自定义上传 // 自定义上传
images_upload_handler: function (blobInfo, succFun, failFun) { images_upload_handler: function (blobInfo, succFun, failFun) {
const form = new FormData() const form = new FormData()
console.log(11, form)
form.append('file', blobInfo.blob()), form.append('file', blobInfo.blob()),
Axios({ Axios({
method: 'post', method: 'post',
@ -328,6 +330,13 @@ export default {
token: Util.local.get(Setting.tokenKey) token: Util.local.get(Setting.tokenKey)
}, },
}).then(({ data }) => { }).then(({ data }) => {
if (data.code === 401) {
Util.errorMsg(data.msg)
setTimeout(() => {
store.dispatch('user/logout')
}, 1000)
return false
}
succFun(data.url) succFun(data.url)
}).catch(res => { }) }).catch(res => { })
}, },
@ -358,6 +367,13 @@ export default {
token: Util.local.get(Setting.tokenKey) token: Util.local.get(Setting.tokenKey)
}, },
}).then(({ data }) => { }).then(({ data }) => {
if (data.code === 401) {
Util.errorMsg(data.msg)
setTimeout(() => {
store.dispatch('user/logout')
}, 1000)
return false
}
callback(data.url) callback(data.url)
}).catch(res => { }) }).catch(res => { })
} }

@ -89,6 +89,14 @@
:headers="headers" :action="api.upload"> :headers="headers" :action="api.upload">
<el-button>上传资源</el-button> <el-button>上传资源</el-button>
</el-upload> </el-upload>
<div>
<video v-if="isVideo(data.form.mediaType)" class="preview-media" ref="video" autoplay controls loop>
<source :src="data.form[item.prop]" type="video/mp4">
您的浏览器不支持 video 标签
</video>
<img v-else class="preview-media" :src="data.form[item.prop]" alt="">
</div>
<i v-if="!item.required" class="el-icon-delete del" @click="data.form[item.prop] = ''"></i> <i v-if="!item.required" class="el-icon-delete del" @click="data.form[item.prop] = ''"></i>
</div> </div>
<div v-if="item.type === 'link'" class="flex"> <div v-if="item.type === 'link'" class="flex">
@ -560,4 +568,9 @@ export default {
margin-left: -40px; margin-left: -40px;
} }
} }
.preview-media {
max-width: 100px;
margin-left: 20px;
}
</style> </style>

@ -2,6 +2,8 @@ import Axios from 'axios'
import Api from '@/api' import Api from '@/api'
import Setting from '@/setting' import Setting from '@/setting'
import Util from '@/libs/util' import Util from '@/libs/util'
import store from '@/store'
import { Loading } from 'element-ui'
export default { export default {
//skin:'oxide-dark', //skin:'oxide-dark',
language: 'zh_CN', language: 'zh_CN',
@ -409,6 +411,13 @@ export default {
token: Util.local.get(Setting.tokenKey) token: Util.local.get(Setting.tokenKey)
}, },
}).then(({ data }) => { }).then(({ data }) => {
if (data.code === 401) {
Util.errorMsg(data.msg)
setTimeout(() => {
store.dispatch('user/logout')
}, 1000)
return false
}
succFun(data.url) succFun(data.url)
}).catch(res => { }) }).catch(res => { })
}, },
@ -424,12 +433,26 @@ export default {
if (meta.filetype === 'media') { if (meta.filetype === 'media') {
// 动态创建上传input,并进行模拟点击上传操作,达到本地上传视频效果。 // 动态创建上传input,并进行模拟点击上传操作,达到本地上传视频效果。
let input = document.createElement('input');//创建一个隐藏的input let input = document.createElement('input');//创建一个隐藏的input
input.setAttribute('type', 'file'); input.setAttribute('type', 'file')
input.setAttribute("accept", ".mp4"); input.setAttribute("accept", ".mp4")
input.onchange = function () { input.onchange = function () {
let file = this.files[0]; let file = this.files[0]
let fd = new FormData(); let fd = new FormData()
fd.append("file", file); fd.append("file", file)
// const el = document.createElement('div')
// el.className = 'tinymce-loadel'
// el.style.position = 'absolute'
// el.style.width = '100%'
// el.style.height = '100%'
// document.querySelector('.tox-dialog').appendChild(el)
const load = Loading.service({
lock: true,
text: '正在上传',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
zIndex: 30000,
customClass: 'tinymce-load'
})
Axios({ Axios({
method: 'post', method: 'post',
url: Api.upload, url: Api.upload,
@ -439,8 +462,18 @@ export default {
token: Util.local.get(Setting.tokenKey) token: Util.local.get(Setting.tokenKey)
}, },
}).then(({ data }) => { }).then(({ data }) => {
if (data.code === 401) {
Util.errorMsg(data.msg)
setTimeout(() => {
store.dispatch('user/logout')
}, 1000)
return false
}
load.close()
callback(data.url) callback(data.url)
}).catch(res => { }) }).catch(res => {
load.close()
})
} }
//触发点击 //触发点击
input.click(); input.click();

@ -1,6 +1,9 @@
<template> <template>
<div class="page"> <div class="page">
<p class="page-name mb">SEO管理</p> <h6 class="page-name mb">SEO管理</h6>
<p class="tips">
SEO信息的动态调整应谨慎进行频繁且无规律的更改可能让搜索引擎难以确定页面的真实主题和内容从而影响排名稳定性和可信度更改后的SEO信息最好能够反映最新内容以提高页面与搜索查询的相关性从而可能提升搜索排名</p>
<el-form ref="form" :model="form" :rules="rules" class="input-form" label-width="140px"> <el-form ref="form" :model="form" :rules="rules" class="input-form" label-width="140px">
<el-form-item prop="title" label="SEO标题"> <el-form-item prop="title" label="SEO标题">
<el-input placeholder="SEO标题" v-model="form.title" clearable maxlength="100"></el-input> <el-input placeholder="SEO标题" v-model="form.title" clearable maxlength="100"></el-input>
@ -87,6 +90,12 @@ export default {
siteId: this.siteId, siteId: this.siteId,
}).then(({ data }) => { }).then(({ data }) => {
if (data.length) this.form = data[0] if (data.length) this.form = data[0]
if (data[0].iconUrl) {
this.fileList = [{
name: data[0].iconSuffix,
url: data[0].iconUrl
}]
}
}).catch(err => { }) }).catch(err => { })
}, },
handleExceed () { // handleExceed () { //
@ -130,6 +139,7 @@ export default {
this.submiting = true this.submiting = true
this.$post(this.api[this.form.id ? 'updateSeo' : 'addSeo'], this.form).then(res => { this.$post(this.api[this.form.id ? 'updateSeo' : 'addSeo'], this.form).then(res => {
Util.successMsg('保存成功!') Util.successMsg('保存成功!')
this.getData()
this.submiting = false this.submiting = false
}).catch(res => { }).catch(res => {
this.submiting = false this.submiting = false
@ -150,6 +160,12 @@ export default {
} }
} }
.tips {
margin-bottom: 10px;
font-size: 12px;
color: #8b8b8b;
}
.icon { .icon {
max-height: 32px; max-height: 32px;
} }

@ -5,7 +5,7 @@ const isDev = process.env.NODE_ENV === 'development' // 开发环境
let host = location.origin let host = location.origin
if (isDev) { if (isDev) {
host = 'https://huorantech.com' host = 'https://huorantech.com'
host = 'http://192.168.31.217:10000' // host = 'http://192.168.31.217:10000'
} }
const Setting = { const Setting = {

@ -438,4 +438,7 @@
} }
.tox-tinymce-aux { .tox-tinymce-aux {
z-index: 2500 !important; z-index: 2500 !important;
}
.tinymce-load {
z-index: 3000 !important;
} }
Loading…
Cancel
Save