ike-weblca-html 2.2.17 → 2.2.19

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.
@@ -1,6 +1,7 @@
1
1
  import { css, html, LitElement } from 'lit-element'
2
2
  import { property } from 'lodash-es'
3
3
  import cookies from 'js-cookie'
4
+ import { getResponseErrorMessage, REQUEST_ERROR_EVENT } from './js/requestError'
4
5
 
5
6
  /**
6
7
  * IkeWebHeader - Web LCA 网站头部组件
@@ -455,7 +456,7 @@ export class IkeWebHeader extends LitElement {
455
456
  首届CBPC供应商产品碳足迹管理能力大赛:
456
457
  '首届CBPC供应商产品碳足迹管理能力大赛',
457
458
  登录: '登录',
458
- 个人中心: '个人中心',
459
+ 个人主页: '个人主页',
459
460
  }
460
461
 
461
462
  /** 繁体中文语言包 */
@@ -474,7 +475,7 @@ export class IkeWebHeader extends LitElement {
474
475
  首届CBPC供应商产品碳足迹管理能力大赛:
475
476
  '首屆CBPC供應商產品碳足迹管理能力大賽',
476
477
  登录: '登录',
477
- 个人中心: '个人中心',
478
+ 个人主页: '个人主页',
478
479
  }
479
480
 
480
481
  /** 英文语言包 */
@@ -494,7 +495,7 @@ export class IkeWebHeader extends LitElement {
494
495
  首届CBPC供应商产品碳足迹管理能力大赛:
495
496
  'First CBPC Supplier Product Carbon Footprint Management Capability Competition',
496
497
  登录: 'Login',
497
- 个人中心: 'Personal Center',
498
+ 个人主页: 'Personal Center',
498
499
  }
499
500
 
500
501
  /** 当前使用的国际化对象 */
