import { base } from '@/utils/config'; import { checkSesskey, loginStatus, post } from '@/utils/https'; import { getStorage, toObject } from '@/utils/util'; Page({ data: { 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: [], }, init() { const companyInfo = toObject(getStorage('company_info')); this.setData({ user_info: toObject(getStorage('user_info')), company_info: companyInfo, }); }, searchChange(e: any) { console.log(e); }, // 腾讯文档 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(); } }, /** * 生命周期函数--监听页面加载 */ onLoad() { this.setData({ loading: true }); loginStatus() .then(() => { console.log('ssss'); this.setData({ isLogin: true, loading: false }); this.init(); }) .catch((err) => { this.setData({ isLogin: false, loading: false }); console.log('调用登录状态请求失败', err); }); }, 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); }); }); } }, }); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() {}, /** * 生命周期函数--监听页面显示 */ onShow() { wx.hideHomeButton(); }, /** * 生命周期函数--监听页面隐藏 */ onHide() {}, /** * 生命周期函数--监听页面卸载 */ onUnload() {}, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() {}, /** * 页面上拉触底事件的处理函数 */ onReachBottom() {}, /** * 用户点击右上角分享 */ onShareAppMessage() {}, });