loulijun2021
2023-12-06 480cb1afdd425d80cbffa79850a958ab2503a4ad
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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
<template>
    <view>
 
        <view class="body">
 
            <view class="headClass">新凯迪云制造</view>
            <view class="main">
                <view class="circle">
                    <view class="circleBg"></view>
                </view>
 
                <view class="mainContent">
                    <u--input placeholder="请输入用户编码" prefixIcon="account" v-model="usercode"
                        prefixIconStyle="font-size: 22px;color: #909399" class="inputClass" style="margin-top: 60rpx;">
                    </u--input>
 
 
                    <u--input class="inputClass" v-show='!isView' password placeholder="请输入用户密码" v-model="userpassword"
                        prefixIcon="lock" prefixIconStyle="font-size: 22px;color: #909399"
                        :suffixIconStyle="{color:!isView? '#909399':'#436df5',fontSize:'22px'}"
                        :suffixIcon="!isView?'eye-off':'eye-fill'">
 
                    </u--input>
                    <u--input class="inputClass" v-show='isView' placeholder="请输入用户密码" v-model="userpassword"
                        prefixIcon="lock" prefixIconStyle="font-size: 22px;color: #909399"
                        :suffixIconStyle="{color:!isView? '#909399':'#436df5',fontSize:'22px'}"
                        :suffixIcon="!isView?'eye-off':'eye-fill'">
                    </u--input>
                    <view class="suffixEyeClass" @click="isViewClick"></view>
 
                    <u-button hairline type="primary"
                        :disabled="!(usercode.trim().length>0&&userpassword.trim().length>0)" text="立即登录"
                        :loading="isDisabledSubmitButton" loadingText="正在登录,请稍等..." class="loginClass"
                        @click="gotoIndex"></u-button>
                </view>
 
 
            </view>
 
        </view>
 
        <view style="position: absolute;bottom: 6px;
                     width: 34px;margin-left: calc(50% - 17px);
                    color: #fff;font-size: 12px;">
            {{$appVersion}}
        </view>
 
 
 
    </view>
</template>
 
<script>
    import {
        LoginSave,
        ForcedOffline,
    } from '../../config/api.js';
    import {
        decode
    } from 'jsonwebtoken';
    export default {
        data() {
            return {
                // #ifdef H5
                usercode: '9999',
                // #endif
 
                // #ifdef APP-PLUS
                usercode: '999',
                // #endif
 
                userpassword: '123',
                isView: false, //密码是否可见
 
                isDisabledSubmitButton: false, //提交按钮是否处于加载中
 
                isShowCancelButton: false,
                isShow: false,
                downloadUrl: '', //下载地址
 
            }
        },
        onLoad() {},
 
        onUnload() {
 
        },
        created() {
 
        },
        mounted() {
 
        },
        methods: {
            //密码是否查看  显示明文
            isViewClick() {
                this.isView = !this.isView
            },
            // 点击立即登录时触发
            gotoIndex() {
                const data = {
                    username: this.usercode,
                    password: this.userpassword,
                    usertype: 'APP'
                }
                // this.isDisabledSubmitButton = true
                LoginSave({
                    params: data
                }).then(result => {
                    if (result.code === '200') {
                        uni.setStorageSync("Token", result.data)
                        const jwt = decode(result.data)
                        uni.setStorageSync("usercode", jwt.usercode)
                        uni.setStorageSync("username", jwt.username)
                        uni.setStorageSync("storg_code", jwt.storg_code)
                        uni.setStorageSync("storg_name", jwt.storg_name)
                        uni.redirectTo({
                            //关闭当前页面,跳转到应用内的某个页面。
                            url: '../xtsy/index'
                        });
                        // uni.$u.toast(result.Message)
                    } 
                    
                    // else if (result.code === '302') {
                    //     const data2 = {
                    //         // token: uni.getStorageSync('Token'),
                    //         token: result.data,
                    //         rid: ''
                    //     }
                    //     const jwt = decode(result.data)
                    //     console.log(jwt, 2)
                    //     uni.setStorageSync("usercode", jwt.usercode)
                    //     uni.setStorageSync("username", jwt.username)
                    //     uni.setStorageSync("storg_code", jwt.storg_code)
                    //     uni.setStorageSync("storg_name", jwt.storg_name)
 
                    //     ForcedOffline('', {
                    //         params: data2
                    //     }).then(res2 => {
                    //         if (res2.code === '200') {
                    //             uni.redirectTo({
                    //                 //关闭当前页面,跳转到应用内的某个页面。
                    //                 url: '../xtsy/index'
                    //             });
                    //         }
                    //     })
                    // }
                     
                     else {
                        this.isDisabledSubmitButton = false
                    }
                })
            },
 
            // 确认
            async isShowConfirm() {
 
            },
            // 取消
            isShowCancel() {
                this.isShow = false
            },
 
 
        }
    }
</script>
 
<style lang="scss" scoped>
    .main {
        background-color: #fff;
        width: 90%;
        height: 700rpx;
        margin: 20vh auto 0;
        position: relative;
        border-radius: 30rpx;
 
        .circle {
            background-color: #fff;
            width: 240rpx;
            height: 240rpx;
            border-radius: 50% 50% 0 0;
            position: absolute;
            top: -120rpx;
            left: 32%;
 
            .circleBg {
                width: 200rpx;
                height: 200rpx;
                background: url('../../static/img/96x96.png') no-repeat;
                position: absolute;
                top: 28rpx;
                left: 8.5%;
                background-size: 100% 100%;
                border-radius: 50%;
            }
        }
 
        .mainContent {
            position: absolute;
            top: 160rpx;
            left: 1.8%;
 
            .inputClass {
                width: 600rpx;
                margin: 30rpx auto 0;
                border: 1px solid #eee;
                border-radius: 16rpx;
            }
 
            .loginClass {
                width: 650rpx;
                margin: 80rpx auto 0;
                border-radius: 16rpx;
                letter-spacing: 6rpx;
            }
        }
 
    }
 
    .suffixEyeClass {
        position: absolute;
        right: 10rpx;
        margin-top: -80rpx;
        width: 80rpx;
        height: 80rpx;
    }
 
    .headClass {
        display: flex;
        justify-content: center;
        align-items: flex-end;
        width: 100%;
        height: 120rpx;
        line-height: 100rpx;
        color: #fff;
        font-weight: bolder;
        letter-spacing: 2rpx;
        font-family: serif;
        padding: 20rpx 0;
        background-color: #0659ff;
    }
 
    ::v-deep .u-link {
        font-size: 16px !important;
        line-height: 20px !important;
    }
</style>
<style>
    page {
        overflow: hidden;
        background-color: #0653f7;
    }
</style>