feat: 5.22 update

This commit is contained in:
chenhao 2026-05-23 08:36:36 +08:00
parent 736adae554
commit 6a20d18c12
9 changed files with 73 additions and 22 deletions

View File

@ -63,6 +63,11 @@ function handleResponse(response) {
* 处理 token 失效
*/
function handleUnauthorized() {
// 如果 localStorage 中本来就没有 token说明是未登录状态不做处理
if (!localStorage.getItem('member_token')) {
return;
}
// 清除登录状态
localStorage.removeItem('member_token');
localStorage.removeItem('member_username');

View File

@ -87,6 +87,11 @@ export default {
})
},
getPermissions() {
if (!this.$isLogin()) {
// this.$showFailToast('')
// location.replace('#/Login')
return
}
this.$get('/v1/client/DUsersClient').then(res => {
this.PermissionsData = {
id: res.data.id,

View File

@ -310,6 +310,9 @@ const routes = [
path: '/SyncAuth',
name: 'SyncAuth',
component: () => import('./views/SyncAuth.vue'),
meta: {
noLogin: true,
}
},
{
path: '/404',

View File

@ -538,8 +538,9 @@ img {
>img {
width: 16vw;
height: 16vw;
.y50;
border-radius: 50%;
margin-right: 2.933vw;
object-fit: contain;
}
.text {

View File

@ -164,6 +164,12 @@ export default {
location.replace('#/')
return
}
if (!this.$isLogin) {
this.$showFailToast?.('登录状态异常,请重新登录')
// localStorage.removeItem('member_token')
location.replace('#/Login')
return
}
// this.checkWxLogin();
const code = JSON.stringify(this.$route.query.code);
if (code) {

View File

@ -149,7 +149,21 @@ export default {
name: 'Merchant',
components: { ManagerPopup },
mounted() {
this.init()
this.$get('/v1/client/DUsersClient').then(res => {
this.id = res.data.id;
if (!res.data.isshop) {
this.$showFailToast('您不是商家账号!')
// localStorage.removeItem('member_token')
location.replace('#/My')
return
}
this.init();
}).catch(() => {
this.$showFailToast('登录状态异常,请重新登录')
// localStorage.removeItem('member_token')
location.replace('#/Login')
})
window.addEventListener('showManagerPopup', this.onShowManagerPopup)
window.addEventListener('closeManagerPopup', this.onCloseManagerPopup)
},
@ -160,7 +174,7 @@ export default {
data() {
return {
managerPopupVisible: false,
id: this.$route.query.id,
id: this.$route.query.id || this.$ls.get('user_id'),
data: {
endTimes: new Date().toLocaleString('zh-CN', { hour12: false })
},
@ -203,5 +217,4 @@ export default {
</script>
<style lang="less">
</style>
<style lang="less"></style>

View File

@ -28,7 +28,7 @@
</div>
<div class="times">
<span>{{ $formatGMT(item.addtime, 'yyyy-MM-dd HH:mm:ss') }}</span>
<span>阅览量 {{ item.ReadCount }}</span>
<span>阅览量 {{ item.click }}</span>
</div>
</div>
</div>

View File

@ -3,21 +3,27 @@
</template>
<script>
import { useUserStore } from '@/stores/user'
export default {
mounted() {
if (this.token)
localStorage.setItem('member_token', this.token);
// if (this.miniopenid)
// localStorage.setItem('miniopenid', this.miniopenid);
if (this.target)
location.replace(`#/${this.target}`);
else
location.replace('#/');
if (this.token) {
localStorage.setItem('member_token', this.token)
const userStore = useUserStore()
userStore.setToken(this.token)
setTimeout(() => {
const target = this.target ? `/${this.target}` : '/Home'
// console.log(target);
this.$router.replace(target)
}, 200)
} else {
this.$router.replace('/Home')
}
},
data() {
return {
token: decodeURIComponent(this.$route.query.token || ''),
// miniopenid: decodeURIComponent(this.$route.query.miniopenid || ''),
target: decodeURIComponent(this.$route.query.target || ''),
}
},

View File

@ -218,10 +218,15 @@ export default {
components: { ManagerPopup },
computed: {
},
beforeRouteEnter(to, from, next) {
if (!localStorage.getItem('member_token')) {
next({ name: 'Login', query: { redirect: to.fullPath } });
} else {
next();
}
},
mounted() {
this.init();
window.addEventListener('showManagerPopup', this.onShowManagerPopup)
window.addEventListener('closeManagerPopup', this.onCloseManagerPopup)
},
beforeUnmount() {
window.removeEventListener('showManagerPopup', this.onShowManagerPopup)
@ -250,6 +255,13 @@ export default {
},
methods: {
init() {
if (!this.$isLogin()) {
this.$showFailToast('登录状态异常,请重新登录')
location.replace('#/Login')
return
}
window.addEventListener('showManagerPopup', this.onShowManagerPopup)
window.addEventListener('closeManagerPopup', this.onCloseManagerPopup)
Promise.all(
[
this.$get('/v1/client/DUsersClient').then(data => {