fix
13404089107
2025-07-28 2e90f57e7d28d6a949247ef39b487d3e75b56683
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
<template>
  <view class="content">
    <view class="header" :style="{marginTop:systemInfo.statusBarHeight+'px'}" @click="navHome"><image mode="widthFix" src="/static/icon/icon_close.png"></image></view>
    <view class="container">
      <view class="logo">
        <image class="logo-image" mode="widthFix" src="/static/icon/logo.png"></image>
        <view class="logo-title">注册/登录</view>
      </view>
      <input type="number" class="input-phone" placeholder="请输入手机号" :maxlength="11" v-model="phone" />
      <!-- <view class="passward-login"><text>密码登录</text></view> -->
      <button class="button submit" :class="{disabled:verifyPhone}" :disabled="verifyPhone" @click="submit">发送验证码</button>
      <!-- <view class="tip">点击按钮即代表同意热看点</view> -->
      <view class="termsPrivacy" @click="checkedHandle">
        <checkbox style="transform:scale(0.7)" :checked="checked" />
        同意热看点
        <view class="link" @click="$navTo('/pages/user/setup/documentDisplay?t=2&title=用户协议')">《用户协议》</view>
        以及
        <view class="link" @click="$navTo('/pages/user/setup/documentDisplay?t=3&title=隐私条款')">《隐私协议》</view>
      </view>
      <button class="button oneclick-login-btn" :loading="loading.loginBtn" open-type="getPhoneNumber" @getphonenumber="getphonenumber" @click="login">手机号一键登录</button>
    </view>
  </view>
</template>
 
<script>
  import {
    mapState,
    mapMutations
  } from 'vuex'
  export default {
    data() {
      return {
        loading:{
          loginBtn:false
        },
        phone:"",
        checked:false
      }
    },
    onLoad() {
    },
    computed:{
      ...mapState({
        systemInfo: state=>state.systemInfo
      }),
      verifyPhone(){
        const strictReg = /^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[189]))\d{8}$/;
        return !strictReg.test(this.phone)
      }
    },
    methods: {
      ...mapMutations(['setUserInfo']),
      submit(){
        if(!this.checked){
          this.$toast("请阅读并同意《用户协议》和《隐私协议》")
          return
        }
        if(this.phone){
          this.$navTo('/pages/login/verificationCode?phone=' + this.phone)
        }
      },
      navHome(){
        uni.reLaunch({
          url:"/pages/index/index/index"
        })
      },
      login(){
        
      },
      checkedHandle(){
        this.checked = !this.checked
      },
      async getphonenumber(ev){
        if(!ev.detail.code) return
        if(!this.checked){
          this.$toast("请阅读并同意《用户协议》和《隐私协议》")
          return
        }
        if(this.loading.loginBtn) return
        this.loading.loginBtn = true
        try {
          let { data } = await this.$apis.login.wxLoginGetPhone({code:ev.detail.code})
          uni.login({
            provider: 'weixin',
            success: (e) => {
              // 登录成功
              let params = {
                code: e.code,
                encryptedData: ev.detail.encryptedData,
                iv: ev.detail.iv,
                phone: data
              }
              this.$apis.login.wxLogin(params).then(res=>{
                this.loading.loginBtn = false
                this.setUserInfo(res.data)
                this.$toast('登录成功',ev=>{
                  uni.reLaunch({
                    url:"/pages/index/index/index"
                  })
                })
              }).catch(err=>{
                this.loading.loginBtn = false
              })
            }
          })
        } catch (error) {
          this.loading.loginBtn = false
        }
      }
    }
  }
</script>
 
<style lang="scss" scoped>
  .content {
    .header {
      height: 83rpx;
      display: flex;
      align-items: center;
      padding: 0 26rpx;
      padding-top: constant(safe-area-inset-top);
      padding-top: env(safe-area-inset-top);
      image{
        width: 34.62rpx;
      }
    }
    .container{
      padding: 0 60rpx;
      padding-top: 110rpx;
      .logo {
        display: flex;
        align-items: center;
        .logo-image {
          width: 100rpx;
        }
        .logo-title {
          padding-left: 28rpx;
          font-weight: 700;
          font-size: 46rpx;
          color: #000000;
          line-height: 63rpx;
        }
      }
      .input-phone {
        height: 116rpx;
        margin-top: 35rpx;
        border-bottom: 1rpx solid #D9D9D9;
      }
      .passward-login {
        margin-top: 26rpx;
        font-size: 24rpx;
        color: rgba(0,0,0,0.6);
        line-height: 24rpx;
        display: flex;
        justify-content: flex-end;  
      }
      .submit {
        width: 635rpx;
        height: 96rpx;
        background: #FFFFFF;
        border-radius: 58rpx;
        opacity: 0.8;
        background-color: #FF2729;
        font-weight: 700;
        font-size: 35rpx;
        color: #FFFFFF;
        line-height: 48rpx;
        margin-top: 78rpx;
        &.disabled{
          background-color: #FFD3D3;
        }
      }
      .tip {
        font-size: 24rpx;
        color: rgba(0,0,0,0.6);
        line-height: 34rpx;
        margin-top: 30rpx;
        text-align: center;
      }
      .termsPrivacy {
        display: flex;
        align-items: center;
        justify-content: center;
        margin-top: 23rpx;
        font-size: 24rpx;
        color: #000000;
        line-height: 24rpx;
        .link {}
      }
      .oneclick-login-btn{
        width: 635rpx;
        height: 96rpx;
        border-radius: 58rpx;
        border: 2rpx solid #FF2729;
        
        font-weight: 700;
        font-size: 35rpx;
        color: #FF2729;
        line-height: 48rpx;
        position: absolute;
        bottom: 196rpx;
      }
    }
  }
</style>