18 lines
682 B
Python
18 lines
682 B
Python
import codecs
|
|
import re
|
|
|
|
path = r'd:\骅锋\mall\layouts\admin\components\AdminHeader.uvue'
|
|
with codecs.open(path, 'r', 'utf-8') as f:
|
|
text = f.read()
|
|
|
|
# Replace uni.removeStorageSync('adminRole') with clearAdminRoleCache()
|
|
# Add import if missing
|
|
if 'clearAdminRoleCache' not in text:
|
|
text = text.replace("import { state, logout } from '@/utils/store.uts'", "import { state, logout } from '@/utils/store.uts'\nimport { clearAdminRoleCache } from '@/layouts/admin/utils/role.uts'")
|
|
|
|
text = text.replace("uni.removeStorageSync('adminRole')", "clearAdminRoleCache()")
|
|
|
|
with codecs.open(path, 'w', 'utf-8') as f:
|
|
f.write(text)
|
|
print("Updated via direct string replace")
|