Showing
2 changed files
with
24 additions
and
22 deletions
| ... | @@ -342,7 +342,7 @@ onBeforeRouteLeave((to, from) => { | ... | @@ -342,7 +342,7 @@ onBeforeRouteLeave((to, from) => { |
| 342 | } else { | 342 | } else { |
| 343 | changeRouterKeepAlive(from.path, false); | 343 | changeRouterKeepAlive(from.path, false); |
| 344 | // BUG: 改变keepAlive数据不刷新,只能手动刷新 | 344 | // BUG: 改变keepAlive数据不刷新,只能手动刷新 |
| 345 | - if (to.path !== '/client/chooseSchool' && to.path !== '/me/index') { | 345 | + if (to.path === '/client/chooseBook') { |
| 346 | location.reload() | 346 | location.reload() |
| 347 | } | 347 | } |
| 348 | } | 348 | } | ... | ... |
| ... | @@ -19,25 +19,6 @@ import { Toast } from 'vant'; | ... | @@ -19,25 +19,6 @@ import { Toast } from 'vant'; |
| 19 | 19 | ||
| 20 | const $router = useRouter(); | 20 | const $router = useRouter(); |
| 21 | 21 | ||
| 22 | -// 幼儿园列表页 | ||
| 23 | -const schoolList = ref([]) | ||
| 24 | -axios.get('/srv/?a=kg_list') | ||
| 25 | -.then(res => { | ||
| 26 | - if (res.data.code === 1) { | ||
| 27 | - schoolList.value = res.data.data; | ||
| 28 | - } else { | ||
| 29 | - console.warn(res); | ||
| 30 | - if (!res.data.show) return false; | ||
| 31 | - Toast({ | ||
| 32 | - icon: 'close', | ||
| 33 | - message: res.data.msg | ||
| 34 | - }); | ||
| 35 | - } | ||
| 36 | -}) | ||
| 37 | -.catch(err => { | ||
| 38 | - console.error(err); | ||
| 39 | -}) | ||
| 40 | - | ||
| 41 | // 跳转幼儿园爱心书籍列表页 | 22 | // 跳转幼儿园爱心书籍列表页 |
| 42 | const onClick = (item) => { | 23 | const onClick = (item) => { |
| 43 | $router.push({ | 24 | $router.push({ |
| ... | @@ -47,16 +28,37 @@ const onClick = (item) => { | ... | @@ -47,16 +28,37 @@ const onClick = (item) => { |
| 47 | } | 28 | } |
| 48 | }); | 29 | }); |
| 49 | } | 30 | } |
| 31 | + | ||
| 50 | </script> | 32 | </script> |
| 51 | 33 | ||
| 52 | <script> | 34 | <script> |
| 53 | import mixin from 'common/mixin' | 35 | import mixin from 'common/mixin' |
| 54 | -import { mainStore } from '@/store' | 36 | + |
| 55 | -import { storeToRefs } from 'pinia' | ||
| 56 | export default { | 37 | export default { |
| 38 | + beforeRouteEnter (to, from, next) { | ||
| 39 | + // 幼儿园列表页 | ||
| 40 | + axios.get('/srv/?a=kg_list') | ||
| 41 | + .then(res => { | ||
| 42 | + if (res.data.code === 1) { | ||
| 43 | + to.params.schoolList = res.data.data; | ||
| 44 | + next(); | ||
| 45 | + } else { | ||
| 46 | + console.warn(res); | ||
| 47 | + if (!res.data.show) return false; | ||
| 48 | + Toast({ | ||
| 49 | + icon: 'close', | ||
| 50 | + message: res.data.msg | ||
| 51 | + }); | ||
| 52 | + } | ||
| 53 | + }) | ||
| 54 | + .catch(err => { | ||
| 55 | + console.error(err); | ||
| 56 | + }) | ||
| 57 | + }, | ||
| 57 | mixins: [mixin.init], | 58 | mixins: [mixin.init], |
| 58 | data () { | 59 | data () { |
| 59 | return { | 60 | return { |
| 61 | + schoolList: this.$route.params.schoolList | ||
| 60 | } | 62 | } |
| 61 | }, | 63 | }, |
| 62 | mounted () { | 64 | mounted () { | ... | ... |
-
Please register or login to post a comment