学员端小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

166 lines
3.9 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. <template>
  2. <view class="main">
  3. <view class="h1Img">
  4. <image src="../../../static/images/userCenter/loginTitle.png" mode=""></image>
  5. </view>
  6. <view class="btnCon">
  7. <view class="btn">手机号快捷登录</view>
  8. <!-- <button type="success" size="mini" style="margin-top: 15rpx;" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" text="获取手机号">获取手机号</button> -->
  9. <view class="btn border" @click="$goPage('/pages/userCenter/login/loginByPhone');">手机号登录/注册</view>
  10. </view>
  11. <view style="margin-top: 40rpx;">
  12. <privacyRadion :isCheck="isCheck" @changeRadio="changeRadio"></privacyRadion>
  13. </view>
  14. <u-popup :show="show" :round="10" mode="center" >
  15. <view class="">
  16. <view class="popupCon">
  17. <view class="h1"> </view>
  18. <view class="msg">授权手机号我们才能继续为您 <br>提供服务哦~</view>
  19. <view class="oneBtn">我知道了</view>
  20. </view>
  21. </view>
  22. </u-popup>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. data() {
  28. return {
  29. isCheck: false,
  30. show: false,
  31. decodePhoneParams: {}
  32. }
  33. },
  34. onLoad() {
  35. this.getCode()
  36. // uni.getLocation({
  37. // type: 'wgs84',
  38. // success: function (res) {
  39. // console.log(res)
  40. // console.log('当前位置的经度:' + res.longitude);
  41. // console.log('当前位置的纬度:' + res.latitude);
  42. // }
  43. // });
  44. },
  45. methods: {
  46. // 获取code
  47. getCode() {
  48. uni.login({
  49. provider: 'weixin',
  50. success: loginRes => {
  51. this.decodePhoneParams.code = loginRes.code
  52. console.log('loginRes')
  53. console.log(loginRes)
  54. }
  55. });
  56. },
  57. // 获取手机号
  58. async getPhoneNumber(e) {
  59. await this.getCode();
  60. console.log('获取手机号')
  61. console.log(e)
  62. if(!this.decodePhoneParams.code || !e.detail.encryptedData){
  63. return false;
  64. }
  65. },
  66. // 是否选择协议
  67. changeRadio(val) {
  68. this.isCheck = val
  69. },
  70. init() {
  71. uni.login({
  72. provider: 'weixin',
  73. "onlyAuthorize": true,
  74. success: function (loginRes) {
  75. console.log('11')
  76. console.log(loginRes)
  77. // 登录成功
  78. uni.getUserInfo({
  79. provider: 'weixin',
  80. success: function(info) {
  81. // 获取用户信息成功, info.authResult保存用户信息
  82. console.log('11')
  83. console.log(info)
  84. }
  85. })
  86. },
  87. fail: function (err) {
  88. // 登录授权失败
  89. // err.code是错误码
  90. }
  91. });
  92. },
  93. }
  94. }
  95. </script>
  96. <style lang="scss" scoped>
  97. .main {
  98. width: 100%;
  99. display: flex;
  100. flex-direction: column;
  101. align-items: center;
  102. background: url('../../../static/images/userCenter/loginTopBg.png') no-repeat;
  103. background-size: 100% 360rpx;
  104. .h1Img {
  105. width: 658rpx;
  106. height: 94rpx;
  107. margin: 288rpx 0 120rpx 0;
  108. }
  109. .btnCon {
  110. .btn {
  111. width: 396rpx;
  112. height: 72rpx;
  113. background: #1989FA;
  114. border-radius: 8rpx;
  115. color: #fff;
  116. margin-bottom: 32rpx;
  117. text-align: center;
  118. line-height: 72rpx;
  119. font-size: 28rpx;
  120. &.border {
  121. background: rgba(25,137,250,0.1);
  122. border: 2rpx solid #1989FA;
  123. color: $themC;
  124. }
  125. }
  126. }
  127. }
  128. .popupCon {
  129. width: 558rpx;
  130. height: 344rpx;
  131. border-radius: 16rpx;
  132. overflow: hidden;
  133. .h1 {
  134. line-height: 124rpx;
  135. text-align: center;
  136. font-size: 36rpx;
  137. font-weight: 600;
  138. height: 124rpx;
  139. width: 100%;
  140. background: linear-gradient(180deg, #C1DFFE 0%, #FFFFFF 100%);
  141. }
  142. .msg {
  143. font-size: 28rpx;
  144. color: #686B73;
  145. padding: 0 0 30rpx 0;
  146. text-align: center;
  147. }
  148. .oneBtn {
  149. line-height: 112rpx;
  150. height: 112rpx;
  151. border-top: 1px solid #E8E9EC;
  152. text-align: center;
  153. font-size: 36rpx;
  154. color: $themC;
  155. font-weight: 600;
  156. }
  157. }
  158. </style>