Merge branch 'master' of http://gitea.bugtc.com/zhouyanli/property-manager-side
This commit is contained in:
@@ -0,0 +1,242 @@
|
||||
<template>
|
||||
<view class="form-container">
|
||||
<!-- 维修项目展示 -->
|
||||
<view class="form-item">
|
||||
<text class="label">维修项目</text>
|
||||
<view class="value" @click="goBackSelect">
|
||||
<view>
|
||||
<text v-if="!repairProject">请选择项目</text>
|
||||
{{ repairProject }}
|
||||
</view>
|
||||
<uni-icons type="arrowright" size="16"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 标题输入 -->
|
||||
<view class="form-item">
|
||||
<text class="label">标题</text>
|
||||
<!-- <input type="text" placeholder="请输入问题标题" v-model="form.title" /> -->
|
||||
<uni-easyinput v-model="form.title" placeholder="请输入内容" :inputBorder="false"></uni-easyinput>
|
||||
</view>
|
||||
|
||||
<!-- 问题描述 -->
|
||||
<view class="form-item-wenti">
|
||||
<text class="label">问题描述</text>
|
||||
<!-- <textarea placeholder="请输入问题内容" v-model="form.desc" rows="5" ></textarea> -->
|
||||
<uni-easyinput v-model="form.desc" placeholder="请描述你的问题" type="textarea"></uni-easyinput>
|
||||
</view>
|
||||
|
||||
<!-- 手机号 -->
|
||||
<view class="form-item">
|
||||
<text class="label">手机号</text>
|
||||
<uni-easyinput type="number" v-model="form.phone" placeholder="请输入手机号" :inputBorder="false"></uni-easyinput>
|
||||
</view>
|
||||
|
||||
<!-- 图片上传 -->
|
||||
<view class="form-item-wenti">
|
||||
<text class="label">问题照片</text>
|
||||
<view class="upload-wrap">
|
||||
<!-- 已上传图片 -->
|
||||
<view class="upload-item" v-for="(img, index) in form.images" :key="index">
|
||||
<image :src="img" mode="aspectFill"></image>
|
||||
<uni-icons type="close" size="16" @click="deleteImage(index)"></uni-icons>
|
||||
</view>
|
||||
<!-- 上传按钮 -->
|
||||
<view class="upload-btn" @click="chooseImage">
|
||||
<uni-icons type="plus" size="24"></uni-icons>
|
||||
<text>上传照片</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 提交按钮 -->
|
||||
<button class="submit-btn" @click="submitForm">提交</button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import{onLoad} from "@dcloudio/uni-app"
|
||||
// import { onLoad, uniShowToast, uniNavigateBack, uniChooseImage, uniUploadFile } from '@dcloudio/uni-app'
|
||||
|
||||
// 接收上个页面传的维修项目
|
||||
const repairProject = ref('')
|
||||
|
||||
// 表单数据
|
||||
const form = ref({
|
||||
title: '',
|
||||
desc: '',
|
||||
phone: '',
|
||||
images: [] // 图片列表
|
||||
})
|
||||
|
||||
// 页面加载时获取传参
|
||||
onLoad((options) => {
|
||||
if (options.category && options.project) {
|
||||
repairProject.value = `${options.category}-${options.project}`
|
||||
}
|
||||
})
|
||||
|
||||
// 选择项目页
|
||||
const goBackSelect = () => {
|
||||
uni.navigateTo({
|
||||
url:"/pageSubPack/fault-reporting/repairSelect"
|
||||
})
|
||||
}
|
||||
|
||||
// 选择图片
|
||||
const chooseImage = () => {
|
||||
uni.chooseImage({
|
||||
count: 3, // 最多选3张
|
||||
sizeType: ['original', 'compressed'],
|
||||
sourceType: ['album', 'camera'],
|
||||
success: (res) => {
|
||||
// 临时文件路径
|
||||
const tempFilePaths = res.tempFilePaths
|
||||
form.value.images = [...form.value.images, ...tempFilePaths]
|
||||
|
||||
// 【可选】如果需要上传到服务器,取消下面注释
|
||||
// tempFilePaths.forEach(path => {
|
||||
// uni.uploadFile({
|
||||
// url: '你的上传接口地址',
|
||||
// filePath: path,
|
||||
// name: 'file',
|
||||
// success: (uploadRes) => {
|
||||
// console.log('上传成功', uploadRes)
|
||||
// }
|
||||
// })
|
||||
// })
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 删除图片
|
||||
const deleteImage = (index) => {
|
||||
form.value.images.splice(index, 1)
|
||||
}
|
||||
|
||||
// 表单提交
|
||||
const submitForm = () => {
|
||||
// 表单校验
|
||||
if (!repairProject.value) {
|
||||
uni.showToast({ title: '请选择维修项目', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (!form.value.title) {
|
||||
uni.showToast({ title: '请输入问题标题', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (!form.value.desc) {
|
||||
uni.showToast({ title: '请输入问题描述', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (!/^1[3-9]\d{9}$/.test(form.value.phone)) {
|
||||
uni.showToast({ title: '请输入正确的手机号', icon: 'none' })
|
||||
return
|
||||
}
|
||||
|
||||
// 提交数据(替换成你的接口)
|
||||
uni.showLoading({ title: '提交中...' })
|
||||
|
||||
// 模拟接口请求
|
||||
setTimeout(() => {
|
||||
uni.hideLoading()
|
||||
uni.showToast({ title: '提交成功', icon: 'success' })
|
||||
|
||||
// 提交成功后重置表单/返回上一页
|
||||
form.value = { title: '', desc: '', phone: '', images: [] }
|
||||
// 或返回上一页
|
||||
uni.navigateBack({ delta: 3 })
|
||||
}, 1000)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.form-container {
|
||||
padding: 30rpx 40rpx;
|
||||
background: #fff;
|
||||
min-height: 100vh;
|
||||
}
|
||||
.form-item-wenti {
|
||||
margin-bottom: 20px;
|
||||
border-bottom: 1px solid #eee;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
.form-item {
|
||||
display: flex;
|
||||
margin-bottom: 30rpx;
|
||||
align-items: flex-start;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
.label {
|
||||
width: 140rpx;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
line-height: 80rpx;
|
||||
}
|
||||
|
||||
.value {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
line-height: 80rpx;
|
||||
text-align: right;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.input, .textarea {
|
||||
font-size: 14px;
|
||||
width: 100%;
|
||||
padding: 8px 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.textarea {
|
||||
resize: none;
|
||||
}
|
||||
.upload-wrap {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
.upload-item {
|
||||
position: relative;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
}
|
||||
.upload-item image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.upload-item uni-icons {
|
||||
position: absolute;
|
||||
top: -5px;
|
||||
right: -5px;
|
||||
background: #ff3b30;
|
||||
color: #fff;
|
||||
border-radius: 50%;
|
||||
padding: 2px;
|
||||
}
|
||||
.upload-btn {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
border: 1px dashed #ccc;
|
||||
border-radius: 4px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
color: #999;
|
||||
font-size: 12px;
|
||||
}
|
||||
.submit-btn {
|
||||
width: 100%;
|
||||
background: #4D5DFA;
|
||||
color: #fff;
|
||||
border-radius: 6px;
|
||||
height: 44px;
|
||||
line-height: 44px;
|
||||
font-size: 16px;
|
||||
}
|
||||
</style>
|
||||
141
wuye-manager-uniapp/pageSubPack/fault-reporting/repairSelect.vue
Normal file
141
wuye-manager-uniapp/pageSubPack/fault-reporting/repairSelect.vue
Normal file
@@ -0,0 +1,141 @@
|
||||
<template>
|
||||
<view class="select-container">
|
||||
<!-- 搜索框 -->
|
||||
<view class="search-bar">
|
||||
<input type="text" placeholder="请输入关键字搜索" v-model="searchKey" />
|
||||
<uni-icons type="search" size="18"></uni-icons>
|
||||
</view>
|
||||
|
||||
<!-- 分类选择 -->
|
||||
<view class="category-wrap">
|
||||
<!-- 左侧分类 -->
|
||||
<scroll-view scroll-y class="category-left">
|
||||
<view
|
||||
class="category-item"
|
||||
:class="{ active: activeCategory === item.id }"
|
||||
@click="selectCategory(item)"
|
||||
v-for="item in categoryList"
|
||||
:key="item.id"
|
||||
>
|
||||
{{ item.name }}
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<!-- 右侧项目 -->
|
||||
<scroll-view scroll-y class="category-right">
|
||||
<view
|
||||
class="project-item"
|
||||
@click="selectProject(item)"
|
||||
v-for="item in currentProjectList"
|
||||
:key="item.id"
|
||||
>
|
||||
{{ item.name }}
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed } from 'vue'
|
||||
// import { uniNavigateTo } from '@dcloudio/uni-app'
|
||||
|
||||
// 分类列表
|
||||
const categoryList = ref([
|
||||
{ id: 1, name: '基础设施' },
|
||||
{ id: 2, name: '电子设施' }
|
||||
])
|
||||
|
||||
// 所有项目数据
|
||||
const projectList = ref([
|
||||
{ id: 101, categoryId: 1, name: '路灯' },
|
||||
{ id: 102, categoryId: 1, name: '楼层指示灯' },
|
||||
{ id: 103, categoryId: 2, name: '应急出口灯' },
|
||||
{ id: 104, categoryId: 1, name: '草坪灯' }
|
||||
])
|
||||
|
||||
// 选中的分类
|
||||
const activeCategory = ref(1)
|
||||
// 搜索关键词
|
||||
const searchKey = ref('')
|
||||
|
||||
// 筛选当前分类的项目(含搜索)
|
||||
const currentProjectList = computed(() => {
|
||||
let list = projectList.value.filter(item => item.categoryId === activeCategory.value)
|
||||
if (searchKey.value) {
|
||||
list = list.filter(item => item.name.includes(searchKey.value))
|
||||
}
|
||||
return list
|
||||
})
|
||||
|
||||
// 选择分类
|
||||
const selectCategory = (item) => {
|
||||
activeCategory.value = item.id
|
||||
}
|
||||
|
||||
// 选择项目并跳转到维修项目填写页
|
||||
const selectProject = (item) => {
|
||||
// 获取分类名称
|
||||
const categoryName = categoryList.value.find(c => c.id === item.categoryId)?.name
|
||||
// 跳转并传参
|
||||
uni.navigateTo({
|
||||
url: `/pageSubPack/fault-reporting/fault-reporting?category=${categoryName}&project=${item.name}`
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.select-container {
|
||||
padding: 10px;
|
||||
height: 100vh;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.search-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 8px 10px;
|
||||
background: #f5f5f5;
|
||||
border-radius: 6px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.search-bar input {
|
||||
flex: 1;
|
||||
font-size: 14px;
|
||||
}
|
||||
.category-wrap {
|
||||
display: flex;
|
||||
height: calc(100% - 50px);
|
||||
}
|
||||
.category-left {
|
||||
width: 120px;
|
||||
height: 100%;
|
||||
background: #f8f8f8;
|
||||
border-radius: 6px 0 0 6px;
|
||||
}
|
||||
.category-item {
|
||||
padding: 15px 10px;
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
.category-item.active {
|
||||
background: #fff;
|
||||
color: #007aff;
|
||||
font-weight: bold;
|
||||
}
|
||||
.category-right {
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
background: #fff;
|
||||
border-radius: 0 6px 6px 0;
|
||||
padding: 10px;
|
||||
}
|
||||
.project-item {
|
||||
padding: 12px 10px;
|
||||
font-size: 14px;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
.project-item:active {
|
||||
background: #f5f5f5;
|
||||
}
|
||||
</style>
|
||||
@@ -1,359 +1,370 @@
|
||||
<template>
|
||||
<view class="login-page">
|
||||
<view class="status_bar"></view>
|
||||
<!-- 登录标题 -->
|
||||
<view class="login-title">手机验证码登录</view>
|
||||
<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="http://47.104.199.163:9090/images/login/phone.png" mode="" style="height: 100%;width: 100%;"></image>
|
||||
</view>
|
||||
<uni-easyinput class="input-content" type="number" v-model="phoneNumber"
|
||||
placeholder="请输入手机号" :inputBorder="false" maxlength="11" :placeholderStyle="placeholderStyle">
|
||||
</uni-easyinput>
|
||||
<!-- <input
|
||||
class="input-content"
|
||||
type="number"
|
||||
placeholder="请输入手机号"
|
||||
v-model="phoneNumber"
|
||||
maxlength="11"
|
||||
@input="checkForm"
|
||||
/> -->
|
||||
</view>
|
||||
<!-- 手机号输入框 -->
|
||||
<view class="input-item">
|
||||
<view class="input-icon">
|
||||
<!-- <uni-icons type="phone" size="24" color="#999"></uni-icons> -->
|
||||
<image src="http://47.104.199.163:9090/images/login/phone.png" mode=""
|
||||
style="height: 100%;width: 100%;"></image>
|
||||
</view>
|
||||
<uni-easyinput class="input-content" type="number" v-model="phoneNumber" placeholder="请输入手机号"
|
||||
:inputBorder="false" maxlength="11" :placeholderStyle="placeholderStyle">
|
||||
</uni-easyinput>
|
||||
</view>
|
||||
|
||||
<!-- 验证码输入框 + 获取验证码按钮 -->
|
||||
<view class="input-item verify-item">
|
||||
<view class="input-icon">
|
||||
<image src="http://47.104.199.163:9090/images/login/code.png" mode="" style="height: 100%;width: 100%;"></image>
|
||||
</view>
|
||||
<uni-easyinput class="input-content verify-input" type="number" v-model="verifyCode"
|
||||
placeholder="请输入验证码" :inputBorder="false" maxlength="6" :placeholderStyle="placeholderStyle">
|
||||
</uni-easyinput>
|
||||
<!-- <input
|
||||
class="input-content verify-input"
|
||||
type="number"
|
||||
placeholder="请输入验证码"
|
||||
v-model="verifyCode"
|
||||
maxlength="6"
|
||||
@input="checkForm"
|
||||
/> -->
|
||||
<button
|
||||
class="get-verify-btn"
|
||||
:disabled="!canGetVerify || countDown > 0"
|
||||
@click="getVerifyCode"
|
||||
>
|
||||
{{ countDown > 0 ? `${countDown}s后重新获取` : '获取验证码' }}
|
||||
</button>
|
||||
</view>
|
||||
<!-- 验证码输入框 + 获取验证码按钮 -->
|
||||
<view class="input-item verify-item">
|
||||
<view class="input-icon">
|
||||
<image src="http://47.104.199.163:9090/images/login/code.png" mode="" style="height: 100%;width: 100%;">
|
||||
</image>
|
||||
</view>
|
||||
<uni-easyinput class="input-content verify-input" type="number" v-model="verifyCode" placeholder="请输入验证码"
|
||||
:inputBorder="false" maxlength="6" :placeholderStyle="placeholderStyle">
|
||||
</uni-easyinput>
|
||||
<button class="get-verify-btn" :disabled="!canGetVerify || countDown > 0" @click="getVerifyCode">
|
||||
{{ countDown > 0 ? `${countDown}s后重新获取` : '获取验证码' }}
|
||||
</button>
|
||||
</view>
|
||||
|
||||
<!-- 协议勾选 -->
|
||||
<view class="agreement-item" @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>
|
||||
<text class="agreement-text">我已阅读并同意《用户隐私政策》</text>
|
||||
</view>
|
||||
<!-- 协议勾选 -->
|
||||
<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>
|
||||
|
||||
<!-- 登录按钮 -->
|
||||
<button
|
||||
class="login-btn"
|
||||
:disabled="!canLogin"
|
||||
@click="handleLogin"
|
||||
>
|
||||
登录
|
||||
</button>
|
||||
<text class="agreement-text" @click.stop="goToPrivacy">我已阅读并同意
|
||||
<text class="agreePrivacy">《用户隐私政策》</text>
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<!-- 底部链接 -->
|
||||
<view class="bottom-link">
|
||||
<navigator class="link-item" url="/pageSubPack/loginSub/pwd-login">账号密码登录</navigator>
|
||||
<navigator class="link-item" url="/pageSubPack/loginSub/register-new-user">注册新用户</navigator>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 登录按钮 -->
|
||||
<button class="login-btn" :disabled="!canLogin" @click="handleLogin">
|
||||
登录
|
||||
</button>
|
||||
|
||||
<!-- 底部链接 -->
|
||||
<view class="bottom-link">
|
||||
<navigator class="link-item" url="/pageSubPack/loginSub/pwd-login">账号密码登录</navigator>
|
||||
<navigator class="link-item" url="/pageSubPack/loginSub/register-new-user">注册新用户</navigator>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, onUnmounted } from 'vue';
|
||||
import {getLoginBySms,getSendCode} from '../api/api.js'
|
||||
import {
|
||||
ref,
|
||||
computed,
|
||||
onUnmounted
|
||||
} from 'vue';
|
||||
import {
|
||||
getLoginBySms,
|
||||
getSendCode
|
||||
} from '../api/api.js'
|
||||
|
||||
// ========== 响应式数据 ==========
|
||||
// 手机号
|
||||
const phoneNumber = ref('');
|
||||
// 验证码
|
||||
const verifyCode = ref('');
|
||||
const placeholderStyle = ref('font-size:24rpx')
|
||||
// 是否同意协议
|
||||
const agreeAgreement = ref(true); // 默认勾选
|
||||
// 倒计时(秒)
|
||||
const countDown = ref(0);
|
||||
// 定时器
|
||||
let timer = null;
|
||||
// ========== 响应式数据 ==========
|
||||
// 手机号
|
||||
const phoneNumber = ref('');
|
||||
// 验证码
|
||||
const verifyCode = ref('');
|
||||
const placeholderStyle = ref('font-size:24rpx')
|
||||
// 是否同意协议
|
||||
const agreeAgreement = ref(false); // 默认勾选
|
||||
// 倒计时(秒)
|
||||
const countDown = ref(0);
|
||||
// 定时器
|
||||
let timer = null;
|
||||
// 控制点击变色
|
||||
// const isClicked = ref(false)
|
||||
|
||||
// ========== 计算属性 ==========
|
||||
// 是否可以获取验证码(手机号格式正确)
|
||||
const canGetVerify = computed(() => {
|
||||
// 手机号正则:11位数字,以1开头
|
||||
const phoneReg = /^1[3-9]\d{9}$/;
|
||||
return phoneReg.test(phoneNumber.value);
|
||||
});
|
||||
// ========== 计算属性 ==========
|
||||
// 是否可以获取验证码(手机号格式正确)
|
||||
const canGetVerify = computed(() => {
|
||||
// 手机号正则:11位数字,以1开头
|
||||
const phoneReg = /^1[3-9]\d{9}$/;
|
||||
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 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 checkForm = () => {
|
||||
// 无需额外逻辑,计算属性已实时监听
|
||||
};
|
||||
|
||||
// 切换协议勾选状态
|
||||
const toggleAgreement = () => {
|
||||
agreeAgreement.value = !agreeAgreement.value;
|
||||
};
|
||||
// 切换协议勾选状态
|
||||
const toggleAgreement = () => {
|
||||
agreeAgreement.value = !agreeAgreement.value;
|
||||
};
|
||||
// 跳转隐私协议
|
||||
const goToPrivacy = () => {
|
||||
// 点击变色
|
||||
// isClicked.value = true
|
||||
uni.navigateTo({
|
||||
url:'/pageSubPack/loginSub/privacy',
|
||||
})
|
||||
}
|
||||
|
||||
// 获取验证码
|
||||
const getVerifyCode = () => {
|
||||
if (!canGetVerify.value) return;
|
||||
let params = {
|
||||
phone:phoneNumber.value,
|
||||
scene:'login'
|
||||
}
|
||||
uni.showLoading({ title: '发送中...', mask: true });
|
||||
getSendCode(params).then(res =>{
|
||||
if(res.code === 200){
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: '验证码已发送',
|
||||
icon: 'success'
|
||||
});
|
||||
// 开始60秒倒计时
|
||||
countDown.value = 60;
|
||||
timer = setInterval(() => {
|
||||
countDown.value--;
|
||||
if (countDown.value <= 0) {
|
||||
clearInterval(timer);
|
||||
timer = null;
|
||||
}
|
||||
}, 1000);
|
||||
}else{
|
||||
uni.showToast({
|
||||
title: '验证码发送失败',
|
||||
icon: 'error'
|
||||
});
|
||||
}
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: '网络异常',
|
||||
icon: 'error'
|
||||
});
|
||||
})
|
||||
|
||||
};
|
||||
|
||||
// 登录处理
|
||||
const handleLogin = () => {
|
||||
if (!canLogin.value) return;
|
||||
uni.showLoading({ title: '登录中...', mask: true });
|
||||
let params = {
|
||||
phone:phoneNumber.value,
|
||||
smsCode:'123456',
|
||||
scene:'login',
|
||||
}
|
||||
getLoginBySms(params).then(res =>{
|
||||
if(res.code === 200){
|
||||
if(res.data){
|
||||
uni.setStorageSync('token', res.data.token);
|
||||
// 存用户ID
|
||||
if(res.data.userId) {
|
||||
uni.setStorageSync('userId', res.data.userId);
|
||||
}
|
||||
// 存当前绑定的小区ID,0 表示未绑定
|
||||
const currentVillageId = res.data.currentVillageId || 0;
|
||||
uni.setStorageSync('currentVillageId', currentVillageId);
|
||||
uni.hideLoading();
|
||||
uni.showToast({ title: '登录成功', icon: 'success' });
|
||||
setTimeout(() =>{
|
||||
uni.switchTab({ url: '/pages/index/index' });
|
||||
},1500)
|
||||
}else{
|
||||
uni.showToast({ title: '登录失败', icon: 'error' });
|
||||
// 获取验证码
|
||||
const getVerifyCode = () => {
|
||||
if (!canGetVerify.value) return;
|
||||
let params = {
|
||||
phone: phoneNumber.value,
|
||||
scene: 'login'
|
||||
}
|
||||
|
||||
}else{
|
||||
uni.showToast({ title:'登录失败', icon: 'error' });
|
||||
}
|
||||
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: '网络异常,请重试',
|
||||
icon: 'error'
|
||||
uni.showLoading({
|
||||
title: '发送中...',
|
||||
mask: true
|
||||
});
|
||||
})
|
||||
getSendCode(params).then(res => {
|
||||
if (res.code === 200) {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: '验证码已发送',
|
||||
icon: 'success'
|
||||
});
|
||||
// 开始60秒倒计时
|
||||
countDown.value = 60;
|
||||
timer = setInterval(() => {
|
||||
countDown.value--;
|
||||
if (countDown.value <= 0) {
|
||||
clearInterval(timer);
|
||||
timer = null;
|
||||
}
|
||||
}, 1000);
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '验证码发送失败',
|
||||
icon: 'error'
|
||||
});
|
||||
}
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: '网络异常',
|
||||
icon: 'error'
|
||||
});
|
||||
})
|
||||
|
||||
};
|
||||
|
||||
// 登录处理
|
||||
const handleLogin = () => {
|
||||
if (!canLogin.value) return;
|
||||
uni.showLoading({
|
||||
title: '登录中...',
|
||||
mask: true
|
||||
});
|
||||
let params = {
|
||||
phone: phoneNumber.value,
|
||||
smsCode: '123456',
|
||||
scene: 'login',
|
||||
}
|
||||
getLoginBySms(params).then(res => {
|
||||
if (res.code === 200) {
|
||||
if (res.data) {
|
||||
uni.setStorageSync('token', res.data.token);
|
||||
// 存用户ID
|
||||
if (res.data.userId) {
|
||||
uni.setStorageSync('userId', res.data.userId);
|
||||
}
|
||||
// 存当前绑定的小区ID,0 表示未绑定
|
||||
const currentVillageId = res.data.currentVillageId || 0;
|
||||
uni.setStorageSync('currentVillageId', currentVillageId);
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: '登录成功',
|
||||
icon: 'success'
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.switchTab({
|
||||
url: '/pages/index/index'
|
||||
});
|
||||
}, 1500)
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '登录失败',
|
||||
icon: 'error'
|
||||
});
|
||||
}
|
||||
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '登录失败',
|
||||
icon: 'error'
|
||||
});
|
||||
}
|
||||
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: '网络异常,请重试',
|
||||
icon: 'error'
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
// 模拟登录请求
|
||||
// uni.showLoading({
|
||||
// title: '登录中...'
|
||||
// });
|
||||
};
|
||||
// 模拟登录请求
|
||||
// uni.showLoading({
|
||||
// title: '登录中...'
|
||||
// });
|
||||
};
|
||||
|
||||
// ========== 生命周期 ==========
|
||||
// 页面卸载时清除定时器
|
||||
onUnmounted(() => {
|
||||
if (timer) {
|
||||
clearInterval(timer);
|
||||
}
|
||||
});
|
||||
// ========== 生命周期 ==========
|
||||
// 页面卸载时清除定时器
|
||||
onUnmounted(() => {
|
||||
if (timer) {
|
||||
clearInterval(timer);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 页面容器 */
|
||||
.login-page {
|
||||
padding: 80rpx 40rpx 40rpx;
|
||||
/* background-color: #f8f9fa; */
|
||||
min-height: 100vh;
|
||||
background: repeating-linear-gradient(to bottom, #E2F0FF, #F6FAFF );
|
||||
}
|
||||
.status_bar {
|
||||
height: 160px;
|
||||
width: 100%;
|
||||
/* 页面容器 */
|
||||
.login-page {
|
||||
padding: 80rpx 40rpx 40rpx;
|
||||
/* background-color: #f8f9fa; */
|
||||
min-height: 100vh;
|
||||
background: repeating-linear-gradient(to bottom, #E2F0FF, #F6FAFF);
|
||||
}
|
||||
|
||||
/* 登录标题 */
|
||||
.login-title {
|
||||
font-size: 48rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
text-align: center;
|
||||
margin-bottom: 80rpx;
|
||||
}
|
||||
.status_bar {
|
||||
height: 160px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* 输入框项 */
|
||||
.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);
|
||||
}
|
||||
/* 登录标题 */
|
||||
.login-title {
|
||||
font-size: 48rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
text-align: center;
|
||||
margin-bottom: 80rpx;
|
||||
}
|
||||
|
||||
/* 验证码输入项(特殊布局) */
|
||||
.verify-item {
|
||||
position: relative;
|
||||
padding-right: 220rpx;
|
||||
}
|
||||
/* 输入框项 */
|
||||
.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 {
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
margin-right: 20rpx;
|
||||
color: #999;
|
||||
}
|
||||
/* 验证码输入项(特殊布局) */
|
||||
.verify-item {
|
||||
position: relative;
|
||||
padding-right: 220rpx;
|
||||
}
|
||||
|
||||
/* 输入框内容 */
|
||||
.input-content {
|
||||
flex: 1;
|
||||
font-size: 32rpx;
|
||||
color: #333;
|
||||
height: 100%;
|
||||
}
|
||||
/* 输入框图标 */
|
||||
.input-icon {
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
margin-right: 20rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
/* 验证码输入框 */
|
||||
.verify-input {
|
||||
padding-right: 20rpx;
|
||||
}
|
||||
/* 输入框内容 */
|
||||
.input-content {
|
||||
flex: 1;
|
||||
font-size: 32rpx;
|
||||
color: #333;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
/* 获取验证码按钮 */
|
||||
.get-verify-btn {
|
||||
position: absolute;
|
||||
right: 10rpx;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
width: 200rpx;
|
||||
height: 70rpx;
|
||||
line-height: 70rpx;
|
||||
background-color: #4D5DFA;
|
||||
color: #fff;
|
||||
border-radius: 35rpx;
|
||||
font-size: 28rpx;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
/* 验证码输入框 */
|
||||
.verify-input {
|
||||
padding-right: 20rpx;
|
||||
}
|
||||
|
||||
/* 获取验证码按钮禁用状态 */
|
||||
.get-verify-btn:disabled {
|
||||
background-color: #ccc;
|
||||
color: #fff;
|
||||
border-radius: 50px;
|
||||
}
|
||||
/* 获取验证码按钮 */
|
||||
.get-verify-btn {
|
||||
position: absolute;
|
||||
right: 10rpx;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
width: 200rpx;
|
||||
height: 70rpx;
|
||||
line-height: 70rpx;
|
||||
background-color: #4D5DFA;
|
||||
color: #fff;
|
||||
border-radius: 35rpx;
|
||||
font-size: 28rpx;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* 协议勾选项 */
|
||||
.agreement-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin: 40rpx 0;
|
||||
padding-left: 10rpx;
|
||||
}
|
||||
/* 获取验证码按钮禁用状态 */
|
||||
.get-verify-btn:disabled {
|
||||
background-color: #ccc;
|
||||
color: #fff;
|
||||
border-radius: 50px;
|
||||
}
|
||||
|
||||
/* 协议文本 */
|
||||
.agreement-text {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
/* 协议勾选项 */
|
||||
.agreement-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin: 40rpx 0;
|
||||
padding-left: 10rpx;
|
||||
}
|
||||
|
||||
/* 登录按钮 */
|
||||
.login-btn {
|
||||
width: 100%;
|
||||
height: 88rpx;
|
||||
line-height: 88rpx;
|
||||
background-color: #4D5DFA;
|
||||
color: #fff;
|
||||
border-radius: 44rpx;
|
||||
font-size: 32rpx;
|
||||
margin-bottom: 60rpx;
|
||||
}
|
||||
/* 协议文本 */
|
||||
.agreement-text {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
.agreePrivacy{
|
||||
color: #4D5DFA;
|
||||
}
|
||||
/* 登录按钮 */
|
||||
.login-btn {
|
||||
width: 100%;
|
||||
height: 88rpx;
|
||||
line-height: 88rpx;
|
||||
background-color: #4D5DFA;
|
||||
color: #fff;
|
||||
border-radius: 44rpx;
|
||||
font-size: 32rpx;
|
||||
margin-bottom: 60rpx;
|
||||
}
|
||||
|
||||
/* 登录按钮禁用状态 */
|
||||
.login-btn:disabled {
|
||||
background-color: #99c8ff;
|
||||
color: #fff;
|
||||
/* border-radius: 50px; */
|
||||
}
|
||||
/* 禁用按钮边框 */
|
||||
button:after{
|
||||
border-radius: 50px;
|
||||
}
|
||||
/* 登录按钮禁用状态 */
|
||||
.login-btn:disabled {
|
||||
background-color: #99c8ff;
|
||||
color: #fff;
|
||||
/* border-radius: 50px; */
|
||||
}
|
||||
|
||||
/* 底部链接 */
|
||||
.bottom-link {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 0 20rpx;
|
||||
}
|
||||
/* 禁用按钮边框 */
|
||||
button:after {
|
||||
border-radius: 50px;
|
||||
}
|
||||
|
||||
/* 链接项 */
|
||||
.link-item {
|
||||
font-size: 28rpx;
|
||||
color: #4D5DFA;
|
||||
text-decoration: none;
|
||||
}
|
||||
/* 底部链接 */
|
||||
.bottom-link {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 0 20rpx;
|
||||
}
|
||||
|
||||
/* 链接项 */
|
||||
.link-item {
|
||||
font-size: 28rpx;
|
||||
color: #4D5DFA;
|
||||
text-decoration: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
169
wuye-manager-uniapp/pageSubPack/loginSub/privacy.vue
Normal file
169
wuye-manager-uniapp/pageSubPack/loginSub/privacy.vue
Normal file
@@ -0,0 +1,169 @@
|
||||
<template>
|
||||
<view class="privacy-page">
|
||||
|
||||
<!-- 协议内容 -->
|
||||
<scroll-view class="privacy-content" scroll-y>
|
||||
<view class="content-wrap">
|
||||
<view class="title">隐私政策</view>
|
||||
|
||||
<view class="section">
|
||||
<!-- <view class="section-title">一、适用范围</view> -->
|
||||
<view class="section-text">
|
||||
欢迎使用我们的产品/服务(以下统称“服务”)。我们高度重视用户隐私保护,
|
||||
致力于为您提供安全、可靠的服务体验。本隐私政策旨在向您说明我们如何收集、使用、存储、保护您的个人信息,
|
||||
以及您享有的相关权利。请您在使用我们的服务前,仔细阅读并理解本政策全部内容,
|
||||
一旦您使用我们的服务,即视为您同意本政策的所有条款。
|
||||
一、我们收集的个人信息 为了向您提供更优质、个性化的服务,我们会根据服务功能的需要,收集您主动提供或在使用服务过程中产生的个人信息,
|
||||
具体如下: (一)您主动提供的信息 账户注册信息:当您注册我们的账户时,您可能需要提供姓名、手机号码、电子邮箱、密码等信息,用于身份验证、账户登录及找回。
|
||||
服务相关信息:根据您使用的具体服务,您可能需要提供相关补充信息(如使用客服咨询服务时,提供问题描述及相关凭证;使用交易类服务时,提供收货地址、支付相关信息等)。
|
||||
自愿提交的信息:您主动向我们反馈的意见、建议,或参与我们的问卷调查、活动时提交的相关信息。
|
||||
若您通过第三方平台(如微信、支付宝、QQ等)登录我们的服务,我们会根据您的授权,
|
||||
从第三方获取您的相关账户信息(如昵称、头像),用于完成登录及账户绑定,
|
||||
我们不会获取第三方平台的其他未授权信息。
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</scroll-view>
|
||||
<!-- 底部同意按钮(新增) -->
|
||||
<!-- <view class="agree-btn-wrap" v-if="needAgree">
|
||||
<button class="agree-btn" @click="agreePrivacy">同意隐私政策</button>
|
||||
</view> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
|
||||
// 返回上一页
|
||||
// const navigateBack = () => {
|
||||
// uni.navigateBack({
|
||||
// delta: 1
|
||||
// });
|
||||
// };
|
||||
// 页面加载
|
||||
// onLoad((options) => {
|
||||
// // 判断是否需要同意
|
||||
// if (options.needAgree === '1') {
|
||||
// needAgree.value = true;
|
||||
// }
|
||||
// });
|
||||
|
||||
// 返回上一页
|
||||
// const goToBack = () => {
|
||||
// uni.navigateBack({
|
||||
// delta: 1
|
||||
// });
|
||||
// };
|
||||
|
||||
// 同意隐私政策(新增)
|
||||
// const agreePrivacy = () => {
|
||||
// // #ifdef MP-WEIXIN
|
||||
// wx.requirePrivacyAuthorize({
|
||||
// success: () => {
|
||||
// uni.showToast({
|
||||
// title: '已同意隐私政策',
|
||||
// icon: 'success'
|
||||
// });
|
||||
// // 记录授权状态(可选,存入本地缓存)
|
||||
// uni.setStorageSync('privacyAgreed', true);
|
||||
// navigateBack();
|
||||
// },
|
||||
// fail: () => {
|
||||
// uni.showToast({
|
||||
// title: '授权失败',
|
||||
// icon: 'none'
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
// // #endif
|
||||
|
||||
// // 非微信小程序直接标记同意
|
||||
// // #ifndef MP-WEIXIN
|
||||
// uni.setStorageSync('privacyAgreed', true);
|
||||
// uni.showToast({
|
||||
// title: '已同意隐私政策',
|
||||
// icon: 'success'
|
||||
// });
|
||||
// navigateBack();
|
||||
// // #endif
|
||||
// };
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.privacy-page {
|
||||
min-height: 100vh;
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
|
||||
/* 导航栏 */
|
||||
.nav-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 20rpx;
|
||||
background-color: #fff;
|
||||
border-bottom: 1rpx solid #eee;
|
||||
}
|
||||
.nav-back {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.back-text {
|
||||
font-size: 30rpx;
|
||||
color: #333;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
.nav-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
margin-left: 60rpx;
|
||||
}
|
||||
|
||||
/* 协议内容 */
|
||||
.privacy-content {
|
||||
height: calc(100vh - 88rpx);
|
||||
}
|
||||
.content-wrap {
|
||||
padding: 30rpx;
|
||||
}
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
text-align: center;
|
||||
margin-bottom: 40rpx;
|
||||
color: #333;
|
||||
}
|
||||
.section {
|
||||
margin-bottom: 30rpx;
|
||||
padding: 0 20rpx;
|
||||
}
|
||||
.section-title {
|
||||
font-size: 30rpx;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
.section-text {
|
||||
font-size: 28rpx;
|
||||
line-height: 1.6;
|
||||
color: #666;
|
||||
}
|
||||
/* 同意按钮样式(新增) */
|
||||
.agree-btn-wrap {
|
||||
padding: 20rpx;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background-color: #fff;
|
||||
border-top: 1rpx solid #eee;
|
||||
}
|
||||
.agree-btn {
|
||||
background-color: #007aff;
|
||||
color: #fff;
|
||||
border-radius: 8rpx;
|
||||
height: 88rpx;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
</style>
|
||||
@@ -1,263 +1,282 @@
|
||||
<template>
|
||||
<view class="login-page">
|
||||
<view class="status_bar"></view>
|
||||
<!-- 标题 -->
|
||||
<view class="login-title">账号密码登录</view>
|
||||
<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="http://47.104.199.163:9090/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="phone" size="24" color="#999"></uni-icons> -->
|
||||
<image src="http://47.104.199.163:9090/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="http://47.104.199.163:9090/images/login/password.png" mode="" style="height: 100%;width: 100%;"></image>
|
||||
</view>
|
||||
<uni-easyinput class="input-content" type="password" v-model="password"
|
||||
placeholder="请输入密码" :inputBorder="false" :placeholderStyle="placeholderStyle">
|
||||
</uni-easyinput>
|
||||
<!-- 密码输入框 -->
|
||||
<view class="input-item">
|
||||
<view class="input-icon">
|
||||
<!-- <uni-icons type="locked" size="24" color="#999"></uni-icons> -->
|
||||
<image src="http://47.104.199.163:9090/images/login/password.png" mode=""
|
||||
style="height: 100%;width: 100%;"></image>
|
||||
</view>
|
||||
<uni-easyinput class="input-content" type="password" v-model="password" placeholder="请输入密码"
|
||||
:inputBorder="false" :placeholderStyle="placeholderStyle">
|
||||
</uni-easyinput>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 协议勾选 + 忘记密码 -->
|
||||
<view class="agreement-wrap">
|
||||
<view class="agreement-item" @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>
|
||||
<text class="agreement-text">我已阅读并同意《用户隐私政策》</text>
|
||||
</view>
|
||||
<navigator class="forget-pwd" url="/pageSubPack/loginSub/forget-pwd">忘记密码?</navigator>
|
||||
</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" @click.stop="goToPrivacy">我已阅读并同意
|
||||
<text class="agreePrivacy">《用户隐私政策》</text>
|
||||
</text>
|
||||
</view>
|
||||
<navigator class="forget-pwd" url="/pageSubPack/loginSub/forget-pwd">忘记密码?</navigator>
|
||||
</view>
|
||||
|
||||
<!-- 登录按钮 -->
|
||||
<button
|
||||
class="login-btn"
|
||||
:disabled="!canLogin"
|
||||
@click="handleLogin"
|
||||
>
|
||||
登录
|
||||
</button>
|
||||
<!-- 登录按钮 -->
|
||||
<button class="login-btn" :disabled="!canLogin" @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>
|
||||
<!-- 底部链接 -->
|
||||
<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>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import {onLoad} from "@dcloudio/uni-app"
|
||||
import {getLoginPassword} from '../api/api.js'
|
||||
import {
|
||||
ref,
|
||||
computed
|
||||
} from 'vue';
|
||||
import {
|
||||
onLoad
|
||||
} from "@dcloudio/uni-app"
|
||||
import {
|
||||
getLoginPassword
|
||||
} from '../api/api.js'
|
||||
|
||||
// 响应式数据
|
||||
const phoneNumber = ref('');
|
||||
const password = ref('');
|
||||
const agreeAgreement = ref(true); // 默认勾选
|
||||
const placeholderStyle = ref('font-size:24rpx')
|
||||
// 响应式数据
|
||||
const phoneNumber = ref('');
|
||||
const password = ref('');
|
||||
const agreeAgreement = ref(false); // 默认勾选
|
||||
const placeholderStyle = ref('font-size:24rpx')
|
||||
// 控制点击变色
|
||||
// const isClicked = 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 checkForm = () => {};
|
||||
|
||||
|
||||
onLoad(() =>{
|
||||
});
|
||||
|
||||
// 登录逻辑
|
||||
const handleLogin = () => {
|
||||
// if (!canLogin.value) {
|
||||
// uni.showToast({ title: '请输入账号和密码', icon: 'none' });
|
||||
// return
|
||||
// }
|
||||
|
||||
// if (!phoneNumber.value) {
|
||||
// uni.showToast({ title: '请输入账号', icon: 'none' });
|
||||
// return;
|
||||
// }
|
||||
// if (!password.value) {
|
||||
// uni.showToast({ title: '请输入密码', icon: 'none' });
|
||||
// return;
|
||||
// }
|
||||
// if(!agreeAgreement.value){
|
||||
// uni.showToast({ title: '请勾选协议', icon: 'none' });
|
||||
// return;
|
||||
// }
|
||||
// uni.showLoading({ title: '登录中...', mask: true });
|
||||
// let params = {
|
||||
// username:phoneNumber.value,
|
||||
// password:password.value
|
||||
// }
|
||||
// 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.hideLoading();
|
||||
// uni.showToast({ title: '登录成功', icon: 'success' });
|
||||
// setTimeout(() =>{
|
||||
// uni.switchTab({
|
||||
// url: '/pages/index/index'
|
||||
// },1000);
|
||||
// })
|
||||
// }else{
|
||||
// uni.showToast({ title: res.msg, icon: 'error' });
|
||||
// }
|
||||
|
||||
// }).catch(err => {
|
||||
// uni.showToast({
|
||||
// title: '网络异常',
|
||||
// icon: 'error'
|
||||
// });
|
||||
// })
|
||||
|
||||
// 测试
|
||||
uni.showLoading({
|
||||
title: '登录中...',
|
||||
mask:true
|
||||
// 计算属性:是否可登录(帐号+密码+协议都满足)
|
||||
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;
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.switchTab({ url: '/pages/index/index' });
|
||||
}, 1500);
|
||||
|
||||
// 切换协议勾选
|
||||
const toggleAgreement = () => {
|
||||
agreeAgreement.value = !agreeAgreement.value;
|
||||
};
|
||||
// 跳转隐私协议
|
||||
const goToPrivacy = () => {
|
||||
|
||||
// isClicked.value = true
|
||||
uni.navigateTo({
|
||||
url:'/pageSubPack/loginSub/privacy',
|
||||
})
|
||||
}
|
||||
|
||||
// 检查表单
|
||||
const checkForm = () => {};
|
||||
|
||||
|
||||
onLoad(() => {});
|
||||
|
||||
// 登录逻辑
|
||||
const handleLogin = () => {
|
||||
// if (!canLogin.value) {
|
||||
// uni.showToast({ title: '请输入账号和密码', icon: 'none' });
|
||||
// return
|
||||
// }
|
||||
|
||||
// if (!phoneNumber.value) {
|
||||
// uni.showToast({ title: '请输入账号', icon: 'none' });
|
||||
// return;
|
||||
// }
|
||||
// if (!password.value) {
|
||||
// uni.showToast({ title: '请输入密码', icon: 'none' });
|
||||
// return;
|
||||
// }
|
||||
// if(!agreeAgreement.value){
|
||||
// uni.showToast({ title: '请勾选协议', icon: 'none' });
|
||||
// return;
|
||||
// }
|
||||
// uni.showLoading({ title: '登录中...', mask: true });
|
||||
// let params = {
|
||||
// username:phoneNumber.value,
|
||||
// password:password.value
|
||||
// }
|
||||
// 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.hideLoading();
|
||||
// uni.showToast({ title: '登录成功', icon: 'success' });
|
||||
// setTimeout(() =>{
|
||||
// uni.switchTab({
|
||||
// url: '/pages/index/index'
|
||||
// },1000);
|
||||
// })
|
||||
// }else{
|
||||
// uni.showToast({ title: res.msg, icon: 'error' });
|
||||
// }
|
||||
|
||||
// }).catch(err => {
|
||||
// uni.showToast({
|
||||
// title: '网络异常',
|
||||
// icon: 'error'
|
||||
// });
|
||||
// })
|
||||
|
||||
// 测试
|
||||
uni.showLoading({
|
||||
title: '登录中...',
|
||||
mask: true
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.switchTab({
|
||||
url: '/pages/index/index'
|
||||
});
|
||||
}, 1500);
|
||||
uni.hideLoading()
|
||||
|
||||
};
|
||||
};
|
||||
</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-page {
|
||||
padding: 80rpx 40rpx 40rpx;
|
||||
/* background-color: #f8f9fa; */
|
||||
min-height: 100vh;
|
||||
background: repeating-linear-gradient(180deg, #E2F0FF, #F6FAFF);
|
||||
}
|
||||
.login-title {
|
||||
font-size: 48rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
text-align: center;
|
||||
margin-bottom: 80rpx;
|
||||
}
|
||||
|
||||
.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);
|
||||
}
|
||||
.status_bar {
|
||||
height: 160px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.input-icon {
|
||||
margin-right: 20rpx;
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
}
|
||||
.login-title {
|
||||
font-size: 48rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
text-align: center;
|
||||
margin-bottom: 80rpx;
|
||||
}
|
||||
|
||||
.input-content {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
height: 100%;
|
||||
}
|
||||
.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);
|
||||
}
|
||||
|
||||
.agreement-wrap {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin: 40rpx 0;
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
.input-icon {
|
||||
margin-right: 20rpx;
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
}
|
||||
|
||||
.agreement-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.input-content {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.agreement-text {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
.agreement-wrap {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin: 40rpx 0;
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
|
||||
.forget-pwd {
|
||||
font-size: 28rpx;
|
||||
color: #4D5DFA;
|
||||
text-decoration: none;
|
||||
}
|
||||
.agreement-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.login-btn {
|
||||
width: 100%;
|
||||
height: 88rpx;
|
||||
line-height: 88rpx;
|
||||
background-color: #4D5DFA;
|
||||
color: #fff;
|
||||
border-radius: 44rpx;
|
||||
font-size: 32rpx;
|
||||
margin-bottom: 60rpx;
|
||||
}
|
||||
.agreement-text {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
.agreePrivacy{
|
||||
color: #4D5DFA;
|
||||
}
|
||||
/* .agreePrivacy.active{
|
||||
color: #4D5DFA;
|
||||
} */
|
||||
|
||||
.login-btn:disabled {
|
||||
background-color: #99c8ff;
|
||||
color: #fff;
|
||||
/* border-radius: 50px; */
|
||||
.forget-pwd {
|
||||
font-size: 28rpx;
|
||||
color: #4D5DFA;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
}
|
||||
/* 禁用按钮边框 */
|
||||
button:after{
|
||||
border-radius: 50px;
|
||||
}
|
||||
.login-btn {
|
||||
width: 100%;
|
||||
height: 88rpx;
|
||||
line-height: 88rpx;
|
||||
background-color: #4D5DFA;
|
||||
color: #fff;
|
||||
border-radius: 44rpx;
|
||||
font-size: 32rpx;
|
||||
margin-bottom: 60rpx;
|
||||
}
|
||||
|
||||
.bottom-link {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 0 20rpx;
|
||||
}
|
||||
.login-btn:disabled {
|
||||
background-color: #99c8ff;
|
||||
color: #fff;
|
||||
/* border-radius: 50px; */
|
||||
|
||||
.link-item {
|
||||
font-size: 28rpx;
|
||||
color: #4D5DFA;
|
||||
text-decoration: none;
|
||||
}
|
||||
</style>
|
||||
}
|
||||
|
||||
/* 禁用按钮边框 */
|
||||
button:after {
|
||||
border-radius: 50px;
|
||||
}
|
||||
|
||||
.bottom-link {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 0 20rpx;
|
||||
}
|
||||
|
||||
.link-item {
|
||||
font-size: 28rpx;
|
||||
color: #4D5DFA;
|
||||
text-decoration: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -36,7 +36,7 @@ import { ref } from 'vue'
|
||||
// 跳转到详情页方法
|
||||
const goToDetail = () => {
|
||||
uni.navigateTo({
|
||||
url: '/pageSubPack/notice-list/noticeListDetails'
|
||||
url: '/pageSubPack/notice-list/noticeListDetails'
|
||||
})
|
||||
}
|
||||
</script>
|
||||
@@ -81,9 +81,9 @@ const goToDetail = () => {
|
||||
|
||||
// 右上角未读红点
|
||||
.unread-dot {
|
||||
width: 8rpx;
|
||||
height: 8rpx;
|
||||
background-color: #ff3b30;
|
||||
width: 16rpx;
|
||||
height: 16rpx;
|
||||
background-color: #E34D59;
|
||||
border-radius: 50%;
|
||||
margin-top: 6rpx;
|
||||
}
|
||||
@@ -130,4 +130,4 @@ const goToDetail = () => {
|
||||
color: #4D5DFA;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -4,13 +4,8 @@
|
||||
<view class="search-container">
|
||||
<view class="search-input-wrapper">
|
||||
<uni-icons class="search-icon" type="search" size="20" color="#999"></uni-icons>
|
||||
<input
|
||||
class="search-input"
|
||||
placeholder="请输入关键字进行搜索"
|
||||
placeholder-class="placeholder"
|
||||
v-model="searchText"
|
||||
@input="handleSearchInput"
|
||||
/>
|
||||
<input class="search-input" placeholder="请输入关键字进行搜索" placeholder-class="placeholder" v-model="searchText"
|
||||
@input="handleSearchInput" />
|
||||
<view v-if="searchText" class="clear-icon" @tap="clearSearch">
|
||||
<uni-icons type="clear" size="18" color="#999"></uni-icons>
|
||||
</view>
|
||||
@@ -19,35 +14,21 @@
|
||||
</view>
|
||||
|
||||
<!-- 小区列表 -->
|
||||
<scroll-view
|
||||
class="community-list"
|
||||
scroll-y
|
||||
:scroll-into-view="scrollIntoViewId"
|
||||
@scrolltolower="loadMoreData"
|
||||
:lower-threshold="100"
|
||||
>
|
||||
<view
|
||||
v-for="item in displayedCommunities"
|
||||
:key="item.id"
|
||||
class="community-item"
|
||||
:id="'item-' + item.id"
|
||||
@tap="selectCommunity(item)"
|
||||
>
|
||||
<scroll-view class="community-list" scroll-y :scroll-into-view="scrollIntoViewId" @scrolltolower="loadMoreData"
|
||||
:lower-threshold="100">
|
||||
<view v-for="item in displayedCommunities" :key="item.id" class="community-item" :id="'item-' + item.id"
|
||||
@tap="selectCommunity(item)" :class="{active:selectedItem?.id === item.id}">
|
||||
<view class="community-item-left">
|
||||
<image src="/static/imgs/community.png" style="width: 48rpx;height: 48rpx;"></image>
|
||||
<!-- <uni-icons class="house-icon" type="home" size="24" color="#666"></uni-icons> -->
|
||||
<image src="/static/imgs/community.png" style="width: 48rpx;height: 48rpx;"></image>
|
||||
<view class="community-info">
|
||||
<text class="community-name">{{ item.name }}</text>
|
||||
<!-- <text class="community-address">{{ item.address }}</text> -->
|
||||
<!-- <text class="community-id">ID: {{ item.id }}</text> -->
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="selectedItem && selectedItem.id === item.id" class="selected-icon">
|
||||
<!-- <uni-icons type="checkbox-filled" size="24" color="#007AFF"></uni-icons> -->
|
||||
<image src="/static/imgs/check.png" style="width: 48rpx;height: 48rpx;"></image>
|
||||
<image src="/static/imgs/check.png" style="width: 48rpx;height: 48rpx;"></image>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 加载更多 -->
|
||||
<view v-if="hasMoreData" class="load-more-container">
|
||||
<view v-if="!isLoading" class="load-more-btn" @tap="loadMoreData">
|
||||
@@ -60,18 +41,18 @@
|
||||
</view>
|
||||
<!-- <text class="page-info">第 {{ currentPage }} 页 / 共 {{ totalPages }} 页</text> -->
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 没有更多数据 -->
|
||||
<view v-if="!hasMoreData && displayedCommunities.length > 0" class="no-more-data">
|
||||
<text>没有更多数据了</text>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 空状态 -->
|
||||
<view v-if="displayedCommunities.length === 0 && !isSearching" class="empty-state">
|
||||
<uni-icons type="info" size="60" color="#ccc"></uni-icons>
|
||||
<text class="empty-text">暂无小区数据</text>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 搜索无结果 -->
|
||||
<view v-if="displayedCommunities.length === 0 && isSearching" class="empty-state">
|
||||
<uni-icons type="search" size="60" color="#ccc"></uni-icons>
|
||||
@@ -82,12 +63,8 @@
|
||||
|
||||
<!-- 确认按钮 -->
|
||||
<view class="confirm-area">
|
||||
<button
|
||||
class="confirm-btn"
|
||||
:disabled="!selectedItem"
|
||||
:class="{ 'disabled-btn': !selectedItem }"
|
||||
@tap="handleConfirm"
|
||||
>
|
||||
<button class="confirm-btn" :disabled="!selectedItem" :class="{ 'disabled-btn': !selectedItem }"
|
||||
@tap="handleConfirm">
|
||||
确认选择
|
||||
</button>
|
||||
</view>
|
||||
@@ -95,435 +72,490 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, onMounted, watch } from 'vue'
|
||||
import {
|
||||
ref,
|
||||
computed,
|
||||
onMounted,
|
||||
watch
|
||||
} from 'vue'
|
||||
|
||||
// 响应式数据
|
||||
const searchText = ref('')
|
||||
const selectedItem = ref(null)
|
||||
const scrollIntoViewId = ref('')
|
||||
// 响应式数据
|
||||
const searchText = ref('')
|
||||
const selectedItem = ref(null)
|
||||
const scrollIntoViewId = ref('')
|
||||
|
||||
// 分页相关
|
||||
const currentPage = ref(1)
|
||||
const pageSize = 5
|
||||
const totalCommunities = ref([])
|
||||
const displayedCommunities = ref([])
|
||||
const hasMoreData = ref(true)
|
||||
const isLoading = ref(false)
|
||||
// 分页相关
|
||||
const currentPage = ref(1)
|
||||
const pageSize = 5
|
||||
const totalCommunities = ref([])
|
||||
const displayedCommunities = ref([])
|
||||
const hasMoreData = ref(true)
|
||||
const isLoading = ref(false)
|
||||
|
||||
// 搜索状态
|
||||
const isSearching = ref(false)
|
||||
let searchTimeout = null
|
||||
// 搜索状态
|
||||
const isSearching = ref(false)
|
||||
let searchTimeout = null
|
||||
|
||||
// 所有小区数据
|
||||
const allCommunities = ref([
|
||||
{ id: 1, name: '北境碧桂园小区', address: '北境市光明区碧桂路1号' },
|
||||
{ id: 2, name: '南湖花园小区', address: '南湖市滨湖区湖滨路28号' },
|
||||
{ id: 3, name: '东城国际社区', address: '东城市新城区人民路156号' },
|
||||
{ id: 4, name: '西湖雅苑', address: '西湖市风景区梅灵路88号' },
|
||||
{ id: 5, name: '北境锦绣家园', address: '北境市朝阳区朝阳路56号' },
|
||||
{ id: 6, name: '阳光100小区', address: '阳光市高新区创业路100号' },
|
||||
{ id: 7, name: '绿城玫瑰园', address: '绿城市西湖区学院路188号' },
|
||||
{ id: 8, name: '金地自在城', address: '金城市江干区金沙大道200号' },
|
||||
{ id: 9, name: '万科城市花园', address: '万城市余杭区文一西路299号' },
|
||||
{ id: 10, name: '保利中央公园', address: '保利市拱墅区莫干山路500号' },
|
||||
{ id: 11, name: '龙湖天街小区', address: '龙湖市滨江区江南大道100号' },
|
||||
])
|
||||
// 所有小区数据
|
||||
const allCommunities = ref([{
|
||||
id: 1,
|
||||
name: '北境碧桂园小区',
|
||||
address: '北境市光明区碧桂路1号'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: '南湖花园小区',
|
||||
address: '南湖市滨湖区湖滨路28号'
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: '东城国际社区',
|
||||
address: '东城市新城区人民路156号'
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: '西湖雅苑',
|
||||
address: '西湖市风景区梅灵路88号'
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
name: '北境锦绣家园',
|
||||
address: '北境市朝阳区朝阳路56号'
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: '阳光100小区',
|
||||
address: '阳光市高新区创业路100号'
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: '绿城玫瑰园',
|
||||
address: '绿城市西湖区学院路188号'
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: '金地自在城',
|
||||
address: '金城市江干区金沙大道200号'
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: '万科城市花园',
|
||||
address: '万城市余杭区文一西路299号'
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: '保利中央公园',
|
||||
address: '保利市拱墅区莫干山路500号'
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: '龙湖天街小区',
|
||||
address: '龙湖市滨江区江南大道100号'
|
||||
},
|
||||
])
|
||||
|
||||
// 计算属性
|
||||
const totalPages = computed(() => {
|
||||
return Math.ceil(totalCommunities.value.length / pageSize)
|
||||
})
|
||||
// 计算属性
|
||||
const totalPages = computed(() => {
|
||||
return Math.ceil(totalCommunities.value.length / pageSize)
|
||||
})
|
||||
|
||||
// 方法
|
||||
// 加载分页数据
|
||||
const loadPageData = (pageNum) => {
|
||||
isLoading.value = true
|
||||
|
||||
// 模拟网络请求延迟
|
||||
setTimeout(() => {
|
||||
const startIndex = (pageNum - 1) * pageSize
|
||||
const endIndex = startIndex + pageSize
|
||||
const pageData = totalCommunities.value.slice(startIndex, endIndex)
|
||||
|
||||
if (pageNum === 1) {
|
||||
displayedCommunities.value = pageData
|
||||
} else {
|
||||
displayedCommunities.value = [...displayedCommunities.value, ...pageData]
|
||||
}
|
||||
|
||||
currentPage.value = pageNum
|
||||
hasMoreData.value = displayedCommunities.value.length < totalCommunities.value.length
|
||||
isLoading.value = false
|
||||
|
||||
// 滚动到新加载的内容
|
||||
if (pageNum > 1 && pageData.length > 0) {
|
||||
setTimeout(() => {
|
||||
scrollIntoViewId.value = 'item-' + pageData[0].id
|
||||
}, 100)
|
||||
}
|
||||
}, 500)
|
||||
}
|
||||
// 方法
|
||||
// 加载分页数据
|
||||
const loadPageData = (pageNum) => {
|
||||
isLoading.value = true
|
||||
|
||||
// 加载更多数据
|
||||
const loadMoreData = () => {
|
||||
if (isLoading.value || !hasMoreData.value) return
|
||||
loadPageData(currentPage.value + 1)
|
||||
}
|
||||
// 模拟网络请求延迟
|
||||
setTimeout(() => {
|
||||
const startIndex = (pageNum - 1) * pageSize
|
||||
const endIndex = startIndex + pageSize
|
||||
const pageData = totalCommunities.value.slice(startIndex, endIndex)
|
||||
|
||||
// 处理搜索输入
|
||||
const handleSearchInput = () => {
|
||||
// 防抖处理
|
||||
if (searchTimeout) {
|
||||
clearTimeout(searchTimeout)
|
||||
if (pageNum === 1) {
|
||||
displayedCommunities.value = pageData
|
||||
} else {
|
||||
displayedCommunities.value = [...displayedCommunities.value, ...pageData]
|
||||
}
|
||||
|
||||
currentPage.value = pageNum
|
||||
hasMoreData.value = displayedCommunities.value.length < totalCommunities.value.length
|
||||
isLoading.value = false
|
||||
|
||||
// 滚动到新加载的内容
|
||||
if (pageNum > 1 && pageData.length > 0) {
|
||||
setTimeout(() => {
|
||||
scrollIntoViewId.value = 'item-' + pageData[0].id
|
||||
}, 100)
|
||||
}
|
||||
}, 500)
|
||||
}
|
||||
|
||||
searchTimeout = setTimeout(() => {
|
||||
handleSearch()
|
||||
}, 300)
|
||||
}
|
||||
|
||||
// 处理搜索
|
||||
const handleSearch = () => {
|
||||
const keyword = searchText.value.trim().toLowerCase()
|
||||
|
||||
if (!keyword) {
|
||||
// 加载更多数据
|
||||
const loadMoreData = () => {
|
||||
if (isLoading.value || !hasMoreData.value) return
|
||||
loadPageData(currentPage.value + 1)
|
||||
}
|
||||
|
||||
// 处理搜索输入
|
||||
const handleSearchInput = () => {
|
||||
// 防抖处理
|
||||
if (searchTimeout) {
|
||||
clearTimeout(searchTimeout)
|
||||
}
|
||||
|
||||
searchTimeout = setTimeout(() => {
|
||||
handleSearch()
|
||||
}, 300)
|
||||
}
|
||||
|
||||
// 处理搜索
|
||||
const handleSearch = () => {
|
||||
const keyword = searchText.value.trim().toLowerCase()
|
||||
|
||||
if (!keyword) {
|
||||
isSearching.value = false
|
||||
totalCommunities.value = [...allCommunities.value]
|
||||
loadPageData(1)
|
||||
return
|
||||
}
|
||||
|
||||
isSearching.value = true
|
||||
totalCommunities.value = allCommunities.value.filter(community =>
|
||||
community.name.toLowerCase().includes(keyword) ||
|
||||
community.address.toLowerCase().includes(keyword)
|
||||
)
|
||||
|
||||
loadPageData(1)
|
||||
}
|
||||
|
||||
// 清空搜索
|
||||
const clearSearch = () => {
|
||||
searchText.value = ''
|
||||
isSearching.value = false
|
||||
totalCommunities.value = [...allCommunities.value]
|
||||
loadPageData(1)
|
||||
return
|
||||
}
|
||||
|
||||
isSearching.value = true
|
||||
totalCommunities.value = allCommunities.value.filter(community =>
|
||||
community.name.toLowerCase().includes(keyword) ||
|
||||
community.address.toLowerCase().includes(keyword)
|
||||
)
|
||||
|
||||
loadPageData(1)
|
||||
}
|
||||
|
||||
// 清空搜索
|
||||
const clearSearch = () => {
|
||||
searchText.value = ''
|
||||
isSearching.value = false
|
||||
totalCommunities.value = [...allCommunities.value]
|
||||
loadPageData(1)
|
||||
}
|
||||
|
||||
// 选择小区
|
||||
const selectCommunity = (item) => {
|
||||
selectedItem.value = item
|
||||
}
|
||||
|
||||
// 确认选择
|
||||
const handleConfirm = () => {
|
||||
if (!selectedItem.value) {
|
||||
uni.showToast({
|
||||
title: '请先选择小区',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
return
|
||||
// 选择小区
|
||||
const selectCommunity = (item) => {
|
||||
selectedItem.value = item
|
||||
}
|
||||
|
||||
uni.showModal({
|
||||
title: '确认选择',
|
||||
content: `您已选择: ${selectedItem.value.name}\n地址: ${selectedItem.value.address}`,
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.showToast({
|
||||
title: '选择成功',
|
||||
icon: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
|
||||
// 在实际应用中,这里可以触发回调或页面跳转
|
||||
// uni.navigateBack() 或 emit('confirm', selectedItem.value)
|
||||
uni.$emit('confirm', selectedItem.value)
|
||||
// 模拟2秒后返回上一页
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 1500)
|
||||
|
||||
// 确认选择
|
||||
const handleConfirm = () => {
|
||||
if (!selectedItem.value) {
|
||||
uni.showToast({
|
||||
title: '请先选择小区',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
uni.showModal({
|
||||
title: '确认选择',
|
||||
content: `您已选择: ${selectedItem.value.name}\n地址: ${selectedItem.value.address}`,
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.showToast({
|
||||
title: '选择成功',
|
||||
icon: 'success',
|
||||
duration: 1500
|
||||
})
|
||||
|
||||
// 在实际应用中,这里可以触发回调或页面跳转
|
||||
// uni.navigateBack() 或 emit('confirm', selectedItem.value)
|
||||
uni.$emit('confirm', selectedItem.value)
|
||||
// 模拟2秒后返回上一页
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 1500)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 监听搜索文本变化
|
||||
watch(searchText, (newVal) => {
|
||||
if (!newVal.trim()) {
|
||||
clearSearch()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 监听搜索文本变化
|
||||
watch(searchText, (newVal) => {
|
||||
if (!newVal.trim()) {
|
||||
clearSearch()
|
||||
}
|
||||
})
|
||||
// 初始化
|
||||
onMounted(() => {
|
||||
// 初始化数据
|
||||
totalCommunities.value = [...allCommunities.value]
|
||||
loadPageData(1)
|
||||
|
||||
// 初始化
|
||||
onMounted(() => {
|
||||
// 初始化数据
|
||||
totalCommunities.value = [...allCommunities.value]
|
||||
loadPageData(1)
|
||||
|
||||
// 默认选中第一项
|
||||
if (displayedCommunities.value.length > 0) {
|
||||
selectedItem.value = displayedCommunities.value[0]
|
||||
}
|
||||
})
|
||||
// 默认选中第一项
|
||||
if (displayedCommunities.value.length > 0) {
|
||||
selectedItem.value = displayedCommunities.value[0]
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 页面容器 */
|
||||
.container {
|
||||
min-height: 100vh;
|
||||
background-color: #f5f5f5;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 0rpx 40rpx;
|
||||
}
|
||||
|
||||
/* 搜索区域 */
|
||||
.search-container {
|
||||
padding: 20rpx 30rpx;
|
||||
background-color: #ffffff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
|
||||
z-index: 10;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.search-input-wrapper {
|
||||
flex: 1;
|
||||
background-color: #f8f8f8;
|
||||
border-radius: 10rpx;
|
||||
padding: 0 20rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 80rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.search-icon {
|
||||
margin-right: 15rpx;
|
||||
}
|
||||
|
||||
.search-input {
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.placeholder {
|
||||
color: #999;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.clear-icon {
|
||||
padding: 10rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.search-btn {
|
||||
background-color: #007AFF;
|
||||
color: #fff;
|
||||
font-size: 28rpx;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
border-radius: 10rpx;
|
||||
padding: 0 30rpx;
|
||||
margin: 0;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* 小区列表 */
|
||||
.community-list {
|
||||
flex: 1;
|
||||
/* padding: 0 30rpx; */
|
||||
margin-top: 20rpx;
|
||||
margin-bottom: 180rpx;
|
||||
|
||||
}
|
||||
|
||||
.community-item {
|
||||
background-color: #fff;
|
||||
border-radius: 12rpx;
|
||||
padding: 30rpx;
|
||||
margin-bottom: 20rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.community-item:active {
|
||||
background-color: #f9f9f9;
|
||||
transform: translateY(2rpx);
|
||||
}
|
||||
|
||||
.community-item-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.house-icon {
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.community-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.community-name {
|
||||
font-size: 32rpx;
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.community-address {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
margin-bottom: 5rpx;
|
||||
}
|
||||
|
||||
.community-id {
|
||||
font-size: 22rpx;
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
.selected-icon {
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
|
||||
/* 加载更多容器 */
|
||||
.load-more-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 40rpx 0;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.load-more-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 20rpx 40rpx;
|
||||
background-color: #f8f8f8;
|
||||
border-radius: 50rpx;
|
||||
color: #007AFF;
|
||||
font-size: 28rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.load-more-btn text {
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
.loading-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 20rpx 40rpx;
|
||||
background-color: #f8f8f8;
|
||||
border-radius: 50rpx;
|
||||
color: #007AFF;
|
||||
font-size: 28rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.loading-icon {
|
||||
margin-right: 10rpx;
|
||||
animation: rotate 1s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes rotate {
|
||||
from { transform: rotate(0deg); }
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
.page-info {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
/* 没有更多数据 */
|
||||
.no-more-data {
|
||||
text-align: center;
|
||||
padding: 40rpx 0;
|
||||
color: #999;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
/* 空状态 */
|
||||
.empty-state {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 100rpx 0;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
font-size: 32rpx;
|
||||
color: #999;
|
||||
margin-top: 20rpx;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.empty-tip {
|
||||
font-size: 24rpx;
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
/* 确认区域 */
|
||||
.confirm-area {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
padding: 20rpx 30rpx 40rpx;
|
||||
background-color: #fff;
|
||||
box-shadow: 0 -2rpx 20rpx rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.confirm-btn {
|
||||
background-color: #4D5DFA;
|
||||
color: #fff;
|
||||
height: 100rpx;
|
||||
line-height: 100rpx;
|
||||
border-radius: 8rpx;
|
||||
font-size: 34rpx;
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.disabled-btn {
|
||||
background-color: #ccc;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.selected-info {
|
||||
text-align: center;
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
margin-top: 20rpx;
|
||||
padding: 10rpx;
|
||||
background-color: #f8f8f8;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
/* 适配不同屏幕 */
|
||||
@media (min-width: 768px) {
|
||||
/* 页面容器 */
|
||||
.container {
|
||||
max-width: 500px;
|
||||
margin: 0 auto;
|
||||
min-height: 100vh;
|
||||
background-color: #f5f5f5;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 0rpx 40rpx;
|
||||
}
|
||||
|
||||
/* 搜索区域 */
|
||||
.search-container {
|
||||
padding: 20rpx 30rpx;
|
||||
background-color: #ffffff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
|
||||
z-index: 10;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.search-input-wrapper {
|
||||
flex: 1;
|
||||
background-color: #f8f8f8;
|
||||
border-radius: 10rpx;
|
||||
padding: 0 20rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 80rpx;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.search-icon {
|
||||
margin-right: 15rpx;
|
||||
}
|
||||
|
||||
.search-input {
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.placeholder {
|
||||
color: #999;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.clear-icon {
|
||||
padding: 10rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.search-btn {
|
||||
background-color: #007AFF;
|
||||
color: #fff;
|
||||
font-size: 28rpx;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
border-radius: 10rpx;
|
||||
padding: 0 30rpx;
|
||||
margin: 0;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* 小区列表 */
|
||||
.community-list {
|
||||
flex: 1;
|
||||
/* padding: 0 30rpx; */
|
||||
margin-top: 20rpx;
|
||||
margin-bottom: 180rpx;
|
||||
|
||||
}
|
||||
|
||||
.community-item {
|
||||
background-color: #fff;
|
||||
border-radius: 12rpx;
|
||||
padding: 30rpx;
|
||||
margin-bottom: 20rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.community-item.active {
|
||||
background-color: #F5FAFF;
|
||||
border: 1px solid #2F77FD;
|
||||
transform: translateY(2rpx);
|
||||
|
||||
}
|
||||
|
||||
.community-item-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.house-icon {
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
.community-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.community-name {
|
||||
font-size: 32rpx;
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.community-address {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
margin-bottom: 5rpx;
|
||||
}
|
||||
|
||||
.community-id {
|
||||
font-size: 22rpx;
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
.selected-icon {
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
|
||||
/* 加载更多容器 */
|
||||
.load-more-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 40rpx 0;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.load-more-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 20rpx 40rpx;
|
||||
background-color: #f8f8f8;
|
||||
border-radius: 50rpx;
|
||||
color: #007AFF;
|
||||
font-size: 28rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.load-more-btn text {
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
.loading-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 20rpx 40rpx;
|
||||
background-color: #f8f8f8;
|
||||
border-radius: 50rpx;
|
||||
color: #007AFF;
|
||||
font-size: 28rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.loading-icon {
|
||||
margin-right: 10rpx;
|
||||
animation: rotate 1s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes rotate {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.page-info {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
/* 没有更多数据 */
|
||||
.no-more-data {
|
||||
text-align: center;
|
||||
padding: 40rpx 0;
|
||||
color: #999;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
/* 空状态 */
|
||||
.empty-state {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 100rpx 0;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
font-size: 32rpx;
|
||||
color: #999;
|
||||
margin-top: 20rpx;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.empty-tip {
|
||||
font-size: 24rpx;
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
/* 确认区域 */
|
||||
.confirm-area {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
padding: 20rpx 30rpx 40rpx;
|
||||
background-color: #fff;
|
||||
box-shadow: 0 -2rpx 20rpx rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.confirm-btn {
|
||||
background-color: #4D5DFA;
|
||||
color: #fff;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
border-radius: 8rpx;
|
||||
font-size: 28rpx;
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.disabled-btn {
|
||||
background-color: #ccc;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.selected-info {
|
||||
text-align: center;
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
margin-top: 20rpx;
|
||||
padding: 10rpx;
|
||||
background-color: #f8f8f8;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
/* 适配不同屏幕 */
|
||||
@media (min-width: 768px) {
|
||||
.container {
|
||||
max-width: 500px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -2,17 +2,17 @@
|
||||
<view class="report-record-page">
|
||||
<view class="status-bar"></view>
|
||||
<!-- 顶部导航栏 -->
|
||||
<uni-nav-bar
|
||||
left-icon="back"
|
||||
title="上报记录"
|
||||
<uni-nav-bar
|
||||
left-icon="back"
|
||||
title="上报记录"
|
||||
backgroundColor="transparent"
|
||||
:border= "false"
|
||||
@clickLeft="navBack"/>
|
||||
|
||||
<!-- 状态筛选标签 -->
|
||||
<view class="status-tabs">
|
||||
<view
|
||||
v-for="item in statusTabs"
|
||||
<view
|
||||
v-for="item in statusTabs"
|
||||
:key="item.value"
|
||||
class="status-tab-item"
|
||||
:class="{ active: activeStatus === item.value }"
|
||||
@@ -24,8 +24,8 @@
|
||||
|
||||
<!-- 类型筛选标签 -->
|
||||
<view class="type-tabs">
|
||||
<view
|
||||
v-for="item in typeTabs"
|
||||
<view
|
||||
v-for="item in typeTabs"
|
||||
:key="item.value"
|
||||
class="type-tab-item"
|
||||
:class="{ active: activeType === item.value }"
|
||||
@@ -36,9 +36,9 @@
|
||||
</view>
|
||||
|
||||
<!-- 上报记录列表 -->
|
||||
<scroll-view
|
||||
class="record-list"
|
||||
scroll-y
|
||||
<scroll-view
|
||||
class="record-list"
|
||||
scroll-y
|
||||
:style="{ height: `calc(100vh - ${navHeight + statusTabHeight + typeTabHeight}px)` }"
|
||||
>
|
||||
<!-- 空状态 -->
|
||||
@@ -48,8 +48,8 @@
|
||||
</view>
|
||||
|
||||
<!-- 记录卡片 -->
|
||||
<view
|
||||
v-for="record in filteredRecords"
|
||||
<view
|
||||
v-for="record in filteredRecords"
|
||||
:key="record.id"
|
||||
class="record-card"
|
||||
>
|
||||
@@ -211,14 +211,17 @@ onReady(() => {
|
||||
.status-tabs {
|
||||
display: flex;
|
||||
/* background-color: #fff; */
|
||||
padding: 0 20rpx;
|
||||
padding: 0 40rpx;
|
||||
height: 88rpx;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.status-tab-item {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
/* flex: 1; */
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
margin-right: 60rpx;
|
||||
text-align: left;
|
||||
font-size: 32rpx;
|
||||
color: #666;
|
||||
height: 100%;
|
||||
@@ -247,7 +250,7 @@ onReady(() => {
|
||||
.type-tabs {
|
||||
display: flex;
|
||||
/* background-color: #fff; */
|
||||
padding: 20rpx 30rpx;
|
||||
padding: 20rpx 0rpx;
|
||||
margin-top: 10rpx;
|
||||
justify-content: flex-start;
|
||||
gap: 20rpx;
|
||||
@@ -259,13 +262,13 @@ onReady(() => {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
border: 2rpx solid #999;
|
||||
border-radius: 25rpx;
|
||||
border-radius: 198rpx;
|
||||
}
|
||||
|
||||
.type-tab-item.active {
|
||||
color: #4D5DFA;
|
||||
border: 2rpx solid #4D5DFA;
|
||||
border-radius: 25rpx;
|
||||
border-radius: 198rpx;
|
||||
/* background-color: #007AFF; */
|
||||
}
|
||||
|
||||
@@ -317,7 +320,7 @@ onReady(() => {
|
||||
/* 状态标签 */
|
||||
.status-tag {
|
||||
padding: 6rpx 16rpx;
|
||||
font-size: 24rpx;
|
||||
font-size: 20rpx;
|
||||
border-radius: 12rpx;
|
||||
color: #fff;
|
||||
border-radius: 198rpx;
|
||||
@@ -370,4 +373,4 @@ onReady(() => {
|
||||
.repairman {
|
||||
color: #999;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -9,26 +9,26 @@
|
||||
|
||||
<!-- 旧密码输入框 -->
|
||||
<view class="input-item">
|
||||
<uni-easyinput
|
||||
class="input-content"
|
||||
type="password"
|
||||
<uni-easyinput
|
||||
class="input-content"
|
||||
type="password"
|
||||
v-model="oldPassword"
|
||||
placeholder="请输入旧密码"
|
||||
:inputBorder="false"
|
||||
placeholder="请输入旧密码"
|
||||
:inputBorder="false"
|
||||
:placeholderStyle="placeholderStyle"
|
||||
@input="checkForm"
|
||||
>
|
||||
</uni-easyinput>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 新密码输入框 -->
|
||||
<view class="input-item">
|
||||
<uni-easyinput
|
||||
class="input-content"
|
||||
type="password"
|
||||
<uni-easyinput
|
||||
class="input-content"
|
||||
type="password"
|
||||
v-model="newPassword"
|
||||
placeholder="请输入新密码(6-16位,含字母+数字)"
|
||||
:inputBorder="false"
|
||||
placeholder="请输入新密码(6-16位,含字母+数字)"
|
||||
:inputBorder="false"
|
||||
:placeholderStyle="placeholderStyle"
|
||||
@input="checkForm"
|
||||
>
|
||||
@@ -37,12 +37,12 @@
|
||||
|
||||
<!-- 确认密码输入框 -->
|
||||
<view class="input-item">
|
||||
<uni-easyinput
|
||||
class="input-content"
|
||||
type="password"
|
||||
<uni-easyinput
|
||||
class="input-content"
|
||||
type="password"
|
||||
v-model="confirmPassword"
|
||||
placeholder="请再次输入新密码"
|
||||
:inputBorder="false"
|
||||
placeholder="请再次输入新密码"
|
||||
:inputBorder="false"
|
||||
:placeholderStyle="placeholderStyle"
|
||||
@input="checkForm"
|
||||
>
|
||||
@@ -55,8 +55,8 @@
|
||||
</view>
|
||||
|
||||
<!-- 确定按钮 -->
|
||||
<button
|
||||
class="confirm-btn"
|
||||
<button
|
||||
class="confirm-btn"
|
||||
:disabled="!canConfirm"
|
||||
@click="handleConfirm"
|
||||
>
|
||||
@@ -88,15 +88,15 @@ const smsCode = ref('');
|
||||
const canConfirm = computed(() => {
|
||||
// 密码格式规则:6-16位,必须包含字母+数字
|
||||
const pwdReg = /^(?=.*[a-zA-Z])(?=.*\d).{6,16}$/;
|
||||
|
||||
|
||||
// 校验条件:
|
||||
// 1. 旧密码不为空
|
||||
// 2. 新密码符合格式
|
||||
// 3. 确认密码和新密码一致
|
||||
// 1. 旧密码不为空
|
||||
// 2. 新密码符合格式
|
||||
// 3. 确认密码和新密码一致
|
||||
// 4. 所有密码输入框不为空
|
||||
return oldPassword.value.trim()
|
||||
&& pwdReg.test(newPassword.value)
|
||||
&& newPassword.value === confirmPassword.value
|
||||
return oldPassword.value.trim()
|
||||
&& pwdReg.test(newPassword.value)
|
||||
&& newPassword.value === confirmPassword.value
|
||||
&& newPassword.value && confirmPassword.value;
|
||||
});
|
||||
|
||||
@@ -109,11 +109,11 @@ const goBack = () => {
|
||||
// 页面显示时读取缓存参数
|
||||
onShow(() => {
|
||||
// 从缓存读取参数
|
||||
const params = uni.getStorageSync('tempChangePwdParams') || {};
|
||||
const params = uni.getStorageSync('tempChangePwdParams') || {};
|
||||
// 赋值
|
||||
phone.value = params.phoneNumber || ''
|
||||
smsCode.value = params.verifyCode || ''
|
||||
|
||||
|
||||
// 校验参数是否完整
|
||||
// if (!phone.value || !smsCode.value) {
|
||||
// uni.showToast({
|
||||
@@ -124,7 +124,7 @@ onShow(() => {
|
||||
// goBack()
|
||||
// }, 1500)
|
||||
// }
|
||||
|
||||
|
||||
// 用完删除缓存(避免下次跳转读取旧值)
|
||||
uni.removeStorageSync('tempChangePwdParams');
|
||||
});
|
||||
@@ -266,7 +266,7 @@ const handleConfirm = () => {
|
||||
background-color: #4D5DFA;
|
||||
color: #fff;
|
||||
border-radius: 44rpx;
|
||||
font-size: 32rpx;
|
||||
font-size: 28rpx;
|
||||
margin-top: 20rpx;
|
||||
border: none;
|
||||
}
|
||||
@@ -282,4 +282,4 @@ button:after {
|
||||
border: none;
|
||||
border-radius: 44rpx;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
<uni-easyinput class="input-content verify-input" type="number" v-model="verifyCode" trim="all"
|
||||
placeholder="请输入验证码" :inputBorder="false" maxlength="6" :placeholderStyle="placeholderStyle">
|
||||
</uni-easyinput>
|
||||
<button
|
||||
class="get-verify-btn"
|
||||
<button
|
||||
class="get-verify-btn"
|
||||
:disabled="!canGetVerify || countDown > 0"
|
||||
@click="getVerifyCode"
|
||||
>
|
||||
@@ -32,18 +32,18 @@
|
||||
</button>
|
||||
</view>
|
||||
<!-- 确定 -->
|
||||
<button
|
||||
class="forget-btn"
|
||||
<button
|
||||
class="forget-btn"
|
||||
:disabled="!canRegister"
|
||||
@click="handleConfirm"
|
||||
>
|
||||
确定
|
||||
</button>
|
||||
|
||||
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref, computed, onUnmounted } from 'vue';
|
||||
import { ref, computed, onUnmounted } from 'vue';
|
||||
import {getSendCode} from '../api/api.js'
|
||||
|
||||
// ====响应式数据======
|
||||
@@ -73,7 +73,7 @@ const getVerifyCode = () => {
|
||||
uni.showToast({
|
||||
title: '验证码已发送',
|
||||
icon: 'success'
|
||||
});
|
||||
});
|
||||
// 开始60秒倒计时
|
||||
countDown.value = 60;
|
||||
timer = setInterval(() => {
|
||||
@@ -82,25 +82,25 @@ const getVerifyCode = () => {
|
||||
clearInterval(timer);
|
||||
timer = null;
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
}, 1000);
|
||||
|
||||
}else{
|
||||
uni.showToast({
|
||||
title: '验证码发送失败',
|
||||
icon: 'error'
|
||||
});
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
};
|
||||
// 是否确认
|
||||
const canRegister = computed(() => {
|
||||
const phoneReg = /^1[3-9]\d{9}$/; // 手机号11位
|
||||
const verifyReg = /^\d{6}$/; // 验证码6位
|
||||
|
||||
return phoneReg.test(phoneNumber.value)
|
||||
&& verifyReg.test(verifyCode.value)
|
||||
return phoneReg.test(phoneNumber.value)
|
||||
&& verifyReg.test(verifyCode.value)
|
||||
});
|
||||
// 确认
|
||||
const handleConfirm = () =>{
|
||||
@@ -118,7 +118,7 @@ const handleConfirm = () =>{
|
||||
const goBack = () => {
|
||||
uni.navigateBack();
|
||||
};
|
||||
|
||||
|
||||
</script>
|
||||
<style scoped>
|
||||
.forget-page{
|
||||
@@ -126,7 +126,7 @@ const goBack = () => {
|
||||
min-height: 100vh;
|
||||
background-color: #f9f9f9;
|
||||
/* background: repeating-linear-gradient(180deg, #E2F0FF, #F6FAFF ); */
|
||||
}
|
||||
}
|
||||
.status_bar{
|
||||
width: 100%;
|
||||
height: 46px;
|
||||
@@ -211,7 +211,7 @@ const goBack = () => {
|
||||
background-color: #4D5DFA;
|
||||
color: #fff;
|
||||
border-radius: 8rpx;
|
||||
font-size: 32rpx;
|
||||
font-size: 28rpx;
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
.forget-btn:disabled{
|
||||
@@ -223,5 +223,5 @@ button:after{
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user