index.vue 36 KB

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