wxLogin.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <template>
  2. <view class="login">
  3. <view class="title">
  4. </view>
  5. <view class="logo">
  6. <image src="/static/identify/logo.png" mode=""></image>
  7. </view>
  8. <view class="btn" @click="login">
  9. 微信登录
  10. </view>
  11. <view class="agree">
  12. <view class="round" @click="isLook">
  13. <image src="/static/other/select_round.png" mode="" v-if="look"></image>
  14. <image src="/static/other/round.png" mode="" v-else></image>
  15. </view>
  16. <view class="choice">
  17. 我已阅读并同意 <text @click="goAgreement">《用户协议》</text> 和 <text @click="goPrivacy">《隐私政策》</text>
  18. </view>
  19. </view>
  20. </view>
  21. </template>
  22. <!-- <script href="http://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script> -->
  23. <script ref="http://res.wx.qq.com/open/js/jweixin-1.6.0.js">
  24. import {
  25. wxGetCode
  26. } from '../../api/my'
  27. export default {
  28. data() {
  29. return {
  30. openId: '',
  31. isLogin: false,
  32. token: '',
  33. url:'',
  34. look:false
  35. }
  36. },
  37. methods: {
  38. goPrivacy(){
  39. uni.navigateTo({
  40. url:'./privacy'
  41. })
  42. },
  43. goAgreement(){
  44. uni.navigateTo({
  45. url:'./agreement'
  46. })
  47. },
  48. isLook(){
  49. this.look = !this.look
  50. },
  51. login() {
  52. if(this.look){
  53. window.location.href = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa72f643173a90106&redirect_uri=https://test.baoxianzhanggui.com/fragrance/&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect'
  54. }else{
  55. uni.showToast({
  56. title: '请同意《用户协议》和《隐私政策》',
  57. icon: 'none'
  58. })
  59. }
  60. // wxGetCode().then(res => {
  61. // })
  62. // uni.request({
  63. // url: 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx9aaa5016e4b259bd&redirect_uri=https://test.baoxianzhanggui.com/fragrance/%23/&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect',
  64. // success: (res) => {
  65. // }
  66. // })
  67. },
  68. back() {
  69. uni.switchTab({
  70. url: '/pages/index/index'
  71. })
  72. }
  73. },
  74. onLoad(options) {}
  75. }
  76. </script>
  77. <style lang="scss" scoped>
  78. .login {
  79. width: 100vw;
  80. height: 100vh;
  81. // background-image: radial-gradient(circle, #b1fffc, #fcfdff);
  82. background: radial-gradient( 1000% 50% at 65% 50%, #C9FEF4 0%, #F6FFFF 100%);
  83. overflow: hidden;
  84. .title {
  85. margin: 38rpx 0px 0px 40rpx;
  86. font-size: 36rpx;
  87. letter-spacing: 1px;
  88. }
  89. // display: flex;
  90. // align-items: center;
  91. .logo {
  92. width: 240rpx;
  93. height: 240rpx;
  94. border-radius: 10%;
  95. overflow: hidden;
  96. margin: 80px auto 0px;
  97. image {
  98. width: 100%;
  99. height: 100%;
  100. }
  101. }
  102. .btn {
  103. width:670rpx;
  104. height: 84rpx;
  105. text-align: center;
  106. background: linear-gradient(to right, #35c99d, #27aea7);
  107. margin: 200rpx 0px 20px 40rpx;
  108. line-height: 84rpx;
  109. border-radius: 10px;
  110. color: #fcfdff;
  111. font-size: 28rpx;
  112. }
  113. .agree{
  114. width: 100%;
  115. height: 50rpx;
  116. margin-left: 40rpx;
  117. display: flex;
  118. // justify-content: center;
  119. align-items: center;
  120. .round{
  121. margin-right: 10rpx;
  122. image{
  123. width: 28rpx;
  124. height: 28rpx;
  125. }
  126. }
  127. .choice{
  128. font-size: 26rpx;
  129. }
  130. text{
  131. color: #27aea7;
  132. line-height: 50rpx;
  133. }
  134. }
  135. }
  136. </style>