liyongli 1 month ago
parent
commit
5f03c0bac6
2 changed files with 27 additions and 10 deletions
  1. 11 8
      src/view/fenghui/index.vue
  2. 16 2
      src/view/fenghui/lang.js

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

@@ -3,7 +3,8 @@
         <div class="swith">
             <div class="title" @click="showLange = true">{{ langObjT[langType] }}</div>
             <van-popup v-model:show="showLange" destroy-on-close round position="bottom">
-                <van-picker :model-value="[langType]" :columns="langObj" @cancel="showLange = false" @confirm="langChange"/>
+                <van-picker :model-value="[langType]" :columns="langObj" @cancel="showLange = false"
+                    @confirm="langChange" />
             </van-popup>
         </div>
         <van-image style="width: 100%;" :src="soundbyteJpg" />
@@ -112,7 +113,6 @@ const isFile = () => {
     return from.photo && from.photo.length;
 };
 const langChange = ({ selectedValues }) => {
-
     langType.value = selectedValues[0];
     showLange.value = false;
 };
@@ -142,7 +142,7 @@ getJoinType().then((res) => {
     })
 })
 
-const filesize = () => showToast('超出文件大小限制');
+const filesize = () => showToast(lang[langType].fileSize);
 const previewClick = () => {
     let getUrl = null;
     const file = from.photo[0].file;
@@ -168,7 +168,7 @@ const onConfirm = ({ selectedValues, selectedOptions }) => {
 };
 
 const beforeRead = () => {
-    if (!isFile) showToast('请选择照片');
+    if (!isFile) showToast(lang[langType].changePhono);
     const oriData = new FormData();
     oriData.append('file', from.photo[0].file);
     axios({
@@ -181,10 +181,11 @@ const beforeRead = () => {
     })
         .then(res => {
             if (res.status !== 200 || res.data.code !== 0) {
-                showToast('上传失败');
+                showToast(lang[langType].upFileError);
                 from.photoUrl = ''
                 return
             }
+            showToast(lang[langType].upFileSusscess);
             from.photoUrl = res.data.data
         })
     return true;
@@ -192,7 +193,7 @@ const beforeRead = () => {
 
 // 选择权限范围
 const onSubmit = () => {
-    if (!isFile) showToast('请上传作品');
+    if (!isFile) showToast(lang[langType].selectFile);
     saveData({
         "name": from.name,
         "photo": from.photoUrl,
@@ -204,7 +205,7 @@ const onSubmit = () => {
         "participationType": from.cardType.join(','),
         "remarks": from.message
     }).then(() => {
-        showToast('报名成功');
+        showToast(lang[langType].registration);
         // 清空表单内容
         from.name = '';
         from.idCard = '';
@@ -216,7 +217,9 @@ const onSubmit = () => {
         from.cardType = [];
         from.photo = [];
         from.message = '';
-    })
+    }).catch(() => {
+        showToast(lang[langType].registrationError);
+    });
 };
 </script>
 <style lang="scss">

+ 16 - 2
src/view/fenghui/lang.js

@@ -34,7 +34,14 @@ export default {
         "ortherNotes": "备注",
         "ortherNotesContent": "特殊需求(如无障碍设施、饮食禁忌等)",
         "submit": "提交申请",
-        "copyright": "由陕西广电融媒体集团技术研究院提供计算服务"
+        "copyright": "由陕西广电融媒体集团技术研究院提供计算服务",
+        "fileSize": "超出文件大小限制",
+        "upFileError": "上传失败",
+        "upFileSusscess": "上传成功",
+        "changePhono": "请选择照片",
+        "selectFile": "请选择文件",
+        "registration": "报名成功",
+        "registrationError": "报名失败",
     },
     "en": {
         "forumTopic": "Forum Theme",
@@ -71,6 +78,13 @@ export default {
         "ortherNotes": "Notes",
         "ortherNotesContent": "Special requests (e.g. accessibility/dietary requirements)",
         "submit": "Submit Application",
-        "copyright": "Computing services provided by Shaanxi Radio & TV Media Group Technology Institute"
+        "copyright": "Computing services provided by Shaanxi Radio & TV Media Group Technology Institute",
+        "fileSize": "Exceeding file size limit",
+        "changePhono": "Please select a photo",
+        "upFileError": "Upload failed",
+        "upFileSusscess": "Upload successful",
+        "selectFile": "Please select a file",
+        "registration": "报名成功",
+        "registrationError": "报名失败",
     }
 }