ike-weblca-html 2.0.12 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/package.json +6 -2
- package/src/IkeWebHeader.js +729 -518
- package/src/index.js +4 -4
- package/src/IkeWebHeader-temporary.js +0 -529
package/src/IkeWebHeader.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {css, html, LitElement} from 'lit-element'
|
|
2
|
-
import {property} from
|
|
3
|
-
import cookies from 'js-cookie'
|
|
1
|
+
import { css, html, LitElement } from 'lit-element'
|
|
2
|
+
import { property } from 'lodash-es'
|
|
3
|
+
import cookies from 'js-cookie'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* IkeWebHeader - Web LCA 网站头部组件
|
|
@@ -17,539 +17,750 @@ import cookies from 'js-cookie';
|
|
|
17
17
|
* - 登录状态检测和相应的URL跳转逻辑
|
|
18
18
|
*/
|
|
19
19
|
export class IkeWebHeader extends LitElement {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.iwh-url {
|
|
38
|
-
max-width: 220px;
|
|
39
|
-
max-height: 40px;
|
|
40
|
-
display: inline-block;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.header-list {
|
|
44
|
-
color: #fff !important;
|
|
45
|
-
height: 72px;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.menu-item:hover {
|
|
49
|
-
background: rgba(0, 162, 44, 0.1);
|
|
50
|
-
color: var(--ike-web-header-text-color, '#fff')
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.el-menu-demo {
|
|
54
|
-
display: flex;
|
|
55
|
-
align-items: center;
|
|
56
|
-
cursor: pointer;
|
|
57
|
-
color: #fff;
|
|
58
|
-
background: transparent;
|
|
59
|
-
border: none;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.posi {
|
|
63
|
-
position: absolute;
|
|
64
|
-
top: 20%;
|
|
65
|
-
left: 70%;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.box-a {
|
|
69
|
-
display: inline-block;
|
|
70
|
-
margin-left: 30px;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.box-a img {
|
|
74
|
-
width: auto;
|
|
75
|
-
height: 40px;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.left-menu-items {
|
|
79
|
-
display: flex;
|
|
80
|
-
align-items: center;
|
|
81
|
-
margin-left: 20px;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.left-menu-item {
|
|
85
|
-
padding: 0 15px;
|
|
86
|
-
font-size: 14px;
|
|
87
|
-
height: 72px;
|
|
88
|
-
display: flex;
|
|
89
|
-
align-items: center;
|
|
90
|
-
cursor: pointer;
|
|
91
|
-
border-radius: 4px;
|
|
92
|
-
transition: background-color 0.3s ease;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
.left-menu-item:hover {
|
|
96
|
-
background: rgba(0, 162, 44, 0.1);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.menu-item {
|
|
100
|
-
padding: 0 20px;
|
|
101
|
-
font-size: 14px;
|
|
102
|
-
height: 72px;
|
|
103
|
-
text-align: center;
|
|
104
|
-
box-sizing: border-box;
|
|
105
|
-
display: flex;
|
|
106
|
-
align-items: center;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
.menu-item-database{
|
|
110
|
-
position: relative;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
.menu-sub-group{
|
|
114
|
-
background: #E6F2E8;
|
|
115
|
-
position: absolute;
|
|
116
|
-
z-index: 999;
|
|
117
|
-
width: 150%;
|
|
118
|
-
//bottom: -72px;
|
|
119
|
-
top: 100%;
|
|
120
|
-
left: -50%;
|
|
121
|
-
padding: 20px 20px 0 20px;
|
|
122
|
-
//transform: translateX(50%);
|
|
123
|
-
color: #06AA3E;
|
|
124
|
-
box-shadow: 0px 0px 4px 0px rgba(6,50,35,0.53);
|
|
125
|
-
border-radius: 0px 0px 8px 8px;
|
|
126
|
-
display: none;
|
|
127
|
-
transition: opacity 0.3s ease;
|
|
128
|
-
opacity: 0;
|
|
129
|
-
}
|
|
130
|
-
.menu-sub-group-1{
|
|
131
|
-
width: 280px;
|
|
132
|
-
left: 50%;
|
|
133
|
-
transform: translateX(-50%);
|
|
134
|
-
}
|
|
135
|
-
.menu-sub-item{
|
|
136
|
-
padding-bottom: 20px;
|
|
137
|
-
color: #373737;
|
|
138
|
-
}
|
|
139
|
-
.menu-sub-item:hover{
|
|
140
|
-
color: #06AA3E;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
.menu-item-database:hover .menu-sub-group {
|
|
144
|
-
display: block;
|
|
145
|
-
opacity: 1;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
/* 消息图标样式 */
|
|
149
|
-
.message-icon-container {
|
|
150
|
-
position: relative;
|
|
151
|
-
display: flex;
|
|
152
|
-
align-items: center;
|
|
153
|
-
margin: 0 15px;
|
|
154
|
-
cursor: pointer;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
.message-icon {
|
|
158
|
-
width: 24px;
|
|
159
|
-
height: 24px;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
.message-badge {
|
|
163
|
-
position: absolute;
|
|
164
|
-
top: -8px;
|
|
165
|
-
right: -8px;
|
|
166
|
-
background: linear-gradient(90deg, #FFBB24 0%, #FF9900 100%);
|
|
167
|
-
color: white;
|
|
168
|
-
border-radius: 50%;
|
|
169
|
-
width: 18px;
|
|
170
|
-
height: 18px;
|
|
171
|
-
display: flex;
|
|
172
|
-
align-items: center;
|
|
173
|
-
justify-content: center;
|
|
174
|
-
font-size: 12px;
|
|
175
|
-
font-weight: bold;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/* 登录按钮样式 */
|
|
179
|
-
.login-button {
|
|
180
|
-
padding: 8px 16px;
|
|
181
|
-
border: 1px solid;
|
|
182
|
-
border-radius: 4px;
|
|
183
|
-
cursor: pointer;
|
|
184
|
-
font-size: 14px;
|
|
185
|
-
transition: all 0.3s ease;
|
|
186
|
-
margin-left: 15px;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
.login-button:hover {
|
|
190
|
-
opacity: 0.8;
|
|
191
|
-
}
|
|
192
|
-
`;
|
|
193
|
-
|
|
194
|
-
// ==================== 环境和状态相关属性 ====================
|
|
195
|
-
|
|
196
|
-
/** 当前网站状态,基于域名的第一部分 */
|
|
197
|
-
status = window.location.hostname.split('.')[0]
|
|
198
|
-
|
|
199
|
-
/** 当前页面完整URL */
|
|
200
|
-
hostName = window.location.href
|
|
201
|
-
|
|
202
|
-
/** 是否为平台版本(www、192、online环境) */
|
|
203
|
-
isPlat = this.status === 'www' || this.status === '192' || this.status === 'online'
|
|
204
|
-
|
|
205
|
-
/** 是否显示语言切换功能 */
|
|
206
|
-
isShowLang = this.status === 'www' || this.status === 'nanozeo' || this.status === '192' || this.status === 'online'
|
|
207
|
-
|
|
208
|
-
// ==================== 数据相关属性 ====================
|
|
209
|
-
|
|
210
|
-
/** 从API获取的数据 */
|
|
211
|
-
data = []
|
|
212
|
-
|
|
213
|
-
/** 个性化配置JSON数据 */
|
|
214
|
-
personalizedConfigJson
|
|
215
|
-
|
|
216
|
-
/** 机构logo URL */
|
|
217
|
-
logo
|
|
218
|
-
|
|
219
|
-
/** 机构联系方式 */
|
|
220
|
-
orgContacts
|
|
221
|
-
|
|
222
|
-
/** 机构名称 */
|
|
223
|
-
name
|
|
224
|
-
|
|
225
|
-
/** 机构邮箱 */
|
|
226
|
-
email
|
|
227
|
-
|
|
228
|
-
/** 机构电话 */
|
|
229
|
-
phone
|
|
230
|
-
|
|
231
|
-
/** 机构地址 */
|
|
232
|
-
address
|
|
233
|
-
|
|
234
|
-
/** 关注链接 */
|
|
235
|
-
followUrl
|
|
236
|
-
|
|
237
|
-
/** 已开通的服务列表 */
|
|
238
|
-
alreadyServices
|
|
239
|
-
|
|
240
|
-
// ==================== 多语言相关属性 ====================
|
|
241
|
-
|
|
242
|
-
/** 当前语言 */
|
|
243
|
-
currentLanguage = 'zh_CN';
|
|
244
|
-
|
|
245
|
-
/** 简体中文语言包 */
|
|
246
|
-
zhCN = {
|
|
247
|
-
'首页':'首页',
|
|
248
|
-
'数据库':'数据库',
|
|
249
|
-
'资料库':'资料库',
|
|
250
|
-
'皮革LCA数据库':'皮革LCA数据库',
|
|
251
|
-
'LCA大赛':'LCA大赛',
|
|
252
|
-
'专业培训':'专业培训',
|
|
253
|
-
'联系我们':'联系我们',
|
|
254
|
-
'标准库':'标准库',
|
|
255
|
-
'核算模版':'核算模版',
|
|
256
|
-
'2025全生命周期创新大赛':'2025全生命周期创新大赛',
|
|
257
|
-
|
|
258
|
-
'化工专题比赛':'2025首届中国化工产品碳足迹数据库大赛',
|
|
259
|
-
'登录':'登录',
|
|
260
|
-
'个人中心':'个人中心',
|
|
261
|
-
|
|
20
|
+
/**
|
|
21
|
+
* 组件样式定义
|
|
22
|
+
* 包含头部容器、菜单项、子菜单、悬停效果等样式
|
|
23
|
+
*/
|
|
24
|
+
static styles = css`
|
|
25
|
+
.ike-web-header {
|
|
26
|
+
width: 100%;
|
|
27
|
+
box-sizing: border-box;
|
|
28
|
+
height: 72px;
|
|
29
|
+
display: flex;
|
|
30
|
+
padding: 0 72px;
|
|
31
|
+
background: var(--ike-web-header-bg, #063223);
|
|
32
|
+
align-items: center;
|
|
33
|
+
justify-content: space-between;
|
|
34
|
+
border-bottom: 1px solid rgba(211, 211, 211, 0.3);
|
|
262
35
|
}
|
|
263
36
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
'资料库':'資料庫',
|
|
269
|
-
'皮革LCA数据库':'皮革LCA數據庫',
|
|
270
|
-
'LCA大赛':'LCA大賽',
|
|
271
|
-
'专业培训':'專業培訓',
|
|
272
|
-
'联系我们':'聯繫我們',
|
|
273
|
-
'标准库':'標準庫',
|
|
274
|
-
'核算模版':'核算模版',
|
|
275
|
-
'2025全生命周期创新大赛':'2025全生命週期創新大賽',
|
|
276
|
-
'化工专题比赛': '2025首届中國化工產品碳足迹資料庫大賽',
|
|
277
|
-
'登录':'登录',
|
|
278
|
-
'个人中心':'个人中心',
|
|
37
|
+
.iwh-url {
|
|
38
|
+
max-width: 220px;
|
|
39
|
+
max-height: 40px;
|
|
40
|
+
display: inline-block;
|
|
279
41
|
}
|
|
280
42
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
'数据库':'Database',
|
|
285
|
-
'资料库':'Database',
|
|
286
|
-
'皮革LCA数据库':'Leather LCA Database',
|
|
287
|
-
'LCA大赛':'LCA Competition',
|
|
288
|
-
'专业培训':'Professional Training',
|
|
289
|
-
'联系我们':'Contact Us',
|
|
290
|
-
'标准库':'Standard Library',
|
|
291
|
-
'核算模版':'Calculation Template',
|
|
292
|
-
'2025全生命周期创新大赛':'2025 Life Cycle Innovation Competition',
|
|
293
|
-
'化工专题比赛':'2025 First China Chemical Product Carbon Footprint Database Competition',
|
|
294
|
-
'登录':'Login',
|
|
295
|
-
'个人中心':'Personal Center',
|
|
43
|
+
.header-list {
|
|
44
|
+
color: #fff !important;
|
|
45
|
+
height: 72px;
|
|
296
46
|
}
|
|
297
47
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
/** 浏览器默认语言 */
|
|
302
|
-
createLang = navigator.language.replace('-', '_')
|
|
303
|
-
|
|
304
|
-
/** 用户选择的语言(优先从localStorage获取,否则使用浏览器语言) */
|
|
305
|
-
lang = window.localStorage.getItem('lang') || this.createLang
|
|
306
|
-
|
|
307
|
-
/** 登录状态检测 - 检查cookie中是否存在token */
|
|
308
|
-
isLoggedIn = !!cookies.get('token')
|
|
309
|
-
|
|
310
|
-
/** 消息数量(当前写死为1) */
|
|
311
|
-
messageCount = 1
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
connectedCallback() {
|
|
316
|
-
switch(this.lang) {
|
|
317
|
-
case 'zh':
|
|
318
|
-
this.currentLanguage = 'zh_CN';
|
|
319
|
-
this.i18n = this.zhCN
|
|
320
|
-
break;
|
|
321
|
-
case 'zh_CN':
|
|
322
|
-
this.currentLanguage = 'zh_CN';
|
|
323
|
-
this.i18n = this.zhCN
|
|
324
|
-
break;
|
|
325
|
-
case 'zh_TW':
|
|
326
|
-
this.currentLanguage = 'zh_TW';
|
|
327
|
-
this.i18n = this.zhTW
|
|
328
|
-
break;
|
|
329
|
-
case 'en_US':
|
|
330
|
-
this.currentLanguage = 'en_US';
|
|
331
|
-
this.i18n= this.enUS
|
|
332
|
-
break;
|
|
333
|
-
default:
|
|
334
|
-
this.currentLanguage = 'zh_CN';
|
|
335
|
-
this.i18n = this.zhCN
|
|
336
|
-
break;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
super.connectedCallback();
|
|
340
|
-
this.fetchData();
|
|
48
|
+
.menu-item:hover {
|
|
49
|
+
background: rgba(0, 162, 44, 0.1);
|
|
50
|
+
color: var(--ike-web-header-text-color, '#fff');
|
|
341
51
|
}
|
|
342
52
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
this.personalizedConfigJson = JSON.parse(data.personalizedConfigJson);
|
|
351
|
-
}
|
|
352
|
-
// console.log('this.data.data.personalizedConfigJson', this.personalizedConfigJson)
|
|
353
|
-
this.logo = this.personalizedConfigJson && this.personalizedConfigJson.logo;
|
|
354
|
-
this.orgContacts = this.personalizedConfigJson && this.personalizedConfigJson.orgContacts;
|
|
355
|
-
this.name = this.personalizedConfigJson && this.personalizedConfigJson.institution && this.personalizedConfigJson.institution.name;
|
|
356
|
-
this.email = this.personalizedConfigJson && this.personalizedConfigJson.orgEmail;
|
|
357
|
-
this.phone = this.personalizedConfigJson && this.personalizedConfigJson.orgPhone
|
|
358
|
-
this.address = this.personalizedConfigJson && this.personalizedConfigJson.orgAddress;
|
|
359
|
-
this.followUrl = this.personalizedConfigJson && this.personalizedConfigJson.followUrl;
|
|
360
|
-
this.alreadyServices = data.alreadyServices
|
|
361
|
-
setTimeout(() => this.requestUpdate())
|
|
362
|
-
// this.requestUpdate(); // 更新组件以触发重新渲染
|
|
363
|
-
} catch (error) {
|
|
364
|
-
// console.error('Error fetching data:', error);
|
|
365
|
-
}
|
|
53
|
+
.el-menu-demo {
|
|
54
|
+
display: flex;
|
|
55
|
+
align-items: center;
|
|
56
|
+
cursor: pointer;
|
|
57
|
+
color: #fff;
|
|
58
|
+
background: transparent;
|
|
59
|
+
border: none;
|
|
366
60
|
}
|
|
367
61
|
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
${ this.isShowLang ? html`
|
|
463
|
-
<div class="menu-item menu-item-database"
|
|
464
|
-
style=" position: relative;
|
|
465
|
-
text-align: center;
|
|
466
|
-
display: flex;
|
|
467
|
-
align-items: center;
|
|
468
|
-
color: ${this.hostName.includes('weblca.net/database') ? '#06AA3E' : this.isPlat ? '#fff' : '#373737'}"
|
|
469
|
-
>
|
|
470
|
-
${ this.isPlat ? html`<img src="http://ike-web.oss-cn-hangzhou.aliyuncs.com/language.png" alt="">` : html`<img src="http://ike-web.oss-cn-hangzhou.aliyuncs.com/language_block.png" alt="">` }
|
|
471
|
-
<div class="menu-sub-group">
|
|
472
|
-
<div @click="${this._clickLang}" data-lang="zh_CN" class="menu-sub-item">中文简体</div>
|
|
473
|
-
<div @click="${this._clickLang}" data-lang="zh_TW" class="menu-sub-item">中文繁體</div>
|
|
474
|
-
<div @click="${this._clickLang}" data-lang="en_US" class="menu-sub-item">English</div>
|
|
475
|
-
</div>
|
|
476
|
-
</div>` : ''}
|
|
477
|
-
|
|
478
|
-
<!-- 消息图标 - 仅在登录状态下显示 -->
|
|
479
|
-
${this.isLoggedIn ? html`
|
|
480
|
-
<div @click="${this._routerPush}"
|
|
481
|
-
data-login-url="https://www.weblca.net/notification"
|
|
482
|
-
data-url="https://www.weblca.net/notification" class="message-icon-container">
|
|
483
|
-
<img src="https://ike-web.oss-cn-hangzhou.aliyuncs.com/message.png" alt="消息" class="message-icon">
|
|
484
|
-
<div class="message-badge">${this.messageCount}</div>
|
|
485
|
-
</div>
|
|
486
|
-
` : ''}
|
|
487
|
-
|
|
488
|
-
<!-- 登录/首页按钮 -->
|
|
489
|
-
<div class="login-button"
|
|
490
|
-
style="border-color: ${this.isPlat ? '#fff' : '#373737'}; color: ${this.isPlat ? '#fff' : '#373737'}"
|
|
491
|
-
@click="${this._handleLoginClick}">
|
|
492
|
-
${this.isLoggedIn ? this.i18n['个人中心'] : this.i18n['登录']}
|
|
493
|
-
</div>
|
|
494
|
-
|
|
495
|
-
<!-- <div class="menu-item">-->
|
|
496
|
-
<!-- <el-icon style="cursor: pointer" size="28" color="#fff">-->
|
|
497
|
-
<!-- <UserFilled/>-->
|
|
498
|
-
<!-- </el-icon>-->
|
|
499
|
-
<!-- </div>-->
|
|
500
|
-
</div>
|
|
501
|
-
</div>
|
|
502
|
-
</div>
|
|
503
|
-
</div>`;
|
|
62
|
+
.posi {
|
|
63
|
+
position: absolute;
|
|
64
|
+
top: 20%;
|
|
65
|
+
left: 70%;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.box-a {
|
|
69
|
+
display: inline-block;
|
|
70
|
+
margin-left: 30px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.box-a img {
|
|
74
|
+
width: auto;
|
|
75
|
+
height: 40px;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.left-menu-items {
|
|
79
|
+
display: flex;
|
|
80
|
+
align-items: center;
|
|
81
|
+
margin-left: 20px;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.left-menu-item {
|
|
85
|
+
padding: 0 15px;
|
|
86
|
+
font-size: 14px;
|
|
87
|
+
height: 72px;
|
|
88
|
+
display: flex;
|
|
89
|
+
align-items: center;
|
|
90
|
+
cursor: pointer;
|
|
91
|
+
border-radius: 4px;
|
|
92
|
+
transition: background-color 0.3s ease;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.left-menu-item:hover {
|
|
96
|
+
background: rgba(0, 162, 44, 0.1);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.menu-item {
|
|
100
|
+
padding: 0 20px;
|
|
101
|
+
font-size: 14px;
|
|
102
|
+
height: 72px;
|
|
103
|
+
text-align: center;
|
|
104
|
+
box-sizing: border-box;
|
|
105
|
+
display: flex;
|
|
106
|
+
align-items: center;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.menu-item-database {
|
|
110
|
+
position: relative;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.menu-sub-group {
|
|
114
|
+
background: #e6f2e8;
|
|
115
|
+
position: absolute;
|
|
116
|
+
z-index: 999;
|
|
117
|
+
width: 150%;
|
|
118
|
+
//bottom: -72px;
|
|
119
|
+
top: 100%;
|
|
120
|
+
left: -50%;
|
|
121
|
+
padding: 20px 20px 0 20px;
|
|
122
|
+
//transform: translateX(50%);
|
|
123
|
+
color: #06aa3e;
|
|
124
|
+
box-shadow: 0px 0px 4px 0px rgba(6, 50, 35, 0.53);
|
|
125
|
+
border-radius: 0px 0px 8px 8px;
|
|
126
|
+
display: none;
|
|
127
|
+
transition: opacity 0.3s ease;
|
|
128
|
+
opacity: 0;
|
|
129
|
+
}
|
|
130
|
+
.menu-sub-group-1 {
|
|
131
|
+
width: 280px;
|
|
132
|
+
left: 50%;
|
|
133
|
+
transform: translateX(-50%);
|
|
134
|
+
}
|
|
135
|
+
.menu-sub-item {
|
|
136
|
+
padding-bottom: 20px;
|
|
137
|
+
color: #373737;
|
|
138
|
+
}
|
|
139
|
+
.menu-sub-item:hover {
|
|
140
|
+
color: #06aa3e;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.menu-item-database:hover .menu-sub-group {
|
|
144
|
+
display: block;
|
|
145
|
+
opacity: 1;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/* 消息图标样式 */
|
|
149
|
+
.message-icon-container {
|
|
150
|
+
position: relative;
|
|
151
|
+
display: flex;
|
|
152
|
+
align-items: center;
|
|
153
|
+
margin: 0 15px;
|
|
154
|
+
cursor: pointer;
|
|
504
155
|
}
|
|
505
156
|
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
let to = e.currentTarget && e.currentTarget.getAttribute('data-url');
|
|
510
|
-
let loginUrl = e.currentTarget && e.currentTarget.getAttribute('data-login-url');
|
|
511
|
-
|
|
512
|
-
// 根据登录状态选择跳转URL
|
|
513
|
-
if (loginUrl && this.isLoggedIn) {
|
|
514
|
-
to = loginUrl;
|
|
515
|
-
}
|
|
516
|
-
//192,www ,以及 to之中包含online的都不需要替换
|
|
517
|
-
// @ts-ignore
|
|
518
|
-
if (this.status !== '192' && this.status !== 'www' && this.status !== 'online' && !to.includes('online')) {
|
|
519
|
-
to = to.replace('www', this.status)
|
|
520
|
-
}
|
|
521
|
-
window.location.href = to
|
|
522
|
-
window.parent.postMessage({type: 'navigate', url: to}, '*');
|
|
157
|
+
.message-icon {
|
|
158
|
+
width: 24px;
|
|
159
|
+
height: 24px;
|
|
523
160
|
}
|
|
524
161
|
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
162
|
+
.message-badge {
|
|
163
|
+
position: absolute;
|
|
164
|
+
top: -8px;
|
|
165
|
+
right: -8px;
|
|
166
|
+
background: linear-gradient(90deg, #ffbb24 0%, #ff9900 100%);
|
|
167
|
+
color: white;
|
|
168
|
+
border-radius: 50%;
|
|
169
|
+
width: 18px;
|
|
170
|
+
height: 18px;
|
|
171
|
+
display: flex;
|
|
172
|
+
align-items: center;
|
|
173
|
+
justify-content: center;
|
|
174
|
+
font-size: 12px;
|
|
175
|
+
font-weight: bold;
|
|
534
176
|
}
|
|
535
177
|
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
178
|
+
/* 登录按钮样式 */
|
|
179
|
+
.login-button {
|
|
180
|
+
padding: 8px 16px;
|
|
181
|
+
border: 1px solid;
|
|
182
|
+
border-radius: 4px;
|
|
183
|
+
cursor: pointer;
|
|
184
|
+
font-size: 14px;
|
|
185
|
+
transition: all 0.3s ease;
|
|
186
|
+
margin-left: 15px;
|
|
542
187
|
}
|
|
543
188
|
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
189
|
+
.login-button:hover {
|
|
190
|
+
opacity: 0.8;
|
|
191
|
+
}
|
|
192
|
+
`
|
|
193
|
+
|
|
194
|
+
// ==================== 环境和状态相关属性 ====================
|
|
195
|
+
|
|
196
|
+
/** 当前网站状态,基于域名的第一部分 */
|
|
197
|
+
status = window.location.hostname.split('.')[0]
|
|
198
|
+
|
|
199
|
+
/** 当前页面完整URL */
|
|
200
|
+
hostName = window.location.href
|
|
201
|
+
|
|
202
|
+
/** 是否为平台版本(www、192、online环境) */
|
|
203
|
+
isPlat =
|
|
204
|
+
this.status === 'www' || this.status === '192' || this.status === 'online'
|
|
205
|
+
|
|
206
|
+
/** 是否显示语言切换功能 */
|
|
207
|
+
isShowLang =
|
|
208
|
+
this.status === 'www' ||
|
|
209
|
+
this.status === 'nanozeo' ||
|
|
210
|
+
this.status === '192' ||
|
|
211
|
+
this.status === 'online'
|
|
212
|
+
|
|
213
|
+
// ==================== 数据相关属性 ====================
|
|
214
|
+
|
|
215
|
+
/** 从API获取的数据 */
|
|
216
|
+
data = []
|
|
217
|
+
|
|
218
|
+
/** 个性化配置JSON数据 */
|
|
219
|
+
personalizedConfigJson
|
|
220
|
+
|
|
221
|
+
/** 机构logo URL */
|
|
222
|
+
logo
|
|
223
|
+
|
|
224
|
+
/** 机构联系方式 */
|
|
225
|
+
orgContacts
|
|
226
|
+
|
|
227
|
+
/** 机构名称 */
|
|
228
|
+
name
|
|
229
|
+
|
|
230
|
+
/** 机构邮箱 */
|
|
231
|
+
email
|
|
232
|
+
|
|
233
|
+
/** 机构电话 */
|
|
234
|
+
phone
|
|
235
|
+
|
|
236
|
+
/** 机构地址 */
|
|
237
|
+
address
|
|
238
|
+
|
|
239
|
+
/** 关注链接 */
|
|
240
|
+
followUrl
|
|
241
|
+
|
|
242
|
+
/** 已开通的服务列表 */
|
|
243
|
+
alreadyServices
|
|
244
|
+
|
|
245
|
+
// ==================== 多语言相关属性 ====================
|
|
246
|
+
|
|
247
|
+
/** 当前语言 */
|
|
248
|
+
currentLanguage = 'zh_CN'
|
|
249
|
+
|
|
250
|
+
/** 简体中文语言包 */
|
|
251
|
+
zhCN = {
|
|
252
|
+
首页: '首页',
|
|
253
|
+
数据库: '数据库',
|
|
254
|
+
资料库: '资料库',
|
|
255
|
+
皮革LCA数据库: '皮革LCA数据库',
|
|
256
|
+
LCA大赛: 'LCA大赛',
|
|
257
|
+
专业培训: '专业培训',
|
|
258
|
+
联系我们: '联系我们',
|
|
259
|
+
标准库: '标准库',
|
|
260
|
+
核算模版: '核算模版',
|
|
261
|
+
'2025全生命周期创新大赛': '2025全生命周期创新大赛',
|
|
262
|
+
|
|
263
|
+
化工专题比赛: '2025首届中国化工产品碳足迹数据库大赛',
|
|
264
|
+
登录: '登录',
|
|
265
|
+
个人中心: '个人中心',
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/** 繁体中文语言包 */
|
|
269
|
+
zhTW = {
|
|
270
|
+
首页: '首頁',
|
|
271
|
+
数据库: '數據庫',
|
|
272
|
+
资料库: '資料庫',
|
|
273
|
+
皮革LCA数据库: '皮革LCA數據庫',
|
|
274
|
+
LCA大赛: 'LCA大賽',
|
|
275
|
+
专业培训: '專業培訓',
|
|
276
|
+
联系我们: '聯繫我們',
|
|
277
|
+
标准库: '標準庫',
|
|
278
|
+
核算模版: '核算模版',
|
|
279
|
+
'2025全生命周期创新大赛': '2025全生命週期創新大賽',
|
|
280
|
+
化工专题比赛: '2025首届中國化工產品碳足迹資料庫大賽',
|
|
281
|
+
登录: '登录',
|
|
282
|
+
个人中心: '个人中心',
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/** 英文语言包 */
|
|
286
|
+
enUS = {
|
|
287
|
+
首页: 'Home',
|
|
288
|
+
数据库: 'Database',
|
|
289
|
+
资料库: 'Database',
|
|
290
|
+
皮革LCA数据库: 'Leather LCA Database',
|
|
291
|
+
LCA大赛: 'LCA Competition',
|
|
292
|
+
专业培训: 'Professional Training',
|
|
293
|
+
联系我们: 'Contact Us',
|
|
294
|
+
标准库: 'Standard Library',
|
|
295
|
+
核算模版: 'Calculation Template',
|
|
296
|
+
'2025全生命周期创新大赛': '2025 Life Cycle Innovation Competition',
|
|
297
|
+
化工专题比赛:
|
|
298
|
+
'2025 First China Chemical Product Carbon Footprint Database Competition',
|
|
299
|
+
登录: 'Login',
|
|
300
|
+
个人中心: 'Personal Center',
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/** 当前使用的国际化对象 */
|
|
304
|
+
i18n = {}
|
|
305
|
+
|
|
306
|
+
/** 浏览器默认语言 */
|
|
307
|
+
createLang = navigator.language.replace('-', '_')
|
|
308
|
+
|
|
309
|
+
/** 用户选择的语言(优先从localStorage获取,否则使用浏览器语言) */
|
|
310
|
+
lang = window.localStorage.getItem('lang') || this.createLang
|
|
311
|
+
|
|
312
|
+
/** 登录状态检测 - 检查cookie中是否存在token */
|
|
313
|
+
isLoggedIn = !!cookies.get('token')
|
|
314
|
+
|
|
315
|
+
/** 消息数量(当前写死为1) */
|
|
316
|
+
messageCount = 1
|
|
317
|
+
|
|
318
|
+
connectedCallback() {
|
|
319
|
+
switch (this.lang) {
|
|
320
|
+
case 'zh':
|
|
321
|
+
this.currentLanguage = 'zh_CN'
|
|
322
|
+
this.i18n = this.zhCN
|
|
323
|
+
break
|
|
324
|
+
case 'zh_CN':
|
|
325
|
+
this.currentLanguage = 'zh_CN'
|
|
326
|
+
this.i18n = this.zhCN
|
|
327
|
+
break
|
|
328
|
+
case 'zh_TW':
|
|
329
|
+
this.currentLanguage = 'zh_TW'
|
|
330
|
+
this.i18n = this.zhTW
|
|
331
|
+
break
|
|
332
|
+
case 'en_US':
|
|
333
|
+
this.currentLanguage = 'en_US'
|
|
334
|
+
this.i18n = this.enUS
|
|
335
|
+
break
|
|
336
|
+
default:
|
|
337
|
+
this.currentLanguage = 'zh_CN'
|
|
338
|
+
this.i18n = this.zhCN
|
|
339
|
+
break
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
super.connectedCallback()
|
|
343
|
+
this.fetchData()
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
// @ts-ignore
|
|
347
|
+
async fetchData() {
|
|
348
|
+
try {
|
|
349
|
+
const response = await fetch(
|
|
350
|
+
'https://backsite.efootprint.net/Gpm/webLcaOrganization/GetOrganizationByDomain'
|
|
351
|
+
) // 替换为实际的 API 地址
|
|
352
|
+
const jsonData = await response.json()
|
|
353
|
+
let data = jsonData.data // 将获取到的数据保存到 data 属性中
|
|
354
|
+
if (data && data.personalizedConfigJson) {
|
|
355
|
+
this.personalizedConfigJson = JSON.parse(data.personalizedConfigJson)
|
|
356
|
+
}
|
|
357
|
+
// console.log('this.data.data.personalizedConfigJson', this.personalizedConfigJson)
|
|
358
|
+
this.logo =
|
|
359
|
+
this.personalizedConfigJson && this.personalizedConfigJson.logo
|
|
360
|
+
this.orgContacts =
|
|
361
|
+
this.personalizedConfigJson && this.personalizedConfigJson.orgContacts
|
|
362
|
+
this.name =
|
|
363
|
+
this.personalizedConfigJson &&
|
|
364
|
+
this.personalizedConfigJson.institution &&
|
|
365
|
+
this.personalizedConfigJson.institution.name
|
|
366
|
+
this.email =
|
|
367
|
+
this.personalizedConfigJson && this.personalizedConfigJson.orgEmail
|
|
368
|
+
this.phone =
|
|
369
|
+
this.personalizedConfigJson && this.personalizedConfigJson.orgPhone
|
|
370
|
+
this.address =
|
|
371
|
+
this.personalizedConfigJson && this.personalizedConfigJson.orgAddress
|
|
372
|
+
this.followUrl =
|
|
373
|
+
this.personalizedConfigJson && this.personalizedConfigJson.followUrl
|
|
374
|
+
this.alreadyServices = data.alreadyServices
|
|
375
|
+
setTimeout(() => this.requestUpdate())
|
|
376
|
+
// this.requestUpdate(); // 更新组件以触发重新渲染
|
|
377
|
+
} catch (error) {
|
|
378
|
+
// console.error('Error fetching data:', error);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
render() {
|
|
383
|
+
return html` <div
|
|
384
|
+
class="ike-web-header"
|
|
385
|
+
style="
|
|
386
|
+
background: ${this.isPlat
|
|
387
|
+
? '#063223'
|
|
388
|
+
: '#FFFFFF'}; color: ${this.isPlat ? '#fff' : '#063223'}"
|
|
389
|
+
>
|
|
390
|
+
<div style="display: flex;align-items: center">
|
|
391
|
+
<img
|
|
392
|
+
src="https://ike-web.oss-cn-hangzhou.aliyuncs.com/WebLCA_logo.png"
|
|
393
|
+
class="iwh-url"
|
|
394
|
+
alt=""
|
|
395
|
+
/>
|
|
396
|
+
${this.status !== 'www' && this.status !== '192'
|
|
397
|
+
? html` <div class="box-a" style="display: flex;align-items: center">
|
|
398
|
+
<img src="${this.logo}" alt="" />
|
|
399
|
+
<span
|
|
400
|
+
style="margin-left: 12px;color: #373737;font-weight: 600;color: ${this
|
|
401
|
+
.isPlat
|
|
402
|
+
? '#fff'
|
|
403
|
+
: '#063223'}"
|
|
404
|
+
>${this.name}</span
|
|
405
|
+
>
|
|
406
|
+
</div>`
|
|
407
|
+
: ''}
|
|
408
|
+
|
|
409
|
+
<!-- 左侧菜单项:eFootprint、CarbonZero、GPM -->
|
|
410
|
+
${this.isPlat
|
|
411
|
+
? html` <div class="left-menu-items">
|
|
412
|
+
${this.isPlat || this.alreadyServices.includes('eF')
|
|
413
|
+
? html` <div
|
|
414
|
+
class="left-menu-item"
|
|
415
|
+
style="color: ${this.hostName.includes(
|
|
416
|
+
'efootprint.net/login'
|
|
417
|
+
)
|
|
418
|
+
? '#06AA3E'
|
|
419
|
+
: this.isPlat
|
|
420
|
+
? '#fff'
|
|
421
|
+
: '#373737'}"
|
|
422
|
+
@click="${this._routerPush}"
|
|
423
|
+
data-url="https://www.efootprint.net"
|
|
424
|
+
data-login-url="https://www.efootprint.net/angular/weblca/ef/model/modelList"
|
|
425
|
+
>
|
|
426
|
+
eFootprint
|
|
427
|
+
</div>`
|
|
428
|
+
: ''}
|
|
429
|
+
${this.isPlat || this.alreadyServices.includes('scope')
|
|
430
|
+
? html` <div
|
|
431
|
+
class="left-menu-item"
|
|
432
|
+
style="color: ${this.hostName.includes('webcarbon.net')
|
|
433
|
+
? '#06AA3E'
|
|
434
|
+
: this.isPlat
|
|
435
|
+
? '#fff'
|
|
436
|
+
: '#373737'}"
|
|
437
|
+
@click="${this._routerPush}"
|
|
438
|
+
data-login-url="https://www.webcarbon.net/#/calculate/calculatCarbon"
|
|
439
|
+
data-url="https://www.webcarbon.net"
|
|
440
|
+
>
|
|
441
|
+
CarbonZero
|
|
442
|
+
</div>`
|
|
443
|
+
: ''}
|
|
444
|
+
${this.isPlat || this.alreadyServices.includes('GPM')
|
|
445
|
+
? html` <div
|
|
446
|
+
class="left-menu-item"
|
|
447
|
+
style="color: ${this.hostName.includes('webgpm.net')
|
|
448
|
+
? '#06AA3E'
|
|
449
|
+
: this.isPlat
|
|
450
|
+
? '#fff'
|
|
451
|
+
: '#373737'}"
|
|
452
|
+
@click="${this._routerPush}"
|
|
453
|
+
data-login-url="https://www.webgpm.net/#/dashboard/targetCenter"
|
|
454
|
+
data-url="https://www.webgpm.net"
|
|
455
|
+
>
|
|
456
|
+
GPM
|
|
457
|
+
</div>`
|
|
458
|
+
: ''}
|
|
459
|
+
</div>`
|
|
460
|
+
: ''}
|
|
461
|
+
</div>
|
|
462
|
+
|
|
463
|
+
<div class="iwh-right">
|
|
464
|
+
<div class="header-list flex align-center">
|
|
465
|
+
<div class="el-menu-demo">
|
|
466
|
+
<div
|
|
467
|
+
class="menu-item"
|
|
468
|
+
style="color: ${this.hostName.includes('weblca.net/home')
|
|
469
|
+
? '#06AA3E'
|
|
470
|
+
: this.isPlat
|
|
471
|
+
? '#fff'
|
|
472
|
+
: '#373737'}"
|
|
473
|
+
@click="${this._routerPush}"
|
|
474
|
+
data-login-url="https://www.weblca.net/home"
|
|
475
|
+
data-url="https://www.weblca.net/home"
|
|
476
|
+
>
|
|
477
|
+
${this.i18n['首页']}
|
|
478
|
+
</div>
|
|
479
|
+
|
|
480
|
+
<!-- 平台专属菜单项:标准库和核算模版 -->
|
|
481
|
+
${this.isPlat
|
|
482
|
+
? html` <div
|
|
483
|
+
class="menu-item"
|
|
484
|
+
style="color: ${this.isPlat ? '#fff' : '#373737'}"
|
|
485
|
+
@click="${this._routerPush}"
|
|
486
|
+
data-login-url="https://www.weblca.net/standard"
|
|
487
|
+
data-url="https://www.weblca.net/standard"
|
|
488
|
+
>
|
|
489
|
+
${this.i18n['标准库']}
|
|
490
|
+
</div>
|
|
491
|
+
<div
|
|
492
|
+
class="menu-item"
|
|
493
|
+
style="color: ${this.isPlat ? '#fff' : '#373737'}"
|
|
494
|
+
@click="${this._routerPush}"
|
|
495
|
+
data-login-url="https://www.weblca.net/template"
|
|
496
|
+
data-url="https://www.weblca.net/template"
|
|
497
|
+
>
|
|
498
|
+
${this.i18n['核算模版']}
|
|
499
|
+
</div>`
|
|
500
|
+
: ''}
|
|
501
|
+
${this.isPlat || this.alreadyServices.includes('database')
|
|
502
|
+
? html` <div
|
|
503
|
+
class="menu-item menu-item-database"
|
|
504
|
+
style=" position: relative;color: ${this.hostName.includes(
|
|
505
|
+
'weblca.net/database'
|
|
506
|
+
)
|
|
507
|
+
? '#06AA3E'
|
|
508
|
+
: this.isPlat
|
|
509
|
+
? '#fff'
|
|
510
|
+
: '#373737'}"
|
|
511
|
+
@click="${this._routerPush}"
|
|
512
|
+
data-login-urlurl="https://www.weblca.net/database"
|
|
513
|
+
data-url="https://www.weblca.net/database"
|
|
514
|
+
>
|
|
515
|
+
${this.isPlat
|
|
516
|
+
? html`<img
|
|
517
|
+
class="posi"
|
|
518
|
+
src="https://ike-web.oss-cn-hangzhou.aliyuncs.com/HOT.png"
|
|
519
|
+
alt=""
|
|
520
|
+
/>`
|
|
521
|
+
: ''}
|
|
522
|
+
${this.i18n['数据库']}
|
|
523
|
+
<div class="menu-sub-group">
|
|
524
|
+
<div
|
|
525
|
+
@click="${this._routerPush}"
|
|
526
|
+
data-login-url="https://www.weblca.net/database"
|
|
527
|
+
data-url="https://www.weblca.net/database"
|
|
528
|
+
class="menu-sub-item"
|
|
529
|
+
>
|
|
530
|
+
${this.i18n['数据库']}
|
|
531
|
+
</div>
|
|
532
|
+
<div
|
|
533
|
+
@click="${this._routerPush}"
|
|
534
|
+
data-login-url="https://www.weblca.net/database/leather"
|
|
535
|
+
data-url="https://www.weblca.net/database/leather"
|
|
536
|
+
class="menu-sub-item"
|
|
537
|
+
>
|
|
538
|
+
${this.i18n['皮革LCA数据库']}
|
|
539
|
+
</div>
|
|
540
|
+
</div>
|
|
541
|
+
</div>`
|
|
542
|
+
: ''}
|
|
543
|
+
${this.isPlat || this.alreadyServices.includes('databankpage')
|
|
544
|
+
? html` <div
|
|
545
|
+
class="menu-item"
|
|
546
|
+
style="color: ${this.hostName.includes('/databankpage')
|
|
547
|
+
? '#06AA3E'
|
|
548
|
+
: this.isPlat
|
|
549
|
+
? '#fff'
|
|
550
|
+
: '#373737'}"
|
|
551
|
+
@click="${this._routerPush}"
|
|
552
|
+
data-login-url="https://www.weblca.net/databankpage"
|
|
553
|
+
data-url="https://www.weblca.net/databankpage"
|
|
554
|
+
>
|
|
555
|
+
${this.i18n['资料库']}
|
|
556
|
+
</div>`
|
|
557
|
+
: ''}
|
|
558
|
+
${this.isPlat
|
|
559
|
+
? html` <div
|
|
560
|
+
class="menu-item menu-item-database"
|
|
561
|
+
style=" position: relative;color: ${this.hostName.includes(
|
|
562
|
+
'efootprint.net/contest'
|
|
563
|
+
)
|
|
564
|
+
? '#06AA3E'
|
|
565
|
+
: this.isPlat
|
|
566
|
+
? '#fff'
|
|
567
|
+
: '#373737'}"
|
|
568
|
+
>
|
|
569
|
+
${this.i18n['LCA大赛']}
|
|
570
|
+
<div class="menu-sub-group menu-sub-group-1">
|
|
571
|
+
<div
|
|
572
|
+
@click="${this._routerPush}"
|
|
573
|
+
data-login-url="https://www.weblca.net/contest"
|
|
574
|
+
data-url="https://www.weblca.net/contest"
|
|
575
|
+
class="menu-sub-item"
|
|
576
|
+
>
|
|
577
|
+
${this.i18n['2025全生命周期创新大赛']}
|
|
578
|
+
</div>
|
|
579
|
+
<div
|
|
580
|
+
@click="${this._routerPush}"
|
|
581
|
+
data-login-url="https://www.weblca.net/contest/cccd"
|
|
582
|
+
data-url="https://www.weblca.net/contest/cccd"
|
|
583
|
+
class="menu-sub-item"
|
|
584
|
+
>
|
|
585
|
+
${this.i18n['化工专题比赛']}
|
|
586
|
+
</div>
|
|
587
|
+
</div>
|
|
588
|
+
</div>`
|
|
589
|
+
: ''}
|
|
590
|
+
${this.isPlat
|
|
591
|
+
? html` <div
|
|
592
|
+
class="menu-item"
|
|
593
|
+
style="color: ${this.hostName.includes(
|
|
594
|
+
'efootprint.net/training'
|
|
595
|
+
)
|
|
596
|
+
? '#06AA3E'
|
|
597
|
+
: this.isPlat
|
|
598
|
+
? '#fff'
|
|
599
|
+
: '#373737'}"
|
|
600
|
+
@click="${this._routerPush}"
|
|
601
|
+
data-login-url="https://www.weblca.net/training"
|
|
602
|
+
data-url="https://www.weblca.net/training"
|
|
603
|
+
>
|
|
604
|
+
${this.i18n['专业培训']}
|
|
605
|
+
</div>`
|
|
606
|
+
: ''}
|
|
607
|
+
<div
|
|
608
|
+
class="menu-item"
|
|
609
|
+
style="color: ${this.isPlat ? '#fff' : '#373737'}"
|
|
610
|
+
@click="${this._scroll}"
|
|
611
|
+
data-login-url="#"
|
|
612
|
+
data-url="#"
|
|
613
|
+
>
|
|
614
|
+
${this.i18n['联系我们']}
|
|
615
|
+
</div>
|
|
616
|
+
|
|
617
|
+
${this.isShowLang
|
|
618
|
+
? html` <div
|
|
619
|
+
class="menu-item menu-item-database"
|
|
620
|
+
style=" position: relative;
|
|
621
|
+
text-align: center;
|
|
622
|
+
display: flex;
|
|
623
|
+
align-items: center;
|
|
624
|
+
color: ${this.hostName.includes(
|
|
625
|
+
'weblca.net/database'
|
|
626
|
+
)
|
|
627
|
+
? '#06AA3E'
|
|
628
|
+
: this.isPlat
|
|
629
|
+
? '#fff'
|
|
630
|
+
: '#373737'}"
|
|
631
|
+
>
|
|
632
|
+
${this.isPlat
|
|
633
|
+
? html`<img
|
|
634
|
+
src="http://ike-web.oss-cn-hangzhou.aliyuncs.com/language.png"
|
|
635
|
+
alt=""
|
|
636
|
+
/>`
|
|
637
|
+
: html`<img
|
|
638
|
+
src="http://ike-web.oss-cn-hangzhou.aliyuncs.com/language_block.png"
|
|
639
|
+
alt=""
|
|
640
|
+
/>`}
|
|
641
|
+
<div class="menu-sub-group">
|
|
642
|
+
<div
|
|
643
|
+
@click="${this._clickLang}"
|
|
644
|
+
data-lang="zh_CN"
|
|
645
|
+
class="menu-sub-item"
|
|
646
|
+
>
|
|
647
|
+
中文简体
|
|
648
|
+
</div>
|
|
649
|
+
<div
|
|
650
|
+
@click="${this._clickLang}"
|
|
651
|
+
data-lang="zh_TW"
|
|
652
|
+
class="menu-sub-item"
|
|
653
|
+
>
|
|
654
|
+
中文繁體
|
|
655
|
+
</div>
|
|
656
|
+
<div
|
|
657
|
+
@click="${this._clickLang}"
|
|
658
|
+
data-lang="en_US"
|
|
659
|
+
class="menu-sub-item"
|
|
660
|
+
>
|
|
661
|
+
English
|
|
662
|
+
</div>
|
|
663
|
+
</div>
|
|
664
|
+
</div>`
|
|
665
|
+
: ''}
|
|
666
|
+
|
|
667
|
+
<!-- 消息图标 - 仅在登录状态下显示 -->
|
|
668
|
+
${this.isLoggedIn
|
|
669
|
+
? html`
|
|
670
|
+
<div
|
|
671
|
+
@click="${this._routerPush}"
|
|
672
|
+
data-login-url="https://www.weblca.net/notification"
|
|
673
|
+
data-url="https://www.weblca.net/notification"
|
|
674
|
+
class="message-icon-container"
|
|
675
|
+
>
|
|
676
|
+
<img
|
|
677
|
+
src="https://ike-web.oss-cn-hangzhou.aliyuncs.com/message.png"
|
|
678
|
+
alt="消息"
|
|
679
|
+
class="message-icon"
|
|
680
|
+
/>
|
|
681
|
+
<div class="message-badge">${this.messageCount}</div>
|
|
682
|
+
</div>
|
|
683
|
+
`
|
|
684
|
+
: ''}
|
|
685
|
+
|
|
686
|
+
<!-- 登录/首页按钮 -->
|
|
687
|
+
${this.isPlat
|
|
688
|
+
? html` <div
|
|
689
|
+
class="login-button"
|
|
690
|
+
style="border-color: ${this.isPlat
|
|
691
|
+
? '#fff'
|
|
692
|
+
: '#373737'}; color: ${this.isPlat ? '#fff' : '#373737'}"
|
|
693
|
+
@click="${this._handleLoginClick}"
|
|
694
|
+
>
|
|
695
|
+
${this.isLoggedIn ? this.i18n['个人中心'] : this.i18n['登录']}
|
|
696
|
+
</div>`
|
|
697
|
+
: ''}
|
|
698
|
+
|
|
699
|
+
<!-- <div class="menu-item">-->
|
|
700
|
+
<!-- <el-icon style="cursor: pointer" size="28" color="#fff">-->
|
|
701
|
+
<!-- <UserFilled/>-->
|
|
702
|
+
<!-- </el-icon>-->
|
|
703
|
+
<!-- </div>-->
|
|
704
|
+
</div>
|
|
705
|
+
</div>
|
|
706
|
+
</div>
|
|
707
|
+
</div>`
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
_routerPush(e) {
|
|
711
|
+
e.stopPropagation()
|
|
712
|
+
// @ts-ignore
|
|
713
|
+
let to = e.currentTarget && e.currentTarget.getAttribute('data-url')
|
|
714
|
+
let loginUrl =
|
|
715
|
+
e.currentTarget && e.currentTarget.getAttribute('data-login-url')
|
|
716
|
+
|
|
717
|
+
// 根据登录状态选择跳转URL
|
|
718
|
+
if (loginUrl && this.isLoggedIn) {
|
|
719
|
+
to = loginUrl
|
|
720
|
+
}
|
|
721
|
+
//192,www ,以及 to之中包含online的都不需要替换
|
|
722
|
+
// @ts-ignore
|
|
723
|
+
if (
|
|
724
|
+
this.status !== '192' &&
|
|
725
|
+
this.status !== 'www' &&
|
|
726
|
+
this.status !== 'online' &&
|
|
727
|
+
!to.includes('online')
|
|
728
|
+
) {
|
|
729
|
+
to = to.replace('www', this.status)
|
|
730
|
+
}
|
|
731
|
+
window.location.href = to
|
|
732
|
+
window.parent.postMessage({ type: 'navigate', url: to }, '*')
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
_clickLang(e) {
|
|
736
|
+
e.stopPropagation()
|
|
737
|
+
// @ts-ignore
|
|
738
|
+
let lang = e.currentTarget && e.currentTarget.getAttribute('data-lang')
|
|
739
|
+
//192,www ,以及 to之中包含online的都不需要替换
|
|
740
|
+
// @ts-ignore
|
|
741
|
+
localStorage.setItem('lang', lang)
|
|
742
|
+
window.location.reload()
|
|
743
|
+
// window.parent.postMessage({type: 'navigate', url: to}, '*');
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
_scroll() {
|
|
747
|
+
let box = document.body
|
|
748
|
+
// console.log(box.clientHeight)
|
|
749
|
+
window.scrollTo({
|
|
750
|
+
top: document.documentElement.scrollHeight,
|
|
751
|
+
behavior: 'smooth',
|
|
752
|
+
})
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
_handleLoginClick() {
|
|
756
|
+
if (this.isLoggedIn) {
|
|
757
|
+
// 如果已登录,跳转到首页
|
|
758
|
+
window.location.href = 'https://www.weblca.net/selfCenter'
|
|
759
|
+
} else {
|
|
760
|
+
// 如果未登录,跳转到登录页面
|
|
761
|
+
window.location.href = 'https://www.weblca.net/login'
|
|
552
762
|
}
|
|
763
|
+
}
|
|
553
764
|
}
|
|
554
765
|
|
|
555
|
-
customElements.define('ike-web-header', IkeWebHeader)
|
|
766
|
+
customElements.define('ike-web-header', IkeWebHeader)
|