import { ref, computed } from 'vue'; const __sfc__ = defineComponent({ __name: 'login', setup(__props) { const __ins = getCurrentInstance()!; const _ctx = __ins.proxy as InstanceType; const _cache = __ins.renderCache; const phone = ref(''); const code = ref(''); const isAgree = ref(false); const showModal = ref(false); const countdown = ref(0); // 定义定时器变量 let timer : number | null = null; const canSend = computed(() => phone.value.length === 11 && countdown.value === 0); const canLogin = computed(() => phone.value.length === 11 && code.value.length === 6 && isAgree.value); const codeText = computed(() => countdown.value > 0 ? `${countdown.value}s 后重试` : '获取验证码'); const goBack = () => uni.navigateBack(); const oneKeyNav = () => uni.navigateTo({ url: '/pages/login/login-one-key' }); const wechatLogin = () => uni.showToast({ title: '微信登录开发中', icon: 'none' }); const sendCode = () => { if (!canSend.value) return; // ✅ 修复核心:先取值到局部常量,再操作 const currentTimer = timer; if (currentTimer !== null) { clearInterval(currentTimer); } timer = null; countdown.value = 60; uni.showToast({ title: '验证码已发送', icon: 'success' }); timer = setInterval(() => { countdown.value--; if (countdown.value <= 0) { // ✅ 同样在闭包内先取局部常量 const t = timer; if (t !== null) { clearInterval(t); } timer = null; countdown.value = 0; } }, 1000); }; const onAgreeChange = (e : any) => { // UTS 中 any 类型必须 as 成具体类型再访问属性 const evt = e as UTSJSONObject; if (evt != null) { const detail = evt["detail"] as UTSJSONObject | null; if (detail != null) { const value = detail["value"] as Boolean | null; isAgree.value = (value != null) && value; return; } } isAgree.value = false; }; const doLogin = () => { if (!canLogin.value) { uni.showToast({ title: isAgree.value ? '请填写完整信息' : '请先同意协议', icon: 'none' }); return; } uni.showLoading({ title: '登录中...' }); setTimeout(() => { uni.hideLoading(); uni.showToast({ title: '登录成功', icon: 'success' }); }, 1500); }; const rejectAgreement = () => { showModal.value = false; uni.showToast({ title: '您拒绝了协议', icon: 'none' }); }; const agreeAgreement = () => { showModal.value = false; isAgree.value = true; uni.showToast({ title: '已同意协议', icon: 'success' }); }; return (): any | null => { const _component_uni_icons = resolveComponent("uni-icons") const _component_checkbox = resolveComponent("checkbox") return _cE("view", _uM({ class: "page-container" }), [ _cE("view", _uM({ class: "close-btn", onClick: goBack }), [ _cV(_component_uni_icons, _uM({ type: "closeempty", size: "24", color: "#333" })) ]), _cE("view", _uM({ class: "header-section" }), [ _cE("text", _uM({ class: "hello-text" }), " Hello! "), _cE("text", _uM({ class: "welcome-text" }), " 欢迎来到小丁到家 "), _cE("image", _uM({ src: "/static/logo-massage.png", class: "logo-img", mode: "aspectFit" })) ]), _cE("view", _uM({ class: "form-section" }), [ _cE("view", _uM({ class: "input-box" }), [ _cE("input", _uM({ class: "input-field", type: "number", placeholder: "请输入手机号码", modelValue: phone.value, onInput: ($event: UniInputEvent) => {(phone).value = $event.detail.value}, maxlength: "11" }), null, 40 /* PROPS, NEED_HYDRATION */, ["modelValue", "onInput"]) ]), _cE("view", _uM({ class: "input-box row-between" }), [ _cE("input", _uM({ class: "input-field", type: "number", placeholder: "请输入验证码", modelValue: code.value, onInput: ($event: UniInputEvent) => {(code).value = $event.detail.value}, maxlength: "6" }), null, 40 /* PROPS, NEED_HYDRATION */, ["modelValue", "onInput"]), _cE("text", _uM({ class: _nC(["code-btn", _uM({ disabled: !canSend.value })]), onClick: sendCode }), _tD(codeText.value), 3 /* TEXT, CLASS */) ]), _cE("view", _uM({ class: _nC(["login-btn", _uM({ disabled: !canLogin.value })]), onClick: doLogin }), " 登录 ", 2 /* CLASS */), _cE("view", _uM({ class: "agree-row row-start" }), [ _cV(_component_checkbox, _uM({ checked: isAgree.value, onChange: onAgreeChange, style: _nS(_uM({"transform":"scale(0.8)"})) }), null, 8 /* PROPS */, ["checked", "style"]), _cE("view", _uM({ class: "agree-content" }), [ _cE("text", _uM({ class: "agree-text" }), [ " 我已阅读并同意 ", _cE("text", _uM({ class: "link-text" }), " 《用户协议》 "), _cE("text", _uM({ class: "link-text" }), " 《隐私政策》 "), _cE("text", _uM({ class: "link-text" }), " 《上门按摩服务行业平台公约》 "), " ,未注册的手机号将自动创建小丁到家账号 " ]) ]) ]) ]), _cE("view", _uM({ class: "footer-section" }), [ _cE("view", _uM({ class: "divider-row row-center" }), [ _cE("view", _uM({ class: "line" })), _cE("text", _uM({ class: "divider-text" }), " 其他登录方式 "), _cE("view", _uM({ class: "line" })) ]), _cE("view", _uM({ class: "methods-row row-center" }), [ _cE("view", _uM({ class: "method-item column-center", onClick: oneKeyNav }), [ _cE("view", _uM({ class: "icon-box blue-bg" }), [ _cV(_component_uni_icons, _uM({ type: "checkmark", size: "20", color: "#fff" })) ]), _cE("text", _uM({ class: "method-name" }), " 一键登录 ") ]), _cE("view", _uM({ class: "method-item column-center", onClick: wechatLogin }), [ _cE("view", _uM({ class: "icon-box green-bg" }), [ _cV(_component_uni_icons, _uM({ type: "weixin", size: "20", color: "#fff" })) ]), _cE("text", _uM({ class: "method-name" }), " 微信登录 ") ]) ]) ]), isTrue(showModal.value) ? _cE("view", _uM({ key: 0, class: "modal-mask", onClick: () => {showModal.value=false} }), [ _cE("view", _uM({ class: "modal-box", onClick: withModifiers(() => {}, ["stop"]) }), [ _cE("text", _uM({ class: "modal-title" }), " 服务协议及隐私政策 "), _cE("scroll-view", _uM({ "scroll-y": "", class: "modal-scroll" }), [ _cE("text", _uM({ class: "modal-welcome" }), " 欢迎您使用小丁到家! "), _cE("text", _uM({ class: "modal-desc" }), [ " 请你务必审慎阅读、并充分理解 ", _cE("text", _uM({ class: "modal-link" }), " 《用户协议》 "), " 和 ", _cE("text", _uM({ class: "modal-link" }), " 《隐私政策》 "), " ,协议内容包括但不限于: " ]), _cE("text", _uM({ class: "modal-list" }), " 1、在您使用软件及服务的过程中,向您提供相关基本功能,我们将根据合法、正当、必要的原则,收集或使用必要的个人信息; "), _cE("text", _uM({ class: "modal-list" }), " 2、基于您的授权,我们可能会获取您的地理位置、相册、相机等相关软件权限; "), _cE("text", _uM({ class: "modal-list" }), " 3、我们会采取符合标准的技术措施和数据安全措施来保护您的个人信息安全; "), _cE("text", _uM({ class: "modal-list" }), " 4、您可以查询,更正,管理您的个人信息,我们也提供账户注销的渠道; "), _cE("text", _uM({ class: "modal-footer" }), " 如您同意以上协议内容,请点击“同意”开始使用我们的产品和服务,我们依法尽全力保护您的个人信息。 ") ]), _cE("view", _uM({ class: "modal-btns row-between" }), [ _cE("text", _uM({ class: "modal-btn reject", onClick: rejectAgreement }), " 拒绝并退出 "), _cE("text", _uM({ class: "modal-btn agree", onClick: agreeAgreement }), " 同意 ") ]) ], 8 /* PROPS */, ["onClick"]) ], 8 /* PROPS */, ["onClick"]) : _cC("v-if", true) ]) } } }) export default __sfc__ const GenPagesLoginLoginStyles = [_uM([["page-container", _pS(_uM([["backgroundImage", "linear-gradient(180deg, #e0f7fa 0%, #fff8e1 100%)"], ["backgroundColor", "rgba(0,0,0,0)"], ["height", "100%"], ["paddingTop", "40rpx"], ["paddingRight", "30rpx"], ["paddingBottom", "40rpx"], ["paddingLeft", "30rpx"], ["boxSizing", "border-box"]]))], ["close-btn", _pS(_uM([["position", "absolute"], ["top", "40rpx"], ["right", "30rpx"], ["zIndex", 10]]))], ["header-section", _pS(_uM([["alignItems", "center"], ["marginBottom", "60rpx"]]))], ["hello-text", _pS(_uM([["fontSize", "48rpx"], ["fontWeight", "bold"], ["color", "#333333"], ["marginBottom", "10rpx"]]))], ["welcome-text", _pS(_uM([["fontSize", "32rpx"], ["color", "#666666"], ["marginBottom", "30rpx"]]))], ["logo-img", _pS(_uM([["width", "300rpx"], ["height", "300rpx"], ["borderTopLeftRadius", "150rpx"], ["borderTopRightRadius", "150rpx"], ["borderBottomRightRadius", "150rpx"], ["borderBottomLeftRadius", "150rpx"], ["backgroundColor", "rgba(255,255,255,0.3)"]]))], ["form-section", _pS(_uM([["marginBottom", "60rpx"]]))], ["input-box", _pS(_uM([["backgroundColor", "#ffffff"], ["borderTopLeftRadius", "30rpx"], ["borderTopRightRadius", "30rpx"], ["borderBottomRightRadius", "30rpx"], ["borderBottomLeftRadius", "30rpx"], ["paddingTop", "20rpx"], ["paddingRight", "30rpx"], ["paddingBottom", "20rpx"], ["paddingLeft", "30rpx"], ["marginBottom", "30rpx"], ["boxShadow", "0 2rpx 8rpx rgba(0, 0, 0, 0.05)"]]))], ["input-field", _pS(_uM([["flexGrow", 1], ["flexShrink", 1], ["flexBasis", "0%"], ["fontSize", "28rpx"], ["color", "#333333"]]))], ["code-btn", _uM([["", _uM([["fontSize", "26rpx"], ["color", "#ffc107"], ["fontWeight", "bold"], ["whiteSpace", "nowrap"]])], [".disabled", _uM([["color", "#cccccc"]])]])], ["login-btn", _uM([["", _uM([["backgroundImage", "linear-gradient(90deg, #ffc107, #ffca2c)"], ["backgroundColor", "rgba(0,0,0,0)"], ["color", "#ffffff"], ["fontSize", "32rpx"], ["fontWeight", "bold"], ["textAlign", "center"], ["paddingTop", "24rpx"], ["paddingRight", 0], ["paddingBottom", "24rpx"], ["paddingLeft", 0], ["borderTopLeftRadius", "30rpx"], ["borderTopRightRadius", "30rpx"], ["borderBottomRightRadius", "30rpx"], ["borderBottomLeftRadius", "30rpx"], ["marginBottom", "30rpx"], ["boxShadow", "0 4rpx 12rpx rgba(255, 193, 7, 0.3)"]])], [".disabled", _uM([["backgroundImage", "none"], ["backgroundColor", "#dddddd"], ["color", "#999999"], ["boxShadow", "none"]])]])], ["agree-row", _pS(_uM([["alignItems", "flex-start"]]))], ["agree-content", _pS(_uM([["flexGrow", 1], ["flexShrink", 1], ["flexBasis", "0%"], ["marginLeft", "10rpx"]]))], ["agree-text", _pS(_uM([["fontSize", "24rpx"], ["color", "#999999"], ["lineHeight", 1.6]]))], ["link-text", _pS(_uM([["color", "#00b894"], ["borderBottomWidth", "1rpx"], ["borderBottomStyle", "solid"], ["borderBottomColor", "#00b894"]]))], ["footer-section", _pS(_uM([["marginTop", "auto"]]))], ["divider-row", _pS(_uM([["marginBottom", "40rpx"], ["alignItems", "center"]]))], ["line", _pS(_uM([["flexGrow", 1], ["flexShrink", 1], ["flexBasis", "0%"], ["height", "1rpx"], ["backgroundColor", "#dddddd"]]))], ["divider-text", _pS(_uM([["fontSize", "26rpx"], ["color", "#999999"], ["marginTop", 0], ["marginRight", "20rpx"], ["marginBottom", 0], ["marginLeft", "20rpx"]]))], ["methods-row", _pS(_uM([["justifyContent", "center"], ["marginBottom", "40rpx"]]))], ["method-item", _pS(_uM([["marginRight", "60rpx"], ["alignItems", "center"], ["marginRight:last-child", 0]]))], ["icon-box", _pS(_uM([["width", "80rpx"], ["height", "80rpx"], ["borderTopLeftRadius", "40rpx"], ["borderTopRightRadius", "40rpx"], ["borderBottomRightRadius", "40rpx"], ["borderBottomLeftRadius", "40rpx"], ["justifyContent", "center"], ["alignItems", "center"], ["marginBottom", "15rpx"]]))], ["blue-bg", _pS(_uM([["backgroundImage", "linear-gradient(135deg, #4a90e2, #67b26f)"], ["backgroundColor", "rgba(0,0,0,0)"]]))], ["green-bg", _pS(_uM([["backgroundImage", "linear-gradient(135deg, #00b894, #00cec9)"], ["backgroundColor", "rgba(0,0,0,0)"]]))], ["method-name", _pS(_uM([["fontSize", "26rpx"], ["color", "#666666"]]))], ["modal-mask", _pS(_uM([["position", "fixed"], ["top", 0], ["left", 0], ["right", 0], ["bottom", 0], ["backgroundColor", "rgba(0,0,0,0.5)"], ["justifyContent", "center"], ["alignItems", "center"], ["zIndex", 100]]))], ["modal-box", _pS(_uM([["backgroundColor", "#ffffff"], ["borderTopLeftRadius", "20rpx"], ["borderTopRightRadius", "20rpx"], ["borderBottomRightRadius", "20rpx"], ["borderBottomLeftRadius", "20rpx"], ["paddingTop", "40rpx"], ["paddingRight", "30rpx"], ["paddingBottom", "40rpx"], ["paddingLeft", "30rpx"], ["width", "600rpx"], ["maxHeight", "800rpx"], ["flexDirection", "column"]]))], ["modal-title", _pS(_uM([["fontSize", "36rpx"], ["fontWeight", "bold"], ["color", "#333333"], ["textAlign", "center"], ["marginBottom", "20rpx"]]))], ["modal-scroll", _pS(_uM([["flexGrow", 1], ["flexShrink", 1], ["flexBasis", "0%"], ["marginBottom", "20rpx"]]))], ["modal-welcome", _pS(_uM([["fontSize", "28rpx"], ["color", "#333333"], ["marginBottom", "15rpx"]]))], ["modal-desc", _pS(_uM([["fontSize", "26rpx"], ["color", "#666666"], ["lineHeight", 1.6], ["marginBottom", "15rpx"]]))], ["modal-link", _pS(_uM([["color", "#00b894"], ["borderBottomWidth", "1rpx"], ["borderBottomStyle", "solid"], ["borderBottomColor", "#00b894"]]))], ["modal-list", _pS(_uM([["fontSize", "26rpx"], ["color", "#666666"], ["lineHeight", 1.6], ["marginBottom", "10rpx"]]))], ["modal-footer", _pS(_uM([["fontSize", "26rpx"], ["color", "#666666"], ["lineHeight", 1.6], ["marginBottom", "10rpx"]]))], ["modal-btns", _pS(_uM([["borderTopWidth", "1rpx"], ["borderTopStyle", "solid"], ["borderTopColor", "#eeeeee"], ["paddingTop", "20rpx"]]))], ["modal-btn", _uM([["", _uM([["flexGrow", 1], ["flexShrink", 1], ["flexBasis", "0%"], ["textAlign", "center"], ["fontSize", "28rpx"], ["fontWeight", "bold"], ["paddingTop", "15rpx"], ["paddingRight", 0], ["paddingBottom", "15rpx"], ["paddingLeft", 0]])], [".reject", _uM([["color", "#999999"], ["marginRight", "20rpx"]])], [".agree", _uM([["color", "#00b894"]])]])], ["row-between", _pS(_uM([["flexDirection", "row"], ["justifyContent", "space-between"], ["alignItems", "center"]]))], ["row-start", _pS(_uM([["flexDirection", "row"], ["alignItems", "flex-start"]]))], ["row-center", _pS(_uM([["flexDirection", "row"], ["justifyContent", "center"], ["alignItems", "center"]]))], ["column-center", _pS(_uM([["flexDirection", "column"], ["justifyContent", "center"], ["alignItems", "center"]]))]])]