├── php-api/ # 改造后的PHP接口层 ├── java-ad-service/ # 若依框架微服务(广告+VIP+分账) ├── uniapp-reader/ # UniApp前端项目 │ ├── pages/ # 各端页面 │ └──
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. <template>
  2. <view class="normal-login-container">
  3. <view class="logo-content align-center justify-center flex">
  4. <image style="width: 100rpx;height: 100rpx;" :src="globalConfig.appInfo.logo" mode="widthFix">
  5. </image>
  6. <text class="title">哎呀电子注册</text>
  7. </view>
  8. <view class="login-form-content">
  9. <view class="input-item flex align-center">
  10. <view class="iconfont icon-user icon"></view>
  11. <input v-model="registerForm.username" class="input" type="text" placeholder="请输入账号" maxlength="30" />
  12. </view>
  13. <view class="input-item flex align-center">
  14. <view class="iconfont icon-password icon"></view>
  15. <input v-model="registerForm.password" type="password" class="input" placeholder="请输入密码" maxlength="20" />
  16. </view>
  17. <view class="input-item flex align-center">
  18. <view class="iconfont icon-password icon"></view>
  19. <input v-model="registerForm.confirmPassword" type="password" class="input" placeholder="请再次输入密码" maxlength="20" />
  20. </view>
  21. <view class="input-item flex align-center" style="width: 60%;margin: 0px;" v-if="captchaEnabled">
  22. <view class="iconfont icon-code icon"></view>
  23. <input v-model="registerForm.code" type="number" class="input" placeholder="请输入验证码" maxlength="4" />
  24. <view class="login-code">
  25. <image :src="codeUrl" @click="getCode" class="login-code-img"></image>
  26. </view>
  27. </view>
  28. <!-- 用户协议 - 优化后的样式 -->
  29. <view class="agreement-section">
  30. <view class="agreement-item" @click="toggleAgreement">
  31. <view class="checkbox-wrapper">
  32. <view class="custom-checkbox" :class="{ checked: agreementChecked }">
  33. <text class="checkmark" v-if="agreementChecked">✓</text>
  34. </view>
  35. </view>
  36. <view class="agreement-text">
  37. <text>我已阅读并同意</text>
  38. <text class="agreement-link" @click.stop="handleUserAgrement">《用户协议》</text>
  39. <text>和</text>
  40. <text class="agreement-link" @click.stop="handlePrivacy">《隐私协议》</text>
  41. </view>
  42. </view>
  43. </view>
  44. <view class="action-btn">
  45. <button @click="handleRegister()" class="register-btn cu-btn block bg-blue lg round" :class="{ disabled: !agreementChecked }" :disabled="!agreementChecked">注册</button>
  46. </view>
  47. </view>
  48. <view class="login-link text-center">
  49. <text @click="handleUserLogin" class="text-blue">使用已有账号登录</text>
  50. </view>
  51. </view>
  52. </template>
  53. <script>
  54. import { getCodeImg, register } from '@/api/login'
  55. export default {
  56. data() {
  57. return {
  58. codeUrl: "",
  59. captchaEnabled: true,
  60. agreementChecked: false,
  61. globalConfig: getApp().globalData.config,
  62. registerForm: {
  63. username: "",
  64. password: "",
  65. confirmPassword: "",
  66. code: "",
  67. uuid: ''
  68. }
  69. }
  70. },
  71. created() {
  72. this.getCode()
  73. },
  74. methods: {
  75. // 用户登录
  76. handleUserLogin() {
  77. this.$tab.navigateTo(`/pages/login/index`)
  78. },
  79. // 协议相关
  80. handlePrivacy() {
  81. let site = this.globalConfig.appInfo.agreements[0]
  82. this.$tab.navigateTo(`/pages/common/webview/index?title=${site.title}&url=${site.url}`)
  83. },
  84. handleUserAgrement() {
  85. let site = this.globalConfig.appInfo.agreements[1]
  86. this.$tab.navigateTo(`/pages/common/webview/index?title=${site.title}&url=${site.url}`)
  87. },
  88. toggleAgreement() {
  89. this.agreementChecked = !this.agreementChecked
  90. },
  91. // 获取图形验证码
  92. getCode() {
  93. getCodeImg().then(res => {
  94. this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled
  95. if (this.captchaEnabled) {
  96. this.codeUrl = 'data:image/gif;base64,' + res.img
  97. this.registerForm.uuid = res.uuid
  98. }
  99. })
  100. },
  101. // 注册方法
  102. async handleRegister() {
  103. if (!this.agreementChecked) {
  104. this.$modal.msgError("请先同意用户协议和隐私协议")
  105. return
  106. }
  107. if (this.registerForm.username === "") {
  108. this.$modal.msgError("请输入您的账号")
  109. } else if (this.registerForm.password === "") {
  110. this.$modal.msgError("请输入您的密码")
  111. } else if (this.registerForm.confirmPassword === "") {
  112. this.$modal.msgError("请再次输入您的密码")
  113. } else if (this.registerForm.password !== this.registerForm.confirmPassword) {
  114. this.$modal.msgError("两次输入的密码不一致")
  115. } else if (this.registerForm.code === "" && this.captchaEnabled) {
  116. this.$modal.msgError("请输入验证码")
  117. } else {
  118. this.$modal.loading("注册中,请耐心等待...")
  119. this.register()
  120. }
  121. },
  122. // 用户注册
  123. async register() {
  124. register(this.registerForm).then(res => {
  125. this.$modal.closeLoading()
  126. uni.showModal({
  127. title: "系统提示",
  128. content: "恭喜你,您的账号 " + this.registerForm.username + " 注册成功!",
  129. success: (res) => {
  130. if (res.confirm) {
  131. uni.redirectTo({ url: `/pages/login/index` });
  132. }
  133. }
  134. })
  135. }).catch(() => {
  136. if (this.captchaEnabled) {
  137. this.getCode()
  138. }
  139. })
  140. }
  141. }
  142. }
  143. </script>
  144. <style lang="scss">
  145. page {
  146. background-color: #ffffff;
  147. }
  148. .normal-login-container {
  149. width: 100%;
  150. .logo-content {
  151. width: 100%;
  152. font-size: 21px;
  153. text-align: center;
  154. padding-top: 15%;
  155. flex-direction: column;
  156. image {
  157. border-radius: 4px;
  158. }
  159. .title {
  160. margin: 10px 0;
  161. font-size: 24px;
  162. color: #e94f87;
  163. }
  164. }
  165. .login-form-content {
  166. text-align: center;
  167. margin: 20px auto;
  168. margin-top: 10%;
  169. width: 80%;
  170. .input-item {
  171. margin: 20px auto;
  172. background-color: #f5f6f7;
  173. height: 45px;
  174. border-radius: 20px;
  175. .icon {
  176. font-size: 38rpx;
  177. margin-left: 10px;
  178. color: #999;
  179. }
  180. .input {
  181. width: 100%;
  182. font-size: 14px;
  183. line-height: 20px;
  184. text-align: left;
  185. padding-left: 15px;
  186. }
  187. }
  188. /* 优化后的协议区域样式 */
  189. .agreement-section {
  190. margin: 25px 0;
  191. padding: 0 10px;
  192. }
  193. .agreement-item {
  194. display: flex;
  195. align-items: flex-start;
  196. justify-content: flex-start;
  197. text-align: left;
  198. font-size: 14px;
  199. color: #666;
  200. line-height: 1.5;
  201. }
  202. .checkbox-wrapper {
  203. margin-right: 10px;
  204. margin-top: 2px;
  205. flex-shrink: 0;
  206. }
  207. .custom-checkbox {
  208. width: 20px;
  209. height: 20px;
  210. border: 2px solid #ddd;
  211. border-radius: 4px;
  212. display: flex;
  213. align-items: center;
  214. justify-content: center;
  215. transition: all 0.3s ease;
  216. background-color: #fff;
  217. }
  218. .custom-checkbox.checked {
  219. border-color: #e94f87;
  220. background-color: #e94f87;
  221. }
  222. .checkmark {
  223. color: #fff;
  224. font-size: 14px;
  225. font-weight: bold;
  226. }
  227. .agreement-text {
  228. flex: 1;
  229. display: flex;
  230. flex-wrap: wrap;
  231. align-items: center;
  232. }
  233. .agreement-link {
  234. color: #e94f87;
  235. margin: 0 3px;
  236. text-decoration: underline;
  237. }
  238. .agreement-link:active {
  239. opacity: 0.7;
  240. }
  241. .register-btn {
  242. margin-top: 20px;
  243. height: 45px;
  244. background: #e94f87 !important;
  245. color: #fff;
  246. border-radius: 25px;
  247. font-size: 16px;
  248. }
  249. .register-btn.disabled {
  250. background: #ccc !important;
  251. color: #999;
  252. }
  253. .login-code {
  254. height: 38px;
  255. float: right;
  256. .login-code-img {
  257. height: 38px;
  258. position: absolute;
  259. margin-left: 10px;
  260. width: 200rpx;
  261. }
  262. }
  263. }
  264. .login-link {
  265. margin-top: 30px;
  266. .text-blue {
  267. color: #e94f87;
  268. }
  269. }
  270. }
  271. </style>