EnterpriseRegistration.vue 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082
  1. <template>
  2. <div class="register">
  3. <div class="container">
  4. <div class="content">
  5. <div class="content-top">
  6. <h3>企业注册</h3>
  7. <a class="go" @click="goRegister"><i class="fa fa-long-arrow-right"></i>个人注册</a>
  8. </div>
  9. <div v-show="goNextStep">
  10. <el-form :model="enterprise" :rules="rules" ref="enterprise" label-width="100px" class="demo-ruleForm">
  11. <el-form-item prop="mobile">
  12. <el-input v-model="enterprise.mobile" placeholder="手机号码"></el-input>
  13. <span class="tip" v-show="showMsgTip">一个手机可注册多个企业</span>
  14. </el-form-item>
  15. <el-form-item prop="code">
  16. <el-input type="text" v-model="enterprise.code"
  17. v-bind:class="{ active: codeErrorChecked }"
  18. auto-complete="off"
  19. class="msg"
  20. placeholder="短信验证码"></el-input>
  21. <el-button type="primary" class="code"
  22. v-show="sendEnterpriseCode"
  23. @click="getCheckCode"
  24. :disabled="getCodeBtnIsDisabled">获取验证码</el-button>
  25. <el-button type="primary" v-show="!sendEnterpriseCode" class="code code-send">已发送({{enterprise_time}}s)</el-button>
  26. <span v-show="codeErrorChecked" class="codeError-tip">{{codeErrorMsg}}</span>
  27. </el-form-item>
  28. <el-form-item>
  29. <a class="btn finish"
  30. @click="checkPhone">下一步</a>
  31. </el-form-item>
  32. <el-form-item>
  33. <el-checkbox name="type" v-model="checked" @click="checkboxIsChecked"></el-checkbox>
  34. <span class="agree">我已阅读并同意 <a href="/common/agreement">《优软云服务条款》</a></span>
  35. </el-form-item>
  36. </el-form>
  37. </div>
  38. <div v-show="!goNextStep">
  39. <el-form :model="enterprise1" :rules="rules1" ref="enterprise1" label-width="100px" class="demo-ruleForm">
  40. <el-form-item prop="spaceName">
  41. <el-input type="text"
  42. v-model="enterprise1.spaceName"
  43. v-bind:class="{ active: isSpaceNameExist }"
  44. auto-complete="off"
  45. placeholder="企业名称"
  46. ></el-input>
  47. <span class="tip exist" v-show="isSpaceNameExist">
  48. {{spaceNameExitMsg}}
  49. <!--<i class="fa fa-question-circle" aria-hidden="true"-->
  50. <!--v-show="spaceNameExitMsg != '出现异常'"-->
  51. <!--@mouseenter='showPopTip =true'-->
  52. <!--@mouseleave='showPopTip = false'></i>-->
  53. </span>
  54. <!--<div class="pop-tip" @mouseenter='showPopTip =true'-->
  55. <!--@mouseleave='showPopTip = false'> <span class='pop-title' v-show="showPopTip">如果您所属企业的管理员已离职或不再使用优软云,请 <a href="/appeals/changeManagerAppeal">更换管理员</a> </span>-->
  56. <!--</div>-->
  57. </el-form-item>
  58. <el-form-item prop="businessCode">
  59. <el-input type="text"
  60. v-model="enterprise1.businessCode"
  61. v-bind:class="{ active: isBusinessCodeExist }"
  62. auto-complete="off"
  63. placeholder="营业执照号"></el-input>
  64. <span class="tip exist" v-show="isBusinessCodeExist">{{businessCodeExitMsg}}。<a href="https://www.ubtob.com/contact">仍有问题?</a></span>
  65. </el-form-item>
  66. <el-form-item prop="vipName" v-if="!isHasRegister">
  67. <el-input type="text" v-model="enterprise1.vipName" auto-complete="off" placeholder="管理员姓名"></el-input>
  68. </el-form-item>
  69. <el-form-item prop="password" v-if="!isHasRegister">
  70. <el-input type="password" v-model="enterprise1.password" auto-complete="new-password" placeholder="登录密码"></el-input>
  71. <div class="pwd sm" v-show="showMsgTip1">密码强度 <em></em><em></em><em></em><span>弱</span></div>
  72. <div class="pwd md" v-show="showMsgTip2">密码强度 <em></em><em></em><em></em><span>中</span></div>
  73. <div class="pwd lar" v-show="showMsgTip3">密码强度 <em></em><em></em><em></em><span>强</span></div>
  74. <div class="pwd low" v-show="showMsgTip4">密码强度 <em></em><em></em><em></em></div>
  75. </el-form-item>
  76. <el-form-item prop="password" v-if="isHasRegister">
  77. <el-input type="password"
  78. v-model="enterprise1.password"
  79. auto-complete="new-password"
  80. placeholder="密码确认"
  81. v-bind:class="{ correct: passwordChecked }"></el-input>
  82. <span class="sure" v-if="isHasRegister" v-show="phoneIsRegisterTip">该手机号已有优软账号,请输入原账号的登录密码进行校验确认</span>
  83. </el-form-item>
  84. <el-form-item prop="confirm" v-if="!isHasRegister">
  85. <el-input type="password"
  86. auto-complete="new-password"
  87. placeholder="密码确认"
  88. v-bind:class="{active: showPasswordError}"
  89. v-model="enterprise1.confirm"></el-input>
  90. <span class="tip passwordError" v-show="showPasswordError">两次输入密码不一致</span>
  91. </el-form-item>
  92. <el-form-item prop="email" v-if="!isHasEmail">
  93. <el-input type="text"
  94. v-model="enterprise1.email"
  95. auto-complete="off"
  96. placeholder="联系邮箱"
  97. v-bind:class="{active: emailHasRegister}"></el-input>
  98. <span class="codeError-tip" v-if="emailHasRegister">该邮箱已被注册</span>
  99. </el-form-item>
  100. <a class="btn finish" @click="sureRegister">确认注册</a>
  101. </el-form-item>
  102. <el-form-item>
  103. <el-checkbox name="type" v-model="checked" @click="checkboxIsChecked"></el-checkbox>
  104. <span class="agree">我已阅读并同意 <a href="/common/agreement">《优软云服务条款》</a></span>
  105. </el-form-item>
  106. </el-form>
  107. </div>
  108. </div>
  109. <div class="login">已有账号?<a :href="returnLogin">立即登录</a></div>
  110. <loading v-show="isShowLoading"/>
  111. </div>
  112. <!--尾部-->
  113. <div v-html="loginStyle.footUrl" class="footer"></div>
  114. </div>
  115. </template>
  116. <script>
  117. import Loading from '~components/common/loading/Loading.vue'
  118. export default {
  119. name: 'EnterpriseRegistration',
  120. components: {
  121. Loading
  122. },
  123. data () {
  124. // 企业注册第一步
  125. var validateMobile = (rule, value, callback) => {
  126. if (value === '') {
  127. callback(new Error('请填写正确的手机号'))
  128. this.showMsgTip = false
  129. this.getCodeBtnIsDisabled = true
  130. this.mobileChecked = false
  131. } else {
  132. if (this.enterprise.mobile !== '') {
  133. var reg = /^1[0-9]{10}$/
  134. if (!reg.test(value)) {
  135. callback(new Error('请填写正确的手机号'))
  136. this.showMsgTip = false
  137. this.getCodeBtnIsDisabled = true
  138. this.mobileChecked = false
  139. } else {
  140. this.getCodeBtnIsDisabled = false
  141. this.showMsgTip = false
  142. this.mobileChecked = true
  143. }
  144. }
  145. callback()
  146. }
  147. }
  148. var validateCode = (rule, value, callback) => {
  149. if (value === '') {
  150. callback(new Error('请填写正确的验证码'))
  151. this.codeErrorChecked = false
  152. this.codeChecked = false
  153. } else {
  154. if (this.enterprise.mobile === '') {
  155. callback(new Error('请先填写正确的手机号'))
  156. } else {
  157. if (this.token) {
  158. if (this.enterprise.code.length === 6) {
  159. let param = new FormData()
  160. param.append('mobile', this.enterprise.mobile)
  161. param.append('code', this.enterprise.code)
  162. param.append('token', this.token)
  163. let config = {
  164. headers: {'Content-Type': 'multipart/form-data'}
  165. }
  166. this.$http.post(`/sso/userspace/register/checkCode`, param, config)
  167. .then(response => {
  168. if (response.data.success) {
  169. this.codeChecked = true
  170. this.codeErrorChecked = false
  171. } else {
  172. this.codeErrorChecked = true
  173. this.codeChecked = false
  174. return Promise.reject(response.data)
  175. }
  176. }).catch(err => {
  177. this.codeErrorChecked = true
  178. this.codeErrorMsg = err.errMsg
  179. })
  180. } else {
  181. callback(new Error('请输入正确的验证码'))
  182. this.codeChecked = false
  183. this.codeErrorChecked = false
  184. }
  185. } else {
  186. callback(new Error('请先获取验证码'))
  187. this.codeChecked = false
  188. this.codeErrorChecked = false
  189. }
  190. }
  191. callback()
  192. }
  193. }
  194. var validateCodeIsEmpty = (rule, value, callback) => {
  195. if (value === '') {
  196. callback(new Error('请填写正确的验证码'))
  197. this.codeErrorChecked = false
  198. this.codeChecked = false
  199. } else {
  200. if (this.enterprise.mobile === '') {
  201. callback(new Error('请先填写正确的手机号'))
  202. } else {
  203. if (this.token) {
  204. if (this.enterprise.code.length === 6) {
  205. let param = new FormData()
  206. param.append('mobile', this.enterprise.mobile)
  207. param.append('code', this.enterprise.code)
  208. param.append('token', this.token)
  209. let config = {
  210. headers: {'Content-Type': 'multipart/form-data'}
  211. }
  212. this.$http.post(`/sso/userspace/register/checkCode`, param, config)
  213. .then(response => {
  214. if (response.data.success) {
  215. this.codeChecked = true
  216. this.codeErrorChecked = false
  217. } else {
  218. this.codeErrorChecked = true
  219. this.codeChecked = false
  220. return Promise.reject(response.data)
  221. }
  222. }).catch(err => {
  223. this.codeErrorChecked = true
  224. this.codeErrorMsg = err.errMsg
  225. })
  226. } else {
  227. callback(new Error('请输入正确的验证码'))
  228. this.codeChecked = false
  229. this.codeErrorChecked = false
  230. }
  231. } else {
  232. callback(new Error('请先获取验证码'))
  233. this.codeChecked = false
  234. this.codeErrorChecked = false
  235. }
  236. }
  237. callback()
  238. }
  239. }
  240. // 企业注册第二步
  241. var validateSpaceName = (rule, value, callback) => {
  242. if (value === '') {
  243. callback(new Error('请填写正确的企业名称'))
  244. this.spaceNameChecked = false
  245. this.isSpaceNameExist = false
  246. } else {
  247. if (this.enterprise1.spaceName !== '') {
  248. if (value.length > 20) {
  249. callback(new Error('输入长度过长,20个字符以内'))
  250. this.spaceNameChecked = false
  251. } else {
  252. this.$http.get(`/api/userspace/checkSpaceName`, {params: {spaceName: this.enterprise1.spaceName}})
  253. .then(response => {
  254. if (response.data.success) {
  255. this.spaceNameChecked = true
  256. this.isSpaceNameExist = false
  257. } else {
  258. this.spaceNameChecked = false
  259. this.isSpaceNameExist = true
  260. return Promise.reject(response.data)
  261. }
  262. }).catch(err => {
  263. this.spaceNameExitMsg = err.errMsg
  264. // this.$message.error(err.errMsg)
  265. })
  266. }
  267. }
  268. callback()
  269. }
  270. }
  271. var validateBusinessCode = (rule, value, callback) => {
  272. if (value === '') {
  273. callback(new Error('请填写正确的营业执照号'))
  274. this.businessCodeChecked = false
  275. this.isBusinessCodeExist = false
  276. } else {
  277. if (this.enterprise1.businessCode !== '') {
  278. let reg = /^[A-Za-z0-9]+$/
  279. if (reg.test(value)) {
  280. if (value.length > 20) {
  281. callback(new Error('输入长度过长,20个字符以内'))
  282. this.businessCodeChecked = false
  283. this.isBusinessCodeExist = false
  284. } else {
  285. this.$http.get(`/api/userspace/checkBusinessCode`, {params: {businessCode: this.enterprise1.businessCode}})
  286. .then(response => {
  287. if (response.data.success) {
  288. this.businessCodeChecked = true
  289. this.isBusinessCodeExist = false
  290. } else {
  291. this.businessCodeChecked = false
  292. this.isBusinessCodeExist = true
  293. return Promise.reject(response.data)
  294. }
  295. }).catch(err => {
  296. this.businessCodeExitMsg = err.errMsg
  297. // this.$message.error(err.errMsg)
  298. })
  299. }
  300. } else {
  301. callback(new Error('请填写正确的营业执照号'))
  302. this.businessCodeChecked = false
  303. this.isBusinessCodeExist = false
  304. }
  305. }
  306. callback()
  307. }
  308. }
  309. var validateVipName = (rule, value, callback) => {
  310. if (this.isHasRegister) {
  311. this.vipNameChecked = true
  312. } else {
  313. if (value === '') {
  314. callback(new Error('请填写正确的管理员姓名'))
  315. this.vipNameChecked = false
  316. } else {
  317. if (this.enterprise1.vipName !== '') {
  318. if (value.length > 20) {
  319. callback(new Error('输入长度过长,20个字符以内'))
  320. this.vipNameChecked = false
  321. } else {
  322. this.vipNameChecked = true
  323. }
  324. }
  325. callback()
  326. }
  327. }
  328. }
  329. var validatePassword = (rule, value, callback) => {
  330. if (this.enterprise1.password !== '') {
  331. if (value.length <= 20 && value.length >= 8) {
  332. var reg1 = /^(?=.{8,20})(((?=.*[0-9])(?=.*[a-z])(?=.*[A-Z]))|((?=.*[0-9])((?=.*[a-zA-Z]))(?=.*[^a-zA-Z0-9]))).*$/
  333. var reg2 = /^(?=.{8,20})(((?=.*[0-9])(?=.*[a-z]))|((?=.*[0-9])(?=.*[A-Z]))).*$/
  334. if (reg1.test(value)) {
  335. // callback(new Error('密码强度强'))
  336. this.showMsgTip3 = true
  337. this.showMsgTip2 = false
  338. this.showMsgTip1 = false
  339. this.showMsgTip4 = false
  340. this.passwordChecked = true
  341. } else if (reg2.test(value)) {
  342. // callback(new Error('密码强度中'))
  343. this.showMsgTip2 = true
  344. this.showMsgTip3 = false
  345. this.showMsgTip1 = false
  346. this.showMsgTip4 = false
  347. this.passwordChecked = true
  348. } else {
  349. this.showMsgTip1 = true
  350. this.showMsgTip3 = false
  351. this.showMsgTip2 = false
  352. this.showMsgTip4 = false
  353. this.passwordChecked = false
  354. }
  355. } else {
  356. this.showMsgTip3 = false
  357. this.showMsgTip2 = false
  358. this.showMsgTip1 = false
  359. this.showMsgTip4 = true
  360. this.passwordChecked = false
  361. }
  362. }
  363. callback()
  364. }
  365. var validatePasswordTip = (rule, value, callback) => {
  366. if (this.isHasRegister) {
  367. if (value === '') {
  368. callback(new Error('请输入密码'))
  369. this.passwordChecked = false
  370. this.phoneIsRegisterTip = false
  371. } else {
  372. this.passwordChecked = true
  373. }
  374. } else {
  375. if (value === '') {
  376. callback(new Error('请输入密码'))
  377. this.passwordChecked = false
  378. } else {
  379. if (this.enterprise1.password !== '') {
  380. if (value.length <= 20 && value.length >= 8) {
  381. var reg1 = /^(?=.{8,20})(((?=.*[0-9])(?=.*[a-z])(?=.*[A-Z]))|((?=.*[0-9])((?=.*[a-zA-Z]))(?=.*[^a-zA-Z0-9]))).*$/
  382. var reg2 = /^(?=.{8,20})(((?=.*[0-9])(?=.*[a-z]))|((?=.*[0-9])(?=.*[A-Z]))).*$/
  383. if (reg1.test(value)) {
  384. this.passwordChecked = true
  385. } else if (reg2.test(value)) {
  386. this.passwordChecked = true
  387. } else {
  388. callback(new Error('密码须为8-20字符的英文、数字混合'))
  389. this.passwordChecked = false
  390. }
  391. } else {
  392. callback(new Error('密码须为8-20字符的英文、数字混合'))
  393. this.passwordChecked = false
  394. }
  395. if (this.enterprise1.confirm !== '') {
  396. if (value !== this.enterprise1.confirm) {
  397. this.showPasswordError = true
  398. // callback(new Error('两次输入密码不一致!'))
  399. this.passwordConfirmChecked = false
  400. } else {
  401. this.passwordConfirmChecked = true
  402. this.showPasswordError = false
  403. callback()
  404. }
  405. }
  406. }
  407. callback()
  408. }
  409. }
  410. }
  411. var validateConfirm = (rule, value, callback) => {
  412. if (this.isHasRegister) {
  413. this.passwordConfirmChecked = true
  414. } else {
  415. if (value === '') {
  416. callback(new Error('请再次输入密码'))
  417. this.passwordConfirmChecked = false
  418. this.showPasswordError = false
  419. } else if (value !== this.enterprise1.password) {
  420. // callback(new Error('两次输入密码不一致!'))
  421. this.showPasswordError = true
  422. this.passwordConfirmChecked = false
  423. } else {
  424. this.passwordConfirmChecked = true
  425. this.showPasswordError = false
  426. }
  427. }
  428. callback()
  429. }
  430. var validateEmail = (rule, value, callback) => {
  431. if (this.isHasEmail) {
  432. this.emailChecked = true
  433. this.emailHasRegister = false
  434. } else {
  435. if (this.enterprise1.email) {
  436. var reg = /^([\w-])+(\.\w+)*@([\w-])+((\.\w{2,3}){1,3})$/
  437. if (!reg.test(value)) {
  438. callback(new Error('请输入正确的邮箱地址格式'))
  439. this.emailChecked = false
  440. this.emailHasRegister = false
  441. } else {
  442. this.$http.get(`/api/user/checkEmail`, {params: {email: this.enterprise1.email}})
  443. .then(response => {
  444. if (response.data.hasRegister) {
  445. this.emailChecked = false
  446. this.emailHasRegister = true
  447. } else {
  448. this.emailChecked = true
  449. this.emailHasRegister = false
  450. return Promise.reject(response.data)
  451. }
  452. }).catch(err => {
  453. this.$message.error(err.errMsg)
  454. })
  455. }
  456. callback()
  457. } else {
  458. this.emailChecked = true
  459. this.emailHasRegister = false
  460. }
  461. }
  462. }
  463. return {
  464. // 企业注册第一步
  465. enterprise: {
  466. mobile: '',
  467. code: ''
  468. },
  469. // 企业注册第二步
  470. enterprise1: {
  471. spaceName: '',
  472. businessCode: '',
  473. vipName: '',
  474. password: '',
  475. confirm: '',
  476. email: ''
  477. },
  478. businessCodeExitMsg: '',
  479. spaceNameExitMsg: '',
  480. showPopTip: false,
  481. showPasswordError: false,
  482. isShowLoading: false,
  483. codeErrorMsg: '',
  484. checked: true,
  485. getCodeBtnIsDisabled: true,
  486. mobileChecked: false,
  487. codeChecked: false,
  488. showMsgTip: true,
  489. sendEnterpriseCode: true,
  490. codeErrorChecked: false,
  491. enterprise_time: 0,
  492. showMsgTip1: false,
  493. showMsgTip2: false,
  494. showMsgTip3: false,
  495. showMsgTip4: false,
  496. spaceNameChecked: false,
  497. businessCodeChecked: false,
  498. vipNameChecked: false,
  499. passwordChecked: false,
  500. passwordConfirmChecked: false,
  501. emailChecked: true,
  502. isHasRegister: false,
  503. isHasEmail: false,
  504. goNextStep: true,
  505. phoneIsRegisterTip: true,
  506. isSpaceNameExist: false,
  507. isBusinessCodeExist: false,
  508. emailHasRegister: false,
  509. queryLink: '',
  510. appId: '',
  511. returnLogin: '',
  512. // 企业注册第一步
  513. rules: {
  514. mobile: [
  515. {validator: validateMobile, trigger: 'blur'}
  516. ],
  517. code: [
  518. {validator: validateCode, trigger: 'change'},
  519. {validator: validateCodeIsEmpty, trigger: 'blur'}
  520. ]
  521. },
  522. // 企业注册第二步
  523. rules1: {
  524. spaceName: [
  525. {validator: validateSpaceName, trigger: 'blur'}
  526. ],
  527. businessCode: [
  528. {validator: validateBusinessCode, trigger: 'blur'}
  529. ],
  530. vipName: [
  531. {validator: validateVipName, trigger: 'blur'}
  532. ],
  533. password: [
  534. {validator: validatePassword, trigger: 'change'},
  535. {validator: validatePasswordTip, trigger: 'blur'}
  536. ],
  537. confirm: [
  538. {validator: validateConfirm, trigger: 'blur'}
  539. ],
  540. email: [
  541. {validator: validateEmail, trigger: 'change'}
  542. ]
  543. }
  544. }
  545. },
  546. computed: {
  547. loginStyle () {
  548. return this.$store.state.login.loginStyle.data.content
  549. }
  550. },
  551. mounted () {
  552. // 获取链接
  553. this.$nextTick(() => {
  554. this.getUrl()
  555. })
  556. },
  557. methods: {
  558. // 获取链接
  559. getUrl () {
  560. var url = window.location.search
  561. var origin = window.location.origin
  562. this.returnLogin = origin + url
  563. var request = {}
  564. if (url.indexOf('?' !== -1)) {
  565. var str = url.substr(1)
  566. var strs = str.split('&')
  567. this.queryLink = str
  568. for (var i = 0; i < strs.length; i++) {
  569. request[strs[i].split('=')[0]] = decodeURI(strs[i].split('=')[1])
  570. }
  571. }
  572. this.appId = request['appId'] || ''
  573. },
  574. // 注册
  575. goRegister () {
  576. console.log(this.queryLink)
  577. window.location.href = `/register/personalRegistration?${this.queryLink}`
  578. },
  579. // 我同意是否被选中
  580. checkboxIsChecked () {
  581. this.checked = !this.checked
  582. },
  583. // 获取校验码
  584. getCheckCode () {
  585. this.isShowLoading = true
  586. this.$http.get(`/sso/userspace/register/checkCode`, {params: {mobile: this.enterprise.mobile}})
  587. .then(response => {
  588. this.isShowLoading = false
  589. if (response.data) {
  590. this.token = response.data.token
  591. if (this.token !== '') {
  592. this.$message({
  593. message: '验证码已经发送到您的手机,请注意查收',
  594. type: 'success'
  595. })
  596. this.sendEnterpriseCode = false
  597. this.enterprise_time = 60
  598. var enterpriseTime = setInterval(() => {
  599. this.enterprise_time--
  600. if (this.enterprise_time <= 0) {
  601. this.sendEnterpriseCode = true
  602. clearInterval(enterpriseTime)
  603. }
  604. }, 1000)
  605. }
  606. } else {
  607. return Promise.reject(response.data)
  608. }
  609. }).catch(err => {
  610. this.isShowLoading = false
  611. this.$message.error(err.errMsg)
  612. })
  613. },
  614. // 验证手机
  615. checkPhone () {
  616. if (this.mobileChecked && this.codeChecked && this.checked) {
  617. this.isShowLoading = true
  618. let param = new FormData()
  619. param.append('mobile', this.enterprise.mobile)
  620. param.append('code', this.enterprise.code)
  621. param.append('appId', this.appId)
  622. param.append('token', this.token)
  623. let config = {
  624. headers: {'Content-Type': 'multipart/form-data'}
  625. }
  626. this.$http.post('/sso/userspace/register/checkAdminTel', param, config)
  627. .then(response => {
  628. this.isShowLoading = false
  629. if (response.data.success) {
  630. this.goNextStep = false
  631. if (response.data.content.hasRegister) {
  632. this.isHasRegister = true
  633. if (response.data.content.hasEmail) {
  634. this.isHasEmail = true
  635. } else {
  636. this.isHasEmail = false
  637. }
  638. } else {
  639. this.isHasRegister = false
  640. this.isHasEmail = false
  641. }
  642. } else {
  643. this.goNextStep = true
  644. return Promise.reject(response.data)
  645. }
  646. }).catch(err => {
  647. this.$message.error(err.errMsg)
  648. this.isShowLoading = false
  649. this.enterprise_time = 0
  650. })
  651. } else {
  652. if (!this.enterprise.mobile) {
  653. this.$message.error('手机号不能为空')
  654. } else if (!this.mobileChecked) {
  655. this.$message.error('手机号输入有误,请按提示重新输入')
  656. } else if (!this.token) {
  657. this.$message.error('请先获取验证码')
  658. } else if (!this.enterprise.code) {
  659. this.$message.error('验证码不能为空')
  660. } else if (!this.codeChecked) {
  661. this.$message.error('验证码输入有误,请按提示重新输入')
  662. } else if (!this.checked) {
  663. this.$message.error('您对阅读条款未做勾选')
  664. }
  665. }
  666. },
  667. // 确认注册
  668. sureRegister () {
  669. if (!this.isHasRegister) {
  670. if (this.spaceNameChecked && this.businessCodeChecked && this.vipNameChecked && this.passwordChecked && this.passwordConfirmChecked && this.emailChecked && this.checked) {
  671. this.submitRegister()
  672. } else {
  673. if (!this.enterprise1.spaceName) {
  674. this.$message.error('企业名不能为空')
  675. } else if (!this.spaceNameChecked) {
  676. this.$message.error('企业名称输入有误,请按提示重新输入')
  677. } else if (!this.enterprise1.businessCode) {
  678. this.$message.error('营业执照号不能为空')
  679. } else if (!this.businessCodeChecked) {
  680. this.$message.error('营业执照号输入有误,请按提示重新输入')
  681. } else if (!this.enterprise1.vipName) {
  682. this.$message.error('管理员姓名不能为空')
  683. } else if (!this.vipNameChecked) {
  684. this.$message.error('管理员姓名输入有误,请按提示重新输入')
  685. } else if (!this.enterprise1.password) {
  686. this.$message.error('密码不能为空')
  687. } else if (!this.passwordChecked) {
  688. this.$message.error('密码输入有误,请按提示重新输入')
  689. } else if (!this.enterprise1.confirm) {
  690. this.$message.error('请再次输入密码')
  691. } else if (this.enterprise1.password !== this.enterprise1.confirm) {
  692. this.$message.error('请确认两次填写密码是否一致')
  693. } else if (this.enterprise1.email && !this.emailChecked) {
  694. this.$message.error('邮箱输入有误,请按提示重新输入')
  695. } else if (!this.checked) {
  696. this.$message.error('您对阅读条款未做勾选')
  697. }
  698. }
  699. } else {
  700. if (this.isHasEmail) {
  701. if (this.spaceNameChecked && this.businessCodeChecked && this.passwordChecked && this.checked) {
  702. this.submitRegister()
  703. } else {
  704. if (!this.enterprise1.spaceName) {
  705. this.$message.error('企业名不能为空')
  706. } else if (!this.spaceNameChecked) {
  707. this.$message.error('企业名称输入有误,请按提示重新输入')
  708. } else if (!this.enterprise1.businessCode) {
  709. this.$message.error('营业执照号不能为空')
  710. } else if (!this.businessCodeChecked) {
  711. this.$message.error('营业执照号输入有误,请按提示重新输入')
  712. } else if (!this.enterprise1.password) {
  713. this.$message.error('密码不能为空')
  714. } else if (!this.checked) {
  715. this.$message.error('您对阅读条款未做勾选')
  716. }
  717. }
  718. } else {
  719. if (this.spaceNameChecked && this.businessCodeChecked && this.passwordChecked && this.emailChecked && this.checked) {
  720. this.submitRegister()
  721. } else {
  722. if (!this.enterprise1.spaceName) {
  723. this.$message.error('企业名不能为空')
  724. } else if (!this.spaceNameChecked) {
  725. this.$message.error('企业名称输入有误,请按提示重新输入')
  726. } else if (!this.enterprise1.businessCode) {
  727. this.$message.error('营业执照号不能为空')
  728. } else if (!this.businessCodeChecked) {
  729. this.$message.error('营业执照号输入有误,请按提示重新输入')
  730. } else if (!this.enterprise1.password) {
  731. this.$message.error('密码不能为空')
  732. } else if (this.enterprise1.email && !this.emailChecked) {
  733. this.$message.error('邮箱输入有误,请按提示重新输入')
  734. } else if (!this.checked) {
  735. this.$message.error('您对阅读条款未做勾选')
  736. }
  737. }
  738. }
  739. }
  740. },
  741. submitRegister () {
  742. this.isShowLoading = true
  743. let param = new FormData()
  744. param.append('spaceName', this.enterprise1.spaceName)
  745. param.append('businessCode', this.enterprise1.businessCode)
  746. param.append('vipName', this.enterprise1.vipName || '')
  747. param.append('password', this.enterprise1.password)
  748. param.append('email', this.enterprise1.email || '')
  749. param.append('appId', this.$store.state.option.appId)
  750. param.append('inviteSpaceUU', this.$store.state.option.inviteSpaceUU)
  751. param.append('inviteUserUU', this.$store.state.option.inviteUserUU)
  752. param.append('invitationTime', this.$store.state.option.invitationTime)
  753. let config = {
  754. headers: {'Content-Type': 'multipart/form-data'}
  755. }
  756. this.$http.post('/sso/userspace/register', param, config)
  757. .then(response => {
  758. this.isShowLoading = false
  759. if (response.data.success) {
  760. if (response.data.content) {
  761. let param = response.data.content.data
  762. let a = ''
  763. for (let n in param) {
  764. a += (n + '=' + encodeURIComponent(param[n]) + '&')
  765. }
  766. let params = a.substr(0, a.length - 1)
  767. this.isShowLoading = true
  768. if (response.data.content.currentUrl) {
  769. this.$jsonp(`${response.data.content.currentUrl}?${params}`, {
  770. name: 'successCallback',
  771. timeout: 3000
  772. }, (err, data) => {
  773. if (err) {
  774. this.$message.error('注册成功,请点击下方“立即登录”完成登录')
  775. this.isShowLoading = false
  776. throw err
  777. } else {
  778. this.loginOther(response, params)
  779. }
  780. })
  781. } else {
  782. this.loginOther(response, params, 3000)
  783. }
  784. } else {
  785. window.location.href = '/overRegister/overEnterprise'
  786. }
  787. } else {
  788. return Promise.reject(response.data)
  789. }
  790. }).catch(err => {
  791. this.isShowLoading = false
  792. this.$message.error(err.errMsg)
  793. })
  794. },
  795. getJsonp: function (url, timeout = 500) {
  796. return new Promise((resolve, reject) => {
  797. this.$jsonp(url, {
  798. name: 'successCallback',
  799. timeout: timeout
  800. }, function (err, data) {
  801. if (err) {
  802. reject(err)
  803. throw err
  804. } else {
  805. resolve(data)
  806. }
  807. })
  808. })
  809. },
  810. crossAfter (url) {
  811. try {
  812. window.location.href = url
  813. } catch (err) {
  814. console.log(err)
  815. }
  816. },
  817. loginOther (response, a, timeout) {
  818. const crossAfter = this.crossAfter
  819. let promises = []
  820. for (let i in response.data.content.loginUrls) {
  821. promises.push(this.getJsonp(`${response.data.content.loginUrls[i]}?${a}`))
  822. }
  823. let returnUrl = decodeURIComponent(this.$route.query.returnURL)
  824. Promise.all(promises).then(() => {
  825. crossAfter(returnUrl || 'http://www.ubtob.com', timeout)
  826. }).catch(() => {
  827. crossAfter(returnUrl || 'http://www.ubtob.com', timeout)
  828. })
  829. }
  830. }
  831. }
  832. </script>
  833. <style lang="scss" scoped>
  834. .register {
  835. margin: 0 auto;
  836. width: 100%;
  837. background: #eee;
  838. .container{
  839. padding-top: 50px;
  840. margin: 0 auto;
  841. width: 980px;
  842. text-align: center;
  843. .content{
  844. padding: 0 50px;
  845. margin: 50px auto 0;
  846. width: 100%;
  847. text-align: center;
  848. background: #fff;
  849. .content-top{
  850. position: relative;
  851. height: 80px;
  852. line-height: 80px;
  853. border-bottom: 1px solid #dcdcdc;
  854. h3{
  855. font-family: 'SimHei';
  856. font-size: 24px;
  857. color: #000;
  858. }
  859. a.go{
  860. position: absolute;
  861. top: 0;
  862. right: 0;
  863. font-size: 14px;
  864. i{
  865. margin-right: 3px;
  866. }
  867. }
  868. }
  869. form {
  870. padding-bottom: 44px;
  871. margin-top: 35px;
  872. span.sure{
  873. position: absolute;
  874. top: 0;
  875. right: -271px;
  876. width: 250px;
  877. text-align: left;
  878. line-height: 21px;
  879. font-size: 13px;
  880. color: #8c8c8c;
  881. }
  882. span.codeError-tip{
  883. position: absolute;
  884. top: 3px;
  885. left: 378px;
  886. width: 200px;
  887. text-align: left;
  888. color: #ff4949;
  889. font-size: 12px;
  890. }
  891. input{
  892. padding: 0 0 0 18px;
  893. width: 360px;
  894. height: 44px;
  895. line-height: 44px;
  896. font-size: 14px;
  897. color: #000;
  898. border-radius: 0;
  899. }
  900. .pwd {
  901. margin: 6px 0 -15px 0;
  902. text-align: left;
  903. font-size: 13px;
  904. em{
  905. display: inline-block;
  906. margin: 0 8px 2px 0;
  907. width: 24px;
  908. height: 6px;
  909. &:first-child{
  910. margin-left: 10px;
  911. }
  912. }
  913. span{
  914. margin-left: 10px;
  915. font-size: 13px;
  916. }
  917. }
  918. .pwd.sm{
  919. color: #8c8c8c;
  920. em {
  921. background: #bfbfbf;
  922. &:first-child{
  923. background: #ff4e00;
  924. }
  925. }
  926. span{
  927. color: #ff4e00;
  928. }
  929. }
  930. .pwd.md{
  931. color: #8c8c8c;
  932. em {
  933. background: #22ac38;
  934. &:nth-child(3){
  935. background: #bfbfbf;
  936. }
  937. }
  938. span{
  939. color: #22ac38;
  940. }
  941. }
  942. .pwd.lar{
  943. color: #8c8c8c;
  944. em {
  945. background: #00a0e9;
  946. }
  947. span{
  948. color: #00a0e9;
  949. }
  950. }
  951. .pwd.low{
  952. color: #8c8c8c;
  953. em {
  954. background: #bfbfbf;
  955. }
  956. span{
  957. color: #00a0e9;
  958. }
  959. }
  960. span.tip{
  961. position: absolute;
  962. top: 0;
  963. right: -165px;
  964. font-size: 13px;
  965. color: #8c8c8c;
  966. }
  967. span.tip.exist{
  968. top: 5px;
  969. left: 380px;
  970. width: 250px;
  971. line-height: 18px;
  972. text-align: left;
  973. a{
  974. color: #2d8cf0;
  975. &:hover{
  976. color: #f44336;
  977. }
  978. }
  979. i.fa {
  980. font-size: 14px;
  981. color: #666;
  982. cursor: pointer;
  983. }
  984. }
  985. div.pop-tip{
  986. position: absolute;
  987. top: 39px;
  988. left: 470px;
  989. z-index: 10;
  990. span.pop-title{
  991. display: inline-block;
  992. padding: 5px;
  993. z-index:100;
  994. width: 150px;
  995. height: 55px;
  996. line-height: 16px;
  997. text-align: left;
  998. font-size: 12px;
  999. color: #8c8c8c;
  1000. background: #fff;
  1001. box-shadow: 0 0 5px rgba(0,0,0,.5);
  1002. -moz-box-shadow: 0 0 5px rgba(0,0,0,.5);
  1003. -o-box-shadow: 0 0 5px rgba(0,0,0,.5);
  1004. -webkit-box-shadow: 0 0 5px rgba(0,0,0,.5);
  1005. border-radius: 5px;
  1006. }
  1007. }
  1008. span.tip.passwordError{
  1009. position: absolute;
  1010. top: 3px;
  1011. left: 380px;
  1012. width: 200px;
  1013. text-align: left;
  1014. color: #ff4949;
  1015. font-size: 12px;
  1016. }
  1017. input.msg{
  1018. float: left;
  1019. width: 210px;
  1020. }
  1021. span.msg{
  1022. float: right;
  1023. width: 130px;
  1024. height: 44px;
  1025. line-height: 44px;
  1026. font-size: 14px;
  1027. color: #5a5a5a;
  1028. background: #f4f4f4;
  1029. border: 1px solid #dcdcdc;
  1030. cursor: pointer;
  1031. }
  1032. span.msg.send{
  1033. background: #d2d2d2;
  1034. color: #fff;
  1035. }
  1036. input[type='checkbox']{
  1037. margin: 0 14px 0 55px;
  1038. float: left;
  1039. width: 16px;
  1040. height: 16px;
  1041. }
  1042. span.agree{
  1043. float: left;
  1044. margin: 1px 0 0 10px;
  1045. font-size: 14px;
  1046. color: #8b8b8b;
  1047. a{
  1048. color: #0076ad;
  1049. }
  1050. }
  1051. .form-group.agree{
  1052. margin: 20px auto 0 !important;
  1053. }
  1054. .btn {
  1055. margin: 34px 0 16px 0;
  1056. width: 360px;
  1057. height: 44px;
  1058. line-height: 44px;
  1059. font-size: 16px;
  1060. color: #fff;
  1061. background: #0076AD;
  1062. border-radius: 3px;
  1063. }
  1064. }
  1065. }
  1066. .login{
  1067. margin-top: 20px;
  1068. font-size: 14px;
  1069. color: #8c8c8c;
  1070. a{
  1071. font-size: 14px;
  1072. color: #0076ad;
  1073. }
  1074. }
  1075. }
  1076. }
  1077. .footer{
  1078. padding: 50px 0;
  1079. }
  1080. </style>