兴安访客小程序对接部分迁移
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 登录方法
|
||||
export function login(username, password, code, uuid) {
|
||||
export function login(encrypt, code, uuid) {
|
||||
return request({
|
||||
url: '/auth/login',
|
||||
headers: {
|
||||
isToken: false
|
||||
},
|
||||
method: 'post',
|
||||
data: { username, password, code, uuid }
|
||||
data: { encrypt, code, uuid }
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import {login, logout, getInfo, refreshToken, validate} from '@/api/login'
|
||||
import { getToken, setToken, setExpiresIn, removeToken } from '@/utils/auth'
|
||||
import {encrypt} from "@/utils/jsencrypt";
|
||||
|
||||
const user = {
|
||||
state: {
|
||||
@@ -38,8 +39,14 @@ const user = {
|
||||
const password = userInfo.password
|
||||
const code = userInfo.code
|
||||
const uuid = userInfo.uuid
|
||||
const data = {
|
||||
username: username,
|
||||
password: password,
|
||||
};
|
||||
const encryptData = encrypt(JSON.stringify(data));
|
||||
return new Promise((resolve, reject) => {
|
||||
login(username, password, code, uuid).then(res => {
|
||||
// login(username, password, code, uuid).then(res => {
|
||||
login(encryptData, code, uuid).then(res => {
|
||||
let data = res.data
|
||||
setToken(data.access_token)
|
||||
commit('SET_TOKEN', data.access_token)
|
||||
|
||||
@@ -83,6 +83,11 @@
|
||||
<dict-tag :options="dict.type.sys_notice_type" :value="scope.row.noticeType"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="园区" align="center" prop="dictValue" width="100">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.sys_park_group" :value="scope.row.dictValue"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" align="center" prop="status" width="100">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.sys_notice_status" :value="scope.row.status"/>
|
||||
@@ -133,7 +138,8 @@
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="公告类型" prop="noticeType">
|
||||
<el-select v-model="form.noticeType" placeholder="请选择公告类型">
|
||||
<el-select v-model="form.noticeType" placeholder="请选择公告类型"
|
||||
@change="noticeTypeChange(form.noticeType)">
|
||||
<el-option
|
||||
v-for="dict in dict.type.sys_notice_type"
|
||||
:key="dict.value"
|
||||
@@ -143,7 +149,7 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="状态">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio
|
||||
@@ -154,6 +160,18 @@
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="园区" v-if="form.noticeType === '3'" prop="dictValue">
|
||||
<el-select v-model="form.dictValue" placeholder="请选择园区">
|
||||
<el-option
|
||||
v-for="dict in dict.type.sys_park_group"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="内容">
|
||||
<editor v-model="form.noticeContent" :min-height="192"/>
|
||||
@@ -174,7 +192,7 @@ import { listNotice, getNotice, delNotice, addNotice, updateNotice } from "@/api
|
||||
|
||||
export default {
|
||||
name: "Notice",
|
||||
dicts: ['sys_notice_status', 'sys_notice_type'],
|
||||
dicts: ['sys_notice_status', 'sys_notice_type', 'sys_park_group'],
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
@@ -211,8 +229,9 @@ export default {
|
||||
{ required: true, message: "公告标题不能为空", trigger: "blur" }
|
||||
],
|
||||
noticeType: [
|
||||
{ required: true, message: "公告类型不能为空", trigger: "change" }
|
||||
]
|
||||
{required: true, message: "公告类型不能为空", trigger: "change"}
|
||||
],
|
||||
dictValue: [],
|
||||
}
|
||||
};
|
||||
},
|
||||
@@ -241,7 +260,9 @@ export default {
|
||||
noticeTitle: undefined,
|
||||
noticeType: undefined,
|
||||
noticeContent: undefined,
|
||||
status: "0"
|
||||
status: "0",
|
||||
dictValue: undefined,
|
||||
dictType: undefined,
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
@@ -271,6 +292,9 @@ export default {
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const noticeId = row.noticeId || this.ids
|
||||
if (row.noticeType === '3') {
|
||||
this.rules.dictValue.push({required: true, message: "园区不能为空", trigger: "change"});
|
||||
}
|
||||
getNotice(noticeId).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
@@ -281,6 +305,9 @@ export default {
|
||||
submitForm: function() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.noticeType === '3') {
|
||||
this.form.dictType = 'sys_park_group';
|
||||
}
|
||||
if (this.form.noticeId != undefined) {
|
||||
updateNotice(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
@@ -300,13 +327,22 @@ export default {
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const noticeIds = row.noticeId || this.ids
|
||||
this.$modal.confirm('是否确认删除公告编号为"' + noticeIds + '"的数据项?').then(function() {
|
||||
this.$modal.confirm('是否确认删除公告编号为"' + noticeIds + '"的数据项?').then(function () {
|
||||
return delNotice(noticeIds);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
}
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
|
||||
noticeTypeChange(data) {
|
||||
console.log(data === '3')
|
||||
if (data === '3') {
|
||||
this.rules.dictValue.push({required: true, message: "园区不能为空", trigger: "change"});
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user