EnterpriseRegistration.vue 41 KB

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