Skip to content

Commit

Permalink
feat: 平台管理-代码源管理 TencentBlueKing#11379
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 28960
  • Loading branch information
vhwweng committed Jan 9, 2025
1 parent 6ef228b commit aa1b83a
Show file tree
Hide file tree
Showing 22 changed files with 2,587 additions and 783 deletions.
3 changes: 2 additions & 1 deletion src/frontend/devops-nav/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@
} else if ([
/^\/console\/store\/(\w+)?/,
/^\/console\/permission\/(\w+)?/,
/^\/console\/manage\/apply/
/^\/console\/manage\/apply/,
/^\/console\/platform\/(\w+)?/,
].some((reg) => location.pathname.match(reg))) {
// TODO store、permission、apply project 没有projectId
return ''
Expand Down
24 changes: 24 additions & 0 deletions src/frontend/devops-platform/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
5 changes: 5 additions & 0 deletions src/frontend/devops-platform/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Vue 3 + Vite

This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.

Learn more about IDE Support for Vue in the [Vue Docs Scaling up Guide](https://vuejs.org/guide/scaling-up/tooling.html#ide-support).
12 changes: 12 additions & 0 deletions src/frontend/devops-platform/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>平台管理</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
41 changes: 41 additions & 0 deletions src/frontend/devops-platform/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "devops-paltform",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"bkui-vue": "1.0.3-beta.9",
"vue": "^3.5.13",
"vue-i18n": "^9.10.2",
"vue-router": "^4.3.0",
"pinia": "^2.1.7",
"dayjs": "^1.11.2",
"lodash": "^4.17.21"
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.2.1",
"@vitejs/plugin-vue-jsx": "^3.1.0",
"@rushstack/eslint-patch": "^1.3.3",
"@tsconfig/node20": "^20.1.2",
"@types/jsdom": "^21.1.6",
"@types/node": "^20.11.28",
"@vue/eslint-config-prettier": "^8.0.0",
"@vue/eslint-config-typescript": "^12.0.0",
"@vue/test-utils": "^2.4.5",
"@vue/tsconfig": "^0.5.1",
"lodash-es": "^4.17.21",
"eslint": "^8.49.0",
"eslint-plugin-vue": "^9.17.0",
"eslint-plugin-cypress": "^2.15.1",
"typescript": "~5.4.0",
"jsdom": "^24.0.0",
"vite-plugin-vue-devtools": "^7.0.18",
"vite": "^6.0.5",
"start-server-and-test": "^2.0.3"
}
}
1 change: 1 addition & 0 deletions src/frontend/devops-platform/public/vite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions src/frontend/devops-platform/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { ConfigProvider } from 'bkui-vue';
import { computed, defineComponent } from 'vue';
import { RouterView } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { EN_LOCALE } from './i18n';
import enLang from 'bkui-vue/dist/locale/en.esm';
import zhLang from 'bkui-vue/dist/locale/zh-cn.esm';

export default defineComponent({
name: 'App',
setup() {
const { locale } = useI18n();
const lang = computed(() => {
if (locale.value === EN_LOCALE) {
return enLang;
}
return zhLang;
});
return () => (
<div>123</div>
);
},
});

61 changes: 61 additions & 0 deletions src/frontend/devops-platform/src/common/util.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import dayjs from 'dayjs';

// 获取 cookie
export function getCookie(name: string): string {
try {
const decodedCookie = decodeURIComponent(document.cookie);
const cookies = decodedCookie.split(';');
for (const cookie of cookies) {
const [key, value] = cookie.trim().split('=');
if (key === name) {
return value;
}
}
return '';
} catch (e) {
console.error('get cookie error', e);
return '';
}
}

/**
* 检查是不是 object 类型
* @param item
* @returns {boolean}
*/
export function isObject(item: any) {
return Object.prototype.toString.apply(item) === '[object Object]';
}


/**
* 深度合并多个对象
* @param objectArray 待合并列表
* @returns {object} 合并后的对象
*/
export function deepMerge(...objectArray: object[]) {
return objectArray.reduce((acc, obj) => {
Object.keys(obj || {}).forEach((key) => {
const pVal = acc[key];
const oVal = obj[key];

if (isObject(pVal) && isObject(oVal)) {
acc[key] = deepMerge(pVal, oVal);
} else {
acc[key] = oVal;
}
});

return acc;
}, {});
}

/**
* 时间格式化
* @param val 待格式化时间
* @param format 格式
* @returns 格式化后的时间
*/
export function timeFormatter(val: string, format = 'YYYY-MM-DD HH:mm:ss') {
return val ? dayjs(val).format(format) : '--';
}
Empty file.
2 changes: 2 additions & 0 deletions src/frontend/devops-platform/src/css/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@import url(./main.css);
@import url(./reset.css);
15 changes: 15 additions & 0 deletions src/frontend/devops-platform/src/css/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
background: #f5f7fb;
color: #63656e;
font-size: 12px;
text-align: left;
width: 100vw;
height: 100vh;
overflow: auto;
display: flex;
flex-direction: column;
}
Loading

0 comments on commit aa1b83a

Please sign in to comment.