index_1.vue
4 KB
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
206
207
<template>
<view class="logo-v">
<view class="login-bg">
<image src="/static/login-bg.png" mode="widthFix"></image>
</view>
<view class="logo-hd u-flex-col" style="">
<view class="u-flex-col introduce u-m-t-30">
<text class="u-font-36 text-one" style="">一丰大药房</text>
<text class="u-font-24 text-two">表单采集</text>
</view>
<view class="loginSwitch u-flex-col">
<view class="loginInputBox u-flex-col">
<u-form :model="formData" :rules="rules" ref="dataForm" :errorType="['toast']" label-position="left"
label-width="150" label-align="left">
<u-form-item prop="account">
<u-input v-model="formData.account" placeholder="请输入帐号"></u-input>
</u-form-item>
<u-form-item prop="password">
<u-input v-model="formData.password" type="password" placeholder="请输入密码"></u-input>
</u-form-item>
</u-form>
<view class="loginBtnBox u-m-t-64">
<u-button @click="login" type="primary" :loading="loading">{{ loading ? "登录中...":"登录"}}
</u-button>
</view>
</view>
</view>
</view>
<view class="copyright">Copyright © 2023 一丰大药房</view>
</view>
</template>
<script>
import {
login
} from '@/api/common.js'
import md5Libs from "uview-ui/libs/function/md5";
import resources from '@/libs/resources'
export default {
data() {
return {
loading: false,
formData: {
account: "",
password: "",
},
rules: {
account: [{
required: true,
message: '请输入账号',
trigger: 'blur',
}],
password: [{
required: true,
message: '请输入密码',
trigger: 'blur',
}],
}
}
},
onReady() {
this.$refs.dataForm.setRules(this.rules);
},
onLoad() {
this.formData.password = ''
},
methods: {
login() {
this.$refs.dataForm.validate(valid => {
if (valid) {
this.loading = true
let query = {
account: this.formData.account,
password: md5Libs.md5(this.formData.password)
}
// #ifdef APP-PLUS
const clientId = plus.push.getClientInfo().clientid;
query.clientId = clientId
// #endif
login(query).then(res => {
this.loading = false
let token = res.data.token
this.$store.commit('user/SET_TOKEN', token)
uni.setStorageSync('token', token)
// uni.switchTab({
// url: '/pages/index/apply'
// });
uni.switchTab({
url: '/pages/tbDrugIftForm/index'
});
// uni.navigateTo({
// url:'/pages/tbDrugIftForm/index'
// })
}).catch(() => {
this.loading = false
})
}
});
},
}
}
</script>
<style lang="scss">
page {}
.logo-v {
.login-bg {
image {
width: 100%;
height: 100%;
}
}
.logo-hd {
width: 100%;
position: absolute;
top: 200rpx;
.logoImg {
width: 160rpx;
height: 160rpx;
margin: 0 auto;
image {
width: 100%;
height: 100%;
border-radius: 20%;
}
}
.introduce {
justify-content: center;
align-items: center;
.text-one {
height: 70rpx;
font-weight: 700;
}
.text-two {
color: #999999;
}
}
}
.loginSwitch {
margin-top: 40rpx;
justify-content: center;
align-items: center;
.tabs {
color: #999999;
position: relative;
&::after {
content: "";
width: 64rpx;
height: 4rpx;
background-color: #356efe;
margin-top: 15rpx;
position: absolute;
left: 0;
bottom: -15rpx;
display: block;
border-radius: 50rpx;
}
// &.active1 {
// &::after {
// left: 0;
// }
// }
&.active2 {
&::after {
left: 70%;
}
}
.tab {
width: 50%;
height: 80upx;
text-align: center;
color: #AEAFB5;
font-size: 32upx;
&.active {
color: #3281ff;
}
}
}
.loginInputBox {
width: 100%;
margin-top: 80rpx;
padding: 0 64rpx;
.loginBtnBox {}
}
}
}
</style>