register.vue 17 KB

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