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

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