regist.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  1. <script setup>
  2. import { ref, watch, onMounted } from 'vue'
  3. import { useI18n } from 'vue-i18n'
  4. import { useEmailCountdown } from '@/hooks/useEmailCountdown'
  5. import { ucardApi } from '@/api/ucard'
  6. import { showToast } from '@/utils/toast'
  7. const { t } = useI18n()
  8. const {
  9. time,
  10. text: getCodeString,
  11. canSend,
  12. start,
  13. restore
  14. } = useEmailCountdown()
  15. // 响应式表单数据
  16. const formData = ref({
  17. country: '',
  18. birthDate: '',
  19. code: '',
  20. password: '',
  21. agentId: null,
  22. agentValue: '',
  23. readName: '',
  24. agree: '',
  25. })
  26. const ho = ref('')
  27. // 账号类型
  28. const accountType = ref(1)
  29. const value = ref('')
  30. watch(value, (newValue, oldValue) => {
  31. // console.log('v-model', newValue);
  32. })
  33. // 切换注册账号类型
  34. const changeAccountType = (type) => {
  35. if (accountType.value !== type) accountType.value = type
  36. }
  37. // 获取验证码按钮点击
  38. async function handleGetCode() {
  39. if (!canSend.value) return
  40. await sendEmailCode();
  41. }
  42. // 发送邮箱验证码
  43. async function sendEmailCode() {
  44. const res = await ucardApi.getBlockchainWithdrawSendEmailCode({
  45. ...formData.value,
  46. });
  47. if (res.code === 200) {
  48. showToast(t("Msg.CodeSuccess"));
  49. start()
  50. return true;
  51. } else {
  52. showToast(t("Msg.CodeFail"));
  53. return false;
  54. }
  55. }
  56. onMounted(() => {
  57. const hostParts = window.location.host.split('.')
  58. ho.value = hostParts.length > 1 ? hostParts[1] : ''
  59. })
  60. </script>
  61. <template>
  62. <view class="regist-page" :isHeaderFixed="true" :isLoginPage="true">
  63. <uni-row class="content">
  64. <uni-col :span="20" :offset="2" :sm="{ span: 14, offset: 5 }">
  65. <view class="logo">
  66. <image src="/static/images/logo.png" class="company-icon" mode="widthFix"></image>
  67. </view>
  68. <!-- 账号类型-->
  69. <view class="account-type">
  70. <view class="type-btn" @click="changeAccountType(1)" :class="{ active: accountType === 1 }">Open Live Account
  71. </view>
  72. <view class="type-btn" @click="changeAccountType(2)" :class="{ active: accountType === 2 }">Register Demo
  73. Account
  74. </view>
  75. </view>
  76. <view class="account-tip">
  77. <view class="title">{{ accountType === 1 ? 'Open Live Account' : 'Register Demo Account' }}</view>
  78. <view class="tip">
  79. {{ accountType === 1 ? 'Please enter your required information' : 'Register Demo Account' }}
  80. </view>
  81. </view>
  82. <uni-forms ref="form" :modelValue="formData" validate-trigger="blur" label-position="top" label-width="120">
  83. <uni-row :gutter="20" class="formContent">
  84. <uni-col :xs="24" :md="12">
  85. <uni-forms-item name="country" :label="t('newSignup.item3')">
  86. <uni-data-select class="formStyle" v-model="formData.country">
  87. </uni-data-select>
  88. </uni-forms-item>
  89. </uni-col>
  90. <uni-col :xs="24" :md="12">
  91. <uni-forms-item name="phone" :label="t('newSignup.item5')">
  92. <uni-easyinput class="formStyle" v-model="formData.phone"></uni-easyinput>
  93. </uni-forms-item>
  94. </uni-col>
  95. <uni-col :xs="24" :md="12">
  96. <uni-forms-item name="birthDate" :label="t('newSignup.item18')">
  97. <uni-datetime-picker class="formStyle" type="date" v-model="formData.birthDate"
  98. :placeholder="t('newSignup.item19')" />
  99. </uni-forms-item>
  100. </uni-col>
  101. <uni-col :xs="24" :md="12">
  102. <uni-forms-item name="email" :label="t('newSignup.item7')">
  103. <uni-easyinput class="formStyle" v-model="formData.email"
  104. :placeholder="t('newSignup.item8')"></uni-easyinput>
  105. </uni-forms-item>
  106. </uni-col>
  107. <uni-col :xs="24" :md="12">
  108. <uni-forms-item name="code" :label="t('newSignup.item7')">
  109. <uni-easyinput class="formStyle" v-model="formData.code" :placeholder="t('newSignup.item8')">
  110. <template #right>
  111. <view class="btn-code" @click="handleGetCode">{{ getCodeString }}</view>
  112. </template>
  113. </uni-easyinput>
  114. </uni-forms-item>
  115. </uni-col>
  116. </uni-row>
  117. </uni-forms>
  118. <view class="check-box">
  119. <up-checkbox-group v-model="formData.agree">
  120. <up-checkbox size="14" labelSize="14" labelColor="#666666" activeColor="#ea002a" v-model="formData.agree"
  121. :label="t('signup.agree')" name="" class="wcg-checkbox"></up-checkbox>
  122. </up-checkbox-group>
  123. </view>
  124. <view class="check-box">
  125. <up-checkbox-group v-model="formData.isSubscribeEmail">
  126. <up-checkbox size="14" labelSize="14" labelColor="#666666" activeColor="#ea002a"
  127. v-model="formData.isSubscribeEmail" :label="t('signup.agree1')" name=""
  128. class="wcg-checkbox"></up-checkbox>
  129. </up-checkbox-group>
  130. </view>
  131. <view>
  132. <u-button class="regiset-btn">
  133. {{ t('signup.button') }}
  134. </u-button>
  135. </view>
  136. <view class="or-title">
  137. <view class="line"></view>
  138. <view class="qr-tit2">OR</view>
  139. <view class="line"></view>
  140. </view>
  141. <uni-row :gutter="20">
  142. <uni-col :xs="24" :md="12">
  143. <u-button class="login-btn">
  144. {{ t('signup.button') }}
  145. </u-button>
  146. </uni-col>
  147. <uni-col :xs="24" :md="12">
  148. <u-button class="login-btn">
  149. {{ t('signup.button') }}
  150. </u-button>
  151. </uni-col>
  152. </uni-row>
  153. </uni-col>
  154. </uni-row>
  155. <view class="des">
  156. <view>
  157. {{ t('newSignin.item12') }}
  158. </view><br />
  159. <view>
  160. {{ t('newSignin.item10') }}
  161. </view><br />
  162. <view>
  163. {{ t('newSignin.item11') }}
  164. </view><br />
  165. <view>{{ t('newSignin.item13') }}</view>
  166. <a :href="`https://www.${ho}.com/doc/Risk-Disclosures-and-Acknowledgements-2020-08.pdf`" target="_blank">
  167. {{ t('newSignin.item13_1') }}
  168. </a>
  169. <view>{{ t('newSignin.item13_2') }}</view>
  170. <view>{{ t('newSignin.item13_3') }}</view>
  171. <view>{{ t('newSignin.item13_4') }}</view>
  172. </view>
  173. </view>
  174. </template>
  175. <style lang="scss"></style>
  176. <style lang="scss" scoped>
  177. @import "@/uni.scss";
  178. .regist-page {
  179. height: 100vh;
  180. border: none;
  181. padding: 0;
  182. }
  183. .content {
  184. //display: flex;
  185. .logo {
  186. width: 100%;
  187. margin-top: px2rpx(40);
  188. display: flex;
  189. align-items: center;
  190. justify-content: center;
  191. }
  192. .company-icon {
  193. width: px2rpx(234);
  194. }
  195. .account-type {
  196. width: 100%;
  197. margin-top: px2rpx(20);
  198. padding: px2rpx(10);
  199. background-color: $uni-bg-color-hover;
  200. height: px2rpx(60);
  201. box-sizing: border-box;
  202. border-radius: px2rpx(20);
  203. display: flex;
  204. align-items: center;
  205. .type-btn {
  206. width: 50%;
  207. text-align: center;
  208. height: px2rpx(40);
  209. border-radius: px2rpx(20);
  210. line-height: px2rpx(40);
  211. font-size: px2rpx(18);
  212. cursor: pointer;
  213. &.active {
  214. background-color: var(--primary-color);
  215. }
  216. }
  217. }
  218. }
  219. .formStyle {
  220. height: px2rpx(40);
  221. }
  222. .account-tip {
  223. width: 100%;
  224. text-align: center;
  225. margin: px2rpx(30) 0;
  226. .title {
  227. font-size: px2rpx(26);
  228. font-weight: bold;
  229. }
  230. .tip {
  231. margin-top: px2rpx(5);
  232. color: var(--gray);
  233. }
  234. }
  235. .formContent {
  236. padding: 0 10px;
  237. }
  238. // 修改表单组件高度。
  239. :deep(.uni-stat-box) {
  240. height: 100%;
  241. }
  242. :deep(.uni-select) {
  243. height: 100%;
  244. }
  245. :deep(.uni-easyinput__content) {
  246. height: 100%;
  247. }
  248. :deep(.uni-date-editor) {
  249. height: 100%;
  250. }
  251. :deep(.uni-date-editor--x) {
  252. height: 100%;
  253. }
  254. .btn-code {
  255. width: 30%;
  256. height: 100%;
  257. background-color: #102047;
  258. border: 1px solid #f0f0f0;
  259. color: #fff;
  260. text-align: center;
  261. line-height: px2rpx(40);
  262. border-radius: 0 4px 4px 0;
  263. }
  264. .check-box {
  265. padding: 0 px2rpx(10);
  266. margin-bottom: px2rpx(10);
  267. :deep(.u-checkbox) {
  268. display: flex;
  269. align-items: flex-start;
  270. }
  271. }
  272. .regiset-btn {
  273. width: 100%;
  274. height: px2rpx(40);
  275. border-radius: px2rpx(20);
  276. background-color: #DE002D;
  277. color: #fff;
  278. font-weight: bold;
  279. }
  280. .or-title {
  281. font-size: px2rpx(16);
  282. line-height: 1.5;
  283. color: #333;
  284. font-weight: 500;
  285. text-align: center;
  286. margin: px2rpx(20) 0 px2rpx(18) 0;
  287. display: flex;
  288. align-items: center;
  289. justify-content: center;
  290. .line {
  291. flex: 1;
  292. height: 1px;
  293. background-color: #e4e4e4;
  294. }
  295. .qr-tit2 {
  296. margin: 0 px2rpx(12);
  297. }
  298. }
  299. .login-btn {
  300. width: 100%;
  301. height: px2rpx(40);
  302. border-radius: px2rpx(20);
  303. background-color: #1EBF42;
  304. color: #fff;
  305. font-weight: bold;
  306. margin-bottom: px2rpx(20);
  307. }
  308. .code-text {
  309. padding-right: px2rpx(20);
  310. }
  311. .des {
  312. width: 100%;
  313. box-sizing: border-box;
  314. text-align: start;
  315. line-height: 20px;
  316. color: #000;
  317. font-size: 12px;
  318. padding: px2rpx(20) px2rpx(30);
  319. //display: none;
  320. :nth-child(n) {
  321. display: inline;
  322. word-break: break-all;
  323. word-wrap: break-word;
  324. }
  325. a {
  326. color: #e61f1e;
  327. }
  328. }
  329. :deep(.u-text__value) {
  330. color: #ea002a !important;
  331. font-size: px2rpx(14) !important;
  332. }
  333. </style>