Browse Source

省平台父项目

hanqingsong 1 year ago
parent
commit
c620bb40d2
2 changed files with 1377 additions and 789 deletions
  1. 1184 700
      src/index.html
  2. 193 89
      src/login.html

File diff suppressed because it is too large
+ 1184 - 700
src/index.html


+ 193 - 89
src/login.html

@@ -6,29 +6,37 @@
6 6
     <meta name="renderer" content="webkit|ie-comp|ie-stand">
7 7
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
8 8
     <meta name="viewport"
9
-          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
9
+        content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
10 10
     <meta http-equiv="Cache-Control" content="no-siteapp" />
11 11
     <link rel="stylesheet" type="text/css" href="./css/H-ui.min.css" />
12 12
     <link href="./iconfont/iconfont.css" rel="stylesheet" />
13 13
     <link rel="stylesheet" href="./css/style.css">
14 14
     <link href="./css/tianjin/login.css" rel="stylesheet" type="text/css" />
15 15
 
16
-    <script src="./polyfill.js"> </script>
16
+    <link rel="stylesheet" href="./unpkg/index.css">
17
+
18
+    <link href="./css/theme/greenTheme.css" rel="alternate stylesheet" type="text/css" title="green" disabled />
19
+    <link href="./css/theme/blueTheme.css" rel="alternate stylesheet" type="text/css" title="blue" disabled />
20
+    <link href="./css/theme/purpleTheme.css" rel="alternate stylesheet" type="text/css" title="purple" />
21
+    <link href="./css/theme/redTheme.css" rel="alternate stylesheet" type="text/css" title="red" disabled />
22
+
23
+
24
+    <script src="./polyfill.js"></script>
17 25
 
18 26
     <script type="text/javascript" src="./jquery.min.js"></script>
19 27
     <script type="text/javascript" src="./base64Reverse.js"></script>
20 28
     <script type="text/javascript" src="./md5.js"></script>
21 29
     <!-- import CSS -->
22 30
     <!-- <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css"> -->
23
-    <link rel="stylesheet" href="./unpkg/index.css">
31
+    <!-- <link rel="stylesheet" href="./unpkg/index.css"> -->
24 32
     <!-- import Vue before Element -->
25 33
     <!-- <script src="https://unpkg.com/vue/dist/vue.js"></script> -->
26 34
     <script src="./unpkg/vue.js"></script>
27 35
     <!-- import JavaScript -->
28 36
     <!-- <script src="https://unpkg.com/element-ui/lib/index.js"></script> -->
29 37
     <script src="./unpkg/index.js"></script>
38
+
30 39
     <script src="./browser.min.js"></script>
31
-    <script src="./polyfill.min.js"></script>
32 40
 
33 41
 
34 42
     <title>天津市粮食和物资储备局</title>
@@ -36,27 +44,27 @@
36 44
     <meta name="description" content="天津市粮食和物资储备局">
37 45
 </head>
38 46
 
39
-<body>
40
-<div id="app">
41
-    <div class="login-warp">
42
-        <div class="login-title">
43
-            <img src="./images/tianjin/head-logo.svg" alt=""
44
-                 style="width: 90px;height: 90px;display: inline-block;">
45
-            <img src="./images/tianjin/login-tit.png" alt="" style="margin-left:20px;display: inline-block;">
46
-        </div>
47
-        <div class="login-logo clearFloat">
48
-            <div class="login-left floatLeft">
49
-                <img src="./images/tianjin/login-left.png" alt="">
47
+<body class="login-body" onkeydown="keyupEnter();">
48
+    <div id="app">
49
+        <div class="login-warp">
50
+            <div class="login-title">
51
+                <div class="head-logo"></div>
52
+                <div class="login-tit"></div>
50 53
             </div>
54
+            <div class="login-logo clearFloat">
55
+                <div class="login-left floatLeft">
56
+                    <div class="login-leftimg"></div>
57
+                </div>
51 58
 
