feat:架构代码优化

This commit is contained in:
R524809
2025-12-11 13:02:44 +08:00
parent 2c32235568
commit 3c0e2af10d
89 changed files with 2774 additions and 2816 deletions
+13 -3
View File
@@ -1,17 +1,27 @@
import config from './config/config';
const defaultPrintConfig: PrintConfig = config.printHeader as PrintConfig;
import { defaultPrintConfig } from './config/config';
import { generateUUID, getAppUUID, setAppUUID } from './utils/uuid';
// app.ts
App<IAppOption>({
globalData: {
env: 'release',
uuid: '',
printConfig: defaultPrintConfig,
},
onLaunch() {
const accountInfo = wx.getAccountInfoSync();
const env = accountInfo.miniProgram.envVersion || 'release';
this.globalData.env = env;
// 从 localStorage 读取 UUID,如果没有则生成并存储
let uuid = getAppUUID();
if (!uuid) {
uuid = generateUUID();
setAppUUID(uuid);
console.log('生成并存储 UUID', uuid);
}
this.globalData.uuid = uuid;
if (env !== 'release') {
const printConfig =
wx.getStorageSync('printConfig') || defaultPrintConfig;