From 3edc06d8b1e2449be45dbaa552f635eee72d1519 Mon Sep 17 00:00:00 2001
From: zzw <228544128@qq.com>
Date: 星期三, 07 十月 2026 16:17:38 +0800
Subject: [PATCH] feat: load status dictionary from public assets

---
 emergency-repair-web/src/main.js |   35 +++++++++++++++++++++++++++++------
 1 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/emergency-repair-web/src/main.js b/emergency-repair-web/src/main.js
index 36c8336..d839a2a 100644
--- a/emergency-repair-web/src/main.js
+++ b/emergency-repair-web/src/main.js
@@ -5,15 +5,38 @@
 import router from './router'
 import './styles/global.css'
 import { installSensitiveWords } from './utils/sensitive'
+import { loadDictionary } from './utils/dict'
 
 Vue.use(ElementUI, { size: 'small' })
 Vue.config.productionTip = false
 
-Vue.prototype.$appName = '涓存姠淇鐞嗙郴缁�'
+Vue.prototype.$appName = 'rk_SystemName'
 
-new Vue({
-  router,
-  render: h => h(App)
-}).$mount('#app')
+Vue.prototype.$hasPermission = function(code) {
+  const raw = sessionStorage.getItem('permissions')
+  if (raw === null) return true
+  try {
+    const list = JSON.parse(raw)
+    if (!Array.isArray(list)) return true
+    return list.indexOf(code) >= 0
+  } catch (e) {
+    return true
+  }
+}
 
-installSensitiveWords()
+Vue.directive('permission', {
+  inserted(el, binding) {
+    if (binding.value && !Vue.prototype.$hasPermission(binding.value) && el.parentNode) {
+      el.parentNode.removeChild(el)
+    }
+  }
+})
+
+loadDictionary().then(() => {
+  new Vue({
+    router,
+    render: h => h(App)
+  }).$mount('#app')
+
+  installSensitiveWords()
+})

--
Gitblit v1.9.1