修复校验

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

View File

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

View File

@@ -1,30 +1,30 @@
{ {
"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" : { "modules": {
"Camera" : {}, "Camera": {},
"Push" : {}, "Push": {},
"Bluetooth" : {}, "Bluetooth": {},
"Barcode" : {} "Barcode": {}
}, },
"distribute" : { "distribute": {
"android" : { "android": {
"permissions" : [ "permissions": [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>", "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>", "<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>", "<uses-permission android:name=\"android.permission.VIBRATE\"/>",
@@ -41,114 +41,117 @@
"<uses-feature android:name=\"android.hardware.camera\"/>", "<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>" "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
], ],
"targetSdkVersion" : 30 "targetSdkVersion": 30
}, },
"ios" : { "ios": {
"dSYMs" : false, "dSYMs": false,
"privacyDescription" : { "privacyDescription": {
"NSPhotoLibraryUsageDescription" : "需要访问手机相册,选取本地巡检记录照片、业主报修故障图、水电表二维码用于上传工单与巡检台账,仅读取当前业务所需图片,不会获取相册内其他无关照片。", "NSPhotoLibraryUsageDescription": "需要访问手机相册,选取本地巡检记录照片、业主报修故障图、水电表二维码用于上传工单与巡检台账,仅读取当前业务所需图片,不会获取相册内其他无关照片。",
"NSPhotoLibraryAddUsageDescription" : "需要相册写入权限,保存巡检凭证、报修工单至手机相册,方便线下核对查看,图片仅本地存储,不会上传至无关服务器。", "NSPhotoLibraryAddUsageDescription": "需要相册写入权限,保存巡检凭证、报修工单至手机相册,方便线下核对查看,图片仅本地存储,不会上传至无关服务器。",
"NSCameraUsageDescription" : "本应用需要使用相机,用于管家现场巡检拍摄点位记录、处理业主报修拍摄故障照片,扫描水电表二维码抄表,拍摄影像仅用于小区物业工单与巡检业务存档,不会私自留存、对外分享。", "NSCameraUsageDescription": "本应用需要使用相机,用于管家现场巡检拍摄点位记录、处理业主报修拍摄故障照片,扫描水电表二维码抄表,拍摄影像仅用于小区物业工单与巡检业务存档,不会私自留存、对外分享。",
"NSLocationWhenInUseUsageDescription" : "", "NSLocationWhenInUseUsageDescription": "",
"NSLocationAlwaysAndWhenInUseUsageDescription" : "", "NSLocationAlwaysAndWhenInUseUsageDescription": "",
"NSBluetoothPeripheralUsageDescription" : "需要蓝牙权限连接小区智能门禁,实现蓝牙一键开门通行,仅用于小区门禁解锁业务,不采集蓝牙设备信息。", "NSBluetoothPeripheralUsageDescription": "需要蓝牙权限连接小区智能门禁,实现蓝牙一键开门通行,仅用于小区门禁解锁业务,不采集蓝牙设备信息。",
"NSBluetoothAlwaysUsageDescription" : "本应用需要蓝牙权限,用于扫描、连接小区蓝牙门禁设备实现一键开门,仅和本小区门禁硬件建立通信,不会扫描、连接无关蓝牙设备。" "NSBluetoothAlwaysUsageDescription": "本应用需要蓝牙权限,用于扫描、连接小区蓝牙门禁设备实现一键开门,仅和本小区门禁硬件建立通信,不会扫描、连接无关蓝牙设备。"
}, },
"urltypes" : [ "urltypes": [{
{ "urlschemes": ["unionpaycashier"]
"urlschemes" : [ "unionpaycashier" ] }],
} "idfa": false
],
"idfa" : false
}, },
"sdkConfigs" : { "sdkConfigs": {
"push" : { "push": {
"unipush" : { "unipush": {
"version" : "2", "version": "2",
"offline" : false, "offline": false,
"oppo" : {}, "oppo": {},
"vivo" : {}, "vivo": {},
"mi" : {}, "mi": {},
"meizu" : {}, "meizu": {},
"honor" : {}, "honor": {},
"fcm" : {} "fcm": {}
} }
}, },
"geolocation" : { "geolocation": {
"system" : { "system": {
"__platform__" : [ "ios", "android" ] "__platform__": ["ios", "android"]
} }
} }
}, },
"icons" : { "icons": {
"android" : { "android": {
"hdpi" : "unpackage/res/icons/72x72.png", "hdpi": "unpackage/res/icons/72x72.png",
"xhdpi" : "unpackage/res/icons/96x96.png", "xhdpi": "unpackage/res/icons/96x96.png",
"xxhdpi" : "unpackage/res/icons/144x144.png", "xxhdpi": "unpackage/res/icons/144x144.png",
"xxxhdpi" : "unpackage/res/icons/192x192.png" "xxxhdpi": "unpackage/res/icons/192x192.png"
}, },
"ios" : { "ios": {
"appstore" : "unpackage/res/icons/1024x1024.png", "appstore": "unpackage/res/icons/1024x1024.png",
"ipad" : { "ipad": {
"app" : "unpackage/res/icons/76x76.png", "app": "unpackage/res/icons/76x76.png",
"app@2x" : "unpackage/res/icons/152x152.png", "app@2x": "unpackage/res/icons/152x152.png",
"notification" : "unpackage/res/icons/20x20.png", "notification": "unpackage/res/icons/20x20.png",
"notification@2x" : "unpackage/res/icons/40x40.png", "notification@2x": "unpackage/res/icons/40x40.png",
"proapp@2x" : "unpackage/res/icons/167x167.png", "proapp@2x": "unpackage/res/icons/167x167.png",
"settings" : "unpackage/res/icons/29x29.png", "settings": "unpackage/res/icons/29x29.png",
"settings@2x" : "unpackage/res/icons/58x58.png", "settings@2x": "unpackage/res/icons/58x58.png",
"spotlight" : "unpackage/res/icons/40x40.png", "spotlight": "unpackage/res/icons/40x40.png",
"spotlight@2x" : "unpackage/res/icons/80x80.png" "spotlight@2x": "unpackage/res/icons/80x80.png"
}, },
"iphone" : { "iphone": {
"app@2x" : "unpackage/res/icons/120x120.png", "app@2x": "unpackage/res/icons/120x120.png",
"app@3x" : "unpackage/res/icons/180x180.png", "app@3x": "unpackage/res/icons/180x180.png",
"notification@2x" : "unpackage/res/icons/40x40.png", "notification@2x": "unpackage/res/icons/40x40.png",
"notification@3x" : "unpackage/res/icons/60x60.png", "notification@3x": "unpackage/res/icons/60x60.png",
"settings@2x" : "unpackage/res/icons/58x58.png", "settings@2x": "unpackage/res/icons/58x58.png",
"settings@3x" : "unpackage/res/icons/87x87.png", "settings@3x": "unpackage/res/icons/87x87.png",
"spotlight@2x" : "unpackage/res/icons/80x80.png", "spotlight@2x": "unpackage/res/icons/80x80.png",
"spotlight@3x" : "unpackage/res/icons/120x120.png" "spotlight@3x": "unpackage/res/icons/120x120.png"
} }
} }
} }
} }
}, },
"quickapp" : {}, "quickapp": {},
"mp-weixin" : { "mp-weixin": {
"appid" : "wx40625124315d2de1", "appid": "wx40625124315d2de1",
"usingComponents" : true, "usingComponents": true,
"lazyCodeLoading" : "requiredComponents" "lazyCodeLoading": "requiredComponents"
}, },
"mp-alipay" : { "mp-alipay": {
"usingComponents" : true "usingComponents": true
}, },
"mp-baidu" : { "mp-baidu": {
"usingComponents" : true "usingComponents": true
}, },
"mp-toutiao" : { "mp-toutiao": {
"usingComponents" : true "usingComponents": true
}, },
"uniStatistics" : { "uniStatistics": {
"enable" : false "enable": false
}, },
"vueVersion" : "3", "vueVersion": "3",
"locale" : "zh-Hans", "locale": "zh-Hans",
"fallbackLocale" : "zh-Hans", "fallbackLocale": "zh-Hans",
"app-harmony" : { "app-harmony": {
"distribute" : { "distribute": {
"bundleName" : "com.chengkong.property.butler", "bundleName": "com.chengkong.property.butler",
"signingConfigs" : { "signingConfigs": {
"release" : { "release": {
"certpath" : "C:/Users/admin/Desktop/AppStore/new_harmony/花开物业.cer", "certpath": "C:/Users/admin/Desktop/AppStore/new_harmony/花开物业.cer",
"keyAlias" : "wuye", "keyAlias": "wuye",
"keyPassword" : "0000001ADF5A2ECBEA883B44816B2D1993792348DB36113109A8D6190B7BB0FA49FC807D9A4191B23E10", "keyPassword": "0000001ADF5A2ECBEA883B44816B2D1993792348DB36113109A8D6190B7BB0FA49FC807D9A4191B23E10",
"profile" : "C:/Users/admin/Desktop/AppStore/new_harmony/guanjiaRelease.p7b", "profile": "C:/Users/admin/Desktop/AppStore/new_harmony/guanjiaRelease.p7b",
"signAlg" : "SHA256withECDSA", "signAlg": "SHA256withECDSA",
"storeFile" : "C:/Users/admin/Desktop/AppStore/new_harmony/huakaiwuye.p12", "storeFile": "C:/Users/admin/Desktop/AppStore/new_harmony/huakaiwuye.p12",
"storePassword" : "0000001AA46C978566364D5E371290888A2A18578BBB958BCACA8A64F023354E30EC33C84C8CC9515B38" "storePassword": "0000001AA46C978566364D5E371290888A2A18578BBB958BCACA8A64F023354E30EC33C84C8CC9515B38"
} }
} }
} }
},
"h5": {
"devServer": {
"port": 5588
}
} }
} }

View File

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

View File

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

View File

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

View File

@@ -163,7 +163,7 @@
<view <view
class="function-item" class="function-item"
@tap="goToReplacement_record" @tap="goToReplacement_record"
v-if="hasPermi('butler:,meter:replace')" v-if="hasPermi('butler:meter:replace')"
> >
<image <image
class="item-icon" class="item-icon"
@@ -198,6 +198,7 @@ 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 = () => {

View File

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