|
|
@@ -1,206 +1,207 @@
|
|
1
|
1
|
<template>
|
|
2
|
|
- <view class="normal-login-container">
|
|
3
|
|
- <view class="logo-content align-center justify-center flex">
|
|
4
|
|
- <image style="width: 100rpx;height: 100rpx;" :src="globalConfig.appInfo.logo" mode="widthFix">
|
|
5
|
|
- </image>
|
|
6
|
|
- <text class="title">法务平台</text>
|
|
7
|
|
- </view>
|
|
8
|
|
- <view class="login-form-content">
|
|
9
|
|
- <view class="input-item flex align-center">
|
|
10
|
|
- <view class="iconfont icon-user icon"></view>
|
|
11
|
|
- <input v-model="loginForm.username" class="input" type="text" placeholder="请输入账号" maxlength="30" />
|
|
12
|
|
- </view>
|
|
13
|
|
- <view class="input-item flex align-center">
|
|
14
|
|
- <view class="iconfont icon-password icon"></view>
|
|
15
|
|
- <input v-model="loginForm.password" type="password" class="input" placeholder="请输入密码" maxlength="20" />
|
|
16
|
|
- </view>
|
|
17
|
|
- <view class="input-item flex align-center" style="width: 60%;margin: 0px;" v-if="captchaEnabled">
|
|
18
|
|
- <view class="iconfont icon-code icon"></view>
|
|
19
|
|
- <input v-model="loginForm.code" type="number" class="input" placeholder="请输入验证码" maxlength="4" />
|
|
20
|
|
- <view class="login-code">
|
|
21
|
|
- <image :src="codeUrl" @click="getCode" class="login-code-img"></image>
|
|
22
|
|
- </view>
|
|
23
|
|
- </view>
|
|
24
|
|
- <view class="action-btn">
|
|
25
|
|
- <button @click="handleLogin" class="login-btn cu-btn block bg-blue lg round">登录</button>
|
|
26
|
|
- </view>
|
|
27
|
|
- <view class="reg text-center" v-if="register">
|
|
28
|
|
- <text class="text-grey1">没有账号?</text>
|
|
29
|
|
- <text @click="handleUserRegister" class="text-blue">立即注册</text>
|
|
30
|
|
- </view>
|
|
31
|
|
- <!-- <view class="reg text-center" v-if="register">
|
|
|
2
|
+ <view class="normal-login-container">
|
|
|
3
|
+ <view class="logo-content align-center justify-center flex">
|
|
|
4
|
+ <image style="width: 100rpx;height: 100rpx;" :src="globalConfig.appInfo.logo" mode="widthFix">
|
|
|
5
|
+ </image>
|
|
|
6
|
+ <text class="title">法务平台</text>
|
|
|
7
|
+ </view>
|
|
|
8
|
+ <view class="login-form-content">
|
|
|
9
|
+ <view class="input-item flex align-center">
|
|
|
10
|
+ <view class="iconfont icon-user icon"></view>
|
|
|
11
|
+ <input v-model="loginForm.username" class="input" type="text" placeholder="请输入账号" maxlength="30" />
|
|
|
12
|
+ </view>
|
|
|
13
|
+ <view class="input-item flex align-center">
|
|
|
14
|
+ <view class="iconfont icon-password icon"></view>
|
|
|
15
|
+ <input v-model="loginForm.password" type="password" class="input" placeholder="请输入密码" maxlength="20" />
|
|
|
16
|
+ </view>
|
|
|
17
|
+ <view class="input-item flex align-center" style="width: 60%;margin: 0px;" v-if="captchaEnabled">
|
|
|
18
|
+ <view class="iconfont icon-code icon"></view>
|
|
|
19
|
+ <input v-model="loginForm.code" type="number" class="input" placeholder="请输入验证码" maxlength="4" />
|
|
|
20
|
+ <view class="login-code">
|
|
|
21
|
+ <image :src="codeUrl" @click="getCode" class="login-code-img"></image>
|
|
|
22
|
+ </view>
|
|
|
23
|
+ </view>
|
|
|
24
|
+ <view class="action-btn">
|
|
|
25
|
+ <button @click="handleLogin" class="login-btn cu-btn block bg-blue lg round">登录</button>
|
|
|
26
|
+ </view>
|
|
|
27
|
+ <view class="reg text-center" v-if="register">
|
|
|
28
|
+ <text class="text-grey1">没有账号?</text>
|
|
|
29
|
+ <text @click="handleUserRegister" class="text-blue">立即注册</text>
|
|
|
30
|
+ </view>
|
|
|
31
|
+ <!-- <view class="reg text-center" v-if="register">
|
|
32
|
32
|
<text class="text-grey1">使用其他方式登录:</text>
|
|
33
|
33
|
<text @click="handleUserRegister" class="text-blue"></text>
|
|
34
|
34
|
</view> -->
|
|
35
|
|
- <!-- <view class="xieyi text-center">
|
|
|
35
|
+ <!-- <view class="xieyi text-center">
|
|
36
|
36
|
<text class="text-grey1">登录即代表同意</text>
|
|
37
|
37
|
<text @click="handleUserAgrement" class="text-blue">《用户协议》</text>
|
|
38
|
38
|
<text @click="handlePrivacy" class="text-blue">《隐私协议》</text>
|
|
39
|
39
|
</view> -->
|
|
40
|
|
- </view>
|
|
41
|
|
-
|
|
42
|
|
- </view>
|
|
|
40
|
+ </view>
|
|
|
41
|
+
|
|
|
42
|
+ </view>
|
|
43
|
43
|
</template>
|
|
44
|
44
|
|
|
45
|
45
|
<script>
|
|
46
|
|
- import { getCodeImg } from '@/api/login'
|
|
47
|
|
-
|
|
48
|
|
- export default {
|
|
49
|
|
- data() {
|
|
50
|
|
- return {
|
|
51
|
|
- codeUrl: "",
|
|
52
|
|
- captchaEnabled: true,
|
|
53
|
|
- // 用户注册开关
|
|
54
|
|
- register: true,
|
|
55
|
|
- globalConfig: getApp().globalData.config,
|
|
56
|
|
- loginForm: {
|
|
57
|
|
- username: "admin",
|
|
58
|
|
- password: "admin123",
|
|
59
|
|
- code: "",
|
|
60
|
|
- uuid: ''
|
|
61
|
|
- }
|
|
62
|
|
- }
|
|
63
|
|
- },
|
|
64
|
|
- created() {
|
|
65
|
|
- this.getCode()
|
|
66
|
|
- },
|
|
67
|
|
- methods: {
|
|
68
|
|
- // 用户注册
|
|
69
|
|
- handleUserRegister() {
|
|
70
|
|
- this.$tab.redirectTo(`/pages/register`)
|
|
71
|
|
- },
|
|
72
|
|
- // 隐私协议
|
|
73
|
|
- handlePrivacy() {
|
|
74
|
|
- let site = this.globalConfig.appInfo.agreements[0]
|
|
75
|
|
- this.$tab.navigateTo(`/pages/common/webview/index?title=${site.title}&url=${site.url}`)
|
|
76
|
|
- },
|
|
77
|
|
- // 用户协议
|
|
78
|
|
- handleUserAgrement() {
|
|
79
|
|
- let site = this.globalConfig.appInfo.agreements[1]
|
|
80
|
|
- this.$tab.navigateTo(`/pages/common/webview/index?title=${site.title}&url=${site.url}`)
|
|
81
|
|
- },
|
|
82
|
|
- // 获取图形验证码
|
|
83
|
|
- getCode() {
|
|
84
|
|
- getCodeImg().then(res => {
|
|
85
|
|
- this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled
|
|
86
|
|
- if (this.captchaEnabled) {
|
|
87
|
|
- this.codeUrl = 'data:image/gif;base64,' + res.img
|
|
88
|
|
- this.loginForm.uuid = res.uuid
|
|
89
|
|
- }
|
|
90
|
|
- })
|
|
91
|
|
- },
|
|
92
|
|
- // 登录方法
|
|
93
|
|
- async handleLogin() {
|
|
94
|
|
- if (this.loginForm.username === "") {
|
|
95
|
|
- this.$modal.msgError("请输入您的账号")
|
|
96
|
|
- } else if (this.loginForm.password === "") {
|
|
97
|
|
- this.$modal.msgError("请输入您的密码")
|
|
98
|
|
- } else if (this.loginForm.code === "" && this.captchaEnabled) {
|
|
99
|
|
- this.$modal.msgError("请输入验证码")
|
|
100
|
|
- } else {
|
|
101
|
|
- this.$modal.loading("登录中,请耐心等待...")
|
|
102
|
|
- this.pwdLogin()
|
|
103
|
|
- }
|
|
104
|
|
- },
|
|
105
|
|
- // 密码登录
|
|
106
|
|
- async pwdLogin() {
|
|
107
|
|
- this.$store.dispatch('Login', this.loginForm).then(() => {
|
|
108
|
|
- this.$modal.closeLoading()
|
|
109
|
|
- this.loginSuccess()
|
|
110
|
|
- }).catch(() => {
|
|
111
|
|
- if (this.captchaEnabled) {
|
|
112
|
|
- this.getCode()
|
|
113
|
|
- }
|
|
114
|
|
- })
|
|
115
|
|
- },
|
|
116
|
|
- // 登录成功后,处理函数
|
|
117
|
|
- loginSuccess(result) {
|
|
118
|
|
- // 设置用户信息
|
|
119
|
|
- this.$store.dispatch('GetInfo').then(res => {
|
|
120
|
|
- this.$tab.reLaunch('/pages/index')
|
|
121
|
|
- })
|
|
122
|
|
- }
|
|
123
|
|
- }
|
|
124
|
|
- }
|
|
|
46
|
+ import {
|
|
|
47
|
+ getCodeImg
|
|
|
48
|
+ } from '@/api/login'
|
|
|
49
|
+
|
|
|
50
|
+ export default {
|
|
|
51
|
+ data() {
|
|
|
52
|
+ return {
|
|
|
53
|
+ codeUrl: "",
|
|
|
54
|
+ captchaEnabled: true,
|
|
|
55
|
+ // 用户注册开关
|
|
|
56
|
+ register: true,
|
|
|
57
|
+ globalConfig: getApp().globalData.config,
|
|
|
58
|
+ loginForm: {
|
|
|
59
|
+ username: "admin",
|
|
|
60
|
+ password: "admin123",
|
|
|
61
|
+ code: "",
|
|
|
62
|
+ uuid: ''
|
|
|
63
|
+ }
|
|
|
64
|
+ }
|
|
|
65
|
+ },
|
|
|
66
|
+ created() {
|
|
|
67
|
+ this.getCode()
|
|
|
68
|
+ },
|
|
|
69
|
+ methods: {
|
|
|
70
|
+ // 用户注册
|
|
|
71
|
+ handleUserRegister() {
|
|
|
72
|
+ this.$tab.redirectTo(`/pages/register`)
|
|
|
73
|
+ },
|
|
|
74
|
+ // 隐私协议
|
|
|
75
|
+ handlePrivacy() {
|
|
|
76
|
+ let site = this.globalConfig.appInfo.agreements[0]
|
|
|
77
|
+ this.$tab.navigateTo(`/pages/common/webview/index?title=${site.title}&url=${site.url}`)
|
|
|
78
|
+ },
|
|
|
79
|
+ // 用户协议
|
|
|
80
|
+ handleUserAgrement() {
|
|
|
81
|
+ let site = this.globalConfig.appInfo.agreements[1]
|
|
|
82
|
+ this.$tab.navigateTo(`/pages/common/webview/index?title=${site.title}&url=${site.url}`)
|
|
|
83
|
+ },
|
|
|
84
|
+ // 获取图形验证码
|
|
|
85
|
+ getCode() {
|
|
|
86
|
+ getCodeImg().then(res => {
|
|
|
87
|
+ this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled
|
|
|
88
|
+ if (this.captchaEnabled) {
|
|
|
89
|
+ this.codeUrl = 'data:image/gif;base64,' + res.img
|
|
|
90
|
+ this.loginForm.uuid = res.uuid
|
|
|
91
|
+ }
|
|
|
92
|
+ })
|
|
|
93
|
+ },
|
|
|
94
|
+ // 登录方法
|
|
|
95
|
+ async handleLogin() {
|
|
|
96
|
+ if (this.loginForm.username === "") {
|
|
|
97
|
+ this.$modal.msgError("请输入您的账号")
|
|
|
98
|
+ } else if (this.loginForm.password === "") {
|
|
|
99
|
+ this.$modal.msgError("请输入您的密码")
|
|
|
100
|
+ } else if (this.loginForm.code === "" && this.captchaEnabled) {
|
|
|
101
|
+ this.$modal.msgError("请输入验证码")
|
|
|
102
|
+ } else {
|
|
|
103
|
+ this.$modal.loading("登录中,请耐心等待...")
|
|
|
104
|
+ this.pwdLogin()
|
|
|
105
|
+ }
|
|
|
106
|
+ },
|
|
|
107
|
+ // 密码登录
|
|
|
108
|
+ async pwdLogin() {
|
|
|
109
|
+ this.$store.dispatch('Login', this.loginForm).then(() => {
|
|
|
110
|
+ this.$modal.closeLoading()
|
|
|
111
|
+ this.loginSuccess()
|
|
|
112
|
+ }).catch(() => {
|
|
|
113
|
+ if (this.captchaEnabled) {
|
|
|
114
|
+ this.getCode()
|
|
|
115
|
+ }
|
|
|
116
|
+ })
|
|
|
117
|
+ },
|
|
|
118
|
+ // 登录成功后,处理函数
|
|
|
119
|
+ loginSuccess(result) {
|
|
|
120
|
+ // 设置用户信息
|
|
|
121
|
+ this.$store.dispatch('GetInfo').then(res => {
|
|
|
122
|
+ this.$tab.reLaunch('/pages/index')
|
|
|
123
|
+ })
|
|
|
124
|
+ }
|
|
|
125
|
+ }
|
|
|
126
|
+ }
|
|
125
|
127
|
</script>
|
|
126
|
128
|
|
|
127
|
129
|
<style lang="scss">
|
|
128
|
|
- page {
|
|
129
|
|
- background-color: #ffffff;
|
|
130
|
|
- }
|
|
131
|
|
-
|
|
132
|
|
- .normal-login-container {
|
|
133
|
|
- width: 100%;
|
|
134
|
|
-
|
|
135
|
|
- .logo-content {
|
|
136
|
|
- width: 100%;
|
|
137
|
|
- font-size: 21px;
|
|
138
|
|
- text-align: center;
|
|
139
|
|
- padding-top: 15%;
|
|
140
|
|
-
|
|
141
|
|
- image {
|
|
142
|
|
- border-radius: 4px;
|
|
143
|
|
- }
|
|
144
|
|
-
|
|
145
|
|
- .title {
|
|
146
|
|
- margin-left: 10px;
|
|
147
|
|
- }
|
|
148
|
|
- }
|
|
149
|
|
-
|
|
150
|
|
- .login-form-content {
|
|
151
|
|
- text-align: center;
|
|
152
|
|
- margin: 20px auto;
|
|
153
|
|
- margin-top: 15%;
|
|
154
|
|
- width: 80%;
|
|
155
|
|
-
|
|
156
|
|
- .input-item {
|
|
157
|
|
- margin: 20px auto;
|
|
158
|
|
- background-color: #f5f6f7;
|
|
159
|
|
- height: 45px;
|
|
160
|
|
- border-radius: 20px;
|
|
161
|
|
-
|
|
162
|
|
- .icon {
|
|
163
|
|
- font-size: 38rpx;
|
|
164
|
|
- margin-left: 10px;
|
|
165
|
|
- color: #999;
|
|
166
|
|
- }
|
|
167
|
|
-
|
|
168
|
|
- .input {
|
|
169
|
|
- width: 100%;
|
|
170
|
|
- font-size: 14px;
|
|
171
|
|
- line-height: 20px;
|
|
172
|
|
- text-align: left;
|
|
173
|
|
- padding-left: 15px;
|
|
174
|
|
- }
|
|
175
|
|
-
|
|
176
|
|
- }
|
|
177
|
|
-
|
|
178
|
|
- .login-btn {
|
|
179
|
|
- margin-top: 40px;
|
|
180
|
|
- height: 45px;
|
|
181
|
|
- }
|
|
182
|
|
-
|
|
183
|
|
- .reg {
|
|
184
|
|
- margin-top: 15px;
|
|
185
|
|
- }
|
|
186
|
|
-
|
|
187
|
|
- .xieyi {
|
|
188
|
|
- color: #333;
|
|
189
|
|
- margin-top: 20px;
|
|
190
|
|
- }
|
|
191
|
|
-
|
|
192
|
|
- .login-code {
|
|
193
|
|
- height: 38px;
|
|
194
|
|
- float: right;
|
|
195
|
|
-
|
|
196
|
|
- .login-code-img {
|
|
197
|
|
- height: 38px;
|
|
198
|
|
- position: absolute;
|
|
199
|
|
- margin-left: 10px;
|
|
200
|
|
- width: 200rpx;
|
|
201
|
|
- }
|
|
202
|
|
- }
|
|
203
|
|
- }
|
|
204
|
|
- }
|
|
205
|
|
-
|
|
206
|
|
-</style>
|
|
|
130
|
+ page {
|
|
|
131
|
+ background-color: #ffffff;
|
|
|
132
|
+ }
|
|
|
133
|
+
|
|
|
134
|
+ .normal-login-container {
|
|
|
135
|
+ width: 100%;
|
|
|
136
|
+
|
|
|
137
|
+ .logo-content {
|
|
|
138
|
+ width: 100%;
|
|
|
139
|
+ font-size: 21px;
|
|
|
140
|
+ text-align: center;
|
|
|
141
|
+ padding-top: 15%;
|
|
|
142
|
+
|
|
|
143
|
+ image {
|
|
|
144
|
+ border-radius: 4px;
|
|
|
145
|
+ }
|
|
|
146
|
+
|
|
|
147
|
+ .title {
|
|
|
148
|
+ margin-left: 10px;
|
|
|
149
|
+ }
|
|
|
150
|
+ }
|
|
|
151
|
+
|
|
|
152
|
+ .login-form-content {
|
|
|
153
|
+ text-align: center;
|
|
|
154
|
+ margin: 20px auto;
|
|
|
155
|
+ margin-top: 15%;
|
|
|
156
|
+ width: 80%;
|
|
|
157
|
+
|
|
|
158
|
+ .input-item {
|
|
|
159
|
+ margin: 20px auto;
|
|
|
160
|
+ background-color: #f5f6f7;
|
|
|
161
|
+ height: 45px;
|
|
|
162
|
+ border-radius: 20px;
|
|
|
163
|
+
|
|
|
164
|
+ .icon {
|
|
|
165
|
+ font-size: 38rpx;
|
|
|
166
|
+ margin-left: 10px;
|
|
|
167
|
+ color: #999;
|
|
|
168
|
+ }
|
|
|
169
|
+
|
|
|
170
|
+ .input {
|
|
|
171
|
+ width: 100%;
|
|
|
172
|
+ font-size: 14px;
|
|
|
173
|
+ line-height: 20px;
|
|
|
174
|
+ text-align: left;
|
|
|
175
|
+ padding-left: 15px;
|
|
|
176
|
+ }
|
|
|
177
|
+
|
|
|
178
|
+ }
|
|
|
179
|
+
|
|
|
180
|
+ .login-btn {
|
|
|
181
|
+ margin-top: 40px;
|
|
|
182
|
+ height: 45px;
|
|
|
183
|
+ }
|
|
|
184
|
+
|
|
|
185
|
+ .reg {
|
|
|
186
|
+ margin-top: 15px;
|
|
|
187
|
+ }
|
|
|
188
|
+
|
|
|
189
|
+ .xieyi {
|
|
|
190
|
+ color: #333;
|
|
|
191
|
+ margin-top: 20px;
|
|
|
192
|
+ }
|
|
|
193
|
+
|
|
|
194
|
+ .login-code {
|
|
|
195
|
+ height: 38px;
|
|
|
196
|
+ float: right;
|
|
|
197
|
+
|
|
|
198
|
+ .login-code-img {
|
|
|
199
|
+ height: 38px;
|
|
|
200
|
+ position: absolute;
|
|
|
201
|
+ margin-left: 10px;
|
|
|
202
|
+ width: 200rpx;
|
|
|
203
|
+ }
|
|
|
204
|
+ }
|
|
|
205
|
+ }
|
|
|
206
|
+ }
|
|
|
207
|
+</style>
|