@gx-design-vue/create-gx-cli 0.0.1 → 0.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.
- package/package.json +1 -1
- package/template-mobile-ts/README.md +1 -16
- package/template-mobile-ts/build/plugin/index.ts +13 -1
- package/template-mobile-ts/build/script/postBuild.ts +15 -0
- package/template-mobile-ts/package.json +12 -5
- package/template-mobile-ts/postcss.config.js +5 -8
- package/template-mobile-ts/src/components/PageContainer/index.tsx +1 -0
- package/template-mobile-ts/src/core/vant-design/index.ts +0 -5
- package/template-mobile-ts/src/hooks/web/usePageLoading.ts +5 -8
- package/template-mobile-ts/src/main.ts +3 -1
- package/template-mobile-ts/src/{views → pages}/home.vue +1 -12
- package/template-mobile-ts/src/router/index.ts +3 -4
- package/template-mobile-ts/src/router/routes.ts +1 -1
- package/template-mobile-ts/src/settings/index.ts +10 -0
- package/template-mobile-ts/src/store/modules/global.ts +1 -4
- package/template-mobile-ts/src/utils/cryptoJS.ts +31 -17
- package/template-mobile-ts/src/utils/{index.ts → env.ts} +1 -1
- package/template-mobile-ts/src/utils/request/XHR.ts +131 -0
- package/template-mobile-ts/src/utils/request/axiosCancel.ts +60 -0
- package/template-mobile-ts/src/utils/request/checkStatus.ts +11 -0
- package/template-mobile-ts/src/utils/request/index.ts +143 -0
- package/template-mobile-ts/src/utils/request/typings.ts +114 -0
- package/template-mobile-ts/src/utils/storage.ts +191 -0
- package/template-mobile-ts/src/utils/validate.ts +0 -264
- package/template-mobile-ts/types/global.d.ts +16 -0
- package/template-mobile-ts/vite.config.ts +16 -2
- package/template-mobile-ts/pnpm-lock.yaml +0 -3890
- package/template-mobile-ts/src/utils/request.ts +0 -105
- package/template-vue-ts/.vscode/extensions.json +0 -3
- package/template-vue-ts/README.md +0 -18
- package/template-vue-ts/index.html +0 -13
- package/template-vue-ts/package.json +0 -20
- package/template-vue-ts/public/vite.svg +0 -1
- package/template-vue-ts/src/App.vue +0 -30
- package/template-vue-ts/src/assets/vue.svg +0 -1
- package/template-vue-ts/src/components/HelloWorld.vue +0 -38
- package/template-vue-ts/src/main.ts +0 -5
- package/template-vue-ts/src/style.css +0 -81
- package/template-vue-ts/src/vite-env.d.ts +0 -1
- package/template-vue-ts/tsconfig.json +0 -18
- package/template-vue-ts/tsconfig.node.json +0 -9
- package/template-vue-ts/vite.config.ts +0 -7
@@ -1,105 +0,0 @@
|
|
1
|
-
import type { AxiosRequestConfig, AxiosResponse, AxiosError } from 'axios'
|
2
|
-
import axios, { Axios, AxiosPromise } from 'axios'
|
3
|
-
import qs from 'qs'
|
4
|
-
import { Toast } from 'vant'
|
5
|
-
import { useStoreGlobal } from '@gx-vuex'
|
6
|
-
import { tansParams } from '@/utils/util'
|
7
|
-
import { checkURL } from '@/utils/validate'
|
8
|
-
|
9
|
-
export interface CreateAxiosOptions extends AxiosRequestConfig {
|
10
|
-
headers?: any;
|
11
|
-
isMock?: boolean;
|
12
|
-
customize?: boolean;
|
13
|
-
carryToken?: boolean;
|
14
|
-
ignoreCancelToken?: boolean;
|
15
|
-
}
|
16
|
-
|
17
|
-
export interface GAxiosInstance extends Axios {
|
18
|
-
(config: CreateAxiosOptions): AxiosPromise<ResponseResult>;
|
19
|
-
|
20
|
-
(url: string, config?: CreateAxiosOptions): AxiosPromise<ResponseResult>;
|
21
|
-
}
|
22
|
-
|
23
|
-
let loadingInstance
|
24
|
-
|
25
|
-
/**
|
26
|
-
* @author gx12358 2539306317@qq.com
|
27
|
-
* @description axios初始化
|
28
|
-
*/
|
29
|
-
const instance: GAxiosInstance = axios.create({
|
30
|
-
timeout: 100000,
|
31
|
-
headers: {
|
32
|
-
'Content-Type': 'application/json;charset=UTF-8'
|
33
|
-
}
|
34
|
-
})
|
35
|
-
/**
|
36
|
-
* @author gx12358 2539306317@qq.com
|
37
|
-
* @description axios请求拦截器
|
38
|
-
*/
|
39
|
-
instance.interceptors.request.use(
|
40
|
-
(config: CreateAxiosOptions) => {
|
41
|
-
const global = useStoreGlobal()
|
42
|
-
|
43
|
-
// get请求映射params参数
|
44
|
-
if (config.method === 'get' && config.params) {
|
45
|
-
let url = config.url + '?' + tansParams(config.params)
|
46
|
-
url = url.slice(0, -1)
|
47
|
-
config.params = {}
|
48
|
-
config.url = url
|
49
|
-
}
|
50
|
-
|
51
|
-
if (!checkURL(config.url)) {
|
52
|
-
if (config.isMock) {
|
53
|
-
config.url = `/mock-server${config.url}`
|
54
|
-
} else {
|
55
|
-
config.url = `${import.meta.env.VITE_BASE_URL}/${config.url}`
|
56
|
-
}
|
57
|
-
}
|
58
|
-
|
59
|
-
if (global.token && global.tokenName)
|
60
|
-
(config).headers[global.tokenName] = global.token
|
61
|
-
|
62
|
-
if (
|
63
|
-
config.data &&
|
64
|
-
config.headers['Content-Type'] ===
|
65
|
-
'application/x-www-form-urlencoded;charset=UTF-8'
|
66
|
-
)
|
67
|
-
config.data = qs.stringify(config.data)
|
68
|
-
|
69
|
-
return config
|
70
|
-
},
|
71
|
-
(error: Error | AxiosError) => {
|
72
|
-
return Promise.reject(error)
|
73
|
-
}
|
74
|
-
)
|
75
|
-
/**
|
76
|
-
* @author gx12358 2539306317@qq.com
|
77
|
-
* @description axios响应拦截器
|
78
|
-
*/
|
79
|
-
instance.interceptors.response.use(
|
80
|
-
(response: AxiosResponse) => {
|
81
|
-
if (loadingInstance) loadingInstance.close()
|
82
|
-
const { data, config } = response
|
83
|
-
const { code} = data as ResponseResult
|
84
|
-
// 操作正常Code数组
|
85
|
-
const codeVerificationArray = [ 200, 0 ]
|
86
|
-
// 是否操作正常
|
87
|
-
if ((config as CreateAxiosOptions).customize)
|
88
|
-
return data
|
89
|
-
else if (codeVerificationArray.includes(code))
|
90
|
-
return data
|
91
|
-
else {
|
92
|
-
Toast.fail(`服务器出错!`)
|
93
|
-
return Promise.resolve(false)
|
94
|
-
}
|
95
|
-
},
|
96
|
-
(_: AxiosError): Promise<ResponseResult | boolean> => {
|
97
|
-
if (loadingInstance) loadingInstance.close()
|
98
|
-
Toast.fail(`服务器出错!`)
|
99
|
-
return Promise.resolve(false)
|
100
|
-
}
|
101
|
-
)
|
102
|
-
|
103
|
-
const request: (opt?: CreateAxiosOptions) => Promise<ResponseResult> = async (opt) => await instance.request(opt)
|
104
|
-
|
105
|
-
export default request
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# Vue 3 + TypeScript + Vite
|
2
|
-
|
3
|
-
This template should help get you started developing with Vue 3 and TypeScript 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.
|
4
|
-
|
5
|
-
## Recommended IDE Setup
|
6
|
-
|
7
|
-
- [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
|
8
|
-
|
9
|
-
## Type Support For `.vue` Imports in TS
|
10
|
-
|
11
|
-
TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types.
|
12
|
-
|
13
|
-
If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps:
|
14
|
-
|
15
|
-
1. Disable the built-in TypeScript Extension
|
16
|
-
1. Run `Extensions: Show Built-in Extensions` from VSCode's command palette
|
17
|
-
2. Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)`
|
18
|
-
2. Reload the VSCode window by running `Developer: Reload Window` from the command palette.
|
@@ -1,13 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html lang="en">
|
3
|
-
<head>
|
4
|
-
<meta charset="UTF-8" />
|
5
|
-
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
7
|
-
<title>Vite + Vue + TS</title>
|
8
|
-
</head>
|
9
|
-
<body>
|
10
|
-
<div id="app"></div>
|
11
|
-
<script type="module" src="/src/main.ts"></script>
|
12
|
-
</body>
|
13
|
-
</html>
|
@@ -1,20 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "vite-vue-typescript-starter",
|
3
|
-
"private": true,
|
4
|
-
"version": "0.0.0",
|
5
|
-
"type": "module",
|
6
|
-
"scripts": {
|
7
|
-
"dev": "vite",
|
8
|
-
"build": "vue-tsc && vite build",
|
9
|
-
"preview": "vite preview"
|
10
|
-
},
|
11
|
-
"dependencies": {
|
12
|
-
"vue": "^3.2.45"
|
13
|
-
},
|
14
|
-
"devDependencies": {
|
15
|
-
"@vitejs/plugin-vue": "^4.0.0",
|
16
|
-
"typescript": "^4.9.3",
|
17
|
-
"vite": "^4.0.4",
|
18
|
-
"vue-tsc": "^1.0.22"
|
19
|
-
}
|
20
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
@@ -1,30 +0,0 @@
|
|
1
|
-
<script setup lang="ts">
|
2
|
-
import HelloWorld from './components/HelloWorld.vue'
|
3
|
-
</script>
|
4
|
-
|
5
|
-
<template>
|
6
|
-
<div>
|
7
|
-
<a href="https://vitejs.dev" target="_blank">
|
8
|
-
<img src="/vite.svg" class="logo" alt="Vite logo" />
|
9
|
-
</a>
|
10
|
-
<a href="https://vuejs.org/" target="_blank">
|
11
|
-
<img src="./assets/vue.svg" class="logo vue" alt="Vue logo" />
|
12
|
-
</a>
|
13
|
-
</div>
|
14
|
-
<HelloWorld msg="Vite + Vue" />
|
15
|
-
</template>
|
16
|
-
|
17
|
-
<style scoped>
|
18
|
-
.logo {
|
19
|
-
height: 6em;
|
20
|
-
padding: 1.5em;
|
21
|
-
will-change: filter;
|
22
|
-
transition: filter 300ms;
|
23
|
-
}
|
24
|
-
.logo:hover {
|
25
|
-
filter: drop-shadow(0 0 2em #646cffaa);
|
26
|
-
}
|
27
|
-
.logo.vue:hover {
|
28
|
-
filter: drop-shadow(0 0 2em #42b883aa);
|
29
|
-
}
|
30
|
-
</style>
|
@@ -1 +0,0 @@
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>
|
@@ -1,38 +0,0 @@
|
|
1
|
-
<script setup lang="ts">
|
2
|
-
import { ref } from 'vue'
|
3
|
-
|
4
|
-
defineProps<{ msg: string }>()
|
5
|
-
|
6
|
-
const count = ref(0)
|
7
|
-
</script>
|
8
|
-
|
9
|
-
<template>
|
10
|
-
<h1>{{ msg }}</h1>
|
11
|
-
|
12
|
-
<div class="card">
|
13
|
-
<button type="button" @click="count++">count is {{ count }}</button>
|
14
|
-
<p>
|
15
|
-
Edit
|
16
|
-
<code>components/HelloWorld.vue</code> to test HMR
|
17
|
-
</p>
|
18
|
-
</div>
|
19
|
-
|
20
|
-
<p>
|
21
|
-
Check out
|
22
|
-
<a href="https://vuejs.org/guide/quick-start.html#local" target="_blank"
|
23
|
-
>create-vue</a
|
24
|
-
>, the official Vue + Vite starter
|
25
|
-
</p>
|
26
|
-
<p>
|
27
|
-
Install
|
28
|
-
<a href="https://github.com/johnsoncodehk/volar" target="_blank">Volar</a>
|
29
|
-
in your IDE for a better DX
|
30
|
-
</p>
|
31
|
-
<p class="read-the-docs">Click on the Vite and Vue logos to learn more</p>
|
32
|
-
</template>
|
33
|
-
|
34
|
-
<style scoped>
|
35
|
-
.read-the-docs {
|
36
|
-
color: #888;
|
37
|
-
}
|
38
|
-
</style>
|
@@ -1,81 +0,0 @@
|
|
1
|
-
:root {
|
2
|
-
font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
|
3
|
-
font-size: 16px;
|
4
|
-
line-height: 24px;
|
5
|
-
font-weight: 400;
|
6
|
-
|
7
|
-
color-scheme: light dark;
|
8
|
-
color: rgba(255, 255, 255, 0.87);
|
9
|
-
background-color: #242424;
|
10
|
-
|
11
|
-
font-synthesis: none;
|
12
|
-
text-rendering: optimizeLegibility;
|
13
|
-
-webkit-font-smoothing: antialiased;
|
14
|
-
-moz-osx-font-smoothing: grayscale;
|
15
|
-
-webkit-text-size-adjust: 100%;
|
16
|
-
}
|
17
|
-
|
18
|
-
a {
|
19
|
-
font-weight: 500;
|
20
|
-
color: #646cff;
|
21
|
-
text-decoration: inherit;
|
22
|
-
}
|
23
|
-
a:hover {
|
24
|
-
color: #535bf2;
|
25
|
-
}
|
26
|
-
|
27
|
-
body {
|
28
|
-
margin: 0;
|
29
|
-
display: flex;
|
30
|
-
place-items: center;
|
31
|
-
min-width: 320px;
|
32
|
-
min-height: 100vh;
|
33
|
-
}
|
34
|
-
|
35
|
-
h1 {
|
36
|
-
font-size: 3.2em;
|
37
|
-
line-height: 1.1;
|
38
|
-
}
|
39
|
-
|
40
|
-
button {
|
41
|
-
border-radius: 8px;
|
42
|
-
border: 1px solid transparent;
|
43
|
-
padding: 0.6em 1.2em;
|
44
|
-
font-size: 1em;
|
45
|
-
font-weight: 500;
|
46
|
-
font-family: inherit;
|
47
|
-
background-color: #1a1a1a;
|
48
|
-
cursor: pointer;
|
49
|
-
transition: border-color 0.25s;
|
50
|
-
}
|
51
|
-
button:hover {
|
52
|
-
border-color: #646cff;
|
53
|
-
}
|
54
|
-
button:focus,
|
55
|
-
button:focus-visible {
|
56
|
-
outline: 4px auto -webkit-focus-ring-color;
|
57
|
-
}
|
58
|
-
|
59
|
-
.card {
|
60
|
-
padding: 2em;
|
61
|
-
}
|
62
|
-
|
63
|
-
#app {
|
64
|
-
max-width: 1280px;
|
65
|
-
margin: 0 auto;
|
66
|
-
padding: 2rem;
|
67
|
-
text-align: center;
|
68
|
-
}
|
69
|
-
|
70
|
-
@media (prefers-color-scheme: light) {
|
71
|
-
:root {
|
72
|
-
color: #213547;
|
73
|
-
background-color: #ffffff;
|
74
|
-
}
|
75
|
-
a:hover {
|
76
|
-
color: #747bff;
|
77
|
-
}
|
78
|
-
button {
|
79
|
-
background-color: #f9f9f9;
|
80
|
-
}
|
81
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
/// <reference types="vite/client" />
|
@@ -1,18 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"compilerOptions": {
|
3
|
-
"target": "ESNext",
|
4
|
-
"useDefineForClassFields": true,
|
5
|
-
"module": "ESNext",
|
6
|
-
"moduleResolution": "Node",
|
7
|
-
"strict": true,
|
8
|
-
"jsx": "preserve",
|
9
|
-
"resolveJsonModule": true,
|
10
|
-
"isolatedModules": true,
|
11
|
-
"esModuleInterop": true,
|
12
|
-
"lib": ["ESNext", "DOM"],
|
13
|
-
"skipLibCheck": true,
|
14
|
-
"noEmit": true
|
15
|
-
},
|
16
|
-
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
|
17
|
-
"references": [{ "path": "./tsconfig.node.json" }]
|
18
|
-
}
|