register.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729
  1. <template>
  2. <view class="container register" :style="{paddingTop:CustomBar+'px'}" v-if="isWxAuthorize">
  3. <cu-custom :navbar-data='nvabarData' @navigateBack="hanldNavigateBack"></cu-custom>
  4. <view class="register-main clearfix">
  5. <view class="register-logo">
  6. <image class="logo" src="../../static/login-logo@3x.png" mode=""></image>
  7. <text class="logo-text">生美/医美采购服务平台</text>
  8. </view>
  9. <view class="register-row clearfix">
  10. <view class="register-from">
  11. <view class="label">联系人:</view>
  12. <input class="row-input" type="text" name="input" v-model="userName" placeholder="请输入机构联系人姓名" maxlength="6"/>
  13. </view>
  14. </view>
  15. <view class="register-row clearfix">
  16. <view class="register-from">
  17. <view class="label">手机号:</view>
  18. <input class="row-input" type="number" name="input" v-model="bindMobile" placeholder="请输入联系人常用手机号" maxlength="11"/>
  19. </view>
  20. </view>
  21. <view class="register-row clearfix">
  22. <view class="register-from code">
  23. <view class="label">短信验证码:</view>
  24. <input class="row-input" type="text" v-model="mobileCode" placeholder="请输入短信验证码" maxlength="6"/>
  25. </view>
  26. <view class="register-from btn" :class="[isMobileDisabled ? 'disabled' : '']" >
  27. <button class="row-input"
  28. type="button"
  29. @click.stop="getMobileCodeFn"
  30. :disabled="isMobileDisabled">
  31. {{ mobileCodeText }}
  32. </button>
  33. </view>
  34. </view>
  35. <view class="register-row clearfix">
  36. <view class="register-from">
  37. <view class="label">登录密码:</view>
  38. <input class="row-input" type="password" name="input" v-model="password" placeholder="密码必须为8-16位字母数字组合" maxlength="16"/>
  39. </view>
  40. </view>
  41. <view class="register-row clearfix">
  42. <view class="register-from">
  43. <view class="label">确认密码:</view>
  44. <input class="row-input" type="password" name="input" v-model="passwordCheck" placeholder="请确认密码" maxlength="16"/>
  45. </view>
  46. </view>
  47. <view class="register-main clearfix">
  48. <view class="register-row login">
  49. <view class="row-login" @click.stop="this.$api.navigateTo('/pages/login/login')">账号登录</view>
  50. <view class="row-logincode" @click.stop="this.$api.navigateTo('/pages/login/logincode')">邀请码登录</view>
  51. </view>
  52. <view class="register-row ">
  53. <view class="register-btn sub" @click.stop="registerStepsfirst">注册</view>
  54. </view>
  55. <view class="register-agree">
  56. <view class="agree-text" @tap.stop="agreeCheck()">
  57. <button class="checkbox iconfont" :class="[isCheck?'icon-gouxuan':'icon-weigouxuan']"></button>
  58. 我已阅读并同意
  59. <text @click.stop="this.$api.navigateTo('/pages/service/organagree')">《机构协议》</text>
  60. <text @click.stop="this.$api.navigateTo('/pages/service/useragree')">《用户协议》</text>及
  61. <text @click.stop="this.$api.navigateTo('/pages/service/privacyagree')">《隐私权政策》</text>
  62. </view>
  63. </view>
  64. <view class="register-consult" @click.stop="goFastConsult">
  65. <text class="iconfont icon-kefunv"></text>
  66. <text class="text">入驻咨询</text>
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. </template>
  72. <script>
  73. import { mapState,mapMutations } from 'vuex';
  74. import authorize from '@/common/config/authorize.js'
  75. import wxLogin from "@/common/config/wxLogin.js"
  76. import mpvueCityPicker from '@/components/mpvue-citypicker/mpvueCityPicker.vue'
  77. import { beautyList,mentuzCampNullList,medicaCampNullList } from '@/common/json/data.json.js' //本地数据
  78. import { organizationVerifyRegisterFirst,organizationRegister ,organizationLogin } from "@/api/use.js"
  79. import { getImageCode, getRegisterMobileCode, uploadFileImage } from "@/api/utils.js"
  80. export default{
  81. components:{
  82. mpvueCityPicker
  83. },
  84. data() {
  85. return{
  86. nvabarData: {//顶部自定义导航
  87. showCapsule: 1, // 是否显示左上角图标 1表示显示 0表示不显示,
  88. showSearch: 0,
  89. title: '注册', // 导航栏 中间的标题
  90. haveBack:true,
  91. textLeft:this.$store.state.isIphone
  92. },
  93. CustomBar:this.CustomBar,// 顶部导航栏高度
  94. isMobileDisabled: false, //手机验证码按钮控制
  95. mobilCount: '', //倒计时
  96. mobileCodeText: '获取验证码',
  97. mobilTime: null,
  98. password:'', //密码
  99. passwordCheck:'', //校验密码
  100. userName:'', //联系人
  101. bindMobile:'', //联系人手机号
  102. mobileCode:'', //手机验证码
  103. imageCode:'', //图形验证码
  104. imageCodeUrl:'', //图形验证码图片
  105. imageCodetoken:'', //图形验证校验
  106. isAgreed:0, //是否勾选协议
  107. isCheck:false, //是否勾选协议
  108. userID:'', //机构userID
  109. clubID:'', //机构ID
  110. }
  111. },
  112. onLoad(option) {
  113. },
  114. computed:{
  115. ...mapState(['isWxAuthorize'])
  116. },
  117. methods:{
  118. ...mapMutations(['login']),
  119. hanldNavigateBack(){
  120. this.$util.modal('','注册尚未完成,确定放弃注册吗?','确定','取消',true,() =>{
  121. uni.navigateBack({
  122. delta: 1
  123. });
  124. })
  125. },
  126. registerStepsfirst(){
  127. wx.getUserInfo({
  128. success: res => {
  129. let params ={
  130. userName:this.userName,
  131. bindMobile:this.bindMobile,
  132. activationCode:this.mobileCode,
  133. password:this.password,
  134. passWordConfirm:this.passwordCheck,
  135. isAgreed:this.isAgreed, //是否勾选协议
  136. nickName:res.userInfo.nickName,
  137. headimgurl:res.userInfo.avatarUrl,
  138. }
  139. organizationVerifyRegisterFirst(params).then(response =>{
  140. this.storeUpdataeStatus(response.data)
  141. wxLogin.wxLoginAuthorize()
  142. setTimeout(() =>{
  143. this.$api.switchTabTo('/pages/tabBar/user/user')
  144. },2000)
  145. }).catch(error =>{
  146. this.$util.msg(error.msg,2000);
  147. })
  148. }
  149. })
  150. },
  151. storeUpdataeStatus(data){
  152. uni.setStorageSync('token',data.token)
  153. this.$store.commit('updateStatus',data)
  154. this.login(data);
  155. },
  156. getMobileCodeFn(){
  157. if( this.bindMobile == ''){
  158. this.$util.msg('请输入手机号',2000);
  159. return
  160. }
  161. if(!this.$reg.isMobile(this.bindMobile)){
  162. this.$util.msg('请输入正确的手机号',2000);
  163. return
  164. }
  165. let params = {
  166. mobile:this.bindMobile,
  167. activateCodeType:2,
  168. platformType:2
  169. }
  170. this.isMobileDisabled = true;
  171. getRegisterMobileCode(params).then(response =>{
  172. this.$util.msg('验证短信已发送',2000);
  173. const TIME_COUNT = 60;
  174. if (!this.mobilTime) {
  175. this.mobilCount = TIME_COUNT;
  176. this.isMobileDisabled = true;
  177. this.mobilTime = setInterval(() => {
  178. if (this.mobilCount > 1 && this.mobilCount <= TIME_COUNT) {
  179. this.mobilCount--
  180. this.mobileCodeText = this.mobilCount +'s重新发送'
  181. } else {
  182. this.isMobileDisabled = false;
  183. clearInterval(this.mobilTime)
  184. this.mobilTime = null
  185. this.mobileCodeText = '获取验证码'
  186. }
  187. },1000)
  188. }
  189. }).catch( error =>{
  190. this.$util.msg(error.msg,2000);
  191. this.isMobileDisabled = false;
  192. })
  193. },
  194. agreeCheck() {
  195. this.isCheck = !this.isCheck
  196. if(this.isCheck){
  197. this.isAgreed = 1
  198. }else{
  199. this.isAgreed = 0
  200. }
  201. },
  202. goFastConsult(){
  203. this.$api.navigateTo('/pages/login/consult')
  204. }
  205. },
  206. onShow() {
  207. authorize.getSetting().then(wxResponse =>{// console.log('是否已授权',res);//0:为取消授权 1:为已授权 2:为未操作
  208. if(wxResponse == 1){
  209. wxLogin.wxLoginQuick()
  210. }else{
  211. this.$api.navigateTo('/pages/authorization/authorization?type=0')
  212. }
  213. })
  214. }
  215. }
  216. </script>
  217. <style lang="scss">
  218. .register{
  219. width: 100%;
  220. height: auto;
  221. .register-main{
  222. width: 100%;
  223. height: auto;
  224. position: relative;
  225. .register-consult{
  226. width: 110rpx;
  227. height: 68rpx;
  228. background:linear-gradient(223deg,rgba(225,86,21,0.6) 0%,rgba(225,86,10,0.3) 100%);
  229. border-radius: 34rpx 0 0 34rpx;
  230. position: absolute;
  231. right: 0;
  232. bottom: 120rpx;
  233. text-align: left;
  234. line-height: 68rpx;
  235. padding-left: 20rpx;
  236. .icon-kefunv{
  237. font-size: 48rpx;
  238. color: #31313B;
  239. float: left;
  240. }
  241. .text{
  242. font-size: $font-size-24;
  243. display: block;
  244. float: left;
  245. width: 60rpx;
  246. line-height: 30rpx;
  247. color: #FFFFFF;
  248. margin-top: 6rpx;
  249. }
  250. }
  251. .register-agree{
  252. display: flex;
  253. flex-direction: column;
  254. align-items: center;
  255. margin: 200rpx 0 20rpx 0;
  256. .agree-text{
  257. .checkbox{
  258. float: left;
  259. margin: 4rpx 6rpx 0 0;
  260. color: #999999;
  261. font-size: $font-size-34;
  262. &.icon-gouxuan{
  263. color: $color-system;
  264. }
  265. }
  266. font-size: $font-size-24;
  267. line-height: 44rpx;
  268. color: #999999;
  269. text{
  270. color:#E36125;
  271. }
  272. }
  273. }
  274. .register-logo{
  275. width: 100%;
  276. display: flex;
  277. flex-direction: column;
  278. align-items: center;
  279. height: 198rpx;
  280. padding:60rpx 0 40rpx 0;
  281. .logo{
  282. width: 138rpx;
  283. height: 118rpx;
  284. display: block;
  285. }
  286. .logo-text{
  287. font-size: 30rpx;
  288. line-height: 44rpx;
  289. color: $color-system;
  290. font-weight: 600;
  291. margin-top: 20rpx;
  292. }
  293. }
  294. &.detailed{
  295. padding-bottom: 330rpx;
  296. }
  297. .register-row{
  298. width: 702rpx;
  299. height: auto;
  300. padding: 0 24rpx;
  301. margin-bottom: 20rpx;
  302. &.none{
  303. margin-bottom: 0;
  304. }
  305. &.login{
  306. display: flex;
  307. }
  308. .register-text{
  309. line-height: 44rpx;
  310. margin-top: 100rpx;
  311. font-size: $font-size-24;
  312. color: #999999;
  313. text-align: justify;
  314. .txt{
  315. margin-right: 15rpx;
  316. }
  317. }
  318. .register-title{
  319. line-height: 44rpx;
  320. font-size: $font-size-24;
  321. color: $text-color;
  322. text-align: left;
  323. &.first{
  324. margin-top: 20rpx;
  325. }
  326. }
  327. .register-tip{
  328. line-height: 64rpx;
  329. font-size: $font-size-24;
  330. color: #CECECE;
  331. text-align: left;
  332. }
  333. .register-from{
  334. width: 654rpx;
  335. height: 88rpx;
  336. padding:0 24rpx;
  337. background: $sub-bg-color;
  338. border-radius: 14rpx;
  339. position: relative;
  340. .label{
  341. text-align: left;
  342. font-size: $font-size-28;
  343. color: $text-color;
  344. line-height: 88rpx;
  345. float: left;
  346. }
  347. .row-input{
  348. width: 440rpx;
  349. padding-left:10rpx;
  350. font-size: $font-size-28;
  351. color: $text-color;
  352. line-height: 88rpx;
  353. float: left;
  354. height: 88rpx;
  355. &.none{
  356. color: #999999;
  357. }
  358. &.picker{
  359. text-align: left;
  360. color: #333333;
  361. }
  362. &.keshi{
  363. width: 550rpx;
  364. }
  365. }
  366. &.img-btn{
  367. width: 220rpx;
  368. height: 88rpx;
  369. padding: 0;
  370. float: left;
  371. background: #FFFFFF;
  372. display: block;
  373. .vscodeimg{
  374. width: 150rpx;
  375. height: 88rpx;
  376. float: left;
  377. display: flex;
  378. flex-direction: column;
  379. align-items: center;
  380. border-radius: 14rpx;
  381. image{
  382. width: 150rpx;
  383. height: 88rpx;
  384. border-radius: 14rpx;
  385. }
  386. }
  387. .vscod-refresh{
  388. width: 70rpx;
  389. float: right;
  390. text-align: right;
  391. display: flex;
  392. flex-direction: column;
  393. align-items: center;
  394. line-height: 44rpx;
  395. .icon-shuaxin{
  396. font-size: 48rpx;
  397. color: #333333;
  398. }
  399. .ref-text{
  400. font-size: 24rpx;
  401. color: #333333;
  402. }
  403. }
  404. }
  405. &.imgcode{
  406. width: 410rpx;
  407. float: left;
  408. margin-right: 20rpx;
  409. .row-input{
  410. width: 230rpx;
  411. }
  412. }
  413. &.code{
  414. width: 410rpx;
  415. float: left;
  416. margin-right: 20rpx;
  417. .row-input{
  418. width: 230rpx;
  419. }
  420. }
  421. &.btn{
  422. width: 224rpx;
  423. height: 88rpx;
  424. float: left;
  425. background: $btn-confirm;
  426. padding: 0;
  427. .row-input{
  428. width: 224rpx;
  429. height: 88rpx;
  430. line-height: 88rpx;
  431. padding: 0;
  432. color: #FFFFFF;
  433. background: $btn-confirm;
  434. text-align: center;
  435. border-radius: 14rpx;
  436. &.other{
  437. width: 224rpx;
  438. background: #F7F7F7;
  439. margin-right: 20rpx;
  440. }
  441. &.none{
  442. background: #F7F7F7;
  443. }
  444. }
  445. &.disabled{
  446. background: #F7F7F7;
  447. .row-input{
  448. background: #F7F7F7;
  449. color: #999999;
  450. }
  451. }
  452. }
  453. &.picker{
  454. padding: 0 24rpx;
  455. width: 654rpx;
  456. height: 88rpx;
  457. line-height: 88rpx;
  458. .label{
  459. line-height: 88rpx;
  460. }
  461. .row-input{
  462. width: 470rpx;
  463. height: 88rpx;
  464. line-height: 88rpx;
  465. padding-left: 30rpx;
  466. }
  467. }
  468. &.radio{
  469. padding: 0 24rpx;
  470. width: 654rpx;
  471. height: 288rpx;
  472. .row-input{
  473. width: 100%;
  474. height: 88rpx;
  475. line-height: 88rpx;
  476. padding-left: 0;
  477. }
  478. .row-radio{
  479. float: left;
  480. transform: scale(0.8);
  481. }
  482. .row-text{
  483. width: 100rpx;
  484. text-align: center;
  485. float: left;
  486. }
  487. }
  488. &.group{
  489. padding: 0 24rpx;
  490. width: 654rpx;
  491. height: auto;
  492. background: #FFFFFF;
  493. margin-top: 30rpx;
  494. .label{
  495. line-height: 76rpx;
  496. }
  497. .row-input{
  498. width: 100%;
  499. height: 88rpx;
  500. line-height: 88rpx;
  501. padding-left: 0;
  502. }
  503. .row-radio{
  504. float: left;
  505. }
  506. .row-text{
  507. width: 100rpx;
  508. text-align: center;
  509. float: left;
  510. }
  511. }
  512. &.btn{
  513. margin-top: 0;
  514. }
  515. .content-class {
  516. margin: 20rpx auto;
  517. display: flex;
  518. flex-flow: row wrap;
  519. justify-content: space-between;
  520. align-items: center;
  521. &.btn{
  522. margin: 0 auto;
  523. margin-left: 116rpx;
  524. }
  525. .row-input{
  526. display: flex;
  527. width: 220rpx;
  528. height: 40rpx;
  529. padding: 24rpx;
  530. text-align: left;
  531. border-radius: 10rpx;
  532. font-size: $font-size-28;
  533. color: $text-color;
  534. }
  535. .confirm-btn{
  536. width: 200rpx;
  537. height: 88rpx;
  538. border-radius: 10rpx;
  539. line-height: 88rpx;
  540. text-align: center;
  541. &.other{
  542. width: 213rpx;
  543. }
  544. &.none{
  545. color: #FFFFFF;
  546. background: $btn-confirm;
  547. }
  548. &.disabled{
  549. color: #999999;
  550. }
  551. }
  552. .item {
  553. width: 155rpx;
  554. height: 60rpx;
  555. font-size:$font-size-28;
  556. line-height: 60rpx;
  557. border-radius:10rpx;
  558. margin: 10rpx;
  559. text-align: center;
  560. box-sizing: border-box;
  561. border: 1rpx solid #EFEFEF;
  562. float: left;
  563. checkbox {
  564. display: none;
  565. }
  566. }
  567. .on {
  568. border-color: $color-system;
  569. color:$color-system;
  570. }
  571. }
  572. }
  573. .row-login{
  574. flex: 1;
  575. font-size: $font-size-28;
  576. color: $text-color;
  577. text-align: left;
  578. }
  579. .row-logincode{
  580. flex: 1;
  581. font-size: $font-size-28;
  582. color: $text-color;
  583. text-align: right;
  584. }
  585. .icon-xiayibu{
  586. width: 88rpx;
  587. height: 88rpx;
  588. position: absolute;
  589. right: 0;
  590. top: 0;
  591. line-height: 88rpx;
  592. text-align: center;
  593. }
  594. &.text-textarea{
  595. background: #FFFFFF;
  596. .textarea{
  597. width: 654rpx;
  598. height: 180rpx;
  599. background: #F7F7F7;
  600. padding: 24rpx;
  601. font-size: $font-size-28;
  602. color: $text-color;
  603. z-index: 1;
  604. border-radius: 14rpx;
  605. }
  606. .textarea.hide{
  607. opacity: 0;
  608. }
  609. .textarea.show{
  610. color: #999999;
  611. }
  612. }
  613. }
  614. .register-picture{
  615. height: 102rpx;
  616. margin: 30rpx 0;
  617. width: 42%;
  618. float: left;
  619. &.zz{
  620. width: 100%;
  621. }
  622. .label{
  623. float: left;
  624. font-size: $font-size-28;
  625. color: $text-color;
  626. line-height: 102rpx;
  627. width: 150rpx;
  628. text-align: right;
  629. &.zz{
  630. width: 230rpx;
  631. }
  632. }
  633. .upload-picture{
  634. float: left;
  635. height: 100rpx;
  636. .upload-none{
  637. width: 100rpx;
  638. height: 100rpx;
  639. text-align: center;
  640. line-height: 100rpx;
  641. color: #999999;
  642. border: 1px solid #999999;
  643. border-radius: 10rpx;
  644. margin: 0 20rpx;
  645. .iconfont{
  646. font-size: $font-size-28;
  647. }
  648. }
  649. .upload-image{
  650. width: 100rpx;
  651. height: 100rpx;
  652. border-radius: 10rpx;
  653. margin: 0 20rpx;
  654. position: relative;
  655. image{
  656. width: 100rpx;
  657. height: 100rpx;
  658. border-radius: 10rpx;
  659. }
  660. .upload-del{
  661. width: 40rpx;
  662. height: 40rpx;
  663. position: absolute;
  664. top: -20rpx;
  665. right: -20rpx;
  666. line-height: 40rpx;
  667. text-align: center;
  668. .iconfont{
  669. font-size: $font-size-32;
  670. color: #999999;
  671. }
  672. }
  673. }
  674. }
  675. }
  676. .register-input{
  677. width: 654rpx;
  678. height: 40rpx;
  679. padding: 24rpx;
  680. margin: 0 auto;
  681. margin-bottom: 60rpx;
  682. background: #F7F7F7;
  683. border-radius: 14rpx;
  684. .input{
  685. width: 100%;
  686. height: 100%;
  687. background: #F7F7F7;
  688. font-size: $font-size-28;
  689. line-height: 40rpx;
  690. color: #333333;
  691. border-radius: 14rpx;
  692. }
  693. }
  694. .register-fiexd{
  695. width: 100%;
  696. height: auto;
  697. position: fixed;
  698. bottom: 0;
  699. left: 0;
  700. z-index: 999;
  701. background: #FFFFFF;
  702. }
  703. .register-btn{
  704. width: 702rpx;
  705. height: 88rpx;
  706. border-radius: 14rpx;
  707. font-size: $font-size-28;
  708. line-height: 88rpx;
  709. color: #FFFFFF;
  710. margin: 0 auto;
  711. text-align: center;
  712. background: $btn-confirm;
  713. margin-top: 96rpx;
  714. &.none{
  715. border: 1px solid $color-system;
  716. background: #FFFFFF;
  717. color:$color-system;
  718. margin-top: 0;
  719. }
  720. &.sub{
  721. margin-top: 0;
  722. }
  723. }
  724. }
  725. }
  726. </style>