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"
},
"dependencies": {
"@cool-vue/crud": "^7.1.26",
"@cool-vue/crud": "^7.1.27",
"@element-plus/icons-vue": "^2.3.1",
"@vueuse/core": "^10.4.0",
"@wangeditor/editor": "^5.1.23",
@ -38,7 +38,7 @@
},
"devDependencies": {
"@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/lodash-es": "^4.17.8",
"@types/mockjs": "^1.0.7",

View File

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

View File

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

View File

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

View File

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

View File

@ -694,7 +694,9 @@
}
async function createCtx() {
let ctx = {};
let ctx = {
serviceLang: "Node",
};
if (config.type == "app") {
const manifest = readFile(rootDir("manifest.json"), true);
// 文件路径
@ -753,6 +755,22 @@
if (config.type == "admin") {
const list = fs.readdirSync(rootDir("./src/modules"));
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;
}

View File

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

View File

@ -1,13 +1,16 @@
import { join } from "path";
import { readFile, rootDir, writeFile } from "../utils";
import { readFile, rootDir, writeFile, error } from "../utils";
import { glob } from "glob";
import { assign, cloneDeep, isEqual, orderBy } from "lodash";
import { config } from "../config";
import fs from "fs";
import axios from "axios";
import type { Ctx } from "../../types";
export async function createCtx() {
let ctx: Ctx.Data = {};
let ctx: Ctx.Data = {
serviceLang: "Node",
};
if (config.type == "app") {
const manifest = readFile(rootDir("manifest.json"), true);
@ -82,6 +85,23 @@ export async function createCtx() {
if (config.type == "admin") {
const list = fs.readdirSync(rootDir("./src/modules"));
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;

View File

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

View File

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