zhangfei
2025-06-03 14c90f4513a26dbc30960121c57a3cdf60996aa3
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
<template>
    <view class="login-box">
        <image src="/static/login/login-bg.png" class="headimg" mode="widthFix"></image>
        <view style="width:100%;height:444rpx;"></view>
        <view class="box">
            <view class="font">
                账号
            </view>
            <u-input height='88' v-model="phone" placeholder-style="color:'#98A1B2'" style="margin-top:14rpx;background-color: #F2F4F7;font-size:32rpx;border-radius: 16rpx;" placeholder="请输入账号" type="text" :border="true" />
            <view class="font" style="margin-top: 32rpx;">
                密码
            </view>
            <u-input height='88' v-model="yzm" placeholder-style="color:'#98A1B2'" placeholder="请输入密码" style="margin-top:14rpx;background-color: #F2F4F7;font-size:32rpx;border-radius: 16rpx;" type="password" :border="true" />
            <view class="button" @click="loginNoPass">登录</view>
        </view>
    </view>
</template>
 
<script>
    import {
        loginpass,
        getLoginUserInfo
    } from '@/api/index.js'
    import {
        encryptPwd
    } from '@/common/util.js'
    export default {
        onLoad(options) {
            let token = uni.getStorageSync("sessionToken")
            if (token) {
                uni.redirectTo({
                    url:'/pages/agent-list/agent-list'
                })
            }
        },
        data() {
            return {
                phone: '',
                yzm: '123123',
            }
        },
        methods: {
            loginNoPass() {
                if (this.phone == '') {
                    uni.showToast({
                        title: '请输入账号',
                        icon: 'none'
                    })
                    return
                }
                if (this.yzm == '') {
                    uni.showToast({
                        title: '请输入密码',
                        icon: 'none'
                    })
                    return
                }
                loginpass({
                    username: this.phone,
                    password: encryptPwd(this.yzm)
                }).then(val => {
                    if (val.code == 200) {
                        uni.setStorageSync('sessionToken', val.token),
                        this.getLoginUserInfo()
                    }
                })
            },
            getLoginUserInfo() {
                getLoginUserInfo().then(val => {
                    this.$u.vuex('userInfo', val.user)
                    uni.redirectTo({
                        url:'/pages/agent-list/agent-list'
                    })
                })
            },
        }
    }
</script>
 
<style lang="scss" scoped>
    page{
        width:100%;height:100%;
        background-color: #F6FBFE;
    }
    .login-box{
        width:100%;height:100%;
    }
    .headimg {
        width: 100%;
        height:536rpx;
        position: absolute;
        left: 0;
        top: 0;
    }
    .box {
        height: calc(100vh - 444rpx);
        position: relative;
        padding: 44rpx 30rpx; 
        background: #fff;
        box-sizing: border-box;
        border-radius: 16px 16px 0 0;
        input{
            height:88rpx;
        }
    }
 
    .button {
        height: 100rpx;
        line-height: 100rpx;
        flex-shrink: 0;
        border-radius: 100rpx;
        background: linear-gradient(272deg, #05B0FC -62.04%, #3C50F9 -5.3%, #0079FE 38.57%, #05B2FC 124.24%), #0AAD60;
        font-size: 32rpx;
        color: white;
        margin-top: 64rpx;
        text-align: center;
    }
 
    .font {
        color: #475467;
        font-size: 32rpx;
        line-height:48rpx;
        font-weight:500;
        margin-bottom: 14rpx;
    }
</style>