register.vue 17 KB

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