EnterpriseRegistration.vue 41 KB

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