lex hace 1 año
padre
commit
9683bbf6b9

+ 2 - 0
src/components/m-wx-tip/index.tsx

@@ -43,6 +43,8 @@ export default defineComponent({
       () => {
         if (props.show) {
           showPopup.value = true;
+        } else {
+          showPopup.value = false;
         }
       }
     );

+ 2 - 0
src/views/member-center/index.tsx

@@ -127,6 +127,7 @@ export default defineComponent({
         const selectMember = this.selectMember;
         const params: any = [
           {
+            giftVipDay: this.users.membershipGiftDays,
             goodsId: selectMember.id,
             goodsNum: 1,
             goodsType: 'VIP',
@@ -149,6 +150,7 @@ export default defineComponent({
             }
           }
         );
+
         if (result.code === 5435) {
           this.showTips = true;
           this.showMessage = result.message;

+ 13 - 3
src/views/student-register/register-member/index.tsx

@@ -161,7 +161,7 @@ export default defineComponent({
           forms.showButton = false;
         } else if (result.code === 5435) {
           forms.showTips = true;
-          forms.showMessage = result.message;
+          forms.showMessage = '报名信息更新,请刷新后重新提交';
           forms.showButton = true;
         } else {
           setTimeout(() => {
@@ -429,11 +429,21 @@ export default defineComponent({
         </Popup>
         {/* 是否在微信中打开 */}
         <OWxTip
-          show={forms.showTips}
+          v-model:show={forms.showTips}
           message={forms.showMessage}
           showButton={forms.showButton}
           buttonText="刷新"
-          onConfirm={() => window.location.reload()}
+          onConfirm={async () => {
+            forms.showTips = false;
+            await getRegisterGoods();
+
+            studentInfo.password = '';
+
+            window.scrollTo({
+              top: 0,
+              behavior: 'smooth'
+            });
+          }}
         />
       </div>
     );

+ 82 - 29
src/views/student-register/register-modal/index.tsx

@@ -1,4 +1,12 @@
-import { computed, defineComponent, nextTick, reactive, ref } from 'vue';
+import {
+  computed,
+  defineComponent,
+  nextTick,
+  onMounted,
+  reactive,
+  ref,
+  watch
+} from 'vue';
 import styles from './index.module.less';
 import infoTitle from '../images/info-title.png';
 import {
@@ -51,35 +59,9 @@ export default defineComponent({
   },
   emits: ['close', 'submit', 'error'],
   setup(props, { emit }) {
+    const studentDetails = sessionStorage.getItem('register-student');
     const countDownRef = ref();
-    const gradeList = computed(() => {
-      let tempList: any = [];
-      const five = [
-        { text: '一年级', value: 1 },
-        { text: '二年级', value: 2 },
-        { text: '三年级', value: 3 },
-        { text: '四年级', value: 4 },
-        { text: '五年级', value: 5 }
-      ];
-      const one = [{ text: '六年级', value: 6 }];
-      const three = [
-        { text: '七年级', value: 7 },
-        { text: '八年级', value: 8 },
-        { text: '九年级', value: 9 }
-      ];
-      if (props.gradeYear === 'FIVE_YEAR_SYSTEM') {
-        tempList.push([...five]);
-      } else if (props.gradeYear === 'SIX_YEAR_SYSTEM') {
-        tempList.push([...five, ...one]);
-      } else if (props.gradeYear === 'THREE_YEAR_SYSTEM') {
-        tempList.push([...three]);
-      } else if (props.gradeYear === 'FORE_YEAR_SYSTEM') {
-        tempList.push([...one, ...three]);
-      } else {
-        tempList.push([...five, ...one, ...three]);
-      }
-      return tempList;
-    });
+    const gradeList = ref([]);
     const forms = reactive({
       countDownStatus: true,
       countDownTime: 1000 * 120, // 倒计时时间
@@ -149,13 +131,25 @@ export default defineComponent({
             })
           }
         });
+
         if (result.code !== 200) {
+          sessionStorage.setItem(
+            'register-student',
+            JSON.stringify({
+              ...res,
+              extra: JSON.stringify({
+                ...extra,
+                schoolId: props.schoolId
+              })
+            })
+          );
           emit('close');
           emit('error', {
             code: result.code,
             message: result.message
           });
         } else {
+          console.log(111);
           studentRegisterStore.setToken(
             result.data.token_type + ' ' + result.data.access_token
           );
@@ -190,6 +184,65 @@ export default defineComponent({
       return false;
     };
 
+    const getGradeList = () => {
+      let tempList: any = [];
+      const five = [
+        { text: '一年级', value: 1 },
+        { text: '二年级', value: 2 },
+        { text: '三年级', value: 3 },
+        { text: '四年级', value: 4 },
+        { text: '五年级', value: 5 }
+      ];
+      const one = [{ text: '六年级', value: 6 }];
+      const three = [
+        { text: '七年级', value: 7 },
+        { text: '八年级', value: 8 },
+        { text: '九年级', value: 9 }
+      ];
+      if (props.gradeYear === 'FIVE_YEAR_SYSTEM') {
+        tempList.push([...five]);
+      } else if (props.gradeYear === 'SIX_YEAR_SYSTEM') {
+        tempList.push([...five, ...one]);
+      } else if (props.gradeYear === 'THREE_YEAR_SYSTEM') {
+        tempList.push([...three]);
+      } else if (props.gradeYear === 'FORE_YEAR_SYSTEM') {
+        tempList.push([...one, ...three]);
+      } else {
+        tempList.push([...five, ...one, ...three]);
+      }
+      return tempList;
+    };
+
+    onMounted(() => {
+      gradeList.value = getGradeList();
+      if (studentDetails) {
+        const studentJson = JSON.parse(studentDetails);
+        const extraJson = studentJson.extra
+          ? JSON.parse(studentJson.extra)
+          : {};
+        studentInfo.extra.nickname = extraJson.nickname;
+        studentInfo.extra.currentGradeNum = extraJson.currentGradeNum;
+        studentInfo.extra.currentClass = extraJson.currentClass;
+        studentInfo.extra.gender = extraJson.gender;
+        studentInfo.username = studentJson.username;
+
+        classList.forEach((i: any) => {
+          if (i.value === extraJson.currentClass) {
+            forms.currentClassText = i.text;
+          }
+        });
+
+        const tempGrade: any = gradeList.value[0] || [];
+        tempGrade?.forEach((i: any) => {
+          if (i.value === extraJson.currentGradeNum) {
+            forms.gradeNumText = i.text;
+          }
+        });
+
+        sessionStorage.removeItem('register-student');
+      }
+    });
+
     return () => (
       <div class={styles.registerModal}>
         <img src={infoTitle} class={styles.infoTitle} />