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

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

@ -89,6 +89,14 @@
:headers="headers" :action="api.upload">
<el-button>上传资源</el-button>
</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>
</div>
<div v-if="item.type === 'link'" class="flex">
@ -560,4 +568,9 @@ export default {
margin-left: -40px;
}
}
.preview-media {
max-width: 100px;
margin-left: 20px;
}
</style>

@ -2,6 +2,8 @@ import Axios from 'axios'
import Api from '@/api'
import Setting from '@/setting'
import Util from '@/libs/util'
import store from '@/store'
import { Loading } from 'element-ui'
export default {
//skin:'oxide-dark',
language: 'zh_CN',
@ -409,6 +411,13 @@ export default {
token: Util.local.get(Setting.tokenKey)
},
}).then(({ data }) => {
if (data.code === 401) {
Util.errorMsg(data.msg)
setTimeout(() => {
store.dispatch('user/logout')
}, 1000)
return false
}
succFun(data.url)
}).catch(res => { })
},
@ -424,12 +433,26 @@ export default {
if (meta.filetype === 'media') {
// 动态创建上传input,并进行模拟点击上传操作,达到本地上传视频效果。
let input = document.createElement('input');//创建一个隐藏的input
input.setAttribute('type', 'file');
input.setAttribute("accept", ".mp4");
input.setAttribute('type', 'file')
input.setAttribute("accept", ".mp4")
input.onchange = function () {
let file = this.files[0];
let fd = new FormData();
fd.append("file", file);
let file = this.files[0]
let fd = new FormData()
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({
method: 'post',
url: Api.upload,
@ -439,8 +462,18 @@ export default {
token: Util.local.get(Setting.tokenKey)
},
}).then(({ data }) => {
if (data.code === 401) {
Util.errorMsg(data.msg)
setTimeout(() => {
store.dispatch('user/logout')
}, 1000)
return false
}
load.close()
callback(data.url)
}).catch(res => { })
}).catch(res => {
load.close()
})
}
//触发点击
input.click();

@ -1,6 +1,9 @@
<template>
<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-item prop="title" label="SEO标题">
<el-input placeholder="SEO标题" v-model="form.title" clearable maxlength="100"></el-input>
@ -87,6 +90,12 @@ export default {
siteId: this.siteId,
}).then(({ data }) => {
if (data.length) this.form = data[0]
if (data[0].iconUrl) {
this.fileList = [{
name: data[0].iconSuffix,
url: data[0].iconUrl
}]
}
}).catch(err => { })
},
handleExceed () { //
@ -130,6 +139,7 @@ export default {
this.submiting = true
this.$post(this.api[this.form.id ? 'updateSeo' : 'addSeo'], this.form).then(res => {
Util.successMsg('保存成功!')
this.getData()
this.submiting = false
}).catch(res => {
this.submiting = false
@ -150,6 +160,12 @@ export default {
}
}
.tips {
margin-bottom: 10px;
font-size: 12px;
color: #8b8b8b;
}
.icon {
max-height: 32px;
}

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

@ -439,3 +439,6 @@
.tox-tinymce-aux {
z-index: 2500 !important;
}
.tinymce-load {
z-index: 3000 !important;
}
Loading…
Cancel
Save