liyongli hai 1 semana
pai
achega
a1ea496f1f
Modificáronse 1 ficheiros con 9 adicións e 8 borrados
  1. 9 8
      src/view/fenghui/index.vue

+ 9 - 8
src/view/fenghui/index.vue

@@ -102,7 +102,7 @@ const langObjT = {
  */
 
 const lang = ref(langpkg);
-const langType = ref('zh');
+const langType = ref(localStorage.getItem('langType') || 'zh');
 const preview = ref('');
 const showLange = ref(false);
 const showCardType = ref(false);
@@ -112,6 +112,7 @@ const isFile = () => {
 };
 const langChange = ({ selectedValues }) => {
     langType.value = selectedValues[0];
+    localStorage.setItem('langType', selectedValues[0]);
     showLange.value = false;
 };
 
@@ -140,7 +141,7 @@ getJoinType().then((res) => {
     })
 })
 
-const filesize = () => showToast(lang[langType].fileSize);
+const filesize = () => showToast(lang.value[langType.value].fileSize);
 const previewClick = () => {
     let getUrl = null;
     const file = from.photo[0].file;
@@ -166,7 +167,7 @@ const onConfirm = ({ selectedValues, selectedOptions }) => {
 };
 
 const beforeRead = () => {
-    if (!isFile) showToast(lang[langType].changePhono);
+    if (!isFile) showToast(lang.value[langType.value].changePhono);
     const oriData = new FormData();
     oriData.append('file', from.photo[0].file);
     axios({
@@ -179,11 +180,11 @@ const beforeRead = () => {
     })
         .then(res => {
             if (res.status !== 200 || res.data.code !== 0) {
-                showToast(lang[langType].upFileError);
+                showToast(lang.value[langType.value].upFileError);
                 from.photoUrl = ''
                 return
             }
-            showToast(lang[langType].upFileSusscess);
+            showToast(lang.value[langType.value].upFileSusscess);
             from.photoUrl = res.data.data
         })
     return true;
@@ -191,7 +192,7 @@ const beforeRead = () => {
 
 // 选择权限范围
 const onSubmit = () => {
-    if (!isFile) showToast(lang[langType].selectFile);
+    if (!isFile) showToast(lang.value[langType.value].selectFile);
     saveData({
         "name": from.name,
         "photo": from.photoUrl,
@@ -203,7 +204,7 @@ const onSubmit = () => {
         "participationType": from.cardType.join(','),
         "remarks": from.message
     }).then(() => {
-        showToast(lang[langType].registration);
+        showToast(lang.value[langType.value].registration);
         // 清空表单内容
         from.name = '';
         from.idCard = '';
@@ -216,7 +217,7 @@ const onSubmit = () => {
         from.photo = [];
         from.message = '';
     }).catch(() => {
-        showToast(lang[langType].registrationError);
+        showToast(lang.value[langType.value].registrationError);
     });
 };
 </script>