deploy
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import Message from "tdesign-miniprogram/message/index";
|
||||
import { getDict } from "../../api/dict";
|
||||
import { addFinance, getFinanceInfo, updateFinance } from "../../api/finance";
|
||||
import { getInfo } from "../../api/login";
|
||||
|
||||
// pages/add-affairs/add-affairs.ts
|
||||
const dayjs = require("dayjs");
|
||||
@ -9,6 +10,7 @@ Page({
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
permissions: [],
|
||||
defaultTime: dayjs(dayjs().format("YYYY-MM-DD")).valueOf(),
|
||||
types: [],
|
||||
form: {
|
||||
@ -56,6 +58,23 @@ Page({
|
||||
[`form.date`]: e.detail.value,
|
||||
});
|
||||
},
|
||||
loadUserInfo() {
|
||||
const permissions = getApp().globalData.permissions;
|
||||
|
||||
if (permissions) {
|
||||
this.setData({
|
||||
permissions,
|
||||
});
|
||||
} else {
|
||||
const token = getApp().globalData.authToken;
|
||||
getInfo(token).then((resp: any) => {
|
||||
this.setData({
|
||||
permissions: resp.permissions,
|
||||
});
|
||||
getApp().globalData.permissions = resp.permissions;
|
||||
});
|
||||
}
|
||||
},
|
||||
getTypeLabel(dictValue: string) {
|
||||
// @ts-ignore
|
||||
return this.data.types.find((item: any) => item.value === dictValue)?.label;
|
||||
@ -117,6 +136,7 @@ Page({
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
handleSubmitFinance() {
|
||||
const { form } = this.data;
|
||||
const result = this.validate();
|
||||
@ -208,6 +228,7 @@ Page({
|
||||
this.getFinanceDetail(option.financeId);
|
||||
}
|
||||
this.getTypeOptions();
|
||||
this.loadUserInfo();
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user