RegisterAccount.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. <template>
  2. <div class="center">
  3. <div class="item">
  4. <span
  5. style="color: #bbb; font-size: 21px; padding-top: 7px"
  6. class="icon iconfont icon-wode"
  7. ></span>
  8. <input
  9. type="text"
  10. v-model="name"
  11. :placeholder="L['请输入用户名']"
  12. class="input"
  13. />
  14. <div data-type="userName" class="cancel" @click="clearInputVal">
  15. <span style="color: #bbb" class="iconfont icon-cuowu"></span>
  16. </div>
  17. <div class="error" v-if="nameErrorMsg">
  18. <span
  19. style="color: #e1251b; font-size: 14px"
  20. class="iconfont icon-jubao"
  21. ></span>
  22. {{ nameErrorMsg }}
  23. </div>
  24. </div>
  25. <div class="item password">
  26. <span
  27. style="color: #bbb; font-size: 21px; padding-top: 7px"
  28. class="icon iconfont icon-mima1"
  29. ></span>
  30. <input
  31. :type="showPwdFlag ? 'text' : 'password'"
  32. v-model="password"
  33. :placeholder="L['请输入6~20位英文、数字、符号']"
  34. class="input"
  35. />
  36. <div class="cancel" @click="isShowPwd">
  37. <span
  38. :style="{
  39. color: '#bbb',
  40. fontSize: showPwdFlag ? '20px' : '16px',
  41. }"
  42. :class="{
  43. iconfont: true,
  44. 'icon-bukejian11': !showPwdFlag,
  45. 'icon-kejian': showPwdFlag,
  46. show_pwd: showPwdFlag,
  47. }"
  48. ></span>
  49. </div>
  50. </div>
  51. <div class="item confirm">
  52. <span
  53. style="color: #bbb; font-size: 21px; padding-top: 7px"
  54. class="icon iconfont icon-mima1"
  55. ></span>
  56. <input
  57. :type="showConfirmPwdFlag ? 'text' : 'password'"
  58. v-model="confirmPassword"
  59. :placeholder="L['register']['请确认密码']"
  60. class="input"
  61. />
  62. <div class="cancel" @click="isShowConfirmPwd">
  63. <span
  64. :style="{
  65. color: '#bbb',
  66. fontSize: showConfirmPwdFlag ? '20px' : '16px',
  67. }"
  68. :class="{
  69. iconfont: true,
  70. 'icon-bukejian11': !showConfirmPwdFlag,
  71. 'icon-kejian': showConfirmPwdFlag,
  72. show_pwd: showConfirmPwdFlag,
  73. }"
  74. ></span>
  75. </div>
  76. </div>
  77. <a
  78. href="javascript:void(0)"
  79. @click="joinForFree"
  80. :class="{ submit: true, disabled: joinForFreeDisabled }"
  81. >{{ L["去注册"] }}</a
  82. >
  83. <div class="agree_wrap">
  84. <input
  85. type="checkbox"
  86. :class="{ checkbox: true, default: true, checked: agreeFlag }"
  87. />
  88. <span class="agree_selected iconfont icon-finish" @click="agree" />
  89. <span class="text">
  90. {{ L["我同意"]
  91. }}<nuxt-link
  92. target="_blank"
  93. class="agreement"
  94. :to="`/member/login/agreement?type=1`"
  95. >
  96. {{ L["《用户注册协议》"] }}</nuxt-link
  97. >
  98. <nuxt-link
  99. target="_blank"
  100. class="agreement"
  101. :to="`/member/login/agreement?type=2`"
  102. >{{ L["《隐私政策》"] }}
  103. </nuxt-link>
  104. </span>
  105. </div>
  106. <div class="error" v-if="agreeErrorMsg">
  107. <span
  108. style="color: #e1251b; font-size: 14px"
  109. class="iconfont icon-jubao"
  110. ></span>
  111. {{ agreeErrorMsg }}
  112. </div>
  113. </div>
  114. </template>
  115. <script setup>
  116. import { getCurLanguage } from "@/composables/common.js";
  117. const L = getCurLanguage();
  118. const agreeFlag = ref(false); //同意注册协议标识,默认不同意
  119. const agreeErrorMsg = ref(); // 协议错误提示
  120. const name = ref(""); //用户名
  121. const nameErrorMsg = ref(""); //用户名错误提示
  122. const password = ref(""); //密码
  123. const confirmPassword = ref("") //二次确认密码
  124. const showPwdFlag = ref(false); //密码是否明文显示,默认密文
  125. const showConfirmPwdFlag = ref(false) // 二次密码是否明文显示,默认密文
  126. const joinForFreeDisabled = computed(() => false);
  127. const clearInputVal = () => {
  128. name.value = "";
  129. };
  130. //密码是否显示
  131. const isShowPwd = () => {
  132. showPwdFlag.value = !showPwdFlag.value;
  133. };
  134. // 二次确认密码是否显示
  135. const isShowConfirmPwd = () => {
  136. showConfirmPwdFlag.value = !showConfirmPwdFlag.value;
  137. }
  138. //是否同意用户注册协议
  139. const agree = () => {
  140. agreeFlag.value = !agreeFlag.value;
  141. };
  142. const joinForFree = () => {
  143. if (!agreeFlag.value) {
  144. agreeErrorMsg.value = L["请同意用户注册协议及隐私政策"];
  145. return false;
  146. }
  147. agreeErrorMsg.value = "";
  148. };
  149. watch(name, (val) => {
  150. nameErrorMsg.value = val ? "" : L["请输入用户名"];
  151. });
  152. </script>
  153. <style lang="scss" scoped>
  154. .center {
  155. padding: 30px 30px 40px;
  156. .item {
  157. position: relative;
  158. margin-top: 15px;
  159. border-radius: 2px;
  160. &:first-child {
  161. margin-top: 0;
  162. }
  163. .icon {
  164. position: absolute;
  165. left: 1px;
  166. top: 1px;
  167. width: 50px;
  168. text-align: center;
  169. height: 38px;
  170. background: #f8f8f8;
  171. .input {
  172. border: 1px solid #e8e8e8;
  173. height: 40px;
  174. padding: 0 44px 0 60px;
  175. width: 326px;
  176. }
  177. }
  178. .input {
  179. border: 1px solid #e8e8e8;
  180. height: 40px;
  181. padding: 0 44px 0 60px;
  182. width: 326px;
  183. }
  184. &.code {
  185. .input {
  186. padding-right: 10px;
  187. width: 150px;
  188. }
  189. }
  190. }
  191. .cancel {
  192. position: absolute;
  193. right: 0;
  194. top: 1px;
  195. width: 44px;
  196. height: 38px;
  197. cursor: pointer;
  198. :before {
  199. position: absolute;
  200. top: 9px;
  201. left: 14px;
  202. }
  203. }
  204. .error {
  205. margin-top: 10px;
  206. position: relative;
  207. color: $colorMain;
  208. height: 16px;
  209. line-height: 16px;
  210. }
  211. .submit {
  212. display: block;
  213. margin-top: 35px;
  214. background: $colorMain;
  215. color: #fff;
  216. text-align: center;
  217. border-radius: 2px;
  218. height: 45px;
  219. line-height: 45px;
  220. font-size: 18px;
  221. letter-spacing: 0px;
  222. &:hover {
  223. opacity: 0.9;
  224. }
  225. &.disabled {
  226. background-color: #909399;
  227. pointer-events: none;
  228. }
  229. }
  230. .agree_wrap {
  231. margin-top: 11px;
  232. height: 14px;
  233. line-height: 14px;
  234. color: #999;
  235. padding-left: 2px;
  236. position: relative;
  237. cursor: pointer;
  238. .agree_selected {
  239. color: #fff;
  240. position: absolute;
  241. top: 1px;
  242. left: 3px;
  243. z-index: 2;
  244. font-size: 13px;
  245. }
  246. .checkbox {
  247. width: 14px;
  248. height: 14px;
  249. display: inline-block;
  250. vertical-align: top;
  251. position: relative;
  252. outline: none;
  253. -webkit-appearance: none;
  254. background: none;
  255. border: none;
  256. box-sizing: border-box;
  257. cursor: pointer;
  258. box-shadow: none;
  259. &.checked {
  260. &:before {
  261. background: $colorMain;
  262. border-color: $colorMain;
  263. }
  264. }
  265. &:before {
  266. border: 1px solid #ddd;
  267. background: #fff;
  268. z-index: 1;
  269. position: absolute;
  270. top: 0;
  271. left: 0;
  272. content: " ";
  273. display: block;
  274. width: 100%;
  275. height: 100%;
  276. box-sizing: border-box;
  277. }
  278. }
  279. .text {
  280. margin-left: 5px;
  281. display: inline-block;
  282. vertical-align: top;
  283. .agreement {
  284. color: #000;
  285. &:hover {
  286. text-decoration: underline;
  287. }
  288. }
  289. }
  290. }
  291. }
  292. </style>