Files
FreeERP.Applet/miniprogram/pages/my/my.ts

105 lines
2.2 KiB
TypeScript
Raw Normal View History

2026-01-21 17:05:30 +08:00
import { base } from '@/utils/config';
2026-02-06 15:30:07 +08:00
import { checkSesskey, loginStatusPage, post } from '@/utils/https';
2026-01-21 17:05:30 +08:00
import { getStorage, toObject } from '@/utils/util';
2025-11-28 16:49:36 +08:00
Page({
data: {
2026-01-21 17:05:30 +08:00
version: wx.getAccountInfoSync().miniProgram.version || '开发1.0',
isLogin: false,
host: base.apiHost,
user_info: {},
company_info: {},
loading: true,
// staffType: StaffType,
company_list: [],
show: false,
hideTabKeys: [],
},
2026-01-21 17:05:30 +08:00
init() {
const companyInfo = toObject(getStorage('company_info'));
this.setData({
user_info: toObject(getStorage('user_info')),
company_info: companyInfo,
});
2025-11-28 16:49:36 +08:00
},
searchChange(e: any) {
console.log(e);
},
2026-01-21 17:05:30 +08:00
// 腾讯文档
txDoc() {
return;
wx.navigateToMiniProgram({
appId: 'wxd45c635d754dbf59',
path:
`pages/detail/detail?url=` +
encodeURIComponent('https://docs.qq.com/aio/DS2NCRFFseG9Ma3Ja?p=7umJTJ6bznQtaBK2RSLmPD'),
});
},
handleLogin(e: any) {
this.setData({ isLogin: e.detail });
if (e.detail) {
this.init();
}
},
2025-11-28 16:49:36 +08:00
/**
* --
*/
2026-01-21 17:05:30 +08:00
onLoad() {
2026-02-06 15:30:07 +08:00
loginStatusPage(this);
2026-01-21 17:05:30 +08:00
},
loginOut() {
wx.showModal({
title: '确认退出?',
// content: '',
complete: (res: any) => {
if (res.confirm) {
post('Applet/loginOut').then((res: any) => {
this.setData({ isLogin: false });
checkSesskey({ showLoading: false, showError: false })
.then((res) => {})
.catch((err) => {
console.log('checkSesskey', err);
});
});
}
},
});
},
2025-11-28 16:49:36 +08:00
/**
* --
*/
onReady() {},
/**
* --
*/
onShow() {
wx.hideHomeButton();
},
2025-11-28 16:49:36 +08:00
/**
* --
*/
onHide() {},
/**
* --
*/
onUnload() {},
/**
* --
*/
onPullDownRefresh() {},
/**
*
*/
onReachBottom() {},
/**
*
*/
onShareAppMessage() {},
});