From b5e7d41a0f50b65d3869fe484efedd3adee31233 Mon Sep 17 00:00:00 2001
From: yujialong <479214531@qq.com>
Date: Thu, 18 Jul 2024 11:37:28 +0800
Subject: [PATCH] fix
---
public/styles/css/editor.css | 2 +-
src/components/editor.js | 16 +++++++++++
src/components/modules/module.vue | 13 +++++++++
src/pages/article/add/editor.js | 45 ++++++++++++++++++++++++++-----
src/pages/seo/index.vue | 18 ++++++++++++-
src/setting.js | 2 +-
src/styles/common.scss | 3 +++
7 files changed, 90 insertions(+), 9 deletions(-)
diff --git a/public/styles/css/editor.css b/public/styles/css/editor.css
index 9d3366a..400cff8 100644
--- a/public/styles/css/editor.css
+++ b/public/styles/css/editor.css
@@ -131,4 +131,4 @@
margin-right: 8px;
background: #1583ff;
border-radius: 4px;
-}
+}
\ No newline at end of file
diff --git a/src/components/editor.js b/src/components/editor.js
index 32097fe..19e06d7 100644
--- a/src/components/editor.js
+++ b/src/components/editor.js
@@ -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 => { })
}
diff --git a/src/components/modules/module.vue b/src/components/modules/module.vue
index 1566d39..1ddde13 100644
--- a/src/components/modules/module.vue
+++ b/src/components/modules/module.vue
@@ -89,6 +89,14 @@
:headers="headers" :action="api.upload">
上传资源
+
+
+
+
+
@@ -560,4 +568,9 @@ export default {
margin-left: -40px;
}
}
+
+.preview-media {
+ max-width: 100px;
+ margin-left: 20px;
+}
\ No newline at end of file
diff --git a/src/pages/article/add/editor.js b/src/pages/article/add/editor.js
index 36e6fd1..00c1ded 100644
--- a/src/pages/article/add/editor.js
+++ b/src/pages/article/add/editor.js
@@ -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();
diff --git a/src/pages/seo/index.vue b/src/pages/seo/index.vue
index 31fdec2..4adc44d 100644
--- a/src/pages/seo/index.vue
+++ b/src/pages/seo/index.vue
@@ -1,6 +1,9 @@
-
SEO管理
+
SEO管理
+
+ SEO信息的动态调整应谨慎进行,频繁且无规律的更改可能让搜索引擎难以确定页面的真实主题和内容,从而影响排名稳定性和可信度。更改后的SEO信息最好能够反映最新内容,以提高页面与搜索查询的相关性,从而可能提升搜索排名。
+
@@ -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;
}
diff --git a/src/setting.js b/src/setting.js
index 8cd23f3..18002e7 100644
--- a/src/setting.js
+++ b/src/setting.js
@@ -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 = {
diff --git a/src/styles/common.scss b/src/styles/common.scss
index b972e13..1a89e16 100644
--- a/src/styles/common.scss
+++ b/src/styles/common.scss
@@ -438,4 +438,7 @@
}
.tox-tinymce-aux {
z-index: 2500 !important;
+}
+.tinymce-load {
+ z-index: 3000 !important;
}
\ No newline at end of file