index.vue 36 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.jpg" 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. export default {
  167. name: 'businessEnter',
  168. layout: 'main',
  169. data () {
  170. return {
  171. enterprise: {
  172. mobile: '',
  173. code: '',
  174. ImgCode: '',
  175. spaceName: '',
  176. businessCode: '',
  177. vipName: '',
  178. password: '',
  179. confirm: '',
  180. email: ''
  181. },
  182. imageCode: `${this.address}/sso/login/checkCode`,
  183. mobileErrMsg: '一个手机可注册多个企业',
  184. codeErrMsg: '',
  185. spaceNameErrMsg: '',
  186. businessCodeErrMsg: '',
  187. vipNameErrMsg: '',
  188. passwordErrMsg: '',
  189. confirmErrMsg: '',
  190. emailErrMsg: '',
  191. mobileChecked: false,
  192. codeChecked: false,
  193. spaceNameChecked: false,
  194. businessCodeChecked: false,
  195. vipNameChecked: false,
  196. passwordChecked: false,
  197. passwordConfirmChecked: false,
  198. emailChecked: true,
  199. showLoading: false,
  200. visible: false,
  201. address: '',
  202. sendEnterpriseCode: true,
  203. token: '',
  204. enterprise_time: 0,
  205. isRead: true,
  206. isReads: true,
  207. isHasRegister: false,
  208. isHasEmail: false,
  209. goNextStep: true,
  210. phoneIsRegisterTip: '该手机号已有优软账号,请输入原账号的登录密码进行校验确认',
  211. strength: ''
  212. }
  213. },
  214. mounted () {
  215. this.$nextTick(() => {
  216. this.getAddress()
  217. this.getImgCode()
  218. })
  219. },
  220. methods: {
  221. // 立即入驻
  222. onRegisterClick () {
  223. this.$http.get('/register/page').then(response => {
  224. if (response.data) {
  225. window.location.href = response.data.content
  226. }
  227. })
  228. },
  229. checkMobile (flg) {
  230. let reg = /^1[0-9]{10}$/
  231. if (flg === '' && !flg) {
  232. this.mobileChecked = false
  233. this.mobileErrMsg = '请填写正确的手机号'
  234. } else {
  235. if (!reg.test(flg)) {
  236. this.mobileChecked = false
  237. this.mobileErrMsg = '请填写正确的手机号'
  238. } else {
  239. this.mobileErrMsg = ''
  240. this.mobileChecked = true
  241. }
  242. }
  243. },
  244. getAddress () {
  245. this.address = process.env.ssoUrl
  246. },
  247. getImgCode () {
  248. let imgSrc = document.getElementById('captchaImage2')
  249. imgSrc.setAttribute('src', this.address + '/sso/resetPwd/checkCaptcha?timestamp=' + (new Date()).valueOf())
  250. },
  251. getCode () {
  252. this.showLoading = true
  253. if (this.mobileChecked) {
  254. this.$http.get(`${this.address}/sso/userspace/register/checkCode`, {params: {mobile: this.enterprise.mobile, timestamp: new Date().getTime() + '', code: this.enterprise.ImgCode}})
  255. .then(response => {
  256. this.showLoading = false
  257. if (response.data) {
  258. this.token = response.data.token
  259. if (response.data.errMsg) {
  260. this.$message({
  261. message: response.data.errMsg,
  262. type: 'error'
  263. })
  264. this.enterprise.ImgCode = ''
  265. this.getImgCode()
  266. return
  267. }
  268. if (this.token !== '') {
  269. this.$message({
  270. message: '验证码已经发送到您的手机,请注意查收',
  271. type: 'success'
  272. })
  273. this.sendEnterpriseCode = false
  274. this.enterprise_time = 60
  275. this.visible = false
  276. this.enterprise.ImgCode = ''
  277. let enterpriseTime = setInterval(() => {
  278. this.enterprise_time--
  279. if (this.enterprise_time <= 0) {
  280. this.sendEnterpriseCode = true
  281. clearInterval(enterpriseTime)
  282. }
  283. }, 1000)
  284. this.getImgCode()
  285. }
  286. } else {
  287. return Promise.reject(response.data)
  288. }
  289. }).catch(err => {
  290. this.showLoading = false
  291. this.$message.error(err.errMsg)
  292. })
  293. }
  294. },
  295. checkMsgCode (flg) {
  296. if (!flg && flg === '') {
  297. this.codeErrMsg = '请填写正确的验证码'
  298. this.codeChecked = false
  299. } else {
  300. if (this.enterprise.mobile === '') {
  301. this.mobileErrMsg = '请填写正确的手机号'
  302. this.codeChecked = false
  303. } else {
  304. if (this.token) {
  305. if (flg.length === 6) {
  306. let param = new FormData()
  307. param.append('mobile', this.enterprise.mobile)
  308. param.append('code', this.enterprise.code)
  309. param.append('token', this.token)
  310. let config = {
  311. headers: {'Content-Type': 'multipart/form-data'}
  312. }
  313. this.$http.post(`${this.address}/sso/userspace/register/checkCode`, param, config)
  314. .then(response => {
  315. if (response.data.success) {
  316. this.codeChecked = true
  317. this.codeErrMsg = ''
  318. } else {
  319. this.codeChecked = false
  320. return Promise.reject(response.data)
  321. }
  322. }).catch(err => {
  323. this.codeChecked = false
  324. this.codeErrMsg = err.errMsg
  325. })
  326. } else {
  327. this.codeChecked = false
  328. this.codeErrMsg = '请输入正确的验证码'
  329. }
  330. } else {
  331. this.codeChecked = false
  332. this.codeErrMsg = '请先获取验证码'
  333. }
  334. }
  335. }
  336. },
  337. nextStep () {
  338. if (this.mobileChecked && this.codeChecked && this.isRead) {
  339. this.showLoading = true
  340. let param = new FormData()
  341. param.append('mobile', this.enterprise.mobile)
  342. param.append('code', this.enterprise.code)
  343. param.append('appId', 'mall')
  344. param.append('token', this.token)
  345. let config = {
  346. headers: {'Content-Type': 'multipart/form-data'}
  347. }
  348. this.$http.post(`${this.address}/sso/userspace/register/checkAdminTel`, param, config)
  349. .then(response => {
  350. this.showLoading = false
  351. if (response.data.success) {
  352. this.goNextStep = false
  353. if (response.data.content.hasRegister) {
  354. this.isHasRegister = true
  355. if (response.data.content.hasEmail) {
  356. this.isHasEmail = true
  357. } else {
  358. this.isHasEmail = false
  359. }
  360. } else {
  361. this.isHasRegister = false
  362. this.isHasEmail = false
  363. }
  364. } else {
  365. this.goNextStep = true
  366. return Promise.reject(response.data)
  367. }
  368. }).catch(err => {
  369. this.$message.error(err.errMsg)
  370. this.showLoading = false
  371. this.enterprise_time = 0
  372. })
  373. } else {
  374. if (!this.enterprise.mobile) {
  375. this.$message.error('手机号不能为空')
  376. } else if (!this.mobileChecked) {
  377. this.$message.error('手机号输入有误,请按提示重新输入')
  378. } else if (!this.token) {
  379. this.$message.error('请先获取验证码')
  380. } else if (!this.enterprise.code) {
  381. this.$message.error('验证码不能为空')
  382. } else if (!this.codeChecked) {
  383. this.$message.error('验证码输入有误,请按提示重新输入')
  384. } else if (!this.isRead) {
  385. this.$message.error('您对阅读条款未做勾选')
  386. }
  387. }
  388. },
  389. checkSpaceName (flg) {
  390. if (!flg && flg === '') {
  391. this.spaceNameErrMsg = '请填写正确的企业名称'
  392. this.spaceNameChecked = false
  393. } else {
  394. this.$http.get(`${this.address}/api/userspace/checkSpaceName`, {params: {spaceName: this.enterprise.spaceName}})
  395. .then(response => {
  396. if (response.data.success) {
  397. this.spaceNameChecked = true
  398. this.spaceNameErrMsg = ''
  399. } else {
  400. this.spaceNameChecked = false
  401. return Promise.reject(response.data)
  402. }
  403. }).catch(err => {
  404. this.spaceNameErrMsg = err.errMsg
  405. })
  406. }
  407. },
  408. checkBusinessCode (flg) {
  409. if (!flg && flg === '') {
  410. this.businessCodeErrMsg = '请填写正确的营业执照号'
  411. this.businessCodeChecked = false
  412. } else {
  413. let reg = /^[A-Za-z0-9]+$/
  414. if (!reg.test(flg)) {
  415. this.businessCodeErrMsg = '请填写正确的营业执照号'
  416. this.businessCodeChecked = false
  417. } else {
  418. this.$http.get(`${this.address}/api/userspace/checkBusinessCode`, {params: {businessCode: this.enterprise.businessCode}})
  419. .then(response => {
  420. if (response.data.success) {
  421. this.businessCodeChecked = true
  422. this.businessCodeErrMsg = ''
  423. } else {
  424. this.businessCodeChecked = false
  425. return Promise.reject(response.data)
  426. }
  427. }).catch(err => {
  428. this.businessCodeErrMsg = err.errMsg
  429. })
  430. }
  431. }
  432. },
  433. checkVipName (flg) {
  434. if (this.isHasRegister) {
  435. this.vipNameChecked = true
  436. } else {
  437. if (!flg && flg === '') {
  438. this.vipNameChecked = false
  439. this.vipNameErrMsg = '请填写正确的管理员姓名'
  440. } else {
  441. this.vipNameChecked = true
  442. this.vipNameErrMsg = ''
  443. }
  444. }
  445. },
  446. passwordStrength (flg) {
  447. console.log(flg)
  448. let reg1 = /^(?=.{8,20})(((?=.*[0-9])(?=.*[a-z])(?=.*[A-Z]))|((?=.*[0-9])((?=.*[a-zA-Z]))(?=.*[^a-zA-Z0-9]))).*$/
  449. let reg2 = /^(?=.{8,20})(((?=.*[0-9])(?=.*[a-z]))|((?=.*[0-9])(?=.*[A-Z]))).*$/
  450. if (flg.length <= 20 && flg.length >= 8) {
  451. if (reg1.test(flg)) {
  452. this.strength = '强'
  453. } else if (reg2.test(flg)) {
  454. this.strength = '中'
  455. } else {
  456. this.strength = '弱'
  457. }
  458. } else {
  459. this.strength = ''
  460. }
  461. },
  462. checkPassword (flg) {
  463. if (!flg && flg === '') {
  464. this.passwordErrMsg = '请输入密码'
  465. } else {
  466. if (flg.length <= 20 && flg.length >= 8) {
  467. let reg1 = /^(?=.{8,20})(((?=.*[0-9])(?=.*[a-z])(?=.*[A-Z]))|((?=.*[0-9])((?=.*[a-zA-Z]))(?=.*[^a-zA-Z0-9]))).*$/
  468. let reg2 = /^(?=.{8,20})(((?=.*[0-9])(?=.*[a-z]))|((?=.*[0-9])(?=.*[A-Z]))).*$/
  469. if (reg1.test(flg)) {
  470. this.passwordChecked = true
  471. this.passwordErrMsg = ''
  472. } else if (reg2.test(flg)) {
  473. this.passwordChecked = true
  474. this.passwordErrMsg = ''
  475. } else {
  476. this.passwordErrMsg = '密码强度弱'
  477. this.passwordChecked = false
  478. }
  479. } else {
  480. this.passwordErrMsg = '密码须为8-20字符的英文、数字混合'
  481. this.passwordChecked = false
  482. }
  483. }
  484. },
  485. checkRegisterPassword (flg) {
  486. if (this.isHasRegister) {
  487. if (!flg && flg === '') {
  488. this.phoneIsRegisterTip = '请输入密码'
  489. this.passwordChecked = false
  490. } else {
  491. this.passwordChecked = true
  492. this.phoneIsRegisterTip = ''
  493. }
  494. } else {
  495. if (!flg && flg === '') {
  496. this.phoneIsRegisterTip = '请输入密码'
  497. this.passwordChecked = false
  498. } else {
  499. if (flg.length <= 20 && flg.length >= 8) {
  500. let reg1 = /^(?=.{8,20})(((?=.*[0-9])(?=.*[a-z])(?=.*[A-Z]))|((?=.*[0-9])((?=.*[a-zA-Z]))(?=.*[^a-zA-Z0-9]))).*$/
  501. let reg2 = /^(?=.{8,20})(((?=.*[0-9])(?=.*[a-z]))|((?=.*[0-9])(?=.*[A-Z]))).*$/
  502. if (reg1.test(flg)) {
  503. this.passwordChecked = true
  504. } else if (reg2.test(flg)) {
  505. this.passwordChecked = true
  506. } else {
  507. this.phoneIsRegisterTip = '密码须为8-20字符的英文、数字混合'
  508. this.passwordChecked = false
  509. }
  510. } else {
  511. this.phoneIsRegisterTip = '密码须为8-20字符的英文、数字混合'
  512. this.passwordChecked = false
  513. }
  514. if (this.enterprise.confirm && this.enterprise.confirm !== '') {
  515. if (flg !== this.enterprise.confirm) {
  516. this.phoneIsRegisterTip = '两次输入密码不一致!'
  517. this.passwordConfirmChecked = false
  518. } else {
  519. this.passwordConfirmChecked = true
  520. this.phoneIsRegisterTip = ''
  521. }
  522. }
  523. }
  524. }
  525. },
  526. checkConfirm (flg) {
  527. if (this.isHasRegister) {
  528. this.passwordConfirmChecked = true
  529. } else {
  530. if (!flg && flg === '') {
  531. this.confirmErrMsg = '请再次输入密码'
  532. this.passwordConfirmChecked = false
  533. } else if (flg !== this.enterprise.password) {
  534. this.confirmErrMsg = '两次输入密码不一致!'
  535. this.passwordConfirmChecked = false
  536. } else {
  537. this.passwordConfirmChecked = true
  538. this.confirmErrMsg = ''
  539. }
  540. }
  541. },
  542. checkEmail (flg) {
  543. if (this.isHasEmail) {
  544. this.emailChecked = true
  545. this.emailErrMsg = ''
  546. } else {
  547. if (flg) {
  548. let reg = /^([\w-])+(\.\w+)*@([\w-])+((\.\w{2,3}){1,3})$/
  549. if (!reg.test(flg)) {
  550. this.emailErrMsg = '请输入正确的邮箱地址格式'
  551. this.emailChecked = false
  552. } else {
  553. this.$http.get(`${this.address}/api/user/checkEmail`, {params: {email: this.enterprise.email}})
  554. .then(response => {
  555. if (response.data.hasRegister) {
  556. this.emailChecked = false
  557. this.emailErrMsg = '该邮箱已被注册'
  558. } else {
  559. this.emailChecked = true
  560. this.emailErrMsg = ''
  561. return Promise.reject(response.data)
  562. }
  563. }).catch(err => {
  564. this.$message.error(err.errMsg)
  565. })
  566. }
  567. } else {
  568. this.emailChecked = true
  569. this.emailErrMsg = ''
  570. }
  571. }
  572. },
  573. sureRegister () {
  574. if (!this.isHasRegister) {
  575. if (this.spaceNameChecked && this.businessCodeChecked && this.vipNameChecked && this.passwordChecked && this.passwordConfirmChecked && this.emailChecked && this.isReads) {
  576. this.submitRegister()
  577. } else {
  578. if (!this.enterprise.spaceName) {
  579. this.$message.error('企业名不能为空')
  580. } else if (!this.spaceNameChecked) {
  581. this.$message.error('企业名称输入有误,请按提示重新输入')
  582. } else if (!this.enterprise.businessCode) {
  583. this.$message.error('营业执照号不能为空')
  584. } else if (!this.businessCodeChecked) {
  585. this.$message.error('营业执照号输入有误,请按提示重新输入')
  586. } else if (!this.enterprise.vipName) {
  587. this.$message.error('管理员姓名不能为空')
  588. } else if (!this.vipNameChecked) {
  589. this.$message.error('管理员姓名输入有误,请按提示重新输入')
  590. } else if (!this.enterprise.password) {
  591. this.$message.error('密码不能为空')
  592. } else if (!this.passwordChecked) {
  593. this.$message.error('密码输入有误,请按提示重新输入')
  594. } else if (!this.enterprise.confirm) {
  595. this.$message.error('请再次输入密码')
  596. } else if (this.enterprise.password !== this.enterprise.confirm) {
  597. this.$message.error('请确认两次填写密码是否一致')
  598. } else if (this.enterprise.email && !this.emailChecked) {
  599. this.$message.error('邮箱输入有误,请按提示重新输入')
  600. } else if (!this.isReads) {
  601. this.$message.error('您对阅读条款未做勾选')
  602. }
  603. }
  604. } else {
  605. if (this.isHasEmail) {
  606. if (this.spaceNameChecked && this.businessCodeChecked && this.passwordChecked && this.isReads) {
  607. this.submitRegister()
  608. } else {
  609. if (!this.enterprise.spaceName) {
  610. this.$message.error('企业名不能为空')
  611. } else if (!this.spaceNameChecked) {
  612. this.$message.error('企业名称输入有误,请按提示重新输入')
  613. } else if (!this.enterprise.businessCode) {
  614. this.$message.error('营业执照号不能为空')
  615. } else if (!this.businessCodeChecked) {
  616. this.$message.error('营业执照号输入有误,请按提示重新输入')
  617. } else if (!this.enterprise.password) {
  618. this.$message.error('密码不能为空')
  619. } else if (!this.isReads) {
  620. this.$message.error('您对阅读条款未做勾选')
  621. }
  622. }
  623. } else {
  624. if (this.spaceNameChecked && this.businessCodeChecked && this.passwordChecked && this.emailChecked && this.isReads) {
  625. this.submitRegister()
  626. } else {
  627. if (!this.enterprise.spaceName) {
  628. this.$message.error('企业名不能为空')
  629. } else if (!this.spaceNameChecked) {
  630. this.$message.error('企业名称输入有误,请按提示重新输入')
  631. } else if (!this.enterprise.businessCode) {
  632. this.$message.error('营业执照号不能为空')
  633. } else if (!this.businessCodeChecked) {
  634. this.$message.error('营业执照号输入有误,请按提示重新输入')
  635. } else if (!this.enterprise.password) {
  636. this.$message.error('密码不能为空')
  637. } else if (this.enterprise.email && !this.emailChecked) {
  638. this.$message.error('邮箱输入有误,请按提示重新输入')
  639. } else if (!this.isReads) {
  640. this.$message.error('您对阅读条款未做勾选')
  641. }
  642. }
  643. }
  644. }
  645. },
  646. submitRegister () {
  647. this.showLoading = true
  648. let param = new FormData()
  649. param.append('spaceName', this.enterprise.spaceName)
  650. param.append('businessCode', this.enterprise.businessCode)
  651. param.append('vipName', this.enterprise.vipName || '')
  652. param.append('password', this.enterprise.password)
  653. param.append('email', this.enterprise.email || '')
  654. param.append('appId', 'mall')
  655. param.append('returnUrl', window.location.origin)
  656. param.append('t', '')
  657. let config = {
  658. headers: {'Content-Type': 'multipart/form-data'}
  659. }
  660. this.$http.post(`${this.address}/sso/userspace/register`, param, config)
  661. .then(response => {
  662. this.showLoading = false
  663. if (response.data.success) {
  664. let param = response.data.content.data
  665. let a = ''
  666. for (let n in param) {
  667. a += (n + '=' + encodeURIComponent(param[n]) + '&')
  668. }
  669. let params = a.substr(0, a.length - 1)
  670. this.showLoading = true
  671. response.data.content.currentUrl = window.location.hash + '/newLogin/other'
  672. this.$jsonp(`${response.data.content.currentUrl}?${params}`, {
  673. name: 'successCallback',
  674. timeout: 3000
  675. }, (err, data) => {
  676. if (err) {
  677. this.$message.error('注册成功,返回首页完成登录')
  678. this.showLoading = false
  679. throw err
  680. } else {
  681. this.loginOther(response, params)
  682. }
  683. })
  684. } else {
  685. return Promise.reject(response.data)
  686. }
  687. }).catch(err => {
  688. this.showLoading = false
  689. this.$message.error(err.errMsg)
  690. })
  691. },
  692. getJsonp: function (url, timeout = 500) {
  693. return new Promise((resolve, reject) => {
  694. this.$jsonp(url, {
  695. name: 'successCallback',
  696. timeout: timeout
  697. }, function (err, data) {
  698. if (err) {
  699. reject(err)
  700. throw err
  701. } else {
  702. resolve(data)
  703. }
  704. })
  705. })
  706. },
  707. crossAfter (url) {
  708. try {
  709. console.log(url, 'url')
  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>