@@ -540,6 +541,8 @@ export class IkeWebHeader extends LitElement {
540
541
 
541
542
  _documentClickHandler = null
542
543
 
544
+ _requestErrorHandler = null
545
+
543
546
  /** 未读消息数量 */
544
547
  messageCount = 0
545
548
 
@@ -568,6 +571,14 @@ export class IkeWebHeader extends LitElement {
568
571
  }
569
572
 
570
573
  super.connectedCallback()
574
+ this._requestErrorHandler = (event) => {
575
+ const message =
576
+ (event.detail && event.detail.message) || '请求失败,请稍后重试'
577
+ if (this.permissionModalMessage !== message) {
578
+ this._showPermissionModal(message)
579
+ }
580
+ }
581
+ window.addEventListener(REQUEST_ERROR_EVENT, this._requestErrorHandler)
571
582
  this.fetchData()
572
583
  if (this.isLoggedIn) {
573
584
  this.fetchUserSummary()
@@ -581,6 +592,9 @@ export class IkeWebHeader extends LitElement {
581
592
  if (this._documentClickHandler) {
582
593
  document.removeEventListener('click', this._documentClickHandler)
583
594
  }
595
+ if (this._requestErrorHandler) {
596
+ window.removeEventListener(REQUEST_ERROR_EVENT, this._requestErrorHandler)
597
+ }
584
598
  super.disconnectedCallback()
585
599
  }
586
600
 
@@ -589,6 +603,9 @@ export class IkeWebHeader extends LitElement {
589
603
  try {
590
604
  const response = await fetch(this._getOrganizationByDomainUrl())
591
605
  const jsonData = await response.json()
606
+ if (this._hasResponseError(response, jsonData, '获取机构配置失败')) {
607
+ return
608
+ }
592
609
  let data = jsonData.data // 将获取到的数据保存到 data 属性中
593
610
  if (data && data.personalizedConfigJson) {
594
611
  this.personalizedConfigJson = JSON.parse(data.personalizedConfigJson)
@@ -614,10 +631,17 @@ export class IkeWebHeader extends LitElement {
614
631
  setTimeout(() => this.requestUpdate())
615
632
  // this.requestUpdate(); // 更新组件以触发重新渲染
616
633
  } catch (error) {
617
- // console.error('Error fetching data:', error);
634
+ this._showPermissionModal('获取机构配置失败')
618
635
  }
619
636
  }
620
637
 
638
+ _hasResponseError(response, payload, fallbackMessage) {
639
+ const message = getResponseErrorMessage(response, payload, fallbackMessage)
640
+ if (!message) return false
641
+ this._showPermissionModal(message)
642
+ return true
643
+ }
644
+
621
645
  _getUserSummaryUrl() {
622
646
  return this._isLocalEnvironment()
623
647
  ? 'http://192.168.10.30:41000/ef_weblca/User/GetUserSummaryByHomePage'
@@ -767,11 +791,7 @@ export class IkeWebHeader extends LitElement {
767
791
  return
768
792
  }
769
793
  const res = await response.json()
770
- const code = res.Code || res.code
771
- if (Number(code) !== 200) {
772
- this._showPermissionModal(
773
- res.Message || res.message || '无对应系统权限'
774
- )
794
+ if (this._hasResponseError(response, res, '无对应系统权限')) {
775
795
  return
776
796
  }
777
797
  } catch (err) {
@@ -795,6 +815,9 @@ export class IkeWebHeader extends LitElement {
795
815
  })
796
816
 
797
817
  const res = await response.json()
818
+ if (this._hasResponseError(response, res, '跨系统跳转失败')) {
819
+ return
820
+ }
798
821
  if (res.success && res.data) {
799
822
  const { sc, timestamp, sign } = res.data
800
823
  // 拼接参数
@@ -803,12 +826,13 @@ export class IkeWebHeader extends LitElement {
803
826
 
804
827
  window.location.href = finalUrl
805
828
  } else {
806
- // 接口调用失败,降级处理
807
- window.location.href = loginUrl
829
+ this._showPermissionModal(
830
+ res.Message || res.message || '跨系统跳转失败'
831
+ )
808
832
  }
809
833
  } catch (err) {
810
834
  console.error('Error during service jump:', err)
811
- window.location.href = loginUrl
835
+ this._showPermissionModal('跨系统跳转失败')
812
836
  }
813
837
  }
814
838
 
@@ -857,14 +881,19 @@ export class IkeWebHeader extends LitElement {
857
881
  try {
858
882
  if (window.caches) {
859
883
  const cacheNames = await window.caches.keys()
860
- await Promise.all(cacheNames.map((cacheName) => window.caches.delete(cacheName)))
884
+ await Promise.all(
885
+ cacheNames.map((cacheName) => window.caches.delete(cacheName))
886
+ )
861
887
  }
862
888
  } catch (error) {
863
889
  console.error('Error clearing Cache Storage:', error)
864
890
  }
865
891
 
866
892
  try {
867
- if (window.indexedDB && typeof window.indexedDB.databases === 'function') {
893
+ if (
894
+ window.indexedDB &&
895
+ typeof window.indexedDB.databases === 'function'
896
+ ) {
868
897
  const databases = await window.indexedDB.databases()
869
898
  await Promise.all(
870
899
  databases
@@ -873,7 +902,10 @@ export class IkeWebHeader extends LitElement {
873
902
  (database) =>
874
903
  new Promise((resolve) => {
875
904
  const request = window.indexedDB.deleteDatabase(database.name)
876
- request.onsuccess = request.onerror = request.onblocked = resolve
905
+ request.onsuccess =
906
+ request.onerror =
907
+ request.onblocked =
908
+ resolve
877
909
  })
878
910
  )
879
911
  )
@@ -894,6 +926,9 @@ export class IkeWebHeader extends LitElement {
894
926
  },
895
927
  })
896
928
  const jsonData = await response.json()
929
+ if (this._hasResponseError(response, jsonData, '获取用户信息失败')) {
930
+ return
931
+ }
897
932
  const data =
898
933
  jsonData &&
899
934
  (jsonData.data || jsonData.result || jsonData.user || jsonData)
@@ -922,7 +957,7 @@ export class IkeWebHeader extends LitElement {
922
957
  }
923
958
  setTimeout(() => this.requestUpdate())
924
959
  } catch (error) {
925
- // console.error('Error fetching user summary:', error)
960
+ this._showPermissionModal('获取用户信息失败')
926
961
  }
927
962
  }
928
963
 
@@ -935,14 +970,16 @@ export class IkeWebHeader extends LitElement {
935
970
 
936
971
  try {
937
972
  const response = await fetch(this._getUnreadMessageCountUrl(), {
938
- method: 'GET',
973
+ method: 'POST',
939
974
  headers: {
940
975
  Authorization: token,
941
976
  },
942
977
  })
943
- if (!response.ok) throw new Error('Failed to fetch unread message count')
944
-
945
978
  const jsonData = await response.json()
979
+ if (this._hasResponseError(response, jsonData, '获取未读消息失败')) {
980
+ this.messageCount = 0
981
+ return
982
+ }
946
983
  const data = jsonData?.data ?? jsonData?.result ?? jsonData
947
984
  const count =
948
985
  typeof data === 'object'
@@ -952,6 +989,7 @@ export class IkeWebHeader extends LitElement {
952
989
  this.messageCount = Math.max(0, Number(count) || 0)
953
990
  } catch (error) {
954
991
  this.messageCount = 0
992
+ this._showPermissionModal('获取未读消息失败')
955
993
  }
956
994
 
957
995
  this.requestUpdate()
@@ -995,318 +1033,321 @@ export class IkeWebHeader extends LitElement {
995
1033
 
996
1034
  render() {
997
1035
  return html` <div
998
- class="ike-web-header"
999
- style="
1036
+ class="ike-web-header"
1037
+ style="
1000
1038
  background: ${this.isPlat
1001
- ? '#063223'
1002
- : '#FFFFFF'}; color: ${this.isPlat ? '#fff' : '#063223'}"
1003
- >
1004
- <div style="display: flex;align-items: center">
1005
- <img
1006
- src="https://ike-web.oss-cn-hangzhou.aliyuncs.com/WebLCA_logo.png"
1007
- class="iwh-url"
1008
- alt=""
1009
- />
1010
- ${this.status !== 'www' || this.isLocalSecondaryPreview
1011
- ? html` <div class="box-a" style="display: flex;align-items: center">
1012
- <img src="${this.logo}" alt="" />
1013
- <span
1014
- style="margin-left: 12px;color: #373737;font-weight: 600;color: ${this
1015
- .isPlat
1016
- ? '#fff'
1017
- : '#063223'}"
1018
- >${this.name}</span
1039
+ ? '#063223'
1040
+ : '#FFFFFF'}; color: ${this.isPlat ? '#fff' : '#063223'}"
1041
+ >
1042
+ <div style="display: flex;align-items: center">
1043
+ <img
1044
+ src="https://ike-web.oss-cn-hangzhou.aliyuncs.com/WebLCA_logo.png"
1045
+ class="iwh-url"
1046
+ alt=""
1047
+ />
1048
+ ${this.status !== 'www' || this.isLocalSecondaryPreview
1049
+ ? html` <div
1050
+ class="box-a"
1051
+ style="display: flex;align-items: center"
1019
1052
  >
1020
- </div>`
1021
- : ''}
1022
-
1023
- <!-- 左侧菜单项:eFootprint、CarbonZero、GPM ---- 111111 -->
1024
- ${html` <div class="left-menu-items">
1025
- ${html` <div
1026
- class="left-menu-item"
1027
- style="color: ${this.hostName.includes('efootprint.net/login')
1028
- ? '#06AA3E'
1029
- : this.isPlat
1030
- ? '#fff'
1031
- : '#373737'}"
1032
- @click="${this._handleServiceClick}"
1033
- data-url="${this._getServiceLoginUrl()}"
1034
- data-login-url="${this._getServiceTargetUrl('eFootprint')}"
1035
- data-service="ef"
1036
- >
1037
- eFootprint
1038
- </div>`}
1039
- ${html` <div
1040
- class="left-menu-item"
1041
- style="color: ${this.hostName.includes('webcarbon.net')
1042
- ? '#06AA3E'
1043
- : this.isPlat
1044
- ? '#fff'
1045
- : '#373737'}"
1046
- @click="${this._handleServiceClick}"
1047
- data-login-url="${this._getServiceTargetUrl('carbonZero')}"
1048
- data-url="${this._getServiceLoginUrl()}"
1049
- data-service="cz"
1050
- >
1051
- CarbonZero
1052
- </div>`}
1053
- ${html` <div
1054
- class="left-menu-item"
1055
- style="color: ${this.hostName.includes('webgpm.net')
1056
- ? '#06AA3E'
1057
- : this.isPlat
1058
- ? '#fff'
1059
- : '#373737'}"
1060
- @click="${this._handleServiceClick}"
1061
- data-login-url="${this._getServiceTargetUrl('gpm')}"
1062
- data-url="${this._getServiceLoginUrl()}"
1063
- data-service="gpm"
1064
- >
1065
- GPM
1066
- </div>`}
1067
- </div>`}
1068
- </div>
1069
-
1070
- <div class="iwh-right">
1071
- <div class="header-list flex align-center">
1072
- <div class="el-menu-demo">
1073
- <div
1074
- class="menu-item"
1075
- style="color: ${this.hostName.includes('weblca.net/home')
1053
+ <img src="${this.logo}" alt="" />
1054
+ <span
1055
+ style="margin-left: 12px;color: #373737;font-weight: 600;color: ${this
1056
+ .isPlat
1057
+ ? '#fff'
1058
+ : '#063223'}"
1059
+ >${this.name}</span
1060
+ >
1061
+ </div>`
1062
+ : ''}
1063
+
1064
+ <!-- 左侧菜单项:eFootprint、CarbonZero、GPM ---- 111111 -->
1065
+ ${html` <div class="left-menu-items">
1066
+ ${html` <div
1067
+ class="left-menu-item"
1068
+ style="color: ${this.hostName.includes('efootprint.net/login')
1076
1069
  ? '#06AA3E'
1077
1070
  : this.isPlat
1078
1071
  ? '#fff'
1079
1072
  : '#373737'}"
1080
- @click="${this._routerPush}"
1081
- data-login-url="${this._getHomeUrl()}"
1082
- data-url="${this._getHomeUrl()}"
1073
+ @click="${this._handleServiceClick}"
1074
+ data-url="${this._getServiceLoginUrl()}"
1075
+ data-login-url="${this._getServiceTargetUrl('eFootprint')}"
1076
+ data-service="ef"
1083
1077
  >
1084
- ${this.i18n['首页']}
1085
- </div>
1078
+ eFootprint
1079
+ </div>`}
1080
+ ${html` <div
1081
+ class="left-menu-item"
1082
+ style="color: ${this.hostName.includes('webcarbon.net')
1083
+ ? '#06AA3E'
1084
+ : this.isPlat
1085
+ ? '#fff'
1086
+ : '#373737'}"
1087
+ @click="${this._handleServiceClick}"
1088
+ data-login-url="${this._getServiceTargetUrl('carbonZero')}"
1089
+ data-url="${this._getServiceLoginUrl()}"
1090
+ data-service="cz"
1091
+ >
1092
+ CarbonZero
1093
+ </div>`}
1094
+ ${html` <div
1095
+ class="left-menu-item"
1096
+ style="color: ${this.hostName.includes('webgpm.net')
1097
+ ? '#06AA3E'
1098
+ : this.isPlat
1099
+ ? '#fff'
1100
+ : '#373737'}"
1101
+ @click="${this._handleServiceClick}"
1102
+ data-login-url="${this._getServiceTargetUrl('gpm')}"
1103
+ data-url="${this._getServiceLoginUrl()}"
1104
+ data-service="gpm"
1105
+ >
1106
+ GPM
1107
+ </div>`}
1108
+ </div>`}
1109
+ </div>
1086
1110
 
1087
- <!-- 平台专属菜单项:标准库和核算模板 -->
1088
- ${this.isPlat && false
1089
- ? html` <div
1090
- class="menu-item"
1091
- style="color: ${this.isPlat ? '#fff' : '#373737'}"
1092
- @click="${this._routerPush}"
1093
- data-login-url="https://www.weblca.net/standard"
1094
- data-url="https://www.weblca.net/standard"
1095
- >
1096
- ${this.i18n['标准库']}
1097
- </div>
1098
- <div
1099
- class="menu-item"
1100
- style="color: ${this.isPlat ? '#fff' : '#373737'}"
1101
- @click="${this._routerPush}"
1102
- data-login-url="https://www.weblca.net/template"
1103
- data-url="https://www.weblca.net/template"
1104
- >
1105
- ${this.i18n['核算模版']}
1106
- </div>`
1107
- : ''}
1108
- ${this.isPlat || this.alreadyServices.includes('database')
1109
- ? html` <div
1110
- class="menu-item menu-item-database"
1111
- style=" position: relative;color: ${this.hostName.includes(
1112
- 'weblca.net/database'
1113
- )
1114
- ? '#06AA3E'
1115
- : this.isPlat
1116
- ? '#fff'
1117
- : '#373737'}"
1118
- @click="${this._routerPush}"
1119
- data-login-urlurl="https://www.weblca.net/database"
1120
- data-url="https://www.weblca.net/database"
1121
- >
1122
- ${this.isPlat
1123
- ? html`<img
1124
- class="posi"
1125
- src="https://ike-web.oss-cn-hangzhou.aliyuncs.com/HOT.png"
1126
- alt=""
1127
- />`
1128
- : ''}
1129
- ${this.i18n['数据库']}
1130
- <div class="menu-sub-group">
1131
- <div
1132
- @click="${this._routerPush}"
1133
- data-login-url="https://www.weblca.net/database"
1134
- data-url="https://www.weblca.net/database"
1135
- class="menu-sub-item"
1136
- >
1137
- ${this.i18n['数据库']}
1138
- </div>
1139
- <div
1140
- @click="${this._routerPush}"
1141
- data-login-url="https://www.weblca.net/database/leather"
1142
- data-url="https://www.weblca.net/database/leather"
1143
- class="menu-sub-item"
1144
- >
1145
- ${this.i18n['皮革LCA数据库']}
1146
- </div>
1147
- </div>
1148
- </div>`
1149
- : ''}
1150
- ${this.isPlat || this.alreadyServices.includes('databankpage')
1151
- ? html` <div
1152
- class="menu-item"
1153
- style="color: ${this.hostName.includes('/databankpage')
1154
- ? '#06AA3E'
1155
- : this.isPlat
1156
- ? '#fff'
1157
- : '#373737'}"
1158
- @click="${this._routerPush}"
1159
- data-login-url="https://www.weblca.net/databankpage"
1160
- data-url="https://www.weblca.net/databankpage"
1161
- >
1162
- ${this.i18n['资料库']}
1163
- </div>`
1164
- : ''}
1165
- ${this.isPlat
1166
- ? html` <div
1167
- class="menu-item menu-item-database"
1168
- style=" position: relative;color: ${this.hostName.includes(
1169
- 'efootprint.net/contest'
1170
- )
1171
- ? '#06AA3E'
1172
- : this.isPlat
1173
- ? '#fff'
1174
- : '#373737'}"
1175
- >
1176
- ${this.i18n['LCA大赛']}
1177
- <div class="menu-sub-group menu-sub-group-1">
1178
- <div
1111
+ <div class="iwh-right">
1112
+ <div class="header-list flex align-center">
1113
+ <div class="el-menu-demo">
1114
+ <div
1115
+ class="menu-item"
1116
+ style="color: ${this.hostName.includes('weblca.net/home')
1117
+ ? '#06AA3E'
1118
+ : this.isPlat
1119
+ ? '#fff'
1120
+ : '#373737'}"
1121
+ @click="${this._routerPush}"
1122
+ data-login-url="${this._getHomeUrl()}"
1123
+ data-url="${this._getHomeUrl()}"
1124
+ >
1125
+ ${this.i18n['首页']}
1126
+ </div>
1127
+
1128
+ <!-- 平台专属菜单项:标准库和核算模板 -->
1129
+ ${this.isPlat && false
1130
+ ? html` <div
1131
+ class="menu-item"
1132
+ style="color: ${this.isPlat ? '#fff' : '#373737'}"
1179
1133
  @click="${this._routerPush}"
1180
- data-login-url="https://www.weblca.net/contest"
1181
- data-url="https://www.weblca.net/contest"
1182
- class="menu-sub-item"
1134
+ data-login-url="https://www.weblca.net/standard"
1135
+ data-url="https://www.weblca.net/standard"
1183
1136
  >
1184
- ${this.i18n['2025全生命周期创新大赛']}
1137
+ ${this.i18n['标准库']}
1185
1138
  </div>
1186
1139
  <div
1140
+ class="menu-item"
1141
+ style="color: ${this.isPlat ? '#fff' : '#373737'}"
1187
1142
  @click="${this._routerPush}"
1188
- data-login-url="https://www.weblca.net/contest/cccd"
1189
- data-url="https://www.weblca.net/contest/cccd"
1190
- class="menu-sub-item"
1143
+ data-login-url="https://www.weblca.net/template"
1144
+ data-url="https://www.weblca.net/template"
1191
1145
  >
1192
- ${this.i18n['化工专题比赛']}
1146
+ ${this.i18n['核算模版']}
1147
+ </div>`
1148
+ : ''}
1149
+ ${this.isPlat || this.alreadyServices.includes('database')
1150
+ ? html` <div
1151
+ class="menu-item menu-item-database"
1152
+ style=" position: relative;color: ${this.hostName.includes(
1153
+ 'weblca.net/database'
1154
+ )
1155
+ ? '#06AA3E'
1156
+ : this.isPlat
1157
+ ? '#fff'
1158
+ : '#373737'}"
1159
+ @click="${this._routerPush}"
1160
+ data-login-urlurl="https://www.weblca.net/database"
1161
+ data-url="https://www.weblca.net/database"
1162
+ >
1163
+ ${this.isPlat
1164
+ ? html`<img
1165
+ class="posi"
1166
+ src="https://ike-web.oss-cn-hangzhou.aliyuncs.com/HOT.png"
1167
+ alt=""
1168
+ />`
1169
+ : ''}
1170
+ ${this.i18n['数据库']}
1171
+ <div class="menu-sub-group">
1172
+ <div
1173
+ @click="${this._routerPush}"
1174
+ data-login-url="https://www.weblca.net/database"
1175
+ data-url="https://www.weblca.net/database"
1176
+ class="menu-sub-item"
1177
+ >
1178
+ ${this.i18n['数据库']}
1179
+ </div>
1180
+ <div
1181
+ @click="${this._routerPush}"
1182
+ data-login-url="https://www.weblca.net/database/leather"
1183
+ data-url="https://www.weblca.net/database/leather"
1184
+ class="menu-sub-item"
1185
+ >
1186
+ ${this.i18n['皮革LCA数据库']}
1187
+ </div>
1193
1188
  </div>
1194
- <div
1195
- @click="${this._routerPush}"
1196
- data-login-url="https://www.weblca.net/contest/cbpc"
1197
- data-url="https://www.weblca.net/contest/cbpc"
1198
- class="menu-sub-item"
1199
- >
1200
- ${this.i18n['首届CBPC供应商产品碳足迹管理能力大赛']}
1189
+ </div>`
1190
+ : ''}
1191
+ ${this.isPlat || this.alreadyServices.includes('databankpage')
1192
+ ? html` <div
1193
+ class="menu-item"
1194
+ style="color: ${this.hostName.includes('/databankpage')
1195
+ ? '#06AA3E'
1196
+ : this.isPlat
1197
+ ? '#fff'
1198
+ : '#373737'}"
1199
+ @click="${this._routerPush}"
1200
+ data-login-url="https://www.weblca.net/databankpage"
1201
+ data-url="https://www.weblca.net/databankpage"
1202
+ >
1203
+ ${this.i18n['资料库']}
1204
+ </div>`
1205
+ : ''}
1206
+ ${this.isPlat
1207
+ ? html` <div
1208
+ class="menu-item menu-item-database"
1209
+ style=" position: relative;color: ${this.hostName.includes(
1210
+ 'efootprint.net/contest'
1211
+ )
1212
+ ? '#06AA3E'
1213
+ : this.isPlat
1214
+ ? '#fff'
1215
+ : '#373737'}"
1216
+ >
1217
+ ${this.i18n['LCA大赛']}
1218
+ <div class="menu-sub-group menu-sub-group-1">
1219
+ <div
1220
+ @click="${this._routerPush}"
1221
+ data-login-url="https://www.weblca.net/contest"
1222
+ data-url="https://www.weblca.net/contest"
1223
+ class="menu-sub-item"
1224
+ >
1225
+ ${this.i18n['2025全生命周期创新大赛']}
1226
+ </div>
1227
+ <div
1228
+ @click="${this._routerPush}"
1229
+ data-login-url="https://www.weblca.net/contest/cccd"
1230
+ data-url="https://www.weblca.net/contest/cccd"
1231
+ class="menu-sub-item"
1232
+ >
1233
+ ${this.i18n['化工专题比赛']}
1234
+ </div>
1235
+ <div
1236
+ @click="${this._routerPush}"
1237
+ data-login-url="https://www.weblca.net/contest/cbpc"
1238
+ data-url="https://www.weblca.net/contest/cbpc"
1239
+ class="menu-sub-item"
1240
+ >
1241
+ ${this.i18n['首届CBPC供应商产品碳足迹管理能力大赛']}
1242
+ </div>
1201
1243
  </div>
1202
- </div>
1203
- </div>`
1204
- : ''}
1205
- ${this.isPlat
1206
- ? html` <div
1207
- class="menu-item"
1208
- style="color: ${this.hostName.includes(
1209
- 'efootprint.net/training'
1210
- )
1211
- ? '#06AA3E'
1212
- : this.isPlat
1213
- ? '#fff'
1214
- : '#373737'}"
1215
- @click="${this._routerPush}"
1216
- data-login-url="https://www.weblca.net/training"
1217
- data-url="https://www.weblca.net/training"
1218
- >
1219
- ${this.i18n['专业培训']}
1220
- </div>`
1221
- : ''}
1222
- <div
1223
- class="menu-item"
1224
- style="color: ${this.isPlat ? '#fff' : '#373737'}"
1225
- @click="${this._scroll}"
1226
- data-login-url="#"
1227
- data-url="#"
1228
- >
1229
- ${this.i18n['联系我们']}
1230
- </div>
1244
+ </div>`
1245
+ : ''}
1246
+ ${this.isPlat
1247
+ ? html` <div
1248
+ class="menu-item"
1249
+ style="color: ${this.hostName.includes(
1250
+ 'efootprint.net/training'
1251
+ )
1252
+ ? '#06AA3E'
1253
+ : this.isPlat
1254
+ ? '#fff'
1255
+ : '#373737'}"
1256
+ @click="${this._routerPush}"
1257
+ data-login-url="https://www.weblca.net/training"
1258
+ data-url="https://www.weblca.net/training"
1259
+ >
1260
+ ${this.i18n['专业培训']}
1261
+ </div>`
1262
+ : ''}
1263
+ <div
1264
+ class="menu-item"
1265
+ style="color: ${this.isPlat ? '#fff' : '#373737'}"
1266
+ @click="${this._scroll}"
1267
+ data-login-url="#"
1268
+ data-url="#"
1269
+ >
1270
+ ${this.i18n['联系我们']}
1271
+ </div>
1231
1272
 
1232
- ${this.isShowLang
1233
- ? html` <div
1234
- class="menu-item menu-item-database"
1235
- style=" position: relative;
1273
+ ${this.isShowLang
1274
+ ? html` <div
1275
+ class="menu-item menu-item-database"
1276
+ style=" position: relative;
1236
1277
  text-align: center;
1237
1278
  display: flex;
1238
1279
  align-items: center;
1239
1280
  color: ${this.hostName.includes(
1240
- 'weblca.net/database'
1241
- )
1242
- ? '#06AA3E'
1243
- : this.isPlat
1244
- ? '#fff'
1245
- : '#373737'}"
1246
- >
1247
- ${this.isPlat
1248
- ? html`<img
1249
- src="http://ike-web.oss-cn-hangzhou.aliyuncs.com/language.png"
1250
- alt=""
1251
- />`
1252
- : html`<img
1253
- src="http://ike-web.oss-cn-hangzhou.aliyuncs.com/language_block.png"
1254
- alt=""
1255
- />`}
1256
- <div class="menu-sub-group">
1257
- <div
1258
- @click="${this._clickLang}"
1259
- data-lang="zh_CN"
1260
- class="menu-sub-item"
1261
- >
1262
- 中文简体
1263
- </div>
1264
- <div
1265
- @click="${this._clickLang}"
1266
- data-lang="zh_TW"
1267
- class="menu-sub-item"
1268
- >
1269
- 中文繁体
1281
+ 'weblca.net/database'
1282
+ )
1283
+ ? '#06AA3E'
1284
+ : this.isPlat
1285
+ ? '#fff'
1286
+ : '#373737'}"
1287
+ >
1288
+ ${this.isPlat
1289
+ ? html`<img
1290
+ src="http://ike-web.oss-cn-hangzhou.aliyuncs.com/language.png"
1291
+ alt=""
1292
+ />`
1293
+ : html`<img
1294
+ src="http://ike-web.oss-cn-hangzhou.aliyuncs.com/language_block.png"
1295
+ alt=""
1296
+ />`}
1297
+ <div class="menu-sub-group">
1298
+ <div
1299
+ @click="${this._clickLang}"
1300
+ data-lang="zh_CN"
1301
+ class="menu-sub-item"
1302
+ >
1303
+ 中文简体
1304
+ </div>
1305
+ <div
1306
+ @click="${this._clickLang}"
1307
+ data-lang="zh_TW"
1308
+ class="menu-sub-item"
1309
+ >
1310
+ 中文繁体
1311
+ </div>
1312
+ <div
1313
+ @click="${this._clickLang}"
1314
+ data-lang="en_US"
1315
+ class="menu-sub-item"
1316
+ >
1317
+ English
1318
+ </div>
1270
1319
  </div>
1320
+ </div>`
1321
+ : ''}
1322
+
1323
+ <!-- 消息图标 - 仅在登录状态下显示 -->
1324
+ ${this.isLoggedIn
1325
+ ? html`
1271
1326
  <div
1272
- @click="${this._clickLang}"
1273
- data-lang="en_US"
1274
- class="menu-sub-item"
1327
+ @click="${this._routerPush}"
1328
+ data-login-url="${this._getNotificationUrl()}"
1329
+ data-url="${this._getNotificationUrl()}"
1330
+ class="message-icon-container"
1275
1331
  >
1276
- English
1332
+ <img
1333
+ src="https://ike-web.oss-cn-hangzhou.aliyuncs.com/message.png"
1334
+ alt="消息"
1335
+ class="message-icon ${this.isPlat
1336
+ ? ''
1337
+ : 'message-icon-dark'}"
1338
+ />
1339
+ ${this.messageCount > 0
1340
+ ? html`<div class="message-badge">
1341
+ ${this.messageCount}
1342
+ </div>`
1343
+ : ''}
1277
1344
  </div>
1278
- </div>
1279
- </div>`
1280
- : ''}
1281
-
1282
- <!-- 消息图标 - 仅在登录状态下显示 -->
1283
- ${this.isLoggedIn
1284
- ? html`
1285
- <div
1286
- @click="${this._routerPush}"
1287
- data-login-url="${this._getNotificationUrl()}"
1288
- data-url="${this._getNotificationUrl()}"
1289
- class="message-icon-container"
1290
- >
1291
- <img
1292
- src="https://ike-web.oss-cn-hangzhou.aliyuncs.com/message.png"
1293
- alt="消息"
1294
- class="message-icon ${this.isPlat
1295
- ? ''
1296
- : 'message-icon-dark'}"
1297
- />
1298
- ${this.messageCount > 0
1299
- ? html`<div class="message-badge">
1300
- ${this.messageCount}
1301
- </div>`
1302
- : ''}
1303
- </div>
1304
- `
1305
- : ''}
1345
+ `
1346
+ : ''}
1306
1347
 
1307
- <!-- 登录/用户信息 -->
1308
- ${this.isLoggedIn
1309
- ? html` <div
1348
+ <!-- 登录/用户信息 -->
1349
+ ${this.isLoggedIn
1350
+ ? html` <div
1310
1351
  class="user-menu ${this.isUserMenuOpen ? 'open' : ''}"
1311
1352
  @click="${this._toggleUserMenu}"
1312
1353
  >
@@ -1369,7 +1410,7 @@ export class IkeWebHeader extends LitElement {
1369
1410
  class="user-action"
1370
1411
  @click="${this._goPersonalCenter}"
1371
1412
  >
1372
- 个人中心
1413
+ 个人主页
1373
1414
  </div>
1374
1415
  <div class="user-action" @click="${this._logout}">
1375
1416
  退出登录
@@ -1377,7 +1418,7 @@ export class IkeWebHeader extends LitElement {
1377
1418
  </div>
1378
1419
  </div>
1379
1420
  </div>`
1380
- : html` <div
1421
+ : html` <div
1381
1422
  class="login-button"
1382
1423
  style="border-color: ${this.isPlat
1383
1424
  ? '#fff'
@@ -1387,33 +1428,33 @@ export class IkeWebHeader extends LitElement {
1387
1428
  ${this.i18n['登录']}
1388
1429
  </div>`}
1389
1430
 
1390
- <!-- <div class="menu-item">-->
1391
- <!-- <el-icon style="cursor: pointer" size="28" color="#fff">-->
1392
- <!-- <UserFilled/>-->
1393
- <!-- </el-icon>-->
1394
- <!-- </div>-->
1431
+ <!-- <div class="menu-item">-->
1432
+ <!-- <el-icon style="cursor: pointer" size="28" color="#fff">-->
1433
+ <!-- <UserFilled/>-->
1434
+ <!-- </el-icon>-->
1435
+ <!-- </div>-->
1436
+ </div>
1395
1437
  </div>
1396
1438
  </div>
1397
1439
  </div>
1398
- </div>
1399
- ${this.permissionModalMessage
1400
- ? html`<div class="permission-modal-mask">
1401
- <div class="permission-modal" role="alertdialog" aria-modal="true">
1402
- <div class="permission-modal-title">提示</div>
1403
- <div class="permission-modal-content">
1404
- ${this.permissionModalMessage}
1405
- </div>
1406
- <div class="permission-modal-footer">
1407
- <button
1408
- class="permission-modal-button"
1409
- @click="${this._hidePermissionModal}"
1410
- >
1411
- 确定
1412
- </button>
1440
+ ${this.permissionModalMessage
1441
+ ? html`<div class="permission-modal-mask">
1442
+ <div class="permission-modal" role="alertdialog" aria-modal="true">
1443
+ <div class="permission-modal-title">提示</div>
1444
+ <div class="permission-modal-content">
1445
+ ${this.permissionModalMessage}
1446
+ </div>
1447
+ <div class="permission-modal-footer">
1448
+ <button
1449
+ class="permission-modal-button"
1450
+ @click="${this._hidePermissionModal}"
1451
+ >
1452
+ 确定
1453
+ </button>
1454
+ </div>
1413
1455
  </div>
1414
- </div>
1415
- </div>`
1416
- : ''}`
1456
+ </div>`
1457
+ : ''}`
1417
1458
  }
1418
1459
 
1419
1460
  _routerPush(e) {