|
@@ -19,7 +19,8 @@ import {
|
|
|
onMounted,
|
|
|
onUnmounted,
|
|
|
reactive,
|
|
|
- ref
|
|
|
+ ref,
|
|
|
+ watch
|
|
|
} from 'vue';
|
|
|
import styles from './new-index.module.less';
|
|
|
import MSticky from '@/components/m-sticky';
|
|
@@ -279,6 +280,45 @@ export default defineComponent({
|
|
|
forms.schoolLoading = false;
|
|
|
};
|
|
|
|
|
|
+ watch(
|
|
|
+ () => [
|
|
|
+ studentInfo.phone,
|
|
|
+ studentInfo.nickname,
|
|
|
+ studentInfo.gender,
|
|
|
+ forms.schoolAreaId,
|
|
|
+ forms.gradeNumText,
|
|
|
+ forms.schoolName,
|
|
|
+ forms.areaName,
|
|
|
+ forms.provinceCode,
|
|
|
+ forms.cityCode,
|
|
|
+ forms.regionCode,
|
|
|
+ forms.currentClassText,
|
|
|
+ studentInfo.currentGradeNum,
|
|
|
+ studentInfo.currentClass
|
|
|
+ ],
|
|
|
+ () => {
|
|
|
+ // 缓存数据到 localStorage
|
|
|
+ localStorage.setItem(
|
|
|
+ 'activationRegistration-form',
|
|
|
+ JSON.stringify({
|
|
|
+ phone: studentInfo.phone,
|
|
|
+ name: studentInfo.nickname,
|
|
|
+ gender: studentInfo.gender,
|
|
|
+ schoolAreaId: forms.schoolAreaId,
|
|
|
+ gradeNumText: forms.gradeNumText,
|
|
|
+ schoolName: forms.schoolName,
|
|
|
+ areaName: forms.areaName,
|
|
|
+ provinceCode: forms.provinceCode,
|
|
|
+ cityCode: forms.cityCode,
|
|
|
+ regionCode: forms.regionCode,
|
|
|
+ currentClassText: forms.currentClassText,
|
|
|
+ currentGradeNum: studentInfo.currentGradeNum,
|
|
|
+ currentClass: studentInfo.currentClass
|
|
|
+ })
|
|
|
+ );
|
|
|
+ }
|
|
|
+ );
|
|
|
+
|
|
|
onMounted(() => {
|
|
|
forms.gradeList = getGradeList();
|
|
|
forms.classList = classList;
|
|
@@ -306,29 +346,6 @@ export default defineComponent({
|
|
|
getSchoolAreaList();
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- // 页面离开之前保存数据
|
|
|
- window.addEventListener('beforeunload', function (event) {
|
|
|
- // 缓存数据到 localStorage
|
|
|
- localStorage.setItem(
|
|
|
- 'activationRegistration-form',
|
|
|
- JSON.stringify({
|
|
|
- phone: studentInfo.phone,
|
|
|
- name: studentInfo.nickname,
|
|
|
- gender: studentInfo.gender,
|
|
|
- schoolAreaId: forms.schoolAreaId,
|
|
|
- gradeNumText: forms.gradeNumText,
|
|
|
- schoolName: forms.schoolName,
|
|
|
- areaName: forms.areaName,
|
|
|
- provinceCode: forms.provinceCode,
|
|
|
- cityCode: forms.cityCode,
|
|
|
- regionCode: forms.regionCode,
|
|
|
- currentClassText: forms.currentClassText,
|
|
|
- currentGradeNum: studentInfo.currentGradeNum,
|
|
|
- currentClass: studentInfo.currentClass
|
|
|
- })
|
|
|
- );
|
|
|
- });
|
|
|
});
|
|
|
|
|
|
return () => (
|