Files
xuanzhi-wx/packages/demo/pages/workbench/index.js

48 lines
1.2 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const { sessionStore } = require('../../../../stores/index')
const { openStaticRoute } = require('../../../../utils/static-ux/route-map')
const MODULES = [
{
title: 'Request Layer',
description: '统一超时、重试、鉴权失效和重复提交控制,页面不直接碰 wx.request。',
badge: 'service',
actionText: '查看首页',
actionPath: '/pages/home/index'
},
{
title: 'Session Store',
description: '跨页共享的登录态只保留在 store本页的筛选和列表状态仍然是页面本地状态。',
badge: 'store',
actionText: '打开登录页',
actionPath: '/pages/login/index'
}
]
Page({
data: {
modules: MODULES,
currentUser: '访客',
localTodos: [
'把 /services/api 替换成真实后端接口',
'按业务域继续拆 packages/<domain>',
'接入 miniprogram-ci 上传非生产环境'
]
},
onLoad() {
const state = sessionStore.getState()
this.setData({
currentUser: state.userInfo?.nickname || state.userInfo?.name || '访客'
})
},
handleEntryAction(event) {
const { path } = event.detail
if (!path) {
return
}
openStaticRoute(path, wx)
}
})