EnterpriseRegistration.vue 43 KB

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