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/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import './IkeWebHeader'
|
|
2
|
+
import './IkeWebFooter'
|
|
3
|
+
import './js/UserAgreement'
|
|
4
4
|
|
|
5
|
-
export {UserAgreementModal} from
|
|
5
|
+
export { UserAgreementModal } from './js/UserAgreement'
|
|
@@ -1,529 +0,0 @@
|
|
|
1
|
-
import {css, html, LitElement} from 'lit-element';
|
|
2
|
-
import {property} from "lodash-es";
|
|
3
|
-
import cookies from 'js-cookie';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* IkeWebHeader - Web LCA 网站头部组件
|
|
7
|
-
*
|
|
8
|
-
* 这是一个基于 LitElement 的 Web Components 组件,用于渲染网站的头部导航栏。
|
|
9
|
-
* 支持多语言切换、动态菜单显示、响应式设计等功能。
|
|
10
|
-
*
|
|
11
|
-
* 主要功能:
|
|
12
|
-
* - 多语言支持(简体中文、繁体中文、英文)
|
|
13
|
-
* - 根据域名动态显示不同的菜单项
|
|
14
|
-
* - 支持个性化配置(logo、机构名称等)
|
|
15
|
-
* - 响应式导航菜单
|
|
16
|
-
* - 平滑滚动到页面底部
|
|
17
|
-
* - 登录状态检测和相应的URL跳转逻辑
|
|
18
|
-
*/
|
|
19
|
-
export class IkeWebHeader extends LitElement {
|
|
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);
|
|
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
|
-
'化工专题比赛':'2025首届中国化工产品碳足迹数据库大赛',
|
|
258
|
-
'登录':'登录',
|
|
259
|
-
'个人中心':'个人中心',
|
|
260
|
-
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
/** 繁体中文语言包 */
|
|
264
|
-
zhTW = {
|
|
265
|
-
'首页':'首頁',
|
|
266
|
-
'数据库':'數據庫',
|
|
267
|
-
'资料库':'資料庫',
|
|
268
|
-
'皮革LCA数据库':'皮革LCA數據庫',
|
|
269
|
-
'LCA大赛':'LCA大賽',
|
|
270
|
-
'专业培训':'專業培訓',
|
|
271
|
-
'联系我们':'聯繫我們',
|
|
272
|
-
'标准库':'標準庫',
|
|
273
|
-
'核算模版':'核算模版',
|
|
274
|
-
'2025全生命周期创新大赛':'2025全生命週期創新大賽',
|
|
275
|
-
'化工专题比赛': '2025首届中國化工產品碳足迹資料庫大賽',
|
|
276
|
-
'登录':'登录',
|
|
277
|
-
'个人中心':'个人中心',
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
/** 英文语言包 */
|
|
281
|
-
enUS = {
|
|
282
|
-
'首页':'Home',
|
|
283
|
-
'数据库':'Database',
|
|
284
|
-
'资料库':'Database',
|
|
285
|
-
'皮革LCA数据库':'Leather LCA Database',
|
|
286
|
-
'LCA大赛':'LCA Competition',
|
|
287
|
-
'专业培训':'Professional Training',
|
|
288
|
-
'联系我们':'Contact Us',
|
|
289
|
-
'标准库':'Standard Library',
|
|
290
|
-
'核算模版':'Calculation Template',
|
|
291
|
-
'2025全生命周期创新大赛':'2025 Life Cycle Innovation Competition',
|
|
292
|
-
'化工专题比赛':'2025 First China Chemical Product Carbon Footprint Database Competition',
|
|
293
|
-
'登录':'Login',
|
|
294
|
-
'个人中心':'Personal Center',
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
/** 当前使用的国际化对象 */
|
|
298
|
-
i18n = {}
|
|
299
|
-
|
|
300
|
-
/** 浏览器默认语言 */
|
|
301
|
-
createLang = navigator.language.replace('-', '_')
|
|
302
|
-
|
|
303
|
-
/** 用户选择的语言(优先从localStorage获取,否则使用浏览器语言) */
|
|
304
|
-
lang = window.localStorage.getItem('lang') || this.createLang
|
|
305
|
-
|
|
306
|
-
/** 登录状态检测 - 检查cookie中是否存在token */
|
|
307
|
-
isLoggedIn = !!cookies.get('token')
|
|
308
|
-
|
|
309
|
-
/** 消息数量(当前写死为1) */
|
|
310
|
-
messageCount = 1
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
connectedCallback() {
|
|
315
|
-
switch(this.lang) {
|
|
316
|
-
case 'zh':
|
|
317
|
-
this.currentLanguage = 'zh_CN';
|
|
318
|
-
this.i18n = this.zhCN
|
|
319
|
-
break;
|
|
320
|
-
case 'zh_CN':
|
|
321
|
-
this.currentLanguage = 'zh_CN';
|
|
322
|
-
this.i18n = this.zhCN
|
|
323
|
-
break;
|
|
324
|
-
case 'zh_TW':
|
|
325
|
-
this.currentLanguage = 'zh_TW';
|
|
326
|
-
this.i18n = this.zhTW
|
|
327
|
-
break;
|
|
328
|
-
case 'en_US':
|
|
329
|
-
this.currentLanguage = 'en_US';
|
|
330
|
-
this.i18n= this.enUS
|
|
331
|
-
break;
|
|
332
|
-
default:
|
|
333
|
-
this.currentLanguage = 'zh_CN';
|
|
334
|
-
this.i18n = this.zhCN
|
|
335
|
-
break;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
super.connectedCallback();
|
|
339
|
-
this.fetchData();
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
// @ts-ignore
|
|
343
|
-
async fetchData() {
|
|
344
|
-
try {
|
|
345
|
-
const response = await fetch('https://backsite.efootprint.net/Gpm/webLcaOrganization/GetOrganizationByDomain'); // 替换为实际的 API 地址
|
|
346
|
-
const jsonData = await response.json();
|
|
347
|
-
let data = jsonData.data; // 将获取到的数据保存到 data 属性中
|
|
348
|
-
if (data && data.personalizedConfigJson) {
|
|
349
|
-
this.personalizedConfigJson = JSON.parse(data.personalizedConfigJson);
|
|
350
|
-
}
|
|
351
|
-
// console.log('this.data.data.personalizedConfigJson', this.personalizedConfigJson)
|
|
352
|
-
this.logo = this.personalizedConfigJson && this.personalizedConfigJson.logo;
|
|
353
|
-
this.orgContacts = this.personalizedConfigJson && this.personalizedConfigJson.orgContacts;
|
|
354
|
-
this.name = this.personalizedConfigJson && this.personalizedConfigJson.institution && this.personalizedConfigJson.institution.name;
|
|
355
|
-
this.email = this.personalizedConfigJson && this.personalizedConfigJson.orgEmail;
|
|
356
|
-
this.phone = this.personalizedConfigJson && this.personalizedConfigJson.orgPhone
|
|
357
|
-
this.address = this.personalizedConfigJson && this.personalizedConfigJson.orgAddress;
|
|
358
|
-
this.followUrl = this.personalizedConfigJson && this.personalizedConfigJson.followUrl;
|
|
359
|
-
this.alreadyServices = data.alreadyServices
|
|
360
|
-
setTimeout(() => this.requestUpdate())
|
|
361
|
-
// this.requestUpdate(); // 更新组件以触发重新渲染
|
|
362
|
-
} catch (error) {
|
|
363
|
-
// console.error('Error fetching data:', error);
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
render() {
|
|
368
|
-
return html`
|
|
369
|
-
<div class="ike-web-header"
|
|
370
|
-
style="
|
|
371
|
-
background: ${this.isPlat ? '#063223' : '#FFFFFF'}; color: ${this.isPlat ? '#fff' : '#063223'}">
|
|
372
|
-
<div style="display: flex;align-items: center">
|
|
373
|
-
<img src="https://ike-web.oss-cn-hangzhou.aliyuncs.com/WebLCA_logo.png" class="iwh-url" alt="">
|
|
374
|
-
${(this.status !== 'www' && this.status !== '192') ? html`
|
|
375
|
-
<div class="box-a" style="display: flex;align-items: center">
|
|
376
|
-
<img src="${this.logo}" alt=""> <span
|
|
377
|
-
style="margin-left: 12px;color: #373737;font-weight: 600;color: ${this.isPlat ? '#fff' : '#063223'}">${this.name}</span>
|
|
378
|
-
</div>` : ''}
|
|
379
|
-
|
|
380
|
-
<!-- 左侧菜单项:eFootprint、CarbonZero、GPM -->
|
|
381
|
-
${this.isPlat ? html`
|
|
382
|
-
<div class="left-menu-items">
|
|
383
|
-
${(this.isPlat || this.alreadyServices.includes('eF')) ? html`
|
|
384
|
-
<div class="left-menu-item"
|
|
385
|
-
style="color: ${this.hostName.includes('efootprint.net/login') ? '#06AA3E' : this.isPlat ? '#fff' : '#373737'}"
|
|
386
|
-
@click="${this._routerPush}" data-url="https://www.efootprint.net"
|
|
387
|
-
data-login-url="https://www.efootprint.net/angular/weblca/ef/model/modelList">eFootprint
|
|
388
|
-
</div>` : ''}
|
|
389
|
-
${(this.isPlat || this.alreadyServices.includes('scope')) ? html`
|
|
390
|
-
<div class="left-menu-item"
|
|
391
|
-
style="color: ${this.hostName.includes('webcarbon.net') ? '#06AA3E' : this.isPlat ? '#fff' : '#373737'}"
|
|
392
|
-
@click="${this._routerPush}" data-login-url="https://www.webcarbon.net/#/calculate/calculatCarbon" data-url="https://www.webcarbon.net">CarbonZero
|
|
393
|
-
</div>` : ''}
|
|
394
|
-
${(this.isPlat || this.alreadyServices.includes('GPM')) ? html`
|
|
395
|
-
<div class="left-menu-item"
|
|
396
|
-
style="color: ${this.hostName.includes('webgpm.net') ? '#06AA3E' : this.isPlat ? '#fff' : '#373737'}"
|
|
397
|
-
@click="${this._routerPush}" data-login-url="https://www.webgpm.net/#/dashboard/targetCenter" data-url="https://www.webgpm.net">GPM
|
|
398
|
-
</div>` : ''}
|
|
399
|
-
</div>` : ''}
|
|
400
|
-
</div>
|
|
401
|
-
|
|
402
|
-
<div class="iwh-right">
|
|
403
|
-
<div class="header-list flex align-center">
|
|
404
|
-
<div class="el-menu-demo">
|
|
405
|
-
<div class="menu-item"
|
|
406
|
-
style="color: ${ this.hostName.includes('weblca.net/home') ? '#06AA3E' : this.isPlat ? '#fff' : '#373737'}"
|
|
407
|
-
@click="${this._routerPush}" data-login-url="https://www.weblca.net/home" data-url="https://www.weblca.net/home"> ${this.i18n['首页'] }
|
|
408
|
-
</div>
|
|
409
|
-
|
|
410
|
-
<!-- 平台专属菜单项:标准库和核算模版 -->
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
${(this.isPlat || this.alreadyServices.includes('database')) ? html`
|
|
414
|
-
<div class="menu-item menu-item-database"
|
|
415
|
-
style=" position: relative;color: ${this.hostName.includes('weblca.net/database') ? '#06AA3E' : this.isPlat ? '#fff' : '#373737'}"
|
|
416
|
-
@click="${this._routerPush}" data-login-urlurl="https://www.weblca.net/database" data-url="https://www.weblca.net/database">
|
|
417
|
-
${(this.isPlat) ? html`<img class="posi"
|
|
418
|
-
src="https://ike-web.oss-cn-hangzhou.aliyuncs.com/HOT.png"
|
|
419
|
-
alt="">` : ''}
|
|
420
|
-
${this.i18n['数据库'] }
|
|
421
|
-
<div class="menu-sub-group">
|
|
422
|
-
<div @click="${this._routerPush}" data-login-url="https://www.weblca.net/database" data-url="https://www.weblca.net/database" class="menu-sub-item">${this.i18n['数据库'] }</div>
|
|
423
|
-
<div @click="${this._routerPush}" data-login-url="https://www.weblca.net/database/leather" data-url="https://www.weblca.net/database/leather" class="menu-sub-item">${this.i18n['皮革LCA数据库'] }</div>
|
|
424
|
-
</div>
|
|
425
|
-
</div>` : ''}
|
|
426
|
-
${(this.isPlat || this.alreadyServices.includes('databankpage')) ? html`
|
|
427
|
-
<div class="menu-item"
|
|
428
|
-
style="color: ${this.hostName.includes('/databankpage') ? '#06AA3E' : this.isPlat ? '#fff' : '#373737'}"
|
|
429
|
-
@click="${this._routerPush}" data-login-url="https://www.efootprint.net/databankpage" data-url="https://www.efootprint.net/databankpage">${this.i18n['资料库'] }
|
|
430
|
-
</div>` : ''}
|
|
431
|
-
${this.isPlat ? html`
|
|
432
|
-
<div class="menu-item menu-item-database"
|
|
433
|
-
style=" position: relative;color: ${this.hostName.includes('efootprint.net/contest') ? '#06AA3E' : this.isPlat ? '#fff' : '#373737'}"
|
|
434
|
-
>
|
|
435
|
-
${this.i18n['LCA大赛'] }
|
|
436
|
-
<div class="menu-sub-group menu-sub-group-1">
|
|
437
|
-
<div @click="${this._routerPush}" data-login-url="https://www.weblca.net/contest" data-url="https://www.weblca.net/contest" class="menu-sub-item">${this.i18n['2025全生命周期创新大赛'] }</div>
|
|
438
|
-
<div @click="${this._routerPush}" data-login-url="https://www.weblca.net/contest/cccd" data-url="https://www.weblca.net/contest/cccd" class="menu-sub-item">${this.i18n['化工专题比赛'] }</div>
|
|
439
|
-
</div>
|
|
440
|
-
</div>` : ''}
|
|
441
|
-
${this.isPlat ? html`
|
|
442
|
-
<div class="menu-item"
|
|
443
|
-
style="color: ${this.hostName.includes('efootprint.net/training') ? '#06AA3E' : this.isPlat ? '#fff' : '#373737'}"
|
|
444
|
-
@click="${this._routerPush}" data-login-url="https://www.weblca.net/training"
|
|
445
|
-
data-url="https://www.weblca.net/training">
|
|
446
|
-
${this.i18n['专业培训'] }
|
|
447
|
-
</div>` : ''}
|
|
448
|
-
<div class="menu-item"
|
|
449
|
-
style="color: ${this.isPlat ? '#fff' : '#373737'}"
|
|
450
|
-
@click="${this._scroll}" data-login-url="#" data-url="#"> ${this.i18n['联系我们'] }
|
|
451
|
-
</div>
|
|
452
|
-
|
|
453
|
-
${ this.isShowLang ? html`
|
|
454
|
-
<div class="menu-item menu-item-database"
|
|
455
|
-
style=" position: relative;
|
|
456
|
-
text-align: center;
|
|
457
|
-
display: flex;
|
|
458
|
-
align-items: center;
|
|
459
|
-
color: ${this.hostName.includes('weblca.net/database') ? '#06AA3E' : this.isPlat ? '#fff' : '#373737'}"
|
|
460
|
-
>
|
|
461
|
-
${ 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="">` }
|
|
462
|
-
<div class="menu-sub-group">
|
|
463
|
-
<div @click="${this._clickLang}" data-lang="zh_CN" class="menu-sub-item">中文简体</div>
|
|
464
|
-
<div @click="${this._clickLang}" data-lang="zh_TW" class="menu-sub-item">中文繁體</div>
|
|
465
|
-
<div @click="${this._clickLang}" data-lang="en_US" class="menu-sub-item">English</div>
|
|
466
|
-
</div>
|
|
467
|
-
</div>` : ''}
|
|
468
|
-
|
|
469
|
-
<!-- 消息图标 - 仅在登录状态下显示 -->
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
<!-- 登录/首页按钮 -->
|
|
473
|
-
|
|
474
|
-
</div>
|
|
475
|
-
</div>
|
|
476
|
-
</div>
|
|
477
|
-
</div>`;
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
_routerPush(e) {
|
|
481
|
-
e.stopPropagation()
|
|
482
|
-
// @ts-ignore
|
|
483
|
-
let to = e.currentTarget && e.currentTarget.getAttribute('data-url');
|
|
484
|
-
let loginUrl = e.currentTarget && e.currentTarget.getAttribute('data-login-url');
|
|
485
|
-
|
|
486
|
-
// 根据登录状态选择跳转URL
|
|
487
|
-
if (loginUrl && this.isLoggedIn) {
|
|
488
|
-
to = loginUrl;
|
|
489
|
-
}
|
|
490
|
-
//192,www ,以及 to之中包含online的都不需要替换
|
|
491
|
-
// @ts-ignore
|
|
492
|
-
if (this.status !== '192' && this.status !== 'www' && this.status !== 'online' && !to.includes('online')) {
|
|
493
|
-
to = to.replace('www', this.status)
|
|
494
|
-
}
|
|
495
|
-
window.location.href = to
|
|
496
|
-
window.parent.postMessage({type: 'navigate', url: to}, '*');
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
_clickLang(e) {
|
|
500
|
-
e.stopPropagation()
|
|
501
|
-
// @ts-ignore
|
|
502
|
-
let lang = e.currentTarget && e.currentTarget.getAttribute('data-lang');
|
|
503
|
-
//192,www ,以及 to之中包含online的都不需要替换
|
|
504
|
-
// @ts-ignore
|
|
505
|
-
localStorage.setItem('lang', lang)
|
|
506
|
-
window.location.reload()
|
|
507
|
-
// window.parent.postMessage({type: 'navigate', url: to}, '*');
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
_scroll() {
|
|
511
|
-
let box = document.body
|
|
512
|
-
// console.log(box.clientHeight)
|
|
513
|
-
window.scrollTo({
|
|
514
|
-
top:document.documentElement.scrollHeight, behavior: "smooth",
|
|
515
|
-
})
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
_handleLoginClick() {
|
|
519
|
-
if (this.isLoggedIn) {
|
|
520
|
-
// 如果已登录,跳转到首页
|
|
521
|
-
window.location.href = 'https://www.weblca.net/selfCenter';
|
|
522
|
-
} else {
|
|
523
|
-
// 如果未登录,跳转到登录页面
|
|
524
|
-
window.location.href = 'https://www.weblca.net/login';
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
customElements.define('ike-web-header', IkeWebHeader);
|