From 2056f69c3e63f3a5cd63244c76d9eb50333b1338 Mon Sep 17 00:00:00 2001 From: huangzhenbao <17818024429@163.com> Date: Wed, 11 Mar 2026 16:12:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=AA=E4=BA=BA=E4=B8=AD?= =?UTF-8?q?=E5=BF=83=E5=8F=8A=E6=8C=89=E8=A7=92=E8=89=B2=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- add_overlay_css.py | 26 +++ add_toast.py | 9 + fix3.py | 8 + fix_css2.py | 11 ++ fix_final.py | 8 + fix_header_css.py | 10 + fix_pages.py | Bin 0 -> 1350 bytes layouts/admin/AdminLayout.uvue | 13 +- layouts/admin/components/AdminHeader.uvue | 142 +++++++++++++- layouts/admin/router/adminComponentMap.uts | 2 + layouts/admin/router/adminRoutes.uts | 20 +- layouts/admin/store/adminNavStore.uts | 21 +++ layouts/admin/utils/role.uts | 51 ++++++ make_simple.py | 20 ++ pages.json | 7 + pages/mall/admin/userCenter/index.uvue | 195 ++++++++++++++++++++ pages/mall/admin/错误信息.txt | 110 ++++++++++- rebuild_html.py | 42 +++++ remove_broken_log.py | 8 + remove_broken_log2.py | 10 + remove_broken_log3.py | 10 + remove_broken_log4.py | 8 + replace_user.py | 25 +++ restore_content.py | 203 +++++++++++++++++++++ script4.py | 4 + script5.py | 4 + script6.py | 4 + script7.py | 6 + script8.py | 5 + script9.py | 5 + simplify.py | 10 + simplify2.py | 10 + simplify3.py | 8 + simplify4.py | 9 + simplify5.py | 10 + simplify6.py | 9 + simplify7.py | 9 + simplify8.py | 10 + simplify9.py | 9 + temp.py | Bin 0 -> 1306 bytes test_html.py | 5 + test_main.py | 8 + test_main2.py | 6 + test_replace_header.py | 25 +++ test_replace_map.py | 16 ++ 45 files changed, 1108 insertions(+), 23 deletions(-) create mode 100644 add_overlay_css.py create mode 100644 add_toast.py create mode 100644 fix3.py create mode 100644 fix_css2.py create mode 100644 fix_final.py create mode 100644 fix_header_css.py create mode 100644 fix_pages.py create mode 100644 layouts/admin/utils/role.uts create mode 100644 make_simple.py create mode 100644 pages/mall/admin/userCenter/index.uvue create mode 100644 rebuild_html.py create mode 100644 remove_broken_log.py create mode 100644 remove_broken_log2.py create mode 100644 remove_broken_log3.py create mode 100644 remove_broken_log4.py create mode 100644 replace_user.py create mode 100644 restore_content.py create mode 100644 script4.py create mode 100644 script5.py create mode 100644 script6.py create mode 100644 script7.py create mode 100644 script8.py create mode 100644 script9.py create mode 100644 simplify.py create mode 100644 simplify2.py create mode 100644 simplify3.py create mode 100644 simplify4.py create mode 100644 simplify5.py create mode 100644 simplify6.py create mode 100644 simplify7.py create mode 100644 simplify8.py create mode 100644 simplify9.py create mode 100644 temp.py create mode 100644 test_html.py create mode 100644 test_main.py create mode 100644 test_main2.py create mode 100644 test_replace_header.py create mode 100644 test_replace_map.py diff --git a/add_overlay_css.py b/add_overlay_css.py new file mode 100644 index 00000000..0de4ef42 --- /dev/null +++ b/add_overlay_css.py @@ -0,0 +1,26 @@ +import codecs +file_path = r'd:\\骅锋\\mall\\layouts\\admin\\components\\AdminHeader.uvue' +with codecs.open(file_path, 'r', 'utf-8') as f: + text = f.read() + +overlay_css = r''' +.user-dropdown-overlay { + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + z-index: 1000; + background-color: transparent; +} +''' +if '.user-dropdown-overlay' not in text: + text = text.replace('', overlay_css + '\n') + +text = text.replace('z-index: 99;', 'z-index: 1001;') +text = text.replace('z-index: 90;', 'z-index: 1001;') +text = text.replace('z-index: 150;', 'z-index: 1001;') +text = text.replace('.user-dropdown {', '.user-dropdown {\n z-index: 1002;') + +with codecs.open(file_path, 'w', 'utf-8') as f: + f.write(text) diff --git a/add_toast.py b/add_toast.py new file mode 100644 index 00000000..844c62c7 --- /dev/null +++ b/add_toast.py @@ -0,0 +1,9 @@ +import codecs +file_path = r'd:\\骅锋\\mall\\layouts\\admin\\components\\AdminHeader.uvue' +with codecs.open(file_path, 'r', 'utf-8') as f: + text = f.read() + +text = text.replace('function goToUserCenter() {', 'function goToUserCenter() {\n uni.showToast({ title: "尝试打开个人中心...", icon: "none", duration: 2000 });\n console.log([AdminHeader] goToUserCenter called);') + +with codecs.open(file_path, 'w', 'utf-8') as f: + f.write(text) diff --git a/fix3.py b/fix3.py new file mode 100644 index 00000000..b87863dc --- /dev/null +++ b/fix3.py @@ -0,0 +1,8 @@ +import codecs +file_path = r'd:\\骅锋\\mall\\pages.json' +with codecs.open(file_path, 'r', 'utf-8') as f: + text = f.read() + +text = text.replace('custom\"\n }\n }\n },', 'custom\"\n }\n },') +with codecs.open(file_path, 'w', 'utf-8') as f: + f.write(text) diff --git a/fix_css2.py b/fix_css2.py new file mode 100644 index 00000000..459acc4e --- /dev/null +++ b/fix_css2.py @@ -0,0 +1,11 @@ +import codecs +import re +file_path = r'd:\\骅锋\\mall\\layouts\\admin\\components\\AdminHeader.uvue' +with codecs.open(file_path, 'r', 'utf-8') as f: + text = f.read() + +text = re.sub(r'(\.header\s*\{)', r'\1\n position: relative;\n z-index: 150;', text) +text = re.sub(r'(\.header-right\s*\{)', r'\1\n position: relative;\n z-index: 100;\n pointer-events: auto;', text) + +with codecs.open(file_path, 'w', 'utf-8') as f: + f.write(text) diff --git a/fix_final.py b/fix_final.py new file mode 100644 index 00000000..1c5e3093 --- /dev/null +++ b/fix_final.py @@ -0,0 +1,8 @@ +import codecs +file_path = r'd:\\骅锋\\mall\\pages.json' +with codecs.open(file_path, 'r', 'utf-8') as f: + text = f.read() + +text = text.replace('custom\"\n },{', 'custom\"\n }\n },\n {') +with codecs.open(file_path, 'w', 'utf-8') as f: + f.write(text) diff --git a/fix_header_css.py b/fix_header_css.py new file mode 100644 index 00000000..3e99240f --- /dev/null +++ b/fix_header_css.py @@ -0,0 +1,10 @@ +import codecs +file_path = r'd:\\骅锋\\mall\\layouts\\admin\\components\\AdminHeader.uvue' +with codecs.open(file_path, 'r', 'utf-8') as f: + text = f.read() + +text = text.replace('.header-right{ \n display:flex;', '.header-right{ \n position: relative;\n z-index: 99;\n pointer-events: auto;\n display:flex;') +text = text.replace('.header{\n height: 56px;', '.header{\n position: relative;\n z-index: 90;\n height: 56px;') + +with codecs.open(file_path, 'w', 'utf-8') as f: + f.write(text) diff --git a/fix_pages.py b/fix_pages.py new file mode 100644 index 0000000000000000000000000000000000000000..badd11b8294dfb059dfe8f170f5b9f0342ccfe80 GIT binary patch literal 1350 zcmbW1!EVz)5QgU*#5-8xU{l&e+)$+osg-(+kXlX{RR%jvY3)RgLyD>#c?2#z3Rm8% z@cpxKn>5Y=w6b@+JNwW4|IGT&eb26}w5d(3w#Fjfh4mOC)^D&c*vr@%vv=hCvE_DX zDdYRkXFoKTc-$~#%lndZGwa(I-V>`VcEkmU0cV0&!FtjWWuF)^S;QtwUZ26pIa`5y z#QGeRksa6@?3egtM2T2ABucazI#c1N^J1mUM`R>+8E6S7#qtH~r;eRtjX71~@ovQ- z!n5!kE6@GPQF|a}AczL5(|}neFj@PPA6Z)b$JNk9rLrbR2k&rRO!+ z%4)F6x3F7qKX`=H&g>&`-tx7CTToo=&N*K&f1*AUw7kY{u%z2`RfnA1D!dl3S@&z} z9eXwI@M`td9BQqKick9;YQKxi95tlV3GYy!+BW&@Z$+7r?>Fzo5a($gA(sk1Us2|g zxnWlQkFjeMP~WMS&v|aK+kE$izlI0H-xn#pw#jWb=Gl{MQZyASX7+>$;)x?qZ<5P4sZ%{^c*Q@V@*1zkqK1f(%vv0xsRGLtaz& YQ%@#DeGjMHwJn$ literal 0 HcmV?d00001 diff --git a/layouts/admin/AdminLayout.uvue b/layouts/admin/AdminLayout.uvue index 027508be..98c7fb55 100644 --- a/layouts/admin/AdminLayout.uvue +++ b/layouts/admin/AdminLayout.uvue @@ -63,8 +63,8 @@ - - + + @@ -116,6 +116,7 @@ import { import type { TabItem } from '@/layouts/admin/store/adminNavStore.uts' import { getComponent } from '@/layouts/admin/router/adminComponentMap.uts' +import { hasAdminModuleAccess } from '@/layouts/admin/utils/role.uts' const props = defineProps({ currentPage: { @@ -131,6 +132,12 @@ const SUB_W = 200 // 页面加载状态 const isPageLoading = ref(false) +const hasAccess = computed(() => { + + + return hasAdminModuleAccess(activeTopMenuId.value) +}) + const hasNotification = ref(false) /** @@ -258,6 +265,8 @@ const breadcrumb = computed>(() => { // 当前渲染的组件 const currentComponent = computed(() => { + + const route = findRouteById(activeRouteId.value) if (!route) return null return getComponent(route.componentKey) diff --git a/layouts/admin/components/AdminHeader.uvue b/layouts/admin/components/AdminHeader.uvue index 45f41b01..56ee986c 100644 --- a/layouts/admin/components/AdminHeader.uvue +++ b/layouts/admin/components/AdminHeader.uvue @@ -25,24 +25,74 @@ 🔍 - + 🔔 + + + + +''' +with codecs.open(r'd:\\骅锋\\mall\\pages\\mall\\admin\\userCenter\\index.uvue', 'w', 'utf-8') as f: + f.write(content) diff --git a/pages.json b/pages.json index 1b0d0218..1e36a80c 100644 --- a/pages.json +++ b/pages.json @@ -14,6 +14,13 @@ "navigationStyle": "custom" } }, + { + "path": "pages/mall/admin/userCenter/index", + "style": { + "navigationBarTitleText": "个人中心", + "navigationStyle": "custom" + } + }, { "path": "pages/user/boot", "style": { diff --git a/pages/mall/admin/userCenter/index.uvue b/pages/mall/admin/userCenter/index.uvue new file mode 100644 index 00000000..06229711 --- /dev/null +++ b/pages/mall/admin/userCenter/index.uvue @@ -0,0 +1,195 @@ + + + + + diff --git a/pages/mall/admin/错误信息.txt b/pages/mall/admin/错误信息.txt index 98222592..519a906e 100644 --- a/pages/mall/admin/错误信息.txt +++ b/pages/mall/admin/错误信息.txt @@ -1,10 +1,100 @@ -signIn result: -AkSupaSignInResult {access_token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI4Y…HNlfQ.5BvQq26lJUF23AEglMvA7EzJZvYN_hrp1Q2JA6o0s-w', refresh_token: 'ehhxnwgvgeyk', expires_at: 1773136334, user: UTSJSONObject2, token_type: 'bearer', …} -login.uvue:175 🔍 开始校验商家端角色 -> UID: 8bdf11be-2838-4d96-8552-0949cde076d4, Email: test19@163.com -login.uvue:216 ❌ 查询角色过程异常: TypeError: res.getData is not a function - at login.uvue:180:23 - at Generator.next () -login.uvue:435 登录错误: Error: 商家身份校验失败,请联系管理员检查用户数据 - at login.uvue:221:9 - at Generator.next ()。 - 打印这些东西 \ No newline at end of file +GET http://localhost:5173/layouts/admin/AdminLayout.uvue?t=1773216297014&import net::ERR_ABORTED 500 (Internal Server Error) +main.uts:16 [Vue warn]: Unhandled error during execution of async component loader + at +at +at +at +at +at +at +at +warnHandler @ uni-h5.es.js:19975 +callWithErrorHandling @ vue.runtime.esm.js:1381 +warn$1 @ vue.runtime.esm.js:1207 +logError @ vue.runtime.esm.js:1438 +errorHandler @ uni-h5.es.js:19600 +callWithErrorHandling @ vue.runtime.esm.js:1381 +handleError @ vue.runtime.esm.js:1421 +onError @ vue.runtime.esm.js:3724 +(anonymous) @ vue.runtime.esm.js:3767 +Promise.catch +setup @ vue.runtime.esm.js:3766 +callWithErrorHandling @ vue.runtime.esm.js:1381 +setupStatefulComponent @ vue.runtime.esm.js:8985 +setupComponent @ vue.runtime.esm.js:8946 +mountComponent @ vue.runtime.esm.js:7262 +processComponent @ vue.runtime.esm.js:7228 +patch @ vue.runtime.esm.js:6694 +mountChildren @ vue.runtime.esm.js:6942 +processFragment @ vue.runtime.esm.js:7158 +patch @ vue.runtime.esm.js:6668 +mountChildren @ vue.runtime.esm.js:6942 +processFragment @ vue.runtime.esm.js:7158 +patch @ vue.runtime.esm.js:6668 +mountChildren @ vue.runtime.esm.js:6942 +mountElement @ vue.runtime.esm.js:6849 +processElement @ vue.runtime.esm.js:6814 +patch @ vue.runtime.esm.js:6682 +mountChildren @ vue.runtime.esm.js:6942 +mountElement @ vue.runtime.esm.js:6849 +processElement @ vue.runtime.esm.js:6814 +patch @ vue.runtime.esm.js:6682 +mountChildren @ vue.runtime.esm.js:6942 +processFragment @ vue.runtime.esm.js:7158 +patch @ vue.runtime.esm.js:6668 +componentUpdateFn @ vue.runtime.esm.js:7372 +run @ vue.runtime.esm.js:153 +instance.update @ vue.runtime.esm.js:7497 +setupRenderEffect @ vue.runtime.esm.js:7507 +mountComponent @ vue.runtime.esm.js:7274 +processComponent @ vue.runtime.esm.js:7228 +patch @ vue.runtime.esm.js:6694 +mountChildren @ vue.runtime.esm.js:6942 +mountElement @ vue.runtime.esm.js:6849 +processElement @ vue.runtime.esm.js:6814 +patch @ vue.runtime.esm.js:6682 +componentUpdateFn @ vue.runtime.esm.js:7372 +run @ vue.runtime.esm.js:153 +instance.update @ vue.runtime.esm.js:7497 +setupRenderEffect @ vue.runtime.esm.js:7507 +mountComponent @ vue.runtime.esm.js:7274 +processComponent @ vue.runtime.esm.js:7228 +patch @ vue.runtime.esm.js:6694 +componentUpdateFn @ vue.runtime.esm.js:7372 +run @ vue.runtime.esm.js:153 +instance.update @ vue.runtime.esm.js:7497 +setupRenderEffect @ vue.runtime.esm.js:7507 +mountComponent @ vue.runtime.esm.js:7274 +processComponent @ vue.runtime.esm.js:7228 +patch @ vue.runtime.esm.js:6694 +componentUpdateFn @ vue.runtime.esm.js:7453 +run @ vue.runtime.esm.js:153 +instance.update @ vue.runtime.esm.js:7497 +updateComponent @ vue.runtime.esm.js:7305 +processComponent @ vue.runtime.esm.js:7239 +patch @ vue.runtime.esm.js:6694 +componentUpdateFn @ vue.runtime.esm.js:7453 +run @ vue.runtime.esm.js:153 +instance.update @ vue.runtime.esm.js:7497 +callWithErrorHandling @ vue.runtime.esm.js:1381 +flushJobs @ vue.runtime.esm.js:1585 +Promise.then +queueFlush @ vue.runtime.esm.js:1494 +queueJob @ vue.runtime.esm.js:1488 +scheduler @ vue.runtime.esm.js:3179 +resetScheduling @ vue.runtime.esm.js:236 +triggerEffects @ vue.runtime.esm.js:280 +triggerRefValue @ vue.runtime.esm.js:1033 +set value @ vue.runtime.esm.js:1078 +finalizeNavigation @ vue-router.mjs?v=ed041164:2474 +(anonymous) @ vue-router.mjs?v=ed041164:2384 +Promise.then +pushWithRedirect @ vue-router.mjs?v=ed041164:2352 +push @ vue-router.mjs?v=ed041164:2278 +install @ vue-router.mjs?v=ed041164:2631 +use @ vue.runtime.esm.js:5190 +initRouter @ uni-h5.es.js:19886 +install @ uni-h5.es.js:19955 +use @ vue.runtime.esm.js:5190 +(anonymous) @ main.uts:16 +main.uts:16 TypeError: Failed to fetch dynamically imported module: http://localhost:5173/pages/mall/admin/homePage/index.uvue?t=1773216297014&import \ No newline at end of file diff --git a/rebuild_html.py b/rebuild_html.py new file mode 100644 index 00000000..0e168349 --- /dev/null +++ b/rebuild_html.py @@ -0,0 +1,42 @@ +import codecs +file_path = r'd:\\骅锋\\mall\\layouts\\admin\\components\\AdminHeader.uvue' +with codecs.open(file_path, 'r', 'utf-8') as f: + text = f.read() + +# I will replace the user-profile-container entirely with a solid implementation, including the overlay. +old_html = r''' + ''' + +new_html = r''' + + + + ''' + +text = text.replace(old_html, new_html) + +# Add closeUserMenu to script if doesn't exist +if 'function closeUserMenu' not in text: + text = text.replace('function toggleUserMenu() {', 'function closeUserMenu() {\n showUserMenu.value = false\n}\n\nfunction toggleUserMenu() {') + +# Adjust goToUserCenter to remove toast, just keep logic +text = text.replace('uni.showToast({ title: "尝试打开个人中心...", icon: "none", duration: 2000 });\n console.log([AdminHeader] goToUserCenter called);\n console.log([AdminHeader] goToUserCenter called);', '') + +with codecs.open(file_path, 'w', 'utf-8') as f: + f.write(text) diff --git a/remove_broken_log.py b/remove_broken_log.py new file mode 100644 index 00000000..74aef048 --- /dev/null +++ b/remove_broken_log.py @@ -0,0 +1,8 @@ +import codecs +file_path = r'd:\\骅锋\\mall\\layouts\\admin\\AdminLayout.uvue' +with codecs.open(file_path, 'r', 'utf-8') as f: + text = f.read() + +text = text.replace('console.log([AdminLayout] Computing component for activeRouteId: );', '') +with codecs.open(file_path, 'w', 'utf-8') as f: + f.write(text) diff --git a/remove_broken_log2.py b/remove_broken_log2.py new file mode 100644 index 00000000..704f510b --- /dev/null +++ b/remove_broken_log2.py @@ -0,0 +1,10 @@ +import codecs +file_path = r'd:\\骅锋\\mall\\layouts\\admin\\store\\adminNavStore.uts' +with codecs.open(file_path, 'r', 'utf-8') as f: + text = f.read() + +text = text.replace('console.log([AdminNavStore] openRoute called with: );', '') +text = text.replace('console.log([AdminNavStore] activeRouteId set to: );', '') + +with codecs.open(file_path, 'w', 'utf-8') as f: + f.write(text) diff --git a/remove_broken_log3.py b/remove_broken_log3.py new file mode 100644 index 00000000..77790960 --- /dev/null +++ b/remove_broken_log3.py @@ -0,0 +1,10 @@ +import codecs +file_path = r'd:\\骅锋\\mall\\layouts\\admin\\components\\AdminHeader.uvue' +with codecs.open(file_path, 'r', 'utf-8') as f: + text = f.read() + +text = text.replace('console.log([AdminHeader] goToUserCenter called)', 'console.log([AdminHeader] goToUserCenter called)') +text = text.replace('console.log([AdminHeader] goToUserCenter called);', '') + +with codecs.open(file_path, 'w', 'utf-8') as f: + f.write(text) diff --git a/remove_broken_log4.py b/remove_broken_log4.py new file mode 100644 index 00000000..9a568053 --- /dev/null +++ b/remove_broken_log4.py @@ -0,0 +1,8 @@ +import codecs +file_path = r'd:\\骅锋\\mall\\layouts\\admin\\AdminLayout.uvue' +with codecs.open(file_path, 'r', 'utf-8') as f: + text = f.read() + +text = text.replace('console.log([AdminLayout] Computing hasAccess for: );', '') +with codecs.open(file_path, 'w', 'utf-8') as f: + f.write(text) diff --git a/replace_user.py b/replace_user.py new file mode 100644 index 00000000..d1ce29fa --- /dev/null +++ b/replace_user.py @@ -0,0 +1,25 @@ +import codecs + +content = ''' + + + + +''' + +with codecs.open(r'd:\\骅锋\\mall\\pages\\mall\\admin\\userCenter\\index.uvue', 'w', 'utf-8') as f: + f.write(content) + +print("userCenter replaced.") diff --git a/restore_content.py b/restore_content.py new file mode 100644 index 00000000..70fae81c --- /dev/null +++ b/restore_content.py @@ -0,0 +1,203 @@ +import codecs + +content = ''' + + + + +''' + +with codecs.open(r'd:\\骅锋\\mall\\pages\\mall\\admin\\userCenter\\index.uvue', 'w', 'utf-8') as f: + f.write(content) + +print("个人中心内容重置完成!") diff --git a/script4.py b/script4.py new file mode 100644 index 00000000..8430ebb4 --- /dev/null +++ b/script4.py @@ -0,0 +1,4 @@ +import codecs +for line in codecs.open(r'd:\骅锋\mall\layouts\admin\store\adminNavStore.uts', 'r', 'utf-8'): + if 'findRouteById' in line: + print(line.strip()) diff --git a/script5.py b/script5.py new file mode 100644 index 00000000..4f7723a3 --- /dev/null +++ b/script5.py @@ -0,0 +1,4 @@ +import codecs +for line in codecs.open(r'd:\骅锋\mall\layouts\admin\router\adminRoutes.uts', 'r', 'utf-8'): + if 'function findRouteById' in line: + print('Found!') diff --git a/script6.py b/script6.py new file mode 100644 index 00000000..cffabf3a --- /dev/null +++ b/script6.py @@ -0,0 +1,4 @@ +import codecs +text = codecs.open(r'd:\骅锋\mall\layouts\admin\router\adminRoutes.uts', 'r', 'utf-8').read() +start = text.find('function findRouteById') +print(text[start:start+400]) diff --git a/script7.py b/script7.py new file mode 100644 index 00000000..44119fe3 --- /dev/null +++ b/script7.py @@ -0,0 +1,6 @@ +import codecs +text = codecs.open(r'd:\骅锋\mall\layouts\admin\router\adminRoutes.uts', 'r', 'utf-8').read() +start = text.find('const routes') +if start == -1: + start = text.find('const adminRoutes') +print(text[start:start+400]) diff --git a/script8.py b/script8.py new file mode 100644 index 00000000..09b25df8 --- /dev/null +++ b/script8.py @@ -0,0 +1,5 @@ +import codecs +text = codecs.open(r'd:\骅锋\mall\layouts\admin\AdminLayout.uvue', 'r', 'utf-8').read() +for line in text.split('\n'): + if 'activeRouteId' in line and 'import' in line: + print(line) diff --git a/script9.py b/script9.py new file mode 100644 index 00000000..47360558 --- /dev/null +++ b/script9.py @@ -0,0 +1,5 @@ +import codecs +text = codecs.open(r'd:\骅锋\mall\layouts\admin\AdminLayout.uvue', 'r', 'utf-8').read() +for line in text.split('\n'): + if 'activeRouteId' in line: + print(line.strip()) diff --git a/simplify.py b/simplify.py new file mode 100644 index 00000000..90faf73a --- /dev/null +++ b/simplify.py @@ -0,0 +1,10 @@ +import codecs +file_path = r'd:\\骅锋\\mall\\layouts\\admin\\components\\AdminHeader.uvue' +with codecs.open(file_path, 'r', 'utf-8') as f: + text = f.read() + +text = text.replace('@click="toggleUserMenu"', '@click="goToUserCenter"') +text = text.replace('function goToUserCenter() {', 'function goToUserCenter() {\n console.log("[AdminHeader] goToUserCenter called");') + +with codecs.open(file_path, 'w', 'utf-8') as f: + f.write(text) diff --git a/simplify2.py b/simplify2.py new file mode 100644 index 00000000..ca23bf5d --- /dev/null +++ b/simplify2.py @@ -0,0 +1,10 @@ +import codecs +file_path = r'd:\\骅锋\\mall\\layouts\\admin\\store\\adminNavStore.uts' +with codecs.open(file_path, 'r', 'utf-8') as f: + text = f.read() + +text = text.replace('function openRoute(routeId: string, addTab: boolean = true): void {', 'function openRoute(routeId: string, addTab: boolean = true): void {\n console.log([AdminNavStore] openRoute called with: );') +text = text.replace('activeRouteId.value = routeId', 'activeRouteId.value = routeId\n console.log([AdminNavStore] activeRouteId set to: );') + +with codecs.open(file_path, 'w', 'utf-8') as f: + f.write(text) diff --git a/simplify3.py b/simplify3.py new file mode 100644 index 00000000..3f5b5be1 --- /dev/null +++ b/simplify3.py @@ -0,0 +1,8 @@ +import codecs +file_path = r'd:\\骅锋\\mall\\layouts\\admin\\AdminLayout.uvue' +with codecs.open(file_path, 'r', 'utf-8') as f: + text = f.read() + +text = text.replace('const currentComponent = computed(() => {', 'const currentComponent = computed(() => {\n console.log([AdminLayout] Computing component for activeRouteId: );') +with codecs.open(file_path, 'w', 'utf-8') as f: + f.write(text) diff --git a/simplify4.py b/simplify4.py new file mode 100644 index 00000000..59ddb972 --- /dev/null +++ b/simplify4.py @@ -0,0 +1,9 @@ +import codecs +file_path = r'd:\\骅锋\\mall\\layouts\\admin\\components\\AdminHeader.uvue' +with codecs.open(file_path, 'r', 'utf-8') as f: + text = f.read() + +text = text.replace('.user-profile-container {\n position: relative;', '.user-profile-container {\n position: relative;\n z-index: 100;\n pointer-events: auto;') + +with codecs.open(file_path, 'w', 'utf-8') as f: + f.write(text) diff --git a/simplify5.py b/simplify5.py new file mode 100644 index 00000000..aaf5d6a8 --- /dev/null +++ b/simplify5.py @@ -0,0 +1,10 @@ +import codecs +file_path = r'd:\\骅锋\\mall\\layouts\\admin\\store\\adminNavStore.uts' +with codecs.open(file_path, 'r', 'utf-8') as f: + text = f.read() + +text = text.replace('console.log([AdminNavStore] openRoute called with: );', 'console.log([AdminNavStore] openRoute called with: );') +text = text.replace('console.log([AdminNavStore] activeRouteId set to: );', 'console.log([AdminNavStore] activeRouteId set to: );') + +with codecs.open(file_path, 'w', 'utf-8') as f: + f.write(text) diff --git a/simplify6.py b/simplify6.py new file mode 100644 index 00000000..efb4348d --- /dev/null +++ b/simplify6.py @@ -0,0 +1,9 @@ +import codecs +file_path = r'd:\\骅锋\\mall\\layouts\\admin\\AdminLayout.uvue' +with codecs.open(file_path, 'r', 'utf-8') as f: + text = f.read() + +text = text.replace('console.log([AdminLayout] Computing component for activeRouteId: );', 'console.log([AdminLayout] Computing component for activeRouteId: );') + +with codecs.open(file_path, 'w', 'utf-8') as f: + f.write(text) diff --git a/simplify7.py b/simplify7.py new file mode 100644 index 00000000..3b54ba29 --- /dev/null +++ b/simplify7.py @@ -0,0 +1,9 @@ +import codecs +file_path = r'd:\\骅锋\\mall\\layouts\\admin\\AdminLayout.uvue' +with codecs.open(file_path, 'r', 'utf-8') as f: + text = f.read() + +text = text.replace('console.log([AdminLayout] Computing component for activeRouteId: )', 'console.log([AdminLayout] Computing component for activeRouteId: )') +text = text.replace('console.log([AdminHeader] goToUserCenter called)', 'console.log([AdminHeader] goToUserCenter called)') +with codecs.open(file_path, 'w', 'utf-8') as f: + f.write(text) diff --git a/simplify8.py b/simplify8.py new file mode 100644 index 00000000..aaf5d6a8 --- /dev/null +++ b/simplify8.py @@ -0,0 +1,10 @@ +import codecs +file_path = r'd:\\骅锋\\mall\\layouts\\admin\\store\\adminNavStore.uts' +with codecs.open(file_path, 'r', 'utf-8') as f: + text = f.read() + +text = text.replace('console.log([AdminNavStore] openRoute called with: );', 'console.log([AdminNavStore] openRoute called with: );') +text = text.replace('console.log([AdminNavStore] activeRouteId set to: );', 'console.log([AdminNavStore] activeRouteId set to: );') + +with codecs.open(file_path, 'w', 'utf-8') as f: + f.write(text) diff --git a/simplify9.py b/simplify9.py new file mode 100644 index 00000000..a3029744 --- /dev/null +++ b/simplify9.py @@ -0,0 +1,9 @@ +import codecs +file_path = r'd:\\骅锋\\mall\\layouts\\admin\\AdminLayout.uvue' +with codecs.open(file_path, 'r', 'utf-8') as f: + text = f.read() + +text = text.replace('const hasAccess = computed(() => {', 'const hasAccess = computed(() => {\n console.log([AdminLayout] Computing hasAccess for: );') + +with codecs.open(file_path, 'w', 'utf-8') as f: + f.write(text) diff --git a/temp.py b/temp.py new file mode 100644 index 0000000000000000000000000000000000000000..7eea60aeb076426abdaba0c49545bc26a7a0893c GIT binary patch literal 1306 zcmbW0L2uJQ5QXO)#D8#4Hf@@S8>)nm+Iv)qA`Tc;Y3sCw#)%vU7oi;a30(LoT=`$X z_h!3|?NSLL%l7W>@ z8^)*9n^NtHdM|k^OWAv1InUScPrm6tC*y`kV`X2mZ)KzV{wehu>V+!p?jw*a$u2GX zOUEJoQtuc>Ybwla-(C=X#@duF36TTpCwEUxwOeN|v@=kM(G<)Xd&I0}Ryjs#6gg#J z|H8YnUA|Ari@e23QE?8dTaM#U3|j_ zT~_3Mc0YtZeH;Nx3ENLFz2sl>m-h}CS9Zdz_WdXH)A>ZayOST2{mIYM9Clr9kJo(N zLzAPFSkO4L)(D;z9oIM| zv*+%}Ju)7ip}NIr*Pp6A0{Pkzw4Eu(2V@$>U2^a>uHJTuD~av6m*c$6;Q#Mlba{i87k&-}{~aRAEpU!J+ve2WH{l!-Kf5X2 Kg8$=g-Q_', text) +if match: + print(match.group(0)[:500]) diff --git a/test_main2.py b/test_main2.py new file mode 100644 index 00000000..d56f9b75 --- /dev/null +++ b/test_main2.py @@ -0,0 +1,6 @@ +import codecs +with codecs.open(r'd:\\骅锋\\mall\\layouts\\admin\\AdminLayout.uvue', 'r', 'utf-8') as f: + text = f.read() + +start = text.find('class="main-content"') +print(text[start-50:start+300]) diff --git a/test_replace_header.py b/test_replace_header.py new file mode 100644 index 00000000..5580426b --- /dev/null +++ b/test_replace_header.py @@ -0,0 +1,25 @@ +import codecs +import re + +with open('layouts/admin/components/AdminHeader.uvue', 'r', encoding='utf-8') as f: + text = f.read() + +new_html = r""" \n 🔔\n \n \n \n \n """ + +new_html = new_html.replace(r'\n', '\n') + +text = re.sub(r'[\s\S]*?<\/view>\s*<\/view>', new_html + '\n ', text) + +new_script = r"""import { ref, computed } from 'vue'\nimport {\n toggleSubSider,\n showSubSider,\n layoutMode,\n isOverlayVisible,\n isMobileMenuOpen,\n openRoute\n} from '@/layouts/admin/store/adminNavStore.uts'\n\nconst showUserMenu = ref(false)\n\nfunction toggleUserMenu() {\n showUserMenu.value = !showUserMenu.value\n}\n\nfunction goToUserCenter() {\n showUserMenu.value = false\n openRoute('demo_user_center')\n}\n\nfunction handleLogout() {\n showUserMenu.value = false\n uni.showModal({\n title: '提示',\n content: '确定要退出登录吗?',\n success: (res) => {\n if (res.confirm) {\n uni.reLaunch({\n url: '/pages/index/index'\n })\n }\n }\n })\n}""" +new_script = new_script.replace(r'\n', '\n') + +text = re.sub(r'import \{ computed \} from \'vue\'[\s\S]*?\} from \'@/layouts/admin/store/adminNavStore\.uts\'', new_script, text) + + +new_style = r""".dot{\n width: 8px;\n height: 8px;\n border-radius: 50%;\n background:#ff4d4f;\n position:absolute;\n top: 6px;\n right: 6px;\n}\n\n.user-profile-container {\n position: relative;\n display: flex;\n flex-direction: row;\n align-items: center;\n margin-left: 10px;\n cursor: pointer;\n}\n\n.user-name {\n font-size: 14px;\n color: #333;\n}\n\n.user-arrow {\n font-size: 12px;\n color: #666;\n margin-left: 4px;\n}\n\n.user-dropdown {\n position: absolute;\n top: 40px;\n right: 0;\n width: 120px;\n background-color: #fff;\n border-radius: 4px;\n box-shadow: 0 2px 12px rgba(0,0,0,0.1);\n z-index: 1000;\n display: flex;\n flex-direction: column;\n}\n\n.dropdown-item {\n height: 40px;\n line-height: 40px;\n text-align: center;\n font-size: 14px;\n color: #333;\n cursor: pointer;\n}\n\n.dropdown-item:hover {\n background-color: #f5f7fa;\n color: #1890ff;\n}""" +new_style = new_style.replace(r'\n', '\n') +text = re.sub(r'\.dot\{[\s\S]*?\}', new_style, text) + +with open('layouts/admin/components/AdminHeader.uvue', 'w', encoding='utf-8') as f: + f.write(text) + diff --git a/test_replace_map.py b/test_replace_map.py new file mode 100644 index 00000000..921ec16a --- /dev/null +++ b/test_replace_map.py @@ -0,0 +1,16 @@ +import codecs +with open('layouts/admin/router/adminComponentMap.uts', 'r', encoding='utf-8') as f: + text = f.read() + +text = text.replace( + "import HomeIndex from '@/pages/mall/admin/homePage/index.uvue'", + "import HomeIndex from '@/pages/mall/admin/homePage/index.uvue'\nimport UserCenter from '@/pages/mall/admin/userCenter/index.uvue'" +) + +text = text.replace( + "['HomeIndex', HomeIndex],", + "['HomeIndex', HomeIndex],\n ['UserCenter', UserCenter]," +) + +with open('layouts/admin/router/adminComponentMap.uts', 'w', encoding='utf-8') as f: + f.write(text)