diff --git a/.env.production b/.env.production index 369dfee..13b3787 100644 --- a/.env.production +++ b/.env.production @@ -10,7 +10,7 @@ ENV = 'production' # VUE_APP_BASE_API = 'http://114.216.202.175:8008' # 公司测试环境 -VUE_APP_BASE_API = 'http://39.101.188.84:7071' +# VUE_APP_BASE_API = 'http://39.101.188.84:7071' # 正式环境 -# VUE_APP_BASE_API = '/api' +VUE_APP_BASE_API = '/api' diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index 0b7b344..b0f5207 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -8,7 +8,7 @@
- - + 退出登录 - + -->
@@ -66,7 +63,7 @@ export default { return { username: "", messages: [], - counts: 0, // 消息计数 + counts: 0, }; }, computed: { diff --git a/src/permission.js b/src/permission.js index 029dc5a..5b2db54 100644 --- a/src/permission.js +++ b/src/permission.js @@ -13,7 +13,7 @@ import { governmentGetInfo } from "@/api/login/index"; NProgress.configure({ showSpinner: false }); -const whiteList = ["/login", "/entLogin", "/register"]; // 白名单路径 +const whiteList = ["/login", "/entLogin", "/register"]; const isWhiteList = (path) => { return whiteList.some((pattern) => isPathMatch(pattern, path)); @@ -25,14 +25,15 @@ router.beforeEach((to, from, next) => { } NProgress.start(); - const search = window.location.search || window.location.hash.split("?")[1] || ""; + const search = + window.location.search || window.location.hash.split("?")[1] || ""; const params = new URLSearchParams(search); const userToken = params.get("userToken"); const signature = params.get("signature"); const timespan = params.get("timespan"); // ============================= - // 🔑 新增:处理 clienttoken 登录逻辑 + // 🔑 新增:处理 clienttoken 登录企业单点登录逻辑 // ============================= if (window.location.href.includes("clienttoken=")) { const reg = /[?&]clienttoken=([^&#]+)/; @@ -41,21 +42,27 @@ router.beforeEach((to, from, next) => { if (clienttoken) { // 清除 clienttoken 避免死循环 - let modifiedUrl = window.location.href.replace(/[?&]clienttoken=[^&#]+/, ''); - if (modifiedUrl.endsWith('?') || modifiedUrl.endsWith('&')) { - modifiedUrl = modifiedUrl.slice(0, -1); // 去掉末尾多余的符号 + let modifiedUrl = window.location.href.replace( + /[?&]clienttoken=[^&#]+/, + "" + ); + if (modifiedUrl.endsWith("?") || modifiedUrl.endsWith("&")) { + modifiedUrl = modifiedUrl.slice(0, -1); } // 如果 roles 还未加载,则拉取用户信息 if (store.getters.roles.length === 0) { isRelogin.show = true; - store.dispatch("SingleSignOnGetInfo", { clientToken: clienttoken }) + store + .dispatch("SingleSignOnGetInfo", { clientToken: clienttoken }) .then(() => { isRelogin.show = false; - + console.log("✅ 单点登录成功"); + console.log("当前 token:", getToken()); + console.log("当前角色:", store.getters.roles); // 清除 URL 中的 clienttoken 并刷新页面 - window.history.replaceState({}, '', modifiedUrl); + window.history.replaceState({}, "", modifiedUrl); // 获取用户权限并生成路由 return store.dispatch("GenerateRoutes"); @@ -67,12 +74,13 @@ router.beforeEach((to, from, next) => { .catch((err) => { // console.error("单点登录失败:", err); store.dispatch("LogOut").then(() => { - // Message.error("单点登录失败,请重试"); - window.location.href = "https://qytt.sipac.gov.cn/ecobrainportal/index.html"; + Message.error("单点登录失败,请重试"); + // window.location.href = + // "https://qytt.sipac.gov.cn/ecobrainportal/index.html"; }); }); - return; + return; } } } @@ -85,7 +93,7 @@ router.beforeEach((to, from, next) => { return; } - if (userToken && signature && timespan && to.path !== "/login") { + if (userToken && signature && timespan && !isPathMatch("/login", to.path)) { next({ path: "/login", query: { userToken, signature, timespan }, @@ -150,22 +158,26 @@ router.beforeEach((to, from, next) => { // ============================= // 🔐 原始本地登录逻辑 // ============================= - const token = getToken(); - if (token) { + if (getToken()) { to.meta.title && store.dispatch("settings/setTitle", to.meta.title); - if (to.path === "/login") { + /* has token*/ + if (to.path === "/entLogin") { next({ path: "/" }); NProgress.done(); - } else if (isWhiteList(to.path)) { - next(); + } else if (whiteList.indexOf(to.path) !== -1) { + next({ path: "/" }); + NProgress.done(); + // next(); } else { if (store.getters.roles.length === 0) { isRelogin.show = true; + // 判断当前用户是否已拉取完user_info信息 store .dispatch("GetInfo") .then(() => { isRelogin.show = false; store.dispatch("GenerateRoutes").then((accessRoutes) => { + // 根据roles权限生成可访问的路由表 router.addRoutes(accessRoutes); next({ ...to, replace: true }); }); @@ -173,7 +185,7 @@ router.beforeEach((to, from, next) => { .catch((err) => { store.dispatch("LogOut").then(() => { Message.error(err); - next("/"); + next({ path: "/" }); }); }); } else { @@ -181,14 +193,16 @@ router.beforeEach((to, from, next) => { } } } else { - if (isWhiteList(to.path)) { + // 没有token + if (whiteList.indexOf(to.path) !== -1) { + // 在免登录白名单,直接进入 next(); } else { - next(`/login?redirect=${encodeURIComponent(to.fullPath)}`); + next(`/entLogin?redirect=${encodeURIComponent(to.fullPath)}`); + NProgress.done(); } } }); - router.afterEach(() => { NProgress.done(); -}); \ No newline at end of file +}); diff --git a/src/router/index.js b/src/router/index.js index 0777c10..dee232e 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -44,9 +44,14 @@ export const constantRoutes = [ { path: "/login", // 正式环境登录页 - // component: () => import("@/views/login"), + component: () => import("@/views/login"), // 测试 - component: () => import("@/views/login_v1"), + // component: () => import("@/views/login_v1"), + hidden: true, + }, + { + path: "/entLogin", + component: () => import("@/views/entLogin"), hidden: true, }, { diff --git a/src/views/components/ProjectDetails/Basic.vue b/src/views/components/ProjectDetails/Basic.vue index 7602b7d..480b15b 100644 --- a/src/views/components/ProjectDetails/Basic.vue +++ b/src/views/components/ProjectDetails/Basic.vue @@ -54,31 +54,189 @@
- 项目代表性照片 + + + 项目图片 + +
- + + {{ basicInfo.name }} + + + + + {{ basicInfo.xmfrdwxz }} + + + + + + + + + + {{ basicInfo.sgdw }} + + + + + {{ basicInfo.sjdw }} + + + + + {{ basicInfo.ztze }} + + + + + + + + + + {{ basicInfo.begainTime }} 至 {{ basicInfo.endTime }} + + + + + + + + + + {{ basicInfo.jsdd }} + + + + + {{ basicInfo.prioritize }} + + + + + + + + + + {{ basicInfo.label }} + + + + + {{ basicInfo.projectLeader }} + + + + + {{ basicInfo.phone }} + + + + + {{ basicInfo.issuingTime }} + + + + + {{ basicInfo.acceptanceTime }} + + + + + {{ basicInfo.jsjd }} + + + + + {{ basicInfo.tyshxydm }} + + + + + {{ basicInfo.jhtze }} + + + + + + + + + + + + + + + {{ basicInfo.unitIntroduction }} + - {{ item.value }} + + + {{ basicInfo.introduction }}
@@ -409,7 +567,7 @@ placeholder="请输入项目简介" > - + @@ -465,19 +623,6 @@ export default { }, data() { return { - requiredFields: [ - "项目名称", - "项目法人单位", - "项目法人单位性质", - "建设模式", - "项目负责人", - "总投资额(万元)", - "联系方式", - "所属功能区", - "建设起止时间", - "现状分类", - "统一社会信用代码", - ], baseUrl: process.env.VUE_APP_BASE_API, descriptions: [], dialogImageUrl: "", @@ -529,6 +674,12 @@ export default { trigger: "change", }, ], + sgdw: [ + { required: true, message: "施工单位不能为空", trigger: "blur" }, + ], + sjdw: [ + { required: true, message: "设计单位不能为空", trigger: "blur" }, + ], ztze: [ { required: true, message: "总投资额不能为空", trigger: "blur" }, { type: "number", message: "总投资额必须是数字", trigger: "blur" }, @@ -553,9 +704,18 @@ export default { xzfl: [ { required: true, message: "现状分类不能为空", trigger: "change" }, ], + jsdd: [ + { required: true, message: "建设地点不能为空", trigger: "blur" }, + ], + prioritize: [ + { required: true, message: "重点发展产业不能为空", trigger: "blur" }, + ], jsms: [ { required: true, message: "建设模式不能为空", trigger: "change" }, ], + label: [ + { required: true, message: "项目标签不能为空", trigger: "blur" }, + ], projectLeader: [ { required: true, message: "项目负责人不能为空", trigger: "blur" }, ], @@ -567,8 +727,55 @@ export default { trigger: "blur", }, ], + issuingTime: [ + { + required: true, + message: "施工许可证发放时间不能为空", + trigger: "blur", + }, + ], + acceptanceTime: [ + { required: true, message: "竣工验收时间不能为空", trigger: "blur" }, + ], + jsjd: [ + { required: true, message: "建设进度不能为空", trigger: "blur" }, + ], + tyshxydm: [ + { + required: true, + message: "统一社会信用代码不能为空", + trigger: "blur", + }, + { + pattern: /^[a-zA-Z0-9]{18}$/, + message: "请输入正确格式的18位统一社会信用代码", + trigger: "blur", + }, + ], + jhtze: [ + { + required: true, + message: "计划投资额(亿元)不能为空", + trigger: "blur", + }, + ], + ml: [ + { + required: true, + message: "所属产业目录不能为空", + trigger: "change", + }, + ], + xfcy: [ + { + required: true, + message: "所属细分产业不能为空", + trigger: "change", + }, + ], unitIntroduction: [ { + required: true, max: 1000, message: "项目法人单位简介长度不能超过1000个字", trigger: "blur", @@ -576,61 +783,48 @@ export default { ], introduction: [ { + required: true, max: 1000, message: "项目简介长度不能超过1000个字", trigger: "blur", }, ], - tyshxydm: [ - { required: true, message: "请填写", trigger: "blur" }, + fj: [ { - pattern: /^[a-zA-Z0-9]{18}$/, - message: "请输入正确格式的18位统一社会信用代码", - trigger: "blur", + required: true, + message: "请上传至少一张项目代表性照片", + trigger: "change", + }, + { + validator: (rule, value, callback) => { + if ( + !value || + value.split(",").filter((url) => url.trim() !== "").length === 0 + ) { + callback(new Error("请上传至少一张项目代表性照片")); + } else { + callback(); + } + }, + trigger: "change", }, ], }, - // select映射 - ssgnqMap: { - 1: "高端制造与国际贸易区", - 2: "独墅湖科教创新区", - 3: "阳澄湖半岛旅游度假区", - 4: "金鸡湖商务区", - 5: "苏相合作区", - }, - xmfrdwxzMap: { - 1: "国企", - 2: "外资企业", - 3: "民营企业", - 4: "其他", - }, - jsmsMap: { - 1: "工地实施", - 2: "利用存量用地改扩建", - }, - xzflMap: { - 1: "已建", - 2: "在建", - 3: "拟建", - }, - mlMap: { - 1: "重点鼓励上楼", - 2: "有条件上楼", - }, - xfMap: { - 1: "新一代信息技术", - 2: "高端装备制造", - 3: "生物医药及大健康", - 4: "纳米技术应用及新材料", - 5: "人工智能及数字产业", - 6: "新能源及绿色产业", - }, }; }, watch: { basicInfo: { handler(newVal) { - this.descriptions = this.formatDescriptions(newVal); + // 处理图片轮播数据 + if (newVal.fj) { + this.carouselImages = newVal.fj + .split(",") + .map((url) => this.baseUrl + url.trim()); + } else { + this.carouselImages = []; + } + + // 设置表单数据 this.form = { ...newVal, begainTime: newVal.begainTime ? new Date(newVal.begainTime) : "", @@ -651,7 +845,7 @@ export default { this.form.latitude = location.lat; // 设置纬度 this.mapDialogVisible = false; // 关闭地图弹窗 }, - /** 导出按钮操作 */ + /* 导出按钮操作 */ handleExport() { this.download( "/gysl/basicInformation/export", @@ -661,47 +855,6 @@ export default { `基本信息导出${new Date().getTime()}.xlsx` ); }, - // 格式化描述信息 - formatDescriptions(data) { - const requiredFields = this.requiredFields; - return [ - { label: "项目名称", value: data.name }, - { label: "项目法人单位", value: data.xmfrdwxz }, - { - label: "项目法人单位性质", - value: this.xmfrdwxzMap[data.nature] || "", - }, - { label: "施工单位", value: data.sgdw }, - { label: "设计单位", value: data.sjdw }, - { label: "总投资额(万元)", value: data.ztze }, - { label: "所属功能区", value: this.ssgnqMap[data.ssgnq] || "" }, - { - label: "建设起止时间", - value: `${data.begainTime ? data.begainTime : ""} 至 ${ - data.endTime ? data.endTime : "" - }`, - }, - { label: "现状分类", value: this.xzflMap[data.xzfl] || "" }, - { label: "建设地点", value: data.jsdd }, - { label: "重点发展产业", value: data.prioritize }, - { label: "建设模式", value: this.jsmsMap[data.jsms] || "" }, - { label: "项目标签", value: data.label }, - { label: "项目负责人", value: data.projectLeader }, - { label: "联系方式", value: data.phone }, - { label: "施工许可证发放时间", value: data.issuingTime }, - { label: "竣工验收时间", value: data.acceptanceTime }, - { label: "建设进度", value: data.jsjd }, - { label: "统一社会信用代码", value: data.tyshxydm }, - { label: "计划投资额(亿元)", value: data.jhtze }, - { label: "所属产业目录", value: this.mlMap[data.ml] || "" }, - { label: "所属细分产业", value: this.xfMap[data.xfcy] || "" }, - { label: "项目法人单位简介", value: data.unitIntroduction }, - { label: "项目简介", value: data.introduction }, - ].map((item) => ({ - ...item, - required: requiredFields.includes(item.label), - })); - }, // 打开编辑对话框 edit() { this.dialogVisible = true; @@ -741,7 +894,7 @@ export default { return { ...formData, begainTime: formatDate(formData.begainTime), // 单独格式化 begainTime - endTime: formatDate(formData.endTime), + endTime: formatDate(formData.endTime), createBy: "", createId: 0, createTime: "", @@ -840,8 +993,8 @@ export default { } .picturediv { - width: 18.31rem; - height: 25rem; + width: 24.4rem; + height: 26rem; position: relative; overflow: hidden; } @@ -859,7 +1012,7 @@ export default { } .descriptionsdiv { - width: calc(100% - 18.31rem); + width: calc(100% - 25rem); margin-left: 1rem; height: auto; } diff --git a/src/views/components/ProjectDetails/Buildings.vue b/src/views/components/ProjectDetails/Buildings.vue index c34f7c8..01ba735 100644 --- a/src/views/components/ProjectDetails/Buildings.vue +++ b/src/views/components/ProjectDetails/Buildings.vue @@ -18,7 +18,8 @@ style=" border: none; background-color: rgba(43, 98, 241, 0.1); - color: #2b62f1;" + color: #2b62f1; + " @click="addBuildingTag" > + *是否为重要楼栋 + {{ getTextForBoolean(selectedBuilding.sfwzyld) }} + + *层数 + {{ selectedBuilding.floor }} + + *总建筑高度(米) + {{ selectedBuilding.totalBuildingHeight }} + - + {{ selectedBuilding.scgd }} + - + {{ selectedBuilding.twoAndFourCg }} + - + {{ selectedBuilding.fourYscg }} + - + {{ selectedBuilding.scdmhz }} + - + {{ selectedBuilding.twoAndThreeLmhz }} + - + {{ selectedBuilding.bzcmj }} + - + {{ selectedBuilding.zj }} + - + {{ getTextForBoolean(selectedBuilding.sfydzk) }} + - + {{ getTextForBoolean(selectedBuilding.sfyqcpd) }} + - + {{ selectedBuilding.fourYslmhz }} + - + {{ selectedBuilding.djjcdj }} + - + {{ selectedBuilding.dcqk }} + - + {{ selectedBuilding.htqk }} @@ -275,7 +319,7 @@ - + {{ scope.row.jyfw }} - + @@ -287,7 +447,7 @@ export default { display: flex; flex-direction: column; width: 100%; - background-color: #FFFFFF; + background-color: #ffffff; box-shadow: 0rem 0.13rem 0.63rem 0rem rgba(177, 177, 177, 0.1); border-radius: 0.5rem 0.5rem 0.5rem 0.5rem; } @@ -301,9 +461,9 @@ export default { height: auto; display: flex; justify-content: space-between; - padding: .7rem 0; - padding: .5rem; - border-bottom: 1px solid #E5E5E5; + padding: 0.7rem 0; + padding: 0.5rem; + border-bottom: 1px solid #e5e5e5; } .topleft { @@ -325,7 +485,7 @@ export default { font-family: aliregular; font-weight: 500; font-size: 1rem; - color: #3D424C; + color: #3d424c; line-height: 1rem; text-align: right; font-style: normal; @@ -337,4 +497,4 @@ export default { margin-left: 1rem; height: auto; } - \ No newline at end of file + diff --git a/src/views/components/ProjectDetails/Projectdraw.vue b/src/views/components/ProjectDetails/Projectdraw.vue index 25d9219..0019e16 100644 --- a/src/views/components/ProjectDetails/Projectdraw.vue +++ b/src/views/components/ProjectDetails/Projectdraw.vue @@ -55,7 +55,7 @@