logincode.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <template>
  2. <view class="container login">
  3. <view class="login-main">
  4. <image class="logo" src="../../static/login-logo@3x.png" mode=""></image>
  5. <text class="logo-text">生美/医美采购服务平台</text>
  6. </view>
  7. <view class="login-input">
  8. <input type="number"
  9. v-model="invitationCode"
  10. maxlength="6"
  11. class="input"
  12. placeholder="请输入邀请码"
  13. />
  14. </view>
  15. <view class="login-row"><text>免费注册</text></view>
  16. <view class="login-btn" @click="goLogin">登录</view>
  17. <view class="login-btn-last" @click.stop="this.$api.navigateTo('/pages/login/login')">账号登录</view>
  18. </view>
  19. </template>
  20. <script>
  21. import authorize from '@/common/config/authorize.js'
  22. import {mapState,mapMutations } from 'vuex';
  23. import { invitationCodeLogin } from '@/api/use.js'
  24. export default{
  25. data() {
  26. return{
  27. invitationCode:'', //获取用户登录的邀请码
  28. }
  29. },
  30. onLoad(option) {
  31. },
  32. methods:{
  33. ...mapMutations(['login']),
  34. goLogin() {
  35. if( this.invitationCode == ''){
  36. this.$util.msg('请输入邀请码',2000)
  37. return
  38. }
  39. wx.getUserInfo({
  40. success: res => {
  41. this.isUserInfo = false
  42. this.userInfo = res.userInfo;
  43. let params ={
  44. invitationCode:this.invitationCode,
  45. nickName:res.userInfo.nickName,
  46. headimgurl:res.userInfo.avatarUrl,
  47. }
  48. invitationCodeLogin(params).then(response =>{
  49. this.login(response.data)
  50. this.$api.switchTabTo('/pages/tabBar/home/home')
  51. }).catch(error =>{
  52. this.$util.msg(error.msg,2000)
  53. this.isUserInfo = false
  54. })
  55. }
  56. })
  57. }
  58. }
  59. }
  60. </script>
  61. <style lang="scss">
  62. .login{
  63. width: 100%;
  64. height: auto;
  65. .model-warp.none{
  66. display: none;
  67. }
  68. .model-warp.show{
  69. display: block;
  70. }
  71. .login-main{
  72. width: 100%;
  73. display: flex;
  74. flex-direction: column;
  75. align-items: center;
  76. height: 198rpx;
  77. padding: 170rpx 0 60rpx 0;
  78. .logo{
  79. width: 138rpx;
  80. height: 118rpx;
  81. display: block;
  82. }
  83. .logo-text{
  84. font-size: 30rpx;
  85. line-height: 44rpx;
  86. color: $color-system;
  87. font-weight: 600;
  88. margin-top: 20rpx;
  89. }
  90. }
  91. .login-input{
  92. width: 654rpx;
  93. height: 40rpx;
  94. padding: 24rpx;
  95. margin: 0 auto;
  96. margin-bottom: 24rpx;
  97. background: #F7F7F7;
  98. border-radius: 14rpx;
  99. .input{
  100. width: 100%;
  101. height: 100%;
  102. background: #F7F7F7;
  103. font-size: $font-size-28;
  104. line-height: 40rpx;
  105. color: #333333;
  106. border-radius: 14rpx;
  107. }
  108. }
  109. .login-row{
  110. padding: 0 24rpx;
  111. font-size: $font-size-28;
  112. line-height: 40rpx;
  113. color: #E15616;
  114. margin-bottom: 48rpx;
  115. }
  116. .login-btn{
  117. width: 702rpx;
  118. height: 88rpx;
  119. border-radius: 14rpx;
  120. font-size: $font-size-28;
  121. line-height: 88rpx;
  122. color: #FFFFFF;
  123. margin: 0 auto;
  124. text-align: center;
  125. background: $btn-confirm;
  126. }
  127. .login-btn-last{
  128. width: 702rpx;
  129. height: 86rpx;
  130. border-radius: 14rpx;
  131. font-size: $font-size-28;
  132. line-height: 88rpx;
  133. color: $color-system;
  134. margin: 0 auto;
  135. text-align: center;
  136. border: 1px solid $color-system;
  137. margin-top: 20rpx;
  138. }
  139. .model-authorization{
  140. width: 100%;
  141. height: 100%;
  142. position: fixed;
  143. top: 0;
  144. left: 0;
  145. z-index: 999;
  146. .authorization{
  147. width: 518rpx;
  148. height: 320rpx;
  149. position: absolute;
  150. background: rgba(255,255,255,.7);
  151. left: 0;
  152. right: 0;
  153. bottom: 0;
  154. top: 0;
  155. margin: auto;
  156. .to-btn{
  157. position: absolute;
  158. top: 0;
  159. left: 0;
  160. right: 0;
  161. bottom: 0;
  162. margin: auto;
  163. width: 70%;
  164. height: 88rpx;
  165. font-size: $font-size-28;
  166. line-height: 88rpx;
  167. color: #FFFFFF;
  168. text-align: center;
  169. border-radius: 44rpx;
  170. }
  171. }
  172. }
  173. }
  174. </style>