ike-weblca-html 1.0.7 → 1.0.9

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.
@@ -0,0 +1,21 @@
1
+ /*! js-cookie v3.0.5 | MIT */
2
+
3
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
4
+
5
+ /**
6
+ * @license
7
+ * Copyright 2017 Google LLC
8
+ * SPDX-License-Identifier: BSD-3-Clause
9
+ */
10
+
11
+ /**
12
+ * @license
13
+ * Copyright 2019 Google LLC
14
+ * SPDX-License-Identifier: BSD-3-Clause
15
+ */
16
+
17
+ /**
18
+ * @license
19
+ * Copyright 2021 Google LLC
20
+ * SPDX-License-Identifier: BSD-3-Clause
21
+ */
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "ike-weblca-html",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "weblca-html-header&footer",
5
- "main": "index.ts",
5
+ "main": "src/index.js",
6
6
  "scripts": {
7
+ "build": "webpack",
7
8
  "test": "echo \"Error: no test specified\" && exit 1"
8
9
  },
9
10
  "author": "yzp",
@@ -14,6 +15,14 @@
14
15
  "lit-element": "^3.3.2",
15
16
  "lit-html": "^2.7.5",
16
17
  "lodash-es": "^4.17.21",
17
- "npm": "^9.8.0"
18
+ "npm": "^9.8.0",
19
+ "js-cookie": "^3.0.1",
20
+ "webpack": "^5.88.2"
21
+ },
22
+ "devDependencies": {
23
+ "@babel/core": "^7.22.9",
24
+ "@babel/preset-env": "^7.22.9",
25
+ "babel-loader": "^9.1.3",
26
+ "webpack-cli": "^5.1.4"
18
27
  }
19
28
  }
@@ -11,7 +11,8 @@ export class IkeWebFooter extends LitElement {
11
11
  align-items: center;
12
12
  flex-direction: column;
13
13
  }
