generated from Leo_Ding/web-template
富文本加密解密解决触发安全策略的问题;修复房刊列表编辑区域不显示的问题
This commit is contained in:
parent
f46ba305ac
commit
643e5454bf
4
.env.dev
4
.env.dev
@ -12,8 +12,8 @@ VITE_ROUTER_BASE=/
|
|||||||
VITE_ROUTER_HISTORY=hash
|
VITE_ROUTER_HISTORY=hash
|
||||||
|
|
||||||
# api
|
# api
|
||||||
VITE_API_BASIC=https://zh.shibeitong.com
|
# VITE_API_BASIC=https://zh.shibeitong.com
|
||||||
# VITE_API_BASIC=http://10.10.1.6:8070
|
VITE_API_BASIC=http://10.10.1.6:8070
|
||||||
VITE_API_HTTP=/api/v1/
|
VITE_API_HTTP=/api/v1/
|
||||||
# storage
|
# storage
|
||||||
VITE_STORAGE_NAMESPACE = gin-admin_local_
|
VITE_STORAGE_NAMESPACE = gin-admin_local_
|
||||||
|
|||||||
@ -336,11 +336,13 @@ export const spliceUrl=(fullUrl)=>{
|
|||||||
return pathOnly
|
return pathOnly
|
||||||
}
|
}
|
||||||
/**加密 */
|
/**加密 */
|
||||||
export function encryptString(plaintext, secretKey) {
|
export function encryptString(plaintext) {
|
||||||
|
if(!plaintext) return null
|
||||||
return CryptoJS.AES.encrypt(plaintext, 'gxzhonghai12345678',{mode: CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7,iv: CryptoJS.enc.Utf8.parse('0000000000000000'),format: CryptoJS.format.OpenSSL}).toString();
|
return CryptoJS.AES.encrypt(plaintext, 'gxzhonghai12345678',{mode: CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7,iv: CryptoJS.enc.Utf8.parse('0000000000000000'),format: CryptoJS.format.OpenSSL}).toString();
|
||||||
}
|
}
|
||||||
/**解密 */
|
/**解密 */
|
||||||
export function decryptString(ciphertext, secretKey) {
|
export function decryptString(ciphertext) {
|
||||||
|
if(!ciphertext) return null
|
||||||
const bytes = CryptoJS.AES.decrypt(ciphertext, 'gxzhonghai12345678',{mode: CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7,iv: CryptoJS.enc.Utf8.parse('0000000000000000'),format: CryptoJS.format.OpenSSL});
|
const bytes = CryptoJS.AES.decrypt(ciphertext, 'gxzhonghai12345678',{mode: CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7,iv: CryptoJS.enc.Utf8.parse('0000000000000000'),format: CryptoJS.format.OpenSSL});
|
||||||
return bytes.toString(CryptoJS.enc.Utf8);
|
return bytes.toString(CryptoJS.enc.Utf8);
|
||||||
}
|
}
|
||||||
@ -140,7 +140,7 @@ import { useI18n } from 'vue-i18n'
|
|||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import GxUpload from '@/components/GxUpload/index.vue'
|
import GxUpload from '@/components/GxUpload/index.vue'
|
||||||
import { typerEnum, areaEnum } from "@/enums/useEnum"
|
import { typerEnum, areaEnum } from "@/enums/useEnum"
|
||||||
import { spliceUrl } from "@/utils/util"
|
import { spliceUrl,decryptString,encryptString } from "@/utils/util"
|
||||||
const emit = defineEmits(['ok'])
|
const emit = defineEmits(['ok'])
|
||||||
const { t } = useI18n() // 解构出t方法
|
const { t } = useI18n() // 解构出t方法
|
||||||
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
||||||
@ -212,7 +212,7 @@ async function handleEdit(record = {}) {
|
|||||||
hideSpining()
|
hideSpining()
|
||||||
formData.value = { ...data }
|
formData.value = { ...data }
|
||||||
formData.value.expireAt = data?.expireAt ? dayjs(data?.expireAt) : ''
|
formData.value.expireAt = data?.expireAt ? dayjs(data?.expireAt) : ''
|
||||||
editorContent.value = data.details
|
editorContent.value = decryptString(data.details)
|
||||||
if (data.cover && data.cover.length > 0) {
|
if (data.cover && data.cover.length > 0) {
|
||||||
formData.value.fileList = [data.cover].map(item => config('http.apiBasic') + item)
|
formData.value.fileList = [data.cover].map(item => config('http.apiBasic') + item)
|
||||||
}
|
}
|
||||||
@ -235,7 +235,7 @@ function handleOk() {
|
|||||||
const params = {
|
const params = {
|
||||||
...values,
|
...values,
|
||||||
cover: spliceUrl(formData.value.fileList[0]),
|
cover: spliceUrl(formData.value.fileList[0]),
|
||||||
details: editorContent.value,
|
details: encryptString(editorContent.value),
|
||||||
}
|
}
|
||||||
let result = null
|
let result = null
|
||||||
switch (modal.value.type) {
|
switch (modal.value.type) {
|
||||||
|
|||||||
@ -134,7 +134,7 @@ import { useI18n } from 'vue-i18n'
|
|||||||
import { PlusOutlined, MinusOutlined, SettingOutlined } from '@ant-design/icons-vue';
|
import { PlusOutlined, MinusOutlined, SettingOutlined } from '@ant-design/icons-vue';
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import { customersEnum, areaEnum } from "@/enums/useEnum"
|
import { customersEnum, areaEnum } from "@/enums/useEnum"
|
||||||
import { spliceUrl } from "@/utils/util.js"
|
import { spliceUrl,decryptString,encryptString } from "@/utils/util.js"
|
||||||
const emit = defineEmits(['ok'])
|
const emit = defineEmits(['ok'])
|
||||||
const { t } = useI18n() // 解构出t方法
|
const { t } = useI18n() // 解构出t方法
|
||||||
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
||||||
@ -203,8 +203,8 @@ async function handleEdit(record = {}) {
|
|||||||
formData.value = {
|
formData.value = {
|
||||||
...data,
|
...data,
|
||||||
startAt:dayjs(data.startAt),
|
startAt:dayjs(data.startAt),
|
||||||
endAt:dayjs(data.endAt)
|
endAt:dayjs(data.endAt),
|
||||||
|
reason:decryptString(data.reason),
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
message.error({ content: error.message })
|
message.error({ content: error.message })
|
||||||
@ -221,7 +221,8 @@ function handleOk() {
|
|||||||
showLoading()
|
showLoading()
|
||||||
const params = {
|
const params = {
|
||||||
...values,
|
...values,
|
||||||
roles:formData.value.roles
|
roles:formData.value.roles,
|
||||||
|
reason:encryptString(formData.value.reason),
|
||||||
}
|
}
|
||||||
let result = null
|
let result = null
|
||||||
switch (modal.value.type) {
|
switch (modal.value.type) {
|
||||||
|
|||||||
@ -53,7 +53,9 @@
|
|||||||
<template v-if="column.dataIndex === 'endAt'">
|
<template v-if="column.dataIndex === 'endAt'">
|
||||||
<span>{{ dayjs(record.endAt).format('YYYY-MM-DD HH:mm:ss') }}</span>
|
<span>{{ dayjs(record.endAt).format('YYYY-MM-DD HH:mm:ss') }}</span>
|
||||||
</template>
|
</template>
|
||||||
|
<template v-if="column.dataIndex === 'reason'">
|
||||||
|
<div v-html="decryptString(record.reason)"></div>
|
||||||
|
</template>
|
||||||
<template v-if="'status' === column.dataIndex">
|
<template v-if="'status' === column.dataIndex">
|
||||||
<a-tag v-if="record.status === 'enabled'" :color="'green'">启用</a-tag>
|
<a-tag v-if="record.status === 'enabled'" :color="'green'">启用</a-tag>
|
||||||
<a-tag v-if="record.status === 'disabled'" :color="'red'">停用</a-tag>
|
<a-tag v-if="record.status === 'disabled'" :color="'red'">停用</a-tag>
|
||||||
@ -89,13 +91,14 @@ import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vu
|
|||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import { customersEnum, areaEnum } from "@/enums/useEnum"
|
import { customersEnum, areaEnum } from "@/enums/useEnum"
|
||||||
|
import { encryptString, decryptString } from "@/utils/util"
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'lotteryRules',
|
name: 'lotteryRules',
|
||||||
})
|
})
|
||||||
const { t } = useI18n() // 解构出t方法
|
const { t } = useI18n() // 解构出t方法
|
||||||
const columns = [
|
const columns = [
|
||||||
{ title: '所属区域', dataIndex: 'areaId' },
|
{ title: '所属区域', dataIndex: 'areaId' },
|
||||||
{ title: '规则名称', dataIndex: 'title'},
|
{ title: '规则名称', dataIndex: 'title' },
|
||||||
{ title: '开始时间', dataIndex: 'startAt', width: 180, align: 'center' },
|
{ title: '开始时间', dataIndex: 'startAt', width: 180, align: 'center' },
|
||||||
{ title: '结束时间', dataIndex: 'endAt', width: 180, align: 'center' },
|
{ title: '结束时间', dataIndex: 'endAt', width: 180, align: 'center' },
|
||||||
{ title: '消耗积分', dataIndex: 'price', align: 'center', width: 110 },
|
{ title: '消耗积分', dataIndex: 'price', align: 'center', width: 110 },
|
||||||
|
|||||||
@ -66,7 +66,7 @@ import { message } from 'ant-design-vue'
|
|||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import GxUpload from '@/components/GxUpload/index.vue'
|
import GxUpload from '@/components/GxUpload/index.vue'
|
||||||
import { spliceUrl } from '@/utils/util'
|
import { spliceUrl,decryptString,encryptString } from '@/utils/util'
|
||||||
import { customersEnum, areaEnum } from "@/enums/useEnum"
|
import { customersEnum, areaEnum } from "@/enums/useEnum"
|
||||||
const areaFormRef = ref()
|
const areaFormRef = ref()
|
||||||
const emit = defineEmits(['ok'])
|
const emit = defineEmits(['ok'])
|
||||||
@ -129,10 +129,11 @@ async function handleEdit(record = {}) {
|
|||||||
title: data.title,
|
title: data.title,
|
||||||
id:data.id,
|
id:data.id,
|
||||||
status: data.status,
|
status: data.status,
|
||||||
|
areaId: data.areaId,
|
||||||
pushAt: dayjs(data.pushAt),
|
pushAt: dayjs(data.pushAt),
|
||||||
imgList: [config('http.apiBasic') + data.cover]
|
imgList: [config('http.apiBasic') + data.cover]
|
||||||
}
|
}
|
||||||
editorContent.value = data.content
|
editorContent.value = decryptString(data.content)
|
||||||
if (data.cover) {
|
if (data.cover) {
|
||||||
formData.value.fileList = [config('http.apiBasic') + data.img]
|
formData.value.fileList = [config('http.apiBasic') + data.img]
|
||||||
}
|
}
|
||||||
@ -158,7 +159,7 @@ function handleOk() {
|
|||||||
name: formData.value.name,
|
name: formData.value.name,
|
||||||
status: formData.value.status,
|
status: formData.value.status,
|
||||||
title: formData.value.title,
|
title: formData.value.title,
|
||||||
content: editorContent.value,
|
content: encryptString(editorContent.value),
|
||||||
pushAt: formData.value.pushAt,
|
pushAt: formData.value.pushAt,
|
||||||
cover: formData.value.imgList && spliceUrl(formData.value.imgList[0])
|
cover: formData.value.imgList && spliceUrl(formData.value.imgList[0])
|
||||||
}
|
}
|
||||||
|
|||||||
@ -360,7 +360,7 @@ import { useI18n } from 'vue-i18n'
|
|||||||
import { PlusOutlined, MinusOutlined, SettingOutlined } from '@ant-design/icons-vue';
|
import { PlusOutlined, MinusOutlined, SettingOutlined } from '@ant-design/icons-vue';
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import { customersEnum, areaEnum } from "@/enums/useEnum"
|
import { customersEnum, areaEnum } from "@/enums/useEnum"
|
||||||
import { spliceUrl } from "@/utils/util.js"
|
import { spliceUrl,decryptString,encryptString } from "@/utils/util.js"
|
||||||
const emit = defineEmits(['ok'])
|
const emit = defineEmits(['ok'])
|
||||||
const { t } = useI18n() // 解构出t方法
|
const { t } = useI18n() // 解构出t方法
|
||||||
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
||||||
@ -432,7 +432,7 @@ async function handleEdit(record = {}) {
|
|||||||
price: data.price,
|
price: data.price,
|
||||||
status: data.status,
|
status: data.status,
|
||||||
basicArea: data.area,
|
basicArea: data.area,
|
||||||
disclaimerContain: data.disclaimerContain,
|
disclaimerContain: decryptString(data.disclaimerContain),
|
||||||
title: data.title,
|
title: data.title,
|
||||||
videos: data.videos ? data.videos.map(item => config('http.apiBasic') + item) : [],
|
videos: data.videos ? data.videos.map(item => config('http.apiBasic') + item) : [],
|
||||||
advisers: data.advisers ? data.advisers.map(item => ({ adviserName: item.name, adviserPhone: item.phone, adviserImg: item.avatar ? [config('http.apiBasic') + item.avatar] : [] })) : [{ adviserName: '', adviserPhone: '', adviserImg: [] },
|
advisers: data.advisers ? data.advisers.map(item => ({ adviserName: item.name, adviserPhone: item.phone, adviserImg: item.avatar ? [config('http.apiBasic') + item.avatar] : [] })) : [{ adviserName: '', adviserPhone: '', adviserImg: [] },
|
||||||
@ -498,7 +498,7 @@ function handleOk() {
|
|||||||
status: formData.value.status,
|
status: formData.value.status,
|
||||||
title: formData.value.title,
|
title: formData.value.title,
|
||||||
area: formData.value.basicArea,
|
area: formData.value.basicArea,
|
||||||
disclaimerContain: formData.value.disclaimerContain,
|
disclaimerContain: encryptString(formData.value.disclaimerContain),
|
||||||
videos: formData.value.videos && formData.value.videos.map(item => spliceUrl(item)),
|
videos: formData.value.videos && formData.value.videos.map(item => spliceUrl(item)),
|
||||||
advisers: formData.value.advisers && formData.value.advisers.map(item => ({ name: item.adviserName, phone: item.adviserPhone, avatar: item.adviserImg[0] && spliceUrl(item.adviserImg[0]) })),
|
advisers: formData.value.advisers && formData.value.advisers.map(item => ({ name: item.adviserName, phone: item.adviserPhone, avatar: item.adviserImg[0] && spliceUrl(item.adviserImg[0]) })),
|
||||||
detail: {
|
detail: {
|
||||||
|
|||||||
@ -79,7 +79,7 @@ import { message } from 'ant-design-vue'
|
|||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import GxUpload from '@/components/GxUpload/index.vue'
|
import GxUpload from '@/components/GxUpload/index.vue'
|
||||||
import { spliceUrl } from '@/utils/util'
|
import { spliceUrl,decryptString,encryptString } from '@/utils/util'
|
||||||
const areaFormRef = ref()
|
const areaFormRef = ref()
|
||||||
const emit = defineEmits(['ok'])
|
const emit = defineEmits(['ok'])
|
||||||
const { t } = useI18n() // 解构出t方法
|
const { t } = useI18n() // 解构出t方法
|
||||||
@ -142,10 +142,9 @@ async function handleEdit(id) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
hideSpining()
|
hideSpining()
|
||||||
editorContent.value=data.content
|
editorContent.value=decryptString(data.content)
|
||||||
formData.value = {
|
formData.value = {
|
||||||
...data,
|
...data,
|
||||||
|
|
||||||
startAt:dayjs(data.startAt),
|
startAt:dayjs(data.startAt),
|
||||||
endAt:dayjs(data.endAt)
|
endAt:dayjs(data.endAt)
|
||||||
}
|
}
|
||||||
@ -171,7 +170,7 @@ function handleOk() {
|
|||||||
showLoading()
|
showLoading()
|
||||||
const params = {
|
const params = {
|
||||||
...values,
|
...values,
|
||||||
content:editorContent.value,
|
content:encryptString(editorContent.value),
|
||||||
img:formData.value.fileList?spliceUrl(formData.value.fileList[0]):''
|
img:formData.value.fileList?spliceUrl(formData.value.fileList[0]):''
|
||||||
}
|
}
|
||||||
let result = null
|
let result = null
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user