Create.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. <script>
  2. import { get, post } from '../../utils/request'
  3. import Eyecolse from '@/components/icon/eye_colse.vue'
  4. import Eyeopen from '@/components/icon/eye_open.vue'
  5. import Loading from '@/components/icon/loading.vue'
  6. import Error from '@/components/icon/error.vue'
  7. export default {
  8. components: { Eyecolse, Eyeopen, Loading, Error },
  9. data() {
  10. return {
  11. loading: false,
  12. checked: false,
  13. checkBox: false,
  14. passwordType: false,
  15. passwordConfirmType: false,
  16. result: true,
  17. verificationCodeError: false,
  18. passwordError: false,
  19. passwordConfirmError: false,
  20. ruleForm: {
  21. email: '',
  22. verificationCode: '',
  23. userName: '',
  24. password: '',
  25. passwordConfirm: '',
  26. industry: '',
  27. company: ''
  28. },
  29. rules: {
  30. email: [
  31. {
  32. required: true,
  33. message: 'Email Address is required',
  34. trigger: ['']
  35. },
  36. {
  37. type: 'email',
  38. message: 'Please enter a valid Email Address',
  39. trigger: ['']
  40. }
  41. ],
  42. verificationCode: [
  43. { required: true, message: 'Password is required', trigger: [''] }
  44. ],
  45. userName: [
  46. { required: true, message: 'User name is required', trigger: [''] }
  47. ],
  48. password: [
  49. { required: true, message: 'Password is required', trigger: [''] }
  50. ],
  51. passwordConfirm: [
  52. {
  53. required: true,
  54. message: 'Password confirm is required',
  55. trigger: ['']
  56. }
  57. ],
  58. company: [
  59. {
  60. required: true,
  61. message: 'Company confirm is required',
  62. trigger: ['']
  63. }
  64. ]
  65. }
  66. }
  67. },
  68. watch: {
  69. checked: {
  70. handler(val) {
  71. if (this.checked !== '') {
  72. this.checkBox = false
  73. } else {
  74. this.checkBox = true
  75. }
  76. }
  77. }
  78. },
  79. methods: {
  80. createAccount() {
  81. this.verificationCodeError = false
  82. this.passwordError = false
  83. this.passwordConfirmError = false
  84. if (this.checked) {
  85. this.loading = true
  86. this.$refs['ruleForm'].validate((valid) => {
  87. if (valid) {
  88. let teamIds = this.$route.query.teamIds.split(',')
  89. console.log(teamIds)
  90. post('http://81.68.234.235:8032/pdf-tech/vppMember/create', {
  91. email: this.ruleForm.email,
  92. verifyCode: this.ruleForm.verificationCode,
  93. username: this.ruleForm.userName,
  94. password: this.ruleForm.password,
  95. confirmPassword: this.ruleForm.passwordConfirm,
  96. industry: this.ruleForm.industry,
  97. company: this.ruleForm.company,
  98. code: this.$route.query.code,
  99. teamIds: teamIds
  100. }).then((res) => {
  101. this.loading = false
  102. if (
  103. res.data.code === 700 &&
  104. res.data.msg === 'False Code,please check again'
  105. ) {
  106. this.verificationCodeError = true
  107. this.$message.error({
  108. message: 'False Code,please check again'
  109. })
  110. } else if (
  111. res.data.code === 700 &&
  112. res.data.msg === 'Password must between 6-24 characters'
  113. ) {
  114. this.passwordError = true
  115. this.passwordConfirmError = true
  116. this.$message.error({
  117. message: 'Password must between 6-24 characters'
  118. })
  119. } else if (
  120. res.data.code === 700 &&
  121. res.data.msg === 'Different Password'
  122. ) {
  123. this.passwordError = true
  124. this.passwordConfirmError = true
  125. this.$message.error({
  126. message: 'Different Password'
  127. })
  128. } else if (
  129. res.data.code === 200 &&
  130. res.data.msg === '注册成功'
  131. ) {
  132. this.$message({
  133. message: 'Create Success',
  134. type: 'success'
  135. })
  136. this.$router.push('/login')
  137. }
  138. })
  139. }
  140. })
  141. } else {
  142. this.checkBox = true
  143. this.$message.error({
  144. message:
  145. 'Please read and confirm POLICY OF PRIVACY and TERMS OF USE first'
  146. })
  147. }
  148. },
  149. sendEmail() {
  150. if (this.result) {
  151. console.log(this.ruleForm.email)
  152. //发送邮件
  153. get(
  154. 'http://81.68.234.235:8032/pdf-tech/auth/getVerifyCode?action=0&type=0&receiver=' +
  155. this.ruleForm.email
  156. ).then((res) => {
  157. console.log(res)
  158. })
  159. }
  160. }
  161. }
  162. }
  163. </script>
  164. <template>
  165. <div class="bg w-full h-100vh flex justify-center items-center">
  166. <div v-show="loading" class="absolute z-100 flex justify-center items-center h-100vh w-full bg-[#fff] opacity-60"><Loading class="z-100" /></div>
  167. <div class="h-auto m-auto">
  168. <div class="w-404px h-auto rounded-8px p-24px bg-[#fff] loginBox">
  169. <h1 class="text-24px font-bold my-24px">Create account</h1>
  170. <el-form
  171. :model="ruleForm"
  172. ref="ruleForm"
  173. :rules="rules"
  174. label-position="top"
  175. label-width="100px"
  176. inline-message
  177. >
  178. <el-form-item prop="email">
  179. <div class="flex items-center relative">
  180. <el-input
  181. v-model.trim="ruleForm.email"
  182. placeholder="Email address"
  183. >
  184. </el-input>
  185. <button
  186. type="button"
  187. @click="sendEmail()"
  188. class="
  189. absolute
  190. flex
  191. justify-center
  192. items-center
  193. top-8px
  194. right-0px
  195. border-1px border-[#1460F3]
  196. text-[#1460F3]
  197. w-64px
  198. h-24px
  199. rounded-4px
  200. "
  201. >
  202. Send
  203. </button>
  204. </div>
  205. </el-form-item>
  206. <el-form-item prop="verificationCode" class="mt-4px">
  207. <div class="flex items-center">
  208. <el-input
  209. v-model="ruleForm.verificationCode"
  210. placeholder="Verification Code"
  211. >
  212. </el-input
  213. ><Error
  214. class="w-14px h-14px block ml-10px"
  215. :class="verificationCodeError ? 'block' : 'hidden'"
  216. />
  217. </div>
  218. </el-form-item>
  219. <el-form-item prop="userName" class="mt-4px">
  220. <div class="flex items-center">
  221. <el-input
  222. v-model.trim="ruleForm.userName"
  223. placeholder="User name"
  224. >
  225. </el-input>
  226. </div>
  227. </el-form-item>
  228. <el-form-item prop="password" class="mt-4px">
  229. <div class="flex items-center">
  230. <el-input
  231. v-model.trim="ruleForm.password"
  232. placeholder="Password"
  233. :type="passwordType ? '' : 'password'"
  234. >
  235. </el-input>
  236. <span
  237. v-show="ruleForm.password !== ''"
  238. class="show-password"
  239. :class="passwordType ? 'eye-open' : 'eye-close'"
  240. @click="passwordType = !passwordType"
  241. >
  242. <Eyeopen v-show="passwordType" />
  243. <Eyecolse v-show="!passwordType" /> </span
  244. ><Error
  245. class="w-14px h-14px block ml-10px"
  246. :class="passwordError ? 'block' : 'hidden'"
  247. />
  248. </div>
  249. </el-form-item>
  250. <el-form-item prop="passwordConfirm" class="mt-4px">
  251. <div class="flex items-center">
  252. <el-input
  253. v-model.trim="ruleForm.passwordConfirm"
  254. placeholder="Password confirm"
  255. :type="passwordConfirmType ? '' : 'password'"
  256. >
  257. </el-input>
  258. <span
  259. v-show="ruleForm.password !== ''"
  260. class="show-password"
  261. :class="passwordConfirmType ? 'eye-open' : 'eye-close'"
  262. @click="passwordConfirmType = !passwordConfirmType"
  263. >
  264. <Eyeopen v-show="passwordConfirmType" />
  265. <Eyecolse v-show="!passwordConfirmType" /> </span
  266. ><Error
  267. class="w-14px h-14px block ml-10px"
  268. :class="passwordConfirmError ? 'block' : 'hidden'"
  269. />
  270. </div>
  271. </el-form-item>
  272. <select
  273. name=""
  274. id=""
  275. class="
  276. flex
  277. w-full
  278. !h-40px
  279. mt-4px
  280. border-1px border-[#D9D9D9]
  281. rounded-6px
  282. text-[#808185]
  283. "
  284. >
  285. <option value="" selected disabled>Select Industry</option>
  286. <option value="Architecture">Architecture</option>
  287. <option value="Engineering_Construction">
  288. Engineering & Construction
  289. </option>
  290. <option value="Finance">Finance</option>
  291. <option value="Law_Firms_Legal_Services">
  292. Law Firms & Legal Services
  293. </option>
  294. <option value="Government">Government</option>
  295. <option value="Healthcare">Healthcare</option>
  296. <option value="Aerospace_Defense">Aerospace & Defense</option>
  297. <option value="Automotive_Marine">Automotive & Marine</option>
  298. <option value="Pharmaceuticals">Pharmaceuticals</option>
  299. <option value="Security">Security</option>
  300. <option value="Information_Document_Management">
  301. Information & Document Management
  302. </option>
  303. <option value="Media">Media</option>
  304. <option value="Publishing">Publishing</option>
  305. <option value="Education">Education</option>
  306. <option value="eLearning">eLearning</option>
  307. <option value="Marketing_Services">Marketing Services</option>
  308. <option value="Insurance">Insurance</option>
  309. <option value="HR_Staffing">HR & Staffing</option>
  310. </select>
  311. <el-form-item prop="company" class="mt-4px">
  312. <div class="flex items-center">
  313. <el-input v-model.trim="ruleForm.company" placeholder="Company">
  314. </el-input>
  315. </div>
  316. </el-form-item>
  317. <el-form-item class="mt-4px">
  318. <div class="flex justify-between items-start">
  319. <input type="checkbox" v-model="checked" name="type" />
  320. <span
  321. class="ml-8px text-12px leading-14px"
  322. :class="checkBox ? 'text-[#FF5054]' : ''"
  323. >Read and Agree to POLICY OF PRIVACY and TERMS OF USE</span
  324. >
  325. </div>
  326. </el-form-item>
  327. <div class="flex justify-between">
  328. <button
  329. type="button"
  330. @click="$router.go(-1)"
  331. class="
  332. w-170px
  333. h-48px
  334. text-[#1460F3]
  335. font-bold
  336. border-[#1460F3] border-1px
  337. rounded-8px
  338. hover:opacity-80
  339. "
  340. >
  341. Back
  342. </button>
  343. <button
  344. type="button"
  345. @click="createAccount()"
  346. class="
  347. w-170px
  348. h-48px
  349. bg-[#1460F3]
  350. text-[#fff]
  351. font-bold
  352. rounded-8px
  353. hover:opacity-80
  354. "
  355. >
  356. Create
  357. </button>
  358. </div>
  359. </el-form>
  360. </div>
  361. </div>
  362. </div>
  363. </template>
  364. <style lang="scss" scoped>
  365. .bg {
  366. background: #e7eaee url('@/assets/images/background.png') center center
  367. no-repeat;
  368. }
  369. .el-input::v-deep input {
  370. border: 0px !important;
  371. border-bottom: 1px solid #d9d9d9 !important;
  372. border-radius: 0 !important;
  373. }
  374. .show-password {
  375. display: inline-block;
  376. position: absolute;
  377. right: 23px;
  378. top: 13px;
  379. width: 14px;
  380. height: 14px;
  381. cursor: pointer;
  382. }
  383. .is-error {
  384. display: block;
  385. }
  386. </style>
  387. <style lang="scss">
  388. .el-message--error {
  389. border-color: #ff5054 !important;
  390. height: 36px;
  391. min-width: auto !important;
  392. padding: 12px !important;
  393. }
  394. .el-message--success {
  395. margin-top: 90px !important;
  396. background-color: #373A47 !important;
  397. height: 36px;
  398. min-width: auto !important;
  399. padding: 12px !important;
  400. p{
  401. color: #fff !important;
  402. }
  403. }
  404. </style>