14
- .plate-footer-ent{
14
+
15
+ .plate-footer-ent {
15
16
  padding: 0;
16
17
  height: 327px;
17
18
  width: 100%;
@@ -28,13 +29,15 @@ export class IkeWebFooter extends LitElement {
28
29
  background: #03261A;
29
30
  line-height: 38px;
30
31
  }
31
- .footer-min{
32
+
33
+ .footer-min {
32
34
  width: 100%;
33
35
  height: 38px;
34
36
  text-align: center;
35
37
  background: #F3F3F3;
36
38
  line-height: 38px;
37
39
  }
40
+
38
41
  .footer-min span {
39
42
  height: 14px;
40
43
  font-size: 12px;
@@ -59,7 +62,8 @@ export class IkeWebFooter extends LitElement {
59
62
  background: url("http://ike-web.oss-cn-hangzhou.aliyuncs.com/bg.png");
60
63
 
61
64
  }
62
- .footer1-box-ent{
65
+
66
+ .footer1-box-ent {
63
67
  width: 100%;
64
68
  height: 289px;
65
69
  justify-content: space-around;
@@ -68,12 +72,12 @@ export class IkeWebFooter extends LitElement {
68
72
  display: flex;
69
73
  }
70
74
 
71
- .box-b-a,.box-b-a-ent {
75
+ .box-b-a, .box-b-a-ent {
72
76
  display: flex;
73
77
  align-items: center;
74
78
  }
75
79
 
76
- .box-b-a img,.box-b-a-ent img {
80
+ .box-b-a img, .box-b-a-ent img {
77
81
  width: 20px;
78
82
  height: 20px;
79
83
  margin-right: 10px;
@@ -88,6 +92,7 @@ export class IkeWebFooter extends LitElement {
88
92
  color: #c1c1c1;
89
93
  line-height: 20px;
90
94
  }
95
+
91
96
  .box-b-a-ent span {
92
97
  margin: 12px 0;
93
98
  height: 18px;
@@ -97,13 +102,14 @@ export class IkeWebFooter extends LitElement {
97
102
  color: #272727;
98
103
  line-height: 20px;
99
104
  }
100
- .box-b-b,.box-b-b-ent {
105
+
106
+ .box-b-b, .box-b-b-ent {
101
107
  display: flex;
102
108
  align-items: center;
103
109
  padding: 6px 0;
104
110
  }
105
111
 
106
- .box-b-b img,.box-b-b-ent img {
112
+ .box-b-b img, .box-b-b-ent img {
107
113
  width: 20px;
108
114
  height: 20px;
109
115
  margin-right: 10px;
@@ -117,7 +123,8 @@ export class IkeWebFooter extends LitElement {
117
123
  color: #c0c0c0;
118
124
  line-height: 20px;
119
125
  }
120
- box-b-b-ent span{
126
+
127
+ box-b-b-ent span {
121
128
  display: block;
122
129
  font-size: 14px;
123
130
  font-family: Microsoft YaHei;
@@ -125,6 +132,7 @@ export class IkeWebFooter extends LitElement {
125
132
  line-height: 20px;
126
133
  color: #272727 !important;
127
134
  }
135
+
128
136
  .box-c-b {
129
137
  height: 17px;
130
138
  font-size: 18px;
@@ -192,51 +200,12 @@ export class IkeWebFooter extends LitElement {
192
200
  }
193
201
  `;
194
202
  // @ts-ignore
195
- @property({type: String}) identification = window.location.hostname.split('.')[0]
196
-
197
- @property() data = []; // 创建用于存储 Ajax 数据的属性
198
- @property() personalizedConfigJson = {}; // 创建用于存储 Ajax 数据的属性
199
- private logo: any;
200
- static get properties(){
201
- return {
202
- logo: String,
203
- orgContacts: String,
204
- };
205
- }
206
- // 在 connectedCallback 中发起 Ajax 请求
207
- connectedCallback() {
208
-
209
- super.connectedCallback();
210
- this.fetchData();
211
- }
212
-
213
- async fetchData() {
214
- try {
215
- const response = await fetch('https://backsite.efootprint.net/Gpm/webLcaOrganization/GetOrganizationByDomain'); // 替换为实际的 API 地址
216
- const jsonData = await response.json();
217
- let data = jsonData.data; // 将获取到的数据保存到 data 属性中
218
- if(data?.personalizedConfigJson){
219
- this.personalizedConfigJson = JSON.parse(data.personalizedConfigJson);
220
- }
221
- console.log('this.data.data.personalizedConfigJson',this.personalizedConfigJson)
222
- this.logo = this.personalizedConfigJson?.logo;
223
- this.orgContacts = this.personalizedConfigJson?.orgContacts;
224
- this.name = this.personalizedConfigJson?.institution?.name;
225
- this.email = this.personalizedConfigJson?.orgEmail;
226
- this.phone = this.personalizedConfigJson?.orgPhone
227
- this.address = this.personalizedConfigJson?.orgAddress;
228
- this.followUrl = this.personalizedConfigJson?.followUrl;
229
-
230
- setTimeout(()=>this.requestUpdate(),1000)
231
-
232
- // this.requestUpdate(); // 更新组件以触发重新渲染
233
- } catch (error) {
234
- console.error('Error fetching data:', error);
235
- }
236
- }
237
-
203
+ identification = window.location.hostname.split('.')[0]
238
204
 
239
- @property() plat = html`
205
+ data = []; // 创建用于存储 Ajax 数据的属性
206
+ personalizedConfigJson = {}; // 创建用于存储 Ajax 数据的属性
207
+ logo = null;
208
+ plat = html`
240
209
  <div class="plate-footer" id="box-id">
241
210
  <div class="footer1-box flex">
242
211
  <div class="box-a">
@@ -278,55 +247,89 @@ export class IkeWebFooter extends LitElement {
278
247
  </span>
279
248
  </div>
280
249
  </div>`
250
+
251
+ // 在 connectedCallback 中发起 Ajax 请求
252
+ connectedCallback() {
253
+
254
+ super.connectedCallback();
255
+ this.fetchData();
256
+ }
257
+
258
+ async fetchData() {
259
+ try {
260
+ const response = await fetch('https://backsite.efootprint.net/Gpm/webLcaOrganization/GetOrganizationByDomain'); // 替换为实际的 API 地址
261
+ const jsonData = await response.json();
262
+ let data = jsonData.data; // 将获取到的数据保存到 data 属性中
263
+ if (data?.personalizedConfigJson) {
264
+ this.personalizedConfigJson = JSON.parse(data.personalizedConfigJson);
265
+ }
266
+ console.log('this.data.data.personalizedConfigJson', this.personalizedConfigJson)
267
+ this.logo = this.personalizedConfigJson?.logo;
268
+ this.orgContacts = this.personalizedConfigJson?.orgContacts;
269
+ this.name = this.personalizedConfigJson?.institution?.name;
270
+ this.email = this.personalizedConfigJson?.orgEmail;
271
+ this.phone = this.personalizedConfigJson?.orgPhone
272
+ this.address = this.personalizedConfigJson?.orgAddress;
273
+ this.followUrl = this.personalizedConfigJson?.followUrl;
274
+
275
+ setTimeout(() => this.requestUpdate(), 1000)
276
+
277
+ // this.requestUpdate(); // 更新组件以触发重新渲染
278
+ } catch (error) {
279
+ console.error('Error fetching data:', error);
280
+ }
281
+ }
282
+
281
283
  // @property() ent =
282
284
 
283
- protected render() {
284
- return html`${this.identification === 'www' ?
285
- this.plat
286
- :
287
- html` <div class="plate-footer-ent" id="box-id">
288
- <div class="footer1-box-ent flex">
289
- <div class="box-a" style="display: flex;align-items: center">
290
- <img src="${this.logo}" alt=""> <span style="margin-left: 12px;color: #373737;font-weight: 600">${this.name}</span>
291
- </div>
292
- <div class="flex flex-clon box-b">
293
- <div class="box-c-b"><span style="color: #272727;border-bottom: 3px solid #272727">联系我们</span></div>
294
- <div>
295
- <div class="box-b-a-ent">
296
- <img src="https://ike-web.oss-cn-hangzhou.aliyuncs.com/index_icon_people_normal.png" alt="">
297
- <span>${this.orgContacts}</span>
298
- </div>
299
- <div class=" box-b-b-ent">
300
- <img src="http://ike-web.oss-cn-hangzhou.aliyuncs.com/tel.png" alt="">
301
- <span>${this.phone}</span>
285
+ render() {
286
+ return html`${(this.identification === 'www' || this.identification === '192')? this.plat : html`
287
+ <div class="plate-footer-ent" id="box-id">
288
+ <div class="footer1-box-ent flex">
289
+ <div class="box-a" style="display: flex;align-items: center">
290
+ <img src="${this.logo}" alt=""> <span style="margin-left: 12px;color: #373737;font-weight: 600">${this.name}</span>
302
291
  </div>
303
- <div class=" box-b-b-ent">
304
- <img src="http://ike-web.oss-cn-hangzhou.aliyuncs.com/e-mail.png" alt="">
305
- <span>${this.email}</span>
292
+ <div class="flex flex-clon box-b">
293
+ <div class="box-c-b"><span
294
+ style="color: #272727;border-bottom: 3px solid #272727">联系我们</span></div>
295
+ <div>
296
+ <div class="box-b-a-ent">
297
+ <img src="https://ike-web.oss-cn-hangzhou.aliyuncs.com/index_icon_people_normal.png"
298
+ alt="">
299
+ <span>${this.orgContacts}</span>
300
+ </div>
301
+ <div class=" box-b-b-ent">
302
+ <img src="http://ike-web.oss-cn-hangzhou.aliyuncs.com/tel.png" alt="">
303
+ <span>${this.phone}</span>
304
+ </div>
305
+ <div class=" box-b-b-ent">
306
+ <img src="http://ike-web.oss-cn-hangzhou.aliyuncs.com/e-mail.png" alt="">
307
+ <span>${this.email}</span>
308
+ </div>
309
+ <div class=" box-b-b-ent">
310
+ <img src="https://ike-web.oss-cn-hangzhou.aliyuncs.com/index_icon_address_normal.png"
311
+ alt="">
312
+ <span>${this.address}</span>
313
+ </div>
314
+ </div>
306
315
  </div>
307
- <div class=" box-b-b-ent">
308
- <img src="https://ike-web.oss-cn-hangzhou.aliyuncs.com/index_icon_address_normal.png"
309
- alt="">
310
- <span>${this.address}</span>
316
+ <div class="box-c">
317
+ <div class="box-c-b"><span
318
+ style="color: #272727;border-bottom: 3px solid #272727">关注我们</span></div>
319
+ <div class="box-c-a flex flex-clon">
320
+ ${this.followUrl ? html`<img src="${this.followUrl}" alt="">` : html`<img
321
+ src="https://ike-web.oss-cn-hangzhou.aliyuncs.com/QR.png" alt="">`}
322
+
323
+ <span>WebLCA公众号</span>
324
+ </div>
311
325
  </div>
312
326
  </div>
313
- </div>
314
- <div class="box-c">
315
- <div class="box-c-b"><span style="color: #272727;border-bottom: 3px solid #272727">关注我们</span></div>
316
- <div class="box-c-a flex flex-clon">
317
- ${this.followUrl ? html`<img src="${this.followUrl}" alt="">` : html`<img src="https://ike-web.oss-cn-hangzhou.aliyuncs.com/QR.png" alt="">` }
318
-
319
- <span>WebLCA公众号</span>
320
- </div>
321
- </div>
322
- </div>
323
- <div class="footer-min-ent">
327
+ <div class="footer-min-ent">
324
328
  <span>
325
329
  © WebLCA开放平台 | 蜀ICP备08100730号-1 | 技术支持:亿科环境
326
330
  </span>
327
- </div>
328
- </div>`
329
- }`;
331
+ </div>
332
+ </div>`}`;
330
333
  }
331
334
  }
332
335
 
@@ -1,6 +1,10 @@
1
1
  import {css, html, LitElement} from 'lit-element';
2
2
  import {property} from "lodash-es";
3
3
 
4
+
5
+
6
+
7
+
4
8
  export class IkeWebHeader extends LitElement {
5
9
  static styles = css`
6
10
  .ike-web-header {
@@ -57,11 +61,10 @@ export class IkeWebHeader extends LitElement {
57
61
  align-items: center;
58
62
  }
59
63
  `;
60
- // @ts-ignore
61
- @property({type: String}) status = window.location.hostname.split('.')[0]
64
+ status = window.location.hostname.split('.')[0]
62
65
 
63
66
  // 在 connectedCallback 中发起 Ajax 请求
64
- @property({type: Array}) data = []
67
+ data = []
65
68
 
66
69
  connectedCallback() {
67
70
 
@@ -86,55 +89,56 @@ export class IkeWebHeader extends LitElement {
86
89
  }
87
90
  }
88
91
 
89
- protected render() {
92
+ render() {
90
93
  return html`
91
94
  <div class="ike-web-header"
92
- style="background: ${this.status === 'www' ? 'var(--ike-web-header-bg,#063223)' : 'var(--ike-web-header-bg,#FFFFFF)'}">
95
+ style="
96
+ background: ${(this.status === 'www' || this.status === '192') ? 'var(--ike-web-header-bg,#063223)' : 'var(--ike-web-header-bg,#FFFFFF)'}; color: ${(this.status === 'www' || this.status === '192') ? 'var(--ike-web-header-bg,#fff)' : 'var(--ike-web-header-bg,#063223)'}">
93
97
  <img src="https://ike-web.oss-cn-hangzhou.aliyuncs.com/WebLCA_logo.png" class="iwh-url" alt="">
94
98
 
95
99
  <div class="iwh-right">
96
100
  <div class="header-list flex align-center">
97
101
  <div class="el-menu-demo">
98
102
  <div class="menu-item"
99
- style="color: ${this.status === 'www' ? 'var(--ike-web-header-text-color,#fff)' : 'var(--ike-web-header-text-color,#373737)'}"
103
+ style="color: ${(this.status === 'www' || this.status === '192' )? 'var(--ike-web-header-text-color,#fff)' : 'var(--ike-web-header-text-color,#373737)'}"
100
104
  @click="${this._routerPush}" data-url="https://www.weblca.net/home">首页
101
105
  </div>
102
106
  <div class="menu-item "
103
- style=" position: relative;color: ${this.status === 'www' ? 'var(--ike-web-header-text-color,#fff)' : 'var(--ike-web-header-text-color,#373737)'}"
107
+ style=" position: relative;color: ${(this.status === 'www' || this.status === '192' )? 'var(--ike-web-header-text-color,#fff)' : 'var(--ike-web-header-text-color,#373737)'}"
104
108
  @click="${this._routerPush}" data-url="https://www.weblca.net/database">
105
- ${this.status === 'www' ? html`<img class="posi"
106
- src="https://ike-web.oss-cn-hangzhou.aliyuncs.com/HOT.png"
107
- alt="">` : ''}
109
+ ${(this.status === 'www' || this.status === '192' )? html`<img class="posi"
110
+ src="https://ike-web.oss-cn-hangzhou.aliyuncs.com/HOT.png"
111
+ alt="">` : ''}
108
112
  数据库
109
113
  </div>
110
114
  ${this.data.includes('ef') ? html`<div class="menu-item"
111
- style="color: ${this.status === 'www' ? 'var(--ike-web-header-text-color,#fff)' : 'var(--ike-web-header-text-color,#373737)'}"
115
+ style="color: ${(this.status === 'www' || this.status === '192' )? 'var(--ike-web-header-text-color,#fff)' : 'var(--ike-web-header-text-color,#373737)'}"
112
116
  @click="${this._routerPush}" data-url="https://www.efootprint.net">eFootprint
113
117
  </div>` : '' }
114
118
  ${this.data.includes('scope') ? html`<div class="menu-item"
115
- style="color: ${this.status === 'www' ? 'var(--ike-web-header-text-color,#fff)' : 'var(--ike-web-header-text-color,#373737)'}"
119
+ style="color: ${(this.status === 'www' || this.status === '192' )? 'var(--ike-web-header-text-color,#fff)' : 'var(--ike-web-header-text-color,#373737)'}"
116
120
  @click="${this._routerPush}" data-url="https://www.webcarbon.net">CarbonZero
117
121
  </div>` : ''}
118
122
  ${this.data.includes('GPM') ? html`<div class="menu-item"
119
- style="color: ${this.status === 'www' ? 'var(--ike-web-header-text-color,#fff)' : 'var(--ike-web-header-text-color,#373737)'}"
120
- v-if="status!=='tibd'" @click="${this._routerPush}" data-url="https://www.webgpm.net">
123
+ style="color: ${(this.status === 'www' || this.status === '192' )? 'var(--ike-web-header-text-color,#fff)' : 'var(--ike-web-header-text-color,#373737)'}"
124
+ v-if="status!=='tibd'" @click="${this._routerPush}" data-url="https://www.webgpm.net">
121
125
  GPM
122
126
  </div>` : ''}
123
127
  ${ ( this.status!=='tibd' && this.status!=='tqc') ? html`<div class="menu-item"
124
- style="color: ${this.status === 'www' ? 'var(--ike-web-header-text-color,#fff)' : 'var(--ike-web-header-text-color,#373737)'}"
128
+ style="color: ${(this.status === 'www' || this.status === '192' )? 'var(--ike-web-header-text-color,#fff)' : 'var(--ike-web-header-text-color,#373737)'}"
125
129
  v-if="status!=='tibd' && status!=='tqc'" @click="${this._routerPush}"
126
130
  data-url="https://online.efootprint.net/contest">
127
131
  LCA大赛
128
132
  </div>` : ''}
129
133
  ${ ( this.status!=='tibd' && this.status!=='tqc') ? html`<div class="menu-item"
130
- style="color: ${this.status === 'www' ? 'var(--ike-web-header-text-color,#fff)' : 'var(--ike-web-header-text-color,#373737)'}"
134
+ style="color: ${(this.status === 'www' || this.status === '192' )? 'var(--ike-web-header-text-color,#fff)' : 'var(--ike-web-header-text-color,#373737)'}"
131
135
  v-if="status!=='tibd' && status!=='tqc'" @click="${this._routerPush}"
132
136
  data-url="https://online.efootprint.net/training">
133
137
  专业培训
134
138
  </div>` : ''}
135
-
139
+
136
140
  <div class="menu-item"
137
- style="color: ${this.status === 'www' ? 'var(--ike-web-header-text-color,#fff)' : 'var(--ike-web-header-text-color,#373737)'}"
141
+ style="color: ${(this.status === 'www' || this.status === '192' )? 'var(--ike-web-header-text-color,#fff)' : 'var(--ike-web-header-text-color,#373737)'}"
138
142
  @click="${this._scroll}" data-url="#">联系我们
139
143
  </div>
140
144
  <div class="menu-item">
@@ -148,9 +152,9 @@ export class IkeWebHeader extends LitElement {
148
152
  </div>`;
149
153
  }
150
154
 
151
- private _routerPush(e: Event) {
155
+ _routerPush(e) {
152
156
  // @ts-ignore
153
- let to: string = e.currentTarget?.getAttribute('data-url');
157
+ let to = e.currentTarget?.getAttribute('data-url');
154
158
  //192,www ,以及 to之中包含online的都不需要替换
155
159
  // @ts-ignore
156
160
  if (this.status !== '192' && this.status !== 'www' && !to.includes('online')) {
@@ -159,7 +163,7 @@ export class IkeWebHeader extends LitElement {
159
163
  window.location.href = to
160
164
  }
161
165
 
162
- private _scroll() {
166
+ _scroll() {
163
167
  let box = document.body
164
168
  console.log(box.clientHeight)
165
169
  window.scrollTo({
package/src/index.js ADDED
@@ -0,0 +1,4 @@
1
+ import "./IkeWebHeader"
2
+ import "./IkeWebFooter"
3
+
4
+ export {UserAgreementModal} from "./js/UserAgreement"