diff --git a/app/Http/Controllers/IndexController.php b/app/Http/Controllers/IndexController.php
index 4ddc4b7b9..a63e6cac6 100755
--- a/app/Http/Controllers/IndexController.php
+++ b/app/Http/Controllers/IndexController.php
@@ -235,6 +235,18 @@ class IndexController extends InvokeController
];
}
+ /**
+ * 设置语言和皮肤
+ * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View
+ */
+ public function setting__theme_language()
+ {
+ return view('setting', [
+ 'theme' => Request::input('theme'),
+ 'language' => Request::input('language')
+ ]);
+ }
+
/**
* 提取所有中文
* @return array|string
diff --git a/resources/assets/js/App.vue b/resources/assets/js/App.vue
index 52a0b4304..4683cedb2 100755
--- a/resources/assets/js/App.vue
+++ b/resources/assets/js/App.vue
@@ -22,8 +22,8 @@
-
-
+
+
@@ -51,8 +51,8 @@ export default {
data() {
return {
routePath: null,
- manifestUrl: null,
- inter: null,
+ searchInter: null,
+ iframes: [],
}
},
@@ -62,19 +62,20 @@ export default {
},
mounted() {
- this.inter = setInterval(this.searchEnter, 1000);
window.addEventListener('resize', this.windowSizeListener);
window.addEventListener('scroll', this.windowScrollListener);
+ this.searchInter = setInterval(this.searchEnter, 1000);
+ this.synchThemeLanguage();
},
beforeDestroy() {
- this.inter && clearInterval(this.inter);
window.removeEventListener('resize', this.windowSizeListener);
window.removeEventListener('scroll', this.windowScrollListener);
+ this.searchInter && clearInterval(this.searchInter);
},
computed: {
- ...mapState(['ws']),
+ ...mapState(['ws', 'themeMode']),
},
watch: {
@@ -131,6 +132,14 @@ export default {
},
immediate: true
},
+
+ themeMode() {
+ this.synchThemeLanguage();
+ },
+
+ languageType() {
+ this.synchThemeLanguage();
+ }
},
methods: {
@@ -193,7 +202,10 @@ export default {
let {action, data} = args;
this.$store.dispatch(action, data);
})
- this.manifestUrl = $A.apiUrl("../manifest")
+ this.iframes.push({
+ key: 'manifest',
+ url: $A.apiUrl("../manifest")
+ })
},
eeuiEvents() {
@@ -226,7 +238,17 @@ export default {
}
}
}
- }
+ },
+
+ synchThemeLanguage() {
+ if (this.$Electron || this.$isEEUiApp) {
+ this.iframes = this.iframes.filter(({key}) => key != 'synchThemeLanguage')
+ this.iframes.push({
+ key: 'synchThemeLanguage',
+ url: $A.apiUrl(`../setting/theme_language?theme=${this.themeMode}&language=${this.languageType}`)
+ })
+ }
+ },
}
}
diff --git a/resources/assets/js/functions/common.js b/resources/assets/js/functions/common.js
index 4281a11eb..d63c6caa8 100755
--- a/resources/assets/js/functions/common.js
+++ b/resources/assets/js/functions/common.js
@@ -590,6 +590,18 @@
}
},
+ /**
+ * 获取文本长度
+ * @param string
+ * @returns {number}
+ */
+ stringLength(string) {
+ if (typeof string === "number" || typeof string === "string") {
+ return (string + "").length
+ }
+ return 0;
+ },
+
/**
* 获取数组长度(处理数组不存在)
* @param array
diff --git a/resources/assets/js/store/actions.js b/resources/assets/js/store/actions.js
index 4e03c2d20..ae7dd61ed 100644
--- a/resources/assets/js/store/actions.js
+++ b/resources/assets/js/store/actions.js
@@ -245,7 +245,7 @@ export default {
}
state.themeMode = mode;
state.themeIsDark = $A.dark.isDarkEnabled();
- $A.setStorage("cacheThemeMode", mode);
+ window.localStorage['__theme:mode__'] = mode;
},
/**
@@ -493,7 +493,6 @@ export default {
return new Promise(function (resolve) {
try {
const cacheLoginEmail = $A.getStorageString("cacheLoginEmail");
- const cacheThemeMode = $A.getStorageString("cacheThemeMode");
const cacheFileSort = $A.getStorageJson("cacheFileSort");
//
window.localStorage.clear();
@@ -507,7 +506,6 @@ export default {
$A.setStorage("cacheProjectParameter", state.cacheProjectParameter);
$A.setStorage("cacheServerUrl", state.cacheServerUrl);
$A.setStorage("cacheLoginEmail", cacheLoginEmail);
- $A.setStorage("cacheThemeMode", cacheThemeMode);
$A.setStorage("cacheFileSort", cacheFileSort);
$A.setStorage("cacheTaskBrowse", state.cacheTaskBrowse);
dispatch("saveUserInfo", $A.isJson(userInfo) ? userInfo : state.userInfo);
diff --git a/resources/assets/js/store/state.js b/resources/assets/js/store/state.js
index d51661260..05590d1a8 100644
--- a/resources/assets/js/store/state.js
+++ b/resources/assets/js/store/state.js
@@ -124,7 +124,7 @@ const stateData = {
],
// 主题皮肤
- themeMode: $A.getStorageString("cacheThemeMode"),
+ themeMode: window.localStorage['__theme:mode__'],
themeList: [
{name: '跟随系统', value: 'auto'},
{name: '明亮', value: 'light'},
diff --git a/resources/views/setting.blade.php b/resources/views/setting.blade.php
new file mode 100755
index 000000000..18533748e
--- /dev/null
+++ b/resources/views/setting.blade.php
@@ -0,0 +1,8 @@
+