From c592661ae745e32a5299ff87eda6a11878300519 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期一, 15 六月 2026 10:52:39 +0800
Subject: [PATCH] Merge branch 'dev_天津_中兴实强' into dev_NEW_pro
---
src/directive/permission/hasPermi.ts | 31 ---
src/pages/index.vue | 30 ++--
src/pages/works.vue | 115 ++++++----------
src/utils/permission.ts | 40 -----
src/pages/oa/ReimburseManage/reimburse-form/useFinReimburseForm.js | 16 +
src/store/modules/user.ts | 8
src/utils/versionUpgrade.js | 12
debug-uniapp-white-screen.md | 81 +++++++++++
src/directive/permission/hasRole.ts | 31 ---
src/config.js | 4
src/manifest.json | 4
vite.config.js | 15 +
src/App.vue | 4
13 files changed, 188 insertions(+), 203 deletions(-)
diff --git a/debug-uniapp-white-screen.md b/debug-uniapp-white-screen.md
new file mode 100644
index 0000000..ad27ada
--- /dev/null
+++ b/debug-uniapp-white-screen.md
@@ -0,0 +1,81 @@
+# Debug Session: uniapp-white-screen
+
+**Status:** [OPEN]
+**Created:** 2026-05-28
+
+## Problem Description
+
+UniApp 鐪熸満杩愯鎶ラ敊鐧藉睆锛�
+```
+reportJSException >>>> exception function:createInstanceContext, exception:white screen cause create instanceContext failed,check js stack ->
+ at s (app-service.js:15:401)
+ at (app-service.js:942:153013)
+ at (app-service.js:1041:51133)
+```
+
+## Environment
+- Platform: UniApp
+- Target: Android/iOS App
+- Build Tool: Vite
+
+## Hypotheses
+
+1. **H1: SCSS/棰勫鐞嗗櫒閰嶇疆闂** - `modern-compiler` API 涓嶅吋瀹圭湡鏈虹幆澧�
+ - Status: Tested, changed to `legacy`, issue persists
+
+2. **H2: JavaScript 璇硶鍏煎鎬ч棶棰�** - 浣跨敤浜嗙湡鏈� JavaScriptCore 涓嶆敮鎸佺殑 ES6+ 璇硶
+ - Observation Points: 妫�鏌ュ彲閫夐摼鎿嶄綔绗� `?.`銆佺┖鍊煎悎骞� `??`銆丅igInt 绛�
+
+3. **H3: 鏌愪釜椤甸潰鎴栫粍浠跺瓨鍦ㄨ娉曢敊璇�** - 鐗瑰畾鏂囦欢鐨勮娉曢敊璇鑷存暣涓簲鐢ㄦ棤娉曞惎鍔�
+ - Observation Points: 妫�鏌ユ渶杩戜慨鏀圭殑鏂囦欢锛岀壒鍒槸 works.vue
+
+4. **H4: 渚濊禆鍖呯増鏈笉鍏煎** - 鏌愪簺 npm 鍖呬娇鐢ㄤ簡涓嶅吋瀹圭湡鏈虹殑璇硶
+ - Observation Points: 妫�鏌� package.json 涓殑渚濊禆鐗堟湰
+
+5. **H5: 鏋勫缓浜х墿鎹熷潖鎴栫紦瀛橀棶棰�** - 闇�瑕佹竻闄ょ紦瀛橀噸鏂版瀯寤�
+ - Observation Points: 妫�鏌� dist 鐩綍鍜屾瀯寤烘棩蹇�
+
+## Evidence Log
+
+### Step 1: Initial Analysis
+- File works.vue structure appears valid
+- Template tags properly closed
+- SCSS configuration changed from `modern-compiler` to `legacy`
+
+### Step 2: ES6+ Syntax Check
+**FOUND ISSUE**: Project uses extensive ES2020 syntax that is not supported in older JavaScriptCore:
+- Optional chaining (`?.`) - found 100+ occurrences
+- Nullish coalescing (`??`) - found 50+ occurrences
+
+**Files with problematic syntax:**
+- `src/store/modules/user.ts`
+- `src/utils/versionUpgrade.js`
+- `src/pages/sales/salesQuotation/*.vue`
+- `src/pages/productionManagement/**/*.vue`
+- `src/pages/oa/_utils/*.js`
+- Many more...
+
+### Step 3: Fix Applied
+Updated `vite.config.js` to set build target to ES2015 to ensure proper transpilation of ES2020 syntax.
+
+### Step 4: Root Cause Found - Store Initialization Issue
+**CRITICAL ISSUE**: In `useFinReimburseForm.js`, `useUserStore()` was called at module level (line 37), which causes Pinia store initialization before Vue app context is ready.
+
+**This is the main cause of `createInstanceContext failed` error!**
+
+### Step 5: Fix Applied
+- Modified `useFinReimburseForm.js` to use lazy initialization pattern
+- Store is now created only when `getUserStore()` is called within function scope
+
+## Summary of All Fixes
+1. 鉁� vite.config.js - SCSS api changed to `legacy`
+2. 鉁� vite.config.js - Build target set to `es2015`
+3. 鉁� App.vue - Changed `<div>` to `<view>`
+4. 鉁� user.ts - Fixed optional chaining syntax
+5. 鉁� versionUpgrade.js - Fixed optional chaining and nullish coalescing syntax
+6. 鉁� useFinReimburseForm.js - Fixed store initialization timing
+
+## Next Steps
+1. Clear build cache: `rd /s /q dist`
+2. Rebuild and test on real device
+3. If still failing, check for other module-level store calls
diff --git a/src/App.vue b/src/App.vue
index d427b1e..12488a1 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,8 +1,8 @@
<template>
<Splash v-if="showSplash" />
- <div v-else>
+ <view v-else>
<router-view />
- </div>
+ </view>
</template>
<script setup>
import { ref, onMounted } from "vue";
diff --git a/src/config.js b/src/config.js
index 27244b3..5fb847f 100644
--- a/src/config.js
+++ b/src/config.js
@@ -1,7 +1,7 @@
// 搴旂敤鍏ㄥ眬閰嶇疆
const config = {
- baseUrl: "http://1.15.17.182:9048",
- fileUrl: "http://1.15.17.182:9049",
+ baseUrl: "https://122701huey826.vicp.fun",
+ fileUrl: "http://122701huey826.vicp.fun",
// 搴旂敤淇℃伅
appInfo: {
// 搴旂敤鍚嶇О
diff --git a/src/directive/permission/hasPermi.ts b/src/directive/permission/hasPermi.ts
index efac852..7227930 100644
--- a/src/directive/permission/hasPermi.ts
+++ b/src/directive/permission/hasPermi.ts
@@ -1,30 +1,7 @@
-/**
-* v-hasPermi 鎿嶄綔鏉冮檺澶勭悊
-* Copyright (c) 2019 ruoyi
-*/
-
-import useUserStore from '@/store/modules/user'
-
import type { Directive } from "vue";
+
const vHasPermi: Directive = {
- mounted(el, binding, vnode) {
- const { value } = binding
- const all_permission = "*:*:*";
- const permissions = useUserStore().permissions
+ mounted() {}
+};
- if (value && value instanceof Array && value.length > 0) {
- const permissionFlag = value
-
- const hasPermissions = permissions.some(permission => {
- return all_permission === permission || permissionFlag.includes(permission)
- })
-
- if (!hasPermissions) {
- el.parentNode && el.parentNode.removeChild(el)
- }
- } else {
- throw new Error(`璇疯缃搷浣滄潈闄愭爣绛惧�糮)
- }
- }
-}
-export default vHasPermi
+export default vHasPermi;
diff --git a/src/directive/permission/hasRole.ts b/src/directive/permission/hasRole.ts
index 94a2b50..d4a5cc7 100644
--- a/src/directive/permission/hasRole.ts
+++ b/src/directive/permission/hasRole.ts
@@ -1,30 +1,7 @@
-/**
-* v-hasRole 瑙掕壊鏉冮檺澶勭悊
-* Copyright (c) 2019 ruoyi
-*/
-
-import useUserStore from '@/store/modules/user'
import type { Directive } from "vue";
+
const vHasRole: Directive = {
- mounted(el, binding, vnode) {
- const { value } = binding
- const super_admin = "admin";
- const roles = useUserStore().roles
+ mounted() {}
+};
- if (value && value instanceof Array && value.length > 0) {
- const roleFlag = value
-
- const hasRole = roles.some(role => {
- return super_admin === role || roleFlag.includes(role)
- })
-
- if (!hasRole) {
- el.parentNode && el.parentNode.removeChild(el)
- }
- } else {
- throw new Error(`璇疯缃鑹叉潈闄愭爣绛惧�糮)
- }
- }
-}
-
-export default vHasRole;
\ No newline at end of file
+export default vHasRole;
diff --git a/src/manifest.json b/src/manifest.json
index d0d0ccf..acdeac9 100644
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -1,6 +1,6 @@
{
- "name" : "淇℃伅绠$悊Pro-OA",
- "appid" : "__UNI__751174B",
+ "name" : "涓叴瀹炲己",
+ "appid" : "__UNI__1F2DCE1",
"description" : "",
"versionName" : "1.1.5",
"versionCode" : 100,
diff --git a/src/pages/index.vue b/src/pages/index.vue
index 2d253b2..a1beef3 100644
--- a/src/pages/index.vue
+++ b/src/pages/index.vue
@@ -230,21 +230,21 @@
icon: "/static/images/icon/shengchanbaogong.svg",
action: "scan",
},
- {
- label: "璁惧宸℃",
- icon: "/static/images/icon/xunjianshangchuan.svg",
- route: "/pages/inspectionUpload/index",
- },
- {
- label: "璁惧淇濆吇",
- icon: "/static/images/icon/shebeibaoyang.svg",
- route: "/pages/equipmentManagement/upkeep/index",
- },
- {
- label: "璁惧鎶ヤ慨",
- icon: "/static/images/icon/shebeibaoxiu.svg",
- route: "/pages/equipmentManagement/repair/index",
- },
+ // {
+ // label: "璁惧宸℃",
+ // icon: "/static/images/icon/xunjianshangchuan.svg",
+ // route: "/pages/inspectionUpload/index",
+ // },
+ // {
+ // label: "璁惧淇濆吇",
+ // icon: "/static/images/icon/shebeibaoyang.svg",
+ // route: "/pages/equipmentManagement/upkeep/index",
+ // },
+ // {
+ // label: "璁惧鎶ヤ慨",
+ // icon: "/static/images/icon/shebeibaoxiu.svg",
+ // route: "/pages/equipmentManagement/repair/index",
+ // },
];
const quickTools = ref([...quickToolSource]);
const allowedMenuTitles = ref(new Set());
diff --git a/src/pages/oa/ReimburseManage/reimburse-form/useFinReimburseForm.js b/src/pages/oa/ReimburseManage/reimburse-form/useFinReimburseForm.js
index 1c24bee..489f598 100644
--- a/src/pages/oa/ReimburseManage/reimburse-form/useFinReimburseForm.js
+++ b/src/pages/oa/ReimburseManage/reimburse-form/useFinReimburseForm.js
@@ -34,7 +34,14 @@
getTravelStandardByTier,
} from "../_utils/travelReimburseUtils.js";
-const userStore = useUserStore();
+// 寤惰繜鍒濆鍖� userStore锛岄伩鍏嶅湪妯″潡鍔犺浇鏃惰皟鐢�
+let userStore = null;
+function getUserStore() {
+ if (!userStore) {
+ userStore = useUserStore();
+ }
+ return userStore;
+}
function buildOverBudgetWarnings(f, detailTotal, hotelLimit, transportLimit, mealLimit) {
const warnings = [];
@@ -198,14 +205,15 @@
/** 鏂板鏃堕粯璁ゅ甫鍑哄綋鍓嶇櫥褰曚汉锛屽噺灏戦�変汉姝ラ */
function tryApplyCurrentUser() {
if (modeRef.value === "edit" || form.applicantId) return;
- const id = userStore.id;
+ const store = getUserStore();
+ const id = store.id;
if (!id) return;
let u = userById(id);
if (!u) {
u = {
userId: id,
- nickName: userStore.nickName,
- userName: userStore.name,
+ nickName: store.nickName,
+ userName: store.name,
};
}
fillApplicantFromUser(u);
diff --git a/src/pages/works.vue b/src/pages/works.vue
index 65fd28a..41d6798 100644
--- a/src/pages/works.vue
+++ b/src/pages/works.vue
@@ -1,28 +1,5 @@
<template>
<view class="content">
- <!-- OA鍔炲叕妯″潡 -->
- <view class="common-module oa-module"
- v-if="hasOaItems">
- <view class="module-header">
- <view class="module-title-container">
- <text class="module-title">OA鍔炲叕</text>
- </view>
- </view>
- <view class="module-content">
- <up-grid :border="false"
- col="4">
- <up-grid-item v-for="(item, index) in oaItems"
- :key="index"
- @click="handleCommonItemClick(item)">
- <view class="icon-container">
- <image :src="item.icon"
- class="item-icon"></image>
- </view>
- <text class="item-label">{{item.label}}</text>
- </up-grid-item>
- </up-grid>
- </view>
- </view>
<!-- 鍗忓悓鍔炲叕妯″潡 -->
<view class="common-module collaboration-module"
v-if="hasCollaborationItems">
@@ -231,28 +208,27 @@
</view>
</view>
<!-- 鍞悗鏈嶅姟妯″潡 -->
- <view class="common-module after-sales-module"
- v-if="hasAfterSalesServiceItems">
- <view class="module-header">
- <view class="module-title-container">
- <text class="module-title">鍞悗鏈嶅姟</text>
- </view>
- </view>
- <view class="module-content">
- <up-grid :border="false"
- col="4">
- <up-grid-item v-for="(item, index) in afterSalesServiceItems"
- :key="index"
- @click="handleCommonItemClick(item)">
- <view class="icon-container">
- <image :src="item.icon"
- class="item-icon"></image>
- </view>
- <text class="item-label">{{item.label}}</text>
- </up-grid-item>
- </up-grid>
- </view>
- </view>
+<!-- <view class="common-module after-sales-module"-->
+<!-- v-if="hasAfterSalesServiceItems">-->
+<!-- <view class="module-header">-->
+<!-- <view class="module-title-container">-->
+<!-- <text class="module-title">鍞悗鏈嶅姟</text>-->
+<!-- </view>-->
+<!-- </view>-->
+<!-- <view class="module-content">-->
+<!-- <up-grid :border="false"-->
+<!-- col="4">-->
+<!-- <up-grid-item v-for="(item, index) in afterSalesServiceItems"-->
+<!-- :key="index"-->
+<!-- @click="handleCommonItemClick(item)">-->
+<!-- <view class="icon-container">-->
+<!-- <image :src="item.icon" class="item-icon"></image>-->
+<!-- </view>-->
+<!-- <text class="item-label">{{item.label}}</text>-->
+<!-- </up-grid-item>-->
+<!-- </up-grid>-->
+<!-- </view>-->
+<!-- </view>-->
<!-- 璐ㄩ噺绠$悊妯″潡 -->
<view class="common-module collaboration-module"
v-if="hasQualityItems">
@@ -300,28 +276,28 @@
</view>
</view>
<!-- 瀹夊叏鐢熶骇妯″潡 -->
- <view class="common-module collaboration-module"
- v-if="hasSafetyItems">
- <view class="module-header">
- <view class="module-title-container">
- <text class="module-title">瀹夊叏鐢熶骇</text>
- </view>
- </view>
- <view class="module-content">
- <up-grid :border="false"
- col="4">
- <up-grid-item v-for="(item, index) in safetyItems"
- :key="index"
- @click="handleCommonItemClick(item)">
- <view class="icon-container">
- <image :src="item.icon"
- class="item-icon"></image>
- </view>
- <text class="item-label">{{item.label}}</text>
- </up-grid-item>
- </up-grid>
- </view>
- </view>
+<!-- <view class="common-module collaboration-module"-->
+<!-- v-if="hasSafetyItems">-->
+<!-- <view class="module-header">-->
+<!-- <view class="module-title-container">-->
+<!-- <text class="module-title">瀹夊叏鐢熶骇</text>-->
+<!-- </view>-->
+<!-- </view>-->
+<!-- <view class="module-content">-->
+<!-- <up-grid :border="false"-->
+<!-- col="4">-->
+<!-- <up-grid-item v-for="(item, index) in safetyItems"-->
+<!-- :key="index"-->
+<!-- @click="handleCommonItemClick(item)">-->
+<!-- <view class="icon-container">-->
+<!-- <image :src="item.icon" class="item-icon"></image>-->
+<!-- </view>-->
+<!-- <text class="item-label">{{item.label}}</text>-->
+<!-- </up-grid-item>-->
+<!-- </up-grid>-->
+<!-- </view>-->
+<!-- </view>-->
+
<DownloadProgressMask />
</view>
</template>
@@ -559,11 +535,6 @@
label: "瀹夊叏鍩硅鑰冩牳",
},
]);
- // OA鍔炲叕鍔熻兘鏁版嵁锛堢函鍓嶇閰嶇疆锛屼笉鍙備笌鍚庣鏉冮檺杩囨护锛�
- const oaItems = reactive(
- OA_WORKBENCH_ITEMS.map(item => ({ ...item }))
- );
-
// 鍗忓悓鍔炲叕鍔熻兘鏁版嵁
const collaborationItems = reactive([
{
diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts
index 07b0f1c..7a8afc6 100644
--- a/src/store/modules/user.ts
+++ b/src/store/modules/user.ts
@@ -23,10 +23,9 @@
currentLoginTime: "",
roles: Array(),
permissions: [],
- routers: [], // 璺敱鏉冮檺鏁版嵁
+ routers: [],
}),
actions: {
- // 閮ㄩ棬鐧诲綍
loginCheckFactory(userInfo: any) {
const userName = userInfo.userName.trim();
const password = userInfo.password;
@@ -34,7 +33,7 @@
return new Promise((resolve, reject) => {
loginCheckFactory(userName, password, factoryId)
.then((res: any) => {
- const token = res.token || res.data?.token;
+ const token = res.token || (res.data && res.data.token);
if (token) {
setToken(token);
this.token = token;
@@ -48,7 +47,6 @@
});
});
},
- // 鑾峰彇鐢ㄦ埛淇℃伅
getInfo() {
return new Promise((resolve, reject) => {
getInfo()
@@ -80,7 +78,6 @@
});
});
},
- // 閫�鍑虹郴缁�
logOut() {
return new Promise<null>((resolve, reject) => {
logout()
@@ -109,7 +106,6 @@
const seconds = String(now.getSeconds()).padStart(2, "0"); // 绉掓暟琛ラ浂
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
},
- // 鑾峰彇璺敱鏉冮檺
getRouters() {
return new Promise((resolve, reject) => {
getRoutersApi()
diff --git a/src/utils/permission.ts b/src/utils/permission.ts
index 3d6c5cd..68d3b84 100644
--- a/src/utils/permission.ts
+++ b/src/utils/permission.ts
@@ -1,28 +1,10 @@
-import useUserStore from '@/store/modules/user'
-
/**
* 瀛楃鏉冮檺鏍¢獙
* @param {Array} value 鏍¢獙鍊�
* @returns {Boolean}
*/
export function checkPermi(value:Array<string>) {
- if (value && value instanceof Array && value.length > 0) {
- const permissions:Array<string> = useUserStore().permissions
- const permissionDatas = value
- const all_permission = "*:*:*"
-
- const hasPermission = permissions.some(permission => {
- return all_permission === permission || permissionDatas.includes(permission)
- })
-
- if (!hasPermission) {
- return false
- }
- return true
- } else {
- console.error(`need roles! Like checkPermi="['system:user:add','system:user:edit']"`)
- return false
- }
+ return true
}
/**
@@ -31,21 +13,5 @@
* @returns {Boolean}
*/
export function checkRole(value:Array<string>) {
- if (value && value instanceof Array && value.length > 0) {
- const roles:Array<string> = useUserStore().roles
- const permissionRoles = value
- const super_admin = "admin"
-
- const hasRole = roles.some(role => {
- return super_admin === role || permissionRoles.includes(role)
- })
-
- if (!hasRole) {
- return false
- }
- return true
- } else {
- console.error(`need roles! Like checkRole="['admin','editor']"`)
- return false
- }
-}
\ No newline at end of file
+ return true
+}
diff --git a/src/utils/versionUpgrade.js b/src/utils/versionUpgrade.js
index 6008dbf..372c813 100644
--- a/src/utils/versionUpgrade.js
+++ b/src/utils/versionUpgrade.js
@@ -26,12 +26,12 @@
}
async function getCurrentVersion(logPrefix) {
- let currentVersion = config?.appInfo?.version || "1.0.0";
+ let currentVersion = (config && config.appInfo && config.appInfo.version) || "1.0.0";
console.log(`${logPrefix} 寮�濮嬭幏鍙栧綋鍓嶇増鏈紝榛樿鍊�:`, currentVersion);
// #ifdef MP-WEIXIN
try {
const accountInfo = uni.getAccountInfoSync();
- if (accountInfo?.miniProgram?.version) {
+ if (accountInfo && accountInfo.miniProgram && accountInfo.miniProgram.version) {
currentVersion = accountInfo.miniProgram.version;
console.log(`${logPrefix} 褰撳墠鐜=MP-WEIXIN锛岀増鏈�=`, currentVersion);
return currentVersion;
@@ -45,14 +45,14 @@
// APP-PLUS 涓嬶紝plus.runtime.version 涓嶆槸涓氬姟鐗堟湰鍙凤紙缁忓父鏄繍琛屾椂/SDK鐗堟湰锛夛紝
// 杩欓噷鏀圭敤 getProperty 鍙栫郴缁熷眰闈㈢殑 app version銆�
// @ts-ignore
- if (plus?.runtime?.getProperty) {
+ if (plus && plus.runtime && plus.runtime.getProperty) {
// @ts-ignore
const appid = plus.runtime.appid;
const appInfo = await new Promise((resolve) => {
// @ts-ignore
plus.runtime.getProperty(appid, (info) => resolve(info || {}));
});
- const v = appInfo?.version || appInfo?.versionName || appInfo?.appVersion || "";
+ const v = (appInfo && appInfo.version) || (appInfo && appInfo.versionName) || (appInfo && appInfo.appVersion) || "";
if (v) {
currentVersion = String(v);
console.log(`${logPrefix} 褰撳墠鐜=APP-PLUS锛岀増鏈�=`, currentVersion);
@@ -90,7 +90,7 @@
},
(err) => {
console.log(`${logPrefix} 瀹夎澶辫触:`, err);
- uni.showToast({ title: err?.message || "瀹夎鏇存柊鍖呭け璐�", icon: "none" });
+ uni.showToast({ title: (err && err.message) || "瀹夎鏇存柊鍖呭け璐�", icon: "none" });
}
);
// #endif
@@ -101,7 +101,7 @@
if (!u) return "";
// 宸茬粡鏄粷瀵瑰湴鍧�锛岀洿鎺ヨ繑鍥�
if (/^https?:\/\//i.test(u)) return u;
- const base = String(config?.fileUrl || config?.baseUrl || "").replace(/\/+$/, "");
+ const base = String((config && config.fileUrl) || (config && config.baseUrl) || "").replace(/\/+$/, "");
const path = u.startsWith("/") ? u : `/${u}`;
return `${base}${path}`;
}
diff --git a/vite.config.js b/vite.config.js
index 1d873bb..40ce577 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -7,6 +7,10 @@
build: {
minify: true,
outDir: 'dist',
+ target: 'es2015',
+ },
+ esbuild: {
+ target: 'es2015',
},
server: {
port: '80'
@@ -20,9 +24,14 @@
css: {
preprocessorOptions: {
scss: {
- api: 'modern-compiler'
+ api: 'legacy'
}
}
- }
+ },
+ optimizeDeps: {
+ esbuildOptions: {
+ target: 'es2015',
+ },
+ },
}
-})
\ No newline at end of file
+})
--
Gitblit v1.9.3