52
-            <div class="login-right floatLeft">
53
-                <img src="./images/tianjin/loginBox-bg.png" alt="" width="100%" height="100%">
54
-                <!-- <img src="./images/person.png" class="title-person"> -->
55
-                <div class="login-form">
56
-                    <form action="" method="get" name="loginForm" id="loginForm" data-action="/login/login"
57
-                          enctype="application/x-www-form-urlencoded">
58
-                        <div class="login-name">
59
-                            <!-- <el-autocomplete
59
+                <div class="login-right floatLeft">
60
+                    <div class="loginBox-bg"></div>
61
+                    <!-- <img src="./images/tianjin/loginBox-bg.png" alt="" width="100%" height="100%"> -->
62
+                    <!-- <img src="./images/person.png" class="title-person"> -->
63
+                    <div class="login-form">
64
+                        <form action="" method="get" name="loginForm" id="loginForm" data-action="/login/login/"
65
+                            enctype="application/x-www-form-urlencoded">
66
+                            <div class="login-name">
67
+                                <!-- <el-autocomplete
60 68
                             id="username"
61 69
                             style="width:100%"
62 70
                             ref="username"
@@ -70,54 +78,100 @@
70 78
                             @keyup.enter.native="login"
71 79
                             >
72 80
                             </el-autocomplete> -->
73
-                            <el-input id="username" ref="username" name="username" type="text"
74
-                                      v-model="loginForm.name" placeholder="请输入用户名" @keyup.enter.native="login">
75
-                            </el-input>
76
-                            <div style="position:absolute;left:5px;top:5px;">
77
-                                <span class="iconfont" style="vertical-align: middle">&#xe623;</span>
81
+                                <el-input id="username" ref="username" name="username" type="text"
82
+                                    v-model="loginForm.name" placeholder="请输入用户名"></el-input>
83
+                                <div style="position:absolute;left:5px;top:5px;">
84
+                                    <span class="iconfont" style="vertical-align: middle">&#xe623;</span>
85
+                                </div>
78 86
                             </div>
79
-                        </div>
80
-                        <div class="login-password">
81
-                            <el-input type="password" name="password" @keyup.enter.native="login" id="password"
82
-                                      v-model="loginForm.password" placeholder="请输入密码" @keyup.enter.native="login">
83
-                            </el-input>
84
-                            <input name="url" type="hidden" id="loginUrl"
85
-                                   value="http://localhost:9000/#/publicfunction/home" style="display: none">
86
-                            <img src="" data-action="/login/idslogout?targeturl=" alt="" id="idsImg"
87
-                                 style="display: none">
88
-                            <div style="position:absolute;left:5px;top:67px;">
89
-                                <span class="iconfont" style="vertical-align: middle">&#xe6cc;</span>
87
+                            <div class="login-password">
88
+                                <el-input type="password" name="password" id="password" v-model="loginForm.password"
89
+                                    placeholder="请输入密码" @keyup.enter.native="login"></el-input>
90
+                                <input name="url" type="hidden" id="loginUrl"
91
+                                    value="http://localhost:9000/#/publicfunction/home" style="display: none">
92
+                                <img src="" data-action="/login/idslogout?targeturl=" alt="" id="idsImg"
93
+                                    style="display: none">
94
+                                <div style="position:absolute;left:5px;top:67px;">
95
+                                    <span class="iconfont" style="vertical-align: middle">&#xe6cc;</span>
96
+                                </div>
90 97
                             </div>
