register.vue 18 KB

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