From 4318f73bd3133598083a84acfe973cbd191fa724 Mon Sep 17 00:00:00 2001
From: yujialong <479214531@qq.com>
Date: Wed, 19 Jun 2024 10:55:25 +0800
Subject: [PATCH] fix
---
src/components/img-upload/Cropper.vue | 163 +++--
src/components/modules/content.vue | 130 ++--
src/components/modules/module.vue | 287 +++-----
src/pages/article/add/index.vue | 969 +++++++++-----------------
src/pages/column/add/index.vue | 2 +-
src/setting.js | 91 ++-
6 files changed, 579 insertions(+), 1063 deletions(-)
diff --git a/src/components/img-upload/Cropper.vue b/src/components/img-upload/Cropper.vue
index b2d12ed..754e269 100644
--- a/src/components/img-upload/Cropper.vue
+++ b/src/components/img-upload/Cropper.vue
@@ -3,31 +3,18 @@
-
+
-
-
+ :style="{ 'width': '500px', 'height': '400px', 'overflow': 'hidden', 'margin': '0 25px', 'display': 'flex', 'align-items': 'center' }">
+
+
@@ -41,10 +28,7 @@
-->
-
+
上传
@@ -56,7 +40,7 @@
import {
VueCropper
} from 'vue-cropper'
-import { compress, compressAccurately } from 'image-conversion'
+import { compress, compressAccurately, canvastoDataURL } from 'image-conversion'
export default {
components: {
VueCropper
@@ -95,7 +79,11 @@ export default {
autoCropHeight: {
type: Number,
default: 124
- }
+ },
+ dataType: {
+ type: String,
+ default: 'form'
+ },
},
data () {
return {
@@ -114,6 +102,7 @@ export default {
fixedNumber: [1, 0.26], // 截图框比例 (默认:[1:1])
enlarge: 1
},
+ imgType: this.dataType === 'form' ? 'image/png' : 'image/jpeg',
isDisabled: false
}
},
@@ -147,9 +136,13 @@ export default {
const that = this
if (type === 'blob') {
this.$refs.cropper.getCropBlob(data => {
- // compress(data, 1).then(res => {
- that.$emit('upload', data)
- // })
+ compress(data, {
+ size: 100,
+ quality: 0.9,
+ type: this.imgType
+ }).then(res => {
+ that.$emit('upload', res)
+ })
})
} else {
this.$refs.cropper.getCropData(data => {
@@ -162,81 +155,81 @@ export default {
diff --git a/src/components/modules/content.vue b/src/components/modules/content.vue
index 211f488..b2af1ac 100644
--- a/src/components/modules/content.vue
+++ b/src/components/modules/content.vue
@@ -1,117 +1,64 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
+
-
-
-
+
+
+
-
+
-
-
+
+
-
@@ -292,11 +239,12 @@ export default {
\ No newline at end of file
diff --git a/src/components/modules/module.vue b/src/components/modules/module.vue
index 5a11daa..4847c6f 100644
--- a/src/components/modules/module.vue
+++ b/src/components/modules/module.vue
@@ -3,40 +3,22 @@
-
+
-
-
+
+
-
+
-
+
{{ scope.row.link.linkName }}
-
-
+
+
@@ -44,241 +26,137 @@
-
+
-
+
-
+
-
-
+
+
-
+
-
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
+
-
+
上传视频
-
-
-
+
+
设置链接
-
+
-
-
-
-
+
+
+
+
-
-
+
+
-
+
- 默认读取关联栏目
+ 默认读取关联栏目
-
-
+
+
-
-
-
+
+
+
-
+
-
+
-
+
-
-
+
+
-
+
-
@@ -650,11 +528,12 @@ export default {
\ No newline at end of file
diff --git a/src/pages/article/add/index.vue b/src/pages/article/add/index.vue
index c928a68..4ef5400 100644
--- a/src/pages/article/add/index.vue
+++ b/src/pages/article/add/index.vue
@@ -1,159 +1,90 @@
文章详情
-
-
-
-
+
+
+
+
-
+
-
+
- -
+
-
-
+
- {{ item.style }}
+ {{ item.style }}
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
@@ -161,81 +92,43 @@
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
+
+
-
+
- 设置
+ 设置
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
+
+
+
-
+
- 设置
+ 设置
-
-
+
+
-
+
- 设置
+ 设置
-
+ prop="summary" label="摘要">
+
-
-
-
-
-
+
+
+
+
+
点击上传
-
-
-
-
+ prop="bannerImg" label="Banner图(选填)" style="flex: 1;">
+
+
+
+
点击上传
@@ -433,81 +242,50 @@
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+ prop="mainBody" label="正文">
+
-
-
+
+
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
站内链接
站外链接
@@ -516,175 +294,98 @@
-
+
-
-
+
+
-
-
+
+
-
-
-
+
+
+
-
+
-
-
+
+
-
-
+
+
-
+
+ accept=".jpg,.png,.jpeg,.gif,.mp4,.3gp,.mov,.m4v,.avi,.dat,.mkv,.flv,.vob,.rmvb,.rm,.qlv"
+ :before-upload="file => fileBeforeUpload(file, 1)" :on-remove="handleRemove" :on-success="uploadSuccessFile"
+ :on-error="uploadError" :action="this.api.upload" :file-list="form.fileList" :limit="1"
+ :on-exceed="handleExceed" :headers="headers" :data="{
+ quote: form.title,
+ site: site.siteName,
+ uploader: userName
+ }">
上传
-
+
上传
- 发布
- 预览
+ 发布
+ 预览
保存草稿
取消
-
-
+
+
-
+
-
+
-
-
-
+
+
+
-
+
{{ scope.row.classificationName }}
- 否
-
+ 否
+
-
-
-
+
+
+
@@ -693,53 +394,26 @@
-
+
-
+
-
-
-
+
+
+
-
+
{{ scope.row.labelName }}
- 否
-
+ 否
+
-
-
-
+
+
+
@@ -1251,12 +925,12 @@ export default {
submitClass (row, showMsg = 1) {
if (!row.classificationName) return Util.errorMsg('请输入分类名称')
this.$post(this.api.checkClassif, Util.rsa({
- classificationName: row.classificationName,
+ classificationName: encodeURI(row.classificationName),
siteId: this.site.id,
classificationId: row.id
})).then(res => {
this.$post(this.api[row.id ? 'updateClassif' : 'saveClassif'], Util.rsa({
- classificationName: row.classificationName,
+ classificationName: encodeURI(row.classificationName),
templateId: this.columnInfo.templateId,
id: row.id,
siteId: this.site.id,
@@ -1329,12 +1003,12 @@ export default {
submitLabel (row, showMsg = 1) {
if (!row.labelName) return Util.errorMsg('请输入主题名称')
this.$post(this.api.checkLabel, Util.rsa({
- labelName: row.labelName,
+ labelName: encodeURI(row.labelName),
siteId: this.site.id,
labelId: row.id,
})).then(res => {
this.$post(this.api[row.id ? 'updateLabel' : 'saveLabel'], Util.rsa({
- labelName: row.labelName,
+ labelName: encodeURI(row.labelName),
id: row.id,
siteId: this.site.id,
editorId: this.userId,
@@ -1372,7 +1046,7 @@ export default {
siteId: this.site.id,
title,
id: id || ''
- })).then(res => {
+ }).then(res => {
this.repeatMsg = ''
this.nameRepeat = false
}).catch(res => {
@@ -1433,7 +1107,7 @@ export default {
return false
}
let url = this.form[this.isBanner ? 'bannerImg' : 'titleImg']
- url && this.$del(this.api.delFile, [url.split('/').pop()]).then(res => { }).catch(e => { }) // 删除替换掉的图片
+ // url && this.$del(this.api.delFile, Util.rsa([url.split('/').pop()])).then(res => { }).catch(e => { }) // 删除替换掉的图片
this.form[this.isBanner ? 'bannerImg' : 'titleImg'] = data.url
}).catch(res => {
})
@@ -1476,7 +1150,7 @@ export default {
// banner上传成功
uploadSuccessBanner (res) {
let url = this.form.bannerImg
- url && this.$del(this.api.delFile, [url.split('/').pop()]).then(res => { }).catch(e => { })
+ // url && this.$del(this.api.delFile, Util.rsa([url.split('/').pop()])).then(res => { }).catch(e => { })
this.form.bannerImg = res.url
},
handleExceed (files, fileList) {
@@ -1519,14 +1193,14 @@ export default {
uploadSuccessFile (res) {
this.uploading--
this.form.id ?
- this.$post(this.api.saveContentFile, Util.rsa({
+ this.$post(this.api.saveContentFile, {
contentId: this.form.id,
editorId: this.userId,
founderId: this.userId,
id: '',
fileName: res.original,
filePath: res.url
- })).then(({ data }) => {
+ }).then(({ data }) => {
this.form.fileList.push({
name: res.original,
url: res.url,
@@ -1674,126 +1348,149 @@ export default {
$upload-width: 220px;
$upload-height: 102px;
$upload-lg-height: 102px;
+
/deep/ .avatar-uploader {
- .el-upload {
- position: relative;
- width: $upload-width;
- height: $upload-height;
- border: 1px solid #dcdee0;
- border-radius: 2px;
- cursor: pointer;
- overflow: hidden;
- .uploader-default {
- display: flex;
- height: $upload-height;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- text-align: center;
- background: #fafafa;
- p {
- margin-top: 10px;
- font-size: 14px;
- color: #333;
- line-height: 20px;
- }
- }
- }
- &.avatar-uploader-lg {
- .el-upload {
- width: 100%;
- max-width: 820px;
- height: $upload-lg-height;
+ .el-upload {
+ position: relative;
+ width: $upload-width;
+ height: $upload-height;
+ border: 1px solid #dcdee0;
+ border-radius: 2px;
+ cursor: pointer;
+ overflow: hidden;
- .uploader-default {
- height: $upload-lg-height;
- }
- }
- }
- .avatar {
- display: block;
- width: $upload-width;
- height: $upload-height;
+ .uploader-default {
+ display: flex;
+ height: $upload-height;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ text-align: center;
+ background: #fafafa;
+
+ p {
+ margin-top: 10px;
+ font-size: 14px;
+ color: #333;
+ line-height: 20px;
+ }
}
- .avatar-lg {
- display: block;
- width: 100%;
+ }
+
+ &.avatar-uploader-lg {
+ .el-upload {
+ width: 100%;
+ max-width: 820px;
+ height: $upload-lg-height;
+
+ .uploader-default {
height: $upload-lg-height;
+ }
}
- .el-upload__tip {
- margin-top: 0;
- p {
- font-size: 12px;
- color: #333;
- }
+ }
+
+ .avatar {
+ display: block;
+ width: $upload-width;
+ height: $upload-height;
+ }
+
+ .avatar-lg {
+ display: block;
+ width: 100%;
+ height: $upload-lg-height;
+ }
+
+ .el-upload__tip {
+ margin-top: 0;
+
+ p {
+ font-size: 12px;
+ color: #333;
}
+ }
}
+
.style-wrap {
- display: flex;
- margin-top: 10px;
- .label {
- margin-right: 30px;
- }
+ display: flex;
+ margin-top: 10px;
+
+ .label {
+ margin-right: 30px;
+ }
}
+
.styles {
+ display: flex;
+ flex-wrap: wrap;
+ width: 955px;
+ // height: 320px;
+ margin-top: 20px;
+ overflow: auto;
+
+ li {
+ margin: 0 20px 10px 0;
+ text-align: center;
+ cursor: pointer;
+
+ &:hover .review {
+ border-color: #2962ff;
+ }
+ }
+
+ .review {
display: flex;
- flex-wrap: wrap;
- width: 955px;
- // height: 320px;
- margin-top: 20px;
- overflow: auto;
- li {
- margin: 0 20px 10px 0;
- text-align: center;
- cursor: pointer;
- &:hover .review {
- border-color: #2962ff;
- }
+ justify-content: center;
+ align-items: center;
+ width: 170px;
+ height: 112px;
+ margin-bottom: 10px;
+ border: 1px solid #dcdee0;
+ border-radius: 2px;
+
+ img {
+ width: 80px;
}
- .review {
- display: flex;
- justify-content: center;
- align-items: center;
- width: 170px;
- height: 112px;
- margin-bottom: 10px;
- border: 1px solid #dcdee0;
- border-radius: 2px;
- img {
- width: 80px;
- }
- .is-link {
- width: 50px;
- }
+
+ .is-link {
+ width: 50px;
}
+ }
}
+
.info {
- position: absolute;
- top: 8px;
- left: -32px;
- cursor: pointer;
+ position: absolute;
+ top: 8px;
+ left: -32px;
+ cursor: pointer;
}
+
.plus {
- margin-bottom: 10px;
- font-size: 18px;
- color: #2962ff;
- text-align: right;
- cursor: pointer;
+ margin-bottom: 10px;
+ font-size: 18px;
+ color: #2962ff;
+ text-align: right;
+ cursor: pointer;
}
+
.set-btn {
- margin-left: 10px !important;
+ margin-left: 10px !important;
}
+
.manage-dia {
- .edit,
- .del {
- font-size: 14px;
- cursor: pointer;
- }
- .edit {
- margin-right: 10px;
- }
+
+ .edit,
+ .del {
+ font-size: 14px;
+ cursor: pointer;
+ }
+
+ .edit {
+ margin-right: 10px;
+ }
}
+
.editor {
- line-height: normal;
+ line-height: normal;
}
\ No newline at end of file
diff --git a/src/pages/column/add/index.vue b/src/pages/column/add/index.vue
index 9be8096..9d37ed5 100644
--- a/src/pages/column/add/index.vue
+++ b/src/pages/column/add/index.vue
@@ -666,7 +666,7 @@ export default {
}
let url = this.form.columnBanner
- url && this.$del(this.api.delFile, [url.split('/').pop()]).then(res => { }).catch(e => { }) // 删除替换掉的图片
+ // url && this.$del(this.api.delFile, Util.rsa([url.split('/').pop()])).then(res => { }).catch(e => { }) // 删除替换掉的图片
this.form.columnBanner = data.url
this.fileId = data.id
}).catch(res => { })
diff --git a/src/setting.js b/src/setting.js
index ac337ad..6556b59 100644
--- a/src/setting.js
+++ b/src/setting.js
@@ -4,53 +4,52 @@
const isDev = process.env.NODE_ENV === 'development' // 开发环境
let host = `${location.origin}/`
-
const Setting = {
- /**
- * 基础配置
- * */
- titleSuffix: '粒子研究院', // 网页标题的后缀
- routerMode: "hash", // 路由模式,可选值为 history 或 hash
- showProgressBar: true, // 页面切换时,是否显示模拟的进度条
- apiBaseURL: host, // 接口请求地址
- autoLogoutTime: 3600000, // 长时间未操作,自动退出登录时间
- modalDuration: 3, // 接口请求返回错误时,弹窗的持续时间,单位:秒
- errorModalType: "Message", // 接口请求返回错误时,弹窗的类型,可选值为 Message 或 Notice
- tokenExpires: 1296000000, // token在localStorage的时间(毫秒)
- isDev,
- /**
- * 路由白名单
- * */
- whiteList: ['/login', '/redirect'],
- /**
- * localStorage里保存的token的key
- */
- tokenKey: "IASF_server_token",
- /**
- * localStorage里保存的vuex的key
- */
- storeKey: "IASF_server_store",
- /**
- * 多语言配置
- * */
- i18n: {
- // 默认语言
- default: "zh",
- // 是否根据用户电脑配置自动设置语言(仅第一次有效)
- auto: false
- },
- /**
- * 布局配置
- * */
- layout: {},
- /**
- * 功能配置
- * */
- // 相同路由,不同参数间进行切换,是否强力更新
- sameRouteForceUpdate: false,
- // 是否使用动态路由(即角色权限,开启了的话就会取后端返回的权限树来显示头部导肮和页面按钮)
- dynamicRoute: true,
- publicKey: 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA08Nz0zscnWtddmaNylIPt9v5ZO6U6pYyGochRrbpI+ocwoyV4E1uUu3J9/mmR8pyMBcYzE5KkBytlaiLnd6dMqo4R60aihN/TqfuI/03LzgAS/egT/Q4VB9yZSyZCmJhrgTtSX5kxotAbewp0gqsWpi+6BUYDuiwJ0WNlhDVV4FOQIppmvHh0RqYDhjiPNAuy7fEtytT+IY4rxm6LggvmNtIq5k2oLbDxEeI1GOyFHT6sLGMkmBLmHu7JYcrlyUGyGWsxh8hVame1zQsScivrZu757BTGhN4xObTivIdAbR7uFeeX4lp0X1JNtIe9TwB/aZzKJjZMPXeV7BJ01g3MQIDAQAB',
+ /**
+ * 基础配置
+ * */
+ titleSuffix: '粒子研究院', // 网页标题的后缀
+ routerMode: "hash", // 路由模式,可选值为 history 或 hash
+ showProgressBar: true, // 页面切换时,是否显示模拟的进度条
+ apiBaseURL: host, // 接口请求地址
+ autoLogoutTime: 3600000, // 长时间未操作,自动退出登录时间
+ modalDuration: 3, // 接口请求返回错误时,弹窗的持续时间,单位:秒
+ errorModalType: "Message", // 接口请求返回错误时,弹窗的类型,可选值为 Message 或 Notice
+ tokenExpires: 1296000000, // token在localStorage的时间(毫秒)
+ isDev,
+ /**
+ * 路由白名单
+ * */
+ whiteList: ['/login', '/redirect'],
+ /**
+ * localStorage里保存的token的key
+ */
+ tokenKey: "IASF_server_token",
+ /**
+ * localStorage里保存的vuex的key
+ */
+ storeKey: "IASF_server_store",
+ /**
+ * 多语言配置
+ * */
+ i18n: {
+ // 默认语言
+ default: "zh",
+ // 是否根据用户电脑配置自动设置语言(仅第一次有效)
+ auto: false
+ },
+ /**
+ * 布局配置
+ * */
+ layout: {},
+ /**
+ * 功能配置
+ * */
+ // 相同路由,不同参数间进行切换,是否强力更新
+ sameRouteForceUpdate: false,
+ // 是否使用动态路由(即角色权限,开启了的话就会取后端返回的权限树来显示头部导肮和页面按钮)
+ dynamicRoute: true,
+ publicKey: 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA08Nz0zscnWtddmaNylIPt9v5ZO6U6pYyGochRrbpI+ocwoyV4E1uUu3J9/mmR8pyMBcYzE5KkBytlaiLnd6dMqo4R60aihN/TqfuI/03LzgAS/egT/Q4VB9yZSyZCmJhrgTtSX5kxotAbewp0gqsWpi+6BUYDuiwJ0WNlhDVV4FOQIppmvHh0RqYDhjiPNAuy7fEtytT+IY4rxm6LggvmNtIq5k2oLbDxEeI1GOyFHT6sLGMkmBLmHu7JYcrlyUGyGWsxh8hVame1zQsScivrZu757BTGhN4xObTivIdAbR7uFeeX4lp0X1JNtIe9TwB/aZzKJjZMPXeV7BJ01g3MQIDAQAB',
};
export default Setting;