EnterpriseRegistration.vue 44 KB

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