Create.vue 12 KB

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