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

View File

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

View File

@ -122,7 +122,7 @@ export default {
{ {
name: 'home', name: 'home',
title: '首页', title: '首页',
icon: require('@/pages/index/assets/nav-home.png'), // icon: require('@/pages/index/assets/nav-home.png'),
}, },
{ {
name: 'tzzx', 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 Footer from '@/pages/index/components/footer/index.vue';
import { menuList } from './config'; import { menuList } from './config';
import api from '../../api/yhzx/index'; import api from '../../api/yhzx/index';
import gxzxApi from '@/pages/index/api/gxzx/index.js';
import qyrz from '../qyrz/index.vue'; import qyrz from '../qyrz/index.vue';
import qyrz1 from '../qy-rz/index.vue'; import qyrz1 from '../qy-rz/index.vue';
import tfwgj from '../gxfb/tfwgj.vue'; import tfwgj from '../gxfb/tfwgj.vue';
@ -153,7 +154,9 @@ export default {
title: '质证结果管理', title: '质证结果管理',
icon: 'user', icon: 'user',
name: 'zljggl', 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', id: 'cunzhengjilu',
@ -161,18 +164,21 @@ export default {
icon: 'user', icon: 'user',
name: 'cunzhengjilu', name: 'cunzhengjilu',
iframeUrl: "https://ctn-web-pre.lingshu.net/cert-record-mgt", iframeUrl: "https://ctn-web-pre.lingshu.net/cert-record-mgt",
path: '/cert-record-mgt',
}, { }, {
id: 'tgjlgl', id: 'tgjlgl',
title: '托管记录管理', title: '托管记录管理',
icon: 'user', icon: 'user',
name: 'tgjlgl', name: 'tgjlgl',
iframeUrl: "https://ctn-web-pre.lingshu.net/hosting-record-mgt", iframeUrl: "https://ctn-web-pre.lingshu.net/hosting-record-mgt",
path: '/hosting-record-mgt',
}, { }, {
id: 'chazhengjilu', id: 'chazhengjilu',
title: '查证记录管理', title: '查证记录管理',
icon: 'user', icon: 'user',
name: 'chazhengjilu', name: 'chazhengjilu',
iframeUrl: "https://ctn-web-pre.lingshu.net/query-record-mgt", iframeUrl: "https://ctn-web-pre.lingshu.net/query-record-mgt",
path: '/query-record-mgt',
}, },
] ]
}, },
@ -193,16 +199,15 @@ export default {
], ],
ejcdList: [], ejcdList: [],
iFrameSrc: '', iFrameSrc: '',
zljgglurl: 'https://ctn-web-pre.lingshu.net/proof-result-mgt?type=carbon-certify',
iframeUrl: "", iframeUrl: "",
activeMenuId: "gzt", activeMenuId: "gzt",
kxurl: '',
}; };
}, },
created() { created() {
this.gettfwzxurl();
}, },
activated() { activated() {
console.log("glxtSy.vue,activated==>", this.$route) console.log("glxtSy.vue,activated==>", this.$route)
@ -214,6 +219,29 @@ export default {
} }
}, },
methods: { 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() { syncMenuWithRoute() {
const path = this.$route.path; const path = this.$route.path;
const match = path.match(/\/yhzx\/(\w+)/); const match = path.match(/\/yhzx\/(\w+)/);
@ -303,7 +331,6 @@ export default {
const params = 'ZZJGGL_URL'; const params = 'ZZJGGL_URL';
const { data } = await api.dm2mc(params); const { data } = await api.dm2mc(params);
console.log('initView', data); console.log('initView', data);
this.zljgglurl = data;
} catch (err) { } catch (err) {
} finally { } finally {
@ -340,13 +367,8 @@ export default {
console.log('change', active); console.log('change', active);
// sessionStorage.removeItem('lclsearchList'); // sessionStorage.removeItem('lclsearchList');
// sessionStorage.removeItem('jblsearchList'); // sessionStorage.removeItem('jblsearchList');
if (active == 'zljggl') {
this.iskxt = false;
this.iFrameSrc = this.zljgglurl;
} else {
this.iskxt = true; this.iskxt = true;
this.activeCompo = active; this.activeCompo = active;
}
}, },
xgmm() { xgmm() {
this.activeCompo = 'xgmm'; this.activeCompo = 'xgmm';

View File

@ -16,7 +16,8 @@
<img src="@/pages/index/assets/home-top-title.png"> <img src="@/pages/index/assets/home-top-title.png">
</div> </div>
<div class="top-title-desc"> <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>
<div class="top-search-box"> <div class="top-search-box">
@ -266,6 +267,7 @@
<script> <script>
import Footer from '@/pages/index/components/footer/index.vue'; import Footer from '@/pages/index/components/footer/index.vue';
import hydtApi from '@/pages/index/api/hydt'; import hydtApi from '@/pages/index/api/hydt';
import gxzxApi from '@/pages/index/api/gxzx/index.js';
export default { export default {
data() { data() {
return { 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-15.png') },
{ name: '合作伙伴', logo: require('@/pages/index/views/home2/assets/partner-16.png') } { name: '合作伙伴', logo: require('@/pages/index/views/home2/assets/partner-16.png') }
], ],
buttonLinkHost: 'https://ctn-web-pre.lingshu.net',
buttonLinks: { buttonLinks: {
// //
'办证指南': '/mdviewer?file=docs%2Fcarbon-guide.md', '办证指南': '/mdviewer?file=docs%2Fcarbon-guide.md',
'碳证查询': 'https://ctn-web-pre.lingshu.net/trustedCarbonQuery/list?type=carbon-query', '碳证查询': '/trustedCarbonQuery/list?type=carbon-query',
'碳证核验': 'https://ctn-web-pre.lingshu.net/carbon-verify', '碳证核验': '/carbon-verify',
'跨境互通': '', '跨境互通': '',
// //
'上链指南': '/mdviewer?file=docs%2Fcarbon-guide.md', '上链指南': '/mdviewer?file=docs%2Fcarbon-guide.md',
'上链标准': '', '上链标准': '',
'上链工具': '', '上链工具': '',
'碳证中心': 'https://ctn-web-pre.lingshu.net/carbon-index', '碳证中心': '/carbon-index',
// 绿 // 绿
'服务市场': '/tfwsc', '服务市场': '/tfwsc',
'需求市场': '/txqsc', '需求市场': '/txqsc',
'金融市场': '', '金融市场': '',
'数据市场': '/tsjsc', '数据市场': '/tsjsc',
}, },
kxtfwzx: '',
}; };
}, },
components: { components: {
@ -378,6 +382,7 @@ export default {
this.syncBannerHeight(); this.syncBannerHeight();
window.addEventListener('resize', this.syncBannerHeight); window.addEventListener('resize', this.syncBannerHeight);
this.fetchNewsData(); this.fetchNewsData();
this.getTfwzxUrl();
window.addEventListener('wheel', this.handleWheel, { passive: false }); window.addEventListener('wheel', this.handleWheel, { passive: false });
}, },
beforeDestroy() { beforeDestroy() {
@ -385,6 +390,15 @@ export default {
window.removeEventListener('wheel', this.handleWheel); window.removeEventListener('wheel', this.handleWheel);
}, },
methods: { 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) { handleWheel(e) {
if (this.isScrolling) return; if (this.isScrolling) return;
const delta = Math.abs(e.deltaY); const delta = Math.abs(e.deltaY);
@ -460,7 +474,11 @@ export default {
} }
}, },
openService() { openService() {
if (location.host.indexOf('cciw') >= 0) {
window.open('http://101.230.193.133:8888/')
} else {
window.open('http://carbon_did.liantu.tech/'); window.open('http://carbon_did.liantu.tech/');
}
}, },
@ -490,11 +508,8 @@ export default {
this.$message.info('敬请期待'); this.$message.info('敬请期待');
return; return;
} }
if (url.startsWith('http://') || url.startsWith('https://')) { const u = `${this.buttonLinkHost}${url}`;
this.$emit('gotoIfreamPage', url); this.$emit('gotoIfreamPage', u);
} else {
this.$router.push(url);
}
}, },
// //
handleSearch() { handleSearch() {
@ -733,11 +748,19 @@ export default {
width: 100%; width: 100%;
font-size: 24px; font-size: 24px;
font-weight: bold; font-weight: bold;
color: #222222;
-webkit-text-stroke: 0.3px #fff;
text-stroke: 0.3px #fff;
text-align: center; text-align: center;
margin-top: 40px; 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 { .top-title-desc img {
@ -2023,7 +2046,7 @@ export default {
.top-title-desc { .top-title-desc {
padding: 0 20px; padding: 0 20px;
margin-top: 16px; margin-top: 16px;
font-size: 14px; font-size: 20px;
} }
.top-search-box { .top-search-box {

View File

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

View File

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

View File

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