加上access_expire

This commit is contained in:
xielue 2022-12-14 18:04:26 +08:00
parent 18f82ac984
commit 4212dbda9b
4 changed files with 35 additions and 9 deletions

View File

@ -9,6 +9,9 @@ export default {
if (rule.dataRule && rule.dataRule.type == "integer") { if (rule.dataRule && rule.dataRule.type == "integer") {
data[rule.field] = parseInt(value); data[rule.field] = parseInt(value);
} }
if (rule.dataRule && rule.dataRule.type == "timestamp") {
data[rule.field] = parseInt(new Date(data[rule.field]).getTime() / 1000);
}
} }
}); });

View File

@ -13,12 +13,14 @@
</a-select> </a-select>
</template> </template>
<template #beid="{ data }"> <template #beid="{ data }">
<a-select v-model="data.beid" :disabled="isEdit" style="width: 100%"> <a-select v-model="data.beid" v-if="!isEdit" style="width: 100%">
<a-select-option v-for=" item in config_list" :key="item.id" :value="item.id"> <a-select-option v-for=" item in config_list" :key="item.id" :value="item.id">
{{ item.title }} {{ item.title }}
</a-select-option> </a-select-option>
</a-select> </a-select>
<div v-else>
{{ currentConfigName || "无" }}
</div>
</template> </template>
<template #logo="{}"> <template #logo="{}">
<div class="imagePanel"> <div class="imagePanel">
@ -80,6 +82,7 @@ export default {
companyTypeData: ['日用陶瓷厂', '卫浴工厂', '公司企业', '贸易公司', '其他'], companyTypeData: ['日用陶瓷厂', '卫浴工厂', '公司企业', '贸易公司', '其他'],
config_list: [], config_list: [],
currentConfigName: "",
currentBeid: 0, currentBeid: 0,
uploadDefaultImg: null, uploadDefaultImg: null,
@ -150,6 +153,9 @@ export default {
password: [ password: [
{ required: true, message: '请输入管理员密码' } { required: true, message: '请输入管理员密码' }
], ],
access_expire: [
{ required: true, message: '请输入登录过期截止时间' }
],
}, },
items: [ items: [
@ -164,6 +170,10 @@ export default {
{ field: 'appid', title: 'AppID', span: 24, itemRender: { name: '$input' } }, { field: 'appid', title: 'AppID', span: 24, itemRender: { name: '$input' } },
{ field: 'appsecret', title: 'AppSecret', span: 24, itemRender: { name: '$input' } }, { field: 'appsecret', title: 'AppSecret', span: 24, itemRender: { name: '$input' } },
{ field: 'token', title: '企业Token', span: 24, itemRender: { name: '$textarea', props: { placeholder: '不用填写' } } }, { field: 'token', title: '企业Token', span: 24, itemRender: { name: '$textarea', props: { placeholder: '不用填写' } } },
{ field: 'access_expire', dataRule: { type: "timestamp" }, title: '登录过期截止时间', span: 24, itemRender: { name: '$input', props: {type:"date", placeholder: '输入登录过期截止时间' } } },
] ]
}, },
@ -246,8 +256,12 @@ export default {
id: parseInt(dataId) id: parseInt(dataId)
} }
}).then(a => { }).then(a => {
if(a.data.BaseCompany.access_expire){
a.data.BaseCompany.access_expire = new Date(a.data.BaseCompany.access_expire * 1000);
}
this.formOptions.data = a.data.BaseCompany; this.formOptions.data = a.data.BaseCompany;
this.currentBeid = this.formOptions.data.beid; this.currentBeid = this.formOptions.data.beid;
this.updateCurrentConfigName();
console.log(this.currentBeid) console.log(this.currentBeid)
}).catch((a) => { }).catch((a) => {
this.$mk.error(a.data.msg); this.$mk.error(a.data.msg);
@ -275,6 +289,7 @@ export default {
} }
}).then(r => { }).then(r => {
this.config_list = r.list; this.config_list = r.list;
this.updateCurrentConfigName();
this.config_list.splice(0, 0, { id: 0, title: "请选择" }) this.config_list.splice(0, 0, { id: 0, title: "请选择" })
}); });
@ -283,6 +298,14 @@ export default {
// //
methods: { methods: {
updateCurrentConfigName() {
this.config_list.forEach(item => {
if (item.id == this.currentBeid) {
this.currentConfigName = item.title;
}
})
},
selectFile() { selectFile() {
this.$refs.imageInput.click(); this.$refs.imageInput.click();
@ -410,12 +433,12 @@ export default {
pageOptions: { pageOptions: {
config_id: this.currentBeid config_id: this.currentBeid
}, },
pageMode:"select", pageMode: "select",
width: 1000, width: 1000,
height: 870, height: 870,
dataId: 0, dataId: 0,
callback: ({ data }) => { callback: ({ data }) => {
if(!data || !data.length){ if (!data || !data.length) {
return; return;
} }
let ids = []; let ids = [];

View File

@ -74,10 +74,10 @@ async function request(url, method, params, config) { // 请求方法
function setAuthorization(auth, authType = AUTH_TYPE.BEARER) { // 设置认证信息 function setAuthorization(auth, authType = AUTH_TYPE.BEARER) { // 设置认证信息
switch (authType) { switch (authType) {
case AUTH_TYPE.BEARER: case AUTH_TYPE.BEARER:
console.log(auth)
Cookie.set(xsrfHeaderName, 'Bearer ' + auth.token, {expires: auth.expireAt}) // 设置cookie中的认证信息// 设置axios请求头 Cookie.set(xsrfHeaderName, 'Bearer ' + auth.token, {expires: auth.expireAt}) // 设置cookie中的认证信息// 设置axios请求头
// 如果 xsrfHeaderName 存在于 cookie 中,则设置到 axios 的请求头中 // 如果 xsrfHeaderName 存在于 cookie 中,则设置到 axios 的请求头中
console.log(Cookie.get(xsrfHeaderName))
axios.defaults.headers.common[xsrfHeaderName] = Cookie.get(xsrfHeaderName) axios.defaults.headers.common[xsrfHeaderName] = Cookie.get(xsrfHeaderName)
break break