From e0cbcb37d09e67b6b16ec2446c3ebbf318d154e0 Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Fri, 23 Feb 2024 16:05:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A8=E9=83=A8=E6=8E=A5=E5=8F=A3=E5=8A=A0?= =?UTF-8?q?=E5=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 5 + package.json | 1 + src/api/index.js | 11 +- src/libs/util.js | 7 + src/pages/account/login/index.vue | 354 +++--- src/pages/annex/list/index.vue | 420 +++---- src/pages/article/add/index.vue | 69 +- src/pages/article/list/index.vue | 38 +- src/pages/column/add/index.vue | 6 +- src/pages/column/list/index.vue | 36 +- src/pages/role/list/index.vue | 492 ++++---- src/pages/setting/list/index.vue | 204 ++-- src/pages/setting/list/info.vue | 797 +++++++------ src/pages/user/list/index.vue | 1679 +++++++++++++++------------- src/pages/userGroup/list/index.vue | 402 ++++--- src/setting.js | 13 +- src/store/modules/user.js | 2 +- vue.config.js | 3 +- 18 files changed, 2466 insertions(+), 2073 deletions(-) diff --git a/package-lock.json b/package-lock.json index caf4e62..19b40d1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7450,6 +7450,11 @@ "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" }, + "jsencrypt": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/jsencrypt/-/jsencrypt-3.3.2.tgz", + "integrity": "sha512-arQR1R1ESGdAxY7ZheWr12wCaF2yF47v5qpB76TtV64H1pyGudk9Hvw8Y9tb/FiTIaaTRUyaSnm5T/Y53Ghm/A==" + }, "jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", diff --git a/package.json b/package.json index 81ca582..9ee2b85 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "element-ui": "^2.13.0", "image-conversion": "^2.1.1", "js-cookie": "^2.2.1", + "jsencrypt": "^3.3.2", "mavon-editor": "^2.6.17", "postcss-px2rem": "^0.3.0", "px2rem-loader": "^0.1.9", diff --git a/src/api/index.js b/src/api/index.js index 73fddd5..655c3a5 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -9,10 +9,15 @@ export default { delFile: `iasf/sysFiles/delete`, updateFile: `iasf/sysFiles/update`, dept: `iasf/sys/dept`, + deleteDept: `iasf/sys/deleteDept`, + updateDept: `iasf/sys/updateDept`, deptTree: `iasf/sys/dept/tree`, depts: `iasf/sys/dept/tree`, users: `iasf/sys/users`, user: `iasf/sys/user`, + updateUser: `iasf/sys/updateUser`, + queryUser: `iasf/sys/queryUser`, + deletedUser: `iasf/sys/deletedUser`, sendPhoneOrEmailCode: `iasf/sys/sendPhoneOrEmailCode`, updatePhoneOrEmail: `iasf/sys/updatePhoneOrEmail`, updateUserAvatars: `${host}iasf/sys/updateUserAvatars`, @@ -25,12 +30,14 @@ export default { importStaff: `${host}iasf/sys/importStaff`, roles: `iasf/sys/roles`, role: `iasf/sys/role`, + addRole: `iasf/sys/addRole`, + updateRole: `iasf/sys/updateRole`, deleteRole: `iasf/sys/role/deleted`, perTree: `iasf/sys/permission/tree/all`, groupAdd: `iasf/sys/userGroup/add`, - groupDel: `iasf/sys/userGroup/delete`, + groupDel: `iasf/sys/userGroup/deleteUserGroup`, groupList: `iasf/sys/userGroup/list`, - groupUpdate: `iasf/sys/userGroup/update`, + groupUpdate: `iasf/sys/userGroup/updateUserGroup`, site: `iasf/sys/site/list`, updateSite: `iasf/sys/site/update`, listWithTree: `iasf/sysColumn/listWithTree`, diff --git a/src/libs/util.js b/src/libs/util.js index 95a0785..ef1e5b7 100644 --- a/src/libs/util.js +++ b/src/libs/util.js @@ -2,6 +2,7 @@ import { _local } from "./util.db"; import { Message } from "element-ui"; import store from "@/store"; import Setting from '@/setting' +import JSEncrypt from "jsencrypt" // 文件后缀集合 const exts = { @@ -112,6 +113,12 @@ const util = { Message.closeAll(); return Message.error({ message, showClose: true, offset: (document.documentElement.clientHeight - 40) / 2, duration }); }, + // rsa加密 + rsa(data) { + const jse = new JSEncrypt(); // 实例化一个 jsEncrypt 对象 + jse.setPublicKey(Setting.publicKey); //配置公钥 + return jse.encrypt(JSON.stringify(data)) + }, }; export default util; \ No newline at end of file diff --git a/src/pages/account/login/index.vue b/src/pages/account/login/index.vue index 5df4c17..5278736 100644 --- a/src/pages/account/login/index.vue +++ b/src/pages/account/login/index.vue @@ -2,7 +2,8 @@
@@ -10,43 +11,46 @@

