EnterpriseRegistration.vue 38 KB

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