Showing
8 changed files
with
35 additions
and
36 deletions
| ... | @@ -121,7 +121,7 @@ export default { | ... | @@ -121,7 +121,7 @@ export default { |
| 121 | path: '/client/videoDetail', | 121 | path: '/client/videoDetail', |
| 122 | query: { | 122 | query: { |
| 123 | prod_id: this.item.id, | 123 | prod_id: this.item.id, |
| 124 | - path: this.item.path // 特殊标识,判断入口 为keepAlive使用 | 124 | + type: this.item.type // 特殊标识,判断入口 为keepAlive使用 |
| 125 | } | 125 | } |
| 126 | }); | 126 | }); |
| 127 | }, | 127 | }, | ... | ... |
| ... | @@ -95,7 +95,7 @@ export default { | ... | @@ -95,7 +95,7 @@ export default { |
| 95 | path: '/client/videoDetail', | 95 | path: '/client/videoDetail', |
| 96 | query: { | 96 | query: { |
| 97 | prod_id: this.item.id, | 97 | prod_id: this.item.id, |
| 98 | - path: this.item.path // 特殊标识,判断入口 为keepAlive使用 | 98 | + type: this.item.type // 特殊标识,判断入口 为keepAlive使用 |
| 99 | } | 99 | } |
| 100 | }); | 100 | }); |
| 101 | }, | 101 | }, | ... | ... |
| ... | @@ -29,7 +29,7 @@ export const useUnwatchList = () => { | ... | @@ -29,7 +29,7 @@ export const useUnwatchList = () => { |
| 29 | prod_list.value = _.concat(prod_list.value, res.data.data.prod); | 29 | prod_list.value = _.concat(prod_list.value, res.data.data.prod); |
| 30 | prod_list.value = _.uniqBy(prod_list.value, 'id'); | 30 | prod_list.value = _.uniqBy(prod_list.value, 'id'); |
| 31 | _.each(prod_list.value, (item) => { | 31 | _.each(prod_list.value, (item) => { |
| 32 | - item.path = 'unWatchList' | 32 | + item.type = 'read-only' // 特殊标识,判断入口 为keepAlive使用 |
| 33 | }) | 33 | }) |
| 34 | offset.value = prod_list.value.length; | 34 | offset.value = prod_list.value.length; |
| 35 | loading.value = false; | 35 | loading.value = false; | ... | ... |
| ... | @@ -62,39 +62,35 @@ import { ref, onActivated, onMounted } from 'vue' | ... | @@ -62,39 +62,35 @@ import { ref, onActivated, onMounted } from 'vue' |
| 62 | import { useRoute, useRouter, onBeforeRouteLeave } from 'vue-router' | 62 | import { useRoute, useRouter, onBeforeRouteLeave } from 'vue-router' |
| 63 | import axios from '@/utils/axios'; | 63 | import axios from '@/utils/axios'; |
| 64 | import _ from 'lodash'; | 64 | import _ from 'lodash'; |
| 65 | -import $ from 'jquery'; | ||
| 66 | import { Toast } from 'vant'; | 65 | import { Toast } from 'vant'; |
| 66 | + | ||
| 67 | const $route = useRoute(); | 67 | const $route = useRoute(); |
| 68 | const $router = useRouter(); | 68 | const $router = useRouter(); |
| 69 | 69 | ||
| 70 | -const store = mainStore(); | ||
| 71 | - | ||
| 72 | const userInfo = ref({}); | 70 | const userInfo = ref({}); |
| 73 | -onMounted(() => { | 71 | +// 获取表演者信息 |
| 74 | - // 获取表演者信息 | 72 | +axios.get('/srv/?a=perf_info', { |
| 75 | - axios.get('/srv/?a=perf_info', { | 73 | + params: { |
| 76 | - params: { | 74 | + perf_id: $route.query.perf_id |
| 77 | - perf_id: $route.query.perf_id | 75 | + } |
| 76 | +}) | ||
| 77 | + .then(res => { | ||
| 78 | + if (res.data.code === 1) { | ||
| 79 | + _.each(res.data.data.prod, (item) => { | ||
| 80 | + item.type = 'read-only' // 特殊标识,判断入口 为keepAlive使用 | ||
| 81 | + }) | ||
| 82 | + userInfo.value = res.data.data; | ||
| 83 | + } else { | ||
| 84 | + console.warn(res); | ||
| 85 | + Toast({ | ||
| 86 | + icon: 'close', | ||
| 87 | + message: res.data.msg | ||
| 88 | + }); | ||
| 78 | } | 89 | } |
| 79 | }) | 90 | }) |
| 80 | - .then(res => { | 91 | + .catch(err => { |
| 81 | - if (res.data.code === 1) { | 92 | + console.error(err); |
| 82 | - _.each(res.data.data.prod, (item) => { | 93 | + }); |
| 83 | - item.path = 'personIndex' | ||
| 84 | - }) | ||
| 85 | - userInfo.value = res.data.data; | ||
| 86 | - } else { | ||
| 87 | - console.warn(res); | ||
| 88 | - Toast({ | ||
| 89 | - icon: 'close', | ||
| 90 | - message: res.data.msg | ||
| 91 | - }); | ||
| 92 | - } | ||
| 93 | - }) | ||
| 94 | - .catch(err => { | ||
| 95 | - console.error(err); | ||
| 96 | - }); | ||
| 97 | -}) | ||
| 98 | 94 | ||
| 99 | // 关注个人用户 | 95 | // 关注个人用户 |
| 100 | const followUser = (status) => { | 96 | const followUser = (status) => { |
| ... | @@ -141,6 +137,10 @@ onActivated(() => { // keepAlive 重置后执行回调 | ... | @@ -141,6 +137,10 @@ onActivated(() => { // keepAlive 重置后执行回调 |
| 141 | }) | 137 | }) |
| 142 | // 触发更新 | 138 | // 触发更新 |
| 143 | userInfo.value.prod = arr.value; | 139 | userInfo.value.prod = arr.value; |
| 140 | + // BUG: 暂时找不到问题,只能先强制刷新,数据串了。 | ||
| 141 | + if (userInfo.value.id && userInfo.value.id !== +$route.query.perf_id) { | ||
| 142 | + location.reload(); | ||
| 143 | + } | ||
| 144 | }); | 144 | }); |
| 145 | 145 | ||
| 146 | const changeRouterKeepAlive = (path, keepAlive) => { | 146 | const changeRouterKeepAlive = (path, keepAlive) => { |
| ... | @@ -155,7 +155,7 @@ onBeforeRouteLeave((to, from) => { | ... | @@ -155,7 +155,7 @@ onBeforeRouteLeave((to, from) => { |
| 155 | // 如果是从页面返回,需要重置keepAlive状态 | 155 | // 如果是从页面返回,需要重置keepAlive状态 |
| 156 | // 列表页 =》 详情页 | 156 | // 列表页 =》 详情页 |
| 157 | // TAG: keepAlive | 157 | // TAG: keepAlive |
| 158 | - if (to.path === '/client/videoDetail' && to.query.path) { | 158 | + if (to.path === '/client/videoDetail' && to.query.type === 'read-only') { |
| 159 | changeRouterKeepAlive(from.path, true); | 159 | changeRouterKeepAlive(from.path, true); |
| 160 | } else { | 160 | } else { |
| 161 | changeRouterKeepAlive(from.path, false); | 161 | changeRouterKeepAlive(from.path, false); | ... | ... |
| ... | @@ -49,7 +49,7 @@ const $router = useRouter(); | ... | @@ -49,7 +49,7 @@ const $router = useRouter(); |
| 49 | 49 | ||
| 50 | const getUserInfo = () => { | 50 | const getUserInfo = () => { |
| 51 | // 从个人头像进入的,不能再往下级进入 | 51 | // 从个人头像进入的,不能再往下级进入 |
| 52 | - if (!$route.query.path) { | 52 | + if ($route.query.type !== 'read-only') { |
| 53 | $router.push({ | 53 | $router.push({ |
| 54 | path: '/client/personIndex', | 54 | path: '/client/personIndex', |
| 55 | query: { | 55 | query: { | ... | ... |
| ... | @@ -39,7 +39,7 @@ axios.get('/srv/?a=my_favor') | ... | @@ -39,7 +39,7 @@ axios.get('/srv/?a=my_favor') |
| 39 | if (res.data.code === 1) { | 39 | if (res.data.code === 1) { |
| 40 | prodList.value = res.data.data.prod; | 40 | prodList.value = res.data.data.prod; |
| 41 | _.each(prodList.value, (item) => { | 41 | _.each(prodList.value, (item) => { |
| 42 | - item.path = 'myCollection' | 42 | + item.type = 'read-only' // 特殊标识,判断入口 为keepAlive使用 |
| 43 | }) | 43 | }) |
| 44 | } else { | 44 | } else { |
| 45 | console.warn(res); | 45 | console.warn(res); | ... | ... |
| ... | @@ -39,7 +39,7 @@ axios.get('/srv/?a=my_like') | ... | @@ -39,7 +39,7 @@ axios.get('/srv/?a=my_like') |
| 39 | if (res.data.code === 1) { | 39 | if (res.data.code === 1) { |
| 40 | prodList.value = res.data.data.prod; | 40 | prodList.value = res.data.data.prod; |
| 41 | _.each(prodList.value, (item) => { | 41 | _.each(prodList.value, (item) => { |
| 42 | - item.path = 'myLike' | 42 | + item.type = 'read-only'; // 特殊标识,判断入口 为keepAlive使用 |
| 43 | }) | 43 | }) |
| 44 | } else { | 44 | } else { |
| 45 | console.warn(res); | 45 | console.warn(res); | ... | ... |
| ... | @@ -23,7 +23,6 @@ import $ from 'jquery' | ... | @@ -23,7 +23,6 @@ import $ from 'jquery' |
| 23 | import _ from 'lodash'; | 23 | import _ from 'lodash'; |
| 24 | import { wxInfo } from '@/utils/tools'; | 24 | import { wxInfo } from '@/utils/tools'; |
| 25 | 25 | ||
| 26 | -const $route = useRoute(); | ||
| 27 | const $router = useRouter(); | 26 | const $router = useRouter(); |
| 28 | 27 | ||
| 29 | const { onLoad, prod_list, finished, loading } = useUnwatchList(); | 28 | const { onLoad, prod_list, finished, loading } = useUnwatchList(); |
| ... | @@ -50,7 +49,7 @@ onActivated(() => { // keepAlive 重置后执行回调 | ... | @@ -50,7 +49,7 @@ onActivated(() => { // keepAlive 重置后执行回调 |
| 50 | * 判断微信环境 | 49 | * 判断微信环境 |
| 51 | */ | 50 | */ |
| 52 | if (wxInfo().isiOS || wxInfo().isAndroid) { | 51 | if (wxInfo().isiOS || wxInfo().isAndroid) { |
| 53 | - // TODO: 手机微信浏览器位置变动了,需要手动调整位置,但是无刷新是起作用的 | 52 | + // TAG: 手机微信浏览器位置变动了,需要手动调整位置,但是无刷新是起作用的 |
| 54 | const { scrollTop } = storeToRefs(store); | 53 | const { scrollTop } = storeToRefs(store); |
| 55 | if (scrollTop.value) { | 54 | if (scrollTop.value) { |
| 56 | $("html,body").animate({ "scrollTop": scrollTop.value }) | 55 | $("html,body").animate({ "scrollTop": scrollTop.value }) |
| ... | @@ -75,7 +74,7 @@ onBeforeRouteLeave((to, from) => { | ... | @@ -75,7 +74,7 @@ onBeforeRouteLeave((to, from) => { |
| 75 | // 如果是从页面返回,需要重置keepAlive状态 | 74 | // 如果是从页面返回,需要重置keepAlive状态 |
| 76 | // 列表页 =》 详情页 | 75 | // 列表页 =》 详情页 |
| 77 | // TAG: keepAlive | 76 | // TAG: keepAlive |
| 78 | - if (to.path === '/client/videoDetail' && to.query.path) { | 77 | + if (to.path === '/client/videoDetail' && to.query.type === 'read-only') { |
| 79 | changeRouterKeepAlive(from.path, true); | 78 | changeRouterKeepAlive(from.path, true); |
| 80 | } else { | 79 | } else { |
| 81 | changeRouterKeepAlive(from.path, false); | 80 | changeRouterKeepAlive(from.path, false); | ... | ... |
-
Please register or login to post a comment