修复权限缓存问题

This commit is contained in:
Zy
2026-07-20 16:43:09 +08:00
parent a5a883a652
commit 3a00c3dfe0
10 changed files with 343 additions and 306 deletions

View File

@@ -99,7 +99,9 @@ import { ref, computed } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { getLoginPassword } from '../../api/api.js'
import PrivacyPopup from '@/components/privacy-popup/privacy-popup.vue'
import { usePermStore } from '@/stores/usePermStore'
const permStore = usePermStore()
// 响应式数据
const phoneNumber = ref('')
const password = ref('')
@@ -201,6 +203,7 @@ const handleLogin = () => {
password: password.value,
cid: push_cid
}
permStore.clearPerm()
getLoginPassword(params)
.then(res => {
// console.log('33333',res)
@@ -214,7 +217,11 @@ const handleLogin = () => {
// // const currentVillageId = res.data.currentVillageId || 0;
// // uni.setStorageSync('currentVillageId', currentVillageId);
// }
uni.setStorageSync('userPermission', res.data.user.permissions)
uni.setStorage({
key: 'userPermission',
data: res.data.user.permissions
})
permStore.setPerm(res.data.user.permissions)
uni.hideLoading()
if (rememberPwd.value) {
uni.setStorageSync('rememberPhone', phoneNumber.value)