欢迎登录

- +
- +
- + - +
- 登录 + 登录
- + 回到官网
\ No newline at end of file diff --git a/src/pages/annex/list/index.vue b/src/pages/annex/list/index.vue index 34a3ba5..f56f8b6 100644 --- a/src/pages/annex/list/index.vue +++ b/src/pages/annex/list/index.vue @@ -1,237 +1,283 @@ \ No newline at end of file diff --git a/src/pages/article/add/index.vue b/src/pages/article/add/index.vue index 5cedba9..ee80850 100644 --- a/src/pages/article/add/index.vue +++ b/src/pages/article/add/index.vue @@ -893,7 +893,8 @@ export default { labels: [], labelVisible: false, originalName: '', - originColumnId: '' + originColumnId: '', + repeatMsg: '', }; }, computed: { @@ -1011,13 +1012,13 @@ export default { }, // 获取栏目 getList () { - this.$post(this.api.listWithTree, { + this.$post(this.api.listWithTree, Util.rsa({ siteId: this.site.id, columnName: '', templateId: '', typeId: '', isSort: 1 - }).then(({ data }) => { + })).then(({ data }) => { this.columns = data let { columnId } = this.$route.query // 如果是新增文章,则要默认选中栏目,因为从外面带进来的是单个id,要取到父id来选中到里面的层级 @@ -1049,20 +1050,20 @@ export default { const inner = this.form.connectionType === 1 const id = inner ? this.links[this.links.length - 1] : this.otherLink[this.otherLink.length - 1] this[inner ? 'article' : 'otherArticle'] = '' - this.$post(this.api.queryArticle, { + this.$post(this.api.queryArticle, Util.rsa({ siteId: inner ? this.site.id : this.form.siteSelection, columnIds: [id], pageNum: 1, pageSize: 1000, title: '', isDisable: 0 - }).then(({ data }) => { + })).then(({ data }) => { this[inner ? 'articles' : 'otherArticles'] = data.records.filter(e => e.isRelease) // 只显示已发布的文章 }).catch(err => { }) }, // 获取文章详情 getData () { - this.$post(`${this.api.findArticle}?id=${this.form.id}`).then(({ data }) => { + this.$post(this.api.findArticle, Util.rsa(this.form.id)).then(({ data }) => { data.lableId = data.lableId ? data.lableId.split(',').map(e => +e) : [] // if (data.activityStartTime && data.activityEndTime) data.time = [data.activityStartTime, data.activityEndTime] // 文件上传回显 @@ -1079,14 +1080,14 @@ export default { const article = columnArticle[1] || '' // 获取文章id(文章id是附在linkAddress最后面的-后面的数字) const { connectionType } = data // 获取文章 - this.$post(this.api.queryArticle, { + this.$post(this.api.queryArticle, Util.rsa({ siteId: connectionType === 1 ? this.site.id : data.siteSelection, columnIds: [column[column.length - 1]], // 截取走最后面的文章id,最后一个id就是栏目id pageNum: 1, pageSize: 1000, title: '', isDisable: 0 - }).then(res => { + })).then(res => { this[connectionType === 1 ? 'articles' : 'otherArticles'] = res.data.records // 站内链接/其他站点链接 if (connectionType === 1) { @@ -1118,7 +1119,7 @@ export default { }, // 获取栏目详情 getColumn () { - this.$post(`${this.api.findColumn}?id=${this.$route.query.columnId}`).then(({ data }) => { + this.$post(this.api.findColumn, Util.rsa(this.$route.query.columnId)).then(({ data }) => { this.columnInfo = data const { form } = this // 如果独立文章模板未启用,并且该栏目的类型为常规/子级优先,则把栏目所选的详情样式赋值到文章模板;如果栏目类型为长页或者链接,则文章模板默认为文章(23) @@ -1181,13 +1182,13 @@ export default { }, // 获取指定站点的栏目列表 getOtherColumn (val) { - this.$post(this.api.listWithTree, { + this.$post(this.api.listWithTree, Util.rsa({ siteId: this.form.siteSelection, columnName: '', templateId: '', typeId: '', isSort: 1 - }).then(({ data }) => { + })).then(({ data }) => { if (val) { this.otherArticles = [] this.otherArticle = '' @@ -1208,7 +1209,10 @@ export default { }, // 获取所属分类 getClassification () { - this.$post(`${this.api.queryClassif}?siteId=${this.site.id}&templateId=${this.columnInfo.templateId}`).then(({ data }) => { + this.$post(this.api.queryClassif, Util.rsa({ + siteId: this.site.id, + templateId: this.columnInfo.templateId + })).then(({ data }) => { this.classifications = data }).catch(err => { }) }, @@ -1234,7 +1238,7 @@ export default { this.$confirm('确定要删除吗?', '提示', { type: 'warning' }).then(() => { - this.$post(`${this.api.delClassif}?id=${row.id}`).then(res => { + this.$post(this.api.delClassif, Util.rsa(row.id)).then(res => { Util.successMsg('删除成功') this.getClassification() }).catch(res => { }) @@ -1246,15 +1250,19 @@ export default { // 提交所属分类 submitClass (row, showMsg = 1) { if (!row.classificationName) return Util.errorMsg('请输入分类名称') - this.$post(`${this.api.checkClassif}?classificationName=${row.classificationName}&siteId=${this.site.id}&classificationId=${row.id}`).then(res => { - this.$post(this.api[row.id ? 'updateClassif' : 'saveClassif'], { + this.$post(this.api.checkClassif, Util.rsa({ + classificationName: row.classificationName, + siteId: this.site.id, + classificationId: row.id + })).then(res => { + this.$post(this.api[row.id ? 'updateClassif' : 'saveClassif'], Util.rsa({ classificationName: row.classificationName, templateId: this.columnInfo.templateId, id: row.id, siteId: this.site.id, editorId: this.userId, founderId: this.userId - }).then(res => { + })).then(res => { showMsg && Util.successMsg((row.id ? '修改' : '新增') + '成功') this.getClassification() }).catch(res => { }) @@ -1282,7 +1290,7 @@ export default { // 获取标签 getLabel () { - this.$post(`${this.api.queryLabel}?siteId=${this.site.id}`).then(({ data }) => { + this.$post(this.api.queryLabel, Util.rsa(this.site.id)).then(({ data }) => { this.labels = data }).catch(err => { }) }, @@ -1308,7 +1316,7 @@ export default { this.$confirm('确定要删除吗?', '提示', { type: 'warning' }).then(() => { - this.$post(`${this.api.delLabel}?id=${row.id}`).then(res => { + this.$post(this.api.delLabel, Util.rsa(row.id)).then(res => { Util.successMsg('删除成功') this.getLabel() }).catch(res => { }) @@ -1320,14 +1328,18 @@ export default { // 提交标签 submitLabel (row, showMsg = 1) { if (!row.labelName) return Util.errorMsg('请输入主题名称') - this.$post(`${this.api.checkLabel}?labelName=${row.labelName}&siteId=${this.site.id}&labelId=${row.id}`).then(res => { - this.$post(this.api[row.id ? 'updateLabel' : 'saveLabel'], { + this.$post(this.api.checkLabel, Util.rsa({ + labelName: row.labelName, + siteId: this.site.id, + labelId: row.id, + })).then(res => { + this.$post(this.api[row.id ? 'updateLabel' : 'saveLabel'], Util.rsa({ labelName: row.labelName, id: row.id, siteId: this.site.id, editorId: this.userId, founderId: this.userId - }).then(res => { + })).then(res => { showMsg && Util.successMsg((row.id ? '修改' : '新增') + '成功') this.getLabel() }).catch(res => { }) @@ -1356,16 +1368,19 @@ export default { nameChange () { const { title, level, id } = this.form if (title && title !== this.originalName) { - this.$post(this.api.checkIfTheTitleIsRepeat, { + this.$post(this.api.checkIfTheTitleIsRepeat, Util.rsa({ siteId: this.site.id, title, id: id || '' - }).then(res => { + })).then(res => { + this.repeatMsg = '' this.nameRepeat = false }).catch(res => { + if (res.msg) this.repeatMsg = res.msg this.nameRepeat = true }) } else { + this.repeatMsg = '' this.nameRepeat = false } }, @@ -1454,7 +1469,7 @@ export default { }, // 附件删除 handleRemove (e, fileList) { - e.id ? this.$post(`${this.api.delContentFile}?id=${e.id}`).then(res => { + e.id ? this.$post(this.api.delContentFile, Util.rsa(e.id)).then(res => { this.form.fileList = fileList }).catch(res => { }) : (this.form.fileList = fileList) }, @@ -1497,14 +1512,14 @@ export default { uploadSuccessFile (res) { this.uploading-- this.form.id ? - this.$post(this.api.saveContentFile, { + this.$post(this.api.saveContentFile, Util.rsa({ 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, @@ -1554,7 +1569,7 @@ export default { if (this.submiting) return false const form = JSON.parse(JSON.stringify(this.form)) if (!form.title) return Util.errorMsg('请填写标题') - if (this.nameRepeat) return Util.errorMsg('该标题已重复!') + if (this.nameRepeat) return Util.errorMsg(this.repeatMsg) if (typeof form.fatherId === 'object') form.fatherId = form.fatherId[form.fatherId.length - 1] const tId = form.articleTemplate // 如果是发布 diff --git a/src/pages/article/list/index.vue b/src/pages/article/list/index.vue index 754972c..34752ca 100644 --- a/src/pages/article/list/index.vue +++ b/src/pages/article/list/index.vue @@ -193,7 +193,7 @@ \ No newline at end of file diff --git a/src/pages/setting/list/index.vue b/src/pages/setting/list/index.vue index 271c0f4..4933a91 100644 --- a/src/pages/setting/list/index.vue +++ b/src/pages/setting/list/index.vue @@ -3,129 +3,151 @@
- - - 点击更换头像 + + + 点击更换头像
- + \ No newline at end of file diff --git a/src/pages/setting/list/info.vue b/src/pages/setting/list/info.vue index 8bafe29..2809293 100644 --- a/src/pages/setting/list/info.vue +++ b/src/pages/setting/list/info.vue @@ -1,127 +1,193 @@ \ No newline at end of file diff --git a/src/setting.js b/src/setting.js index 78ea842..12ccf79 100644 --- a/src/setting.js +++ b/src/setting.js @@ -1,14 +1,10 @@ /** * 业务配置 * */ -const url = location.host; const isDev = process.env.NODE_ENV === 'development' // 开发环境 let host = `${location.origin}/` if (isDev) { - // host = 'http://192.168.31.52:10000/' - host = 'http://192.168.31.136:10000/' - - // host = 'http://10.10.11.7/' + host = 'http://192.168.31.51:10000/' } const Setting = { @@ -36,10 +32,6 @@ const Setting = { * localStorage里保存的vuex的key */ storeKey: "IASF_server_store", - /** - * 默认密码 - */ - initialPassword: "111aaa", /** * 多语言配置 * */ @@ -59,7 +51,8 @@ const Setting = { // 相同路由,不同参数间进行切换,是否强力更新 sameRouteForceUpdate: false, // 是否使用动态路由(即角色权限,开启了的话就会取后端返回的权限树来显示头部导肮和页面按钮) - dynamicRoute: false + dynamicRoute: true, + publicKey: 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA08Nz0zscnWtddmaNylIPt9v5ZO6U6pYyGochRrbpI+ocwoyV4E1uUu3J9/mmR8pyMBcYzE5KkBytlaiLnd6dMqo4R60aihN/TqfuI/03LzgAS/egT/Q4VB9yZSyZCmJhrgTtSX5kxotAbewp0gqsWpi+6BUYDuiwJ0WNlhDVV4FOQIppmvHh0RqYDhjiPNAuy7fEtytT+IY4rxm6LggvmNtIq5k2oLbDxEeI1GOyFHT6sLGMkmBLmHu7JYcrlyUGyGWsxh8hVame1zQsScivrZu757BTGhN4xObTivIdAbR7uFeeX4lp0X1JNtIe9TwB/aZzKJjZMPXeV7BJ01g3MQIDAQAB', }; export default Setting; diff --git a/src/store/modules/user.js b/src/store/modules/user.js index a6000c1..5eb8014 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -15,7 +15,7 @@ export default { }, mutations: { setAvatar: (state, avatar) => { - state.avatar = avatar + if (avatar) state.avatar = avatar }, setUserId: (state, userId) => { state.userId = userId diff --git a/vue.config.js b/vue.config.js index 2aaf54a..8c1c06b 100644 --- a/vue.config.js +++ b/vue.config.js @@ -15,5 +15,6 @@ module.exports = { assetsDir: Setting.assetsDir, devServer: { port: 8088 // 固定端口 - } + }, + productionSourceMap: false, } \ No newline at end of file