学员端小程序
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.

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