290144e9
易尊强
第一次
|
1
|
<template>
|
044301aa
“wangming”
1
|
2
|
|
290144e9
易尊强
第一次
|
3
|
<view class="logo-v">
|
044301aa
“wangming”
1
|
4
5
6
7
8
9
10
11
|
<view class="t-login">
<!-- 页面装饰图片 -->
<image class="img-a" src="@/static/2.png"></image>
<image class="img-b" src="@/static/3.png"></image>
<!-- 标题 -->
<view class="t-b">
<image src="../../static/logo.png" mode="widthFix" style="width: 90%;">
</image>
|
290144e9
易尊强
第一次
|
12
|
</view>
|
044301aa
“wangming”
1
|
13
14
15
16
17
18
19
20
21
22
23
24
25
|
<u-form :model="formData" :rules="rules" ref="dataForm" :errorType="['toast']" label-position="left"
label-width="150" label-align="left">
<u-form-item prop="account">
<view class="t-a">
<image src="@/static/sj.png"></image>
<input placeholder="请输入帐号" v-model="formData.account" />
</view>
</u-form-item>
<u-form-item prop="password">
<view class="t-a">
<image src="@/static/yz.png"></image>
<input placeholder="请输入密码" type="password" v-model="formData.password" />
|
290144e9
易尊强
第一次
|
26
|
</view>
|
044301aa
“wangming”
1
|
27
28
29
30
31
32
33
34
35
|
</u-form-item>
</u-form>
<u-button @click="login" type="primary" :loading="loading">{{ loading ? "登录中...":"登录"}}
</u-button>
<!-- <view class="t-f"><text>————— 第三方账号登录 —————</text></view>
<view class="t-e cl">
<view class="t-g" @tap="wxLogin()">
<image src="@/static/wx.png"></image>
|
290144e9
易尊强
第一次
|
36
|
</view>
|
044301aa
“wangming”
1
|
37
38
39
40
|
<view class="t-g" @tap="zfbLogin()">
<image src="@/static/qq.png"></image>
</view>
</view> -->
|
290144e9
易尊强
第一次
|
41
|
</view>
|
044301aa
“wangming”
1
|
42
|
|
290144e9
易尊强
第一次
|
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
|
</view>
</template>
<script>
import {
login
} from '@/api/common.js'
import request from '../../utils/request.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() {
let that = this
this.$refs.dataForm.validate(valid => {
if (valid) {
this.loading = true
let query = {
account: this.formData.account,
password: this.formData.password
}
// // #ifdef APP-PLUS
// const clientId = plus.push.getClientInfo().clientid;
// query.clientId = clientId
// // #endif
// uni.showToast({
// title:'denglu',
// duration:'2000'
// })
request({
|
044301aa
“wangming”
1
|
102
103
104
105
|
url: '/api/oauth/Login1',
method: 'post',
data: query,
header: {
|
290144e9
易尊强
第一次
|
106
107
108
|
"Content-Type": "application/x-www-form-urlencoded"
}
}).then(res => {
|
044301aa
“wangming”
1
|
109
110
|
// this.API.userLogin(query).then(res => {
console.log('登录信息', res)
|
290144e9
易尊强
第一次
|
111
|
uni.showToast({
|
044301aa
“wangming”
1
|
112
113
|
title: 'denglu',
duration: '2000'
|
290144e9
易尊强
第一次
|
114
|
})
|
044301aa
“wangming”
1
|
115
116
|
if (res.code === 200) {
|
290144e9
易尊强
第一次
|
117
118
|
let token = res.data.token
// let user = res.data.user
|
044301aa
“wangming”
1
|
119
|
console.log('token', token)
|
290144e9
易尊强
第一次
|
120
121
122
|
this.$store.commit('user/SET_TOKEN', token)
uni.setStorageSync('AuthToken_KEY', token)
uni.setStorageSync('token', token)
|
044301aa
“wangming”
1
|
123
124
|
that.API.getUserInfo().then(res => {
|
290144e9
易尊强
第一次
|
125
|
console.log(res)
|
044301aa
“wangming”
1
|
126
|
|
290144e9
易尊强
第一次
|
127
|
let user = res.data
|
044301aa
“wangming”
1
|
128
129
|
uni.setStorageSync('user', user)
if (uni.getStorageSync('user')) {
|
290144e9
易尊强
第一次
|
130
131
|
this.loading = false
uni.showToast({
|
044301aa
“wangming”
1
|
132
133
|
icon: "success",
title: "登陆成功"
|
290144e9
易尊强
第一次
|
134
135
136
137
138
|
})
uni.switchTab({
url: '/pages/home/home'
});
}
|
044301aa
“wangming”
1
|
139
140
|
|
290144e9
易尊强
第一次
|
141
|
})
|
044301aa
“wangming”
1
|
142
143
|
} else {
|
290144e9
易尊强
第一次
|
144
|
uni.showToast({
|
044301aa
“wangming”
1
|
145
|
icon: "error",
|
0189b356
易尊强
登录问题
|
146
|
title: '返回数据不为200'
|
290144e9
易尊强
第一次
|
147
148
149
150
151
152
|
})
this.loading = false
}
// uni.navigateTo({
// url:'/pages/tbDrugIftForm/index'
// })
|
0189b356
易尊强
登录问题
|
153
154
155
156
157
|
}).catch((res) => {
uni.showToast({
icon:'error',
title:`${res}`
})
|
290144e9
易尊强
第一次
|
158
159
160
161
162
163
|
this.loading = false
})
}
});
},
},
|
044301aa
“wangming”
1
|
164
|
|
290144e9
易尊强
第一次
|
165
166
167
168
|
}
</script>
<style lang="scss">
|
044301aa
“wangming”
1
|
169
|
.logo-v {}
|
290144e9
易尊强
第一次
|
170
|
|
044301aa
“wangming”
1
|
171
172
173
174
175
176
|
.img-a {
position: absolute;
width: 100%;
top: -280rpx;
right: -100rpx;
}
|
290144e9
易尊强
第一次
|
177
|
|
044301aa
“wangming”
1
|
178
179
180
181
182
183
184
|
.img-b {
position: absolute;
width: 50%;
bottom: 0;
left: -50rpx;
margin-bottom: -200rpx;
}
|
290144e9
易尊强
第一次
|
185
|
|
044301aa
“wangming”
1
|
186
187
188
189
190
191
|
.t-login {
width: 600rpx;
margin: 0 auto;
font-size: 28rpx;
color: #000;
}
|
290144e9
易尊强
第一次
|
192
|
|
044301aa
“wangming”
1
|
193
194
195
196
197
198
199
200
201
|
.t-login button {
font-size: 28rpx;
background: #ff0000;
color: #fff;
height: 90rpx;
line-height: 90rpx;
border-radius: 50rpx;
box-shadow: 0 5px 7px 0 rgba(86, 119, 252, 0.2);
}
|
290144e9
易尊强
第一次
|
202
|
|
044301aa
“wangming”
1
|
203
204
205
206
207
208
209
210
211
212
|
.t-login input {
padding: 0 20rpx 0 120rpx;
height: 90rpx;
line-height: 90rpx;
margin-bottom: 50rpx;
background: #f8f7fc;
border: 1px solid #e9e9e9;
font-size: 28rpx;
border-radius: 50rpx;
}
|
290144e9
易尊强
第一次
|
213
|
|
044301aa
“wangming”
1
|
214
215
216
217
|
.t-login .t-a {
position: relative;
width: 100%
}
|
290144e9
易尊强
第一次
|
218
|
|
044301aa
“wangming”
1
|
219
220
221
222
223
224
225
226
227
|
.t-login .t-a image {
width: 40rpx;
height: 40rpx;
position: absolute;
left: 40rpx;
top: 28rpx;
border-right: 2rpx solid #dedede;
padding-right: 20rpx;
}
|
290144e9
易尊强
第一次
|
228
|
|
044301aa
“wangming”
1
|
229
230
231
232
233
234
235
|
.t-login .t-b {
text-align: left;
font-size: 46rpx;
color: #000;
padding: 300rpx 0 40rpx 0;
font-weight: bold;
}
|
290144e9
易尊强
第一次
|
236
|
|
044301aa
“wangming”
1
|
237
238
239
240
241
242
243
244
245
246
247
248
|
.t-login .t-c {
position: absolute;
right: 22rpx;
top: 22rpx;
background: #ff0000;
color: #fff;
font-size: 24rpx;
border-radius: 50rpx;
height: 50rpx;
line-height: 50rpx;
padding: 0 25rpx;
}
|
290144e9
易尊强
第一次
|
249
|
|
044301aa
“wangming”
1
|
250
251
252
253
254
|
.t-login .t-d {
text-align: center;
color: #999;
margin: 80rpx 0;
}
|
290144e9
易尊强
第一次
|
255
|
|
044301aa
“wangming”
1
|
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
|
.t-login .t-e {
text-align: center;
width: 250rpx;
margin: 80rpx auto 0;
}
.t-login .t-g {
float: left;
width: 50%;
}
.t-login .t-e image {
width: 50rpx;
height: 50rpx;
}
.t-login .t-f {
text-align: center;
margin: 200rpx 0 0 0;
color: #666;
}
.t-login .t-f text {
margin-left: 20rpx;
color: #aaaaaa;
font-size: 27rpx;
}
.t-login .uni-input-placeholder {
color: #000;
}
.cl {
zoom: 1;
}
.cl:after {
clear: both;
display: block;
visibility: hidden;
height: 0;
content: '\20';
|
290144e9
易尊强
第一次
|
298
|
}
|
044301aa
“wangming”
1
|
299
|
</style>
|