fix: 依赖问题
This commit is contained in:
parent
46392a740d
commit
c56ff9fcd1
7
.claude/settings.local.json
Normal file
7
.claude/settings.local.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"permissions": {
|
||||
"allow": [
|
||||
"Bash(yarn install:*)"
|
||||
]
|
||||
}
|
||||
}
|
||||
52
README.md
Normal file
52
README.md
Normal file
@ -0,0 +1,52 @@
|
||||
# 碳信网 Web 项目本地开发指南
|
||||
|
||||
## 环境要求
|
||||
|
||||
- Node.js >= 14(建议 16+)
|
||||
- Yarn >= 1.22
|
||||
|
||||
## 1. 安装依赖
|
||||
|
||||
```bash
|
||||
node setup.js
|
||||
```
|
||||
|
||||
脚本会自动为所有 web 项目创建本地包链接并安装依赖。Windows 和 Mac 通用。
|
||||
|
||||
> 如果网络不稳定,加 `--prefer-offline` 会优先从本地缓存获取包,速度更快。
|
||||
|
||||
## 2. 启动开发服务
|
||||
|
||||
```bash
|
||||
# 以碳门户主页为例
|
||||
cd txw-mhzc-web
|
||||
yarn dev
|
||||
```
|
||||
|
||||
其他项目同理:`txw-gxzx-web`、`txw-kxtfwzx-web`、`txw-tzzx-web`、`txw-ytzx-web`、`txw-yygl-web`
|
||||
|
||||
## 3. 项目说明
|
||||
|
||||
| 目录 | 说明 |
|
||||
|------|------|
|
||||
| `txw-gxzx-web` | 个人工作台 |
|
||||
| `txw-kxtfwzx-web` | 科学碳体重中心 |
|
||||
| `txw-mhzc-web` | 碳门户主页 |
|
||||
| `txw-tzzx-web` | 碳资讯 |
|
||||
| `txw-ytzx-web` | 碳云学堂 |
|
||||
| `txw-yygl-web` | 运营管理 |
|
||||
| `local-nodemodules` | 本地私有包(ggzc-web 组件库) |
|
||||
|
||||
## 4. 常见问题
|
||||
|
||||
**Q: yarn install 报 `@cssyq/ggzc-web` not found?**
|
||||
|
||||
A: 需要先建立 symlink。执行第 1 步中的 for 循环即可。
|
||||
|
||||
**Q: 启动报错 engine node incompatibility?**
|
||||
|
||||
A: 加 `--ignore-engines` 参数绕过。
|
||||
|
||||
**Q: 需要更新 ggzc-web 组件库?**
|
||||
|
||||
A: 修改 `local-nodemodules/@cssyq/ggzc-web` 后,直接 `yarn dev` 即可看到更新(已通过 symlink 关联)。
|
||||
28
local-nodemodules/@cssyq/ggzc-web/README.md
Normal file
28
local-nodemodules/@cssyq/ggzc-web/README.md
Normal file
@ -0,0 +1,28 @@
|
||||
# GGZC Web Component Library
|
||||
|
||||
## 使用GgzcWeb
|
||||
```js
|
||||
Vue.use(GgzcWeb, {store});
|
||||
|
||||
```
|
||||
|
||||
## 使用扩展配置
|
||||
```vue
|
||||
<template>
|
||||
<div id="app">
|
||||
<div>{{ MH_APP_NAME }}</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Vue from 'vue';
|
||||
import {mapState} from "vuex";
|
||||
|
||||
export default Vue.extend({
|
||||
computed: {
|
||||
...mapState('settings', ['MH_APP_NAME']),
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
```
|
||||
9
local-nodemodules/@cssyq/ggzc-web/dist/config/config.json
vendored
Normal file
9
local-nodemodules/@cssyq/ggzc-web/dist/config/config.json
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"code": 1,
|
||||
"msg": "",
|
||||
"data": {
|
||||
"MH_REGISTRATION_ENABLED": true,
|
||||
"MH_APP_NAME": "修改的系统名称",
|
||||
"MH_LOGO_URL": "img_1.png"
|
||||
}
|
||||
}
|
||||
BIN
local-nodemodules/@cssyq/ggzc-web/dist/favicon.ico
vendored
Normal file
BIN
local-nodemodules/@cssyq/ggzc-web/dist/favicon.ico
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
1
local-nodemodules/@cssyq/ggzc-web/dist/ggzc-web.cjs.js
vendored
Normal file
1
local-nodemodules/@cssyq/ggzc-web/dist/ggzc-web.cjs.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const g=require("vue"),D=require("axios"),h="STARTLOADING",p="ENDLOADING",P={namespaced:!0,state:()=>({loadingStatus:{}}),mutations:{[h](e,t){const{fwbm:n}=t;g.set(e.loadingStatus,n,!0)},[p](e,t){const{fwbm:n}=t;g.set(e.loadingStatus,n,!1)}},actions:{startLoading(e,t){e.commit(h,t||[])},endLoading(e,t){e.commit(p,t||[])}}},r={axiosConfig:{timeout:60*1e3,withCredentials:!0},showRequestErr(e){if(this.vue)return this.vue.$message.error(e);console.error("Vue instance not available:",e)},logoutHandle(){this.vue&&this.vue.$store?this.vue.$store.dispatch("logout"):console.warn("Logout handler called but Vue instance or store not available")},install(e,{axiosConfig:t}){this.vue=e,this.axiosConfig={...this.axiosConfig,...t},e.prototype.$request=u}},d=D.create(r.axiosConfig);d.interceptors.request.use(e=>{const t=e,{url:n}=t;if(n.indexOf("?")!==-1?t.url=`${n}&t=${new Date().getTime()}`:t.url=`${n}?t=${new Date().getTime()}`,t.method==="get"&&t.params){let o=`${t.url}&`;for(const a of Object.keys(t.params)){const s=t.params[a],c=`${encodeURIComponent(a)}=`;if(s!==null&&typeof s<"u")if(typeof s=="object")for(const f of Object.keys(s)){const q=`${a}[${f}]`,y=`${encodeURIComponent(q)}=`;o+=`${y}${encodeURIComponent(s[f])}&`}else o+=`${c}${encodeURIComponent(s)}&`}o=o.slice(0,-1),t.params={},t.url=o}return t},e=>(console.log("====>> req err",e),Promise.reject(e)));d.interceptors.response.use(async e=>{const{code:t}=e.data;return t===401?S():t!==1&&t!==0?(e.config.noTips!==!0&&e.data.msg&&r.showRequestErr(e.data.msg),Promise.reject(t)):e.data},e=>{if(e.config.noTips!==!0){let{message:t}=e;t==="Network Error"?t="后端接口连接异常":t.includes("timeout")?t="系统接口请求超时":t.includes("Request failed with status code")&&(t=`系统接口${t.substr(t.length-3)}异常`),r.showRequestErr(t)}return Promise.reject(e)});function S(){return r.showRequestErr("无效的会话,或者会话已过期,请重新登录。").then(()=>{r.logoutHandle()}),Promise.reject("无效的会话,或者会话已过期,请重新登录。")}const l=(e,t)=>d({...e},t),i={store:null,setStore(e){this.store=e},getStore(){return this.store},dispatch(e,t){this.store&&this.store.dispatch(e,t)}},m=(e,t)=>e.then(n=>{console.log("请求返回",n);const o=[null,n];return t&&t(o),o}).catch(n=>{console.error("请求出错",n);const o=[n,null];return t&&t(o),o}),u={async post(e,t,n,o){const a=`${e}/${t}`,s=JSON.stringify(n)||"{}";await i.dispatch("LoadingManager/startLoading",{fwbm:t}),console.log("发起请求",a,"data:",s);const c=l({...o,url:a,data:s,method:"post",headers:{"Content-Type":"application/json"}},o);return m(c,()=>{i.dispatch("LoadingManager/endLoading",{fwbm:t})})},async get(e,t,n,o){const a=`${e}/${t}`;await i.dispatch("LoadingManager/startLoading",{fwbm:t});const s=l({...o,url:a,params:n,method:"get",headers:{"Content-Type":"application/json"}});return m(s,()=>{i.dispatch("LoadingManager/endLoading",{fwbm:t})})},async _fetch(e,t){return console.log("发起请求:",e.method,",",e.url,",data:",e.params),l(e,t)}},C={install(e,{store:t}){i.setStore(t),t.registerModule("LoadingManager",P)}},j="/config",T={async getDefaultConfig(){const[,e]=await u.get(j,"config.json",null,{noTips:!0});return e?e.data||{}:{}}},$="LOAD_CONFIG",w={namespaced:!0,state:()=>({}),mutations:{[$](e,t){Object.entries(t).forEach(([n,o])=>{g.set(e,n,o)})}},actions:{loadConfig(e,t){e.commit($,typeof t=="object"?t:{})}}},O={install(e,{store:t,extSettings:n}){t.registerModule("settings",w),T.getDefaultConfig().then(o=>{const a={...n,...o};t.dispatch("settings/loadConfig",a)})}},R={request:u},L={RequestPlugin:r,LoadingManagerPlugin:C,ExtSettingsPlugin:O},v={install:function(e,t){Object.values(L).forEach(n=>{e.use(n,t)})},...R,...L};exports.ExtSettingsPlugin=O;exports.LoadingManagerPlugin=C;exports.RequestPlugin=r;exports.default=v;exports.request=u;
|
||||
210
local-nodemodules/@cssyq/ggzc-web/dist/ggzc-web.es.js
vendored
Normal file
210
local-nodemodules/@cssyq/ggzc-web/dist/ggzc-web.es.js
vendored
Normal file
@ -0,0 +1,210 @@
|
||||
import l from "vue";
|
||||
import O from "axios";
|
||||
const h = "STARTLOADING", p = "ENDLOADING", y = {
|
||||
namespaced: !0,
|
||||
state: () => ({
|
||||
loadingStatus: {}
|
||||
}),
|
||||
mutations: {
|
||||
[h](e, t) {
|
||||
const { fwbm: o } = t;
|
||||
l.set(e.loadingStatus, o, !0);
|
||||
},
|
||||
[p](e, t) {
|
||||
const { fwbm: o } = t;
|
||||
l.set(e.loadingStatus, o, !1);
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
startLoading(e, t) {
|
||||
e.commit(h, t || []);
|
||||
},
|
||||
endLoading(e, t) {
|
||||
e.commit(p, t || []);
|
||||
}
|
||||
}
|
||||
}, r = {
|
||||
axiosConfig: {
|
||||
timeout: 60 * 1e3,
|
||||
withCredentials: !0
|
||||
},
|
||||
showRequestErr(e) {
|
||||
if (this.vue)
|
||||
return this.vue.$message.error(e);
|
||||
console.error("Vue instance not available:", e);
|
||||
},
|
||||
logoutHandle() {
|
||||
this.vue && this.vue.$store ? this.vue.$store.dispatch("logout") : console.warn("Logout handler called but Vue instance or store not available");
|
||||
},
|
||||
install(e, { axiosConfig: t }) {
|
||||
this.vue = e, this.axiosConfig = { ...this.axiosConfig, ...t }, e.prototype.$request = d;
|
||||
}
|
||||
}, g = O.create(r.axiosConfig);
|
||||
g.interceptors.request.use(
|
||||
/**
|
||||
* onFulfilled钩子函数处理
|
||||
* @param conf {Object} 实例中request的配置函数
|
||||
* @returns {Object} request配置函数
|
||||
*/
|
||||
(e) => {
|
||||
const t = e, { url: o } = t;
|
||||
if (o.indexOf("?") !== -1 ? t.url = `${o}&t=${(/* @__PURE__ */ new Date()).getTime()}` : t.url = `${o}?t=${(/* @__PURE__ */ new Date()).getTime()}`, t.method === "get" && t.params) {
|
||||
let n = `${t.url}&`;
|
||||
for (const a of Object.keys(t.params)) {
|
||||
const s = t.params[a], c = `${encodeURIComponent(a)}=`;
|
||||
if (s !== null && typeof s < "u")
|
||||
if (typeof s == "object")
|
||||
for (const f of Object.keys(s)) {
|
||||
const C = `${a}[${f}]`, D = `${encodeURIComponent(C)}=`;
|
||||
n += `${D}${encodeURIComponent(s[f])}&`;
|
||||
}
|
||||
else
|
||||
n += `${c}${encodeURIComponent(s)}&`;
|
||||
}
|
||||
n = n.slice(0, -1), t.params = {}, t.url = n;
|
||||
}
|
||||
return t;
|
||||
},
|
||||
/**
|
||||
* onRejected钩子函数处理
|
||||
* @param err {ErrorEvent} 前一个拦截器返回的request错误事件
|
||||
* @returns {Promise<never>} 必须reject对应的错误事件
|
||||
*/
|
||||
(e) => (console.log("====>> req err", e), Promise.reject(e))
|
||||
);
|
||||
g.interceptors.response.use(
|
||||
/**
|
||||
* onFulfilled钩子函数处理
|
||||
* @param res {Object} 为前一个拦截器返回的结果
|
||||
* @returns {Object} 必须要return`结果对象`
|
||||
*/
|
||||
async (e) => {
|
||||
const { code: t } = e.data;
|
||||
return t === 401 ? j() : t !== 1 && t !== 0 ? (e.config.noTips !== !0 && e.data.msg && r.showRequestErr(e.data.msg), Promise.reject(t)) : e.data;
|
||||
},
|
||||
/**
|
||||
* onRejected钩子函数处理
|
||||
* @param err {ErrorEvent} 前一个拦截器返回的错误结果
|
||||
* @returns {Promise<never>}
|
||||
*/
|
||||
(e) => {
|
||||
if (e.config.noTips !== !0) {
|
||||
let { message: t } = e;
|
||||
t === "Network Error" ? t = "后端接口连接异常" : t.includes("timeout") ? t = "系统接口请求超时" : t.includes("Request failed with status code") && (t = `系统接口${t.substr(t.length - 3)}异常`), r.showRequestErr(t);
|
||||
}
|
||||
return Promise.reject(e);
|
||||
}
|
||||
);
|
||||
function j() {
|
||||
return r.showRequestErr("无效的会话,或者会话已过期,请重新登录。").then(() => {
|
||||
r.logoutHandle();
|
||||
}), Promise.reject("无效的会话,或者会话已过期,请重新登录。");
|
||||
}
|
||||
const u = (e, t) => g(
|
||||
{
|
||||
...e
|
||||
},
|
||||
t
|
||||
), i = {
|
||||
store: null,
|
||||
setStore(e) {
|
||||
this.store = e;
|
||||
},
|
||||
getStore() {
|
||||
return this.store;
|
||||
},
|
||||
dispatch(e, t) {
|
||||
this.store && this.store.dispatch(e, t);
|
||||
}
|
||||
}, m = (e, t) => e.then((o) => {
|
||||
console.log("请求返回", o);
|
||||
const n = [null, o];
|
||||
return t && t(n), n;
|
||||
}).catch((o) => {
|
||||
console.error("请求出错", o);
|
||||
const n = [o, null];
|
||||
return t && t(n), n;
|
||||
}), d = {
|
||||
async post(e, t, o, n) {
|
||||
const a = `${e}/${t}`, s = JSON.stringify(o) || "{}";
|
||||
await i.dispatch("LoadingManager/startLoading", { fwbm: t }), console.log("发起请求", a, "data:", s);
|
||||
const c = u({
|
||||
...n,
|
||||
url: a,
|
||||
data: s,
|
||||
method: "post",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
}, n);
|
||||
return m(c, () => {
|
||||
i.dispatch("LoadingManager/endLoading", { fwbm: t });
|
||||
});
|
||||
},
|
||||
async get(e, t, o, n) {
|
||||
const a = `${e}/${t}`;
|
||||
await i.dispatch("LoadingManager/startLoading", { fwbm: t });
|
||||
const s = u({
|
||||
...n,
|
||||
url: a,
|
||||
params: o,
|
||||
method: "get",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
});
|
||||
return m(s, () => {
|
||||
i.dispatch("LoadingManager/endLoading", { fwbm: t });
|
||||
});
|
||||
},
|
||||
async _fetch(e, t) {
|
||||
return console.log("发起请求:", e.method, ",", e.url, ",data:", e.params), u(e, t);
|
||||
}
|
||||
}, w = {
|
||||
install(e, { store: t }) {
|
||||
i.setStore(t), t.registerModule("LoadingManager", y);
|
||||
}
|
||||
}, T = "/config", N = {
|
||||
/** 获取config */
|
||||
async getDefaultConfig() {
|
||||
const [, e] = await d.get(T, "config.json", null, { noTips: !0 });
|
||||
return e ? e.data || {} : {};
|
||||
}
|
||||
}, $ = "LOAD_CONFIG", R = {
|
||||
namespaced: !0,
|
||||
state: () => ({}),
|
||||
mutations: {
|
||||
[$](e, t) {
|
||||
Object.entries(t).forEach(([o, n]) => {
|
||||
l.set(e, o, n);
|
||||
});
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
loadConfig(e, t) {
|
||||
e.commit($, typeof t == "object" ? t : {});
|
||||
}
|
||||
}
|
||||
}, S = {
|
||||
install(e, { store: t, extSettings: o }) {
|
||||
t.registerModule("settings", R), N.getDefaultConfig().then((n) => {
|
||||
const a = { ...o, ...n };
|
||||
t.dispatch("settings/loadConfig", a);
|
||||
});
|
||||
}
|
||||
}, q = { request: d }, L = { RequestPlugin: r, LoadingManagerPlugin: w, ExtSettingsPlugin: S }, P = {
|
||||
install: function(e, t) {
|
||||
Object.values(L).forEach((o) => {
|
||||
e.use(o, t);
|
||||
});
|
||||
},
|
||||
...q,
|
||||
...L
|
||||
};
|
||||
export {
|
||||
S as ExtSettingsPlugin,
|
||||
w as LoadingManagerPlugin,
|
||||
r as RequestPlugin,
|
||||
P as default,
|
||||
d as request
|
||||
};
|
||||
1
local-nodemodules/@cssyq/ggzc-web/dist/ggzc-web.umd.js
vendored
Normal file
1
local-nodemodules/@cssyq/ggzc-web/dist/ggzc-web.umd.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
(function(s,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("vue"),require("axios")):typeof define=="function"&&define.amd?define(["exports","vue","axios"],r):(s=typeof globalThis<"u"?globalThis:s||self,r(s.GgzcWeb={},s.Vue,s.axios))})(this,function(s,r,T){"use strict";const h="STARTLOADING",p="ENDLOADING",j={namespaced:!0,state:()=>({loadingStatus:{}}),mutations:{[h](t,e){const{fwbm:n}=e;r.set(t.loadingStatus,n,!0)},[p](t,e){const{fwbm:n}=e;r.set(t.loadingStatus,n,!1)}},actions:{startLoading(t,e){t.commit(h,e||[])},endLoading(t,e){t.commit(p,e||[])}}},u={axiosConfig:{timeout:60*1e3,withCredentials:!0},showRequestErr(t){if(this.vue)return this.vue.$message.error(t);console.error("Vue instance not available:",t)},logoutHandle(){this.vue&&this.vue.$store?this.vue.$store.dispatch("logout"):console.warn("Logout handler called but Vue instance or store not available")},install(t,{axiosConfig:e}){this.vue=t,this.axiosConfig={...this.axiosConfig,...e},t.prototype.$request=l}},d=T.create(u.axiosConfig);d.interceptors.request.use(t=>{const e=t,{url:n}=e;if(n.indexOf("?")!==-1?e.url=`${n}&t=${new Date().getTime()}`:e.url=`${n}?t=${new Date().getTime()}`,e.method==="get"&&e.params){let o=`${e.url}&`;for(const a of Object.keys(e.params)){const i=e.params[a],f=`${encodeURIComponent(a)}=`;if(i!==null&&typeof i<"u")if(typeof i=="object")for(const O of Object.keys(i)){const R=`${a}[${O}]`,M=`${encodeURIComponent(R)}=`;o+=`${M}${encodeURIComponent(i[O])}&`}else o+=`${f}${encodeURIComponent(i)}&`}o=o.slice(0,-1),e.params={},e.url=o}return e},t=>(console.log("====>> req err",t),Promise.reject(t))),d.interceptors.response.use(async t=>{const{code:e}=t.data;return e===401?q():e!==1&&e!==0?(t.config.noTips!==!0&&t.data.msg&&u.showRequestErr(t.data.msg),Promise.reject(e)):t.data},t=>{if(t.config.noTips!==!0){let{message:e}=t;e==="Network Error"?e="后端接口连接异常":e.includes("timeout")?e="系统接口请求超时":e.includes("Request failed with status code")&&(e=`系统接口${e.substr(e.length-3)}异常`),u.showRequestErr(e)}return Promise.reject(t)});function q(){return u.showRequestErr("无效的会话,或者会话已过期,请重新登录。").then(()=>{u.logoutHandle()}),Promise.reject("无效的会话,或者会话已过期,请重新登录。")}const g=(t,e)=>d({...t},e),c={store:null,setStore(t){this.store=t},getStore(){return this.store},dispatch(t,e){this.store&&this.store.dispatch(t,e)}},m=(t,e)=>t.then(n=>{console.log("请求返回",n);const o=[null,n];return e&&e(o),o}).catch(n=>{console.error("请求出错",n);const o=[n,null];return e&&e(o),o}),l={async post(t,e,n,o){const a=`${t}/${e}`,i=JSON.stringify(n)||"{}";await c.dispatch("LoadingManager/startLoading",{fwbm:e}),console.log("发起请求",a,"data:",i);const f=g({...o,url:a,data:i,method:"post",headers:{"Content-Type":"application/json"}},o);return m(f,()=>{c.dispatch("LoadingManager/endLoading",{fwbm:e})})},async get(t,e,n,o){const a=`${t}/${e}`;await c.dispatch("LoadingManager/startLoading",{fwbm:e});const i=g({...o,url:a,params:n,method:"get",headers:{"Content-Type":"application/json"}});return m(i,()=>{c.dispatch("LoadingManager/endLoading",{fwbm:e})})},async _fetch(t,e){return console.log("发起请求:",t.method,",",t.url,",data:",t.params),g(t,e)}},$={install(t,{store:e}){c.setStore(e),e.registerModule("LoadingManager",j)}},D="/config",P={async getDefaultConfig(){const[,t]=await l.get(D,"config.json",null,{noTips:!0});return t?t.data||{}:{}}},L="LOAD_CONFIG",S={namespaced:!0,state:()=>({}),mutations:{[L](t,e){Object.entries(e).forEach(([n,o])=>{r.set(t,n,o)})}},actions:{loadConfig(t,e){t.commit(L,typeof e=="object"?e:{})}}},C={install(t,{store:e,extSettings:n}){e.registerModule("settings",S),P.getDefaultConfig().then(o=>{const a={...n,...o};e.dispatch("settings/loadConfig",a)})}},v={request:l},y={RequestPlugin:u,LoadingManagerPlugin:$,ExtSettingsPlugin:C},w={install:function(t,e){Object.values(y).forEach(n=>{t.use(n,e)})},...v,...y};s.ExtSettingsPlugin=C,s.LoadingManagerPlugin=$,s.RequestPlugin=u,s.default=w,s.request=l,Object.defineProperties(s,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
||||
17
local-nodemodules/@cssyq/ggzc-web/dist/index.html
vendored
Normal file
17
local-nodemodules/@cssyq/ggzc-web/dist/index.html
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||
<title><%= htmlWebpackPlugin.options.title %></title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
||||
</noscript>
|
||||
<div id="app"></div>
|
||||
<!-- built files will be auto injected -->
|
||||
</body>
|
||||
</html>
|
||||
15
local-nodemodules/@cssyq/ggzc-web/node_modules/.bin/vue-cli-service
generated
vendored
Normal file
15
local-nodemodules/@cssyq/ggzc-web/node_modules/.bin/vue-cli-service
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir//bin/sh" ]; then
|
||||
"$basedir//bin/sh" "$basedir/../../../../vue-cli-service/wrapper.sh" "$@"
|
||||
ret=$?
|
||||
else
|
||||
/bin/sh "$basedir/../../../../vue-cli-service/wrapper.sh" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
||||
7
local-nodemodules/@cssyq/ggzc-web/node_modules/.bin/vue-cli-service.cmd
generated
vendored
Normal file
7
local-nodemodules/@cssyq/ggzc-web/node_modules/.bin/vue-cli-service.cmd
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
@IF EXIST "%~dp0\/bin/sh.exe" (
|
||||
"%~dp0\/bin/sh.exe" "%~dp0\..\..\..\..\vue-cli-service\wrapper.sh" %*
|
||||
) ELSE (
|
||||
@SETLOCAL
|
||||
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
/bin/sh "%~dp0\..\..\..\..\vue-cli-service\wrapper.sh" %*
|
||||
)
|
||||
67
local-nodemodules/@cssyq/ggzc-web/package.json
Normal file
67
local-nodemodules/@cssyq/ggzc-web/package.json
Normal file
@ -0,0 +1,67 @@
|
||||
{
|
||||
"name": "@cssyq/ggzc-web",
|
||||
"version": "1.0.8",
|
||||
"description": "GGZC Web Component Library",
|
||||
"main": "dist/ggzc-web.umd.js",
|
||||
"module": "dist/ggzc-web.es.js",
|
||||
"types": "dist/types/index.d.ts",
|
||||
"files": [
|
||||
"dist",
|
||||
"README.md"
|
||||
],
|
||||
"sideEffects": false,
|
||||
"exports": {
|
||||
".": {
|
||||
"import": "./dist/ggzc-web.es.js",
|
||||
"require": "./dist/ggzc-web.cjs.js"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build:lib": "vite build",
|
||||
"prepublishOnly": "npm run build:lib",
|
||||
"generate-types": "vue-tsc --declaration --emitDeclarationOnly",
|
||||
"lint": "vue-cli-service lint",
|
||||
"serve": "vite preview"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.12.16",
|
||||
"@babel/eslint-parser": "^7.12.16",
|
||||
"axios": "^1.9.0",
|
||||
"core-js": "^3.8.3",
|
||||
"echarts": "5.1.2",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-plugin-vue": "^8.0.3",
|
||||
"lodash": "^4.17.21",
|
||||
"tdesign-vue": "^1.9.0",
|
||||
"tvision-color": "~1.6.0",
|
||||
"typescript": "^5.1.6",
|
||||
"vite": "^4.5.14",
|
||||
"vite-plugin-vue2": "^2.0.3",
|
||||
"vue": "~2.6.14",
|
||||
"vue-template-compiler": "~2.6.14",
|
||||
"vuex": "^3.6.2"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"root": true,
|
||||
"env": {
|
||||
"node": true
|
||||
},
|
||||
"extends": [
|
||||
"plugin:vue/essential",
|
||||
"eslint:recommended"
|
||||
],
|
||||
"parserOptions": {
|
||||
"parser": "@babel/eslint-parser"
|
||||
},
|
||||
"rules": {}
|
||||
},
|
||||
"browserslist": [
|
||||
"> 1%",
|
||||
"last 2 versions",
|
||||
"not dead"
|
||||
],
|
||||
"dependencies": {
|
||||
"vue-cli-service": "^5.0.10"
|
||||
}
|
||||
}
|
||||
70
local-nodemodules/README.md
Normal file
70
local-nodemodules/README.md
Normal file
@ -0,0 +1,70 @@
|
||||
# 本地依赖包说明
|
||||
|
||||
本目录存放需要本地调试的依赖包,供各 web 项目通过 `npm link` 方式引用。
|
||||
|
||||
## 目录结构
|
||||
|
||||
```
|
||||
local-nodemodules/
|
||||
└── @cssyq/
|
||||
└── ggzc-web/ # 工作主页组件库
|
||||
```
|
||||
|
||||
## 首次配置
|
||||
|
||||
在项目根目录执行以下命令,将本地包链接到全局:
|
||||
|
||||
```bash
|
||||
# 链接 ggzc-web 到全局
|
||||
cd local-nodemodules/@cssyq/ggzc-web
|
||||
npm link
|
||||
```
|
||||
|
||||
## 各 web 项目使用
|
||||
|
||||
在项目根目录执行以下命令,创建本地包的 symlink:
|
||||
|
||||
```bash
|
||||
# 创建 symlink
|
||||
for dir in txw-gxzx-web txw-kxtfwzx-web txw-mhzc-web txw-tzzx-web txw-ytzx-web txw-yygl-web; do
|
||||
mkdir -p $dir/node_modules/@cssyq
|
||||
rm -rf $dir/node_modules/@cssyq/ggzc-web
|
||||
ln -sf "$(pwd)/local-nodemodules/@cssyq/ggzc-web" "$dir/node_modules/@cssyq/ggzc-web"
|
||||
done
|
||||
```
|
||||
|
||||
## 完整安装所有 web 项目依赖
|
||||
|
||||
```bash
|
||||
# 1. 创建 symlink(如上)
|
||||
|
||||
# 2. 安装各项目依赖(使用 --prefer-offline 优先使用本地包)
|
||||
for dir in txw-gxzx-web txw-kxtfwzx-web txw-mhzc-web txw-tzzx-web txw-ytzx-web txw-yygl-web; do
|
||||
cd $dir && yarn install --prefer-offline --ignore-engines && cd ..
|
||||
done
|
||||
```
|
||||
|
||||
## 验证 link 是否成功
|
||||
|
||||
```bash
|
||||
# 检查 link 目标是否正确
|
||||
ls -la txw-mhzc-web/node_modules/@cssyq/ggzc-web
|
||||
# 应该显示链接到 local-nodemodules/@cssyq/ggzc-web
|
||||
|
||||
# 或者检查包的 version
|
||||
cat txw-mhzc-web/node_modules/@cssyq/ggzc-web/package.json | grep version
|
||||
```
|
||||
|
||||
## 常见问题
|
||||
|
||||
### yarn install 报 @cssyq/ggzc-web not found
|
||||
|
||||
需要先创建 symlink 或使用 npm link。yarn 不会自动从 local-nodemodules 查找依赖。
|
||||
|
||||
### npm link 后仍然找不到包
|
||||
|
||||
确保在对应 web 项目的 `node_modules/@cssyq/` 下有正确的 symlink。npm link 是链接到全局,再在项目中 link 回来。
|
||||
|
||||
### 更新本地包后需要重新 link
|
||||
|
||||
修改 `local-nodemodules/@cssyq/ggzc-web` 后,不需要重新 link。dist 目录的变动会被直接使用。
|
||||
82
setup.js
Normal file
82
setup.js
Normal file
@ -0,0 +1,82 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* 碳信网 Web 项目初始化脚本
|
||||
* 用法: node setup.js
|
||||
* 支持 Windows 和 Mac
|
||||
*/
|
||||
|
||||
const { execSync } = require('child_process');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
const ROOT = __dirname;
|
||||
const WEBS = ['txw-gxzx-web', 'txw-kxtfwzx-web', 'txw-mhzc-web', 'txw-tzzx-web', 'txw-ytzx-web', 'txw-yygl-web'];
|
||||
const LOCAL_PKG = 'local-nodemodules/@cssyq/ggzc-web';
|
||||
|
||||
function run(cmd, opts = {}) {
|
||||
console.log(` > ${cmd}`);
|
||||
try {
|
||||
execSync(cmd, { stdio: 'inherit', shell: true, ...opts });
|
||||
} catch (e) {
|
||||
console.error(` [失败] ${cmd}`);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
console.log('=== 碳信网 Web 项目初始化 ===\n');
|
||||
|
||||
for (const web of WEBS) {
|
||||
const webPath = path.join(ROOT, web);
|
||||
if (!fs.existsSync(webPath)) {
|
||||
console.warn(`[跳过] ${web} 目录不存在`);
|
||||
continue;
|
||||
}
|
||||
|
||||
console.log(`\n[${web}]`);
|
||||
|
||||
// 创建 symlink
|
||||
const cssyqDir = path.join(webPath, 'node_modules/@cssyq');
|
||||
const linkTarget = path.join(ROOT, LOCAL_PKG);
|
||||
const linkPath = path.join(cssyqDir, 'ggzc-web');
|
||||
|
||||
fs.mkdirSync(cssyqDir, { recursive: true });
|
||||
// 删除旧链接(可能已存在)
|
||||
// 删除旧链接
|
||||
if (fs.existsSync(linkPath)) {
|
||||
try {
|
||||
const stat = fs.lstatSync(linkPath);
|
||||
if (stat.isSymbolicLink() || stat.isDirectory()) {
|
||||
fs.rmSync(linkPath, { recursive: true, force: true });
|
||||
} else {
|
||||
fs.unlinkSync(linkPath);
|
||||
}
|
||||
} catch (e) {
|
||||
// 忽略删除失败,继续创建
|
||||
}
|
||||
}
|
||||
|
||||
// 创建 symlink
|
||||
const isWin = process.platform === 'win32';
|
||||
if (isWin) {
|
||||
try {
|
||||
fs.symlinkSync(linkTarget, linkPath, 'junction');
|
||||
} catch (e) {
|
||||
// junction 失败则用目录拷贝替代
|
||||
console.warn(` [警告] junction 失败,将复制替代链接`);
|
||||
run(`xcopy /E /I /Y "${linkTarget}" "${linkPath}"`);
|
||||
}
|
||||
} else {
|
||||
fs.symlinkSync(linkTarget, linkPath);
|
||||
}
|
||||
console.log(` 链接 @cssyq/ggzc-web -> ${LOCAL_PKG}`);
|
||||
|
||||
// 安装依赖
|
||||
console.log(' 安装依赖...');
|
||||
run(`cd "${webPath}" && yarn install --prefer-offline --ignore-engines`);
|
||||
}
|
||||
|
||||
console.log('\n=== 初始化完成 ===');
|
||||
console.log('\n启动开发服务示例:');
|
||||
for (const web of WEBS) {
|
||||
console.log(` cd ${web} && yarn dev`);
|
||||
}
|
||||
@ -1196,6 +1196,18 @@
|
||||
"@types/conventional-commits-parser" "^5.0.0"
|
||||
chalk "^5.3.0"
|
||||
|
||||
"@cssyq/ggzc-web@^1.0.7":
|
||||
version "1.0.8"
|
||||
resolved "http://10.23.10.90:4873/@cssyq%2fggzc-web/-/ggzc-web-1.0.8.tgz#aa73093ae02914fda1b283809eac031b09046d2e"
|
||||
integrity sha512-ERk8chEGrvMqMAn/ObYzenAQUeEWL5RRHBYDH+ueIKPl9g8mIMMcrwJNuK+OvNbvNti18RxkAURy6uaHoqnGSQ==
|
||||
dependencies:
|
||||
vue-cli-service "^5.0.10"
|
||||
|
||||
"@fortawesome/fontawesome-free@^7.0.1":
|
||||
version "7.2.0"
|
||||
resolved "https://registry.npmmirror.com/@fortawesome/fontawesome-free/-/fontawesome-free-7.2.0.tgz#188c1053ce422ad1f934d7df242a973fcb89636d"
|
||||
integrity sha512-3DguDv/oUE+7vjMeTSOjCSG+KeawgVQOHrKRnvUuqYh1mfArrh7s+s8hXW3e4RerBA1+Wh+hBqf8sJNpqNrBWg==
|
||||
|
||||
"@gar/promisify@^1.0.1":
|
||||
version "1.1.3"
|
||||
resolved "http://10.23.10.90:4873/@gar%2fpromisify/-/promisify-1.1.3.tgz#555193ab2e3bb3b6adc3d551c9c030d9e860daf6"
|
||||
@ -13237,6 +13249,11 @@ vue-cli-plugin-style-resources-loader@~0.1.5:
|
||||
resolved "http://10.23.10.90:4873/vue-cli-plugin-style-resources-loader/-/vue-cli-plugin-style-resources-loader-0.1.5.tgz#3e95f4df41f5408e1255664690698c0533648109"
|
||||
integrity sha512-LluhjWTZmpGl3tiXg51EciF+T70IN/9t6UvfmgluJBqxbrb6OV9i7L5lTd+OKtcTeghDkhcBmYhtTxxU4w/8sQ==
|
||||
|
||||
vue-cli-service@^5.0.10:
|
||||
version "5.0.10"
|
||||
resolved "http://10.23.10.90:4873/vue-cli-service/-/vue-cli-service-5.0.10.tgz#1ae10365dec4539358cb4860cd5876f93faf16e3"
|
||||
integrity sha512-j4+wxqjaHsgphWsQsDs0ET1TWSu+dW5syxk5MloTp6BsQ9dpN+SB0nq253thS6konMC+YiQLHxbf73ytrTHoRA==
|
||||
|
||||
vue-demi@^0.13.11:
|
||||
version "0.13.11"
|
||||
resolved "http://10.23.10.90:4873/vue-demi/-/vue-demi-0.13.11.tgz#7d90369bdae8974d87b1973564ad390182410d99"
|
||||
|
||||
@ -1196,6 +1196,11 @@
|
||||
"@types/conventional-commits-parser" "^5.0.0"
|
||||
chalk "^5.3.0"
|
||||
|
||||
"@fortawesome/fontawesome-free@^7.0.1":
|
||||
version "7.2.0"
|
||||
resolved "https://registry.npmmirror.com/@fortawesome/fontawesome-free/-/fontawesome-free-7.2.0.tgz#188c1053ce422ad1f934d7df242a973fcb89636d"
|
||||
integrity sha512-3DguDv/oUE+7vjMeTSOjCSG+KeawgVQOHrKRnvUuqYh1mfArrh7s+s8hXW3e4RerBA1+Wh+hBqf8sJNpqNrBWg==
|
||||
|
||||
"@gar/promisify@^1.0.1":
|
||||
version "1.1.3"
|
||||
resolved "http://10.23.10.90:4873/@gar%2fpromisify/-/promisify-1.1.3.tgz#555193ab2e3bb3b6adc3d551c9c030d9e860daf6"
|
||||
|
||||
22112
txw-mhzc-web/package-lock.json
generated
22112
txw-mhzc-web/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -9,7 +9,7 @@
|
||||
<template>
|
||||
<div class="cxssb-content">
|
||||
<!-- 头部导航栏 - 固定导航 -->
|
||||
<Nav style="z-index: 100;position: fixed;width: 100%;" />
|
||||
<Nav style="position: fixed;z-index: 100;width: 100%;" />
|
||||
|
||||
<!-- 主体内容区 -->
|
||||
<div class="main-page-content" :style="containerStyle">
|
||||
@ -423,8 +423,9 @@ export default {
|
||||
margin-right: 8px;
|
||||
}
|
||||
.main-page-content {
|
||||
background-color: #263238;
|
||||
overflow: auto;
|
||||
background-color: #263238;
|
||||
|
||||
/* 隐藏滚动条 */
|
||||
scrollbar-width: none; /* Firefox */
|
||||
-ms-overflow-style: none; /* IE 和 Edge */
|
||||
|
||||
@ -283,11 +283,11 @@ module.exports = {
|
||||
},
|
||||
proxy: {
|
||||
'/sso': {
|
||||
target: 'http://10.23.20.13:94/',
|
||||
target: 'http://carbon.liantu.tech',
|
||||
changeOrigin: true,
|
||||
},
|
||||
'/mhzc': {
|
||||
target: 'http://10.23.20.13:94/',
|
||||
target: 'http://carbon.liantu.tech',
|
||||
changeOrigin: true,
|
||||
},
|
||||
},
|
||||
|
||||
@ -1196,6 +1196,18 @@
|
||||
"@types/conventional-commits-parser" "^5.0.0"
|
||||
chalk "^5.3.0"
|
||||
|
||||
"@cssyq/ggzc-web@^1.0.7":
|
||||
version "1.0.8"
|
||||
resolved "http://10.23.10.90:4873/@cssyq%2fggzc-web/-/ggzc-web-1.0.8.tgz#aa73093ae02914fda1b283809eac031b09046d2e"
|
||||
integrity sha512-ERk8chEGrvMqMAn/ObYzenAQUeEWL5RRHBYDH+ueIKPl9g8mIMMcrwJNuK+OvNbvNti18RxkAURy6uaHoqnGSQ==
|
||||
dependencies:
|
||||
vue-cli-service "^5.0.10"
|
||||
|
||||
"@fortawesome/fontawesome-free@^7.0.1":
|
||||
version "7.2.0"
|
||||
resolved "https://registry.npmmirror.com/@fortawesome/fontawesome-free/-/fontawesome-free-7.2.0.tgz#188c1053ce422ad1f934d7df242a973fcb89636d"
|
||||
integrity sha512-3DguDv/oUE+7vjMeTSOjCSG+KeawgVQOHrKRnvUuqYh1mfArrh7s+s8hXW3e4RerBA1+Wh+hBqf8sJNpqNrBWg==
|
||||
|
||||
"@gar/promisify@^1.0.1":
|
||||
version "1.1.3"
|
||||
resolved "http://10.23.10.90:4873/@gar%2fpromisify/-/promisify-1.1.3.tgz#555193ab2e3bb3b6adc3d551c9c030d9e860daf6"
|
||||
@ -13237,6 +13249,11 @@ vue-cli-plugin-style-resources-loader@~0.1.5:
|
||||
resolved "http://10.23.10.90:4873/vue-cli-plugin-style-resources-loader/-/vue-cli-plugin-style-resources-loader-0.1.5.tgz#3e95f4df41f5408e1255664690698c0533648109"
|
||||
integrity sha512-LluhjWTZmpGl3tiXg51EciF+T70IN/9t6UvfmgluJBqxbrb6OV9i7L5lTd+OKtcTeghDkhcBmYhtTxxU4w/8sQ==
|
||||
|
||||
vue-cli-service@^5.0.10:
|
||||
version "5.0.10"
|
||||
resolved "http://10.23.10.90:4873/vue-cli-service/-/vue-cli-service-5.0.10.tgz#1ae10365dec4539358cb4860cd5876f93faf16e3"
|
||||
integrity sha512-j4+wxqjaHsgphWsQsDs0ET1TWSu+dW5syxk5MloTp6BsQ9dpN+SB0nq253thS6konMC+YiQLHxbf73ytrTHoRA==
|
||||
|
||||
vue-demi@^0.13.11:
|
||||
version "0.13.11"
|
||||
resolved "http://10.23.10.90:4873/vue-demi/-/vue-demi-0.13.11.tgz#7d90369bdae8974d87b1973564ad390182410d99"
|
||||
|
||||
22112
txw-tzzx-web/package-lock.json
generated
22112
txw-tzzx-web/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1196,6 +1196,11 @@
|
||||
"@types/conventional-commits-parser" "^5.0.0"
|
||||
chalk "^5.3.0"
|
||||
|
||||
"@fortawesome/fontawesome-free@^7.0.1":
|
||||
version "7.2.0"
|
||||
resolved "https://registry.npmmirror.com/@fortawesome/fontawesome-free/-/fontawesome-free-7.2.0.tgz#188c1053ce422ad1f934d7df242a973fcb89636d"
|
||||
integrity sha512-3DguDv/oUE+7vjMeTSOjCSG+KeawgVQOHrKRnvUuqYh1mfArrh7s+s8hXW3e4RerBA1+Wh+hBqf8sJNpqNrBWg==
|
||||
|
||||
"@gar/promisify@^1.0.1":
|
||||
version "1.1.3"
|
||||
resolved "http://10.23.10.90:4873/@gar%2fpromisify/-/promisify-1.1.3.tgz#555193ab2e3bb3b6adc3d551c9c030d9e860daf6"
|
||||
|
||||
@ -1196,6 +1196,11 @@
|
||||
"@types/conventional-commits-parser" "^5.0.0"
|
||||
chalk "^5.3.0"
|
||||
|
||||
"@fortawesome/fontawesome-free@^7.0.1":
|
||||
version "7.2.0"
|
||||
resolved "https://registry.npmmirror.com/@fortawesome/fontawesome-free/-/fontawesome-free-7.2.0.tgz#188c1053ce422ad1f934d7df242a973fcb89636d"
|
||||
integrity sha512-3DguDv/oUE+7vjMeTSOjCSG+KeawgVQOHrKRnvUuqYh1mfArrh7s+s8hXW3e4RerBA1+Wh+hBqf8sJNpqNrBWg==
|
||||
|
||||
"@gar/promisify@^1.0.1":
|
||||
version "1.1.3"
|
||||
resolved "http://10.23.10.90:4873/@gar%2fpromisify/-/promisify-1.1.3.tgz#555193ab2e3bb3b6adc3d551c9c030d9e860daf6"
|
||||
|
||||
@ -1196,6 +1196,11 @@
|
||||
"@types/conventional-commits-parser" "^5.0.0"
|
||||
chalk "^5.3.0"
|
||||
|
||||
"@fortawesome/fontawesome-free@^7.0.1":
|
||||
version "7.2.0"
|
||||
resolved "https://registry.npmmirror.com/@fortawesome/fontawesome-free/-/fontawesome-free-7.2.0.tgz#188c1053ce422ad1f934d7df242a973fcb89636d"
|
||||
integrity sha512-3DguDv/oUE+7vjMeTSOjCSG+KeawgVQOHrKRnvUuqYh1mfArrh7s+s8hXW3e4RerBA1+Wh+hBqf8sJNpqNrBWg==
|
||||
|
||||
"@gar/promisify@^1.0.1":
|
||||
version "1.1.3"
|
||||
resolved "http://10.23.10.90:4873/@gar%2fpromisify/-/promisify-1.1.3.tgz#555193ab2e3bb3b6adc3d551c9c030d9e860daf6"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user