login.vue 22 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864
<template>
	<view class="lp-page">

		<!-- 顶部装饰圆 -->
		<view class="lp-deco lp-deco--1"></view>
		<view class="lp-deco lp-deco--2"></view>
		<view class="lp-deco lp-deco--3"></view>

		<!-- 主卡片 -->
		<view class="lp-card">

			<!-- Logo + 品牌名 -->
			<view class="lp-brand">
				<view class="lp-logo-wrap">
					<image src="../../static/login/logo.jpg" class="lp-logo" mode="widthFix"></image>
				</view>
				<text class="lp-brand-name">绿纤协同平台</text>
				<text class="lp-brand-sub">专业美业管理系统</text>
			</view>

			<!-- 表单 -->
			<view class="lp-form">

				<!-- 用户名 -->
				<view class="lp-field" :class="{ 'is-focus': focusUser }">
					<view class="lp-field-icon">
						<u-icon name="account" size="18" color="#43a047"></u-icon>
					</view>
					<input
						class="lp-input"
						type="text"
						v-model="formData.username"
						placeholder="请输入用户名"
						placeholder-class="lp-placeholder"
						@focus="focusUser = true"
						@blur="focusUser = false"
					/>
				</view>

				<!-- 密码 -->
				<view class="lp-field" :class="{ 'is-focus': focusPwd }">
					<view class="lp-field-icon">
						<u-icon name="lock" size="18" color="#43a047"></u-icon>
					</view>
					<input
						class="lp-input"
						type="text"
						:password="!showPassword"
						v-model="formData.password"
						placeholder="请输入密码"
						placeholder-class="lp-placeholder"
						@focus="focusPwd = true"
						@blur="focusPwd = false"
					/>
					<view class="lp-field-suffix" @tap="togglePassword">
						<u-icon :name="showPassword ? 'eye-off' : 'eye'" size="19" color="#43a047"></u-icon>
					</view>
				</view>

			</view>

			<!-- 账号密码登录按钮 -->
			<view
				class="lp-btn lp-btn--primary"
				:class="{ 'is-loading': loading }"
				@tap="handleLogin"
			>
				<text>{{ loading ? '登录中...' : '登 录' }}</text>
			</view>

			<!-- 分隔线(仅微信小程序显示) -->
			<!-- #ifdef MP-WEIXIN -->
			<view class="lp-divider">
				<view class="lp-divider-line"></view>
				<text class="lp-divider-text">其他登录方式</text>
				<view class="lp-divider-line"></view>
			</view>

			<!-- 微信登录按钮 -->
			<view
				class="lp-btn lp-btn--wechat"
				:class="{ 'is-loading': wechatLoading }"
				@tap="handleWechatLogin"
			>
				<!-- 微信官方 SVG 图标 -->
				<view class="lp-wechat-ico">
					<svg width="22" height="22" viewBox="0 0 24 24" fill="#ffffff">
						<path d="M8.691 2.188C3.891 2.188 0 5.476 0 9.53c0 2.212 1.17 4.203 3.002 5.55a.59.59 0 0 1 .213.665l-.39 1.48c-.019.07-.048.141-.048.213 0 .163.13.295.29.295a.326.326 0 0 0 .167-.054l1.903-1.114a.864.864 0 0 1 .717-.098 10.16 10.16 0 0 0 2.837.403c.276 0 .543-.027.811-.05-.857-2.578.157-4.972 1.932-6.446 1.703-1.415 3.882-1.98 5.853-1.838-.576-3.583-3.898-6.348-7.596-6.348zM5.785 5.991c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 0 1-1.162 1.178A1.17 1.17 0 0 1 4.623 7.17c0-.651.52-1.18 1.162-1.18zm5.813 0c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 0 1-1.162 1.178 1.17 1.17 0 0 1-1.162-1.178c0-.651.52-1.18 1.162-1.18zm5.34 2.867c-1.797-.052-3.746.512-5.28 1.786-1.72 1.428-2.687 3.72-1.78 6.22.942 2.453 3.666 4.229 6.884 4.229.826 0 1.622-.12 2.361-.336a.722.722 0 0 1 .598.082l1.584.926a.272.272 0 0 0 .14.047c.134 0 .24-.111.24-.247 0-.06-.023-.12-.038-.177l-.327-1.233a.582.582 0 0 1-.023-.156.49.49 0 0 1 .201-.398C23.024 18.48 24 16.82 24 14.98c0-3.21-2.931-5.837-7.062-6.122zm-3.453 3.31c.535 0 .969.44.969.982a.976.976 0 0 1-.969.983.976.976 0 0 1-.969-.983c0-.542.434-.982.97-.982zm4.844 0c.535 0 .969.44.969.982a.976.976 0 0 1-.969.983.976.976 0 0 1-.969-.983c0-.542.434-.982.969-.982z"/>
					</svg>
				</view>
				<text>{{ wechatLoading ? '微信登录中...' : '微信一键登录' }}</text>
			</view>
			<!-- #endif -->

		</view>

		<!-- 隐私政策 -->
		<view class="lp-privacy">
			<u-checkbox-group :value="privacyValue" shape="circle" @input="onPrivacyValueInput" @change="onPrivacyValueInput">
				<u-checkbox active-color="#43a047" name="tongyi" :label-disabled="true"></u-checkbox>
			</u-checkbox-group>
			<text class="lp-privacy-txt">我已阅读并同意</text>
			<text class="lp-privacy-link" @tap.stop="goyinsi">《隐私政策》</text>
		</view>

		<!-- 未勾选隐私时:页面内弹层(不依赖 uni.showModal,避免小程序端不弹出) -->
		<view v-if="showPrivacyGateDialog" class="lp-privacy-mask" @tap="onPrivacyGateCancel">
			<view class="lp-privacy-dialog" @tap.stop>
				<text class="lp-privacy-dialog-title">隐私政策</text>
				<text class="lp-privacy-dialog-content">登录需阅读并同意《隐私政策》,是否同意并继续?</text>
				<view class="lp-privacy-dialog-actions">
					<view class="lp-privacy-dialog-btn lp-privacy-dialog-btn--cancel" @tap="onPrivacyGateCancel">取消</view>
					<view class="lp-privacy-dialog-btn lp-privacy-dialog-btn--ok" @tap="onPrivacyGateConfirm">同意并继续</view>
				</view>
			</view>
		</view>

		<!-- 初始密码强制修改弹层:检测到使用 123456 登录,必须修改后才能进入(不可取消/关闭) -->
		<view v-if="showForcePwdDialog" class="lp-force-mask">
			<view class="lp-force-dialog" @tap.stop>
				<text class="lp-force-title">请修改登录密码</text>
				<text class="lp-force-tip">检测到当前为初始密码或纯数字密码,为保障账号安全需修改。新密码需为 6-20 位,且同时包含英文字母和数字。</text>
				<view class="lp-force-field">
					<input
						class="lp-force-input"
						:password="!forceShowPwd"
						type="text"
						v-model="forcePwd"
						placeholder="请输入新密码"
						placeholder-class="lp-placeholder"
						maxlength="20"
					/>
					<view class="lp-force-eye" @tap="toggleForcePwd">
						<u-icon :name="forceShowPwd ? 'eye-off' : 'eye'" size="19" color="#43a047"></u-icon>
					</view>
				</view>
				<view class="lp-force-field">
					<input
						class="lp-force-input"
						:password="!forceShowPwd"
						type="text"
						v-model="forcePwd2"
						placeholder="请再次输入新密码"
						placeholder-class="lp-placeholder"
						maxlength="20"
					/>
				</view>
				<view
					class="lp-btn lp-btn--primary lp-force-submit"
					:class="{ 'is-loading': forceSubmitting }"
					@tap="submitForcePassword"
				>
					<text>{{ forceSubmitting ? '提交中...' : '确认修改' }}</text>
				</view>
			</view>
		</view>

	</view>
