login.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <template>
  2. <view>
  3. <view class="container" :style="'height:'+ screenHeight +'px !important;'" v-if="isload">
  4. <!-- <image :src="bgImg" mode="" class="bgimg"></image> -->
  5. <view class="box" >
  6. <!-- <image src="../../static/img/login_text.png" mode="" class="loginLogo"></image> -->
  7. <view class="" >
  8. <button class="wxlogin" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" >微信用户快捷登录</button>
  9. </view>
  10. <view class="iphoneLogin" @click="iphoneLogin">使用手机号登录</view>
  11. <view>
  12. </view>
  13. <view class="privacy" @click="privacyClick">
  14. <image src="../../static/img/login_icon_checked.png" mode="" class="imgPrivacy" v-show="privacyCk"></image>
  15. <view class="nock" v-show="!privacyCk"></view>
  16. <span>同意</span> <span class="span1" @click.stop="goTreaty">《服务协议》</span>
  17. <span>与</span> <span class="span1" @click.stop="goIntimity">《隐私政策》 </span>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. export default {
  25. data() {
  26. return {
  27. screenHeight: '',
  28. bgImg:'http://phone.66km.cn:8088/thFiles/4E3EB990-959E-4933-9B29-C09C8074CFEA.png',
  29. privacyCk:true,
  30. wxdata:'',
  31. wxCode:'',
  32. openID:'',
  33. session_key:'',
  34. wxPhoneData:'',
  35. wxOpendata:'',
  36. isload:false,
  37. }
  38. },
  39. onLoad() {
  40. this.screenHeight = uni.getSystemInfoSync().windowHeight;
  41. // console.log( this.screenHeight)
  42. this.wxOpendata=uni.getStorageSync("wxOpendata");
  43. this.wxdata=uni.getStorageSync("wxdata");
  44. if(this.wxOpendata){
  45. this.isload=true;
  46. }else{
  47. uni.redirectTo({
  48. url:'empower?type=1'
  49. })
  50. }
  51. },
  52. methods: {
  53. goTreaty(){
  54. uni.navigateTo({
  55. url:'../me/treaty'
  56. })
  57. },
  58. goIntimity(){
  59. uni.navigateTo({
  60. url:'../me/intimity'
  61. })
  62. },
  63. getPhoneNumber: function(e) {
  64. console.log(e.detail);
  65. this.wxPhoneData=e.detail;
  66. this.gologin()
  67. },
  68. gologin(){
  69. var that=this;
  70. this.$http('worldKeepCar/sys/wxLogin', {
  71. openID:this.wxOpendata.openid,
  72. encrypData:this.wxPhoneData.encryptedData,
  73. iv:this.wxPhoneData.iv,
  74. sessionKey:this.wxOpendata.session_key,
  75. nickName:this.wxdata.userInfo.nickName,
  76. headUrl:this.wxdata.userInfo.avatarUrl,
  77. },).then(res => {
  78. //console.log(res)
  79. uni.hideLoading();
  80. if(res.code==0){
  81. uni.setStorage({
  82. key: 'logodata',
  83. data: res.data,
  84. success: function () {
  85. }
  86. });
  87. uni.showToast({
  88. title: '登录成功',
  89. icon:'none',
  90. duration: 3000
  91. });
  92. uni.switchTab({
  93. url:'../index/index'
  94. })
  95. }else{
  96. uni.showToast({
  97. title: res.msg,
  98. icon:'none',
  99. duration: 3000
  100. });
  101. }
  102. })
  103. },
  104. privacyClick(){
  105. this.privacyCk=!this.privacyCk
  106. },
  107. iphoneLogin(){
  108. uni.navigateTo({
  109. url:'iphoneLogin'
  110. })
  111. },
  112. }
  113. }
  114. </script>
  115. <style scoped>
  116. .bgimg {
  117. display: contents;
  118. overflow: hidden;
  119. position: relative;
  120. }
  121. .container{
  122. width: 100%;
  123. min-height: 100%;
  124. background: url('http://phone.66km.cn:8088/thFiles/4E3EB990-959E-4933-9B29-C09C8074CFEA.png');
  125. background-size: 100%;
  126. }
  127. .loginLogo{
  128. width: 215rpx;height: 111rpx;
  129. }
  130. .box{
  131. padding-top: 20vh;
  132. padding-left: 58rpx;
  133. padding-right: 58rpx;
  134. }
  135. .wxlogin{
  136. width: 634rpx;
  137. height: 88rpx;
  138. background: #FF4F00;
  139. border-radius: 44rpx;
  140. line-height: 88rpx;
  141. text-align: center;
  142. color: #FFFFFF;
  143. font-size: 30rpx;
  144. margin-top: 200rpx;
  145. }
  146. .iphoneLogin{
  147. width: 634rpx;
  148. height: 88rpx;
  149. background: rgba(255,255,255,0.3);
  150. border-radius: 44rpx;
  151. line-height: 88rpx;
  152. text-align: center;
  153. color: #FFFFFF;
  154. font-size: 30rpx;
  155. margin-top: 50rpx;
  156. }
  157. .privacy{
  158. display: flex;
  159. justify-content: center;
  160. font-size: 24rpx;
  161. color: #CCCCCC;
  162. padding-top: 34rpx;
  163. }
  164. .imgPrivacy{
  165. width: 28rpx;
  166. height: 28rpx;
  167. margin-top: 2rpx;
  168. margin-right: 10rpx;
  169. }
  170. .span1{
  171. color: #FF4F00;
  172. }
  173. .nock{
  174. width: 22rpx;
  175. height: 22rpx;
  176. border-radius: 50%;
  177. border:2px solid #AEAEAE;
  178. margin-top: 2rpx;
  179. margin-right: 10rpx;
  180. }
  181. </style>