From b850badcf800eff5819e0789d1b81e5e27fcd037 Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期五, 29 十一月 2024 17:21:34 +0800
Subject: [PATCH] ll
---
h5/pages/login.vue | 82 +++++++++++++++++-----------------------
1 files changed, 35 insertions(+), 47 deletions(-)
diff --git a/h5/pages/login.vue b/h5/pages/login.vue
index 0b3b772..666d529 100644
--- a/h5/pages/login.vue
+++ b/h5/pages/login.vue
@@ -5,16 +5,17 @@
<view class="login_list">
<view class="login_list_item">
<image src="@/static/login_ic_phone@2x.png" mode="widthFix" />
- <input v-model="form.username" maxlength="18" placeholder="璇疯緭鍏ユ墜鏈哄彿" />
+ <input v-model="form.phone" maxlength="18" placeholder="璇疯緭鍏ユ墜鏈哄彿" />
</view>
-<!-- <view class="login_list_item">
+<!-- <view class="login_list_item">
<image src="@/static/login_ic_password@2x.png" mode="widthFix" />
<input v-model="form.password" type="password" placeholder="瀵嗙爜" />
</view> -->
- <view class="login_list_item">
+ <view class="login_list_item">
<image src="@/static/login_ic_password@2x.png" mode="widthFix"></image>
<input v-model="form.code" placeholder="璇疯緭鍏ラ獙璇佺爜" type="text" />
- <view class="btn">鑾峰彇楠岃瘉鐮�</view>
+ <view v-if="downTime == 0" class="btn" @click="sendSms">鑾峰彇楠岃瘉鐮�</view>
+ <view v-else class="btn gray">{{ downTime }}</view>
</view>
</view>
<view class="login_btn">
@@ -24,7 +25,7 @@
</template>
<script>
-import { loginPost, loginCaptcha, getUserInfo, getSystemDictData } from '@/api'
+import { loginPost, getUserInfo, sendSMsPost } from '@/api'
import { mapState, mapMutations } from 'vuex'
export default {
name: 'login',
@@ -32,20 +33,14 @@
data() {
return {
form: {
- // username: '18056814089',
- username: '',
- password: '',
- code: ''
+ phone: '17878787878',
+ code: '1'
},
- isShowProtocol: false,
- ProtocolFlag: false,
- captcha: {},
- htmlText: ''
+ downTime: 0
}
},
onLoad() {
- this.initCaptcha()
},
onBackPress(options) {
uni.redirectTo({
@@ -55,39 +50,28 @@
},
methods: {
...mapMutations(["setToken", "setUserInfo"]),
- changeFalg() {
- this.ProtocolFlag = !this.ProtocolFlag
- },
- getContent() {
- getSystemDictData({
- dictCode: 'SYSTEM',
- label: 'USER_PROTOCOL'
- }).then(res => {
- this.htmlText = res.data.code
- this.isShowProtocol = true
- })
- },
- showContent() {
- this.getContent()
- },
- initCaptcha() {
- loginCaptcha().then(res => {
- this.captcha = res.data
- })
- },
-
+ sendSms() {
+ this.downTime = 60
+ let timer = setInterval(() => {
+ if(this.downTime == 0) return clearInterval(timer)
+ this.downTime = this.downTime - 1
+ }, 1000)
+ const { form } = this
+ sendSMsPost({
+ phone: form.phone,
+ type: 0
+ }).then(res => {
+ this.showToast('鐭俊鍙戦�佹垚鍔�')
+ })
+ },
onLogin() {
const { form, ProtocolFlag } = this
- if (!ProtocolFlag) return uni.showToast({
- title: '璇峰厛闃呰骞跺悓鎰忕敤鎴峰崗璁�',
- icon: 'none'
- })
- if (!form.username) return uni.showToast({
- title: '璐﹀彿涓嶈兘涓虹┖',
- icon: 'none'
- })
- if (!form.password) return uni.showToast({
- title: '瀵嗙爜涓嶈兘涓虹┖',
+ // if (!ProtocolFlag) return uni.showToast({
+ // title: '璇峰厛闃呰骞跺悓鎰忕敤鎴峰崗璁�',
+ // icon: 'none'
+ // })
+ if (!form.phone) return uni.showToast({
+ title: '鎵嬫満鍙蜂笉鑳戒负绌�',
icon: 'none'
})
if (!form.code) return uni.showToast({
@@ -96,15 +80,15 @@
})
loginPost({
...form,
- uuid: this.captcha.uuid,
openId: this.$store.state.openId
}).then(res => {
if (res.code === 200) {
this.setToken(res.data)
+ this.showToast('鐧诲綍鎴愬姛')
getUserInfo().then(ress => {
this.setUserInfo(ress.data)
uni.redirectTo({
- url: "/pages/staff/index"
+ url: "/pages/index"
})
})
}
@@ -162,7 +146,11 @@
.btn{
width: 145rpx;
color: $primaryColor;
+ text-align: center;
}
+ .gray{
+ color: #999999;
+ }
input {
flex: 1;
height: 100%;
--
Gitblit v1.9.3