91
-                        </div>
92
-                        <el-row :gutter="20">
93
-                            <el-col :span="12">
94
-                                <el-input name="text" type="text" auto-complete="on" placeholder="请输入验证码">
95
-                                </el-input>
96
-                            </el-col>
97
-                            <el-col :span="12">
98
-                                <img :src="img" alt="验证码" @click='getVerifyFn' style="width:100px;height:40px">
99
-                            </el-col>
100
-                        </el-row>
101
-                        <div style="text-align:left;margin-top:9px">
102
-                            <el-checkbox v-model='checked'>记住密码</el-checkbox>
103
-                        </div>
104
-                    </form>
105
-                    <form id="submitForm" action="" method="get" enctype="application/x-www-form-urlencoded">
106
-                        <!-- <input name="url" type="hidden" id="loginUrl" value="http://localhost:9000/#/publicfunction/home" style="display: none"> -->
107
-                    </form>
108
-                </div>
109
-                <div class="login-button" style="margin-top:80px;margin-bottom:10px">
110
-                    <input class="btn btn-primary radius" type="button" id="login" value="登录" @click='login'>
111
-                </div>
112
-                <div class="login-forget">
113
-                    <a href="WJPossword.html">忘记密码?</span>
98
+                            <div class="code-mar">
99
+                                <el-row :gutter="20">
100
+                                    <el-col :span="12">
101
+                                        <el-input name="code" v-model="code" type="text" auto-complete="on"
102
+                                            placeholder="请输入验证码"></el-input>
103
+                                    </el-col>
104
+                                    <el-col :span="12">
105
+                                        <img :src="img" alt="验证码" @click='getVerifyFn' style="width:100px;height:40px">
106
+                                    </el-col>
107
+                                </el-row>
108
+                            </div>
109
+                            <div style="text-align:left">
110
+                                <el-checkbox v-model='checked'>记住密码</el-checkbox>
111
+                            </div>
112
+                        </form>
113
+                        <form id="submitForm" action="" method="get" enctype="application/x-www-form-urlencoded">
114
+                            <!-- <input name="url" type="hidden" id="loginUrl" value="http://localhost:9000/#/publicfunction/home" style="display: none"> -->
115
+                        </form>
116
+                    </div>
117
+                    <div class="login-button" style="margin-top:50px;margin-bottom:10px">
118
+                        <input class="btn btn-primary radius" type="button" id="login" value="登录" @click='login'>
119
+                    </div>
120
+                    <div class="login-forget" style="position: absolute;bottom: 5px;left: 25px;right: auto;">
121
+
122
+                        <a @click="goCompany">平台用户中心</a>
123
+                    </div>
124
+
125
+                    <div class="login-forget">
126
+
127
+                        <a href="WJPossword.html">忘记密码?</a>
128
+                    </div>
129
+
114 130
                 </div>
115 131
             </div>
116 132
         </div>
117 133
     </div>
118
-</div>
119 134
 </body>
135
+<script>
136
+    var date = new Date();
137
+    var m = date.getMonth() + 1
138
+    m = m < 10 ? '0' + m : '' + m
139
+    if (m === "03" || m === "04" || m === "05") {//春
140
+        setStyleSheet("green");
141
+    } else if (m === "06" || m === "07" || m === "08") {//夏
142
+        setStyleSheet("blue");
143
+    } else if (m === "09" || m === "10" || m === "11") {//秋
144
+        setStyleSheet("purple");
145
+    } else if (m === "12" || m === "01" || m === "02") {//冬
146
+        setStyleSheet("red");
147
+    }
148
+
149
+    function setStyleSheet(title) {
150
+        var link_list = document.getElementsByTagName("link");
151
+        for (var i = 0; i < link_list.length; i++) {
152
+            if (link_list[i].getAttribute("rel").indexOf("alternate") != -1) {
153
+                link_list[i].disabled = true;
154
+                if (link_list[i].getAttribute("title") === title) {
155
+                    link_list[i].disabled = false;
156
+                }
157
+            }
158
+        }
159
+    }
120 160
 
161
+    function keyupEnter() {
162
+        document.onkeydown = function (e) {
163
+            var body = document.getElementsByTagName("body")[0];
164
+            if (
165
+                (e.keyCode === 13) &&
166
+                window.location.pathname
167
+                == "/web/portal/login.html"
168
+            ) {
169
+                console.log("enter");
170
+                document.getElementById("login").click();
171
+            }
172
+        };
173
+    }
174
+</script>
121 175
 <!-- <script>
