yusijie
6 天以前 38e2af3452b331488e052ee470a9c662fd2b9446
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
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
<!DOCTYPE html>
<html>
<head>
    <title>供应商协同平台</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="description" content="" />
    <meta name="author" content="" />
 
    <!-- CSS -->
    <link rel="stylesheet" href="layuiAdmin.std-v1.2.1/src/css/jquery.selectlist.css" />
    <link rel="stylesheet" href="layuiAdmin.std-v1.2.1/src/css/supersized.css" />
    <link rel="stylesheet" href="layuiAdmin.std-v1.2.1/src/css/reset.css" />
    <link rel="stylesheet" href="layuiAdmin.std-v1.2.1/src/css/style.css" />
    <link rel="stylesheet" href="layuiAdmin.std-v1.2.1/src/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="layuiAdmin.std-v1.2.1/src//layuiadmin/style/admin.css" media="all">
    <link href="layuiAdmin.std-v1.2.1/dist/layuiadmin/style/login.css" rel="stylesheet" />
    <style type="text/css">
        .layadmin-user-login-body .layui-form-item .layui-input {
            color: blue;
        }
 
        .layui-btn-danger {
            width: 100%;
        }       
 
    </style>
</head>
<body>
    <div class="layadmin-user-login-main">
        <div class="layadmin-user-login-box layadmin-user-login-header">
            <!--<img src="layuiAdmin.std-v1.2.1/src/img/Logo.png" alt="供应商协同平台" align="middle" />-->
            <h2 style="color:white;" id="title1">供应商协同平台</h2>
            <p style="color: white;margin-bottom:10px;" id="title2">智云LMES管理系统</p>
            <a class="ax-item FY_BT" id="Hlanguage" style="color: white;">语言</a>
            <select id="HTranSlate" style="width: 25%; margin-right: 1%; padding-left: 1px; font-size: 13px;">
                <option value="1" selected>中文</option>
                <option value="2">Eeglish</option>
                <option value="3">Spanish</option>
            </select>
        </div>
        <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
            <div class="layui-form-item">
                <select id="edu" name="edu" lay-verify="required" lay-search class="layui-input">
                </select>
            </div>
 
            <div class="layui-form-item">
                <label class="layadmin-user-login-icon layui-icon layui-icon-username login-input" for="LAY-user-login-password"></label>
                <input type="text" name="username" id="LAY-user-login-username" lay-verify="required" placeholder="用户名" class="layui-input" style="background-color:transparent;color:white" autocomplete="off">
            </div>
            <div class="layui-form-item">
                <label class="layadmin-user-login-icon layui-icon layui-icon-password login-input" for="LAY-user-login-password"></label>
                <input type="password" name="password" id="LAY-user-login-password" lay-verify="required" placeholder="密码" class="layui-input" style="background-color:transparent;color:white" autocomplete="off">
            </div>
            <div class="layui-form-item">
                <button type="button" lay-submit="" class="layui-btn layui-btn-fluid" id="LAY-user-login-submit" name="LAY-user-login-submit" lay-filter="LAY-user-login-submit">登 入</button>
            </div>
            <!--<div class="layui-form-item">
                <a href="./layuiAdmin.std-v1.2.1/src/Download/组装车间未排产代码.xlsx" download="组装车间未排产代码.xlsx" style="color:red;font-size:20px;">点击下载操作手册</a>
            </div>
            <div class="layui-form-item">
                <a href="./layuiAdmin.std-v1.2.1/src/Download/gridreport6.8.exe" download="gridreport6.8.exe" style="color:red;font-size:20px;">点击下载打印插件</a>
            </div>
            <div class="layui-form-item">
                <a href="./layuiAdmin.std-v1.2.1/src/Download/删除条码,送货单.mp4" download="操作视频.mp4" style="color:red;font-size:20px;">点击下载操作视频</a>
            </div>
            <div class="layui-form-item">
                <a href="./layuiAdmin.std-v1.2.1/src/Download/gridreport6.8.zip" download="插件压缩包.zip" style="color:red;font-size:20px;">点击下载压缩包</a>
            </div>-->
        </div>
    </div>
    <!--顺序不能改变-->
    <script src="layuiAdmin.std-v1.2.1/src/js/jquery.min.js"></script>
    <script src="layuiAdmin.std-v1.2.1/src/js/supersized.3.2.7.min.js"></script>
    <script src="layuiAdmin.std-v1.2.1/src/js/supersized-init.js"></script><!--登录图片-->
    <script src="layuiAdmin.std-v1.2.1/src/js/jquery-1.9.1.min.js"></script>
    <script src="layuiAdmin.std-v1.2.1/src/js/jquery.selectlist.js"></script>
    <script src="layuiAdmin.std-v1.2.1/src/layuiadmin/layui/layui.js"></script>
    <script src="layuiAdmin.std-v1.2.1/src/layuiadmin/MESLanguage.js"></script>
    <script src="Scripts/webConfig.js"></script>
    <script type="text/javascript">
        layui.config({
            base: 'layuiAdmin.std-v1.2.1/src/layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'user'], function () {
            var $ = layui.$
                , setter = layui.setter
                , admin = layui.admin
                , form = layui.form
                , router = layui.router()
                , search = router.search;
 
            //#region 多语言
            var HModName = "SRM_login";
            var login_data = localStorage.getItem("data");
            var login_data2 = [];
            if (login_data != null) {
                login_data2 = JSON.parse(login_data);
            }
            //获取基础信息
            getBaseInfo(login_data2.HTranSlate);
 
            if (login_data == null || login_data2.HTranSlate == undefined) {
                initFunction(1, "SRM_login", 1);
            } else {
                initFunction(1, "SRM_login", login_data2.HTranSlate);
            }
            //#endregion
 
            //获取登录页组织列
            var Organization = '<option value="0" style="color:red;">组织</option>';
            $.ajax({
                type: "get",
                url: GetWEBURL() + "GetOrganizations",
                async: false,
                success: function (result) {
                    if (result.count == 1) { // 说明验证成功了,
                        var data = result.data;
                        for (var i = 0; i < data.length; i++) {
                            if (data[i].Name == "浙江夏宝电器有限公司" || data[i].Name.indexOf("蓝海实业集团") >= 0 || data[i].Name.indexOf("安瑞集团") >= 0 || data[i].Name.indexOf("添康科技") >= 0)
                                Organization += '<option  style="color:blue;" selected value="' + data[i].ID + '">' + data[i].Name + '</option>';
                            else
                                Organization += '<option  style="color:blue;" value="' + data[i].ID + '">' + data[i].Name + '</option>';
                        }
                        $("#edu").append(Organization);
                        form.render('select');
 
                        //读取配置文件
                        get_ReadConfigFile();
                    }
                    layer.closeAll("loading");
                }
            })
            form.on('submit(LAY-user-login-submit)', function (obj) {//登录
                if ($("#HTranSlate").val() == null) {
                    layer.msg("请选择语言!");
                    return false;
                }
                loging(obj);
            })
 
            function loging(obj) {
                if ($("#edu").val() == 0) {
                    layer.msg("请选择组织!");
                    return;
                }
                //var user = obj.field;
                var UserName = $("#LAY-user-login-username").val();
                var PassWord = $("#LAY-user-login-password").val();
 
                if (UserName == '') {
                    layer.msg("用户名不能为空~", {
                        icon: 5,
                        shade: [0.8, '#2F4F4F'] // 透明度  颜色
                    });
                    return false;
                }
                if (PassWord == '') {
                    layer.msg("密码不能为空~", {
                        icon: 5,
                        shade: [0.8, '#2F4F4F'] // 透明度  颜色
                    });
                    return false;
                }
                $.ajax({
                    type: "get",
                    url: GetWEBURL() + "GetUser",
                    data: { "UserName": UserName, "PassWord": PassWord, "HOrgName": $("#edu").val() },
                    success: function (result) {
                        if (result.count == 1) { // 说明验证成功了,
                            layer.msg(result.Message, { icon: 1, });
                            sessionStorage["HUserName"] = result.data.h_p_SRM_GetSupIDByUser[0].Czymc;
                            sessionStorage["HSupIDs"] = result.data.h_p_SRM_GetSupIDByUser1[0].HSupID;
                            sessionStorage["OrganizationID"] = $("#edu").val();
                            sessionStorage["Organization"] = $("#edu option:selected").text();
                            sessionStorage["login"] = "login";
                            sessionStorage["HTranSlate"] = $("#HTranSlate option:selected").val();
                            get_WriteConfigFile();
                            window.location.href = "layuiAdmin.std-v1.2.1/src/views/index.html"
                        }
                        else {
                            // $("#verifycode").click();
                            layer.msg(result.Message, { icon: 5, });
                        }
                        layer.closeAll("loading");
                    }
                })
            }
 
            //密码框回车执行登录
            $('#LAY-user-login-password').on('keydown', function (e) {
                if (e.keyCode == 13) {
                    if ($("#HTranSlate").val() == null) {
                        layer.msg("请选择语言!");
                        return false;
                    }
                    loging();
                }
            });
            //用户名框回车光标移到密码框
            $('#LAY-user-login-username').on('keydown', function (e) {
                if (e.keyCode == 13) {
                    $("#LAY-user-login-password").focus();
                }
            })
 
            //#region 多语言翻译
 
            $("#HTranSlate").change(function () {
                var select = $("#HTranSlate").val();
                getBaseInfo(select);
                initFunction(1, HModName, select);
                //sessionStorage["HTranSlate"] = select;
            })
 
            //读取配置文件
            function get_ReadConfigFile() {
                //获取本地存储的数据
                var data = localStorage.getItem("data");
                if (data != null) {
                    var data2 = JSON.parse(data);
                    $("#LAY-user-login-username").val(data2["UserID"]);
                    $("#Organization").val(data2["OrgID"]);
                    $("#HTranSlate").val(data2["HTranSlate"] == undefined ? 1 : data2["HTranSlate"]);
                    form.render('select');
                }
            }
 
            //存储配置文件
            function get_WriteConfigFile() {
                //清空本地存储的数据
                localStorage.removeItem("data");
                var data = {
                    UserID: sessionStorage["Czybm"]
                    , OrgID: sessionStorage["OrganizationID"]
                    , HTranSlate: sessionStorage["HTranSlate"]
                }
                //本地存储
                localStorage.setItem("data", JSON.stringify(data));
            }
 
            //获取基础信息
            function getBaseInfo(HTranSlate) {
                if (HTranSlate == undefined) {
                    HTranSlate = "1";
                }
 
                $.ajax({
                    type: "get",
                    url: GetWEBURL() + "Web/BaseInfo",
                    async: false,
                    data: {},
                    success: function (res) {
                        //查询成功
                        if (res.count == 1) {
                            var data = res.data[0];
                            console.log(data);
 
                            //判断当前登录的语言类型
                            var HLogoLabel = "";
                            var HMenuLabel = "";
                            if (HTranSlate == "1" || (login_data2.length == 0 && HTranSlate == undefined)) {
                                HLogoLabel = data.HLogoLabel;
                                HMenuLabel = data.HMenuLabel;
                            } else if (HTranSlate == "2") {
                                HLogoLabel = data.HLogoTranslationText_English;
                                HMenuLabel = data.HMenuTranslationText_English;
                            } else if (HTranSlate == "3") {
                                HLogoLabel = data.HLogoTranslationText_Spain;
                                HMenuLabel = data.HMenuTranslationText_Spain;
                            }
 
                            sessionStorage["HCusName"] = data.HCusName;
                            sessionStorage["HLogoLabel"] = HLogoLabel;
                            sessionStorage["HMenuLabel"] = HMenuLabel;
                            $("#HLogoLabel").text(HLogoLabel);
                        }
                    }
                })
            }
            //#endregion
 
        });
    </script>
</body>
</html>