Register.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877
  1. <template>
  2. <div style="height: 100px;background-color: #fff;" class="registerBox">
  3. <div class="header1">
  4. <div class="header2">
  5. <div class="logo">
  6. <img
  7. :src="$i18n.locale=='zh'?require('@/assets/img/home/LOGO2020-12-22.png'):require('@/assets/img/home/LOGO2020-12-22.png')"
  8. alt
  9. :style="$i18n.locale=='zh'?'width: 336px;':'width:336px;transform:translateY(1px)'"
  10. @click="toView(0,'home')"
  11. />
  12. </div>
  13. </div>
  14. </div>
  15. <div
  16. style="width: 1200px;height: 700px;background-color: #fff;margin: auto;margin-top: 30px;position: relative;"
  17. >
  18. <div style="line-height: 100px;padding-left: 30px;color: #999;">
  19. {{ $t('common.userRegistration') }}
  20. <span
  21. style="float: right;margin-right: 20px;color:#2c558a ;text-decoration:underline;"
  22. class="cursor"
  23. @click="toBack"
  24. >
  25. {{ $t('common.alreadyAccounted') }}
  26. </span>
  27. <span style="float: right;margin-right: 20px;color:#2c558a;" class="cursor" @click="locale('en')">EN </span>
  28. <span style="float: right;margin-right: 20px;color:#2c558a;" class="cursor"
  29. @click="locale('zh')">{{ $t('common.CN') }} </span>
  30. </div>
  31. <div style="width: 400px;position: absolute;left: 50%;top: 50%;transform: translate(-50%,-50%);">
  32. <div class="register">
  33. <td @click="active(1)" :style="$i18n.locale=='en'?'font-size:14px':''" :class="num==1?'active':''"
  34. class="cursor">{{ $t('common.MobileNumberRegistration') }}
  35. </td>
  36. <td @click="active(2)" :style="$i18n.locale=='en'?'font-size:14px':''" :class="num==2?'active':''"
  37. class="cursor">{{ $t('common.Emailregistration') }}
  38. </td>
  39. </div>
  40. <!-- 手机号注册 -->
  41. <el-form
  42. ref="ruleForm"
  43. :model="ruleForm"
  44. :rules="rules"
  45. label-width="0px"
  46. style="margin: auto; width: 400px;margin-top: 23px;"
  47. v-if="num==1"
  48. class="login2"
  49. >
  50. <el-form-item style="position: relative;" prop="tel">
  51. <GlobalRoaming ref='GlobalRoaming' :size="{width:'398px'}" v-model="ruleForm.tel"
  52. @getAreaCode="getPassAreaCode"></GlobalRoaming>
  53. </el-form-item>
  54. <el-form-item style="position: relative;" prop="vervification">
  55. <el-input :placeholder="$t('common.SMSverificationcode')" v-model="ruleForm.vervification"
  56. class="indent"></el-input>
  57. <i
  58. class="fa fa-commenting"
  59. aria-hidden="true"
  60. style="position: absolute;left: 10px;top: 12px;font-size: 20px;color: #666;"
  61. ></i>
  62. <span style="position: absolute;right: 17px;top: 4px;">
  63. <span
  64. v-show="show"
  65. @click="getTelCode(ruleForm)"
  66. style="margin-left: 40px;"
  67. class="getCode cursor"
  68. >{{ $t('common.Sendverificationcode') }}</span>
  69. <span
  70. v-show="!show"
  71. class="count"
  72. style="margin-left: 20px;color: #999;"
  73. >{{ $i18n.locale == 'en' ? 'Resend it after' + '(' + count + 's' + ')' : count + '秒后发送' }}</span>
  74. </span>
  75. </el-form-item>
  76. <el-form-item style="position: relative;" prop="possWord1">
  77. <el-input
  78. :placeholder="$i18n.locale=='en'?'Set new password of 8 to 20 digits':'设置8至20位登录密码'"
  79. v-model="ruleForm.possWord1" show-password class="indent">
  80. </el-input>
  81. <i
  82. class="fa fa-lock"
  83. aria-hidden="true"
  84. style="position: absolute;left: 10px;top: 14px;font-size: 20px;color: #666;"
  85. ></i>
  86. </el-form-item>
  87. <el-form-item style="position: relative;" prop="possWord2">
  88. <el-input
  89. :placeholder="$i18n.locale=='en'?'Please Enter new login Password again':'请再次输入登录密码'"
  90. v-model="ruleForm.possWord2" show-password class="indent">
  91. </el-input>
  92. <i
  93. class="fa fa-lock"
  94. aria-hidden="true"
  95. style="position: absolute;left: 10px;top: 14px;font-size: 20px;color: #666;"
  96. ></i>
  97. </el-form-item>
  98. <el-form-item>
  99. <el-checkbox-group v-model="ruleForm.resource">
  100. <el-checkbox :label="$i18n.locale=='en'?'Read and agree':'已阅读并同意'" name="type"></el-checkbox>
  101. </el-checkbox-group>
  102. <span style="float: left;color: #0c27ff;" class="cursor"
  103. @click="getAboutMenu('用户协议')">《{{
  104. $i18n.locale == 'en' ? 'Platform User Agreement' : '平台用户协议'
  105. }}》</span>
  106. {{ $t('common.and') }}
  107. <span style="color:#0c27ff;" class="cursor"
  108. @click="getAboutMenu('隐私政策')">《{{ $i18n.locale == 'en' ? 'Privacy Policy' : '隐私政策' }}》</span>
  109. </el-form-item>
  110. <el-form-item>
  111. <el-button type="primary" @click="onSubmitByTel(ruleForm)" style="width: 100%;">
  112. {{ $i18n.locale == 'en' ? 'Register now' : '立即注册' }}
  113. </el-button>
  114. </el-form-item>
  115. </el-form>
  116. <!-- 邮箱注册 -->
  117. <el-form
  118. ref="emailForm"
  119. :model="emailForm"
  120. :rules="rules"
  121. label-width="0px"
  122. style="margin: auto; width: 400px;margin-top: 23px;"
  123. v-else
  124. class="login2"
  125. >
  126. <el-form-item style="position: relative;">
  127. <el-input :placeholder="$i18n.locale=='en'?'Please enter email address':'请输入邮箱号'" v-model="emailForm.email"
  128. class="indent"></el-input>
  129. <i
  130. class="el-icon-user-solid"
  131. style="position: absolute;left: 10px;top: 12px;font-size: 20px;color: #666;"
  132. ></i>
  133. </el-form-item>
  134. <el-form-item style="position: relative;">
  135. <el-input :placeholder="$i18n.locale=='en'?'Email verification code':'邮件验证码'"
  136. v-model="emailForm.vervification" class="indent"></el-input>
  137. <i
  138. class="fa fa-commenting"
  139. aria-hidden="true"
  140. style="position: absolute;left: 10px;top: 12px;font-size: 20px;color: #666;"
  141. ></i>
  142. <span style="position: absolute;right: 17px;top: 4px;">
  143. <span
  144. v-show="show"
  145. @click="getMailCode(emailForm)"
  146. style="margin-left: 40px;"
  147. class="getCode cursor"
  148. >{{ $t('common.Sendverificationcode') }}</span>
  149. <span
  150. v-show="!show"
  151. class="count"
  152. style="margin-left: 20px;color: #999;"
  153. >{{ $i18n.locale == 'en' ? 'Resend it after' + '(' + count + 's' + ')' : count + '秒后发送' }}</span>
  154. </span>
  155. </el-form-item>
  156. <el-form-item style="position: relative;" prop="possWord1">
  157. <el-input :placeholder="$i18n.locale=='en'?'Set new password of 8 to 20 digits':'设置8至20位登录密码'"
  158. v-model="emailForm.possWord1" show-password class="indent"></el-input>
  159. <i
  160. class="fa fa-lock"
  161. aria-hidden="true"
  162. style="position: absolute;left: 10px;top: 14px;font-size: 20px;color: #666;"
  163. ></i>
  164. </el-form-item>
  165. <el-form-item style="position: relative;" prop="possWord2">
  166. <el-input
  167. :placeholder="$i18n.locale=='en'?'Please Enter new login Password again':'请再次输入登录密码'"
  168. v-model="emailForm.possWord2" show-password class="indent">
  169. </el-input>
  170. <i
  171. class="fa fa-lock"
  172. aria-hidden="true"
  173. style="position: absolute;left: 10px;top: 14px;font-size: 20px;color: #666;"
  174. ></i>
  175. </el-form-item>
  176. <el-form-item>
  177. <el-checkbox-group v-model="emailForm.resource">
  178. <el-checkbox :label="$i18n.locale=='en'?'Read and agree':'已阅读并同意'" name="type"></el-checkbox>
  179. </el-checkbox-group>
  180. <span style="float: left;color: #0c27ff;" class="cursor"
  181. @click="getAboutMenu('用户协议')">《{{
  182. $i18n.locale == 'en' ? 'Platform User Agreement' : '平台用户协议'
  183. }}》</span>
  184. {{ $t('common.and') }}
  185. <span style="color:#0c27ff;" class="cursor"
  186. @click="getAboutMenu('隐私政策')">《{{ $i18n.locale == 'en' ? 'Privacy Policy' : '隐私政策' }}》</span>
  187. </el-form-item>
  188. <el-form-item>
  189. <el-button type="primary" @click="onSubmitByMail(emailForm)" style="width: 100%;">
  190. {{ $i18n.locale == 'en' ? 'Register now' : '立即注册' }}
  191. </el-button>
  192. </el-form-item>
  193. </el-form>
  194. </div>
  195. </div>
  196. <div>
  197. <el-dialog
  198. :title="$i18n.locale=='en'?'Registration Agreement':'平台用户协议和隐私政策'"
  199. :visible.sync="dialogVisible"
  200. width="60%"
  201. :before-close="handleClose"
  202. >
  203. <el-dialog width="60%"
  204. :title=" $i18n.locale=='en'?'《User Agreement of Global Energy Interconnection Development and Cooperation Platform》':'《全球能源互联网发展合作平台用户协议》' "
  205. :visible.sync="innerVisible1" append-to-body>
  206. <iframe v-if="$i18n.locale=='zh'" width="100%" id="embed" name="main" ref="embed1" height="600px"
  207. :src="srcPdf3" frameborder="0"></iframe>
  208. <iframe v-if="$i18n.locale=='en'" width="100%" id="embed" name="main" ref="embed1" height="600px"
  209. :src="srcPdf4" frameborder="0"></iframe>
  210. </el-dialog>
  211. <el-dialog
  212. width="60%"
  213. :title=" $i18n.locale=='en'?'《Privacy Policy of Global Energy Interconnection Development and Cooperation Platform》':'《全球能源互联网发展合作平台隐私政策》' "
  214. :visible.sync="innerVisible2"
  215. append-to-body
  216. >
  217. <iframe v-if="$i18n.locale=='zh'" width="100%" id="embed" name="main" ref="embed2" height="600px"
  218. :src="srcPdf" frameborder="0"></iframe>
  219. <iframe v-if="$i18n.locale=='en'" width="100%" id="embed" name="main" ref="embed2" height="600px"
  220. :src="srcPdf2" frameborder="0"></iframe>
  221. </el-dialog>
  222. <div style="width: 70%;margin: auto;word-break: keep-all;"
  223. v-html="$i18n.locale=='zh'?'<p>【审慎阅读】</p> <p>您在申请注册流程中点击同意前,应当认真阅读以下协议。请您务必审慎阅读、充分理解协议中相关条款内容,其中包括:</p><p>1. 与您约定免除或限制责任的条款;</p><p>2. 与您约定法律适用和管辖的条款;</p><p>3. 其他以粗体下划线标识的重要条款。</p><p>如您对协议有任何疑问,可向平台客服咨询。</p><p>【特别提示】</p><p>当您按照注册页面提示填写信息、阅读并同意协议且完成全部注册程序后,即表示您已充分阅读、理解并接受协议的全部内容。如您因平台服务与全球能源互联网发展合作平台发生争议的,适用《全球能源互联网发展合作平台用户协议》和《全球能源互联网发展合作平台隐私政策》处理。如您在使用平台服务过程中与其他用户发生争议的, 依您与其他用户达成的协议处理。</p> <p>阅读协议的过程中,如果您不同意相关协议或其中任何条款约定,您应立即停止注册程序。</p>':'<p>【Read carefully】</p> <p>You should carefully read the following agreement before you click agree in the registration process. Please read carefully and fully understand the relevant clauses in the agreement, including:</p><p>1. Agreement with you on terms of exemption or limitation of liability;</p><p>2. Agree with you on the terms of application of law and jurisdiction;</p><p>3. Other important terms marked with bold underline.</p><p>If you have any questions about the agreement, you can consult the platform customer service.</p><p>【Special Note】</p><p>When you follow the instructions on the registration page to fill in the information, read and agree to the agreement, and complete all the registration procedures, it means that you have fully read, understood and accepted all the contents of the agreement. If you have a dispute with the Global Energy Interconnection Development and Cooperation Platform due to platform services, the 《User Agreement of Global Energy Interconnection Development and Cooperation Platform》 and the 《Privacy Policy of Global Energy Interconnection Development and Cooperation Platform》 shall apply. If you have a dispute with other users during the use of platform services, it will be handled inaccordance with the agreement reached between you and other users.</p> <p>In the process of reading the agreement, if you do not agree to the relevant agreement or any of itsterms, you should immediately stop the registration process.</p>'"></div>
  224. <div style="width: 70%;margin: auto;">
  225. <p>
  226. 1.
  227. <span
  228. style="color: #0c27ff;"
  229. class="cursor"
  230. @click="getAboutMenu('用户协议')"
  231. >《{{
  232. $i18n.locale == 'en' ? 'User Agreement of Global Energy Interconnection Development and Cooperation Platform' : '全球能源互联网发展合作平台用户协议'
  233. }}》</span>
  234. </p>
  235. <p>
  236. 2.
  237. <span
  238. style="color: #0c27ff;"
  239. class="cursor"
  240. @click="getAboutMenu('隐私政策')"
  241. >《{{
  242. $i18n.locale == 'en' ? 'Privacy Policy of Global Energy Interconnection Development and Cooperation Platform' : '全球能源互联网发展合作平台隐私政策'
  243. }}》</span>
  244. </p>
  245. </div>
  246. <div style="width: 70%;margin: auto;margin-top: 50px; text-align: center">
  247. <span slot="footer" class="dialog-footer">
  248. <el-button type="primary" @click="dialogVisible = false; ruleForm.resource = true;emailForm.resource = true"
  249. style="width: 200px;">{{ $i18n.locale == 'en' ? 'Agree and continue' : '同意并继续' }}</el-button>
  250. </span>
  251. </div>
  252. </el-dialog>
  253. </div>
  254. </div>
  255. </template>
  256. <script>
  257. import axios from "axios";
  258. import {registerByTel, updatePrsonnelInfo, sendTelCode} from "@/api/user";
  259. import {getToken} from '@/api/token.js';
  260. import GlobalRoaming from "@/components/GlobalRoaming";
  261. import PlatformRegistered from "@/components/PlatformRegistered";
  262. import LegalNotices from "@/components/LegalNotices";
  263. import {getUserInfoByTel} from "@/api/login";
  264. import {getHelpColumnTree} from '@/api/operation/help/helpCenterEntity';
  265. export default {
  266. name: "Register",
  267. components: {GlobalRoaming, PlatformRegistered, LegalNotices},
  268. data() {
  269. return {
  270. num: "1",
  271. show: true,
  272. count: "",
  273. timer: null,
  274. service: '',
  275. srcPdf: null,
  276. srcPdf2: null,
  277. srcPdf3: null,
  278. srcPdf4: null,
  279. phoneNum: '',
  280. select: '0086',
  281. dialogVisible: false,
  282. innerVisible1: false,
  283. innerVisible2: false,
  284. codeFromTel: "", //获取的验证码信息
  285. personnelInfo: '',
  286. lang: window.localStorage.getItem('locale'),
  287. ruleForm: {
  288. tel: "", //手机号
  289. vervification: "", //验证码
  290. possWord1: "", //密码
  291. possWord2: "", //确认密码
  292. resource: "", // 是否确认用户服务协议
  293. },
  294. emailForm: {
  295. email: "", // 邮箱
  296. vervification: "", // 验证码
  297. possWord1: "", // 密码
  298. possWord2: "", // 确认密码
  299. resource: "", // 是否确认用户服务协议
  300. },
  301. aboutMenu: [],
  302. };
  303. },
  304. mounted() {
  305. // document.all.iframeid.src = '/api/file/pub/def/Scheme3ofonlineexhibitionhall.pdf';
  306. let locale = window.localStorage.getItem("locale");
  307. if (!locale) {
  308. window.localStorage.setItem("locale", "en");
  309. }
  310. this.getAboutId();
  311. document.title = this.$t('common.GEIDcpTitleSeptember');
  312. this.$i18n.locale = locale;
  313. this.getInitData();
  314. setTimeout((res) => {
  315. this.dialogVisible = true;
  316. }, 1000);
  317. //this.testMethod(); //测试方法
  318. this.srcPdf = '/api/file/pub/def/PrivacyPolicy_CN.pdf';
  319. this.srcPdf2 = '/api/file/pub/def/PrivacyPolicy_EN.pdf';
  320. this.srcPdf3 = '/api/file/pub/def/UserAgreement_CN.pdf';
  321. this.srcPdf4 = '/api/file/pub/def/UserAgreement_EN.pdf';
  322. // document.all.iframeid.src = this.srcPdf?this.srcPdf:'';
  323. },
  324. computed: {
  325. rules() {
  326. return {
  327. tel: [],
  328. vervification: [],
  329. possWord1: [
  330. {
  331. min: 8,
  332. max: 20,
  333. // pattern:/^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\W_]+$)(?![a-z0-9]+$)(?![a-z\W_]+$)(?![0-9\W_]+$)[a-zA-Z0-9\W_]{8,20}$/,
  334. pattern: /^[a-z]{4,10}$/,
  335. message: this.$i18n.locale == 'en' ? 'Please input 8 to 20 digits password, at least 3 items of upper and lower case letters, numbers and special symbols' : '请输入8到20位密码,大小写字母,数字,特殊符号至少三项',
  336. trigger: "blur",
  337. },
  338. ],
  339. possWord2: [
  340. {
  341. min: 8,
  342. max: 20,
  343. pattern: /^[a-z]{4,10}$/,
  344. message: this.$i18n.locale == 'en' ? 'Please input 8 to 20 digits password, at least 3 items of upper and lower case letters, numbers and special symbols' : '请输入8到20位密码,大小写字母,数字,特殊符号至少三项',
  345. trigger: "blur",
  346. },
  347. ],
  348. aboutMenu: [],
  349. }
  350. }
  351. },
  352. methods: {
  353. getPassAreaCode(code) {
  354. this.select = code;
  355. },
  356. locale(lang) {
  357. this.$i18n.locale = lang;
  358. let locale = window.localStorage.getItem("locale");
  359. if (locale) {
  360. window.localStorage.setItem("locale", lang);
  361. } else {
  362. window.localStorage["locale"] = lang;
  363. }
  364. },
  365. getInitData() {
  366. let locale = window.localStorage.getItem('locale')
  367. if (!locale) {
  368. window.localStorage.setItem('locale', 'zh')
  369. }
  370. this.getAboutId();
  371. this.$i18n.locale = locale
  372. if (this.$Cookies.get('token') && this.$i18n.locale == 'zh') {
  373. return this.i = 2
  374. } else if (this.$i18n.locale == 'en' && this.$Cookies.get('token')) {
  375. return this.i = 3
  376. } else {
  377. return this.i = 1
  378. }
  379. },
  380. locale(lang) {
  381. this.$i18n.locale = lang
  382. let locale = window.localStorage.getItem('locale')
  383. if (locale) {
  384. window.localStorage.setItem('locale', lang)
  385. } else {
  386. window.localStorage['locale'] = lang;
  387. }
  388. },
  389. handleCommand(command) {
  390. if (command.value == 'loginOut') {
  391. this.loginOut()
  392. } else {
  393. this.toView(0, command.value, command.json)
  394. }
  395. },
  396. // 退出登录
  397. loginOut() {
  398. this.$confirm(this.$t('common.Thisoperationwilllogout') + '?', this.$t('common.Tips'), {
  399. confirmButtonText: this.$t('common.OK'),
  400. cancelButtonText: this.$t('common.cancel'),
  401. type: 'warning'
  402. }).then(() => {
  403. // 退出的逻辑代码
  404. this.$store
  405. .dispatch("user/LOGOUT")
  406. .then(() => {
  407. // location.href = "/";
  408. this.$router.push({
  409. path: "/login",
  410. });
  411. })
  412. .catch((error) => {
  413. location.href = "/";
  414. });
  415. window.sessionStorage.removeItem("token");
  416. this.getInitData();
  417. })
  418. .catch(() => {
  419. this.$message({
  420. type: "info",
  421. message: this.$t('common.Cancelled'),
  422. });
  423. });
  424. },
  425. toView(num, router, json) {
  426. console.log(num, router)
  427. this.$router.push({name: router, query: {key: json}});
  428. this.$store.commit("modify", router);
  429. window.localStorage.setItem("router", router);
  430. if (num == 1) {
  431. let i = {
  432. label: "用户中心",
  433. value: "userCenterView",
  434. };
  435. if (this.$Cookies.get('token')) {
  436. return (this.i = 2);
  437. } else if (this.$i18n.locale == "en") {
  438. return (this.i = 3);
  439. } else {
  440. return (this.i = 1);
  441. }
  442. this.$nextTick(() => {
  443. Bus.$emit("title", i);
  444. });
  445. }
  446. },
  447. // 搜索地区发生变化
  448. countryChange(item) {
  449. console.log(item);
  450. },
  451. // toView(router, json) {
  452. // this.$router.push({ name: router, params: json });
  453. // },
  454. toBack() {
  455. this.$router.push({
  456. name: "login",
  457. });
  458. },
  459. handleClose(done) {
  460. this.dialogVisible = false;
  461. },
  462. active(num) {
  463. //清空数据
  464. Object.assign(this.$data, this.$options.data());
  465. this.num = num;
  466. this.getAboutId();
  467. },
  468. onSubmit() {
  469. console.log(this.select);
  470. },
  471. // 发送手机验证码
  472. getTelCode(ruleForm) {
  473. if (ruleForm.tel == "") {
  474. this.$message.warning(this.$t('common.Mobilephonenumbercannotbeempty') + "!");
  475. return;
  476. }
  477. this.phoneNum = this.select.concat(ruleForm.tel);
  478. //验证手机号合法性
  479. const regPhone = /^([0-9]*)$/;
  480. if (!regPhone.test(ruleForm.tel)) {
  481. this.$message.warning(this.$t('common.Pleaseenteravalidmobilephonenumber') + "!");
  482. return;
  483. }
  484. //获取验证码信息
  485. this.getCheckCode(this.phoneNum, "TX");
  486. //倒计时
  487. const TIME_COUNT = 60;
  488. if (!this.timer) {
  489. this.count = TIME_COUNT;
  490. this.show = false;
  491. this.timer = setInterval(() => {
  492. if (this.count > 0 && this.count <= TIME_COUNT) {
  493. this.count--;
  494. } else {
  495. this.show = true;
  496. clearInterval(this.timer);
  497. this.timer = null;
  498. }
  499. }, 1000);
  500. }
  501. },
  502. //手机号注册
  503. async onSubmitByTel(ruleForm) {
  504. if (ruleForm.tel == "") {
  505. this.$message.warning(this.$t('common.Mobilephonenumbercannotbeempty') + "!");
  506. return;
  507. }
  508. //验证手机号合法性
  509. const regPhone = /^([0-9]*)$/;
  510. if (!regPhone.test(ruleForm.tel)) {
  511. this.$message.warning(this.$t('common.Pleaseenteravalidmobilephonenumber') + "!");//请输入合法的手机号
  512. return;
  513. }
  514. if (ruleForm.vervification == "") {
  515. this.$message.warning(this.$t('common.Verificationcodecannotbeempty') + "!");//验证码不能为空
  516. return;
  517. }
  518. if (ruleForm.possWord1 == "" || ruleForm.possWord2 == "") {
  519. this.$message.warning(this.$t('common.Passwordcannotbeempty') + "!");//密码不能为空
  520. return;
  521. }
  522. // 验证密码合法性
  523. const regpassword = /^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\W_]+$)(?![a-z0-9]+$)(?![a-z\W_]+$)(?![0-9\W_]+$)[a-zA-Z0-9\W_]{8,20}$/;
  524. if (!regpassword.test(ruleForm.possWord1)) {
  525. this.$message.warning(this.$t('common.Pleaseinputdigitspassword'));//输入8到20位密码,大小写字母,数字,特殊符号至少三项
  526. return;
  527. }
  528. if (ruleForm.possWord1 != ruleForm.possWord2) {
  529. this.$message.warning(this.$t('common.Thetwopasswordsarenotthesame') + "!");//两次输入的密码不一致
  530. return;
  531. }
  532. if (!ruleForm.resource) {
  533. this.$message.warning(this.$t('common.Pleasereadandagreetotheuserservice') + "!");//注册前请阅读并同意《用户服务协议》
  534. return;
  535. }
  536. this.phoneNum = this.select.concat(ruleForm.tel);
  537. let umsUser = {};
  538. umsUser.userPreferredMobile = this.phoneNum;
  539. umsUser.userPassword = ruleForm.possWord1;
  540. // let isRegister= true;
  541. // //注册之前,先判断用户是否注册过
  542. // await getUserInfoByTel(this.phoneNum).then(result=>{
  543. // if(result.data){
  544. // isRegister = false;
  545. // }
  546. // }).catch((error) => {
  547. // })
  548. // if(isRegister == false) {
  549. // return this.$message({
  550. // message: this.$t('common.Mobilephonebeen')+"!",
  551. // type: 'error'
  552. // });
  553. // }else{
  554. //
  555. // }
  556. await registerByTel(JSON.stringify(umsUser), this.ruleForm.vervification, this.lang).then((result) => {
  557. this.$message({
  558. message: this.$t('common.loginwassuccessful') + "!",
  559. type: 'success'
  560. });
  561. this.personnelInfo = result.data;
  562. //获取注册信息,存入人员信息
  563. this.updateInfo();
  564. }).catch((error) => {
  565. this.msg(error.msg, "error");
  566. })
  567. },
  568. // 发送邮箱验证码
  569. getMailCode(emailForm) {
  570. //验证手机号合法性
  571. const regEmail = /^[a-zA-Z0-9]+([-_.][a-zA-Z0-9]+)*@[a-zA-Z0-9]+([-_.][a-zA-Z0-9]+)*\.[a-z]{2,}$/;
  572. if (!regEmail.test(emailForm.email)) {
  573. this.$message.warning(this.$t('common.Pleaseenterthecorrectemailnumber') + "!");//请输入正确的邮箱号
  574. return;
  575. }
  576. //获取验证码信息
  577. this.getCheckCode(emailForm.email, "YJ");
  578. //倒计时
  579. const TIME_COUNT = 60;
  580. if (!this.timer) {
  581. this.count = TIME_COUNT;
  582. this.show = false;
  583. this.timer = setInterval(() => {
  584. if (this.count > 0 && this.count <= TIME_COUNT) {
  585. this.count--;
  586. } else {
  587. this.show = true;
  588. clearInterval(this.timer);
  589. this.timer = null;
  590. }
  591. }, 1000);
  592. }
  593. },
  594. msg: function (msg, type) {
  595. if (msg == 'error') {
  596. msg = this.$t('common.ThesystemisbusyPleasetryagainlater') + "!"//系统繁忙,请稍后再试
  597. }
  598. return this.$message({
  599. message: msg,
  600. type: type
  601. })
  602. },
  603. getCheckCode: function (number, service) {
  604. sendTelCode(number, service, this.lang).then(result => {
  605. this.msg(result.msg, "success");
  606. // this.msg(this.$t('common.Verificationcodehasbeensent') + "!", "success");//验证码已发送,请查收
  607. }).catch((error) => {
  608. this.msg(error.msg, "error");
  609. // this.msg(this.$t('common.FailedVerification'), "error");
  610. })
  611. },
  612. //邮箱注册
  613. async onSubmitByMail(emailForm) {
  614. if (emailForm.email == "") {
  615. this.$message.warning(this.$t('common.Emailnumbercannotbeempty') + "!");//邮箱号不能为空
  616. return;
  617. }
  618. //验证邮箱号合法性
  619. const regEmail = /^[a-zA-Z0-9]+([-_.][a-zA-Z0-9]+)*@[a-zA-Z0-9]+([-_.][a-zA-Z0-9]+)*\.[a-z]{2,}$/;
  620. if (!regEmail.test(emailForm.email)) {
  621. this.$message.warning(this.$t('common.Pleaseenterthecorrectemailnumber') + "!");//请输入正确的邮箱号
  622. return;
  623. }
  624. if (emailForm.vervification == "") {
  625. this.$message.warning(this.$t('common.Verificationcodecannotbeempty') + "!");//验证码不能为空
  626. return;
  627. }
  628. // 验证密码合法性
  629. const regpassword = /^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\W_]+$)(?![a-z0-9]+$)(?![a-z\W_]+$)(?![0-9\W_]+$)[a-zA-Z0-9\W_]{8,20}$/;
  630. if (!regpassword.test(emailForm.possWord1)) {
  631. this.$message.warning(this.$t('common.Pleaseinputdigitspassword'));//输入8到20位密码,大小写字母,数字,特殊符号至少三项
  632. return
  633. }
  634. if (emailForm.possWord1 == "" || emailForm.possWord2 == "") {
  635. this.$message.warning(this.$t('common.Passwordcannotbeempty') + "!");//密码不能为空
  636. return;
  637. }
  638. if (emailForm.possWord1 != emailForm.possWord2) {
  639. this.$message.warning(this.$t('common.Thetwopasswordsarenotthesame') + "!");//两次输入的密码不一致
  640. return;
  641. }
  642. if (!emailForm.resource) {
  643. this.$message.warning(this.$t('common.Pleasereadandagreetotheuserservice') + "!");//注册前请阅读并同意《用户服务协议》
  644. return;
  645. }
  646. let umsUser = {};
  647. umsUser.userEmail = emailForm.email;
  648. umsUser.userPassword = emailForm.possWord1;
  649. // let isRegisterByEmail = true;
  650. // //注册之前,先判断用户是否注册过
  651. // await getUserInfoByTel(emailForm.email).then(result => {
  652. // if (result.data) {
  653. // isRegisterByEmail = false;
  654. // }
  655. // }).catch((error) => {
  656. // })
  657. // if (isRegisterByEmail == false) {
  658. // return this.$message({
  659. // message: this.$t('common.Emailbeen') + "!",
  660. // type: 'error'
  661. // });
  662. // } else {
  663. //
  664. // }
  665. await registerByTel(JSON.stringify(umsUser), this.emailForm.vervification, this.lang).then((result) => {
  666. this.msg(this.$t('common.loginwassuccessful'), "success");//注册成功
  667. this.personnelInfo = result.data;
  668. //获取注册信息,存入人员信息
  669. this.updateInfo();
  670. }).catch((error) => {
  671. this.msg(error.msg, "error");
  672. // this.msg(this.$t('common.loginwasfailed'), "error");
  673. })
  674. },
  675. updateInfo: function () {
  676. updatePrsonnelInfo(JSON.stringify(this.personnelInfo), this.lang).then((result) => {
  677. this.$router.push({
  678. name: "login",
  679. });
  680. // this.$message(result.msg);
  681. }).catch((error) => {
  682. })
  683. },
  684. //次方法用于测试
  685. testMethod() {
  686. axios
  687. .get("./userRegisterAndLogin/sendCode/", {
  688. params: {
  689. telNum: 666,
  690. },
  691. })
  692. .then((res) => {
  693. console.log(res);
  694. })
  695. .catch((error) => {
  696. console.log(error);
  697. alert("网络错误,不能访问");
  698. });
  699. },
  700. //用户注册、隐私协议数据连接处理
  701. getAboutMenu(type) {
  702. this.aboutMenu.forEach(item => {
  703. if (item.name == type) {
  704. this.toViewAbout('helpCenter', item.id);
  705. }
  706. })
  707. },
  708. //获取用户注册、隐私协议id信息
  709. getAboutId() {
  710. var language = "ZH"
  711. getHelpColumnTree(language).then((result) => {
  712. this.aboutMenu = [];
  713. let menuHelp = result.data;
  714. for (let i = 0; i <= menuHelp.length - 1; i++) {
  715. if (menuHelp[i].name == "关于我们" || menuHelp[i].name == "About Us") {
  716. this.aboutMenu = menuHelp[i].children;
  717. }
  718. console.log('this.aboutMenu')
  719. console.log(this.aboutMenu)
  720. }
  721. })
  722. },
  723. //跳转帮助中心
  724. toViewAbout(router, id) {
  725. this.$store.commit('modify', router);
  726. window.localStorage.setItem('router', router);
  727. const {href} = this.$router.resolve({
  728. name: router,
  729. query: {
  730. key: id
  731. }
  732. });
  733. window.open(href, '_blank');
  734. },
  735. },
  736. };
  737. </script>
  738. <!-- Add "scoped" attribute to limit CSS to this component only -->
  739. <style scoped>
  740. .header1 {
  741. width: 100%;
  742. height: 120px;
  743. margin: auto;
  744. background: #2c558a;
  745. /* border-bottom: 2px solid #c2c2c2; */
  746. }
  747. .header2 {
  748. width: 1200px;
  749. height: 120px;
  750. margin: auto;
  751. position: relative;
  752. border-bottom: 1px solid #fff;
  753. /* background: skyblue; */
  754. }
  755. .language {
  756. line-height: 50px;
  757. color: #ccc;
  758. font-weight: 400;
  759. font-size: 12px;
  760. }
  761. .el-form-item__error {
  762. height: 36px;
  763. }
  764. .jurisdiction >>> p {
  765. word-break: break-all;
  766. }
  767. .logo {
  768. position: absolute;
  769. top: 30px;
  770. left: 421px;
  771. width: 240px;
  772. height: 55px;
  773. /* background-image: url(@/assets/logo.png); */
  774. }
  775. .title {
  776. position: absolute;
  777. top: 40px;
  778. left: 450px;
  779. font-size: 30px;
  780. font-weight: 700;
  781. color: #fff;
  782. }
  783. .register td {
  784. height: 78px;
  785. line-height: 78px;
  786. font-size: 20px;
  787. width: 50%;
  788. display: inline-block;
  789. color: #999;
  790. text-align: center;
  791. }
  792. .register td:nth-of-type(2) {
  793. width: 48.5%;
  794. }
  795. .register .active {
  796. background: #199ed8;
  797. color: #fff;
  798. }
  799. .login2 >>> .is-error {
  800. margin-bottom: 36px !important;
  801. }
  802. .login1 >>> .el-input__inner {
  803. height: 48px;
  804. }
  805. .login1 >>> .el-button,
  806. .login2 >>> .el-button {
  807. height: 48px;
  808. }
  809. .login2 >>> .el-input__inner {
  810. /* text-indent: 30px; */
  811. height: 48px;
  812. background: #fff !important;
  813. border: 1px solid #dcdfe6 !important;
  814. }
  815. .login2 .login2_item >>> .el-input__inner {
  816. }
  817. .login2 >>> .el-select {
  818. width: 154px;
  819. height: 48px;
  820. margin: -10px -21px;
  821. }
  822. .getCode {
  823. color: #0c27ff;
  824. }
  825. .indent >>> .el-input__inner {
  826. text-indent: 25px;
  827. }
  828. .login2 .el-checkbox-group {
  829. float: left;
  830. }
  831. .registerBox >>> .el-dialog__header {
  832. text-align: center;
  833. }
  834. </style>