export default { data() { return { currentTab: 0, // 0: 免密, 1: 密码 mobile: '', code: '', password: '', showPassword: false, isAgreed: false, countDown: 0, timer: null, showAgreementModal: false, agreementTitle: '', agreementContent: '' } }, methods: { showAgreement(type) { this.agreementTitle = type === 1 ? '用户服务协议' : '隐私政策'; if (type === 1) { this.agreementContent = '1. 服务条款\n欢迎使用宠宝平台。您在使用本服务时需遵守以下条款...\n\n2. 用户责任\n用户需对自己的行为负责...\n\n3. 账号管理\n请妥善保管您的账号密码...'; } else { this.agreementContent = '1. 信息收集\n为了提供服务,我们需要收集您的手机号、地理位置、设备信息等必要数据。\n\n2. 信息使用\n您的位置信息将用于订单匹配和路径规划;您的联系方式将用于接单通知和客户沟通。\n\n3. 信息保护\n我们将采取严格的安全措施保护您的个人信息,未经授权不会向第三方披露。'; } this.showAgreementModal = true; }, getVerifyCode() { if (this.currentTab === 1) return; // 密码登录不需要验证码 if (this.countDown > 0) return; if (!this.mobile || this.mobile.length !== 11) { uni.showToast({ title: '请输入正确的手机号', icon: 'none' }); return; } this.countDown = 60; this.timer = setInterval(() => { this.countDown--; if (this.countDown <= 0) { clearInterval(this.timer); } }, 1000); uni.showToast({ title: '验证码已发送', icon: 'none' }); }, handleLogin() { if (!this.isAgreed) { uni.showToast({ title: '请先同意用户协议', icon: 'none' }); return; } if (!this.mobile) { uni.showToast({ title: '请输入手机号', icon: 'none' }); return; } if (this.currentTab === 0) { // 免密登录 if (!this.code) { uni.showToast({ title: '请输入验证码', icon: 'none' }); return; } } else { // 密码登录 if (!this.password) { uni.showToast({ title: '请输入密码', icon: 'none' }); return; } } uni.showToast({ title: '登录成功', icon: 'success' }); setTimeout(() => { uni.switchTab({ url: '/pages/home/index' }); }, 1000); }, goToRecruit() { uni.navigateTo({ url: '/pages/recruit/landing' }); }, goToForgotPwd() { uni.navigateTo({ url: '/pages/login/reset-pwd-verify' }); } } }