</template>

<script>
import md5 from '@/service/md5.js'
import auth from '@/common/auth.js'
import { loadItemCategoryMap } from '@/utils/item-category.js'
import { loadWatermarkSwitch } from '@/utils/watermark.js'
import { loadPrivacyMobileMask } from '@/utils/mobile-mask.js'
import { loadCommissionTierHelpSwitch } from '@/utils/commission-tier-help-switch.js'
import oauthApi from '@/apis/modules/oauth.js'
export default {
	data() {
		return {
			/** 选中的 name 列表,与 u-checkbox-group 同步 */
			privacyValue: [],
			/** 是否已同意隐私(登录校验只看此字段,避免组件 v-model 与真实勾选不一致) */
			privacyAgreed: false,
			showPrivacyGateDialog: false,
			/** 弹窗关闭后要执行的登录:account | wechat */
			pendingLogin: null,
			loading: false,
			wechatLoading: false,
			showPassword: false,
			focusUser: false,
			focusPwd: false,
			formData: {
				username: '',
				password: ''
			},
			/** 初始密码强制修改弹层 */
			showForcePwdDialog: false,
			forcePwd: '',
			forcePwd2: '',
			forceShowPwd: false,
			forceSubmitting: false,
			forcePwdUserId: '',
			/** 已登录自动进首页,避免重复 reLaunch */
			autoEntering: false
		}
	},
	onLoad() {
		this.tryAutoEnterHome()
	},
	onShow() {
		this.tryAutoEnterHome()
	},
	methods: {
		tryAutoEnterHome() {
			if (this.autoEntering) return
			if (!auth.getToken()) return
			this.autoEntering = true
			uni.reLaunch({
				url: '/pages/home/home',
				complete: () => {
					this.autoEntering = false
				}
			})
		},
		clearRememberedCredentials() {
			uni.removeStorageSync('rememberPassword')
			uni.removeStorageSync('rememberedUsername')
			uni.removeStorageSync('rememberedPassword')
		},
		goyinsi() {
			// 走小程序原生页,避免 web-view 业务域名未配置导致点击“无效”
			uni.navigateTo({
				url: '/pages/privacy-policy/privacy-policy',
				fail: (err) => {
					console.error('打开隐私政策失败', err)
					uni.showToast({
						title: '暂时无法打开隐私政策',
						icon: 'none'
					})
				}
			})
		},
		onPrivacyValueInput(val) {
			const arr = Array.isArray(val) ? val : []
			this.privacyValue = arr
			this.privacyAgreed = arr.indexOf('tongyi') !== -1
		},
		onPrivacyGateConfirm() {
			this.privacyAgreed = true
			this.privacyValue = ['tongyi']
			this.showPrivacyGateDialog = false
			const kind = this.pendingLogin
			this.pendingLogin = null
			this.$nextTick(() => {
				if (kind === 'account') this.runAccountLogin()
				else if (kind === 'wechat') this.runWechatLogin()
			})
		},
		onPrivacyGateCancel() {
			this.showPrivacyGateDialog = false
			this.pendingLogin = null
		},
		togglePassword() {
			this.showPassword = !this.showPassword
		},
		validateCredentials() {
			if (!this.formData.username.trim()) {
				uni.showToast({ title: '请输入用户名', icon: 'none' })
				return false
			}
			if (!this.formData.password.trim()) {
				uni.showToast({ title: '请输入密码', icon: 'none' })
				return false
			}
			return true
		},
		async getuser() {
			const res = await this.API.getCurrentUser()
			if (res && res.code === 200) {
				uni.setStorageSync('userInfo', res.data.userInfo)
				return res.data.userInfo
			}
			return null
		},
		handleLogin() {
			if (this.loading) return
			if (!this.privacyAgreed) {
				this.pendingLogin = 'account'
				this.showPrivacyGateDialog = true
				return
			}
			this.runAccountLogin()
		},
		async runAccountLogin() {
			if (this.loading) return
			if (!this.privacyAgreed) return
			if (!this.validateCredentials()) return
			this.loading = true
			try {
				const password = md5.hex_md5(this.formData.password)
				const res = await this.API.AppLogin({
					account: this.formData.username,
					password: password
				})
				if (res.code === 200 || res.success) {
					const { token } = res.data
					auth.setToken(token)
					loadItemCategoryMap()
					loadWatermarkSwitch(true)
					loadPrivacyMobileMask(true)
					loadCommissionTierHelpSwitch(true)
					this.clearRememberedCredentials()
					const userInfo = await this.getuser()
					await this.tryBindWechat()
					uni.$emit && uni.$emit('watermark-user-change')
					// 检测到使用初始密码 123456 登录,强制修改密码后才能进入
					if (this.isInitialPassword(this.formData.password)) {
						this.forcePwdUserId = (userInfo && userInfo.userId) || (uni.getStorageSync('userInfo') || {}).userId || ''
						this.forcePwd = ''
						this.forcePwd2 = ''
						this.forceShowPwd = false
						this.showForcePwdDialog = true
						return
					}
					uni.showToast({ title: '登录成功', icon: 'success' })
					setTimeout(() => {
						uni.reLaunch({ url: '/pages/home/home' })
					}, 1500)
				} else {
					uni.showToast({ title: res.msg || '登录失败,请重试', icon: 'none' })
				}
			} catch (error) {
				uni.showToast({ title: '网络错误,请稍后重试', icon: 'none' })
			} finally {
				this.loading = false
			}
		},
		handleWechatLogin() {
			if (this.wechatLoading) return
			if (!this.privacyAgreed) {
				this.pendingLogin = 'wechat'
				this.showPrivacyGateDialog = true
				return
			}
			this.runWechatLogin()
		},
		async runWechatLogin() {
			if (this.wechatLoading) return
			if (!this.privacyAgreed) return
			this.wechatLoading = true
			try {
				const code = await this.getWechatCode()
				const res = await this.API.WechatLogin({ code })
				if (res.code === 200 || res.success) {
					const { token } = res.data
					auth.setToken(token)
					loadItemCategoryMap()
					loadWatermarkSwitch(true)
					loadPrivacyMobileMask(true)
					loadCommissionTierHelpSwitch(true)
					await this.getuser()
					uni.$emit && uni.$emit('watermark-user-change')
					uni.showToast({ title: '登录成功', icon: 'success' })
					setTimeout(() => {
						uni.reLaunch({ url: '/pages/home/home' })
					}, 1500)
				} else {
					uni.showToast({ title: res.msg || '微信登录失败,请先使用账号密码登录', icon: 'none' })
				}
			} catch (error) {
				uni.showToast({ title: '微信登录失败,请稍后重试', icon: 'none' })
			} finally {
				this.wechatLoading = false
			}
		},
		getWechatCode() {
			return new Promise((resolve, reject) => {
				// #ifdef MP-WEIXIN
				uni.login({
					provider: 'weixin',
					success: (res) => {
						if (res.code) {
							resolve(res.code)
							return
						}
						reject(new Error('未获取到微信授权码'))
					},
					fail: (error) => {
						reject(error)
					}
				})
				// #endif
				// #ifndef MP-WEIXIN
				reject(new Error('当前环境不支持微信登录'))
				// #endif
			})
		},
		async tryBindWechat() {
			// #ifdef MP-WEIXIN
			try {
				const code = await this.getWechatCode()
				await this.API.BindWechat({ code })
			} catch (error) {
				console.error('自动绑定微信失败:', error)
			}
			// #endif
		},
		/** 是否需要强制修改密码:初始密码 123456 或纯数字密码 */
		isInitialPassword(pwd) {
			if (!pwd) return false
			return pwd === '123456' || /^\d+$/.test(pwd)
		},
		/** 校验新密码:英文+数字,6-20位;返回错误提示,空字符串表示通过 */
		validateNewPassword(pwd) {
			if (!pwd) return '请输入新密码'
			if (pwd.length < 6 || pwd.length > 20) return '密码长度需为6-20位'
			if (!/^[A-Za-z0-9]+$/.test(pwd)) return '密码只能包含英文字母和数字'
			if (!/[A-Za-z]/.test(pwd) || !/[0-9]/.test(pwd)) return '密码必须同时包含英文字母和数字'
			if (pwd === '123456') return '新密码不能与初始密码相同'
			return ''
		},
		toggleForcePwd() {
			this.forceShowPwd = !this.forceShowPwd
		},
		/** 提交强制修改密码 */
		async submitForcePassword() {
			if (this.forceSubmitting) return
			const err = this.validateNewPassword(this.forcePwd)
			if (err) {
				uni.showToast({ title: err, icon: 'none' })
				return
			}
			if (this.forcePwd !== this.forcePwd2) {
				uni.showToast({ title: '两次输入的密码不一致', icon: 'none' })
				return
			}
			if (!this.forcePwdUserId) {
				uni.showToast({ title: '未获取到用户信息,请重新登录', icon: 'none' })
				return
			}
			this.forceSubmitting = true
			try {
				const enc = md5.hex_md5(this.forcePwd)
				const res = await oauthApi.changePassword(this.forcePwdUserId, {
					userPassword: enc,
					validatePassword: enc
				})
				if (res && (res.code === 200 || res.success)) {
					this.showForcePwdDialog = false
					uni.showToast({ title: '密码修改成功', icon: 'success' })
					setTimeout(() => {
						uni.reLaunch({ url: '/pages/home/home' })
					}, 1200)
				} else {
					uni.showToast({ title: (res && res.msg) || '修改失败,请重试', icon: 'none' })
				}
			} catch (error) {
				uni.showToast({ title: '修改失败,请稍后重试', icon: 'none' })
			} finally {
				this.forceSubmitting = false
			}
		}
	}
}
</script>

