feat: 修复跳转链接、查询页面

This commit is contained in:
liulujian 2026-05-05 22:26:22 +08:00
parent e016eb7e11
commit 07356ee192
8 changed files with 103 additions and 35 deletions

View File

@ -133,6 +133,11 @@ request.interceptors.response.use(
if (err.reqConfig?.loading || err.config?.loading || SingleLoading.load !== null) {
SingleLoading.endLoading(true);
}
// HTTP 状态码 401 未认证,跳转登录页
if (err.response?.status === 401) {
window.location.href = `/view/mhzc/login`;
return Promise.reject(err);
}
let { message } = err;
if (message === 'Network Error') {
message = '后端接口连接异常';

View File

@ -210,5 +210,5 @@ export function authorize(responseType, clientId, redirectUri, state, autoApprov
}
export function hasLogin() {
return window.sessionStorage.getItem('yhxx');
return window.sessionStorage.getItem('sfdl');
}

View File

@ -122,7 +122,7 @@ export default {
{
name: 'home',
title: '首页',
icon: require('@/pages/index/assets/nav-home.png'),
// icon: require('@/pages/index/assets/nav-home.png'),
},
{
name: 'tzzx',

View File

@ -52,6 +52,7 @@ import Nav from '@/pages/index/components/nav/index.vue';
import Footer from '@/pages/index/components/footer/index.vue';
import { menuList } from './config';
import api from '../../api/yhzx/index';
import gxzxApi from '@/pages/index/api/gxzx/index.js';
import qyrz from '../qyrz/index.vue';
import qyrz1 from '../qy-rz/index.vue';
import tfwgj from '../gxfb/tfwgj.vue';
@ -153,7 +154,9 @@ export default {
title: '质证结果管理',
icon: 'user',
name: 'zljggl',
iframeUrl: "https://ctn-web-pre.lingshu.net/proof-result-mgt?type=carbon-certify",
iframeUrl: "https://ctn-web-pre.lingshu.net/proof-result-mgt",
path: '/proof-result-mgt',
query: 'type=carbon-certify',
},
{
id: 'cunzhengjilu',
@ -161,18 +164,21 @@ export default {
icon: 'user',
name: 'cunzhengjilu',
iframeUrl: "https://ctn-web-pre.lingshu.net/cert-record-mgt",
path: '/cert-record-mgt',
}, {
id: 'tgjlgl',
title: '托管记录管理',
icon: 'user',
name: 'tgjlgl',
iframeUrl: "https://ctn-web-pre.lingshu.net/hosting-record-mgt",
path: '/hosting-record-mgt',
}, {
id: 'chazhengjilu',
title: '查证记录管理',
icon: 'user',
name: 'chazhengjilu',
iframeUrl: "https://ctn-web-pre.lingshu.net/query-record-mgt",
path: '/query-record-mgt',
},
]
},
@ -193,16 +199,15 @@ export default {
],
ejcdList: [],
iFrameSrc: '',
zljgglurl: 'https://ctn-web-pre.lingshu.net/proof-result-mgt?type=carbon-certify',
iframeUrl: "",
activeMenuId: "gzt",
kxurl: '',
};
},
created() {
this.gettfwzxurl();
},
activated() {
console.log("glxtSy.vue,activated==>", this.$route)
@ -214,6 +219,29 @@ export default {
}
},
methods: {
updateIframeUrl(menus) {
if (!menus || !this.kxurl) return;
menus.forEach(menu => {
if (menu.path) {
menu.iframeUrl = `${this.kxurl}${menu.path}`;
if (menu.query) {
menu.iframeUrl += `?${menu.query}`;
}
}
if (menu.children && menu.children.length > 0) {
this.updateIframeUrl(menu.children);
}
});
},
async gettfwzxurl() {
try {
const { data } = await gxzxApi.tfwzxurl();
this.kxurl = data.kxtfwzx;
this.updateIframeUrl(this.cdList);
} catch (error) {
console.error('获取碳服务中枢URL失败', error);
}
},
syncMenuWithRoute() {
const path = this.$route.path;
const match = path.match(/\/yhzx\/(\w+)/);
@ -303,7 +331,6 @@ export default {
const params = 'ZZJGGL_URL';
const { data } = await api.dm2mc(params);
console.log('initView', data);
this.zljgglurl = data;
} catch (err) {
} finally {
@ -340,13 +367,8 @@ export default {
console.log('change', active);
// sessionStorage.removeItem('lclsearchList');
// sessionStorage.removeItem('jblsearchList');
if (active == 'zljggl') {
this.iskxt = false;
this.iFrameSrc = this.zljgglurl;
} else {
this.iskxt = true;
this.activeCompo = active;
}
this.iskxt = true;
this.activeCompo = active;
},
xgmm() {
this.activeCompo = 'xgmm';

View File

@ -16,7 +16,8 @@
<img src="@/pages/index/assets/home-top-title.png">
</div>
<div class="top-title-desc">
<img src="@/pages/index/assets/top-desc-text.png" />
<!-- <img src="@/pages/index/assets/top-desc-text.png" /> -->
让中国的每一份碳都拥有独一无二的可信数字身份
</div>
<div class="top-search-box">
@ -266,6 +267,7 @@
<script>
import Footer from '@/pages/index/components/footer/index.vue';
import hydtApi from '@/pages/index/api/hydt';
import gxzxApi from '@/pages/index/api/gxzx/index.js';
export default {
data() {
return {
@ -352,23 +354,25 @@ export default {
{ name: '合作伙伴', logo: require('@/pages/index/views/home2/assets/partner-15.png') },
{ name: '合作伙伴', logo: require('@/pages/index/views/home2/assets/partner-16.png') }
],
buttonLinkHost: 'https://ctn-web-pre.lingshu.net',
buttonLinks: {
//
'办证指南': '/mdviewer?file=docs%2Fcarbon-guide.md',
'碳证查询': 'https://ctn-web-pre.lingshu.net/trustedCarbonQuery/list?type=carbon-query',
'碳证核验': 'https://ctn-web-pre.lingshu.net/carbon-verify',
'碳证查询': '/trustedCarbonQuery/list?type=carbon-query',
'碳证核验': '/carbon-verify',
'跨境互通': '',
//
'上链指南': '/mdviewer?file=docs%2Fcarbon-guide.md',
'上链标准': '',
'上链工具': '',
'碳证中心': 'https://ctn-web-pre.lingshu.net/carbon-index',
'碳证中心': '/carbon-index',
// 绿
'服务市场': '/tfwsc',
'需求市场': '/txqsc',
'金融市场': '',
'数据市场': '/tsjsc',
},
kxtfwzx: '',
};
},
components: {
@ -378,6 +382,7 @@ export default {
this.syncBannerHeight();
window.addEventListener('resize', this.syncBannerHeight);
this.fetchNewsData();
this.getTfwzxUrl();
window.addEventListener('wheel', this.handleWheel, { passive: false });
},
beforeDestroy() {
@ -385,6 +390,15 @@ export default {
window.removeEventListener('wheel', this.handleWheel);
},
methods: {
async getTfwzxUrl() {
try {
const { data } = await gxzxApi.tfwzxurl();
this.kxtfwzx = data.kxtfwzx;
this.buttonLinkHost = this.kxtfwzx;
} catch (error) {
console.error('获取碳服务中枢URL失败', error);
}
},
handleWheel(e) {
if (this.isScrolling) return;
const delta = Math.abs(e.deltaY);
@ -460,7 +474,11 @@ export default {
}
},
openService() {
window.open('http://carbon_did.liantu.tech/');
if (location.host.indexOf('cciw') >= 0) {
window.open('http://101.230.193.133:8888/')
} else {
window.open('http://carbon_did.liantu.tech/');
}
},
@ -490,11 +508,8 @@ export default {
this.$message.info('敬请期待');
return;
}
if (url.startsWith('http://') || url.startsWith('https://')) {
this.$emit('gotoIfreamPage', url);
} else {
this.$router.push(url);
}
const u = `${this.buttonLinkHost}${url}`;
this.$emit('gotoIfreamPage', u);
},
//
handleSearch() {
@ -733,11 +748,19 @@ export default {
width: 100%;
font-size: 24px;
font-weight: bold;
color: #222222;
-webkit-text-stroke: 0.3px #fff;
text-stroke: 0.3px #fff;
text-align: center;
margin-top: 40px;
font-size: 28px;
font-weight: bold;
color: #0A4A17; /* 原图的深绿色文字 */
/* 核心:白色光晕效果 */
text-shadow:
0 0 1px #ffffff,
0 0 3px #ffffff,
0 0 6px #ffffff,
0 0 10px #ffffff;
}
.top-title-desc img {
@ -2023,7 +2046,7 @@ export default {
.top-title-desc {
padding: 0 20px;
margin-top: 16px;
font-size: 14px;
font-size: 20px;
}
.top-search-box {

View File

@ -13,6 +13,7 @@
<script>
import Nav from "@/pages/index/components/nav/index2.vue";
import { hasLogin } from "@/pages/index/api/login";
export default {
name: "Main",
data() {
@ -72,6 +73,10 @@ export default {
},
gotoIfreamPage(iframeUrl) {
if (!hasLogin()) {
window.location.href = `/view/mhzc/login`;
return;
}
this.iframeUrl = iframeUrl;
},

View File

@ -201,14 +201,25 @@ export default {
inputTimer: null,
};
},
watch: {
'$route.query': {
handler(newQuery) {
this.keyword = newQuery.keyword || '';
this.currentCategory = newQuery.category || 'all';
this.selectedCategory = this.currentCategory;
this.currentPage = 1;
this.loadSearchHistory();
this.loadHotSearch();
if (this.keyword) {
this.doSearch();
}
},
immediate: true,
},
},
mounted() {
this.keyword = this.$route.query.keyword || '';
this.currentCategory = this.$route.query.category || 'all';
this.loadSearchHistory();
this.loadHotSearch();
if (this.keyword) {
this.doSearch();
}
},
methods: {
handleSearch() {
@ -226,7 +237,6 @@ export default {
},
});
this.saveSearchHistory(this.keyword);
this.doSearch();
},
handleInput(value) {
if (this.inputTimer) {
@ -249,7 +259,6 @@ export default {
category: this.currentCategory,
},
});
this.doSearch();
},
handlePageChange(pageInfo) {
this.currentPage = pageInfo.current;

View File

@ -289,24 +289,28 @@ module.exports = {
'^/sso': {
target: 'http://localhost:9300',
// target: 'http://carbon.liantu.tech',
// target: 'http://www.cciw.com.cn',
// target: 'http://10.23.20.13:94/',
changeOrigin: true,
},
'^/mhzc': {
target: 'http://localhost:9300',
// target: 'http://carbon.liantu.tech',
// target: 'http://www.cciw.com.cn',
// target: 'http://10.23.20.13:94/',
changeOrigin: true,
},
'^/gxzx': {
target: 'http://localhost:9300',
// target: 'http://carbon.liantu.tech',
// target: 'http://www.cciw.com.cn',
// target: 'http://10.23.20.13:94/',
changeOrigin: true,
},
'^/yygl': {
// target: 'http://localhost:20010',
target: 'http://carbon.liantu.tech',
// target: 'http://www.cciw.com.cn',
// target: 'http://10.23.20.13:94/',
changeOrigin: true,
},