import { defineStore } from 'pinia' interface SysState { /** * 状态栏高度 */ statusBarHeight: number /** * 胶囊按钮高度 */ MenuButtonHeight: number /** * 支付成功页面查看订单按钮跳转路径 * */ paySuccessPath: string /** * 支付成功页面返回首页按钮跳转路径 */ payBackIndexPath: string /** * 支付失败页面返回首页按钮跳转路径 */ payFailPath: string /** * 透明度 */ opcity: number /** * 是否上线审核 */ isOnlineAudit: boolean } export const useSysStore = defineStore('system', { state: (): SysState => ({ statusBarHeight: 0, MenuButtonHeight: 0, paySuccessPath: '', payBackIndexPath: '', payFailPath: '', opcity: 0, isOnlineAudit: true, }), actions: { getSystemData() { const { statusBarHeight } = uni.getSystemInfoSync() const { height } = uni.getMenuButtonBoundingClientRect() this.statusBarHeight = Number(statusBarHeight) this.MenuButtonHeight = height }, /** * * @param payBackIndexPath 支付成功页面返回首页按钮跳转路径 * * @param paySuccessPath 支付成功页面查看订单按钮跳转路径 */ setPaySuccessPath(paySuccessPath: string, payBackIndexPath: string) { this.paySuccessPath = paySuccessPath this.payBackIndexPath = payBackIndexPath }, async getAudit() { const res = await Apis.sys.dictPage({ data: { typeCode: 'sys_applet' } }) this.isOnlineAudit = res.data?.list[0].value === '0' console.log(res.data?.list[0].value === '0') }, }, })