EnterpriseRegistration.vue 40 KB

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