You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

343 lines
7.7 KiB

10 months ago
9 months ago
10 months ago
  1. <!-- 注册页面 -->
  2. <template>
  3. <view class="register bx">
  4. <!-- 背景图片 -->
  5. <view class="bg-box">
  6. <image @click="showSelectLanguageProp" class="language" src="@/static/login/language.png" mode="aspectFit">
  7. </image>
  8. <image src="@/static/logo.png" mode="aspectFit"></image>
  9. </view>
  10. <!-- 加载效果 -->
  11. <loading :loading="loading" @close="closeLoading"></loading>
  12. <view v-if="!loading" class="main">
  13. <!-- 登录标题 -->
  14. <view class="register-title">
  15. <view class="title">{{ $t('page.register.title') }}</view>
  16. <view class="register-descript">{{ $t('page.register.please-register') }}</view>
  17. </view>
  18. <!-- 输入框列表 -->
  19. <view class="input-list">
  20. <view class="input-item">
  21. <view class="input-descript">{{ $t('page.register.username') }}</view>
  22. <input v-model="form.account" type="text" :placeholder="$t('page.register.username-placeholder')" />
  23. </view>
  24. <view class="input-item">
  25. <view class="input-descript">{{ $t('page.register.password') }}</view>
  26. <input v-model="form.password" type="password"
  27. :placeholder="$t('page.register.password-placeholder')" />
  28. </view>
  29. <view class="input-item">
  30. <view class="input-descript">{{ $t('page.register.confirm-password') }}</view>
  31. <input v-model="form.okPassword" type="password"
  32. :placeholder="$t('page.register.confirm-password')" />
  33. </view>
  34. <view class="input-item">
  35. <view class="input-descript">{{ $t('page.register.PaymentPassword') }}</view>
  36. <input v-model="form.payPass" type="password" :placeholder="$t('page.register.PaymentPassword-placeholder')" />
  37. </view>
  38. <view class="input-item">
  39. <view class="input-descript">{{ $t('page.register.confirm-PaymentPassword') }}</view>
  40. <input v-model="form.okPayPass" type="password"
  41. :placeholder="$t('page.register.PaymentPassword-placeholder')" />
  42. </view>
  43. <view class="input-item">
  44. <view class="input-descript">{{ $t('page.register.invitation-code') }}</view>
  45. <input v-model="form.invitationCode" :placeholder="$t('page.register.invitation-code')" />
  46. </view>
  47. </view>
  48. <!-- 勾选协议 -->
  49. <view class="check-box">
  50. <u-checkbox-group v-model="agree" @change="$play">
  51. <u-checkbox activeColor="#B0C73B"
  52. shape="circle" :label="$t('page.register.agreen')"
  53. name="agree"></u-checkbox>
  54. </u-checkbox-group>
  55. <view @click.stop="toAgreement" class="agreement-content">{{ $t('page.register.agreement') }}</view>
  56. </view>
  57. <!-- 忘记密码
  58. <view class="forgot-password">
  59. <text>{{ $t('page.register.forgot-password') }}</text>
  60. </view> -->
  61. <!-- 按钮组 -->
  62. <view class="btns">
  63. <view @click.stop="register" class="now-register-btn">{{ $t('page.register.register') }}</view>
  64. <view @click.stop="toLogin" class="now-login-btn">{{ $t('page.register.login') }}</view>
  65. </view>
  66. </view>
  67. <!-- 切换语言 -->
  68. <changeLanguage :show.sync="showSelectLanguage" @close="closeSelectLanguageProp"></changeLanguage>
  69. <!-- 初始页面 -->
  70. <pageInit></pageInit>
  71. </view>
  72. </template>
  73. <script>
  74. import changeLanguage from '../../components/changeLanguage/changeLanguage.vue';
  75. import pageInit from '@/components/pageInit/pageInit.vue'
  76. import loading from '@/components/pageInit/loading.vue'
  77. export default {
  78. components: {
  79. changeLanguage,
  80. pageInit,
  81. loading
  82. },
  83. data() {
  84. return {
  85. form: {
  86. account: '',
  87. password: '',
  88. okPassword: '',
  89. payPass: '',
  90. okPayPass: '',
  91. invitationCode: ''
  92. },
  93. agree: [],
  94. showSelectLanguage: false,
  95. loading: true
  96. }
  97. },
  98. onShow() {
  99. },
  100. methods: {
  101. //注册
  102. register() {
  103. this.$play()
  104. if (this.verify()) {
  105. this.request('register', {}, this.form).then(res => {
  106. if (res.code == 200) {
  107. this.toLogin(false)
  108. }
  109. })
  110. }
  111. },
  112. //跳转登录页面
  113. toLogin(sound) { //是否发出声音
  114. if(sound){this.$play()}
  115. uni.navigateTo({
  116. url: '/pages/login/login'
  117. })
  118. },
  119. //校验必填项
  120. verify() {
  121. let {
  122. account,
  123. password,
  124. okPassword,
  125. payPass,
  126. okPayPass
  127. } = this.form
  128. if (account.trim() == '') {
  129. uni.showToast({title: this.$t('page.register.accountEmpty'),icon : 'none'});
  130. return false;
  131. }
  132. if (password.trim() == '') {
  133. uni.showToast({title: this.$t('page.register.passEmpty'),icon : 'none'});
  134. return false;
  135. }
  136. if (okPassword.trim() == '') {
  137. uni.showToast({title: this.$t('page.register.okPassEmpty'),icon : 'none'});
  138. return false;
  139. }
  140. if (password.trim() != okPassword.trim()) {
  141. uni.showToast({title: this.$t('page.register.passInconsistency'),icon : 'none'});
  142. return false;
  143. }
  144. if (payPass.trim() == '') {
  145. uni.showToast({title: this.$t('page.register.payPassEmpty'),icon : 'none'});
  146. return false;
  147. }
  148. if (okPayPass.trim() == '') {
  149. uni.showToast({title: this.$t('page.register.okPayPassEmpty'),icon : 'none'});
  150. return false;
  151. }
  152. if (payPass.trim() != okPayPass.trim()) {
  153. uni.showToast({title: this.$t('page.register.payPassInconsistency'),icon : 'none'});
  154. return false;
  155. }
  156. if (this.agree.length <= 0 && this.agree[0] != 'agree') {
  157. uni.showToast({title: this.$t('page.register.tickProtocol'),icon : 'none'});
  158. return false;
  159. }
  160. return true
  161. },
  162. //显示选择语言弹框
  163. showSelectLanguageProp() {
  164. this.$play()
  165. this.showSelectLanguage = true
  166. },
  167. //关闭语言选择弹框
  168. closeSelectLanguageProp() {
  169. this.showSelectLanguage = false
  170. },
  171. //关闭加载效果
  172. closeLoading() {
  173. this.loading = false;
  174. },
  175. //跳转用户协议
  176. toAgreement(){
  177. this.$play()
  178. uni.navigateTo({
  179. url: '/pages/instructions/instructions?index=4'
  180. })
  181. }
  182. }
  183. }
  184. </script>
  185. <style lang="scss" scoped>
  186. .register {
  187. width: 750rpx;
  188. height: 100vh;
  189. margin: 0px auto;
  190. background: black;
  191. background-image: url('@/static/login/bg.png');
  192. background-size: 100%;
  193. background-repeat: no-repeat;
  194. box-sizing: border-box;
  195. padding: 0rpx 20rpx;
  196. .bg-box {
  197. position: relative;
  198. display: flex;
  199. align-items: center;
  200. justify-content: center;
  201. height: 25%;
  202. .language {
  203. position: absolute;
  204. top: 30rpx;
  205. right: 30rpx;
  206. width: 60rpx;
  207. height: 60rpx;
  208. z-index: 999;
  209. }
  210. }
  211. .register-title {
  212. padding: 0rpx 10rpx;
  213. box-sizing: border-box;
  214. .title {
  215. font-size: 36rpx;
  216. font-weight: bold;
  217. color: #B0C73B;
  218. margin-bottom: 10rpx;
  219. }
  220. .register-descript {
  221. font-size: 32rpx;
  222. color: white;
  223. margin-bottom: 20rpx;
  224. }
  225. }
  226. .input-list {
  227. padding: 0rpx 10rpx;
  228. box-sizing: border-box;
  229. margin: 40rpx 0rpx;
  230. .input-item {
  231. display: flex;
  232. justify-content: space-between;
  233. align-items: center;
  234. border: 1px solid #B0C73B;
  235. padding: 20rpx;
  236. border-radius: 5rpx;
  237. margin-bottom: 25rpx;
  238. box-sizing: border-box;
  239. font-size: 28rpx;
  240. .input-descript {
  241. color: #B0C73B;
  242. }
  243. input {
  244. color: #B0C73B;
  245. }
  246. }
  247. }
  248. .forgot-password {
  249. color: #B0C73B;
  250. text-align: center;
  251. text {
  252. border-bottom: 1rpx solid #ccc;
  253. }
  254. }
  255. .check-box{
  256. display: flex;
  257. color: rgb(96, 98, 102);
  258. .agreement-content{
  259. text-decoration: underline;
  260. font-size: 28rpx;
  261. }
  262. }
  263. .btns {
  264. padding: 0rpx 10rpx;
  265. margin-top: 40rpx;
  266. .now-login-btn,
  267. .now-register-btn {
  268. background: #B0C73B;
  269. border-radius: 10rpx;
  270. display: flex;
  271. align-items: center;
  272. justify-content: center;
  273. margin-bottom: 20rpx;
  274. font-weight: bold;
  275. }
  276. .now-login-btn {
  277. height: 60rpx;
  278. width: 90%;
  279. font-size: 28rpx;
  280. margin: 0 auto;
  281. }
  282. .now-register-btn {
  283. height: 90rpx;
  284. font-size: 40rpx;
  285. }
  286. }
  287. }
  288. </style>