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