diff --git a/src/main.js b/src/main.js
index 2aaf4f7..5815b29 100644
--- a/src/main.js
+++ b/src/main.js
@@ -10,7 +10,8 @@ window.axios = axios
Vue.use(ElementUI);
window.$glob = {}
-import('./utils/fetch.js').then(() => {
+
+import('./utils/inject.js').then(() => {
new Vue({
router,
render: (h) => h(App)
diff --git a/src/utils/fetch.js b/src/utils/fetch.js
index bc27044..16feb54 100644
--- a/src/utils/fetch.js
+++ b/src/utils/fetch.js
@@ -1,41 +1,45 @@
-const {axios, $glob} = window
+const init = () => new Promise(resolve => {
+ const {axios, $glob} = window
-let getAuthing = false
-const getToken = () => {
- getAuthing = true
- return axios.post("http://10.0.97.209/data-boot/na/sys/login", {
- t: Date.now(),
- userAcc: "kengee",
- password: "kengee@123",
- uuid: "",
- captcha: ""
- }).then(res => {
- if (res?.data?.data) {
- $glob.token = res.data.data.token
+ let getAuthing = false
+ const getToken = () => {
+ getAuthing = true
+ return axios.post("http://10.0.97.209/data-boot/na/sys/login", {
+ t: Date.now(),
+ userAcc: "kengee",
+ password: "kengee@123",
+ uuid: "",
+ captcha: ""
+ }).then(res => {
+ if (res?.data?.data) {
+ $glob.token = res.data.data.token
+ }
+ }).finally(() => getAuthing = false)
+ }
+ const http = axios.create({baseURL: '/'})
+ const addToken = (config) => {
+ config.headers['h-token'] = $glob.token
+ return config
+ }
+ window.$wait = (t = 500) => new Promise(resolve => setTimeout(resolve, t))
+ http.interceptors.request.use(async config => {
+ while (getAuthing) {
+ await $wait()
}
- }).finally(() => getAuthing = false)
-}
-const http = axios.create({baseURL: '/'})
-const addToken = (config) => {
- config.headers['h-token'] = $glob.token
- return config
-}
-window.$wait = (t = 500) => new Promise(resolve => setTimeout(resolve, t))
-http.interceptors.request.use(async config => {
- while (getAuthing) {
- await $wait()
- }
- if (!$glob.token && !getAuthing) {
- await getToken()
- }
- return addToken(config)
+ if (!$glob.token && !getAuthing) {
+ await getToken()
+ }
+ return addToken(config)
+ })
+ http.interceptors.response.use(res => {
+ if (res?.data) {
+ return res.data
+ } else if (res?.code == 401) {
+ return getToken().then(() => http.request(res.config))
+ }
+ return res
+ })
+ window.$http = http
+ resolve()
})
-http.interceptors.response.use(res => {
- if (res?.data) {
- return res.data
- } else if (res?.code == 401) {
- return getToken().then(() => http.request(res.config))
- }
- return res
-})
-window.$http = http
+await init()
diff --git a/src/utils/inject.js b/src/utils/inject.js
new file mode 100644
index 0000000..8d3eb38
--- /dev/null
+++ b/src/utils/inject.js
@@ -0,0 +1,12 @@
+const KENGEE_CDN_BASE = "http://10.0.97.209/presource/datascreen/"
+const libs = [`${KENGEE_CDN_BASE}/js/pinyin.min.js`]
+
+Promise.all([
+ import("./fetch"),
+ ...libs.map(url => new Promise(resolve => {
+ const script = document.createElement("script")
+ script.src = url
+ document.head.appendChild(script)
+ script.onload = () => resolve()
+ })),
+])
diff --git a/src/views/AppStoresTable.vue b/src/views/AppStoresTable.vue
index 62613a9..c2b124c 100644
--- a/src/views/AppStoresTable.vue
+++ b/src/views/AppStoresTable.vue
@@ -139,11 +139,11 @@ export default {