| | |
| | | |
| | | <view class="input-row password-row"> |
| | | <u-icon name="lock" size="30" color="#B8B8B8"></u-icon> |
| | | <input v-model="form.password" class="input-field" password type="text" placeholder="请输入密码" placeholder-style="color: #999999;" /> |
| | | <input v-model="form.password" class="input-field" :password="!showPassword" placeholder="请输入密码" placeholder-style="color: #999999;" /> |
| | | <view class="password-toggle" @click="showPassword = !showPassword"> |
| | | <u-icon :name="showPassword ? 'eye' : 'eye-off'" size="20" color="#B8B8B8"></u-icon> |
| | | </view> |
| | | </view> |
| | | <view class="input-divider"></view> |
| | | </view> |
| | |
| | | <image class="agree-icon" :src="agreed ? '/static/icon/ic_accept_sel@2x.png' : '/static/icon/ic_accept@2x.png'" mode="aspectFit" @tap="agreed = !agreed"></image> |
| | | <view class="agreement-text-wrap"> |
| | | <text class="agreement-text">我已阅读并同意</text> |
| | | <text class="agreement-link" @click="goToService(0)">《用户服务协议》</text> |
| | | <text class="agreement-link" @click="goToService(2)">《门店服务协议》</text> |
| | | <text class="agreement-text">及</text> |
| | | <text class="agreement-link" @click="goToService(1)">《用户隐私政策》</text> |
| | | <text class="agreement-link" @click="goToService(3)">《门店隐私政策》</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | |
| | | data() { |
| | | return { |
| | | agreed: false, |
| | | showPassword: false, |
| | | form: { |
| | | telephone: '', |
| | | password: '' |
| | |
| | | }, |
| | | onLoad() { |
| | | // 静默登录 |
| | | |
| | | if (this.userInfo.bindShopId) { |
| | | uni.showLoading({ |
| | | title:'登录中...' |
| | |
| | | } |
| | | uni.hideLoading(); |
| | | // setTimeout(() => { |
| | | uni.reLaunch({ |
| | | uni.navigateTo({ |
| | | url: '/shop/pages/store-home/store-home' |
| | | }); |
| | | // }, 1000) |
| | |
| | | } |
| | | }, |
| | | methods: { |
| | | async handleLogin() { |
| | | handleLogin() { |
| | | if (!this.form.telephone) { |
| | | uni.showToast({ |
| | | title: '请输入账号', |
| | |
| | | }) |
| | | return |
| | | } |
| | | uni.showLoading({ title: '登录中...', mask: true }) |
| | | try { |
| | | const res = await this.$u.api.shopLogin({ |
| | | openid: this.openid, |
| | | password: this.form.password, |
| | | telephone: this.form.telephone |
| | | }) |
| | | uni.hideLoading() |
| | | this.$u.api.shopLogin({ |
| | | openid: this.openid, |
| | | password: this.form.password, |
| | | telephone: this.form.telephone |
| | | }).then(async res => { |
| | | if (res.code === 200) { |
| | | this.$store.commit('setUserType', 1) |
| | | this.$store.commit('setShopToken', res.data.token) |
| | |
| | | url: '/shop/pages/store-home/store-home' |
| | | }); |
| | | }, 1500) |
| | | } else { |
| | | uni.showToast({ |
| | | title: res.msg || '登录失败', |
| | | icon: 'none' |
| | | }) |
| | | } |
| | | } catch (err) { |
| | | uni.hideLoading() |
| | | uni.showToast({ |
| | | title: '登录失败', |
| | | icon: 'none' |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | goToService(type) { |
| | | uni.navigateTo({ |
| | |
| | | .password-row { |
| | | margin-top: 18rpx; |
| | | } |
| | | |
| | | .password-toggle { |
| | | padding: 10rpx; |
| | | } |
| | | |
| | | .input-field { |
| | | flex: 1; |
| | |
| | | } |
| | | |
| | | .agreement-row { |
| | | background: #D9F3FF; |
| | | margin-top: 60rpx; |
| | | display: flex; |
| | | align-items: flex-start; |