<style scoped lang="scss">
/* ── 页面底层 ── */
.lp-page {
	position: relative;
	min-height: 100vh;
	width: 100%;
	background: linear-gradient(160deg, #c8e6c9 0%, #b2dfdb 45%, #a5d6a7 100%);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	padding: 60rpx 0 40rpx;
	box-sizing: border-box;
}

/* 背景装饰圆 */
.lp-deco {
	position: absolute;
	border-radius: 50%;
	pointer-events: none;
}
.lp-deco--1 {
	width: 500rpx;
	height: 500rpx;
	background: radial-gradient(circle, rgba(67, 160, 71, 0.18) 0%, transparent 70%);
	top: -120rpx;
	right: -100rpx;
}
.lp-deco--2 {
	width: 360rpx;
	height: 360rpx;
	background: radial-gradient(circle, rgba(255, 255, 255, 0.22) 0%, transparent 70%);
	bottom: 100rpx;
	left: -80rpx;
}
.lp-deco--3 {
	width: 200rpx;
	height: 200rpx;
	background: radial-gradient(circle, rgba(102, 187, 106, 0.15) 0%, transparent 70%);
	top: 40%;
	right: 20rpx;
}

/* ── 主卡片 ── */
.lp-card {
	position: relative;
	z-index: 2;
	width: 86%;
	background: rgba(255, 255, 255, 0.82);
	backdrop-filter: blur(24px) saturate(180%);
	-webkit-backdrop-filter: blur(24px) saturate(180%);
	border-radius: 32rpx;
	box-shadow:
		0 20rpx 60rpx rgba(0, 0, 0, 0.1),
		0 4rpx 16rpx rgba(0, 0, 0, 0.06),
		inset 0 1rpx 0 rgba(255, 255, 255, 0.9);
	padding: 48rpx 40rpx 44rpx;
	box-sizing: border-box;
}

/* ── 品牌区 ── */
.lp-brand {
	display: flex;
	flex-direction: column;
	align-items: center;
	margin-bottom: 44rpx;
}

.lp-logo-wrap {
	width: 120rpx;
	height: 120rpx;
	border-radius: 28rpx;
	overflow: hidden;
	box-shadow:
		0 8rpx 24rpx rgba(67, 160, 71, 0.25),
		0 2rpx 8rpx rgba(0, 0, 0, 0.08);
	margin-bottom: 20rpx;
}

.lp-logo {
	width: 100%;
}

.lp-brand-name {
	font-size: 36rpx;
	font-weight: 800;
	color: #1b5e20;
	letter-spacing: 3rpx;
	margin-bottom: 6rpx;
}

.lp-brand-sub {
	font-size: 22rpx;
	color: #66bb6a;
	letter-spacing: 1rpx;
}

/* ── 表单 ── */
.lp-form {
	margin-bottom: 36rpx;
}

.lp-field {
	display: flex;
	align-items: center;
	height: 96rpx;
	background: rgba(232, 245, 233, 0.5);
	border-radius: 20rpx;
	border: 2rpx solid rgba(67, 160, 71, 0.15);
	padding: 0 24rpx;
	margin-bottom: 20rpx;
	transition: border-color 0.2s ease, background 0.2s ease;
	box-sizing: border-box;

	&.is-focus {
		border-color: #43a047;
		background: rgba(255, 255, 255, 0.9);
		box-shadow: 0 0 0 6rpx rgba(67, 160, 71, 0.08);
	}
}

.lp-field-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 36rpx;
	height: 36rpx;
	margin-right: 16rpx;
	color: #43a047;
}

