ike-weblca-html 1.0.3 → 1.0.4
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/IkeWebHeader.ts +117 -0
- package/package.json +5 -2
- package/MyComponent.ts +0 -20
package/IkeWebHeader.ts
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import {css, html, LitElement} from 'lit-element';
|
|
2
|
+
import {property} from "lodash-es";
|
|
3
|
+
|
|
4
|
+
export class IkeWebHeader extends LitElement {
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
@property({type: String}) status = window.location.hostname.split('.')[0]
|
|
7
|
+
protected render() {
|
|
8
|
+
return html`
|
|
9
|
+
<div class="ike-web-header">
|
|
10
|
+
<img src="https://ike-web.oss-cn-hangzhou.aliyuncs.com/WebLCA_logo.png" class="iwh-url" alt="">
|
|
11
|
+
<div class="iwh-right">
|
|
12
|
+
<div class="header-list flex align-center">
|
|
13
|
+
<div class="el-menu-demo">
|
|
14
|
+
<div class="menu-item" @click="${this._routerPush}" data-url="https://www.weblca.net/home">首页</div>
|
|
15
|
+
<div class="menu-item " style=" color: #06aa3e; position: relative;"
|
|
16
|
+
@click="${this._routerPush}" data-url="https://www.weblca.net/database">
|
|
17
|
+
<img class="posi" src="https://ike-web.oss-cn-hangzhou.aliyuncs.com/HOT.png" alt="">
|
|
18
|
+
数据库
|
|
19
|
+
</div>
|
|
20
|
+
<div class="menu-item" @click="${this._routerPush}" data-url="https://www.efootprint.net">eFootprint</div>
|
|
21
|
+
<div class="menu-item" @click="${this._routerPush}" data-url="https://www.webcarbon.net">CarbonZero</div>
|
|
22
|
+
<div class="menu-item" v-if="status!=='tibd'" @click="${this._routerPush}" data-url="https://www.webgpm.net">GPM</div>
|
|
23
|
+
<div class="menu-item" v-if="status!=='tibd' && status!=='tqc'" @click="${this._routerPush}" data-url="https://online.efootprint.net/contest">
|
|
24
|
+
LCA大赛
|
|
25
|
+
</div>
|
|
26
|
+
<div class="menu-item" v-if="status!=='tibd' && status!=='tqc'" @click="${this._routerPush}" data-url="https://online.efootprint.net/training">
|
|
27
|
+
专业培训
|
|
28
|
+
</div>
|
|
29
|
+
<div class="menu-item" @click="${this._scroll}" data-url="#">联系我们</div>
|
|
30
|
+
<div class="menu-item">
|
|
31
|
+
<el-icon style="cursor: pointer" size="28" color="#fff">
|
|
32
|
+
<UserFilled/>
|
|
33
|
+
</el-icon>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</div>`;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
private _routerPush(e:Event) {
|
|
42
|
+
let to:string = e.currentTarget?.getAttribute('data-url');
|
|
43
|
+
//192,www ,以及 to之中包含online的都不需要替换
|
|
44
|
+
// @ts-ignore
|
|
45
|
+
if (this.status !== '192' && this.status !== 'www' && !to.includes('online')) {
|
|
46
|
+
to = to.replace('www',this.status)
|
|
47
|
+
}
|
|
48
|
+
window.location.href = to
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
private _scroll(){
|
|
52
|
+
let box = document.body
|
|
53
|
+
console.log(box.clientHeight)
|
|
54
|
+
window.scrollTo({
|
|
55
|
+
top: box.clientHeight,
|
|
56
|
+
behavior: "smooth",
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
static styles = css`
|
|
61
|
+
.ike-web-header {
|
|
62
|
+
width: 100%;
|
|
63
|
+
box-sizing: border-box;
|
|
64
|
+
height: 72px;
|
|
65
|
+
display: flex;
|
|
66
|
+
padding: 0 72px;
|
|
67
|
+
background: var(--ike-web-header-bg,#063223);
|
|
68
|
+
align-items: center;
|
|
69
|
+
justify-content: space-between;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.iwh-url {
|
|
73
|
+
width: 255px;
|
|
74
|
+
height: 40px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.header-list {
|
|
78
|
+
color: #fff !important;
|
|
79
|
+
height: 72px;
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.menu-item:hover {
|
|
85
|
+
background: rgba(0, 162, 44, 0.1);
|
|
86
|
+
color: #fff;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.el-menu-demo {
|
|
90
|
+
display: flex;
|
|
91
|
+
align-items: center;
|
|
92
|
+
cursor: pointer;
|
|
93
|
+
color: #fff;
|
|
94
|
+
background: transparent;
|
|
95
|
+
border: none;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.posi {
|
|
99
|
+
position: absolute;
|
|
100
|
+
top: 20%;
|
|
101
|
+
left: 70%;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.menu-item {
|
|
105
|
+
padding: 0 10px;
|
|
106
|
+
font-size: 14px;
|
|
107
|
+
color: #fff;
|
|
108
|
+
height: 72px;
|
|
109
|
+
text-align: center;
|
|
110
|
+
margin-right: 50px;
|
|
111
|
+
display: flex;
|
|
112
|
+
align-items: center;
|
|
113
|
+
}
|
|
114
|
+
`;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
customElements.define('ike-web-header', IkeWebHeader);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ike-weblca-html",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "weblca-html-header&footer",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -9,8 +9,11 @@
|
|
|
9
9
|
"author": "yzp",
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"dependencies": {
|
|
12
|
+
"install": "^0.13.0",
|
|
12
13
|
"lit": "^2.7.6",
|
|
13
14
|
"lit-element": "^3.3.2",
|
|
14
|
-
"lit-html": "^2.7.5"
|
|
15
|
+
"lit-html": "^2.7.5",
|
|
16
|
+
"lodash-es": "^4.17.21",
|
|
17
|
+
"npm": "^9.8.0"
|
|
15
18
|
}
|
|
16
19
|
}
|
package/MyComponent.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { LitElement, html, css } from 'lit-element';
|
|
2
|
-
|
|
3
|
-
export class MyComponent extends LitElement {
|
|
4
|
-
static styles = css`
|
|
5
|
-
:host {
|
|
6
|
-
display: block;
|
|
7
|
-
padding: 16px;
|
|
8
|
-
background-color: #f1f1f1;
|
|
9
|
-
border-radius: 4px;
|
|
10
|
-
}
|
|
11
|
-
`;
|
|
12
|
-
|
|
13
|
-
render() {
|
|
14
|
-
return html`
|
|
15
|
-
<h1>Hello, Lit Element!</h1>
|
|
16
|
-
`;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
customElements.define('my-component', MyComponent);
|