login.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <template>
  2. <view class="page">
  3. <view class="content">
  4. <view class="title flex-col justify-center">
  5. <text>HI,您好!</text>
  6. <text>欢迎登录</text>
  7. </view>
  8. <view class="h-logo flex-row justify-center">
  9. <image class="logo-img" src="../../static/logo.png"></image>
  10. </view>
  11. <button class="login-btn flex-row justify-center" @click="wechatCodeLogin">
  12. <u-icon name="weixin-fill" color="green" size="26"></u-icon>
  13. <text class="weixinLogin">授权微信登录</text>
  14. </button>
  15. <!-- <view class="login-form flex-row justify-between">-->
  16. <!-- <view class="flex-row">-->
  17. <!-- <view class="o"></view>-->
  18. <!-- <view class="v"></view>-->
  19. <!-- <text class="text1">自动登录</text>-->
  20. <!-- </view>-->
  21. <!-- <view @click="gotoRetieveAccount()" class="forget-acconut-password">-->
  22. <!-- <text>找回账号</text>-->
  23. <!-- </view>-->
  24. <!-- </view>-->
  25. <view class="bottom flex-row justify-between">
  26. <view class="o"></view>
  27. <view class="v"></view>
  28. <view class="login-form1 ">
  29. <text class="text2">允许我们在必要的场景下合理使用你的相关信息,且阅读并同意</text>
  30. <text class="text3">《会员协议》、《服务对象协《隐私协议》</text>
  31. <text class="text2">等内容</text>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. export default {
  39. data() {
  40. return {
  41. title: 'Hello'
  42. }
  43. },
  44. onLoad() {
  45. },
  46. methods: {
  47. wechatCodeLogin(){
  48. let that = this;
  49. wx.login({
  50. success(re) {
  51. that.$api.wxAuthLogin({code:re.code}).then(res=>{
  52. uni.setStorageSync('userInfo',res.data.data.userInfo)
  53. uni.setStorageSync('accessToken',res.data.data.access_token)
  54. uni.setStorageSync('phoneIsBind',res.data.data.phoneIsBind)
  55. if (res.data.data.phoneIsBind){
  56. // uni.switchTab({
  57. // url: '/pages/index/index',
  58. // })
  59. uni.navigateTo({
  60. url: '/loginPages/bindAccount/index',
  61. })
  62. }else {
  63. uni.navigateTo({
  64. url: '/loginPages/bindAccount/index',
  65. })
  66. }
  67. })
  68. },
  69. });
  70. },
  71. }
  72. }
  73. </script>
  74. <style>
  75. @import '/common/css/common.css';
  76. @import './index.rpx.css';
  77. </style>