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
|
||||
|
||||
# api
|
||||
VITE_API_BASIC=https://zh.shibeitong.com
|
||||
# VITE_API_BASIC=http://10.10.1.6:8070
|
||||
# VITE_API_BASIC=https://zh.shibeitong.com
|
||||
VITE_API_BASIC=http://10.10.1.6:8070
|
||||
VITE_API_HTTP=/api/v1/
|
||||
# storage
|
||||
VITE_STORAGE_NAMESPACE = gin-admin_local_
|
||||
|
||||
@ -336,11 +336,13 @@ export const spliceUrl=(fullUrl)=>{
|
||||
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();
|
||||
}
|
||||
/**解密 */
|
||||
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});
|
||||
return bytes.toString(CryptoJS.enc.Utf8);
|
||||
}
|
||||
@ -140,7 +140,7 @@ import { useI18n } from 'vue-i18n'
|
||||
import dayjs from 'dayjs'
|
||||
import GxUpload from '@/components/GxUpload/index.vue'
|
||||
import { typerEnum, areaEnum } from "@/enums/useEnum"
|
||||
import { spliceUrl } from "@/utils/util"
|
||||
import { spliceUrl,decryptString,encryptString } from "@/utils/util"
|
||||
const emit = defineEmits(['ok'])
|
||||
const { t } = useI18n() // 解构出t方法
|
||||
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
||||
@ -212,7 +212,7 @@ async function handleEdit(record = {}) {
|
||||
hideSpining()
|
||||
formData.value = { ...data }
|
||||
formData.value.expireAt = data?.expireAt ? dayjs(data?.expireAt) : ''
|
||||
editorContent.value = data.details
|
||||
editorContent.value = decryptString(data.details)
|
||||
if (data.cover && data.cover.length > 0) {
|
||||
formData.value.fileList = [data.cover].map(item => config('http.apiBasic') + item)
|
||||
}
|
||||
@ -235,7 +235,7 @@ function handleOk() {
|
||||
const params = {
|
||||
...values,
|
||||
cover: spliceUrl(formData.value.fileList[0]),
|
||||
details: editorContent.value,
|
||||
details: encryptString(editorContent.value),
|
||||
}
|
||||
let result = null
|
||||
switch (modal.value.type) {
|
||||
|
||||
@ -134,7 +134,7 @@ import { useI18n } from 'vue-i18n'
|
||||
import { PlusOutlined, MinusOutlined, SettingOutlined } from '@ant-design/icons-vue';
|
||||
import dayjs from 'dayjs'
|
||||
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 { t } = useI18n() // 解构出t方法
|
||||
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
||||
@ -203,8 +203,8 @@ async function handleEdit(record = {}) {
|
||||
formData.value = {
|
||||
...data,
|
||||
startAt:dayjs(data.startAt),
|
||||
endAt:dayjs(data.endAt)
|
||||
|
||||
endAt:dayjs(data.endAt),
|
||||
reason:decryptString(data.reason),
|
||||
}
|
||||
} catch (error) {
|
||||
message.error({ content: error.message })
|
||||
@ -221,7 +221,8 @@ function handleOk() {
|
||||
showLoading()
|
||||
const params = {
|
||||
...values,
|
||||
roles:formData.value.roles
|
||||
roles:formData.value.roles,
|
||||
reason:encryptString(formData.value.reason),
|
||||
}
|
||||
let result = null
|
||||
switch (modal.value.type) {
|
||||
|
||||
@ -44,7 +44,7 @@
|
||||
<a-table :columns="columns" :data-source="listData" bordered="true" :loading="loading"
|
||||
:pagination="paginationState" :scroll="{ x: 1000 }" @change="onTableChange">
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.dataIndex === 'areaId'">
|
||||
<template v-if="column.dataIndex === 'areaId'">
|
||||
<span>{{ areaEnum.getName(record.areaId) }}</span>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'startAt'">
|
||||
@ -53,8 +53,10 @@
|
||||
<template v-if="column.dataIndex === 'endAt'">
|
||||
<span>{{ dayjs(record.endAt).format('YYYY-MM-DD HH:mm:ss') }}</span>
|
||||
</template>
|
||||
|
||||
<template v-if="'status' === column.dataIndex">
|
||||
<template v-if="column.dataIndex === 'reason'">
|
||||
<div v-html="decryptString(record.reason)"></div>
|
||||
</template>
|
||||
<template v-if="'status' === column.dataIndex">
|
||||
<a-tag v-if="record.status === 'enabled'" :color="'green'">启用</a-tag>
|
||||
<a-tag v-if="record.status === 'disabled'" :color="'red'">停用</a-tag>
|
||||
</template>
|
||||
@ -89,13 +91,14 @@ import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vu
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import dayjs from 'dayjs'
|
||||
import { customersEnum, areaEnum } from "@/enums/useEnum"
|
||||
import { encryptString, decryptString } from "@/utils/util"
|
||||
defineOptions({
|
||||
name: 'lotteryRules',
|
||||
})
|
||||
const { t } = useI18n() // 解构出t方法
|
||||
const columns = [
|
||||
{ title: '所属区域', dataIndex: 'areaId' },
|
||||
{ title: '规则名称', dataIndex: 'title'},
|
||||
{ title: '规则名称', dataIndex: 'title' },
|
||||
{ title: '开始时间', dataIndex: 'startAt', width: 180, align: 'center' },
|
||||
{ title: '结束时间', dataIndex: 'endAt', width: 180, align: 'center' },
|
||||
{ title: '消耗积分', dataIndex: 'price', align: 'center', width: 110 },
|
||||
|
||||
@ -66,7 +66,7 @@ import { message } from 'ant-design-vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import dayjs from 'dayjs'
|
||||
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"
|
||||
const areaFormRef = ref()
|
||||
const emit = defineEmits(['ok'])
|
||||
@ -129,10 +129,11 @@ async function handleEdit(record = {}) {
|
||||
title: data.title,
|
||||
id:data.id,
|
||||
status: data.status,
|
||||
areaId: data.areaId,
|
||||
pushAt: dayjs(data.pushAt),
|
||||
imgList: [config('http.apiBasic') + data.cover]
|
||||
}
|
||||
editorContent.value = data.content
|
||||
editorContent.value = decryptString(data.content)
|
||||
if (data.cover) {
|
||||
formData.value.fileList = [config('http.apiBasic') + data.img]
|
||||
}
|
||||
@ -158,7 +159,7 @@ function handleOk() {
|
||||
name: formData.value.name,
|
||||
status: formData.value.status,
|
||||
title: formData.value.title,
|
||||
content: editorContent.value,
|
||||
content: encryptString(editorContent.value),
|
||||
pushAt: formData.value.pushAt,
|
||||
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 dayjs from 'dayjs'
|
||||
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 { t } = useI18n() // 解构出t方法
|
||||
const { modal, showModal, hideModal, showLoading, hideLoading } = useModal()
|
||||
@ -432,7 +432,7 @@ async function handleEdit(record = {}) {
|
||||
price: data.price,
|
||||
status: data.status,
|
||||
basicArea: data.area,
|
||||
disclaimerContain: data.disclaimerContain,
|
||||
disclaimerContain: decryptString(data.disclaimerContain),
|
||||
title: data.title,
|
||||
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: [] },
|
||||
@ -498,7 +498,7 @@ function handleOk() {
|
||||
status: formData.value.status,
|
||||
title: formData.value.title,
|
||||
area: formData.value.basicArea,
|
||||
disclaimerContain: formData.value.disclaimerContain,
|
||||
disclaimerContain: encryptString(formData.value.disclaimerContain),
|
||||
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]) })),
|
||||
detail: {
|
||||
|
||||
@ -79,7 +79,7 @@ import { message } from 'ant-design-vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import dayjs from 'dayjs'
|
||||
import GxUpload from '@/components/GxUpload/index.vue'
|
||||
import { spliceUrl } from '@/utils/util'
|
||||
import { spliceUrl,decryptString,encryptString } from '@/utils/util'
|
||||
const areaFormRef = ref()
|
||||
const emit = defineEmits(['ok'])
|
||||
const { t } = useI18n() // 解构出t方法
|
||||
@ -142,10 +142,9 @@ async function handleEdit(id) {
|
||||
return
|
||||
}
|
||||
hideSpining()
|
||||
editorContent.value=data.content
|
||||
editorContent.value=decryptString(data.content)
|
||||
formData.value = {
|
||||
...data,
|
||||
|
||||
startAt:dayjs(data.startAt),
|
||||
endAt:dayjs(data.endAt)
|
||||
}
|
||||
@ -171,7 +170,7 @@ function handleOk() {
|
||||
showLoading()
|
||||
const params = {
|
||||
...values,
|
||||
content:editorContent.value,
|
||||
content:encryptString(editorContent.value),
|
||||
img:formData.value.fileList?spliceUrl(formData.value.fileList[0]):''
|
||||
}
|
||||
let result = null
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user