This commit is contained in:
神仙都没用 2024-07-27 15:38:50 +08:00
parent 2ffacc2041
commit 3e2060dd8c
10 changed files with 55 additions and 12 deletions

View File

@ -9,7 +9,7 @@
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .eslintignore" "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .eslintignore"
}, },
"dependencies": { "dependencies": {
"@cool-vue/crud": "^7.1.26", "@cool-vue/crud": "^7.1.27",
"@element-plus/icons-vue": "^2.3.1", "@element-plus/icons-vue": "^2.3.1",
"@vueuse/core": "^10.4.0", "@vueuse/core": "^10.4.0",
"@wangeditor/editor": "^5.1.23", "@wangeditor/editor": "^5.1.23",
@ -38,7 +38,7 @@
}, },
"devDependencies": { "devDependencies": {
"@rushstack/eslint-patch": "^1.8.0", "@rushstack/eslint-patch": "^1.8.0",
"@cool-vue/vite-plugin": "^7.1.6", "@cool-vue/vite-plugin": "^7.1.7",
"@types/file-saver": "^2.0.7", "@types/file-saver": "^2.0.7",
"@types/lodash-es": "^4.17.8", "@types/lodash-es": "^4.17.8",
"@types/mockjs": "^1.0.7", "@types/mockjs": "^1.0.7",

View File

@ -1,6 +1,6 @@
{ {
"name": "@cool-vue/crud", "name": "@cool-vue/crud",
"version": "7.1.26", "version": "7.1.27",
"private": false, "private": false,
"main": "./dist/index.umd.min.js", "main": "./dist/index.umd.min.js",
"typings": "types/index.d.ts", "typings": "types/index.d.ts",

View File

@ -508,6 +508,9 @@
} }
.cl-dialog { .cl-dialog {
display: flex;
flex-direction: column;
&.el-dialog { &.el-dialog {
border-radius: 6px; border-radius: 6px;
padding: 0; padding: 0;

View File

@ -1,5 +1,5 @@
/// <reference types="../index" /> /// <reference types="../index" />
import { App } from "vue"; import type { App } from "vue";
import "./static/index.scss"; import "./static/index.scss";
declare const Crud: { declare const Crud: {
install(app: App, options?: Options): { install(app: App, options?: Options): {

View File

@ -1,3 +1,3 @@
/// <reference types="../index" /> /// <reference types="../index" />
import { App } from "vue"; import { type App } from "vue";
export declare function useProvide(app: App, options?: Options): void; export declare function useProvide(app: App, options?: Options): void;

View File

@ -694,7 +694,9 @@
} }
async function createCtx() { async function createCtx() {
let ctx = {}; let ctx = {
serviceLang: "Node",
};
if (config.type == "app") { if (config.type == "app") {
const manifest = readFile(rootDir("manifest.json"), true); const manifest = readFile(rootDir("manifest.json"), true);
// 文件路径 // 文件路径
@ -753,6 +755,22 @@
if (config.type == "admin") { if (config.type == "admin") {
const list = fs.readdirSync(rootDir("./src/modules")); const list = fs.readdirSync(rootDir("./src/modules"));
ctx.modules = list.filter((e) => !e.includes(".")); ctx.modules = list.filter((e) => !e.includes("."));
await axios
.get(config.reqUrl + "/admin/base/comm/program", {
timeout: 5000,
})
.then((res) => {
const { code, data, message } = res.data;
if (code === 1000) {
ctx.serviceLang = data || "Node";
}
else {
error(`[cool-ctx] ${message}`);
}
})
.catch((err) => {
// console.error(['[cool-ctx] ', err.message])
});
} }
return ctx; return ctx;
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@cool-vue/vite-plugin", "name": "@cool-vue/vite-plugin",
"version": "7.1.6", "version": "7.1.7",
"description": "cool-admin/cool-uni builder", "description": "cool-admin/cool-uni builder",
"main": "/dist/index.js", "main": "/dist/index.js",
"scripts": { "scripts": {

View File

@ -1,13 +1,16 @@
import { join } from "path"; import { join } from "path";
import { readFile, rootDir, writeFile } from "../utils"; import { readFile, rootDir, writeFile, error } from "../utils";
import { glob } from "glob"; import { glob } from "glob";
import { assign, cloneDeep, isEqual, orderBy } from "lodash"; import { assign, cloneDeep, isEqual, orderBy } from "lodash";
import { config } from "../config"; import { config } from "../config";
import fs from "fs"; import fs from "fs";
import axios from "axios";
import type { Ctx } from "../../types"; import type { Ctx } from "../../types";
export async function createCtx() { export async function createCtx() {
let ctx: Ctx.Data = {}; let ctx: Ctx.Data = {
serviceLang: "Node",
};
if (config.type == "app") { if (config.type == "app") {
const manifest = readFile(rootDir("manifest.json"), true); const manifest = readFile(rootDir("manifest.json"), true);
@ -82,6 +85,23 @@ export async function createCtx() {
if (config.type == "admin") { if (config.type == "admin") {
const list = fs.readdirSync(rootDir("./src/modules")); const list = fs.readdirSync(rootDir("./src/modules"));
ctx.modules = list.filter((e) => !e.includes(".")); ctx.modules = list.filter((e) => !e.includes("."));
await axios
.get(config.reqUrl + "/admin/base/comm/program", {
timeout: 5000,
})
.then((res) => {
const { code, data, message } = res.data;
if (code === 1000) {
ctx.serviceLang = data || "Node";
} else {
error(`[cool-ctx] ${message}`);
}
})
.catch((err) => {
// console.error(['[cool-ctx] ', err.message])
});
} }
return ctx; return ctx;

View File

@ -54,6 +54,7 @@ export namespace Ctx {
pages?: Ctx.Pages; pages?: Ctx.Pages;
subPackages?: Ctx.SubPackages; subPackages?: Ctx.SubPackages;
modules?: string[]; modules?: string[];
serviceLang: "Node" | "Java" | "Go" | "Python";
[key: string]: any; [key: string]: any;
} }
} }

View File

@ -296,6 +296,7 @@ import { sleep, storage } from "/@/cool/utils";
import dayjs from "dayjs"; import dayjs from "dayjs";
import type { CodeItem, EpsColumn } from "../types"; import type { CodeItem, EpsColumn } from "../types";
import { useClipboard } from "@vueuse/core"; import { useClipboard } from "@vueuse/core";
import { ctx } from "virtual:ctx";
const { service, refs, setRefs, router } = useCool(); const { service, refs, setRefs, router } = useCool();
const menu = useMenu(); const menu = useMenu();
@ -369,10 +370,10 @@ const step = reactive({
// //
const lang = reactive({ const lang = reactive({
value: "Node" as "Node" | "Java" | "Go" | "Python", value: "Node",
async get() { get() {
lang.value = await service.base.comm.program(); lang.value = ctx.serviceLang;
code.active = lang.value.toLocaleLowerCase() + "-entity"; code.active = lang.value.toLocaleLowerCase() + "-entity";
}, },