修复校验

This commit is contained in:
Zy
2026-07-20 14:50:16 +08:00
parent d7c201d357
commit a5a883a652
8 changed files with 672 additions and 640 deletions

View File

@@ -3,12 +3,12 @@
* @Author: Zy
* @Date: 2026-05-18 15:36:10
* @LastEditor: Zy
* @LastEditTime: 2026-07-08 17:26:41
* @LastEditTime: 2026-07-20 14:29:10
*/
let baseUrl = ''
if (process.env.NODE_ENV === 'development') {
baseUrl = 'http://192.168.1.222:8080' // 开发环境
baseUrl = 'http://192.168.1.6:8080' // 开发环境
} else {
baseUrl = 'https://wuyeapi.ckdzkj.com' // 生产环境
// baseUrl = 'https://wuyeapi.bugtc.com' // 生产环境

View File

@@ -9,7 +9,7 @@
<view class="popup-content">
<view class="section-text">
我已仔细阅读并同意
<view class="privacy-link" >
<view class="privacy-link">
<text @click="goToUserAgreement">《用户协议》</text>和
<text @click="goToPrivacy">《隐私政策》</text>
</view>

View File

@@ -1,30 +1,30 @@
{
"name" : "花开管家",
"appid" : "__UNI__5F224F3",
"description" : "智慧社区管家端,专为小区物业管理人员打造,支持多小区灵活切换管理。集成账号密码、手机号密码双重登录模式,内置忘记密码找回功能,保障账号安全。涵盖消息通知、日常巡检、故障报修、一键开门、工单流转、投诉处理等核心办公功能,物业人员可在线完成巡检打卡、问题上报、工单派发跟进、投诉对接处理等日常工作,同时支持查看个人上报记录、巡检历史,便捷修改账号信息与登录密码。高效简化社区物业办公流程,提升小区服务与管理效率,打造便捷智能的社区管理服务平台。",
"versionName" : "1.0.2",
"versionCode" : 102,
"transformPx" : false,
"app-plus" : {
"usingComponents" : true,
"nvueStyleCompiler" : "uni-app",
"compilerVersion" : 3,
"splashscreen" : {
"alwaysShowBeforeRender" : true,
"waiting" : true,
"autoclose" : true,
"delay" : 0,
"useOriginalMsgbox" : true
"name": "花开管家",
"appid": "__UNI__5F224F3",
"description": "智慧社区管家端,专为小区物业管理人员打造,支持多小区灵活切换管理。集成账号密码、手机号密码双重登录模式,内置忘记密码找回功能,保障账号安全。涵盖消息通知、日常巡检、故障报修、一键开门、工单流转、投诉处理等核心办公功能,物业人员可在线完成巡检打卡、问题上报、工单派发跟进、投诉对接处理等日常工作,同时支持查看个人上报记录、巡检历史,便捷修改账号信息与登录密码。高效简化社区物业办公流程,提升小区服务与管理效率,打造便捷智能的社区管理服务平台。",
"versionName": "1.0.2",
"versionCode": 102,
"transformPx": false,
"app-plus": {
"usingComponents": true,
"nvueStyleCompiler": "uni-app",
"compilerVersion": 3,
"splashscreen": {
"alwaysShowBeforeRender": true,
"waiting": true,
"autoclose": true,
"delay": 0,
"useOriginalMsgbox": true
},
"modules" : {
"Camera" : {},
"Push" : {},
"Bluetooth" : {},
"Barcode" : {}
"modules": {
"Camera": {},
"Push": {},
"Bluetooth": {},
"Barcode": {}
},
"distribute" : {
"android" : {
"permissions" : [
"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\"/>",
@@ -41,114 +41,117 @@
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
],
"targetSdkVersion" : 30
"targetSdkVersion": 30
},
"ios" : {
"dSYMs" : false,
"privacyDescription" : {
"NSPhotoLibraryUsageDescription" : "需要访问手机相册,选取本地巡检记录照片、业主报修故障图、水电表二维码用于上传工单与巡检台账,仅读取当前业务所需图片,不会获取相册内其他无关照片。",
"NSPhotoLibraryAddUsageDescription" : "需要相册写入权限,保存巡检凭证、报修工单至手机相册,方便线下核对查看,图片仅本地存储,不会上传至无关服务器。",
"NSCameraUsageDescription" : "本应用需要使用相机,用于管家现场巡检拍摄点位记录、处理业主报修拍摄故障照片,扫描水电表二维码抄表,拍摄影像仅用于小区物业工单与巡检业务存档,不会私自留存、对外分享。",
"NSLocationWhenInUseUsageDescription" : "",
"NSLocationAlwaysAndWhenInUseUsageDescription" : "",
"NSBluetoothPeripheralUsageDescription" : "需要蓝牙权限连接小区智能门禁,实现蓝牙一键开门通行,仅用于小区门禁解锁业务,不采集蓝牙设备信息。",
"NSBluetoothAlwaysUsageDescription" : "本应用需要蓝牙权限,用于扫描、连接小区蓝牙门禁设备实现一键开门,仅和本小区门禁硬件建立通信,不会扫描、连接无关蓝牙设备。"
"ios": {
"dSYMs": false,
"privacyDescription": {
"NSPhotoLibraryUsageDescription": "需要访问手机相册,选取本地巡检记录照片、业主报修故障图、水电表二维码用于上传工单与巡检台账,仅读取当前业务所需图片,不会获取相册内其他无关照片。",
"NSPhotoLibraryAddUsageDescription": "需要相册写入权限,保存巡检凭证、报修工单至手机相册,方便线下核对查看,图片仅本地存储,不会上传至无关服务器。",
"NSCameraUsageDescription": "本应用需要使用相机,用于管家现场巡检拍摄点位记录、处理业主报修拍摄故障照片,扫描水电表二维码抄表,拍摄影像仅用于小区物业工单与巡检业务存档,不会私自留存、对外分享。",
"NSLocationWhenInUseUsageDescription": "",
"NSLocationAlwaysAndWhenInUseUsageDescription": "",
"NSBluetoothPeripheralUsageDescription": "需要蓝牙权限连接小区智能门禁,实现蓝牙一键开门通行,仅用于小区门禁解锁业务,不采集蓝牙设备信息。",
"NSBluetoothAlwaysUsageDescription": "本应用需要蓝牙权限,用于扫描、连接小区蓝牙门禁设备实现一键开门,仅和本小区门禁硬件建立通信,不会扫描、连接无关蓝牙设备。"
},
"urltypes" : [
{
"urlschemes" : [ "unionpaycashier" ]
}
],
"idfa" : false
"urltypes": [{
"urlschemes": ["unionpaycashier"]
}],
"idfa": false
},
"sdkConfigs" : {
"push" : {
"unipush" : {
"version" : "2",
"offline" : false,
"oppo" : {},
"vivo" : {},
"mi" : {},
"meizu" : {},
"honor" : {},
"fcm" : {}
"sdkConfigs": {
"push": {
"unipush": {
"version": "2",
"offline": false,
"oppo": {},
"vivo": {},
"mi": {},
"meizu": {},
"honor": {},
"fcm": {}
}
},
"geolocation" : {
"system" : {
"__platform__" : [ "ios", "android" ]
"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"
"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"
"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"
"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"
"quickapp": {},
"mp-weixin": {
"appid": "wx40625124315d2de1",
"usingComponents": true,
"lazyCodeLoading": "requiredComponents"
},
"mp-alipay" : {
"usingComponents" : true
"mp-alipay": {
"usingComponents": true
},
"mp-baidu" : {
"usingComponents" : true
"mp-baidu": {
"usingComponents": true
},
"mp-toutiao" : {
"usingComponents" : true
"mp-toutiao": {
"usingComponents": true
},
"uniStatistics" : {
"enable" : false
"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"
"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
}
}
}

View File

@@ -71,7 +71,8 @@
>我已阅读并同意
<text class="agreePrivacy">《用户隐私政策》</text>
</text> -->
<text class="agreement-text" >我已阅读并同意
<text class="agreement-text"
>我已阅读并同意
<text class="agreePrivacy" @click.stop="goToUserAgreement">《用户协议》</text>和
<text class="agreePrivacy" @click.stop="goToPrivacy">《隐私政策》</text>
</text>
@@ -87,7 +88,11 @@
</view>
<!-- 隐私协议弹窗 -->
<privacy-popup v-model:show="showPrivacyPopup" @agree="agreePrivacy" @disagree="disagreePrivacy" />
<privacy-popup
v-model:show="showPrivacyPopup"
@agree="agreePrivacy"
@disagree="disagreePrivacy"
/>
</view>
</template>
@@ -139,26 +144,25 @@ const checkForm = () => {
const toggleAgreement = () => {
agreeAgreement.value = !agreeAgreement.value
}
// 打开用户协议
const goToUserAgreement = () => {
// 打开用户协议
const goToUserAgreement = () => {
// #ifdef APP-PLUS
plus.runtime.openURL('https://wuye.ckdzkj.com/parivw/butler_xieyi.html')
// #endif
// #ifdef H5
window.open('https://wuye.ckdzkj.com/parivw/butler_xieyi.html')
// #endif
}
}
// 打开隐私政策
const goToPrivacy = () => {
// 打开隐私政策
const goToPrivacy = () => {
// #ifdef APP-PLUS
plus.runtime.openURL('https://wuye.ckdzkj.com/parivw/butler.html')
// #endif
// #ifdef H5
window.open('https://wuye.ckdzkj.com/parivw/butler.html')
// #endif
}
}
// 不同意隐私协议
const disagreePrivacy = () => {
@@ -247,6 +251,7 @@ const handleLogin = () => {
if (res.code === 200) {
if (res.data) {
uni.setStorageSync('token', res.data.token)
uni.setStorageSync('userPermission', res.data.user.permissions)
// 存用户ID
if (res.data.user.userId) {
uni.setStorageSync('userId', res.data.user.userId)

View File

@@ -8,11 +8,20 @@
<view class="input-item">
<view class="input-icon">
<!-- <uni-icons type="phone" size="24" color="#999"></uni-icons> -->
<image src="https://wuyeadmin.bugtc.com/images/login/phone.png" mode=""
style="height: 100%;width: 100%;"></image>
<image
src="https://wuyeadmin.bugtc.com/images/login/phone.png"
mode=""
style="height: 100%; width: 100%"
></image>
</view>
<uni-easyinput class="input-content" type="text" v-model="phoneNumber" placeholder="请输入帐号"
:inputBorder="false" :placeholderStyle="placeholderStyle">
<uni-easyinput
class="input-content"
type="text"
v-model="phoneNumber"
placeholder="请输入帐号"
:inputBorder="false"
:placeholderStyle="placeholderStyle"
>
</uni-easyinput>
</view>
@@ -20,17 +29,25 @@
<view class="input-item">
<view class="input-icon">
<!-- <uni-icons type="locked" size="24" color="#999"></uni-icons> -->
<image src="https://wuyeadmin.bugtc.com/images/login/password.png" mode=""
style="height: 100%;width: 100%;"></image>
<image
src="https://wuyeadmin.bugtc.com/images/login/password.png"
mode=""
style="height: 100%; width: 100%"
></image>
</view>
<uni-easyinput class="input-content" type="password" v-model="password" placeholder="请输入6-16位密码"
:inputBorder="false" :placeholderStyle="placeholderStyle">
<uni-easyinput
class="input-content"
type="password"
v-model="password"
placeholder="请输入6-16位密码"
:inputBorder="false"
:placeholderStyle="placeholderStyle"
>
</uni-easyinput>
</view>
<!-- 记住密码 -->
<view class="remember-wrap" style="display: none;">
<view class="remember-wrap" style="display: none">
<view class="remember-item" @click="toggleRemember">
<uni-icons type="checkbox-filled" size="18" color="#4D5DFA" v-if="rememberPwd"></uni-icons>
<uni-icons type="checkbox" size="18" color="#999" v-else></uni-icons>
@@ -42,10 +59,16 @@
<view class="agreement-wrap">
<view class="agreement-item">
<view @click="toggleAgreement">
<uni-icons type="checkbox-filled" size="24" color="#4D5DFA" v-if="agreeAgreement"></uni-icons>
<uni-icons
type="checkbox-filled"
size="24"
color="#4D5DFA"
v-if="agreeAgreement"
></uni-icons>
<uni-icons type="checkbox" size="24" color="#999" v-else></uni-icons>
</view>
<text class="agreement-text" >我已阅读并同意
<text class="agreement-text"
>我已阅读并同意
<text class="agreePrivacy" @click.stop="goToUserAgreement">《用户协议》</text>和
<text class="agreePrivacy" @click.stop="goToPrivacy">《隐私政策》</text>
</text>
@@ -54,9 +77,7 @@
</view>
<!-- 登录按钮 -->
<button class="login-btn" @click="handleLogin">
登录
</button>
<button class="login-btn" @click="handleLogin">登录</button>
<!-- 底部链接 -->
<view class="bottom-link">
@@ -65,197 +86,196 @@
</view>
</view>
<!-- 隐私协议弹窗 -->
<privacy-popup v-model:show="showPrivacyPopup" @agree="agreePrivacy" @disagree="disagreePrivacy" @close="showPrivacyPopup = false" />
<privacy-popup
v-model:show="showPrivacyPopup"
@agree="agreePrivacy"
@disagree="disagreePrivacy"
@close="showPrivacyPopup = false"
/>
</template>
<script setup>
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 { 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'
// 响应式数据
const phoneNumber = ref('');
const password = ref('');
const agreeAgreement = ref(false); // 默认勾选
const rememberPwd = ref(false);
const placeholderStyle = ref('font-size:24rpx')
const showPrivacyPopup = ref(false)
// 响应式数据
const phoneNumber = ref('')
const password = ref('')
const agreeAgreement = ref(false) // 默认勾选
const rememberPwd = ref(false)
const placeholderStyle = ref('font-size:24rpx')
const showPrivacyPopup = ref(false)
// 计算属性:是否可登录(帐号+密码+协议都满足)
const canLogin = computed(() => {
const phoneReg = /^[a-zA-Z0-9_-]{4,16}$/; // 4-16位
const pwdReg = /^.{6,16}$/; // 密码6-16位
return phoneReg.test(phoneNumber.value) && pwdReg.test(password.value) && agreeAgreement.value;
});
// 计算属性:是否可登录(帐号+密码+协议都满足)
const canLogin = computed(() => {
const phoneReg = /^[a-zA-Z0-9_-]{4,16}$/ // 4-16位
const pwdReg = /^.{6,16}$/ // 密码6-16位
return phoneReg.test(phoneNumber.value) && pwdReg.test(password.value) && agreeAgreement.value
})
// 切换协议勾选
const toggleAgreement = () => {
agreeAgreement.value = !agreeAgreement.value;
};
// 切换记住密码
const toggleRemember = () => {
rememberPwd.value = !rememberPwd.value;
};
// 切换协议勾选
const toggleAgreement = () => {
agreeAgreement.value = !agreeAgreement.value
}
// 切换记住密码
const toggleRemember = () => {
rememberPwd.value = !rememberPwd.value
}
// 打开用户协议
const goToUserAgreement = () => {
// 打开用户协议
const goToUserAgreement = () => {
// #ifdef APP-PLUS
plus.runtime.openURL('https://wuye.ckdzkj.com/parivw/butler_xieyi.html')
// #endif
// #ifdef H5
window.open('https://wuye.ckdzkj.com/parivw/butler_xieyi.html')
// #endif
}
}
// 打开隐私政策
const goToPrivacy = () => {
// 打开隐私政策
const goToPrivacy = () => {
// #ifdef APP-PLUS
plus.runtime.openURL('https://wuye.ckdzkj.com/parivw/butler.html')
// #endif
// #ifdef H5
window.open('https://wuye.ckdzkj.com/parivw/butler.html')
// #endif
}
}
// 打开隐私协议弹窗
// const goToPrivacy = () => {
// showPrivacyPopup.value = true
// }
// 打开隐私协议弹窗
// const goToPrivacy = () => {
// showPrivacyPopup.value = true
// }
// 不同意隐私协议
const disagreePrivacy = () => {
// 不同意隐私协议
const disagreePrivacy = () => {
agreeAgreement.value = false
showPrivacyPopup.value = false
}
}
// 检查表单
const checkForm = () => {};
// 检查表单
const checkForm = () => {}
onLoad(() => {
const savedPhone = uni.getStorageSync('rememberPhone')
const savedPwd = uni.getStorageSync('rememberPassword')
const savedRemember = uni.getStorageSync('rememberPwd')
if (savedPhone) phoneNumber.value = savedPhone
if (savedPwd) password.value = savedPwd
if (savedRemember) rememberPwd.value = savedRemember
})
onLoad(() => {
const savedPhone = uni.getStorageSync('rememberPhone');
const savedPwd = uni.getStorageSync('rememberPassword');
const savedRemember = uni.getStorageSync('rememberPwd');
if (savedPhone) phoneNumber.value = savedPhone;
if (savedPwd) password.value = savedPwd;
if (savedRemember) rememberPwd.value = savedRemember;
});
// 登录逻辑
const handleLogin = () => {
// 登录逻辑
const handleLogin = () => {
if (!phoneNumber.value) {
uni.showToast({ title: '请输入账号', icon: 'none' });
return;
uni.showToast({ title: '请输入账号', icon: 'none' })
return
}
if (phoneNumber.value.length < 4 || phoneNumber.value.length > 16) {
uni.showToast({ title: '账号长度需为 4-16 位', icon: 'none' });
return;
uni.showToast({ title: '账号长度需为 4-16 位', icon: 'none' })
return
}
if (!password.value) {
uni.showToast({ title: '请输入密码', icon: 'none' });
return;
uni.showToast({ title: '请输入密码', icon: 'none' })
return
}
if (password.value.length < 6) {
uni.showToast({ title: '密码至少输入 6 位', icon: 'none' });
return;
uni.showToast({ title: '密码至少输入 6 位', icon: 'none' })
return
}
if (password.value.length > 16) {
uni.showToast({ title: '密码不能超过 16 位', icon: 'none' });
return;
uni.showToast({ title: '密码不能超过 16 位', icon: 'none' })
return
}
if(!agreeAgreement.value){
showPrivacyPopup.value = true;
return;
if (!agreeAgreement.value) {
showPrivacyPopup.value = true
return
}
uni.showLoading({ title: '登录中...', mask: true });
uni.showLoading({ title: '登录中...', mask: true })
const push_cid = uni.getStorageSync('push_cid')
// console.log('登录cid',push_cid)
let params = {
username:phoneNumber.value,
password:password.value,
cid:push_cid
username: phoneNumber.value,
password: password.value,
cid: push_cid
}
getLoginPassword(params).then(res =>{
getLoginPassword(params)
.then(res => {
// console.log('33333',res)
if(res.code === 200){
uni.setStorageSync('token', res.data.token);
if (res.code === 200) {
uni.setStorageSync('token', res.data.token)
// 清掉上次账号的小区缓存,防止新账号显示旧小区
uni.removeStorageSync('currentVillage');
uni.removeStorageSync('currentVillage')
// 存用户ID
// if(res.data) {
// // 存当前绑定的小区ID,0 表示未绑定
// // const currentVillageId = res.data.currentVillageId || 0;
// // uni.setStorageSync('currentVillageId', currentVillageId);
// }
uni.hideLoading();
uni.setStorageSync('userPermission', res.data.user.permissions)
uni.hideLoading()
if (rememberPwd.value) {
uni.setStorageSync('rememberPhone', phoneNumber.value);
uni.setStorageSync('rememberPassword', password.value);
uni.setStorageSync('rememberPwd', true);
uni.setStorageSync('rememberPhone', phoneNumber.value)
uni.setStorageSync('rememberPassword', password.value)
uni.setStorageSync('rememberPwd', true)
} else {
uni.removeStorageSync('rememberPhone');
uni.removeStorageSync('rememberPassword');
uni.removeStorageSync('rememberPwd');
uni.removeStorageSync('rememberPhone')
uni.removeStorageSync('rememberPassword')
uni.removeStorageSync('rememberPwd')
}
uni.showToast({ title: '登录成功', icon: 'success' });
setTimeout(() =>{
uni.switchTab({
uni.showToast({ title: '登录成功', icon: 'success' })
setTimeout(() => {
uni.switchTab(
{
url: '/pages/index/index'
},1000);
},
1000
)
})
}else{
uni.showToast({ title: res.msg, icon: 'error' });
} else {
uni.showToast({ title: res.msg, icon: 'error' })
}
}).catch(err => {
})
.catch(err => {
uni.showToast({
title: err.msg,
icon: 'error'
});
})
})
}
};
// 同意隐私协议(弹窗中点击同意 → 直接登录)
const agreePrivacy = () => {
// 同意隐私协议(弹窗中点击同意 → 直接登录)
const agreePrivacy = () => {
agreeAgreement.value = true
showPrivacyPopup.value = false
handleLogin()
}
}
</script>
<style scoped>
.login-page {
.login-page {
padding: 80rpx 40rpx 40rpx;
/* background-color: #f8f9fa; */
min-height: 100vh;
background: repeating-linear-gradient(180deg, #E2F0FF, #F6FAFF);
}
background: repeating-linear-gradient(180deg, #e2f0ff, #f6faff);
}
.status_bar {
.status_bar {
height: 160px;
width: 100%;
}
}
.login-title {
.login-title {
font-size: 52rpx;
font-weight: 600;
color: #333;
text-align: center;
margin-bottom: 142rpx;
}
}
.input-item {
.input-item {
display: flex;
align-items: center;
background-color: #fff;
@@ -264,126 +284,125 @@
height: 88rpx;
margin-bottom: 30rpx;
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
}
}
.input-icon {
.input-icon {
margin-right: 20rpx;
width: 50rpx;
height: 50rpx;
}
}
.input-content {
.input-content {
flex: 1;
font-size: 28rpx;
color: #333;
display: flex;
align-items: center;
}
}
/* 清除 uni-easyinput 内部默认边距 */
:deep(.uni-easyinput__content) {
/* 清除 uni-easyinput 内部默认边距 */
:deep(.uni-easyinput__content) {
margin: 0 !important;
padding: 0 !important;
min-height: auto !important;
background-color: transparent !important;
}
}
:deep(.uni-easyinput__content-input) {
:deep(.uni-easyinput__content-input) {
height: 60rpx !important;
min-height: 60rpx !important;
line-height: 60rpx !important;
padding: 0 !important;
margin: 0 !important;
font-size: 28rpx;
}
}
.remember-wrap {
.remember-wrap {
display: flex;
align-items: center;
margin: 20rpx 0 0 0;
padding: 0 10rpx;
}
}
.remember-item {
.remember-item {
display: flex;
align-items: center;
}
}
.remember-text {
.remember-text {
font-size: 24rpx;
color: #666;
margin-left: 10rpx;
}
}
.agreement-wrap {
.agreement-wrap {
display: flex;
justify-content: space-between;
align-items: center;
margin: 40rpx 0 28rpx 0;
padding: 0 10rpx;
}
}
.agreement-item {
.agreement-item {
display: flex;
align-items: center;
flex: 1;
min-width: 0;
}
}
.agreement-text {
.agreement-text {
font-size: 24rpx;
color: #666;
margin-left: 10rpx;
line-height: 1.5;
}
.agreePrivacy{
color: #4D5DFA;
}
/* .agreePrivacy.active{
}
.agreePrivacy {
color: #4d5dfa;
}
/* .agreePrivacy.active{
color: #4D5DFA;
} */
.forget-pwd {
.forget-pwd {
font-size: 24rpx;
color: #666;
text-decoration: none;
flex-shrink: 0;
margin-left: 16rpx;
line-height: 1.5;
}
}
.login-btn {
.login-btn {
width: 100%;
height: 88rpx;
line-height: 88rpx;
background-color: #4D5DFA;
background-color: #4d5dfa;
color: #fff;
border-radius: 8rpx;
font-size: 28rpx;
margin-bottom: 40rpx;
}
}
.login-btn:disabled {
.login-btn:disabled {
background-color: #99c8ff;
color: #fff;
/* border-radius: 50px; */
}
}
/* 禁用按钮边框 */
button:after {
/* 禁用按钮边框 */
button:after {
border-radius: 8px;
}
}
.bottom-link {
.bottom-link {
display: flex;
justify-content: center;
padding: 0 20rpx;
}
}
.link-item {
.link-item {
font-size: 28rpx;
color: #4D5DFA;
color: #4d5dfa;
text-decoration: none;
}
}
</style>

View File

@@ -35,9 +35,7 @@
<!-- 退出登录按钮 -->
<view class="logout-btn-wrap">
<button class="logout-btn" @tap="handleLogout">
退出登录
</button>
<button class="logout-btn" @tap="handleLogout">退出登录</button>
</view>
</view>
</template>
@@ -46,6 +44,7 @@
import { ref } from 'vue'
import { onShow } from '@dcloudio/uni-app'
import { logout, getSettingInfo } from '../../api/api.js'
import { clearPermList } from '../../utils/permissions.js'
// 响应式数据
const phoneNumber = ref('') // 绑定手机号
@@ -91,9 +90,9 @@ const goToModifyPassword = () => {
})
}
// 跳转到注销账号
const goToDeleteAccount = () =>{
const goToDeleteAccount = () => {
uni.navigateTo({
url:'/pageSubPack/setting/deleteAccount'
url: '/pageSubPack/setting/deleteAccount'
})
}
@@ -116,17 +115,21 @@ const handleLogout = () => {
const confirmLogout = () => {
uni.showLoading({ title: '退出中...' })
logout().then(res => {
logout()
.then(res => {
if (res.code === 200) {
clearPermList()
uni.clearStorageSync()
uni.showToast({ title: '退出登录成功', icon: 'success' })
uni.redirectTo({ url: '/pageSubPack/loginSub/pwd-login' })
} else {
uni.showToast({ title: res.msg || '退出失败', icon: 'none' })
}
}).catch(() => {
})
.catch(() => {
uni.showToast({ title: '退出失败,请重试', icon: 'none' })
}).finally(() => {
})
.finally(() => {
uni.hideLoading()
})
}

View File

@@ -163,7 +163,7 @@
<view
class="function-item"
@tap="goToReplacement_record"
v-if="hasPermi('butler:,meter:replace')"
v-if="hasPermi('butler:meter:replace')"
>
<image
class="item-icon"
@@ -198,6 +198,7 @@ const pendingCount = ref(0) //待巡检
const InspectedCount = ref(0) //已巡检
const statusBarHeight = ref(uni.getSystemInfoSync().statusBarHeight || 0)
console.log(hasPermi('butler:meter:replace'))
// =======方法=======
// 跳转小区
const navigateToPage = () => {

View File

@@ -10,7 +10,7 @@ export function getPermList() {
* 权限校验函数
* @param perm 单个权限字符串 / 多个权限数组
* @param mode or满足任一 / and全部满足,默认or
* @returns 是否拥有权限
* @returns 是否拥有权限 false 没有权限 true 有权限
*/
export function hasPermi(perm, mode = 'or') {
const permList = getPermList()
@@ -23,6 +23,7 @@ export function hasPermi(perm, mode = 'or') {
// 所有权限都要有
return checkArr.every(item => permList.includes(item))
} else {
console.log(permList, checkArr)
// 有一个即可
return checkArr.some(item => permList.includes(item))
}