index.vue 37 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025
  1. <template>
  2. <div class="business-enter">
  3. <div class="banner"></div>
  4. <div class="section-01">
  5. <img v-if="goNextStep" src="/images/bussinessEnter/banner0201.png" style="height:640px;">
  6. <img v-else src="/images/bussinessEnter/banner02.png" style="height:820px;">
  7. <div class="register">
  8. <div class="reg-box">
  9. <div v-show="goNextStep" class="reg-content">
  10. <div class="form-group">
  11. <input type="text" class="form-control phone"
  12. placeholder="手机号码"
  13. v-model="enterprise.mobile"
  14. maxlength="11"
  15. :class="{'err': !mobileChecked}"
  16. @blur="checkMobile(enterprise.mobile)"/>
  17. <span class="help-list" v-text="mobileErrMsg"></span>
  18. </div>
  19. <div class="form-group">
  20. <input type="text" class="form-control code"
  21. placeholder="短信验证码"
  22. v-model="enterprise.code"
  23. :class="{'err': !codeChecked}"
  24. @change="checkMsgCode(enterprise.code)"/>
  25. <template>
  26. <el-popover
  27. placement="top"
  28. width="300"
  29. v-model="visible">
  30. <div class="valid-code">
  31. <input type="text"
  32. v-model="enterprise.ImgCode">
  33. <img id="captchaImage2" alt="">
  34. <span @click="getImgCode">看不清换一张</span>
  35. </div>
  36. <div class="valid-btn">
  37. <el-button size="mini" type="text" @click="visible = false">取消</el-button>
  38. <el-button type="primary" size="mini" @click="getCode">确定</el-button>
  39. </div>
  40. <button class="code-btn"
  41. slot="reference"
  42. v-show="sendEnterpriseCode"
  43. :disabled="!mobileChecked">获取验证码</button>
  44. </el-popover>
  45. </template>
  46. <button class="code-btn" v-show="!sendEnterpriseCode">已发送({{enterprise_time}}s)</button>
  47. <span class="help-list" v-text="codeErrMsg"></span>
  48. </div>
  49. <div class="form-group">
  50. <label class="check-box-wrap">
  51. <input type="checkbox"
  52. id="check-box"
  53. v-model="isRead"
  54. :checked="isRead">
  55. <label class="agr" for="check-box">我已阅读并同意<a :href="`${address}/common/agreement`" target="_blank">《优软云服务条款》</a></label>
  56. </label>
  57. </div>
  58. <div class="form-group">
  59. <span class="next-bottom" @click="nextStep">下一步</span>
  60. </div>
  61. </div>
  62. <div v-show="!goNextStep" class="reg-content">
  63. <div class="form-group">
  64. <input type="text" class="form-control"
  65. placeholder="企业名称"
  66. v-model="enterprise.spaceName"
  67. maxlength="20"
  68. :class="{'err': !spaceNameChecked}"
  69. @blur="checkSpaceName(enterprise.spaceName)"/>
  70. <span class="help-list" v-text="spaceNameErrMsg"></span>
  71. </div>
  72. <div class="form-group">
  73. <input type="text" class="form-control"
  74. placeholder="营业执照号"
  75. v-model="enterprise.businessCode"
  76. maxlength="20"
  77. :class="{'err': !businessCodeChecked}"
  78. @blur="checkBusinessCode(enterprise.businessCode)"/>
  79. <span class="help-list" v-text="businessCodeErrMsg"></span>
  80. </div>
  81. <div class="form-group" v-if="!isHasRegister">
  82. <input type="text" class="form-control"
  83. placeholder="管理员姓名"
  84. v-model="enterprise.vipName"
  85. maxlength="20"
  86. :class="{'err': !vipNameChecked}"
  87. @blur="checkVipName(enterprise.vipName)"/>
  88. <span class="help-list" v-text="vipNameErrMsg"></span>
  89. </div>
  90. <div class="form-group" v-if="!isHasRegister">
  91. <input type="password" class="form-control"
  92. placeholder="登录密码"
  93. v-model="enterprise.password"
  94. maxlength="20"
  95. :class="{'err': !passwordChecked}"
  96. @blur="checkPassword(enterprise.password)"
  97. @input="passwordStrength(enterprise.password)"/>
  98. <span class="help-list" v-text="passwordErrMsg"></span>
  99. </div>
  100. <div v-if="enterprise.password">
  101. <div class="pwd" v-if="!isHasRegister"
  102. :class="{sm: strength === '弱', md: strength === '中', lar: strength === '强', low: strength === ''}">
  103. 密码强度 <em></em><em></em><em></em>
  104. <span v-text="strength === '弱' ? '弱' : strength === '中' ? '中' : strength === '强' ? '强' : ''">弱</span>
  105. </div>
  106. </div>
  107. <div class="form-group" v-if="isHasRegister">
  108. <input type="password" class="form-control"
  109. placeholder="密码确认"
  110. v-model="enterprise.password"
  111. maxlength="20"
  112. :class="{'err': !passwordChecked}"
  113. @blur="checkRegisterPassword(enterprise.password)"/>
  114. <span class="help-list" v-text="phoneIsRegisterTip"></span>
  115. </div>
  116. <div class="form-group" v-if="!isHasRegister">
  117. <input type="password" class="form-control"
  118. placeholder="密码确认"
  119. v-model="enterprise.confirm"
  120. maxlength="20"
  121. :class="{'err': !passwordConfirmChecked}"
  122. @blur="checkConfirm(enterprise.confirm)"/>
  123. <span class="help-list" v-text="confirmErrMsg"></span>
  124. </div>
  125. <div class="form-group" v-if="!isHasEmail">
  126. <input type="text" class="form-control"
  127. placeholder="联系邮箱"
  128. v-model="enterprise.email"
  129. maxlength="20"
  130. :class="{'err': !emailChecked}"
  131. @blur="checkEmail(enterprise.email)"/>
  132. <span class="help-list" v-text="emailErrMsg"></span>
  133. </div>
  134. <div class="form-group">
  135. <label class="check-box-wrap">
  136. <input type="checkbox"
  137. id="check-boxes"
  138. v-model="isReads"
  139. :checked="isReads">
  140. <label class="agr" for="check-box">我已阅读并同意<a :href="`${address}/common/agreement`" target="_blank">《优软云服务条款》</a></label>
  141. </label>
  142. </div>
  143. <div class="form-group">
  144. <span class="next-bottom" @click="sureRegister">确认注册</span>
  145. </div>
  146. </div>
  147. </div>
  148. </div>
  149. </div>
  150. <div class="section-02"></div>
  151. <div class="section-03">
  152. <img src="/images/bussinessEnter/banner04.png" alt="">
  153. </div>
  154. <div class="section-04">
  155. <div class="handle-btn">
  156. <div class="ps-btn">
  157. <a @click="onRegisterClick">立即入驻</a>
  158. <a href="https://mall.usoftchina.com/help/helpDetail/28" target="_blank">联系企业</a>
  159. </div>
  160. </div>
  161. </div>
  162. <div class="loading" v-show="showLoading"></div>
  163. </div>
  164. </template>
  165. <script>
  166. import md5 from 'js-md5'
  167. export default {
  168. name: 'businessEnter',
  169. layout: 'main',
  170. data () {
  171. return {
  172. enterprise: {
  173. mobile: '',
  174. code: '',
  175. ImgCode: '',
  176. spaceName: '',
  177. businessCode: '',
  178. vipName: '',
  179. password: '',
  180. confirm: '',
  181. email: ''
  182. },
  183. imageCode: `${this.address}/sso/login/checkCode`,
  184. mobileErrMsg: '一个手机可注册多个企业',
  185. codeErrMsg: '',
  186. spaceNameErrMsg: '',
  187. businessCodeErrMsg: '',
  188. vipNameErrMsg: '',
  189. passwordErrMsg: '',
  190. confirmErrMsg: '',
  191. emailErrMsg: '',
  192. mobileChecked: false,
  193. codeChecked: false,
  194. spaceNameChecked: false,
  195. businessCodeChecked: false,
  196. vipNameChecked: false,
  197. passwordChecked: false,
  198. passwordConfirmChecked: false,
  199. emailChecked: true,
  200. showLoading: false,
  201. visible: false,
  202. address: '',
  203. sendEnterpriseCode: true,
  204. token: '',
  205. enterprise_time: 0,
  206. isRead: true,
  207. isReads: true,
  208. isHasRegister: false,
  209. isHasEmail: false,
  210. goNextStep: true,
  211. phoneIsRegisterTip: '该手机号已有优软账号,请输入原账号的登录密码进行校验确认',
  212. strength: ''
  213. }
  214. },
  215. mounted () {
  216. this.$nextTick(() => {
  217. this.getAddress()
  218. this.getImgCode()
  219. })
  220. },
  221. methods: {
  222. // 立即入驻
  223. onRegisterClick () {
  224. this.$http.get('/register/page').then(response => {
  225. if (response.data) {
  226. window.location.href = response.data.content
  227. }
  228. })
  229. },
  230. checkMobile (flg) {
  231. let reg = /^1[0-9]{10}$/
  232. if (flg === '' && !flg) {
  233. this.mobileChecked = false
  234. this.mobileErrMsg = '请填写正确的手机号'
  235. } else {
  236. if (!reg.test(flg)) {
  237. this.mobileChecked = false
  238. this.mobileErrMsg = '请填写正确的手机号'
  239. } else {
  240. this.mobileErrMsg = ''
  241. this.mobileChecked = true
  242. }
  243. }
  244. },
  245. getAddress () {
  246. this.address = process.env.ssoUrl
  247. },
  248. getImgCode () {
  249. let imgSrc = document.getElementById('captchaImage2')
  250. imgSrc.setAttribute('src', this.address + '/sso/resetPwd/checkCaptcha?timestamp=' + (new Date()).valueOf())
  251. },
  252. getCode () {
  253. let md5Code = md5(`{mobile=${this.enterprise.mobile},code=${this.enterprise.ImgCode},salt=sso}`)
  254. this.showLoading = true
  255. if (this.mobileChecked) {
  256. this.$http.get(`${this.address}/sso/userspace/register/checkCode`, {params: {mobile: this.enterprise.mobile, timestamp: new Date().getTime() + '', code: this.enterprise.ImgCode, sign: md5Code}})
  257. .then(response => {
  258. this.showLoading = false
  259. if (response.data) {
  260. this.token = response.data.token
  261. if (response.data.errMsg) {
  262. this.$message({
  263. message: response.data.errMsg,
  264. type: 'error'
  265. })
  266. this.enterprise.ImgCode = ''
  267. this.getImgCode()
  268. return
  269. }
  270. if (this.token !== '') {
  271. this.$message({
  272. message: '验证码已经发送到您的手机,请注意查收',
  273. type: 'success'
  274. })
  275. this.sendEnterpriseCode = false
  276. this.enterprise_time = 60
  277. this.visible = false
  278. this.enterprise.ImgCode = ''
  279. let enterpriseTime = setInterval(() => {
  280. this.enterprise_time--
  281. if (this.enterprise_time <= 0) {
  282. this.sendEnterpriseCode = true
  283. clearInterval(enterpriseTime)
  284. }
  285. }, 1000)
  286. this.getImgCode()
  287. }
  288. } else {
  289. return Promise.reject(response.data)
  290. }
  291. }).catch(err => {
  292. this.showLoading = false
  293. this.$message.error(err.errMsg)
  294. })
  295. }
  296. },
  297. checkMsgCode (flg) {
  298. if (!flg && flg === '') {
  299. this.codeErrMsg = '请填写正确的验证码'
  300. this.codeChecked = false
  301. } else {
  302. if (this.enterprise.mobile === '') {
  303. this.mobileErrMsg = '请填写正确的手机号'
  304. this.codeChecked = false
  305. } else {
  306. if (this.token) {
  307. if (flg.length === 6) {
  308. let param = new FormData()
  309. param.append('mobile', this.enterprise.mobile)
  310. param.append('code', this.enterprise.code)
  311. param.append('token', this.token)
  312. let config = {
  313. headers: {'Content-Type': 'multipart/form-data'}
  314. }
  315. this.$http.post(`${this.address}/sso/userspace/register/checkCode`, param, config)
  316. .then(response => {
  317. if (response.data.success) {
  318. this.codeChecked = true
  319. this.codeErrMsg = ''
  320. } else {
  321. this.codeChecked = false
  322. return Promise.reject(response.data)
  323. }
  324. }).catch(err => {
  325. this.codeChecked = false
  326. this.codeErrMsg = err.errMsg
  327. })
  328. } else {
  329. this.codeChecked = false
  330. this.codeErrMsg = '请输入正确的验证码'
  331. }
  332. } else {
  333. this.codeChecked = false
  334. this.codeErrMsg = '请先获取验证码'
  335. }
  336. }
  337. }
  338. },
  339. nextStep () {
  340. if (this.mobileChecked && this.codeChecked && this.isRead) {
  341. this.showLoading = true
  342. let param = new FormData()
  343. param.append('mobile', this.enterprise.mobile)
  344. param.append('code', this.enterprise.code)
  345. param.append('appId', 'mall')
  346. param.append('token', this.token)
  347. let config = {
  348. headers: {'Content-Type': 'multipart/form-data'}
  349. }
  350. this.$http.post(`${this.address}/sso/userspace/register/checkAdminTel`, param, config)
  351. .then(response => {
  352. this.showLoading = false
  353. if (response.data.success) {
  354. this.goNextStep = false
  355. if (response.data.content.hasRegister) {
  356. this.isHasRegister = true
  357. if (response.data.content.hasEmail) {
  358. this.isHasEmail = true
  359. } else {
  360. this.isHasEmail = false
  361. }
  362. } else {
  363. this.isHasRegister = false
  364. this.isHasEmail = false
  365. }
  366. } else {
  367. this.goNextStep = true
  368. return Promise.reject(response.data)
  369. }
  370. }).catch(err => {
  371. this.$message.error(err.errMsg)
  372. this.showLoading = false
  373. this.enterprise_time = 0
  374. })
  375. } else {
  376. if (!this.enterprise.mobile) {
  377. this.$message.error('手机号不能为空')
  378. } else if (!this.mobileChecked) {
  379. this.$message.error('手机号输入有误,请按提示重新输入')
  380. } else if (!this.token) {
  381. this.$message.error('请先获取验证码')
  382. } else if (!this.enterprise.code) {
  383. this.$message.error('验证码不能为空')
  384. } else if (!this.codeChecked) {
  385. this.$message.error('验证码输入有误,请按提示重新输入')
  386. } else if (!this.isRead) {
  387. this.$message.error('您对阅读条款未做勾选')
  388. }
  389. }
  390. },
  391. checkSpaceName (flg) {
  392. if (!flg && flg === '') {
  393. this.spaceNameErrMsg = '请填写正确的企业名称'
  394. this.spaceNameChecked = false
  395. } else {
  396. this.$http.get(`${this.address}/api/userspace/checkSpaceName`, {params: {spaceName: this.enterprise.spaceName}})
  397. .then(response => {
  398. if (response.data.success) {
  399. this.spaceNameChecked = true
  400. this.spaceNameErrMsg = ''
  401. } else {
  402. this.spaceNameChecked = false
  403. return Promise.reject(response.data)
  404. }
  405. }).catch(err => {
  406. this.spaceNameErrMsg = err.errMsg
  407. })
  408. }
  409. },
  410. checkBusinessCode (flg) {
  411. if (!flg && flg === '') {
  412. this.businessCodeErrMsg = '请填写正确的营业执照号'
  413. this.businessCodeChecked = false
  414. } else {
  415. let reg = /^[A-Za-z0-9]+$/
  416. if (!reg.test(flg)) {
  417. this.businessCodeErrMsg = '请填写正确的营业执照号'
  418. this.businessCodeChecked = false
  419. } else {
  420. this.$http.get(`${this.address}/api/userspace/checkBusinessCode`, {params: {businessCode: this.enterprise.businessCode}})
  421. .then(response => {
  422. if (response.data.success) {
  423. this.businessCodeChecked = true
  424. this.businessCodeErrMsg = ''
  425. } else {
  426. this.businessCodeChecked = false
  427. return Promise.reject(response.data)
  428. }
  429. }).catch(err => {
  430. this.businessCodeErrMsg = err.errMsg
  431. })
  432. }
  433. }
  434. },
  435. checkVipName (flg) {
  436. if (this.isHasRegister) {
  437. this.vipNameChecked = true
  438. } else {
  439. if (!flg && flg === '') {
  440. this.vipNameChecked = false
  441. this.vipNameErrMsg = '请填写正确的管理员姓名'
  442. } else {
  443. this.vipNameChecked = true
  444. this.vipNameErrMsg = ''
  445. }
  446. }
  447. },
  448. passwordStrength (flg) {
  449. let reg1 = /^(?=.{8,20})(((?=.*[0-9])(?=.*[a-z])(?=.*[A-Z]))|((?=.*[0-9])((?=.*[a-zA-Z]))(?=.*[^a-zA-Z0-9]))).*$/
  450. let reg2 = /^(?=.{8,20})(((?=.*[0-9])(?=.*[a-z]))|((?=.*[0-9])(?=.*[A-Z]))).*$/
  451. if (flg.length <= 20 && flg.length >= 8) {
  452. if (reg1.test(flg)) {
  453. this.strength = '强'
  454. } else if (reg2.test(flg)) {
  455. this.strength = '中'
  456. } else {
  457. this.strength = '弱'
  458. }
  459. } else {
  460. this.strength = ''
  461. }
  462. },
  463. checkPassword (flg) {
  464. if (!flg && flg === '') {
  465. this.passwordErrMsg = '请输入密码'
  466. } else {
  467. if (flg.length <= 20 && flg.length >= 8) {
  468. let reg1 = /^(?=.{8,20})(((?=.*[0-9])(?=.*[a-z])(?=.*[A-Z]))|((?=.*[0-9])((?=.*[a-zA-Z]))(?=.*[^a-zA-Z0-9]))).*$/
  469. let reg2 = /^(?=.{8,20})(((?=.*[0-9])(?=.*[a-z]))|((?=.*[0-9])(?=.*[A-Z]))).*$/
  470. if (reg1.test(flg)) {
  471. this.passwordChecked = true
  472. this.passwordErrMsg = ''
  473. } else if (reg2.test(flg)) {
  474. this.passwordChecked = true
  475. this.passwordErrMsg = ''
  476. } else {
  477. this.passwordErrMsg = '密码强度弱'
  478. this.passwordChecked = false
  479. }
  480. } else {
  481. this.passwordErrMsg = '密码须为8-20字符的英文、数字混合'
  482. this.passwordChecked = false
  483. }
  484. }
  485. },
  486. checkRegisterPassword (flg) {
  487. if (this.isHasRegister) {
  488. if (!flg && flg === '') {
  489. this.phoneIsRegisterTip = '请输入密码'
  490. this.passwordChecked = false
  491. } else {
  492. this.passwordChecked = true
  493. this.phoneIsRegisterTip = ''
  494. }
  495. } else {
  496. if (!flg && flg === '') {
  497. this.phoneIsRegisterTip = '请输入密码'
  498. this.passwordChecked = false
  499. } else {
  500. if (flg.length <= 20 && flg.length >= 8) {
  501. let reg1 = /^(?=.{8,20})(((?=.*[0-9])(?=.*[a-z])(?=.*[A-Z]))|((?=.*[0-9])((?=.*[a-zA-Z]))(?=.*[^a-zA-Z0-9]))).*$/
  502. let reg2 = /^(?=.{8,20})(((?=.*[0-9])(?=.*[a-z]))|((?=.*[0-9])(?=.*[A-Z]))).*$/
  503. if (reg1.test(flg)) {
  504. this.passwordChecked = true
  505. } else if (reg2.test(flg)) {
  506. this.passwordChecked = true
  507. } else {
  508. this.phoneIsRegisterTip = '密码须为8-20字符的英文、数字混合'
  509. this.passwordChecked = false
  510. }
  511. } else {
  512. this.phoneIsRegisterTip = '密码须为8-20字符的英文、数字混合'
  513. this.passwordChecked = false
  514. }
  515. if (this.enterprise.confirm && this.enterprise.confirm !== '') {
  516. if (flg !== this.enterprise.confirm) {
  517. this.phoneIsRegisterTip = '两次输入密码不一致!'
  518. this.passwordConfirmChecked = false
  519. } else {
  520. this.passwordConfirmChecked = true
  521. this.phoneIsRegisterTip = ''
  522. }
  523. }
  524. }
  525. }
  526. },
  527. checkConfirm (flg) {
  528. if (this.isHasRegister) {
  529. this.passwordConfirmChecked = true
  530. } else {
  531. if (!flg && flg === '') {
  532. this.confirmErrMsg = '请再次输入密码'
  533. this.passwordConfirmChecked = false
  534. } else if (flg !== this.enterprise.password) {
  535. this.confirmErrMsg = '两次输入密码不一致!'
  536. this.passwordConfirmChecked = false
  537. } else {
  538. this.passwordConfirmChecked = true
  539. this.confirmErrMsg = ''
  540. }
  541. }
  542. },
  543. checkEmail (flg) {
  544. if (this.isHasEmail) {
  545. this.emailChecked = true
  546. this.emailErrMsg = ''
  547. } else {
  548. if (flg) {
  549. let reg = /^([\w-])+(\.\w+)*@([\w-])+((\.\w{2,3}){1,3})$/
  550. if (!reg.test(flg)) {
  551. this.emailErrMsg = '请输入正确的邮箱地址格式'
  552. this.emailChecked = false
  553. } else {
  554. this.$http.get(`${this.address}/api/user/checkEmail`, {params: {email: this.enterprise.email}})
  555. .then(response => {
  556. if (response.data.hasRegister) {
  557. this.emailChecked = false
  558. this.emailErrMsg = '该邮箱已被注册'
  559. } else {
  560. this.emailChecked = true
  561. this.emailErrMsg = ''
  562. return Promise.reject(response.data)
  563. }
  564. }).catch(err => {
  565. this.$message.error(err.errMsg)
  566. })
  567. }
  568. } else {
  569. this.emailChecked = true
  570. this.emailErrMsg = ''
  571. }
  572. }
  573. },
  574. sureRegister () {
  575. if (!this.isHasRegister) {
  576. if (this.spaceNameChecked && this.businessCodeChecked && this.vipNameChecked && this.passwordChecked && this.passwordConfirmChecked && this.emailChecked && this.isReads) {
  577. this.submitRegister()
  578. } else {
  579. if (!this.enterprise.spaceName) {
  580. this.$message.error('企业名不能为空')
  581. } else if (!this.spaceNameChecked) {
  582. this.$message.error('企业名称输入有误,请按提示重新输入')
  583. } else if (!this.enterprise.businessCode) {
  584. this.$message.error('营业执照号不能为空')
  585. } else if (!this.businessCodeChecked) {
  586. this.$message.error('营业执照号输入有误,请按提示重新输入')
  587. } else if (!this.enterprise.vipName) {
  588. this.$message.error('管理员姓名不能为空')
  589. } else if (!this.vipNameChecked) {
  590. this.$message.error('管理员姓名输入有误,请按提示重新输入')
  591. } else if (!this.enterprise.password) {
  592. this.$message.error('密码不能为空')
  593. } else if (!this.passwordChecked) {
  594. this.$message.error('密码输入有误,请按提示重新输入')
  595. } else if (!this.enterprise.confirm) {
  596. this.$message.error('请再次输入密码')
  597. } else if (this.enterprise.password !== this.enterprise.confirm) {
  598. this.$message.error('请确认两次填写密码是否一致')
  599. } else if (this.enterprise.email && !this.emailChecked) {
  600. this.$message.error('邮箱输入有误,请按提示重新输入')
  601. } else if (!this.isReads) {
  602. this.$message.error('您对阅读条款未做勾选')
  603. }
  604. }
  605. } else {
  606. if (this.isHasEmail) {
  607. if (this.spaceNameChecked && this.businessCodeChecked && this.passwordChecked && this.isReads) {
  608. this.submitRegister()
  609. } else {
  610. if (!this.enterprise.spaceName) {
  611. this.$message.error('企业名不能为空')
  612. } else if (!this.spaceNameChecked) {
  613. this.$message.error('企业名称输入有误,请按提示重新输入')
  614. } else if (!this.enterprise.businessCode) {
  615. this.$message.error('营业执照号不能为空')
  616. } else if (!this.businessCodeChecked) {
  617. this.$message.error('营业执照号输入有误,请按提示重新输入')
  618. } else if (!this.enterprise.password) {
  619. this.$message.error('密码不能为空')
  620. } else if (!this.isReads) {
  621. this.$message.error('您对阅读条款未做勾选')
  622. }
  623. }
  624. } else {
  625. if (this.spaceNameChecked && this.businessCodeChecked && this.passwordChecked && this.emailChecked && this.isReads) {
  626. this.submitRegister()
  627. } else {
  628. if (!this.enterprise.spaceName) {
  629. this.$message.error('企业名不能为空')
  630. } else if (!this.spaceNameChecked) {
  631. this.$message.error('企业名称输入有误,请按提示重新输入')
  632. } else if (!this.enterprise.businessCode) {
  633. this.$message.error('营业执照号不能为空')
  634. } else if (!this.businessCodeChecked) {
  635. this.$message.error('营业执照号输入有误,请按提示重新输入')
  636. } else if (!this.enterprise.password) {
  637. this.$message.error('密码不能为空')
  638. } else if (this.enterprise.email && !this.emailChecked) {
  639. this.$message.error('邮箱输入有误,请按提示重新输入')
  640. } else if (!this.isReads) {
  641. this.$message.error('您对阅读条款未做勾选')
  642. }
  643. }
  644. }
  645. }
  646. },
  647. submitRegister () {
  648. this.showLoading = true
  649. let param = new FormData()
  650. param.append('spaceName', this.enterprise.spaceName)
  651. param.append('businessCode', this.enterprise.businessCode)
  652. param.append('vipName', this.enterprise.vipName || '')
  653. param.append('password', this.enterprise.password)
  654. param.append('email', this.enterprise.email || '')
  655. param.append('appId', 'mall')
  656. param.append('returnUrl', window.location.origin)
  657. param.append('t', '')
  658. let config = {
  659. headers: {'Content-Type': 'multipart/form-data'}
  660. }
  661. this.$http.post(`${this.address}/sso/userspace/register`, param, config)
  662. .then(response => {
  663. this.showLoading = false
  664. if (response.data.success) {
  665. let param = response.data.content.data
  666. let a = ''
  667. for (let n in param) {
  668. a += (n + '=' + encodeURIComponent(param[n]) + '&')
  669. }
  670. let params = a.substr(0, a.length - 1)
  671. this.showLoading = true
  672. response.data.content.currentUrl = window.location.hash + '/newLogin/other'
  673. this.$jsonp(`${response.data.content.currentUrl}?${params}`, {
  674. name: 'successCallback',
  675. timeout: 3000
  676. }, (err, data) => {
  677. if (err) {
  678. this.$message.error('注册成功,返回首页完成登录')
  679. this.showLoading = false
  680. throw err
  681. } else {
  682. this.loginOther(response, params)
  683. }
  684. })
  685. } else {
  686. return Promise.reject(response.data)
  687. }
  688. }).catch(err => {
  689. this.showLoading = false
  690. this.$message.error(err.errMsg)
  691. })
  692. },
  693. getJsonp: function (url, timeout = 500) {
  694. return new Promise((resolve, reject) => {
  695. this.$jsonp(url, {
  696. name: 'successCallback',
  697. timeout: timeout
  698. }, function (err, data) {
  699. if (err) {
  700. reject(err)
  701. throw err
  702. } else {
  703. resolve(data)
  704. }
  705. })
  706. })
  707. },
  708. crossAfter (url) {
  709. try {
  710. window.location.href = url
  711. } catch (err) {
  712. console.log(err)
  713. }
  714. },
  715. loginOther (response, a, timeout) {
  716. const crossAfter = this.crossAfter
  717. let promises = []
  718. for (let i in response.data.content.loginUrls) {
  719. if (response.data.content.currentUrl !== response.data.content.loginUrls[i]) {
  720. promises.push(this.getJsonp(`${response.data.content.loginUrls[i]}?${a}`))
  721. }
  722. }
  723. let returnUrl = decodeURIComponent(window.location.origin)
  724. Promise.all(promises).then(() => {
  725. crossAfter(returnUrl, timeout)
  726. }).catch(() => {
  727. crossAfter(returnUrl, timeout)
  728. })
  729. }
  730. }
  731. }
  732. </script>
  733. <style lang="scss" scoped>
  734. .business-enter {
  735. margin: 0 auto;
  736. width: 100%;
  737. text-align: center;
  738. .banner{
  739. width: 100%;
  740. height: 500px;
  741. background: url('/images/bussinessEnter/banner01.png') 50%/auto 100% no-repeat #fcde64;
  742. }
  743. .section-01 {
  744. position: relative;
  745. margin: 0 auto;
  746. width: 100%;
  747. text-align: center;
  748. >img{
  749. margin-top: -15px;
  750. width: 100%;
  751. height: 820px;
  752. }
  753. .register {
  754. margin: 0 auto;
  755. width: 1190px;
  756. position: absolute;
  757. top: 170px;
  758. left: 50%;
  759. margin-left: -595px;
  760. .reg-shadow {
  761. margin: 0 auto;
  762. width: 208px;
  763. height: 11px;
  764. background-image: linear-gradient(0deg,
  765. #f0116a 0%,
  766. #b91552 100%),
  767. linear-gradient(
  768. #f0116a,
  769. #f0116a);
  770. border-radius: 10px 10px 0px 0px;
  771. }
  772. .reg-btn{
  773. margin: 0 auto;
  774. width: 208px;
  775. height: 49px;
  776. line-height: 49px;
  777. font-size: 25px;
  778. font-weight: bold;
  779. text-align: center;
  780. color: #ffffff;
  781. background-color: #f0116a;
  782. border-radius: 0 0 4px 4px;
  783. }
  784. .reg-box{
  785. position: relative;
  786. padding: 34px 0 10px 30px;
  787. margin: 0 auto;
  788. width: 646px;
  789. text-align: center;
  790. background-color: #7058ff;
  791. border-radius: 0 0 30px 30px;
  792. .form-group {
  793. overflow: hidden;
  794. height: 42px;
  795. input.form-control{
  796. padding-left: 20px;
  797. float: left;
  798. width: 358px;
  799. height: 42px;
  800. font-size: 20px;
  801. color: #9d8cfc;
  802. background-color: #ffffff;
  803. border-radius: 5px;
  804. }
  805. input.phone{
  806. width: 358px;
  807. }
  808. span.help-list{
  809. margin-left: 10px;
  810. float: left;
  811. width: 225px;
  812. word-break: break-all;
  813. line-height: 21px;
  814. text-align: left;
  815. font-size: 16px;
  816. color: #e6e6e6;
  817. background:none;
  818. border:0;
  819. }
  820. input.code{
  821. width: 208px;
  822. }
  823. /*input.err{*/
  824. /*border-color: #f56c6c;*/
  825. /*}*/
  826. .code-btn{
  827. float: left;
  828. margin-left: 10px;
  829. display: inline-block;
  830. width: 141px;
  831. height: 42px;
  832. line-height: 42px;
  833. text-align: center;
  834. font-size: 20px;
  835. color: #9d8cfc;
  836. background-color: #baaeff;
  837. border-radius: 5px;
  838. cursor: pointer;
  839. outline: none;
  840. border: none;
  841. }
  842. button.code-btn[disabled] {
  843. cursor: not-allowed;
  844. }
  845. .check-box-wrap {
  846. position: relative;
  847. float: left;
  848. padding-left: 9px;
  849. input{
  850. margin-top: 13px;
  851. width: 20px;
  852. height: 20px;
  853. background-color: #baaeff;
  854. border-radius: 5px;
  855. }
  856. .agr{
  857. position: absolute;
  858. top: 8px;
  859. left: 26px;
  860. width: 400px;
  861. display: inline-table;
  862. text-align: left;
  863. padding-left: 10px;
  864. font-size: 20px;
  865. font-weight: normal;
  866. color: #e6e6e6;
  867. a{
  868. font-size: 20px;
  869. color: #e6e6e6;
  870. }
  871. }
  872. }
  873. .next-bottom{
  874. float: left;
  875. display: inline-block;
  876. width: 358px;
  877. height: 42px;
  878. line-height: 42px;
  879. text-align: center;
  880. font-size: 20px;
  881. color: #3d00ff;
  882. background-color: #ffffff;
  883. border-radius: 5px;
  884. cursor: pointer;
  885. }
  886. &:first-child {
  887. margin-bottom: 14px;
  888. }
  889. }
  890. .pwd{
  891. margin: -10px 0 0 19px;
  892. height: 40px;
  893. line-height: 40px;
  894. text-align: left;
  895. font-size: 16px;
  896. color: #fff;
  897. span{
  898. font-size: 16px;
  899. color: #fff;
  900. }
  901. em{
  902. display: inline-block;
  903. margin: 0 8px 2px 0;
  904. width: 24px;
  905. height: 6px;
  906. border: solid 1px #ffffff;
  907. &:first-child {
  908. margin-left: 13px;
  909. }
  910. }
  911. }
  912. .pwd.sm{
  913. color: #fff;
  914. em {
  915. background: #bfbfbf;
  916. &:first-child{
  917. background: #ff4e00;
  918. }
  919. }
  920. span{
  921. color: #ff4e00;
  922. }
  923. }
  924. .pwd.md{
  925. color: #fff;
  926. em {
  927. background: #22ac38;
  928. &:nth-child(3){
  929. background: #bfbfbf;
  930. }
  931. }
  932. span{
  933. color: #22ac38;
  934. }
  935. }
  936. .pwd.lar{
  937. color: #fff;
  938. em {
  939. background: #00a0e9;
  940. }
  941. span{
  942. color: #00a0e9;
  943. }
  944. }
  945. .pwd.low{
  946. color: #fff;
  947. em {
  948. background: #bfbfbf;
  949. }
  950. span{
  951. color: #00a0e9;
  952. }
  953. }
  954. }
  955. }
  956. }
  957. .section-02 {
  958. width: 100%;
  959. height: 660px;
  960. background: url('/images/bussinessEnter/banner03.png') 50%/auto 100% no-repeat #fff;
  961. }
  962. .section-03{
  963. width: 100%;
  964. img{
  965. width: 100%;
  966. height: 630px;
  967. }
  968. }
  969. .section-04{
  970. margin: 0 auto;
  971. width: 100%;
  972. height: 760px;
  973. text-align: center;
  974. background: url('/images/bussinessEnter/banner05.jpg') 50%/auto 100% no-repeat #fff;
  975. .handle-btn {
  976. position: relative;
  977. margin: 0 auto;
  978. width: 1190px;
  979. height: 760px;
  980. .ps-btn {
  981. margin: 0 auto;
  982. overflow: hidden;
  983. position: absolute;
  984. top: 635px;
  985. left: 50%;
  986. margin-left: -198px;
  987. text-align: center;
  988. }
  989. a{
  990. float:left;
  991. display: inline-block;
  992. width: 190px;
  993. height: 59px;
  994. line-height: 59px;
  995. text-align: center;
  996. font-size: 27px;
  997. font-weight: bold;
  998. color: #ffffff;
  999. cursor: pointer;
  1000. &:first-child {
  1001. background-color: #eb162c;
  1002. }
  1003. &:last-child {
  1004. background-color: #114fa4;
  1005. }
  1006. }
  1007. }
  1008. }
  1009. }
  1010. :-moz-placeholder { /* Mozilla Firefox 4 to 18 */
  1011. color: #9d8cfc; opacity:1;
  1012. }
  1013. ::-moz-placeholder { /* Mozilla Firefox 19+ */
  1014. color: #9d8cfc;opacity:1;
  1015. }
  1016. input:-ms-input-placeholder{
  1017. color: #9d8cfc;opacity:1;
  1018. }
  1019. input::-webkit-input-placeholder{
  1020. color: #9d8cfc;opacity:1;
  1021. }
  1022. </style>