index.vue 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027
  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. console.log(flg)
  450. let reg1 = /^(?=.{8,20})(((?=.*[0-9])(?=.*[a-z])(?=.*[A-Z]))|((?=.*[0-9])((?=.*[a-zA-Z]))(?=.*[^a-zA-Z0-9]))).*$/
  451. let reg2 = /^(?=.{8,20})(((?=.*[0-9])(?=.*[a-z]))|((?=.*[0-9])(?=.*[A-Z]))).*$/
  452. if (flg.length <= 20 && flg.length >= 8) {
  453. if (reg1.test(flg)) {
  454. this.strength = '强'
  455. } else if (reg2.test(flg)) {
  456. this.strength = '中'
  457. } else {
  458. this.strength = '弱'
  459. }
  460. } else {
  461. this.strength = ''
  462. }
  463. },
  464. checkPassword (flg) {
  465. if (!flg && flg === '') {
  466. this.passwordErrMsg = '请输入密码'
  467. } else {
  468. if (flg.length <= 20 && flg.length >= 8) {
  469. let reg1 = /^(?=.{8,20})(((?=.*[0-9])(?=.*[a-z])(?=.*[A-Z]))|((?=.*[0-9])((?=.*[a-zA-Z]))(?=.*[^a-zA-Z0-9]))).*$/
  470. let reg2 = /^(?=.{8,20})(((?=.*[0-9])(?=.*[a-z]))|((?=.*[0-9])(?=.*[A-Z]))).*$/
  471. if (reg1.test(flg)) {
  472. this.passwordChecked = true
  473. this.passwordErrMsg = ''
  474. } else if (reg2.test(flg)) {
  475. this.passwordChecked = true
  476. this.passwordErrMsg = ''
  477. } else {
  478. this.passwordErrMsg = '密码强度弱'
  479. this.passwordChecked = false
  480. }
  481. } else {
  482. this.passwordErrMsg = '密码须为8-20字符的英文、数字混合'
  483. this.passwordChecked = false
  484. }
  485. }
  486. },
  487. checkRegisterPassword (flg) {
  488. if (this.isHasRegister) {
  489. if (!flg && flg === '') {
  490. this.phoneIsRegisterTip = '请输入密码'
  491. this.passwordChecked = false
  492. } else {
  493. this.passwordChecked = true
  494. this.phoneIsRegisterTip = ''
  495. }
  496. } else {
  497. if (!flg && flg === '') {
  498. this.phoneIsRegisterTip = '请输入密码'
  499. this.passwordChecked = false
  500. } else {
  501. if (flg.length <= 20 && flg.length >= 8) {
  502. let reg1 = /^(?=.{8,20})(((?=.*[0-9])(?=.*[a-z])(?=.*[A-Z]))|((?=.*[0-9])((?=.*[a-zA-Z]))(?=.*[^a-zA-Z0-9]))).*$/
  503. let reg2 = /^(?=.{8,20})(((?=.*[0-9])(?=.*[a-z]))|((?=.*[0-9])(?=.*[A-Z]))).*$/
  504. if (reg1.test(flg)) {
  505. this.passwordChecked = true
  506. } else if (reg2.test(flg)) {
  507. this.passwordChecked = true
  508. } else {
  509. this.phoneIsRegisterTip = '密码须为8-20字符的英文、数字混合'
  510. this.passwordChecked = false
  511. }
  512. } else {
  513. this.phoneIsRegisterTip = '密码须为8-20字符的英文、数字混合'
  514. this.passwordChecked = false
  515. }
  516. if (this.enterprise.confirm && this.enterprise.confirm !== '') {
  517. if (flg !== this.enterprise.confirm) {
  518. this.phoneIsRegisterTip = '两次输入密码不一致!'
  519. this.passwordConfirmChecked = false
  520. } else {
  521. this.passwordConfirmChecked = true
  522. this.phoneIsRegisterTip = ''
  523. }
  524. }
  525. }
  526. }
  527. },
  528. checkConfirm (flg) {
  529. if (this.isHasRegister) {
  530. this.passwordConfirmChecked = true
  531. } else {
  532. if (!flg && flg === '') {
  533. this.confirmErrMsg = '请再次输入密码'
  534. this.passwordConfirmChecked = false
  535. } else if (flg !== this.enterprise.password) {
  536. this.confirmErrMsg = '两次输入密码不一致!'
  537. this.passwordConfirmChecked = false
  538. } else {
  539. this.passwordConfirmChecked = true
  540. this.confirmErrMsg = ''
  541. }
  542. }
  543. },
  544. checkEmail (flg) {
  545. if (this.isHasEmail) {
  546. this.emailChecked = true
  547. this.emailErrMsg = ''
  548. } else {
  549. if (flg) {
  550. let reg = /^([\w-])+(\.\w+)*@([\w-])+((\.\w{2,3}){1,3})$/
  551. if (!reg.test(flg)) {
  552. this.emailErrMsg = '请输入正确的邮箱地址格式'
  553. this.emailChecked = false
  554. } else {
  555. this.$http.get(`${this.address}/api/user/checkEmail`, {params: {email: this.enterprise.email}})
  556. .then(response => {
  557. if (response.data.hasRegister) {
  558. this.emailChecked = false
  559. this.emailErrMsg = '该邮箱已被注册'
  560. } else {
  561. this.emailChecked = true
  562. this.emailErrMsg = ''
  563. return Promise.reject(response.data)
  564. }
  565. }).catch(err => {
  566. this.$message.error(err.errMsg)
  567. })
  568. }
  569. } else {
  570. this.emailChecked = true
  571. this.emailErrMsg = ''
  572. }
  573. }
  574. },
  575. sureRegister () {
  576. if (!this.isHasRegister) {
  577. if (this.spaceNameChecked && this.businessCodeChecked && this.vipNameChecked && this.passwordChecked && this.passwordConfirmChecked && this.emailChecked && this.isReads) {
  578. this.submitRegister()
  579. } else {
  580. if (!this.enterprise.spaceName) {
  581. this.$message.error('企业名不能为空')
  582. } else if (!this.spaceNameChecked) {
  583. this.$message.error('企业名称输入有误,请按提示重新输入')
  584. } else if (!this.enterprise.businessCode) {
  585. this.$message.error('营业执照号不能为空')
  586. } else if (!this.businessCodeChecked) {
  587. this.$message.error('营业执照号输入有误,请按提示重新输入')
  588. } else if (!this.enterprise.vipName) {
  589. this.$message.error('管理员姓名不能为空')
  590. } else if (!this.vipNameChecked) {
  591. this.$message.error('管理员姓名输入有误,请按提示重新输入')
  592. } else if (!this.enterprise.password) {
  593. this.$message.error('密码不能为空')
  594. } else if (!this.passwordChecked) {
  595. this.$message.error('密码输入有误,请按提示重新输入')
  596. } else if (!this.enterprise.confirm) {
  597. this.$message.error('请再次输入密码')
  598. } else if (this.enterprise.password !== this.enterprise.confirm) {
  599. this.$message.error('请确认两次填写密码是否一致')
  600. } else if (this.enterprise.email && !this.emailChecked) {
  601. this.$message.error('邮箱输入有误,请按提示重新输入')
  602. } else if (!this.isReads) {
  603. this.$message.error('您对阅读条款未做勾选')
  604. }
  605. }
  606. } else {
  607. if (this.isHasEmail) {
  608. if (this.spaceNameChecked && this.businessCodeChecked && this.passwordChecked && this.isReads) {
  609. this.submitRegister()
  610. } else {
  611. if (!this.enterprise.spaceName) {
  612. this.$message.error('企业名不能为空')
  613. } else if (!this.spaceNameChecked) {
  614. this.$message.error('企业名称输入有误,请按提示重新输入')
  615. } else if (!this.enterprise.businessCode) {
  616. this.$message.error('营业执照号不能为空')
  617. } else if (!this.businessCodeChecked) {
  618. this.$message.error('营业执照号输入有误,请按提示重新输入')
  619. } else if (!this.enterprise.password) {
  620. this.$message.error('密码不能为空')
  621. } else if (!this.isReads) {
  622. this.$message.error('您对阅读条款未做勾选')
  623. }
  624. }
  625. } else {
  626. if (this.spaceNameChecked && this.businessCodeChecked && this.passwordChecked && this.emailChecked && this.isReads) {
  627. this.submitRegister()
  628. } else {
  629. if (!this.enterprise.spaceName) {
  630. this.$message.error('企业名不能为空')
  631. } else if (!this.spaceNameChecked) {
  632. this.$message.error('企业名称输入有误,请按提示重新输入')
  633. } else if (!this.enterprise.businessCode) {
  634. this.$message.error('营业执照号不能为空')
  635. } else if (!this.businessCodeChecked) {
  636. this.$message.error('营业执照号输入有误,请按提示重新输入')
  637. } else if (!this.enterprise.password) {
  638. this.$message.error('密码不能为空')
  639. } else if (this.enterprise.email && !this.emailChecked) {
  640. this.$message.error('邮箱输入有误,请按提示重新输入')
  641. } else if (!this.isReads) {
  642. this.$message.error('您对阅读条款未做勾选')
  643. }
  644. }
  645. }
  646. }
  647. },
  648. submitRegister () {
  649. this.showLoading = true
  650. let param = new FormData()
  651. param.append('spaceName', this.enterprise.spaceName)
  652. param.append('businessCode', this.enterprise.businessCode)
  653. param.append('vipName', this.enterprise.vipName || '')
  654. param.append('password', this.enterprise.password)
  655. param.append('email', this.enterprise.email || '')
  656. param.append('appId', 'mall')
  657. param.append('returnUrl', window.location.origin)
  658. param.append('t', '')
  659. let config = {
  660. headers: {'Content-Type': 'multipart/form-data'}
  661. }
  662. this.$http.post(`${this.address}/sso/userspace/register`, param, config)
  663. .then(response => {
  664. this.showLoading = false
  665. if (response.data.success) {
  666. let param = response.data.content.data
  667. let a = ''
  668. for (let n in param) {
  669. a += (n + '=' + encodeURIComponent(param[n]) + '&')
  670. }
  671. let params = a.substr(0, a.length - 1)
  672. this.showLoading = true
  673. response.data.content.currentUrl = window.location.hash + '/newLogin/other'
  674. this.$jsonp(`${response.data.content.currentUrl}?${params}`, {
  675. name: 'successCallback',
  676. timeout: 3000
  677. }, (err, data) => {
  678. if (err) {
  679. this.$message.error('注册成功,返回首页完成登录')
  680. this.showLoading = false
  681. throw err
  682. } else {
  683. this.loginOther(response, params)
  684. }
  685. })
  686. } else {
  687. return Promise.reject(response.data)
  688. }
  689. }).catch(err => {
  690. this.showLoading = false
  691. this.$message.error(err.errMsg)
  692. })
  693. },
  694. getJsonp: function (url, timeout = 500) {
  695. return new Promise((resolve, reject) => {
  696. this.$jsonp(url, {
  697. name: 'successCallback',
  698. timeout: timeout
  699. }, function (err, data) {
  700. if (err) {
  701. reject(err)
  702. throw err
  703. } else {
  704. resolve(data)
  705. }
  706. })
  707. })
  708. },
  709. crossAfter (url) {
  710. try {
  711. console.log(url, 'url')
  712. window.location.href = url
  713. } catch (err) {
  714. console.log(err)
  715. }
  716. },
  717. loginOther (response, a, timeout) {
  718. const crossAfter = this.crossAfter
  719. let promises = []
  720. for (let i in response.data.content.loginUrls) {
  721. if (response.data.content.currentUrl !== response.data.content.loginUrls[i]) {
  722. promises.push(this.getJsonp(`${response.data.content.loginUrls[i]}?${a}`))
  723. }
  724. }
  725. let returnUrl = decodeURIComponent(window.location.origin)
  726. Promise.all(promises).then(() => {
  727. crossAfter(returnUrl, timeout)
  728. }).catch(() => {
  729. crossAfter(returnUrl, timeout)
  730. })
  731. }
  732. }
  733. }
  734. </script>
  735. <style lang="scss" scoped>
  736. .business-enter {
  737. margin: 0 auto;
  738. width: 100%;
  739. text-align: center;
  740. .banner{
  741. width: 100%;
  742. height: 500px;
  743. background: url('/images/bussinessEnter/banner01.png') 50%/auto 100% no-repeat #fcde64;
  744. }
  745. .section-01 {
  746. position: relative;
  747. margin: 0 auto;
  748. width: 100%;
  749. text-align: center;
  750. >img{
  751. margin-top: -15px;
  752. width: 100%;
  753. height: 820px;
  754. }
  755. .register {
  756. margin: 0 auto;
  757. width: 1190px;
  758. position: absolute;
  759. top: 170px;
  760. left: 50%;
  761. margin-left: -595px;
  762. .reg-shadow {
  763. margin: 0 auto;
  764. width: 208px;
  765. height: 11px;
  766. background-image: linear-gradient(0deg,
  767. #f0116a 0%,
  768. #b91552 100%),
  769. linear-gradient(
  770. #f0116a,
  771. #f0116a);
  772. border-radius: 10px 10px 0px 0px;
  773. }
  774. .reg-btn{
  775. margin: 0 auto;
  776. width: 208px;
  777. height: 49px;
  778. line-height: 49px;
  779. font-size: 25px;
  780. font-weight: bold;
  781. text-align: center;
  782. color: #ffffff;
  783. background-color: #f0116a;
  784. border-radius: 0 0 4px 4px;
  785. }
  786. .reg-box{
  787. position: relative;
  788. padding: 34px 0 10px 30px;
  789. margin: 0 auto;
  790. width: 646px;
  791. text-align: center;
  792. background-color: #7058ff;
  793. border-radius: 0 0 30px 30px;
  794. .form-group {
  795. overflow: hidden;
  796. height: 42px;
  797. input.form-control{
  798. padding-left: 20px;
  799. float: left;
  800. width: 358px;
  801. height: 42px;
  802. font-size: 20px;
  803. color: #9d8cfc;
  804. background-color: #ffffff;
  805. border-radius: 5px;
  806. }
  807. input.phone{
  808. width: 358px;
  809. }
  810. span.help-list{
  811. margin-left: 10px;
  812. float: left;
  813. width: 225px;
  814. word-break: break-all;
  815. line-height: 21px;
  816. text-align: left;
  817. font-size: 16px;
  818. color: #e6e6e6;
  819. background:none;
  820. border:0;
  821. }
  822. input.code{
  823. width: 208px;
  824. }
  825. /*input.err{*/
  826. /*border-color: #f56c6c;*/
  827. /*}*/
  828. .code-btn{
  829. float: left;
  830. margin-left: 10px;
  831. display: inline-block;
  832. width: 141px;
  833. height: 42px;
  834. line-height: 42px;
  835. text-align: center;
  836. font-size: 20px;
  837. color: #9d8cfc;
  838. background-color: #baaeff;
  839. border-radius: 5px;
  840. cursor: pointer;
  841. outline: none;
  842. border: none;
  843. }
  844. button.code-btn[disabled] {
  845. cursor: not-allowed;
  846. }
  847. .check-box-wrap {
  848. position: relative;
  849. float: left;
  850. padding-left: 9px;
  851. input{
  852. margin-top: 13px;
  853. width: 20px;
  854. height: 20px;
  855. background-color: #baaeff;
  856. border-radius: 5px;
  857. }
  858. .agr{
  859. position: absolute;
  860. top: 8px;
  861. left: 26px;
  862. width: 400px;
  863. display: inline-table;
  864. text-align: left;
  865. padding-left: 10px;
  866. font-size: 20px;
  867. font-weight: normal;
  868. color: #e6e6e6;
  869. a{
  870. font-size: 20px;
  871. color: #e6e6e6;
  872. }
  873. }
  874. }
  875. .next-bottom{
  876. float: left;
  877. display: inline-block;
  878. width: 358px;
  879. height: 42px;
  880. line-height: 42px;
  881. text-align: center;
  882. font-size: 20px;
  883. color: #3d00ff;
  884. background-color: #ffffff;
  885. border-radius: 5px;
  886. cursor: pointer;
  887. }
  888. &:first-child {
  889. margin-bottom: 14px;
  890. }
  891. }
  892. .pwd{
  893. margin: -10px 0 0 19px;
  894. height: 40px;
  895. line-height: 40px;
  896. text-align: left;
  897. font-size: 16px;
  898. color: #fff;
  899. span{
  900. font-size: 16px;
  901. color: #fff;
  902. }
  903. em{
  904. display: inline-block;
  905. margin: 0 8px 2px 0;
  906. width: 24px;
  907. height: 6px;
  908. border: solid 1px #ffffff;
  909. &:first-child {
  910. margin-left: 13px;
  911. }
  912. }
  913. }
  914. .pwd.sm{
  915. color: #fff;
  916. em {
  917. background: #bfbfbf;
  918. &:first-child{
  919. background: #ff4e00;
  920. }
  921. }
  922. span{
  923. color: #ff4e00;
  924. }
  925. }
  926. .pwd.md{
  927. color: #fff;
  928. em {
  929. background: #22ac38;
  930. &:nth-child(3){
  931. background: #bfbfbf;
  932. }
  933. }
  934. span{
  935. color: #22ac38;
  936. }
  937. }
  938. .pwd.lar{
  939. color: #fff;
  940. em {
  941. background: #00a0e9;
  942. }
  943. span{
  944. color: #00a0e9;
  945. }
  946. }
  947. .pwd.low{
  948. color: #fff;
  949. em {
  950. background: #bfbfbf;
  951. }
  952. span{
  953. color: #00a0e9;
  954. }
  955. }
  956. }
  957. }
  958. }
  959. .section-02 {
  960. width: 100%;
  961. height: 660px;
  962. background: url('/images/bussinessEnter/banner03.png') 50%/auto 100% no-repeat #fff;
  963. }
  964. .section-03{
  965. width: 100%;
  966. img{
  967. width: 100%;
  968. height: 630px;
  969. }
  970. }
  971. .section-04{
  972. margin: 0 auto;
  973. width: 100%;
  974. height: 760px;
  975. text-align: center;
  976. background: url('/images/bussinessEnter/banner05.jpg') 50%/auto 100% no-repeat #fff;
  977. .handle-btn {
  978. position: relative;
  979. margin: 0 auto;
  980. width: 1190px;
  981. height: 760px;
  982. .ps-btn {
  983. margin: 0 auto;
  984. overflow: hidden;
  985. position: absolute;
  986. top: 635px;
  987. left: 50%;
  988. margin-left: -198px;
  989. text-align: center;
  990. }
  991. a{
  992. float:left;
  993. display: inline-block;
  994. width: 190px;
  995. height: 59px;
  996. line-height: 59px;
  997. text-align: center;
  998. font-size: 27px;
  999. font-weight: bold;
  1000. color: #ffffff;
  1001. cursor: pointer;
  1002. &:first-child {
  1003. background-color: #eb162c;
  1004. }
  1005. &:last-child {
  1006. background-color: #114fa4;
  1007. }
  1008. }
  1009. }
  1010. }
  1011. }
  1012. :-moz-placeholder { /* Mozilla Firefox 4 to 18 */
  1013. color: #9d8cfc; opacity:1;
  1014. }
  1015. ::-moz-placeholder { /* Mozilla Firefox 19+ */
  1016. color: #9d8cfc;opacity:1;
  1017. }
  1018. input:-ms-input-placeholder{
  1019. color: #9d8cfc;opacity:1;
  1020. }
  1021. input::-webkit-input-placeholder{
  1022. color: #9d8cfc;opacity:1;
  1023. }
  1024. </style>