@lixianwei/elpis 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,5 @@
1
+ module.exports =(app)=>{
2
+ const {db:dbConfig} = app.config;
3
+ if(!dbConfig){ return; }
4
+ return require('knex')(dbConfig);
5
+ }
@@ -3,7 +3,11 @@ const md5 =require('md5');
3
3
  * API 签名合法性校验
4
4
  * */
5
5
  module.exports =(app)=>{
6
- return async(ctx, next)=>{
6
+ return async(ctx, next)=>{
7
+ // 校验白名单
8
+ if(app.config?.apiSignVerify.whiteList.includes(ctx.path)){
9
+ return await next();
10
+ }
7
11
  // 只对api请求进行校验
8
12
  if(ctx.path.indexOf('/api') < 0){
9
13
  return await next();
package/app/middleware.js CHANGED
@@ -1,7 +1,9 @@
1
1
  const path = require('path');
2
+
2
3
  module.exports =(app)=>{
3
4
  // 配置静态根目录
4
- const KoaStatic = require('koa-static');
5
+ const KoaStatic = require("koa-static");
6
+ app.use(KoaStatic(path.resolve(__dirname, './public')));
5
7
  app.use(KoaStatic(path.resolve(process.cwd(), './app/public')));
6
8
 
7
9
  // 模板引擎渲染
@@ -56,7 +56,7 @@ const show = (rowData)=>{
56
56
  const fetchFormData = async ()=>{
57
57
  if(loading.value){return}
58
58
  loading.value = true
59
- const res = await $curl({
59
+ const res = await $curl({
60
60
  method: 'get',
61
61
  url:api.value,
62
62
  query:{
@@ -94,6 +94,13 @@ defineExpose({
94
94
  }
95
95
  .item-value{
96
96
  color: #d2dae4;
97
+ display: block;
98
+ width: 250px;
99
+ overflow: hidden;
100
+ text-overflow: ellipsis;
101
+ white-space: nowrap;
102
+ word-break: break-all;
103
+ overflow-wrap:break-word;
97
104
  }
98
105
  }
99
106
 
@@ -58,6 +58,7 @@ export const useSchema = function (){
58
58
  }
59
59
  }
60
60
  components.value = dtoComponents
61
+
61
62
  }
62
63
 
63
64
  })
@@ -13,16 +13,10 @@
13
13
  <el-row type="flex" align="middle" justify="end" class="setting-panel">
14
14
  <!-- 插槽设置区域-->
15
15
  <slot name="setting-content"></slot>
16
- <img src="./asserts/avatar.png" alt="" class="avatar">
17
- <el-dropdown @command="handleUserCommand">
18
- <span class="username">
19
- {{userName}}
20
- <i class="el-icon-arrow-down el-icon--right"></i>
21
- </span>
22
- <template #dropdown>
23
- <el-dropdown-item command="logout">退出登录</el-dropdown-item>
24
- </template>
25
- </el-dropdown>
16
+ <component
17
+ v-if="BusinessHeaderConfig?.userPanel"
18
+ :is="BusinessHeaderConfig?.userPanel?.component"
19
+ ></component>
26
20
  </el-row>
27
21
  </el-row>
28
22
  </el-header>
@@ -34,16 +28,12 @@
34
28
  </template>
35
29
 
36
30
  <script setup>
37
- import {ref} from 'vue';
31
+ import BusinessHeaderConfig from '$businessHeaderConfig'
38
32
  defineProps({
39
33
  title: String,
40
34
  })
41
35
 
42
- const userName = ref('管理员')
43
36
 
44
- const handleUserCommand =(e)=>{
45
- console.log(e)
46
- }
47
37
  </script>
48
38
 
49
39
 
@@ -76,20 +66,7 @@ const handleUserCommand =(e)=>{
76
66
  .setting-panel{
77
67
  margin-left: auto;
78
68
  min-width: 180px;
79
- .avatar{
80
- margin-right: 10px;
81
- width: 30px;
82
- height: 30px;
83
- border-radius: 50%;
84
- }
85
- .username{
86
- font-size: 16px;
87
- font-weight: 500;
88
- cursor: pointer;
89
- height: 60px;
90
- line-height: 60px;
91
- outline: none;
92
- }
69
+
93
70
  }
94
71
 
95
72
  }
@@ -138,6 +138,11 @@ module.exports= merge.smart({
138
138
  // 业务 search -bar 配置扩展
139
139
  const businessSchemaSearchBar = path.resolve(process.cwd(),'./app/pages/widgets/schema-search-bar/search-item-config.js');
140
140
  aliasMap['$businessSearchItemConfig'] = fs.existsSync(businessSchemaSearchBar) ? businessSchemaSearchBar:blankModulePath
141
+
142
+ //header-container 扩展配置
143
+ const businessHeaderConfig = path.resolve(process.cwd(),'./app/pages/widgets/header-container/header-config.js');
144
+ aliasMap['$businessHeaderConfig'] = fs.existsSync(businessHeaderConfig) ? businessHeaderConfig:blankModulePath
145
+
141
146
  return {
142
147
  'vue':require.resolve('vue'),
143
148
  '@babel/runtime/helpers/asyncToGenerator':require.resolve('@babel/runtime/helpers/asyncToGenerator'),
@@ -10,13 +10,11 @@ module.exports = () => {
10
10
  // 从webpack.dev.js获取webpack配置和devServer配置
11
11
  const {webpackConfig,DEV_SERVER_CONFIG} = require('./config/webpack.dev.js');
12
12
 
13
- console.log('9999',webpackConfig)
14
-
15
13
  const app = express();
16
14
 
17
15
  const compiler = webpack(webpackConfig);
18
16
  // 指定静态文件目录
19
- app.use(express.static(path.join(__dirname, '../public/dist')));
17
+ app.use(express.static(path.join(process.cwd(), './app/public/dist')));
20
18
  // 引用devMiddleware 中间件(监控文件改动)
21
19
  app.use(devMiddleware(compiler, {
22
20
  // 落地文件
@@ -1,7 +1,6 @@
1
1
  const webpack = require('webpack')
2
2
  const webpackProdConfig = require('./config/webpack.prod.js')
3
3
  module.exports = () => {
4
- console.log('building...')
5
4
  webpack(webpackProdConfig,(err, stats) => {
6
5
  if (err) {
7
6
  console.log(err)
@@ -34,7 +34,7 @@ module.exports ={
34
34
 
35
35
  // 初始化环境配置
36
36
  app.env = env();
37
- console.log(`----${app.env.get()}---`);
37
+ // console.log(`----${app.env.get()}---`);
38
38
  // 加载config
39
39
  configLoader(app)
40
40
  console.log(`----start config-----`);
@@ -19,7 +19,7 @@ module.exports = (app) => {
19
19
 
20
20
  // 业务config目录及相关文件
21
21
  const businessConfigPath = path.resolve(process.cwd(),`.${sep}config`);
22
- console.log(businessConfigPath)
22
+ // console.log(businessConfigPath)
23
23
 
24
24
  // 获取default.config
25
25
  try{
@@ -28,7 +28,7 @@ module.exports = (app) => {
28
28
  ...require(path.resolve(businessConfigPath,`.${sep}config.default.js`))
29
29
  }
30
30
  }catch(e){
31
- console.log('there is no default.config file')
31
+ console.log('[exception] default.config file exception')
32
32
  }
33
33
 
34
34
  // 获取env.config
@@ -46,7 +46,7 @@ module.exports = (app) => {
46
46
  console.log(envConfig,'_ENV')
47
47
  }
48
48
  }catch(e){
49
- console.log('there is no config file')
49
+ console.log('[exception] env.config file exception')
50
50
  }
51
51
  // 覆盖并加载config配置
52
52
  app.config = Object.assign({},defaultConfig,envConfig);
package/package.json CHANGED
@@ -1,12 +1,11 @@
1
1
  {
2
2
  "name": "@lixianwei/elpis",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "test": "cross-env _ENV=local mocha test/**/*.js",
8
8
  "lint": "eslint --quiet --ext js,vue ."
9
-
10
9
  },
11
10
  "repository": {
12
11
  "type": "git",
@@ -16,14 +15,28 @@
16
15
  "license": "ISC",
17
16
  "dependencies": {
18
17
  "@babel/core": "^7.24.0",
18
+ "@babel/plugin-transform-runtime": "^7.1.0",
19
+ "@babel/preset-env": "^7.4.5",
19
20
  "@babel/runtime": "^7.24.0",
20
21
  "@element-plus/icons-vue": "^2.3.2",
21
22
  "ajv": "^6.10.2",
22
23
  "axios": "^0.19.2",
24
+ "babel-loader": "^8.0.4",
25
+ "clean-webpack-plugin": "^0.1.19",
26
+ "consoler": "^0.2.0",
27
+ "cross-env": "^10.1.0",
28
+ "css-loader": "^0.23.1",
29
+ "css-minimizer-webpack-plugin": "^5.0.1",
30
+ "directory-named-webpack-plugin": "^4.0.1",
23
31
  "echarts": "^5.5.0",
24
32
  "element-plus": "^2.3.7",
33
+ "express": "^4.18.2",
34
+ "file-loader": "^6.2.0",
25
35
  "generate-password": "^1.7.1",
26
36
  "glob": "^7.1.4",
37
+ "happypack": "^5.0.1",
38
+ "html-webpack-inject-attributes-plugin": "^1.0.1",
39
+ "html-webpack-plugin": "^5.5.3",
27
40
  "jsonwebtoken": "^9.0.2",
28
41
  "knex": "^0.19.0",
29
42
  "koa": "2.7.0",
@@ -34,41 +47,27 @@
34
47
  "koa-useragent": "2.0.0",
35
48
  "koa2-cors": "^2.0.6",
36
49
  "less": "^3.8.1",
50
+ "less-loader": "^11.1.3",
37
51
  "lodash": "^4.17.21",
38
52
  "log4js": "^6.9.1",
39
53
  "md5": "^2.2.1",
54
+ "mini-css-extract-plugin": "^2.7.6",
40
55
  "moment": "^2.29.4",
41
56
  "mysql": "^2.18.1",
42
57
  "node-schedule": "^2.1.1",
43
58
  "nodemon": "^1.19.2",
44
59
  "path": "^0.12.7",
45
60
  "pinia": "^2.1.6",
46
- "superagent": "^8.1.2",
47
- "vue": "^3.3.4",
48
- "vue-json-viewer": "^3.0.4",
49
- "vue-router": "^4.2.4",
50
- "vuex": "^4.1.0",
51
- "@babel/plugin-transform-runtime": "^7.1.0",
52
- "@babel/preset-env": "^7.4.5",
53
- "babel-loader": "^8.0.4",
54
- "clean-webpack-plugin": "^0.1.19",
55
- "consoler": "^0.2.0",
56
- "cross-env": "^10.1.0",
57
- "css-loader": "^0.23.1",
58
- "css-minimizer-webpack-plugin": "^5.0.1",
59
- "directory-named-webpack-plugin": "^4.0.1",
60
- "express": "^4.18.2",
61
- "file-loader": "^6.2.0",
62
- "happypack": "^5.0.1",
63
- "html-webpack-inject-attributes-plugin": "^1.0.1",
64
- "html-webpack-plugin": "^5.5.3",
65
- "less-loader": "^11.1.3",
66
- "mini-css-extract-plugin": "^2.7.6",
67
61
  "style-loader": "^0.14.1",
62
+ "superagent": "^8.1.2",
68
63
  "terser-webpack-plugin": "^5.6.1",
69
64
  "url-loader": "^4.1.1",
65
+ "vue": "^3.3.4",
66
+ "vue-json-viewer": "^3.0.4",
70
67
  "vue-loader": "^17.2.2",
68
+ "vue-router": "^4.2.4",
71
69
  "vue-style-loader": "^4.1.2",
70
+ "vuex": "^4.1.0",
72
71
  "webpack": "^5.88.1",
73
72
  "webpack-dev-middleware": "^6.1.1",
74
73
  "webpack-hot-middleware": "^2.25.4",