register.vue 18 KB

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