index.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <view class="login-page">
  3. <!-- 顶部渐变装饰区 -->
  4. <view class="hero-bg">
  5. <view class="deco-circle c1"></view>
  6. <view class="deco-circle c2"></view>
  7. <view class="deco-circle c3"></view>
  8. <!-- 返回按钮 -->
  9. <view class="back-btn" @click="onClickLeft">
  10. <uni-icons type="left" size="20" color="#fff"></uni-icons>
  11. </view>
  12. <!-- Logo 区域 -->
  13. <view class="hero-content">
  14. <view class="logo-wrap">
  15. <uni-icons type="headphones" size="42" color="#fff"></uni-icons>
  16. </view>
  17. <text class="brand-name">宠物服务平台</text>
  18. <text class="brand-desc">专业 · 安心 · 便捷</text>
  19. </view>
  20. </view>
  21. <!-- 表单白色卡片区 -->
  22. <view class="form-card">
  23. <text class="form-title">账号登录</text>
  24. <!-- 账号输入框 -->
  25. <view class="input-group">
  26. <view class="input-icon-wrap">
  27. <uni-icons type="person" size="18" color="#ffc837"></uni-icons>
  28. </view>
  29. <input class="custom-input" v-model="username" placeholder="请输入登录账号" placeholder-class="input-placeholder" />
  30. </view>
  31. <!-- 密码输入框 -->
  32. <view class="input-group">
  33. <view class="input-icon-wrap">
  34. <uni-icons type="locked" size="18" color="#ffc837"></uni-icons>
  35. </view>
  36. <input class="custom-input" v-model="password" type="password" placeholder="请输入密码" placeholder-class="input-placeholder" />
  37. </view>
  38. <!-- 提示信息 -->
  39. <view class="tip-row">
  40. <uni-icons type="info" size="13" color="#ffaa00"></uni-icons>
  41. <text>账号由后台创建,不支持自主注册</text>
  42. </view>
  43. <!-- 协议勾选 -->
  44. <view class="agreement-row">
  45. <checkbox-group @change="onCheckChange">
  46. <label class="agree-label">
  47. <checkbox :checked="checked" color="#ffc837" style="transform: scale(0.7);" />
  48. <text class="agree-text">我已阅读并同意</text>
  49. <text class="text-link" @click.stop="showAgreement('隐私政策')">《隐私政策》</text>
  50. <text class="agree-text">和</text>
  51. <text class="text-link" @click.stop="showAgreement('商家托运协议')">《托运协议》</text>
  52. </label>
  53. </checkbox-group>
  54. </view>
  55. <!-- 登录按钮 -->
  56. <button class="login-btn" @click="onSubmit">安全登录</button>
  57. </view>
  58. <!-- 底部装饰 -->
  59. <view class="footer-hint">
  60. <text>安全加密 · 保护您的账号信息</text>
  61. </view>
  62. </view>
  63. </template>
  64. <script setup>
  65. import { ref } from 'vue'
  66. const username = ref('')
  67. const password = ref('')
  68. const checked = ref(false)
  69. const onClickLeft = () => uni.navigateBack()
  70. const onCheckChange = () => {
  71. checked.value = !checked.value
  72. }
  73. const onSubmit = () => {
  74. if (!username.value) {
  75. uni.showToast({ title: '请填写账号', icon: 'none' })
  76. return
  77. }
  78. if (!password.value) {
  79. uni.showToast({ title: '请填写密码', icon: 'none' })
  80. return
  81. }
  82. if (!checked.value) {
  83. uni.showToast({ title: '请先阅读并勾选协议', icon: 'none' })
  84. return
  85. }
  86. uni.showToast({ title: '登录成功 (模拟)', icon: 'success' })
  87. setTimeout(() => {
  88. uni.reLaunch({ url: '/pages/index/index' })
  89. }, 1000)
  90. }
  91. const showAgreement = (name) => {
  92. uni.showToast({ title: `查看 ${name} 详情 (演示)`, icon: 'none' })
  93. }
  94. </script>
  95. <style lang="scss" scoped>
  96. .login-page { min-height: 100vh; background: #f2f3f7; display: flex; flex-direction: column; }
  97. .hero-bg { background: linear-gradient(150deg, #ffd53f 0%, #ff9500 100%); padding: 0 40rpx 140rpx; position: relative; overflow: hidden; min-height: 560rpx; display: flex; flex-direction: column; justify-content: flex-end; }
  98. .deco-circle { position: absolute; border-radius: 50%; background: rgba(255, 255, 255, 0.12); }
  99. .c1 { width: 400rpx; height: 400rpx; top: -160rpx; right: -120rpx; }
  100. .c2 { width: 260rpx; height: 260rpx; top: 80rpx; left: -100rpx; }
  101. .c3 { width: 160rpx; height: 160rpx; bottom: 80rpx; right: 80rpx; }
  102. .back-btn { position: absolute; top: calc(var(--status-bar-height, 44px) + 20rpx); left: 32rpx; width: 72rpx; height: 72rpx; border-radius: 50%; background: rgba(255, 255, 255, 0.25); display: flex; align-items: center; justify-content: center; }
  103. .hero-content { position: relative; z-index: 2; }
  104. .logo-wrap { width: 140rpx; height: 140rpx; background: rgba(255, 255, 255, 0.25); border-radius: 44rpx; display: flex; align-items: center; justify-content: center; margin-bottom: 28rpx; }
  105. .brand-name { display: block; font-size: 52rpx; font-weight: 800; color: #fff; margin-bottom: 8rpx; }
  106. .brand-desc { display: block; font-size: 28rpx; color: rgba(255, 255, 255, 0.8); letter-spacing: 4rpx; }
  107. .form-card { background: #fff; border-radius: 56rpx 56rpx 0 0; margin-top: -60rpx; padding: 60rpx 48rpx 40rpx; flex: 1; position: relative; z-index: 10; }
  108. .form-title { display: block; font-size: 38rpx; font-weight: 700; color: #1a1a1a; margin-bottom: 48rpx; }
  109. .input-group { display: flex; align-items: center; background: #f8f8f8; border-radius: 28rpx; padding: 8rpx 24rpx; margin-bottom: 28rpx; border: 3rpx solid transparent; }
  110. .input-icon-wrap { margin-right: 16rpx; flex-shrink: 0; }
  111. .custom-input { flex: 1; height: 88rpx; font-size: 30rpx; color: #222; background: transparent; }
  112. .input-placeholder { color: #c0c0c0; }
  113. .tip-row { display: flex; align-items: center; gap: 10rpx; font-size: 24rpx; color: #aaa; padding: 8rpx 8rpx 24rpx; }
  114. .agreement-row { margin-bottom: 48rpx; padding: 0 4rpx; }
  115. .agree-label { display: flex; align-items: center; flex-wrap: wrap; }
  116. .agree-text { font-size: 24rpx; color: #999; }
  117. .text-link { font-size: 24rpx; color: #ff9500; }
  118. .login-btn { width: 100%; height: 104rpx; font-size: 34rpx; font-weight: 700; color: #333; background: linear-gradient(90deg, #ffd53f, #ff9500); border: none; border-radius: 52rpx; letter-spacing: 4rpx; }
  119. .footer-hint { text-align: center; font-size: 22rpx; color: #bbb; padding: 32rpx 0 60rpx; background: #fff; }
  120. </style>