.lp-input {
	flex: 1;
	min-width: 0;
	height: 100%;
	font-size: 28rpx;
	color: #1f2937;
	background: transparent;
	border: none;
	outline: none;
	-webkit-appearance: none;
	appearance: none;

	&:focus {
		border: none;
		outline: none;
		box-shadow: none;
	}
}

.lp-placeholder {
	color: #9ca3af;
	font-size: 28rpx;
}

.lp-field-suffix {
	flex-shrink: 0;
	padding: 10rpx 0 10rpx 16rpx;
	display: flex;
	align-items: center;
}

/* ── 按钮 ── */
.lp-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 92rpx;
	border-radius: 20rpx;
	font-size: 30rpx;
	font-weight: 600;
	letter-spacing: 2rpx;
	transition: opacity 0.15s ease;
	box-sizing: border-box;

	&:active {
		opacity: 0.75;
	}

	&.is-loading {
		opacity: 0.6;
		pointer-events: none;
	}
}

.lp-btn--primary {
	background: linear-gradient(135deg, #43a047 0%, #66bb6a 100%);
	color: #ffffff;
	box-shadow:
		0 8rpx 24rpx rgba(67, 160, 71, 0.38),
		0 2rpx 8rpx rgba(67, 160, 71, 0.2);
}

/* ── 分隔线 ── */
.lp-divider {
	display: flex;
	align-items: center;
	margin: 32rpx 0 28rpx;
	gap: 16rpx;
}

.lp-divider-line {
	flex: 1;
	height: 1rpx;
	background: rgba(0, 0, 0, 0.08);
}

.lp-divider-text {
	font-size: 22rpx;
	color: #9ca3af;
	flex-shrink: 0;
	white-space: nowrap;
}

/* ── 微信登录按钮 ── */
.lp-btn--wechat {
	background: #07c160;
	color: #ffffff;
	gap: 14rpx;
	box-shadow:
		0 8rpx 24rpx rgba(7, 193, 96, 0.32),
		0 2rpx 8rpx rgba(7, 193, 96, 0.18);
}

.lp-wechat-ico {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

/* ── 隐私政策 ── */
.lp-privacy {
	position: relative;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	margin-top: 36rpx;
	gap: 6rpx;
}

.lp-privacy-txt {
	font-size: 22rpx;
	color: rgba(255, 255, 255, 0.85);
}

.lp-privacy-link {
	font-size: 22rpx;
	color: #1b5e20;
	font-weight: 600;
	text-decoration: underline;
}

/* 隐私快捷同意:页面内弹层 */
.lp-privacy-mask {
	position: fixed;
	left: 0;
	right: 0;
	top: 0;
	bottom: 0;
	z-index: 10050;
	background: rgba(0, 0, 0, 0.45);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 48rpx;
	box-sizing: border-box;
}

.lp-privacy-dialog {
	width: 100%;
	max-width: 600rpx;
	background: #ffffff;
	border-radius: 24rpx;
	padding: 40rpx 36rpx 32rpx;
	box-sizing: border-box;
	box-shadow: 0 24rpx 80rpx rgba(0, 0, 0, 0.18);
}

.lp-privacy-dialog-title {
	display: block;
	font-size: 32rpx;
	font-weight: 700;
	color: #1b5e20;
	text-align: center;
	margin-bottom: 24rpx;
}

.lp-privacy-dialog-content {
	display: block;
	font-size: 28rpx;
	color: #4b5563;
	line-height: 1.55;
	text-align: center;
	margin-bottom: 36rpx;
}

.lp-privacy-dialog-actions {
	display: flex;
	flex-direction: row;
	gap: 24rpx;
}

.lp-privacy-dialog-btn {
	flex: 1;
	height: 88rpx;
	border-radius: 16rpx;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 28rpx;
	font-weight: 600;
	box-sizing: border-box;
}

.lp-privacy-dialog-btn--cancel {
	background: #f3f4f6;
	color: #6b7280;
}

.lp-privacy-dialog-btn--ok {
	background: linear-gradient(135deg, #43a047 0%, #66bb6a 100%);
	color: #ffffff;
}

/* ── 初始密码强制修改弹层 ── */
.lp-force-mask {
	position: fixed;
	left: 0;
	right: 0;
	top: 0;
	bottom: 0;
	z-index: 10060;
	background: rgba(0, 0, 0, 0.5);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 48rpx;
	box-sizing: border-box;
}

.lp-force-dialog {
	width: 100%;
	max-width: 640rpx;
	background: #ffffff;
	border-radius: 24rpx;
	padding: 44rpx 36rpx 36rpx;
	box-sizing: border-box;
	box-shadow: 0 24rpx 80rpx rgba(0, 0, 0, 0.2);
}

.lp-force-title {
	display: block;
	font-size: 34rpx;
	font-weight: 700;
	color: #1b5e20;
	text-align: center;
	margin-bottom: 16rpx;
}

.lp-force-tip {
	display: block;
	font-size: 24rpx;
	color: #6b7280;
	line-height: 1.6;
	margin-bottom: 30rpx;
}

.lp-force-field {
	display: flex;
	align-items: center;
	height: 92rpx;
	background: rgba(232, 245, 233, 0.5);
	border-radius: 18rpx;
	border: 2rpx solid rgba(67, 160, 71, 0.15);
	padding: 0 24rpx;
	margin-bottom: 20rpx;
	box-sizing: border-box;
}

.lp-force-input {
	flex: 1;
	min-width: 0;
	height: 100%;
	font-size: 28rpx;
	color: #1f2937;
	background: transparent;
	border: none;
	outline: none;
}

.lp-force-eye {
	flex-shrink: 0;
	padding: 10rpx 0 10rpx 16rpx;
	display: flex;
	align-items: center;
}

.lp-force-submit {
	margin-top: 12rpx;
}
</style>