合并账号和手机号登录页面;更换图片地址;

This commit is contained in:
zhouyanli
2026-08-29 17:08:30 +08:00
parent 872a98529b
commit 7c15f37a6f
13 changed files with 322 additions and 638 deletions

View File

@@ -40,7 +40,7 @@ export default function request(url, data = {}, method = 'GET') {
clearAccountStorage() clearAccountStorage()
setTimeout(() => { setTimeout(() => {
uni.reLaunch({ uni.reLaunch({
url: '/pageSubPack/loginSub/pwd-login' url: '/pageSubPack/loginSub/login?mode=pwd'
}) })
}, 1500) }, 1500)
reject({ reject({

View File

@@ -1,18 +1,12 @@
<template> <template>
<view class="reset-pwd-page"> <view class="reset-pwd-page">
<view class="status_bar"></view>
<!-- 顶部导航栏 -->
<view class="nav-bar">
<uni-icons type="left" size="28" color="#333" @click="goBack"></uni-icons>
<view class="nav-title">修改密码</view>
</view>
<!-- 新密码输入框 --> <!-- 新密码输入框 -->
<view class="input-item"> <view class="input-item">
<uni-easyinput class="input-content" type="password" v-model="newPassword" <uni-easyinput class="input-content" type="password" v-model="newPassword"
placeholder="请输入密码" :inputBorder="false" :placeholderStyle="placeholderStyle"> placeholder="请输入密码" :inputBorder="false" :placeholderStyle="placeholderStyle">
</uni-easyinput> </uni-easyinput>
</view> </view>
<view class="pwd-hint" v-if="passwordTooSimple">密码过于简单,需字母和数字组合</view>
<!-- 确认密码输入框 --> <!-- 确认密码输入框 -->
<view class="input-item"> <view class="input-item">
@@ -59,11 +53,14 @@ const canConfirm = computed(() => {
&& newPassword.value && confirmPassword.value; && newPassword.value && confirmPassword.value;
}); });
// 密码是否过于简单(缺少字母或数字组合)
const passwordTooSimple = computed(() => {
const pwd = newPassword.value;
if (!pwd) return false;
return !(/[a-zA-Z]/.test(pwd) && /\d/.test(pwd));
});
// ========== 方法 ========== // ========== 方法 ==========
// 返回上一页
const goBack = () => {
uni.navigateBack();
};
onShow(() => { onShow(() => {
// 从缓存读取参数 // 从缓存读取参数
const params = uni.getStorageSync('tempChangePwdParams') || {}; const params = uni.getStorageSync('tempChangePwdParams') || {};
@@ -92,16 +89,16 @@ const handleConfirm = () => {
//uni.setStorageSync('token', res.token); // 后端返回token字段 //uni.setStorageSync('token', res.token); // 后端返回token字段
uni.showToast({ title: '修改成功', icon: 'success' }); uni.showToast({ title: '修改成功', icon: 'success' });
setTimeout(() =>{ setTimeout(() =>{
uni.navigateTo({ url: '/pageSubPack/loginSub/pwd-login' }); uni.navigateTo({ url: '/pageSubPack/loginSub/login?mode=pwd' });
},1500) },1500)
}else{ }else{
uni.showToast({ title: "修改失败", icon: 'error' }); uni.showToast({ title: "修改失败", icon: 'none' });
} }
}).catch(err =>{ }).catch(err =>{
uni.showToast({ uni.showToast({
title: err.msg, title: err.msg || '网络异常',
icon: 'error' icon: 'none'
}); });
}) })
@@ -115,27 +112,6 @@ const handleConfirm = () => {
min-height: 100vh; min-height: 100vh;
background: repeating-linear-gradient(180deg, #E2F0FF, #F6FAFF ); background: repeating-linear-gradient(180deg, #E2F0FF, #F6FAFF );
} }
.status_bar{
width: 100%;
height: 36px;
}
/* 顶部导航栏 */
.nav-bar {
display: flex;
align-items: center;
height: 88rpx;
margin-bottom: 60rpx;
}
.nav-title {
flex: 1;
text-align: center;
font-size: 32rpx;
font-weight: 500;
color: #000;
margin-right: 100rpx;
}
/* 输入框通用样式 */ /* 输入框通用样式 */
.input-item { .input-item {
@@ -175,6 +151,13 @@ const handleConfirm = () => {
font-size: 32rpx; font-size: 32rpx;
} }
/* 密码提示 */
.pwd-hint {
margin: -20rpx 30rpx 20rpx;
font-size: 24rpx;
color: #e74c3c;
}
/* 确定按钮 */ /* 确定按钮 */
.confirm-btn { .confirm-btn {
width: 100%; width: 100%;

View File

@@ -1,14 +1,9 @@
<template> <template>
<view class="forget-page"> <view class="forget-page">
<view class="status_bar"></view>
<view class="nav-bar">
<uni-icons type="left" size="28" color="#333" @click="goBack"></uni-icons>
<view class="nav-title">忘记密码</view>
</view>
<!-- 手机号输入框 --> <!-- 手机号输入框 -->
<view class="input-item"> <view class="input-item">
<view class="input-icon"> <view class="input-icon">
<image src="http://47.104.199.163:9090/images/login/phone.png" mode="" style="height: 100%;width: 100%;"></image> <image src="http://wuye.ckdzkj.com/images/login/phone.png" mode="" style="height: 100%;width: 100%;"></image>
</view> </view>
<uni-easyinput class="input-content" type="number" v-model="phoneNumber" trim="all" <uni-easyinput class="input-content" type="number" v-model="phoneNumber" trim="all"
placeholder="请输入手机号" :inputBorder="false" maxlength="11" :placeholderStyle="placeholderStyle"> placeholder="请输入手机号" :inputBorder="false" maxlength="11" :placeholderStyle="placeholderStyle">
@@ -17,7 +12,7 @@
<!-- 验证码输入 + 获取验证码按钮 --> <!-- 验证码输入 + 获取验证码按钮 -->
<view class="input-item verify-item"> <view class="input-item verify-item">
<view class="input-icon"> <view class="input-icon">
<image src="http://47.104.199.163:9090/images/login/code.png" mode="" style="height: 100%;width: 100%;"></image> <image src="http://wuye.ckdzkj.com/images/login/code.png" mode="" style="height: 100%;width: 100%;"></image>
<!-- <uni-icons type="locked" size="24" color="#999"></uni-icons> --> <!-- <uni-icons type="locked" size="24" color="#999"></uni-icons> -->
</view> </view>
<uni-easyinput class="input-content verify-input" type="number" v-model="verifyCode" trim="all" <uni-easyinput class="input-content verify-input" type="number" v-model="verifyCode" trim="all"
@@ -87,7 +82,7 @@ const getVerifyCode = () => {
}else{ }else{
uni.showToast({ uni.showToast({
title: '验证码发送失败', title: '验证码发送失败',
icon: 'error' icon: 'none'
}); });
} }
}) })
@@ -117,11 +112,6 @@ const handleNext = () =>{
url: '/pageSubPack/loginSub/change-pwd' url: '/pageSubPack/loginSub/change-pwd'
}); });
} }
// 返回上一页
const goBack = () => {
uni.navigateBack();
};
</script> </script>
<style scoped> <style scoped>
.forget-page{ .forget-page{
@@ -129,26 +119,6 @@ const goBack = () => {
min-height: 100vh; min-height: 100vh;
background: repeating-linear-gradient(180deg, #E2F0FF, #F6FAFF ); background: repeating-linear-gradient(180deg, #E2F0FF, #F6FAFF );
} }
.status_bar{
width: 100%;
height: 46px;
}
/* 顶部导航栏 */
.nav-bar {
display: flex;
align-items: center;
/* height: 88rpx; */
margin-bottom: 70rpx;
}
.nav-title {
flex: 1;
text-align: center;
font-size: 32rpx;
font-weight: 500;
color: #000;
margin-right: 100rpx;
}
/* 输入框通用样式 */ /* 输入框通用样式 */
.input-item { .input-item {
display: flex; display: flex;

View File

@@ -1,90 +1,131 @@
<template> <template>
<view class="login-page"> <view class="login-page">
<view class="status_bar"></view> <view class="status_bar"></view>
<!-- 登录标题 --> <!-- 登录标题 -->
<view class="login-title">手机验证码登录</view> <view class="login-title">{{ mode === 'sms' ? '手机验证码登录' : '账号密码登录' }}</view>
<!-- 手机号输入框 --> <!-- ========== 验证码登录表单 ========== -->
<view class="input-item"> <template v-if="mode === 'sms'">
<view class="input-icon"> <view class="input-item">
<!-- <uni-icons type="phone" size="24" color="#999"></uni-icons> --> <view class="input-icon">
<image <image
src="https://wuyeadmin.bugtc.com/images/login/phone.png" src="https://wuye.ckdzkj.com/images/login/phone.png"
mode="aspectFit" mode="aspectFit"
style="height: 100%; width: 100%" style="height: 100%; width: 100%"
></image> ></image>
</view> </view>
<uni-easyinput <uni-easyinput
class="input-content" class="input-content"
type="number" type="number"
v-model="phoneNumber" v-model="phoneNumber"
placeholder="请输入手机号" placeholder="请输入手机号"
:inputBorder="false" :inputBorder="false"
maxlength="11" maxlength="11"
:placeholderStyle="placeholderStyle" :placeholderStyle="placeholderStyle"
>
</uni-easyinput>
</view>
<!-- 验证码输入框 + 获取验证码按钮 -->
<view class="input-item verify-item">
<view class="input-icon">
<image
src="https://wuyeadmin.bugtc.com/images/login/code.png"
mode="aspectFit"
style="height: 100%; width: 100%"
> >
</image> </uni-easyinput>
</view> </view>
<uni-easyinput
class="input-content verify-input" <view class="input-item verify-item">
type="number" <view class="input-icon">
v-model="verifyCode" <image
placeholder="请输入验证码" src="https://wuye.ckdzkj.com/images/login/code.png"
:inputBorder="false" mode="aspectFit"
maxlength="6" style="height: 100%; width: 100%"
:placeholderStyle="placeholderStyle" >
> </image>
</uni-easyinput> </view>
<button <uni-easyinput
class="get-verify-btn" class="input-content verify-input"
:disabled="!canGetVerify || countDown > 0" type="number"
@click="getVerifyCode" v-model="verifyCode"
> placeholder="请输入验证码"
{{ countDown > 0 ? `${countDown}s后重新获取` : '获取验证码' }} :inputBorder="false"
</button> maxlength="6"
</view> :placeholderStyle="placeholderStyle"
>
</uni-easyinput>
<button
class="get-verify-btn"
:disabled="!canGetVerify || countDown > 0"
@click="getVerifyCode"
>
{{ countDown > 0 ? `${countDown}s后重新获取` : '获取验证码' }}
</button>
</view>
</template>
<!-- ========== 账号密码登录表单 ========== -->
<template v-else>
<view class="input-item">
<view class="input-icon">
<image
src="https://wuye.ckdzkj.com/images/login/phone.png"
mode=""
style="height: 100%; width: 100%"
></image>
</view>
<uni-easyinput
class="input-content"
type="text"
v-model="account"
placeholder="请输入帐号"
:inputBorder="false"
:placeholderStyle="placeholderStyle"
>
</uni-easyinput>
</view>
<view class="input-item">
<view class="input-icon">
<image
src="https://wuye.ckdzkj.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>
</view>
</template>
<!-- 协议勾选 --> <!-- 协议勾选 -->
<view class="agreement-item"> <view class="agreement-wrap">
<view @click="toggleAgreement"> <view class="agreement-item">
<uni-icons <view @click="toggleAgreement">
type="checkbox-filled" <uni-icons
size="24" type="checkbox-filled"
color="#4D5DFA" size="24"
v-if="agreeAgreement" color="#4D5DFA"
></uni-icons> v-if="agreeAgreement"
<uni-icons type="checkbox" size="24" color="#999" v-else></uni-icons> ></uni-icons>
<uni-icons type="checkbox" size="24" color="#999" v-else></uni-icons>
</view>
<text class="agreement-text"
>我已阅读并同意
<text class="agreePrivacy" @click.stop="goToUserAgreement">《用户协议》</text>和
<text class="agreePrivacy" @click.stop="goToPrivacy">《隐私政策》</text>
</text>
</view> </view>
<text class="forget-pwd" v-if="mode === 'pwd'" @click="goToForgetPwd">忘记密码?</text>
<!-- <text class="agreement-text" @click.stop="goToPrivacy"
>我已阅读并同意
<text class="agreePrivacy">《用户隐私政策》</text>
</text> -->
<text class="agreement-text"
>我已阅读并同意
<text class="agreePrivacy" @click.stop="goToUserAgreement">《用户协议》</text>和
<text class="agreePrivacy" @click.stop="goToPrivacy">《隐私政策》</text>
</text>
</view> </view>
<!-- 登录按钮 --> <!-- 登录按钮 -->
<button class="login-btn" @click="handleLogin">登录</button> <button class="login-btn" @click="handleLogin">登录</button>
<!-- 底部链接 --> <!-- 底部切换链接 -->
<view class="bottom-link"> <view class="bottom-link">
<navigator class="link-item" url="/pageSubPack/loginSub/pwd-login">账号密码登录</navigator> <text class="link-item" @click="toggleMode">
<!-- <navigator class="link-item" url="/pageSubPack/loginSub/register-new-user">注册新用户</navigator> --> {{ mode === 'sms' ? '账号密码登录' : '验证码登录' }}
</text>
</view> </view>
<!-- 隐私协议弹窗 --> <!-- 隐私协议弹窗 -->
@@ -92,61 +133,59 @@
v-model:show="showPrivacyPopup" v-model:show="showPrivacyPopup"
@agree="agreePrivacy" @agree="agreePrivacy"
@disagree="disagreePrivacy" @disagree="disagreePrivacy"
@close="showPrivacyPopup = false"
/> />
</view> </view>
</template> </template>
<script setup> <script setup>
import { ref, computed, onUnmounted } from 'vue' import { ref, computed, onUnmounted } from 'vue'
import { getLoginBySms, getSendCode } from '../../api/api.js' import { onLoad, onReady } from '@dcloudio/uni-app'
import { getLoginBySms, getSendCode, getLoginPassword } from '../../api/api.js'
import { clearAccountStorage } from '../../api/request.js' import { clearAccountStorage } from '../../api/request.js'
import PrivacyPopup from '@/components/privacy-popup/privacy-popup.vue' import PrivacyPopup from '@/components/privacy-popup/privacy-popup.vue'
import { usePermStore } from '@/stores/usePermStore' import { usePermStore } from '@/stores/usePermStore'
const permStore = usePermStore() const permStore = usePermStore()
// ========== 登录方式 ==========
// 'sms' 验证码登录 | 'pwd' 账号密码登录
const mode = ref('sms')
// ========== 响应式数据 ========== // ========== 响应式数据 ==========
// 手机号 // 验证码登录
const phoneNumber = ref('') const phoneNumber = ref('')
// 验证码
const verifyCode = ref('') const verifyCode = ref('')
// 账号密码登录
const account = ref('')
const password = ref('')
const placeholderStyle = ref('font-size:24rpx') const placeholderStyle = ref('font-size:24rpx')
// 是否同意协议 // 是否同意协议
const agreeAgreement = ref(false) // 默认勾选 const agreeAgreement = ref(false)
const showPrivacyPopup = ref(false) const showPrivacyPopup = ref(false)
// 倒计时(秒) // 倒计时(秒)
const countDown = ref(0) const countDown = ref(0)
// 定时器 // 定时器
let timer = null let timer = null
// 控制点击变色
// const isClicked = ref(false)
// ========== 计算属性 ========== // ========== 计算属性 ==========
// 是否可以获取验证码(手机号格式正确) // 是否可以获取验证码(手机号格式正确)
const canGetVerify = computed(() => { const canGetVerify = computed(() => {
// 手机号正则:11位数字,以1开头
const phoneReg = /^1[3-9]\d{9}$/ const phoneReg = /^1[3-9]\d{9}$/
return phoneReg.test(phoneNumber.value) return phoneReg.test(phoneNumber.value)
}) })
// 是否可以登录(手机号+验证码+协议都满足)
const canLogin = computed(() => {
const phoneReg = /^1[3-9]\d{9}$/
const verifyReg = /^\d{6}$/
return (
phoneReg.test(phoneNumber.value) && verifyReg.test(verifyCode.value) && agreeAgreement.value
)
})
// ========== 方法 ========== // ========== 方法 ==========
// 检查表单状态 // 切换登录方式(底部链接点击)
const checkForm = () => { const toggleMode = () => {
// 无需额外逻辑,计算属性已实时监听 mode.value = mode.value === 'sms' ? 'pwd' : 'sms'
} }
// 切换协议勾选状态 // 切换协议勾选状态
const toggleAgreement = () => { const toggleAgreement = () => {
agreeAgreement.value = !agreeAgreement.value agreeAgreement.value = !agreeAgreement.value
} }
// 打开用户协议 // 打开用户协议
const goToUserAgreement = () => { const goToUserAgreement = () => {
uni.navigateTo({ uni.navigateTo({
@@ -161,6 +200,20 @@ const goToPrivacy = () => {
}) })
} }
// 防止重复点击导致页面堆叠
let isNavigating = false
const navigateOnce = (url) => {
if (isNavigating) return
isNavigating = true
uni.navigateTo({
url,
complete: () => {
isNavigating = false
}
})
}
const goToForgetPwd = () => navigateOnce('/pageSubPack/loginSub/forget-pwd')
// 不同意隐私协议 // 不同意隐私协议
const disagreePrivacy = () => { const disagreePrivacy = () => {
agreeAgreement.value = false agreeAgreement.value = false
@@ -170,7 +223,7 @@ const disagreePrivacy = () => {
// 获取验证码 // 获取验证码
const getVerifyCode = () => { const getVerifyCode = () => {
if (!canGetVerify.value) return if (!canGetVerify.value) return
let params = { const params = {
phone: phoneNumber.value, phone: phoneNumber.value,
scene: 'butler_login' scene: 'butler_login'
} }
@@ -198,20 +251,36 @@ const getVerifyCode = () => {
} else { } else {
uni.showToast({ uni.showToast({
title: '验证码发送失败', title: '验证码发送失败',
icon: 'error' icon: 'none'
}) })
} }
}) })
.catch(err => { .catch(err => {
uni.showToast({ uni.showToast({
title: err.msg, title: err.msg,
icon: 'error' icon: 'none'
}) })
}) })
} }
// 登录处理 // 登录成功后的公共处理
const handleLogin = () => { const loginSuccess = () => {
uni.hideLoading()
// 标记引导页已看过,下次启动跳过引导
uni.setStorageSync('hasShowGuide', true)
uni.showToast({
title: '登录成功',
icon: 'success'
})
setTimeout(() => {
uni.switchTab({
url: '/pages/index/index'
})
}, 1500)
}
// 验证码登录
const handleSmsLogin = () => {
if (!phoneNumber.value) { if (!phoneNumber.value) {
uni.showToast({ title: '请输入手机号', icon: 'none' }) uni.showToast({ title: '请输入手机号', icon: 'none' })
return return
@@ -237,7 +306,7 @@ const handleLogin = () => {
mask: true mask: true
}) })
const push_cid = uni.getStorageSync('push_cid') const push_cid = uni.getStorageSync('push_cid')
let params = { const params = {
phone: phoneNumber.value, phone: phoneNumber.value,
smsCode: verifyCode.value, smsCode: verifyCode.value,
scene: 'butler_login', scene: 'butler_login',
@@ -259,39 +328,95 @@ const handleLogin = () => {
// 存当前绑定的小区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() loginSuccess()
// 标记引导页已看过,下次启动跳过引导
uni.setStorageSync('hasShowGuide', true)
uni.showToast({
title: '登录成功',
icon: 'success'
})
setTimeout(() => {
uni.switchTab({
url: '/pages/index/index'
})
}, 1500)
} else { } else {
uni.showToast({ uni.showToast({
title: '登录失败', title: '登录失败',
icon: 'error' icon: 'none'
}) })
} }
} else { } else {
uni.showToast({ uni.showToast({
title: '登录失败', title: '登录失败',
icon: 'error' icon: 'none'
}) })
} }
}) })
.catch(err => { .catch(err => {
uni.showToast({ uni.showToast({
title: err.msg, title: err.msg,
icon: 'error' icon: 'none'
}) })
}) })
} }
// 账号密码登录
const handlePwdLogin = () => {
if (!account.value) {
uni.showToast({ title: '请输入账号', icon: 'none' })
return
}
if (account.value.length < 4 || account.value.length > 16) {
uni.showToast({ title: '账号长度需为 4-16 位', icon: 'none' })
return
}
if (!password.value) {
uni.showToast({ title: '请输入密码', icon: 'none' })
return
}
if (password.value.length < 6) {
uni.showToast({ title: '密码至少输入 6 位', icon: 'none' })
return
}
if (password.value.length > 16) {
uni.showToast({ title: '密码不能超过 16 位', icon: 'none' })
return
}
if (!agreeAgreement.value) {
showPrivacyPopup.value = true
return
}
uni.showLoading({ title: '登录中...', mask: true })
const push_cid = uni.getStorageSync('push_cid')
const params = {
username: account.value,
password: password.value,
cid: push_cid
}
permStore.clearPerm()
// 清除上个账号的所有缓存,防止新账号显示旧数据
clearAccountStorage()
getLoginPassword(params)
.then(res => {
if (res.code === 200) {
uni.setStorageSync('token', res.data.token)
uni.setStorage({
key: 'userPermission',
data: res.data.user.permissions
})
permStore.setPerm(res.data.user.permissions)
loginSuccess()
} else {
uni.showToast({ title: res.msg, icon: 'none' })
}
})
.catch(err => {
uni.showToast({
title: err.msg,
icon: 'none'
})
})
}
// 登录入口(按当前模式分发)
const handleLogin = () => {
if (mode.value === 'pwd') {
handlePwdLogin()
} else {
handleSmsLogin()
}
}
// 同意隐私协议(弹窗中点击同意 → 直接登录) // 同意隐私协议(弹窗中点击同意 → 直接登录)
const agreePrivacy = () => { const agreePrivacy = () => {
agreeAgreement.value = true agreeAgreement.value = true
@@ -300,6 +425,20 @@ const agreePrivacy = () => {
} }
// ========== 生命周期 ========== // ========== 生命周期 ==========
onLoad((options) => {
// 外部跳转时可通过 ?mode=pwd 直接进入账号密码登录
if (options && options.mode === 'pwd') {
mode.value = 'pwd'
}
})
onReady(() => {
// 登录页渲染完成后关闭启动屏
// #ifdef APP-PLUS
plus.navigator.closeSplashscreen()
// #endif
})
// 页面卸载时清除定时器 // 页面卸载时清除定时器
onUnmounted(() => { onUnmounted(() => {
if (timer) { if (timer) {
@@ -410,16 +549,25 @@ onUnmounted(() => {
color: #fff; color: #fff;
border-radius: 50px; border-radius: 50px;
} }
.get-verify-btn:after { .get-verify-btn:after {
border-radius: 50px; border-radius: 50px;
} }
/* 协议勾选项 */ /* 协议勾选行 */
.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; display: flex;
align-items: center; align-items: center;
margin: 70rpx 0 28rpx 0; flex: 1;
padding-left: 10rpx; min-width: 0;
} }
/* 协议文本 */ /* 协议文本 */
@@ -427,10 +575,23 @@ onUnmounted(() => {
font-size: 24rpx; font-size: 24rpx;
color: #666; color: #666;
margin-left: 10rpx; margin-left: 10rpx;
line-height: 1.5;
} }
.agreePrivacy { .agreePrivacy {
color: #4d5dfa; color: #4d5dfa;
} }
/* 忘记密码 */
.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%; width: 100%;
@@ -447,7 +608,6 @@ onUnmounted(() => {
.login-btn:disabled { .login-btn:disabled {
background-color: #99c8ff; background-color: #99c8ff;
color: #fff; color: #fff;
/* border-radius: 50px; */
} }
/* 禁用按钮边框 */ /* 禁用按钮边框 */
@@ -455,14 +615,13 @@ 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;

View File

@@ -1,419 +0,0 @@
<template>
<view class="login-page">
<view class="status_bar"></view>
<!-- 标题 -->
<view class="login-title">账号密码登录</view>
<!-- 手机号输入框 -->
<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>
</view>
<uni-easyinput
class="input-content"
type="text"
v-model="phoneNumber"
placeholder="请输入帐号"
:inputBorder="false"
:placeholderStyle="placeholderStyle"
>
</uni-easyinput>
</view>
<!-- 密码输入框 -->
<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>
</view>
<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-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>
<text class="remember-text">记住密码</text>
</view>
</view>
<!-- 协议勾选 + 忘记密码 -->
<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" size="24" color="#999" v-else></uni-icons>
</view>
<text class="agreement-text"
>我已阅读并同意
<text class="agreePrivacy" @click.stop="goToUserAgreement">《用户协议》</text>和
<text class="agreePrivacy" @click.stop="goToPrivacy">《隐私政策》</text>
</text>
</view>
<navigator class="forget-pwd" url="/pageSubPack/loginSub/forget-pwd">忘记密码?</navigator>
</view>
<!-- 登录按钮 -->
<button class="login-btn" @click="handleLogin">登录</button>
<!-- 底部链接 -->
<view class="bottom-link">
<navigator class="link-item" url="/pageSubPack/loginSub/login">验证码登录</navigator>
<!-- <navigator class="link-item" url="/pageSubPack/loginSub/register-new-user">注册新用户</navigator> -->
</view>
</view>
<!-- 隐私协议弹窗 -->
<privacy-popup
v-model:show="showPrivacyPopup"
@agree="agreePrivacy"
@disagree="disagreePrivacy"
@close="showPrivacyPopup = false"
/>
</template>
<script setup>
import { ref, computed } from 'vue'
import { onLoad, onReady } from '@dcloudio/uni-app'
import { getLoginPassword } from '../../api/api.js'
import { clearAccountStorage } from '../../api/request.js'
import PrivacyPopup from '@/components/privacy-popup/privacy-popup.vue'
import { usePermStore } from '@/stores/usePermStore'
const permStore = usePermStore()
// 响应式数据
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 toggleAgreement = () => {
agreeAgreement.value = !agreeAgreement.value
}
// 切换记住密码
const toggleRemember = () => {
rememberPwd.value = !rememberPwd.value
}
// 打开用户协议
const goToUserAgreement = () => {
uni.navigateTo({
url: '/pageSubPack/loginSub/user-agreement'
})
}
// 打开隐私政策
const goToPrivacy = () => {
uni.navigateTo({
url: '/pageSubPack/loginSub/privacy'
})
}
// 打开隐私协议弹窗
// const goToPrivacy = () => {
// showPrivacyPopup.value = true
// }
// 不同意隐私协议
const disagreePrivacy = () => {
agreeAgreement.value = false
showPrivacyPopup.value = false
}
// 检查表单
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
})
onReady(() => {
// 登录页渲染完成后关闭启动屏(登录过但未登录时直接进登录页)
// #ifdef APP-PLUS
plus.navigator.closeSplashscreen()
// #endif
})
// 登录逻辑
const handleLogin = () => {
if (!phoneNumber.value) {
uni.showToast({ title: '请输入账号', icon: 'none' })
return
}
if (phoneNumber.value.length < 4 || phoneNumber.value.length > 16) {
uni.showToast({ title: '账号长度需为 4-16 位', icon: 'none' })
return
}
if (!password.value) {
uni.showToast({ title: '请输入密码', icon: 'none' })
return
}
if (password.value.length < 6) {
uni.showToast({ title: '密码至少输入 6 位', icon: 'none' })
return
}
if (password.value.length > 16) {
uni.showToast({ title: '密码不能超过 16 位', icon: 'none' })
return
}
if (!agreeAgreement.value) {
showPrivacyPopup.value = true
return
}
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
}
permStore.clearPerm()
// 清除上个账号的所有缓存,防止新账号显示旧数据
clearAccountStorage()
getLoginPassword(params)
.then(res => {
// console.log('33333',res)
if (res.code === 200) {
uni.setStorageSync('token', res.data.token)
// 存用户ID
// if(res.data) {
// // 存当前绑定的小区ID,0 表示未绑定
// // const currentVillageId = res.data.currentVillageId || 0;
// // uni.setStorageSync('currentVillageId', currentVillageId);
// }
uni.setStorage({
key: 'userPermission',
data: res.data.user.permissions
})
permStore.setPerm(res.data.user.permissions)
uni.hideLoading()
// 标记引导页已看过,下次启动跳过引导
uni.setStorageSync('hasShowGuide', true)
if (rememberPwd.value) {
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.showToast({ title: '登录成功', icon: 'success' })
setTimeout(() => {
uni.switchTab(
{
url: '/pages/index/index'
},
1000
)
})
} else {
uni.showToast({ title: res.msg, icon: 'none' })
}
})
.catch(err => {
uni.showToast({
title: err.msg,
icon: 'none'
})
})
}
// 同意隐私协议(弹窗中点击同意 → 直接登录)
const agreePrivacy = () => {
agreeAgreement.value = true
showPrivacyPopup.value = false
handleLogin()
}
</script>
<style scoped>
.login-page {
padding: 80rpx 40rpx 40rpx;
/* background-color: #f8f9fa; */
min-height: 100vh;
background: repeating-linear-gradient(180deg, #e2f0ff, #f6faff);
}
.status_bar {
height: 160px;
width: 100%;
}
.login-title {
font-size: 52rpx;
font-weight: 600;
color: #333;
text-align: center;
margin-bottom: 142rpx;
}
.input-item {
display: flex;
align-items: center;
background-color: #fff;
border-radius: 40rpx;
padding: 0 30rpx;
height: 88rpx;
margin-bottom: 30rpx;
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
}
.input-icon {
margin-right: 20rpx;
width: 50rpx;
height: 50rpx;
}
.input-content {
flex: 1;
font-size: 28rpx;
color: #333;
display: flex;
align-items: center;
}
/* 清除 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) {
height: 60rpx !important;
min-height: 60rpx !important;
line-height: 60rpx !important;
padding: 0 !important;
margin: 0 !important;
font-size: 28rpx;
}
.remember-wrap {
display: flex;
align-items: center;
margin: 20rpx 0 0 0;
padding: 0 10rpx;
}
.remember-item {
display: flex;
align-items: center;
}
.remember-text {
font-size: 24rpx;
color: #666;
margin-left: 10rpx;
}
.agreement-wrap {
display: flex;
justify-content: space-between;
align-items: center;
margin: 40rpx 0 28rpx 0;
padding: 0 10rpx;
}
.agreement-item {
display: flex;
align-items: center;
flex: 1;
min-width: 0;
}
.agreement-text {
font-size: 24rpx;
color: #666;
margin-left: 10rpx;
line-height: 1.5;
}
.agreePrivacy {
color: #4d5dfa;
}
/* .agreePrivacy.active{
color: #4D5DFA;
} */
.forget-pwd {
font-size: 24rpx;
color: #666;
text-decoration: none;
flex-shrink: 0;
margin-left: 16rpx;
line-height: 1.5;
}
.login-btn {
width: 100%;
height: 88rpx;
line-height: 88rpx;
background-color: #4d5dfa;
color: #fff;
border-radius: 8rpx;
font-size: 28rpx;
margin-bottom: 40rpx;
}
.login-btn:disabled {
background-color: #99c8ff;
color: #fff;
/* border-radius: 50px; */
}
/* 禁用按钮边框 */
button:after {
border-radius: 8px;
}
.bottom-link {
display: flex;
justify-content: center;
padding: 0 20rpx;
}
.link-item {
font-size: 28rpx;
color: #4d5dfa;
text-decoration: none;
}
</style>

View File

@@ -17,13 +17,13 @@
<view v-for="item in displayedCommunities" :key="item.id" class="community-item" <view v-for="item in displayedCommunities" :key="item.id" class="community-item"
@tap="selectCommunity(item)" :class="{active: selectedItem?.id === item.id}"> @tap="selectCommunity(item)" :class="{active: selectedItem?.id === item.id}">
<view class="community-item-left"> <view class="community-item-left">
<image src="https://wuyeadmin.bugtc.com/images/imgs/community.png" style="width: 48rpx;height: 48rpx;"></image> <image src="https://wuye.ckdzkj.com/images/imgs/community.png" style="width: 48rpx;height: 48rpx;"></image>
<view class="community-info"> <view class="community-info">
<text class="community-name">{{ item.villageName }}</text> <text class="community-name">{{ item.villageName }}</text>
</view> </view>
</view> </view>
<view v-if="selectedItem && selectedItem.id === item.id" class="selected-icon"> <view v-if="selectedItem && selectedItem.id === item.id" class="selected-icon">
<image src="https://wuyeadmin.bugtc.com/images/imgs/check.png" style="width: 48rpx;height: 48rpx;"></image> <image src="https://wuye.ckdzkj.com/images/imgs/check.png" style="width: 48rpx;height: 48rpx;"></image>
</view> </view>
</view> </view>

View File

@@ -7,7 +7,7 @@
<uni-nav-bar left-icon="left" title="远程开门" backgroundColor ="none" :border="false" @clickLeft="narBack" /> <uni-nav-bar left-icon="left" title="远程开门" backgroundColor ="none" :border="false" @clickLeft="narBack" />
</view> </view>
<view class="top-img"> <view class="top-img">
<image src="https://wuyeadmin.bugtc.com/images/imgs/xuancheng-bg.png" mode="" style="width: 100%;height: 100%;"></image> <image src="https://wuye.ckdzkj.com/images/imgs/xuancheng-bg.png" mode="" style="width: 100%;height: 100%;"></image>
</view> </view>
<!-- 提示文案 --> <!-- 提示文案 -->

View File

@@ -76,7 +76,7 @@ const onDeleteAccount = () => {
uni.showToast({ title: '注销成功', icon: 'success' }) uni.showToast({ title: '注销成功', icon: 'success' })
setTimeout(() => { setTimeout(() => {
uni.redirectTo({ uni.redirectTo({
url: '/pageSubPack/loginSub/pwd-login' url: '/pageSubPack/loginSub/login?mode=pwd'
}) })
}, 1500) }, 1500)
} else { } else {

View File

@@ -119,7 +119,7 @@ const confirmLogout = () => {
clearAccountStorage() clearAccountStorage()
uni.showToast({ title: '退出登录成功', icon: 'success' }) uni.showToast({ title: '退出登录成功', icon: 'success' })
// 使用 reLaunch 销毁所有页面(包括 tab 页),确保新账号登录后页面重新初始化 // 使用 reLaunch 销毁所有页面(包括 tab 页),确保新账号登录后页面重新初始化
uni.reLaunch({ url: '/pageSubPack/loginSub/pwd-login' }) uni.reLaunch({ url: '/pageSubPack/loginSub/login?mode=pwd' })
} else { } else {
uni.showToast({ title: res.msg || '退出失败', icon: 'none' }) uni.showToast({ title: res.msg || '退出失败', icon: 'none' })
} }

View File

@@ -32,16 +32,9 @@
"subPackages": [{ "subPackages": [{
"root": "pageSubPack/loginSub", "root": "pageSubPack/loginSub",
"pages": [{ "pages": [{
"path": "pwd-login",
"style": {
"navigationBarTitleText": "账号登录",
"navigationStyle": "custom"
}
},
{
"path": "login", "path": "login",
"style": { "style": {
"navigationBarTitleText": "手机号登录", "navigationBarTitleText": "登录",
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, },
@@ -60,15 +53,13 @@
{ {
"path": "forget-pwd", "path": "forget-pwd",
"style": { "style": {
"navigationBarTitleText": "忘记密码", "navigationBarTitleText": "忘记密码"
"navigationStyle": "custom"
} }
}, },
{ {
"path": "change-pwd", "path": "change-pwd",
"style": { "style": {
"navigationBarTitleText": "修改密码", "navigationBarTitleText": "修改密码"
"navigationStyle": "custom"
} }
} }
] ]

View File

@@ -128,7 +128,7 @@ const handleBtnClick = () => {
} else { } else {
// 没有token,跳转登录页 // 没有token,跳转登录页
uni.redirectTo({ uni.redirectTo({
url: "/pageSubPack/loginSub/pwd-login" url: "/pageSubPack/loginSub/login?mode=pwd"
}); });
} }
} }

View File

@@ -16,7 +16,7 @@
<view class="location-area"> <view class="location-area">
<view class="location-icon"> <view class="location-icon">
<image <image
src="https://wuyeadmin.bugtc.com/images/imgs/adress.png" src="https://wuye.ckdzkj.com/images/imgs/adress.png"
style="height: 100%; width: 100%" style="height: 100%; width: 100%"
></image> ></image>
</view> </view>
@@ -24,7 +24,7 @@
<text class="community-name">{{ currentCommunity }}</text> <text class="community-name">{{ currentCommunity }}</text>
<view class="community-icon"> <view class="community-icon">
<image <image
src="https://wuyeadmin.bugtc.com/images/imgs/三角形.png" src="https://wuye.ckdzkj.com/images/imgs/三角形.png"
style="height: 100%; width: 100%" style="height: 100%; width: 100%"
></image> ></image>
</view> </view>
@@ -64,7 +64,7 @@
<view class="noticeClass"> <view class="noticeClass">
<view class="notice-left"> <view class="notice-left">
<image <image
src="https://wuyeadmin.bugtc.com/images/imgs/notice.png" src="https://wuye.ckdzkj.com/images/imgs/notice.png"
class="notice-icon" class="notice-icon"
></image> ></image>
<view class="notice-line"></view> <view class="notice-line"></view>
@@ -245,31 +245,31 @@ const goToFeeOverview = () => {
const functionList = [ const functionList = [
{ {
permKey: 'butler:fault:report', permKey: 'butler:fault:report',
icon: 'https://wuyeadmin.bugtc.com/images/imgs/fault-report.png', icon: 'https://wuye.ckdzkj.com/images/imgs/fault-report.png',
text: '故障上报', text: '故障上报',
action: 'goToReport' action: 'goToReport'
}, },
{ {
permKey: 'butler:door:open', permKey: 'butler:door:open',
icon: 'https://wuyeadmin.bugtc.com/images/imgs/open.png', icon: 'https://wuye.ckdzkj.com/images/imgs/open.png',
text: '一键开门', text: '一键开门',
action: 'goToOneOpenDoor' action: 'goToOneOpenDoor'
}, },
{ {
permKey: 'butler:workOrder:hall', permKey: 'butler:workOrder:hall',
icon: 'https://wuyeadmin.bugtc.com/images/imgs/work-order.png', icon: 'https://wuye.ckdzkj.com/images/imgs/work-order.png',
text: '工单大厅', text: '工单大厅',
action: 'goToTicketHall' action: 'goToTicketHall'
}, },
{ {
permKey: 'butler:workOrder:mine', permKey: 'butler:workOrder:mine',
icon: 'https://wuyeadmin.bugtc.com/images/imgs/my-work.png', icon: 'https://wuye.ckdzkj.com/images/imgs/my-work.png',
text: '我的工单', text: '我的工单',
action: 'goToMyTicket' action: 'goToMyTicket'
}, },
{ {
permKey: 'butler:complaint:handle', permKey: 'butler:complaint:handle',
icon: 'https://wuyeadmin.bugtc.com/images/imgs/complaint.png', icon: 'https://wuye.ckdzkj.com/images/imgs/complaint.png',
text: '投诉处理', text: '投诉处理',
action: 'goToComplaint' action: 'goToComplaint'
}, },
@@ -452,7 +452,7 @@ onLoad(() => {
const hasShowGuide = uni.getStorageSync('hasShowGuide') const hasShowGuide = uni.getStorageSync('hasShowGuide')
uni.hideTabBar({ animation: false }) uni.hideTabBar({ animation: false })
uni.reLaunch({ uni.reLaunch({
url: hasShowGuide ? '/pageSubPack/loginSub/pwd-login' : '/pages/guide/guide', url: hasShowGuide ? '/pageSubPack/loginSub/login?mode=pwd' : '/pages/guide/guide',
animationType: 'none', animationType: 'none',
animationDuration: 0 animationDuration: 0
}) })

View File

@@ -4,7 +4,7 @@
<uni-nav-bar backgroundColor="transparent" :border="false" /> <uni-nav-bar backgroundColor="transparent" :border="false" />
<scroll-view class="page" scroll-y> <scroll-view class="page" scroll-y>
<view class="user-card"> <view class="user-card">
<image src="https://wuyeadmin.bugtc.com/images/guanjia-logo.png" class="avatar" /> <image src="https://wuye.ckdzkj.com/images/guanjia-logo.png" class="avatar" />
<view class="user-info"> <view class="user-info">
<text class="user-name">{{ loginName }}</text> <text class="user-name">{{ loginName }}</text>
<text class="user-phone">{{ phoneNum }}</text> <text class="user-phone">{{ phoneNum }}</text>
@@ -35,12 +35,12 @@ import { ref } from 'vue'
import { onShow } from '@dcloudio/uni-app' import { onShow } from '@dcloudio/uni-app'
import { getSettingInfo } from '../../api/api.js' import { getSettingInfo } from '../../api/api.js'
// const defaultAvatar = 'https://wuyeadmin.bugtc.com/images/imgs/default-avatar.png' // const defaultAvatar = 'https://wuye.ckdzkj.com/images/imgs/default-avatar.png'
const list = ref([ const list = ref([
{ icon: 'https://wuyeadmin.bugtc.com/images/imgs/shangbao.png', title: '上报记录' }, { icon: 'https://wuye.ckdzkj.com/images/imgs/shangbao.png', title: '上报记录' },
{ icon: 'https://wuyeadmin.bugtc.com/images/imgs/xunjian.png', title: '巡检记录' }, { icon: 'https://wuye.ckdzkj.com/images/imgs/xunjian.png', title: '巡检记录' },
{ icon: 'https://wuyeadmin.bugtc.com/images/propertyImgs/setting.png', title: '设置' } { icon: 'https://wuye.ckdzkj.com/images/propertyImgs/setting.png', title: '设置' }
]) ])
const loginName = ref('') const loginName = ref('')