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

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