122 176
         $(function () {
123 177
             //切换紫光云本地调试环境
@@ -195,24 +249,34 @@
195 249
             return {
196 250
                 loginForm: {
197 251
                     name: '',
198
-                    password: ''
252
+                    password: '',
199 253
                 },
200 254
                 checked: false,
201 255
                 restaurants: [],
202 256
                 ipConfig: '',
203 257
                 apiConfig: '',
258
+                code: '',
204 259
                 img: ''
205 260
             }
206 261
         },
207 262
         methods: {
263
+            goCompany: function () {
264
+                // let host = window.location.host;
265
+                // if ( host != "localhost:9527") {
266
+                // window.location.href = " http://" + host + "/web/myuser/#/login";
267
+                // }
268
+
269
+                window.location.href = " http://101.36.160.140:21025/web/myuser/#/login";
270
+            },
208 271
             getVerifyFn() {
209
-                let _t = Date.parse(new Date()) / 1000
272
+                var _t = Date.parse(new Date()) / 1000
210 273
                 // this.img = `${location.host}/api/auth/verify?_t=${_t}`
211
-                if (location.host == 'localhost:9000') {
274
+                this.img = `http://101.36.160.140:21025/api/auth/auth/verify?_t=${_t}`
275
+                /*if (location.host == 'localhost:9000') {
212 276
                     this.img = `http://101.36.160.140:8097/api/auth/auth/verify?_t=${_t}`
213 277
                 } else {
214 278
                     this.img = `http://${location.host}/api/auth/auth/verify?_t=${_t}`
215
-                }
279
+                }*/
216 280
             },
217 281
             login: function () {
218 282
                 sessionStorage.setItem('isRemmberPword', this.checked)
@@ -220,10 +284,13 @@
220 284
                 // this.ipConfig + $('#idsImg').attr("data-action") + this.ipConfig + "/ids/js"
221 285
                 // http://111.164.113.172:9090/api/auth/login/idslogout?targeturl=http://111.164.113.172:9090/api/auth/ids/js
222 286
                 var successType = true
223
-                let reUsername = this.loginForm.name
224
-                let rePassword = this.loginForm.password
287
+                var reUsername = this.loginForm.name
288
+                var rePassword = this.loginForm.password
289
+                var reCode = this.code
225 290
                 var username = encodeBase64(this.loginForm.name)
226
-                var password = encodeBase64(this.loginForm.password)
291
+                // var password = encodeBase64(this.loginForm.password)
292
+                var password = hex_md5(this.loginForm.password)
293
+                console.log(password, 'password')
227 294
                 if (!username) {
228 295
                     alert('登录失败,用户名不允许为空')
229 296
                     successType = false
@@ -234,32 +301,69 @@
234 301
                     successType = false
235 302
                     return false
236 303
                 }
304
+                if (!reCode) {
305
+                    alert('登录失败,请输入验证码')
306
+                    successType = false
307
+                    return false
308
+                }
237 309
                 if (successType) {
238
-                    // base64Form("loginForm", "submitForm")
239
-                    getmd5Form("loginForm", "submitForm")
240
-                    $("#submitForm").submit()
310
+                    /*var auth = ''
311
+                    if (location.host == 'localhost:9000') {
312
+                        auth = `http://101.36.160.140:8097/api/auth`
313
+                    } else {
314
+                        auth = `http://${location.host}/api/auth`
315
+                    }*/
316
+                    var auth = `http://101.36.160.140:21025/api/auth`
317
+                    var _this = this
318
+                    $.ajax({
319
+                        url: `${auth}/auth/checkCode?code=${_this.code}`,
320
+                        type: 'post',
321
+                        contentType: "application/json;charset=UTF-8",
322
+                        Accept: "application/json, text/plain, */*",
323
+                        xhrFields: {
324
+                            withCredentials: true // 这里设置了withCredentials
325
+                        },
326
+                        success: function (res) {
327
+                            if (res.infoCode == 200) {
328
+                                _this.loginForm.name = ''
329
+                                _this.loginForm.password = ''
330
+                                //_this.loginForm.passwordNew = ''
241 331
 
242
-                    let newUser = {
243
-                        value: reUsername,
244
-                        pword: rePassword
245
-                    }
246
-                    let newUserArr = []
247
-                    newUserArr.push(newUser)
248
-                    sessionStorage.setItem('newUserArr', escape(JSON.stringify(newUserArr)))
249
-                    // this.rememberPasswordFn(reUsername,rePassword)
332
+                                sessionStorage.setItem('code', _this.code)
333
+
334
+                                // _this.submitForm = JSON.parse(JSON.stringify(_this.loginForm));
335
+                                // _this.submitForm.password = password
336
+                                // base64Form("loginForm", "submitForm")
337
+                                getmd5Form("loginForm", "submitForm")
338
+                                $("#submitForm").submit()
339
+                                var newUser = {
340
+                                    value: reUsername,
341
+                                    pword: rePassword,
342
+                                    code: reCode
343
+                                }
344
+                                var newUserArr = []
345
+                                newUserArr.push(newUser)
346
+                                sessionStorage.setItem('newUserArr', escape(JSON.stringify(newUserArr)))
347
+                                // this.rememberPasswordFn(reUsername, rePassword)
348
+                            } else {
349
+                                alert(res.msg)
350
+                                _this.getVerifyFn()
351
+                            }
352
+                        }
353
+                    })
250 354
                 }
251 355
             },
252 356
             //记住密码处理方法
253 357
             rememberPasswordFn: function (reUsername, rePassword) {
254
-                let inFifteenMinutes = new Date(
358
+                var inFifteenMinutes = new Date(
255 359
                     new Date().getTime() + 100 * 365 * 24 * 60 * 60 * 1000
256 360
                 );
257
-                let loginUserList = JSON.parse(unescape(this.getCookie("portalloginHistory")));
258
-                let newUser = {
361
+                var loginUserList = JSON.parse(unescape(this.getCookie("portalloginHistory")));
362
+                var newUser = {
259 363
                     value: reUsername,
260 364
                     pword: rePassword
261 365
                 };
262
-                let oldUser = {
366
+                var oldUser = {
263 367
                     value: reUsername,
264 368
                     pword: ""
265 369
                 };
@@ -352,8 +456,8 @@
352 456
         },
353 457
         created: function () {
354 458
             this.getVerifyFn()
355
-            this.ipConfig = "http://" + (location.host == 'localhost:9000' ? '101.36.160.140:8097/api/auth' : location.host + "/api/auth")
356
-            this.apiConfig = "http://" + (location.host == 'localhost:9000' ? '101.36.160.140:8097' : location.host)
459
+            this.ipConfig = "http://" + (location.host == 'localhost:9000' ? '101.36.160.140:21025/api/auth' : location.host + "/api/auth")
460
+            this.apiConfig = "http://" + (location.host == 'localhost:9000' ? '101.36.160.140:21025' : location.host)
357 461
 
358 462
             if (location.host != "localhost:9000") {
359 463
                 $("#loginUrl").attr("value", this.apiConfig + '/web/portal/#/publicfunction/home');
@@ -364,7 +468,7 @@
364 468
 
365 469
             if (!this.getCookie("portalloginHistory")) {
366 470
                 this.checked = false
367
-                let inFifteenMinutes = new Date(
471
+                var inFifteenMinutes = new Date(
368 472
                     new Date().getTime() + 100 * 365 * 24 * 60 * 60 * 1000
369 473
                 );
370 474
                 window.document.cookie =
@@ -377,7 +481,7 @@
377 481
                     inFifteenMinutes.toGMTString()
378 482
                 );
379 483
             } else {
380
-                let portalloginHistory = JSON.parse(unescape(this.getCookie("portalloginHistory")))
484
+                var portalloginHistory = JSON.parse(unescape(this.getCookie("portalloginHistory")))
381 485
                 if (portalloginHistory.length > 0) {
382 486
                     if (portalloginHistory[0].pword.length > 0) {
383 487
                         this.checked = true