App-Android(使用App+htnl5框架,解决消息推送兼容SignalR问题)
loulijun2021
2022-09-19 a263dd50386b73f9992919a932f98b4bd5585052
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
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
        <!-- <meta name="HandheldFriendly" content="true" /> -->
        <!-- <meta name="MobileOptimized" content="320" /> -->
        <title>新凯迪制造云平台</title>
        <!-- 引入像素转换 px->rpx -->
        <!-- <script src="../../js/rpx4html.js"></script> -->
 
        <!-- 引入样式文件 -->
        <link rel="stylesheet" href="../../css/vant.css" />
        <!-- 引入 Vue 和 Vant 的 JS 文件 -->
        <script src="../../js/vue.min.js"></script>
        <script src="../../js/vant.min.js"></script>
        <script type="text/javascript" src="../../js/jquery-1.6.4.min.js"></script>
        <script type="text/javascript" src="../../js/axios.min.js"></script>
        <script type="text/javascript" src="../../js/http.js"></script>
 
 
        <!-- 导入自定义js文件 -->
        <!-- <script type="module" src="../../js/global.js"></script> -->
 
 
 
        <!-- <link rel="stylesheet" href="../css/global.css" type="text/css" charset="utf-8" /> -->
 
    </head>
    <body>
        <div id="app">
 
            <div class="body">
                <!-- 头部logo -->
                <div class="headBG">
                    <van-image width="100" height="100" src="../../static/images/96x96.png" radius='50%' />
                </div>
                <!-- 主体 -->
                <div style="display: flex;flex-direction: column;">
                    <div style="margin-top: 100px;">
                        <van-field style="width: 300px;border: 1px solid #e0e0e0; border-radius: 10px;"
                            v-model="username" label="" left-icon="user-o" placeholder="请输入用户编码" />
                    </div>
                    <div style="margin-top: 20px;">
                        <van-field style="border: 1px solid #e0e0e0; border-radius: 10px;"
                            :type="isOpenEye?'':'password'" v-model="password" left-icon="bag-o" placeholder="请输入用户密码">
                            <template #button>
                                <van-icon :name="isOpenEye?'eye-o':'closed-eye'" @click='isOpenEye=!isOpenEye' />
                            </template>
                        </van-field>
                    </div>
                    <div style="margin-top:30px;">
                        <van-button type="info" style="border-radius: 10px;" @click='loginClick' size="large">立即登录
                        </van-button>
                    </div>
                </div>
 
            </div>
        </div>
    </body>
 
    <script>
        var app = new Vue({
            el: '#app',
            data: function() {
                return {
                    username: '999',
                    password: '123',
                    isOpenEye: false,
                }
            },
            created() {
 
            },
            mounted() {
 
            },
            methods: {
                loginClick() {
                    const data = {
                        username: this.username,
                        password: this.password,
                        usertype: 'APP'
                    }
 
                    get('Login/LoginSave', data).then(res => {
                        if (res.code === '200') {
                            // window.location.reload()   //页面重新
 
                            if (!window.localStorage) {
                                alert("浏览器不支持localstorage");
                            } else {
                                localStorage.setItem('userid', res.data.userid)
                                localStorage.setItem('usercode', res.data.usercode)
                                localStorage.setItem('username', res.data.username)
                                localStorage.setItem('usertype', res.data.usertype)
                            }
                            window.location.href = '../xtsy/index.html'
                        }
 
                        if (res.code === '302') {
                            const data2 = {
                                userid: res.data.userid,
                                usercode: res.data.usercode,
                                username: res.data.username,
                                usertype: res.data.usertype
                            }
 
 
                            post('Login/ForcedOffline?userid=' + res.data.userid + '&usercode=' + res.data
                                .usercode + '&username=' + res.data.username + '&usertype=' + res.data
                                .usertype).then(res2 => {
                                if (res2.code === '200') {
                                    this.loginClick()
                                }
 
                            })
                        }
 
                    }).catch(err => {
                        console.log(err);
                    });
 
                }
            }
        })
    </script>
    <style type="text/css">
        body {
            background-color: #2651d8;
        }
 
        .body {
            width: 96%;
            height: 350px;
            background-color: grey;
            margin-top: 150px;
            margin-left: 2%;
            border-radius: 10px;
            background-color: #fff;
            position: relative;
            display: flex;
            justify-content: center;
            align-items: flex-start;
        }
 
        .headBG {
            width: 120px;
            height: 120px;
            background-color: #fff;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            position: absolute;
            top: -60px;
        }
    </style>
</html>