修复权限缓存问题
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
import App from './App'
|
import App from './App'
|
||||||
import uviewPlus from '@/uni_modules/uview-plus'
|
import uviewPlus from '@/uni_modules/uview-plus'
|
||||||
|
import {
|
||||||
|
createPinia
|
||||||
|
} from 'pinia'
|
||||||
// #ifndef VUE3
|
// #ifndef VUE3
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import './uni.promisify.adaptor'
|
import './uni.promisify.adaptor'
|
||||||
@@ -18,7 +20,9 @@ import {
|
|||||||
} from 'vue'
|
} from 'vue'
|
||||||
export function createApp() {
|
export function createApp() {
|
||||||
const app = createSSRApp(App)
|
const app = createSSRApp(App)
|
||||||
app.use(uviewPlus)
|
app.use(uviewPlus)
|
||||||
|
const pinia = createPinia()
|
||||||
|
app.use(pinia)
|
||||||
return {
|
return {
|
||||||
app
|
app
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,157 +1,159 @@
|
|||||||
{
|
{
|
||||||
"name": "花开管家",
|
"name" : "花开管家",
|
||||||
"appid": "__UNI__5F224F3",
|
"appid" : "__UNI__5F224F3",
|
||||||
"description": "智慧社区管家端,专为小区物业管理人员打造,支持多小区灵活切换管理。集成账号密码、手机号密码双重登录模式,内置忘记密码找回功能,保障账号安全。涵盖消息通知、日常巡检、故障报修、一键开门、工单流转、投诉处理等核心办公功能,物业人员可在线完成巡检打卡、问题上报、工单派发跟进、投诉对接处理等日常工作,同时支持查看个人上报记录、巡检历史,便捷修改账号信息与登录密码。高效简化社区物业办公流程,提升小区服务与管理效率,打造便捷智能的社区管理服务平台。",
|
"description" : "智慧社区管家端,专为小区物业管理人员打造,支持多小区灵活切换管理。集成账号密码、手机号密码双重登录模式,内置忘记密码找回功能,保障账号安全。涵盖消息通知、日常巡检、故障报修、一键开门、工单流转、投诉处理等核心办公功能,物业人员可在线完成巡检打卡、问题上报、工单派发跟进、投诉对接处理等日常工作,同时支持查看个人上报记录、巡检历史,便捷修改账号信息与登录密码。高效简化社区物业办公流程,提升小区服务与管理效率,打造便捷智能的社区管理服务平台。",
|
||||||
"versionName": "1.0.2",
|
"versionName" : "1.0.2",
|
||||||
"versionCode": 102,
|
"versionCode" : 102,
|
||||||
"transformPx": false,
|
"transformPx" : false,
|
||||||
"app-plus": {
|
"app-plus" : {
|
||||||
"usingComponents": true,
|
"usingComponents" : true,
|
||||||
"nvueStyleCompiler": "uni-app",
|
"nvueStyleCompiler" : "uni-app",
|
||||||
"compilerVersion": 3,
|
"compilerVersion" : 3,
|
||||||
"splashscreen": {
|
"splashscreen" : {
|
||||||
"alwaysShowBeforeRender": true,
|
"alwaysShowBeforeRender" : true,
|
||||||
"waiting": true,
|
"waiting" : true,
|
||||||
"autoclose": true,
|
"autoclose" : true,
|
||||||
"delay": 0,
|
"delay" : 0,
|
||||||
"useOriginalMsgbox": true
|
"useOriginalMsgbox" : true
|
||||||
|
},
|
||||||
|
"modules" : {
|
||||||
|
"Camera" : {},
|
||||||
|
"Push" : {},
|
||||||
|
"Bluetooth" : {},
|
||||||
|
"Barcode" : {}
|
||||||
|
},
|
||||||
|
"distribute" : {
|
||||||
|
"android" : {
|
||||||
|
"permissions" : [
|
||||||
|
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
||||||
|
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
||||||
|
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
||||||
|
],
|
||||||
|
"targetSdkVersion" : 30
|
||||||
|
},
|
||||||
|
"ios" : {
|
||||||
|
"dSYMs" : false,
|
||||||
|
"privacyDescription" : {
|
||||||
|
"NSPhotoLibraryUsageDescription" : "需要访问手机相册,选取本地巡检记录照片、业主报修故障图、水电表二维码用于上传工单与巡检台账,仅读取当前业务所需图片,不会获取相册内其他无关照片。",
|
||||||
|
"NSPhotoLibraryAddUsageDescription" : "需要相册写入权限,保存巡检凭证、报修工单至手机相册,方便线下核对查看,图片仅本地存储,不会上传至无关服务器。",
|
||||||
|
"NSCameraUsageDescription" : "本应用需要使用相机,用于管家现场巡检拍摄点位记录、处理业主报修拍摄故障照片,扫描水电表二维码抄表,拍摄影像仅用于小区物业工单与巡检业务存档,不会私自留存、对外分享。",
|
||||||
|
"NSLocationWhenInUseUsageDescription" : "",
|
||||||
|
"NSLocationAlwaysAndWhenInUseUsageDescription" : "",
|
||||||
|
"NSBluetoothPeripheralUsageDescription" : "需要蓝牙权限连接小区智能门禁,实现蓝牙一键开门通行,仅用于小区门禁解锁业务,不采集蓝牙设备信息。",
|
||||||
|
"NSBluetoothAlwaysUsageDescription" : "本应用需要蓝牙权限,用于扫描、连接小区蓝牙门禁设备实现一键开门,仅和本小区门禁硬件建立通信,不会扫描、连接无关蓝牙设备。"
|
||||||
|
},
|
||||||
|
"urltypes" : [
|
||||||
|
{
|
||||||
|
"urlschemes" : [ "unionpaycashier" ]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"idfa" : false
|
||||||
|
},
|
||||||
|
"sdkConfigs" : {
|
||||||
|
"push" : {
|
||||||
|
"unipush" : {
|
||||||
|
"version" : "2",
|
||||||
|
"offline" : false,
|
||||||
|
"oppo" : {},
|
||||||
|
"vivo" : {},
|
||||||
|
"mi" : {},
|
||||||
|
"meizu" : {},
|
||||||
|
"honor" : {},
|
||||||
|
"fcm" : {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"geolocation" : {
|
||||||
|
"system" : {
|
||||||
|
"__platform__" : [ "ios", "android" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"icons" : {
|
||||||
|
"android" : {
|
||||||
|
"hdpi" : "unpackage/res/icons/72x72.png",
|
||||||
|
"xhdpi" : "unpackage/res/icons/96x96.png",
|
||||||
|
"xxhdpi" : "unpackage/res/icons/144x144.png",
|
||||||
|
"xxxhdpi" : "unpackage/res/icons/192x192.png"
|
||||||
|
},
|
||||||
|
"ios" : {
|
||||||
|
"appstore" : "unpackage/res/icons/1024x1024.png",
|
||||||
|
"ipad" : {
|
||||||
|
"app" : "unpackage/res/icons/76x76.png",
|
||||||
|
"app@2x" : "unpackage/res/icons/152x152.png",
|
||||||
|
"notification" : "unpackage/res/icons/20x20.png",
|
||||||
|
"notification@2x" : "unpackage/res/icons/40x40.png",
|
||||||
|
"proapp@2x" : "unpackage/res/icons/167x167.png",
|
||||||
|
"settings" : "unpackage/res/icons/29x29.png",
|
||||||
|
"settings@2x" : "unpackage/res/icons/58x58.png",
|
||||||
|
"spotlight" : "unpackage/res/icons/40x40.png",
|
||||||
|
"spotlight@2x" : "unpackage/res/icons/80x80.png"
|
||||||
|
},
|
||||||
|
"iphone" : {
|
||||||
|
"app@2x" : "unpackage/res/icons/120x120.png",
|
||||||
|
"app@3x" : "unpackage/res/icons/180x180.png",
|
||||||
|
"notification@2x" : "unpackage/res/icons/40x40.png",
|
||||||
|
"notification@3x" : "unpackage/res/icons/60x60.png",
|
||||||
|
"settings@2x" : "unpackage/res/icons/58x58.png",
|
||||||
|
"settings@3x" : "unpackage/res/icons/87x87.png",
|
||||||
|
"spotlight@2x" : "unpackage/res/icons/80x80.png",
|
||||||
|
"spotlight@3x" : "unpackage/res/icons/120x120.png"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"modules": {
|
"quickapp" : {},
|
||||||
"Camera": {},
|
"mp-weixin" : {
|
||||||
"Push": {},
|
"appid" : "wx40625124315d2de1",
|
||||||
"Bluetooth": {},
|
"usingComponents" : true,
|
||||||
"Barcode": {}
|
"lazyCodeLoading" : "requiredComponents"
|
||||||
},
|
},
|
||||||
"distribute": {
|
"mp-alipay" : {
|
||||||
"android": {
|
"usingComponents" : true
|
||||||
"permissions": [
|
},
|
||||||
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
"mp-baidu" : {
|
||||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
"usingComponents" : true
|
||||||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
},
|
||||||
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
"mp-toutiao" : {
|
||||||
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
"usingComponents" : true
|
||||||
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
},
|
||||||
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
"uniStatistics" : {
|
||||||
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
"enable" : false
|
||||||
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
},
|
||||||
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
"vueVersion" : "3",
|
||||||
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
"locale" : "zh-Hans",
|
||||||
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
"fallbackLocale" : "zh-Hans",
|
||||||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
"app-harmony" : {
|
||||||
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
"distribute" : {
|
||||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
"bundleName" : "com.chengkong.property.butler",
|
||||||
],
|
"signingConfigs" : {
|
||||||
"targetSdkVersion": 30
|
"release" : {
|
||||||
},
|
"certpath" : "C:/Users/admin/Desktop/AppStore/new_harmony/花开物业.cer",
|
||||||
"ios": {
|
"keyAlias" : "wuye",
|
||||||
"dSYMs": false,
|
"keyPassword" : "0000001ADF5A2ECBEA883B44816B2D1993792348DB36113109A8D6190B7BB0FA49FC807D9A4191B23E10",
|
||||||
"privacyDescription": {
|
"profile" : "C:/Users/admin/Desktop/AppStore/new_harmony/guanjiaRelease.p7b",
|
||||||
"NSPhotoLibraryUsageDescription": "需要访问手机相册,选取本地巡检记录照片、业主报修故障图、水电表二维码用于上传工单与巡检台账,仅读取当前业务所需图片,不会获取相册内其他无关照片。",
|
"signAlg" : "SHA256withECDSA",
|
||||||
"NSPhotoLibraryAddUsageDescription": "需要相册写入权限,保存巡检凭证、报修工单至手机相册,方便线下核对查看,图片仅本地存储,不会上传至无关服务器。",
|
"storeFile" : "C:/Users/admin/Desktop/AppStore/new_harmony/huakaiwuye.p12",
|
||||||
"NSCameraUsageDescription": "本应用需要使用相机,用于管家现场巡检拍摄点位记录、处理业主报修拍摄故障照片,扫描水电表二维码抄表,拍摄影像仅用于小区物业工单与巡检业务存档,不会私自留存、对外分享。",
|
"storePassword" : "0000001AA46C978566364D5E371290888A2A18578BBB958BCACA8A64F023354E30EC33C84C8CC9515B38"
|
||||||
"NSLocationWhenInUseUsageDescription": "",
|
}
|
||||||
"NSLocationAlwaysAndWhenInUseUsageDescription": "",
|
}
|
||||||
"NSBluetoothPeripheralUsageDescription": "需要蓝牙权限连接小区智能门禁,实现蓝牙一键开门通行,仅用于小区门禁解锁业务,不采集蓝牙设备信息。",
|
|
||||||
"NSBluetoothAlwaysUsageDescription": "本应用需要蓝牙权限,用于扫描、连接小区蓝牙门禁设备实现一键开门,仅和本小区门禁硬件建立通信,不会扫描、连接无关蓝牙设备。"
|
|
||||||
},
|
|
||||||
"urltypes": [{
|
|
||||||
"urlschemes": ["unionpaycashier"]
|
|
||||||
}],
|
|
||||||
"idfa": false
|
|
||||||
},
|
|
||||||
"sdkConfigs": {
|
|
||||||
"push": {
|
|
||||||
"unipush": {
|
|
||||||
"version": "2",
|
|
||||||
"offline": false,
|
|
||||||
"oppo": {},
|
|
||||||
"vivo": {},
|
|
||||||
"mi": {},
|
|
||||||
"meizu": {},
|
|
||||||
"honor": {},
|
|
||||||
"fcm": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"geolocation": {
|
|
||||||
"system": {
|
|
||||||
"__platform__": ["ios", "android"]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"icons": {
|
"h5" : {
|
||||||
"android": {
|
"devServer" : {
|
||||||
"hdpi": "unpackage/res/icons/72x72.png",
|
"port" : 5588
|
||||||
"xhdpi": "unpackage/res/icons/96x96.png",
|
|
||||||
"xxhdpi": "unpackage/res/icons/144x144.png",
|
|
||||||
"xxxhdpi": "unpackage/res/icons/192x192.png"
|
|
||||||
},
|
|
||||||
"ios": {
|
|
||||||
"appstore": "unpackage/res/icons/1024x1024.png",
|
|
||||||
"ipad": {
|
|
||||||
"app": "unpackage/res/icons/76x76.png",
|
|
||||||
"app@2x": "unpackage/res/icons/152x152.png",
|
|
||||||
"notification": "unpackage/res/icons/20x20.png",
|
|
||||||
"notification@2x": "unpackage/res/icons/40x40.png",
|
|
||||||
"proapp@2x": "unpackage/res/icons/167x167.png",
|
|
||||||
"settings": "unpackage/res/icons/29x29.png",
|
|
||||||
"settings@2x": "unpackage/res/icons/58x58.png",
|
|
||||||
"spotlight": "unpackage/res/icons/40x40.png",
|
|
||||||
"spotlight@2x": "unpackage/res/icons/80x80.png"
|
|
||||||
},
|
|
||||||
"iphone": {
|
|
||||||
"app@2x": "unpackage/res/icons/120x120.png",
|
|
||||||
"app@3x": "unpackage/res/icons/180x180.png",
|
|
||||||
"notification@2x": "unpackage/res/icons/40x40.png",
|
|
||||||
"notification@3x": "unpackage/res/icons/60x60.png",
|
|
||||||
"settings@2x": "unpackage/res/icons/58x58.png",
|
|
||||||
"settings@3x": "unpackage/res/icons/87x87.png",
|
|
||||||
"spotlight@2x": "unpackage/res/icons/80x80.png",
|
|
||||||
"spotlight@3x": "unpackage/res/icons/120x120.png"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"quickapp": {},
|
|
||||||
"mp-weixin": {
|
|
||||||
"appid": "wx40625124315d2de1",
|
|
||||||
"usingComponents": true,
|
|
||||||
"lazyCodeLoading": "requiredComponents"
|
|
||||||
},
|
|
||||||
"mp-alipay": {
|
|
||||||
"usingComponents": true
|
|
||||||
},
|
|
||||||
"mp-baidu": {
|
|
||||||
"usingComponents": true
|
|
||||||
},
|
|
||||||
"mp-toutiao": {
|
|
||||||
"usingComponents": true
|
|
||||||
},
|
|
||||||
"uniStatistics": {
|
|
||||||
"enable": false
|
|
||||||
},
|
|
||||||
"vueVersion": "3",
|
|
||||||
"locale": "zh-Hans",
|
|
||||||
"fallbackLocale": "zh-Hans",
|
|
||||||
"app-harmony": {
|
|
||||||
"distribute": {
|
|
||||||
"bundleName": "com.chengkong.property.butler",
|
|
||||||
"signingConfigs": {
|
|
||||||
"release": {
|
|
||||||
"certpath": "C:/Users/admin/Desktop/AppStore/new_harmony/花开物业.cer",
|
|
||||||
"keyAlias": "wuye",
|
|
||||||
"keyPassword": "0000001ADF5A2ECBEA883B44816B2D1993792348DB36113109A8D6190B7BB0FA49FC807D9A4191B23E10",
|
|
||||||
"profile": "C:/Users/admin/Desktop/AppStore/new_harmony/guanjiaRelease.p7b",
|
|
||||||
"signAlg": "SHA256withECDSA",
|
|
||||||
"storeFile": "C:/Users/admin/Desktop/AppStore/new_harmony/huakaiwuye.p12",
|
|
||||||
"storePassword": "0000001AA46C978566364D5E371290888A2A18578BBB958BCACA8A64F023354E30EC33C84C8CC9515B38"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"h5": {
|
|
||||||
"devServer": {
|
|
||||||
"port": 5588
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"clipboard": "^2.0.11",
|
"clipboard": "^2.0.11",
|
||||||
"dayjs": "^1.11.21",
|
"dayjs": "^1.11.21",
|
||||||
|
"pinia": "^4.0.2",
|
||||||
"uview-plus": "^3.8.55"
|
"uview-plus": "^3.8.55"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -100,7 +100,9 @@
|
|||||||
import { ref, computed, onUnmounted } from 'vue'
|
import { ref, computed, onUnmounted } from 'vue'
|
||||||
import { getLoginBySms, getSendCode } from '../../api/api.js'
|
import { getLoginBySms, getSendCode } from '../../api/api.js'
|
||||||
import PrivacyPopup from '@/components/privacy-popup/privacy-popup.vue'
|
import PrivacyPopup from '@/components/privacy-popup/privacy-popup.vue'
|
||||||
|
import { usePermStore } from '@/stores/usePermStore'
|
||||||
|
|
||||||
|
const permStore = usePermStore()
|
||||||
// ========== 响应式数据 ==========
|
// ========== 响应式数据 ==========
|
||||||
// 手机号
|
// 手机号
|
||||||
const phoneNumber = ref('')
|
const phoneNumber = ref('')
|
||||||
@@ -246,12 +248,13 @@ const handleLogin = () => {
|
|||||||
scene: 'butler_login',
|
scene: 'butler_login',
|
||||||
cid: push_cid
|
cid: push_cid
|
||||||
}
|
}
|
||||||
|
permStore.clearPerm()
|
||||||
getLoginBySms(params)
|
getLoginBySms(params)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
uni.setStorageSync('token', res.data.token)
|
uni.setStorageSync('token', res.data.token)
|
||||||
uni.setStorageSync('userPermission', res.data.user.permissions)
|
permStore.setPerm(res.data.user.permissions)
|
||||||
// 存用户ID
|
// 存用户ID
|
||||||
if (res.data.user.userId) {
|
if (res.data.user.userId) {
|
||||||
uni.setStorageSync('userId', res.data.user.userId)
|
uni.setStorageSync('userId', res.data.user.userId)
|
||||||
|
|||||||
@@ -99,7 +99,9 @@ import { ref, computed } from 'vue'
|
|||||||
import { onLoad } from '@dcloudio/uni-app'
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
import { getLoginPassword } from '../../api/api.js'
|
import { getLoginPassword } from '../../api/api.js'
|
||||||
import PrivacyPopup from '@/components/privacy-popup/privacy-popup.vue'
|
import PrivacyPopup from '@/components/privacy-popup/privacy-popup.vue'
|
||||||
|
import { usePermStore } from '@/stores/usePermStore'
|
||||||
|
|
||||||
|
const permStore = usePermStore()
|
||||||
// 响应式数据
|
// 响应式数据
|
||||||
const phoneNumber = ref('')
|
const phoneNumber = ref('')
|
||||||
const password = ref('')
|
const password = ref('')
|
||||||
@@ -201,6 +203,7 @@ const handleLogin = () => {
|
|||||||
password: password.value,
|
password: password.value,
|
||||||
cid: push_cid
|
cid: push_cid
|
||||||
}
|
}
|
||||||
|
permStore.clearPerm()
|
||||||
getLoginPassword(params)
|
getLoginPassword(params)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
// console.log('33333',res)
|
// console.log('33333',res)
|
||||||
@@ -214,7 +217,11 @@ const handleLogin = () => {
|
|||||||
// // const currentVillageId = res.data.currentVillageId || 0;
|
// // const currentVillageId = res.data.currentVillageId || 0;
|
||||||
// // uni.setStorageSync('currentVillageId', currentVillageId);
|
// // 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()
|
uni.hideLoading()
|
||||||
if (rememberPwd.value) {
|
if (rememberPwd.value) {
|
||||||
uni.setStorageSync('rememberPhone', phoneNumber.value)
|
uni.setStorageSync('rememberPhone', phoneNumber.value)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<view class="news-card" v-for="item in noticeList" :key="item.id">
|
<view class="news-card" v-for="item in noticeList" :key="item.id">
|
||||||
<view class="news-header">
|
<view class="news-header">
|
||||||
<text class="news-title">{{ item.item || '暂无标题' }}</text>
|
<text class="news-title">{{ item.item || '暂无标题' }}</text>
|
||||||
<view class="unread-dot" v-if="item.isCheckStr === '未读' "></view>
|
<view class="unread-dot" v-if="item.isCheckStr === '未读'"></view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="news-meta">
|
<view class="news-meta">
|
||||||
@@ -29,9 +29,7 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 空数据 -->
|
<!-- 空数据 -->
|
||||||
<view class="empty" v-if="noticeList.length === 0 && !loading">
|
<view class="empty" v-if="noticeList.length === 0 && !loading"> 暂无通知消息 </view>
|
||||||
暂无通知消息
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -39,16 +37,18 @@
|
|||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { onShow, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app'
|
import { onShow, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app'
|
||||||
import { getNoticeList } from '../../api/api.js'
|
import { getNoticeList } from '../../api/api.js'
|
||||||
|
import { usePermStore } from '@/stores/usePermStore.js'
|
||||||
|
|
||||||
|
const permStore = usePermStore()
|
||||||
// 列表数据
|
// 列表数据
|
||||||
const noticeList = ref([])
|
const noticeList = ref([])
|
||||||
|
|
||||||
// 分页相关
|
// 分页相关
|
||||||
const pageNum = ref(1) // 当前页
|
const pageNum = ref(1) // 当前页
|
||||||
const pageSize = ref(10) // 每页条数
|
const pageSize = ref(10) // 每页条数
|
||||||
const total = ref(0) // 总条数
|
const total = ref(0) // 总条数
|
||||||
const loading = ref(false) // 加载状态
|
const loading = ref(false) // 加载状态
|
||||||
const noMore = ref(false) // 是否没有更多
|
const noMore = ref(false) // 是否没有更多
|
||||||
|
|
||||||
// 获取列表数据
|
// 获取列表数据
|
||||||
const getNoticeData = (isRefresh = false) => {
|
const getNoticeData = (isRefresh = false) => {
|
||||||
@@ -59,29 +59,32 @@ const getNoticeData = (isRefresh = false) => {
|
|||||||
getNoticeList({
|
getNoticeList({
|
||||||
pageSize: pageSize.value,
|
pageSize: pageSize.value,
|
||||||
pageNum: pageNum.value
|
pageNum: pageNum.value
|
||||||
}).then(res => {
|
|
||||||
if (res.code === 200) {
|
|
||||||
total.value = res.total || 0
|
|
||||||
const data = res.rows || []
|
|
||||||
|
|
||||||
// 第一页:覆盖,分页:追加
|
|
||||||
if (pageNum.value === 1) {
|
|
||||||
noticeList.value = data
|
|
||||||
} else {
|
|
||||||
noticeList.value = [...noticeList.value, ...data]
|
|
||||||
}
|
|
||||||
|
|
||||||
// 判断是否还有更多
|
|
||||||
noMore.value = noticeList.value.length >= total.value
|
|
||||||
}
|
|
||||||
}).catch(() => {
|
|
||||||
uni.showToast({ title: '加载失败', icon: 'none' })
|
|
||||||
}).finally(() => {
|
|
||||||
loading.value = false
|
|
||||||
if (isRefresh) {
|
|
||||||
uni.stopPullDownRefresh()
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
.then(res => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
total.value = res.total || 0
|
||||||
|
const data = res.rows || []
|
||||||
|
|
||||||
|
// 第一页:覆盖,分页:追加
|
||||||
|
if (pageNum.value === 1) {
|
||||||
|
noticeList.value = data
|
||||||
|
} else {
|
||||||
|
noticeList.value = [...noticeList.value, ...data]
|
||||||
|
}
|
||||||
|
|
||||||
|
// 判断是否还有更多
|
||||||
|
noMore.value = noticeList.value.length >= total.value
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
uni.showToast({ title: '加载失败', icon: 'none' })
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
loading.value = false
|
||||||
|
if (isRefresh) {
|
||||||
|
uni.stopPullDownRefresh()
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 上拉加载更多
|
// 上拉加载更多
|
||||||
@@ -99,11 +102,17 @@ onPullDownRefresh(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// 跳详情(即时标记已读)
|
// 跳详情(即时标记已读)
|
||||||
const goToDetail = (item) => {
|
const goToDetail = item => {
|
||||||
item.isCheck = '1'
|
const hasMine = permStore.hasPermi('butler:workOrder:mine')
|
||||||
uni.navigateTo({
|
const hasHall = permStore.hasPermi('butler:workOrder:hall')
|
||||||
url: `/pageSubPack/ticket/repairMain?id=${item.id}`
|
if (hasMine || hasHall) {
|
||||||
})
|
item.isCheck = '1'
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pageSubPack/ticket/repairMain?id=${item.id}`
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({ title: '暂无操作权限', icon: 'none' })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 页面显示时刷新(从详情页返回也会触发)
|
// 页面显示时刷新(从详情页返回也会触发)
|
||||||
@@ -111,6 +120,7 @@ onShow(() => {
|
|||||||
pageNum.value = 1
|
pageNum.value = 1
|
||||||
noMore.value = false
|
noMore.value = false
|
||||||
getNoticeData()
|
getNoticeData()
|
||||||
|
permStore.initPerm()
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -149,7 +159,7 @@ onShow(() => {
|
|||||||
.unread-dot {
|
.unread-dot {
|
||||||
width: 16rpx;
|
width: 16rpx;
|
||||||
height: 16rpx;
|
height: 16rpx;
|
||||||
background-color: #E34D59;
|
background-color: #e34d59;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
margin-top: 6rpx;
|
margin-top: 6rpx;
|
||||||
}
|
}
|
||||||
@@ -189,7 +199,7 @@ onShow(() => {
|
|||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
.detail-text {
|
.detail-text {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #4D5DFA;
|
color: #4d5dfa;
|
||||||
margin-right: 8rpx;
|
margin-right: 8rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,9 @@
|
|||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { onShow } from '@dcloudio/uni-app'
|
import { onShow } from '@dcloudio/uni-app'
|
||||||
import { logout, getSettingInfo } from '../../api/api.js'
|
import { logout, getSettingInfo } from '../../api/api.js'
|
||||||
import { clearPermList } from '../../utils/permissions.js'
|
import { usePermStore } from '@/stores/usePermStore'
|
||||||
|
|
||||||
|
const permStore = usePermStore()
|
||||||
|
|
||||||
// 响应式数据
|
// 响应式数据
|
||||||
const phoneNumber = ref('') // 绑定手机号
|
const phoneNumber = ref('') // 绑定手机号
|
||||||
@@ -118,7 +120,7 @@ const confirmLogout = () => {
|
|||||||
logout()
|
logout()
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
clearPermList()
|
permStore.clearPerm()
|
||||||
uni.clearStorageSync()
|
uni.clearStorageSync()
|
||||||
uni.showToast({ title: '退出登录成功', icon: 'success' })
|
uni.showToast({ title: '退出登录成功', icon: 'success' })
|
||||||
uni.redirectTo({ url: '/pageSubPack/loginSub/pwd-login' })
|
uni.redirectTo({ url: '/pageSubPack/loginSub/pwd-login' })
|
||||||
|
|||||||
@@ -100,78 +100,77 @@
|
|||||||
<!-- 网格布局功能 -->
|
<!-- 网格布局功能 -->
|
||||||
<view class="function-container">
|
<view class="function-container">
|
||||||
<!-- 第一行功能:故障上报、一键开门、工单大厅、我的工单 -->
|
<!-- 第一行功能:故障上报、一键开门、工单大厅、我的工单 -->
|
||||||
<view class="function-row">
|
<view
|
||||||
<view class="function-item" @click="goToReport" v-if="hasPermi('butler:fault:report')">
|
class="function-item"
|
||||||
<image
|
@click="goToReport"
|
||||||
class="item-icon"
|
v-if="permStore.hasPermi('butler:fault:report')"
|
||||||
src="https://wuyeadmin.bugtc.com/images/imgs/fault-report.png"
|
>
|
||||||
mode="aspectFit"
|
<image
|
||||||
></image>
|
class="item-icon"
|
||||||
<text class="item-text">故障上报</text>
|
src="https://wuyeadmin.bugtc.com/images/imgs/fault-report.png"
|
||||||
</view>
|
mode="aspectFit"
|
||||||
<view
|
></image>
|
||||||
class="function-item"
|
<text class="item-text">故障上报</text>
|
||||||
@click="goToOneOpenDoor"
|
|
||||||
v-if="hasPermi('butler:door:open')"
|
|
||||||
>
|
|
||||||
<image
|
|
||||||
class="item-icon"
|
|
||||||
src="https://wuyeadmin.bugtc.com/images/imgs/open.png"
|
|
||||||
mode="aspectFit"
|
|
||||||
></image>
|
|
||||||
<text class="item-text">一键开门</text>
|
|
||||||
</view>
|
|
||||||
<view
|
|
||||||
class="function-item"
|
|
||||||
@tap="goToTicketHall"
|
|
||||||
v-if="hasPermi('butler:workOrder:hall')"
|
|
||||||
>
|
|
||||||
<image
|
|
||||||
class="item-icon"
|
|
||||||
src="https://wuyeadmin.bugtc.com/images/imgs/work-order.png"
|
|
||||||
mode="aspectFit"
|
|
||||||
></image>
|
|
||||||
<text class="item-text">工单大厅</text>
|
|
||||||
</view>
|
|
||||||
<view
|
|
||||||
class="function-item"
|
|
||||||
@tap="goToMyTicket"
|
|
||||||
v-if="hasPermi('butler:workOrder:mine')"
|
|
||||||
>
|
|
||||||
<image
|
|
||||||
class="item-icon"
|
|
||||||
src="https://wuyeadmin.bugtc.com/images/imgs/my-work.png"
|
|
||||||
mode="aspectFit"
|
|
||||||
></image>
|
|
||||||
<text class="item-text">我的工单</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
<!-- 第二行 -->
|
<view
|
||||||
<view class="function-row" style="margin-top: 2px">
|
class="function-item"
|
||||||
<view
|
@click="goToOneOpenDoor"
|
||||||
class="function-item"
|
v-if="permStore.hasPermi('butler:door:open')"
|
||||||
@tap="goToComplaint"
|
>
|
||||||
v-if="hasPermi('butler:complaint:handle')"
|
<image
|
||||||
>
|
class="item-icon"
|
||||||
<image
|
src="https://wuyeadmin.bugtc.com/images/imgs/open.png"
|
||||||
class="item-icon"
|
mode="aspectFit"
|
||||||
src="https://wuyeadmin.bugtc.com/images/imgs/complaint.png"
|
></image>
|
||||||
mode="aspectFit"
|
<text class="item-text">一键开门</text>
|
||||||
></image>
|
</view>
|
||||||
<text class="item-text">投诉处理</text>
|
<view
|
||||||
</view>
|
class="function-item"
|
||||||
<view
|
@tap="goToTicketHall"
|
||||||
class="function-item"
|
v-if="permStore.hasPermi('butler:workOrder:hall')"
|
||||||
@tap="goToReplacement_record"
|
>
|
||||||
v-if="hasPermi('butler:meter:replace')"
|
<image
|
||||||
>
|
class="item-icon"
|
||||||
<image
|
src="https://wuyeadmin.bugtc.com/images/imgs/work-order.png"
|
||||||
class="item-icon"
|
mode="aspectFit"
|
||||||
src="https://wuye.ckdzkj.com/images/home/updateDevice.png"
|
></image>
|
||||||
mode="aspectFit"
|
<text class="item-text">工单大厅</text>
|
||||||
></image>
|
</view>
|
||||||
<text class="item-text">仪表换新</text>
|
<view
|
||||||
</view>
|
class="function-item"
|
||||||
|
@tap="goToMyTicket"
|
||||||
|
v-if="permStore.hasPermi('butler:workOrder:mine')"
|
||||||
|
>
|
||||||
|
<image
|
||||||
|
class="item-icon"
|
||||||
|
src="https://wuyeadmin.bugtc.com/images/imgs/my-work.png"
|
||||||
|
mode="aspectFit"
|
||||||
|
></image>
|
||||||
|
<text class="item-text">我的工单</text>
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
class="function-item"
|
||||||
|
@tap="goToComplaint"
|
||||||
|
v-if="permStore.hasPermi('butler:complaint:handle')"
|
||||||
|
>
|
||||||
|
<image
|
||||||
|
class="item-icon"
|
||||||
|
src="https://wuyeadmin.bugtc.com/images/imgs/complaint.png"
|
||||||
|
mode="aspectFit"
|
||||||
|
></image>
|
||||||
|
<text class="item-text">投诉处理</text>
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
class="function-item"
|
||||||
|
@tap="goToReplacement_record"
|
||||||
|
v-if="permStore.hasPermi('butler:meter:replace')"
|
||||||
|
>
|
||||||
|
<image
|
||||||
|
class="item-icon"
|
||||||
|
src="https://wuye.ckdzkj.com/images/home/updateDevice.png"
|
||||||
|
mode="aspectFit"
|
||||||
|
></image>
|
||||||
|
<text class="item-text">仪表换新</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -188,7 +187,11 @@ import {
|
|||||||
getNewNoticeData,
|
getNewNoticeData,
|
||||||
getBannarList
|
getBannarList
|
||||||
} from '../../api/api.js'
|
} from '../../api/api.js'
|
||||||
import { hasPermi } from '../../utils/permissions.js'
|
|
||||||
|
import { usePermStore } from '@/stores/usePermStore'
|
||||||
|
|
||||||
|
const permStore = usePermStore()
|
||||||
|
|
||||||
// 列表数据状态
|
// 列表数据状态
|
||||||
const currentCommunity = ref('请先绑定房屋')
|
const currentCommunity = ref('请先绑定房屋')
|
||||||
const bannerList = ref([])
|
const bannerList = ref([])
|
||||||
@@ -197,8 +200,6 @@ const allCount = ref(0) // 全部巡检
|
|||||||
const pendingCount = ref(0) //待巡检
|
const pendingCount = ref(0) //待巡检
|
||||||
const InspectedCount = ref(0) //已巡检
|
const InspectedCount = ref(0) //已巡检
|
||||||
const statusBarHeight = ref(uni.getSystemInfoSync().statusBarHeight || 0)
|
const statusBarHeight = ref(uni.getSystemInfoSync().statusBarHeight || 0)
|
||||||
|
|
||||||
console.log(hasPermi('butler:meter:replace'))
|
|
||||||
// =======方法=======
|
// =======方法=======
|
||||||
// 跳转小区
|
// 跳转小区
|
||||||
const navigateToPage = () => {
|
const navigateToPage = () => {
|
||||||
@@ -343,10 +344,13 @@ const slelctHomeData = data => {
|
|||||||
getNoticeData()
|
getNoticeData()
|
||||||
getInspectionData()
|
getInspectionData()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const permissionlist = ref([])
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
getbannarData()
|
getbannarData()
|
||||||
getInspectionData()
|
getInspectionData()
|
||||||
currentVillageData()
|
currentVillageData()
|
||||||
|
permStore.initPerm()
|
||||||
})
|
})
|
||||||
|
|
||||||
onLoad(() => {
|
onLoad(() => {
|
||||||
@@ -585,6 +589,9 @@ onUnload(() => {
|
|||||||
padding: 30rpx 0;
|
padding: 30rpx 0;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
margin-top: 20rpx;
|
margin-top: 20rpx;
|
||||||
|
display: grid;
|
||||||
|
|
||||||
|
grid-template-columns: repeat(4, 1fr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 功能行布局 */
|
/* 功能行布局 */
|
||||||
@@ -603,7 +610,6 @@ onUnload(() => {
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
width: 25%;
|
|
||||||
padding: 10rpx 0;
|
padding: 10rpx 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
39
wuye-manager-uniapp/stores/usePermStore.js
Normal file
39
wuye-manager-uniapp/stores/usePermStore.js
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
import {
|
||||||
|
defineStore
|
||||||
|
} from 'pinia'
|
||||||
|
export const usePermStore = defineStore('perm', {
|
||||||
|
state: () => ({
|
||||||
|
permList: []
|
||||||
|
}),
|
||||||
|
getters: {
|
||||||
|
// 封装权限判断,页面直接调用
|
||||||
|
hasPermi: (state) => (perm, mode = 'or') => {
|
||||||
|
const list = state.permList
|
||||||
|
// 超级管理员
|
||||||
|
if (list.includes('*')) return true
|
||||||
|
const checkArr = Array.isArray(perm) ? perm : [perm]
|
||||||
|
if (mode === 'and') {
|
||||||
|
return checkArr.every(item => list.includes(item))
|
||||||
|
} else {
|
||||||
|
return checkArr.some(item => list.includes(item))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
// 初始化:页面onShow时从本地缓存加载权限(冷启动用)
|
||||||
|
initPerm() {
|
||||||
|
const perms = uni.getStorageSync('userPermission')
|
||||||
|
this.permList = Array.isArray(perms) ? perms : []
|
||||||
|
},
|
||||||
|
// 登录成功:设置新权限,同步storage
|
||||||
|
setPerm(list) {
|
||||||
|
this.permList = list
|
||||||
|
uni.setStorageSync('userPermission', list)
|
||||||
|
},
|
||||||
|
// 退出/切换账号:清空内存+本地缓存
|
||||||
|
clearPerm() {
|
||||||
|
this.permList = []
|
||||||
|
uni.removeStorageSync('userPermission')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
/**
|
|
||||||
* 获取本地存储的用户权限标识数组
|
|
||||||
*/
|
|
||||||
export function getPermList() {
|
|
||||||
const perms = uni.getStorageSync('userPermission')
|
|
||||||
return Array.isArray(perms) ? perms : []
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 权限校验函数
|
|
||||||
* @param perm 单个权限字符串 / 多个权限数组
|
|
||||||
* @param mode or满足任一 / and全部满足,默认or
|
|
||||||
* @returns 是否拥有权限 false 没有权限 true 有权限
|
|
||||||
*/
|
|
||||||
export function hasPermi(perm, mode = 'or') {
|
|
||||||
const permList = getPermList()
|
|
||||||
// 超级管理员通配符
|
|
||||||
if (permList.includes('*')) return true
|
|
||||||
|
|
||||||
const checkArr = Array.isArray(perm) ? perm : [perm]
|
|
||||||
|
|
||||||
if (mode === 'and') {
|
|
||||||
// 所有权限都要有
|
|
||||||
return checkArr.every(item => permList.includes(item))
|
|
||||||
} else {
|
|
||||||
console.log(permList, checkArr)
|
|
||||||
// 有一个即可
|
|
||||||
return checkArr.some(item => permList.includes(item))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 退出登录清空权限
|
|
||||||
*/
|
|
||||||
export function clearPermList() {
|
|
||||||
uni.removeStorageSync('userPermission')
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user