+
-
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/initializer-ui/src/components/starter.vue b/initializer-ui/src/components/starter.vue
new file mode 100644
index 0000000..65c8c42
--- /dev/null
+++ b/initializer-ui/src/components/starter.vue
@@ -0,0 +1,182 @@
+
+
+
+
项目初始代码生成
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 生成
+ 预览
+ 下载
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/initializer-ui/src/index.css b/initializer-ui/src/index.css
new file mode 100644
index 0000000..d75858f
--- /dev/null
+++ b/initializer-ui/src/index.css
@@ -0,0 +1,8 @@
+#app {
+ font-family: Avenir, Helvetica, Arial, sans-serif;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+ text-align: center;
+ color: #2c3e50;
+ margin-top: 60px;
+}
\ No newline at end of file
diff --git a/initializer-ui/src/main.js b/initializer-ui/src/main.js
deleted file mode 100644
index 139ecb9..0000000
--- a/initializer-ui/src/main.js
+++ /dev/null
@@ -1,8 +0,0 @@
-import {createApp} from 'vue'
-import ElementPlus from 'element-plus'
-import 'element-plus/dist/index.css'
-import App from './App.vue'
-
-const app = createApp(App)
-app.use(ElementPlus)
-app.mount('#app')
\ No newline at end of file
diff --git a/initializer-ui/src/main.ts b/initializer-ui/src/main.ts
new file mode 100644
index 0000000..59c1e47
--- /dev/null
+++ b/initializer-ui/src/main.ts
@@ -0,0 +1,5 @@
+import {createApp} from 'vue'
+import App from './App.vue'
+import './index.css'
+
+createApp(App).mount('#app')
\ No newline at end of file
diff --git a/initializer-ui/src/models/BaseResponse.ts b/initializer-ui/src/models/BaseResponse.ts
new file mode 100644
index 0000000..ef54e5d
--- /dev/null
+++ b/initializer-ui/src/models/BaseResponse.ts
@@ -0,0 +1,9 @@
+import {AxiosResponse} from "axios";
+
+export default interface BaseResponse extends AxiosResponse {
+ code?: number
+ action?: number
+ message?: string
+ uuid?: string
+ result?: T
+}
\ No newline at end of file
diff --git a/initializer-ui/src/shims-vue.d.ts b/initializer-ui/src/shims-vue.d.ts
new file mode 100644
index 0000000..8342608
--- /dev/null
+++ b/initializer-ui/src/shims-vue.d.ts
@@ -0,0 +1,6 @@
+declare module '*.vue' {
+ import type {DefineComponent} from 'vue'
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
+ const component: DefineComponent<{}, {}, any>
+ export default component
+}
\ No newline at end of file
diff --git a/initializer-ui/src/util/loading.js b/initializer-ui/src/util/loading.js
deleted file mode 100644
index 85a1f67..0000000
--- a/initializer-ui/src/util/loading.js
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * 全局loading效果:合并多次loading请求,避免重复请求
- * 当调用一次showLoading,则次数+1;当次数为0时,则显示loading
- * 当调用一次hideLoading,则次数-1; 当次数为0时,则结束loading
- */
-import {ElLoading} from 'element-plus';
-
-// 定义一个请求次数的变量,用来记录当前页面总共请求的次数
-let loadingRequestCount = 0;
-// 初始化loading
-let loadingInstance;
-
-// 编写一个显示loading的函数 并且记录请求次数 ++
-const showLoading = () => {
- if (loadingRequestCount === 0) {
- loadingInstance = ElLoading.service({});
- }
- loadingRequestCount++
-}
-
-// 编写一个隐藏loading的函数,并且记录请求次数 --
-const hideLoading = () => {
- if (loadingRequestCount <= 0) return
- loadingRequestCount--
- if (loadingRequestCount === 0) {
- loadingInstance.close();
- }
-}
-
-export {
- showLoading,
- hideLoading
-}
\ No newline at end of file
diff --git a/initializer-ui/src/util/request.js b/initializer-ui/src/util/request.js
deleted file mode 100644
index fa40f55..0000000
--- a/initializer-ui/src/util/request.js
+++ /dev/null
@@ -1,32 +0,0 @@
-import axios from 'axios';
-import {hideLoading, showLoading} from './loading'
-
-const envDict = {
- 'development': 'http://localhost:8080',
- 'production': 'https://start.develop.schbrain.com'
-}
-
-axios.defaults.baseURL = envDict[process.env.NODE_ENV]
-axios.defaults.timeout = 10000
-
-const service = axios.create()
-
-service.interceptors.request.use(config => {
- showLoading()
- return config
-})
-
-service.interceptors.response.use(response => {
- hideLoading()
- if (response.headers['content-type'] === 'application/json') {
- if (response.data.code !== 0) {
- return Promise.reject(response);
- }
- }
- return response
-}, error => {
- hideLoading()
- return Promise.reject(error)
-})
-
-export default service
\ No newline at end of file
diff --git a/initializer-ui/src/utils/request.ts b/initializer-ui/src/utils/request.ts
new file mode 100644
index 0000000..ac3debd
--- /dev/null
+++ b/initializer-ui/src/utils/request.ts
@@ -0,0 +1,22 @@
+import type {AxiosResponse} from "axios";
+import axios from "axios";
+import {message} from "ant-design-vue";
+
+// @ts-ignore
+axios.defaults.baseURL = import.meta.env.VITE_APP_BASE_URL
+axios.interceptors.response.use((config: AxiosResponse) => {
+ const {data} = config
+ if (config.headers['content-type'] === 'application/json') {
+ switch (data.code) {
+ case 0:
+ return Promise.resolve(data)
+ default:
+ message.error(data.message)
+ return Promise.reject(data)
+ }
+ } else {
+ return Promise.resolve(config)
+ }
+})
+
+export default axios
\ No newline at end of file
diff --git a/initializer-ui/tsconfig.json b/initializer-ui/tsconfig.json
new file mode 100644
index 0000000..92110fa
--- /dev/null
+++ b/initializer-ui/tsconfig.json
@@ -0,0 +1,25 @@
+{
+ "compilerOptions": {
+ "target": "esnext",
+ "module": "esnext",
+ "moduleResolution": "node",
+ "strict": true,
+ "jsx": "preserve",
+ "sourceMap": true,
+ "resolveJsonModule": true,
+ "esModuleInterop": true,
+ "lib": [
+ "esnext",
+ "dom"
+ ],
+ "types": [
+ "vite/client"
+ ]
+ },
+ "include": [
+ "src/**/*.ts",
+ "src/**/*.d.ts",
+ "src/**/*.tsx",
+ "src/**/*.vue"
+ ]
+}
\ No newline at end of file
diff --git a/initializer-ui/vite.config.ts b/initializer-ui/vite.config.ts
new file mode 100644
index 0000000..67cd5b7
--- /dev/null
+++ b/initializer-ui/vite.config.ts
@@ -0,0 +1,47 @@
+import Components from 'unplugin-vue-components/vite'
+import {AntDesignVueResolver} from 'unplugin-vue-components/resolvers'
+import styleImport, {AndDesignVueResolve, AntdResolve} from 'vite-plugin-style-import'
+import {defineConfig} from 'vite'
+// @ts-ignore
+import vue from '@vitejs/plugin-vue'
+
+export default defineConfig({
+ plugins: [
+ vue(),
+ // antd自动按需引入
+ Components({
+ resolvers: [
+ AntDesignVueResolver(),
+ ]
+ }),
+ // @ts-ignore
+ styleImport({
+ resolves: [
+ AndDesignVueResolve(),
+ AntdResolve()
+ ],
+ // 自定义规则
+ libs: [
+ {
+ libraryName: 'ant-design-vue',
+ esModule: true,
+ resolveStyle: (name: any) => {
+ return `ant-design-vue/es/${name}/style/index`
+ }
+ }
+ ]
+ })
+ ],
+ // 引用使用less的库要配置一下
+ css: {
+ preprocessorOptions: {
+ less: {
+ javascriptEnabled: true
+ }
+ }
+ },
+ // 让terminal显示network地址
+ server: {
+ host: '0.0.0.0'
+ }
+})
\ No newline at end of file
diff --git a/initializer-ui/vue.config.js b/initializer-ui/vue.config.js
deleted file mode 100644
index 70cc474..0000000
--- a/initializer-ui/vue.config.js
+++ /dev/null
@@ -1,6 +0,0 @@
-const {defineConfig} = require('@vue/cli-service')
-
-module.exports = defineConfig({
- transpileDependencies: true,
- productionSourceMap: false
-})
\ No newline at end of file
--
GitLab