feat: 更新升级vite 6
This commit is contained in:
1 parent
ac0d3b2f7d
commit
f6ad3ae221
53 files changed
+7734
-588
No files matched your search
@@ -1,4 +0,0 @@
|
|||||||
build
|
|
||||||
dist
|
|
||||||
node_modules
|
|
||||||
.vscode
|
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
{
|
||||||
|
"globals": {
|
||||||
|
"Component": true,
|
||||||
|
"ComponentPublicInstance": true,
|
||||||
|
"ComputedRef": true,
|
||||||
|
"EffectScope": true,
|
||||||
|
"ExtractDefaultPropTypes": true,
|
||||||
|
"ExtractPropTypes": true,
|
||||||
|
"ExtractPublicPropTypes": true,
|
||||||
|
"InjectionKey": true,
|
||||||
|
"PropType": true,
|
||||||
|
"Ref": true,
|
||||||
|
"VNode": true,
|
||||||
|
"WritableComputedRef": true,
|
||||||
|
"acceptHMRUpdate": true,
|
||||||
|
"computed": true,
|
||||||
|
"createApp": true,
|
||||||
|
"createPinia": true,
|
||||||
|
"createRouter": true,
|
||||||
|
"createWebHashHistory": true,
|
||||||
|
"createWebHistory": true,
|
||||||
|
"customRef": true,
|
||||||
|
"defineAsyncComponent": true,
|
||||||
|
"defineComponent": true,
|
||||||
|
"defineStore": true,
|
||||||
|
"effectScope": true,
|
||||||
|
"getActivePinia": true,
|
||||||
|
"getCurrentInstance": true,
|
||||||
|
"getCurrentScope": true,
|
||||||
|
"h": true,
|
||||||
|
"inject": true,
|
||||||
|
"isProxy": true,
|
||||||
|
"isReactive": true,
|
||||||
|
"isReadonly": true,
|
||||||
|
"isRef": true,
|
||||||
|
"mapActions": true,
|
||||||
|
"mapGetters": true,
|
||||||
|
"mapState": true,
|
||||||
|
"mapStores": true,
|
||||||
|
"mapWritableState": true,
|
||||||
|
"markRaw": true,
|
||||||
|
"nextTick": true,
|
||||||
|
"onActivated": true,
|
||||||
|
"onBeforeMount": true,
|
||||||
|
"onBeforeRouteLeave": true,
|
||||||
|
"onBeforeRouteUpdate": true,
|
||||||
|
"onBeforeUnmount": true,
|
||||||
|
"onBeforeUpdate": true,
|
||||||
|
"onDeactivated": true,
|
||||||
|
"onErrorCaptured": true,
|
||||||
|
"onMounted": true,
|
||||||
|
"onRenderTracked": true,
|
||||||
|
"onRenderTriggered": true,
|
||||||
|
"onScopeDispose": true,
|
||||||
|
"onServerPrefetch": true,
|
||||||
|
"onUnmounted": true,
|
||||||
|
"onUpdated": true,
|
||||||
|
"provide": true,
|
||||||
|
"reactive": true,
|
||||||
|
"readonly": true,
|
||||||
|
"ref": true,
|
||||||
|
"resolveComponent": true,
|
||||||
|
"setActivePinia": true,
|
||||||
|
"setMapStoreSuffix": true,
|
||||||
|
"shallowReactive": true,
|
||||||
|
"shallowReadonly": true,
|
||||||
|
"shallowRef": true,
|
||||||
|
"storeToRefs": true,
|
||||||
|
"toRaw": true,
|
||||||
|
"toRef": true,
|
||||||
|
"toRefs": true,
|
||||||
|
"toValue": true,
|
||||||
|
"triggerRef": true,
|
||||||
|
"unref": true,
|
||||||
|
"useAttrs": true,
|
||||||
|
"useCssModule": true,
|
||||||
|
"useCssVars": true,
|
||||||
|
"useLink": true,
|
||||||
|
"useRoute": true,
|
||||||
|
"useRouter": true,
|
||||||
|
"useSlots": true,
|
||||||
|
"watch": true,
|
||||||
|
"watchEffect": true,
|
||||||
|
"watchPostEffect": true,
|
||||||
|
"watchSyncEffect": true,
|
||||||
|
"DirectiveBinding": true,
|
||||||
|
"MaybeRef": true,
|
||||||
|
"MaybeRefOrGetter": true,
|
||||||
|
"onWatcherCleanup": true,
|
||||||
|
"useId": true,
|
||||||
|
"useModel": true,
|
||||||
|
"useTemplateRef": true
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
root: true,
|
|
||||||
env: {
|
|
||||||
"browser": true,
|
|
||||||
"es2021": true,
|
|
||||||
"node": true,
|
|
||||||
"vue/setup-compiler-macros": true
|
|
||||||
},
|
|
||||||
extends: ["eslint:recommended", "plugin:vue/vue3-recommended", "@vue/typescript/recommended", "prettier"],
|
|
||||||
parser: "vue-eslint-parser",
|
|
||||||
parserOptions: {
|
|
||||||
ecmaVersion: "latest",
|
|
||||||
parser: "@typescript-eslint/parser",
|
|
||||||
sourceType: "module"
|
|
||||||
},
|
|
||||||
plugins: ["vue", "html", "@typescript-eslint"],
|
|
||||||
rules: {
|
|
||||||
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
|
|
||||||
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
|
|
||||||
"semi": [2, "always"],
|
|
||||||
"comma-dangle": [2, "never"],
|
|
||||||
"eqeqeq": "warn",
|
|
||||||
"quotes": ["warn", "double"],
|
|
||||||
"@typescript-eslint/ban-types": [
|
|
||||||
"warn",
|
|
||||||
{
|
|
||||||
types: {
|
|
||||||
"{}": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"@typescript-eslint/no-explicit-any": "off",
|
|
||||||
"vue/no-unused-vars": "warn",
|
|
||||||
"vue/multi-word-component-names": "off",
|
|
||||||
"vue/no-mutating-props": "off",
|
|
||||||
"@typescript-eslint/ban-ts-comment": "off",
|
|
||||||
"vue/html-closing-bracket-newline": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
singleline: "never",
|
|
||||||
multiline: "always"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"vue/html-indent": [
|
|
||||||
"error",
|
|
||||||
2,
|
|
||||||
{
|
|
||||||
attribute: 1,
|
|
||||||
baseIndent: 1,
|
|
||||||
closeBracket: 0,
|
|
||||||
alignAttributesVertically: true,
|
|
||||||
ignores: []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"vue/max-attributes-per-line": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
singleline: {
|
|
||||||
max: 2
|
|
||||||
},
|
|
||||||
multiline: {
|
|
||||||
max: 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
};
|
|
||||||
+17
-11
@@ -1,20 +1,26 @@
|
|||||||
.DS_Store
|
# Logs
|
||||||
node_modules
|
logs
|
||||||
/dist
|
*.log
|
||||||
package-lock.json
|
|
||||||
|
|
||||||
# local env files
|
|
||||||
.env.local
|
|
||||||
.env.*.local
|
|
||||||
|
|
||||||
# Log files
|
|
||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
yarn-debug.log*
|
yarn-debug.log*
|
||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
|
pnpm-debug.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
|
||||||
|
node_modules
|
||||||
|
.DS_Store
|
||||||
|
dist
|
||||||
|
dist-ssr
|
||||||
|
coverage
|
||||||
|
*.local
|
||||||
|
|
||||||
|
/cypress/videos/
|
||||||
|
/cypress/screenshots/
|
||||||
|
|
||||||
# Editor directories and files
|
# Editor directories and files
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/extensions.json
|
||||||
.idea
|
.idea
|
||||||
.vscode
|
|
||||||
*.suo
|
*.suo
|
||||||
*.ntvs*
|
*.ntvs*
|
||||||
*.njsproj
|
*.njsproj
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
semi: false,
|
|
||||||
singleQuote: false,
|
|
||||||
tabWidth: 2,
|
|
||||||
useTabs: false,
|
|
||||||
printWidth: 120,
|
|
||||||
proseWrap: 'preserve',
|
|
||||||
trailingComma: 'es5',
|
|
||||||
bracketSpacing: true,
|
|
||||||
quoteProps: "consistent",
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json.schemastore.org/prettierrc",
|
||||||
|
"semi": false,
|
||||||
|
"tabWidth": 2,
|
||||||
|
"singleQuote": false,
|
||||||
|
"printWidth": 100,
|
||||||
|
"trailingComma": "none"
|
||||||
|
}
|
||||||
Vendored
+8
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"recommendations": [
|
||||||
|
"Vue.volar",
|
||||||
|
"Vue.vscode-typescript-vue-plugin",
|
||||||
|
"dbaeumer.vscode-eslint",
|
||||||
|
"esbenp.prettier-vscode"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# vue3-template-h5
|
# mytest
|
||||||
|
|
||||||
一个h5项目
|
vue3-template-h5
|
||||||
|
|
||||||
## 安装
|
## 安装
|
||||||
|
|
||||||
@@ -11,10 +11,9 @@ npm install
|
|||||||
## 运行
|
## 运行
|
||||||
|
|
||||||
```
|
```
|
||||||
npm run serve:dev //本地运行,并且代理到开发环境
|
|
||||||
npm run serve:test //本地运行,并且代理到测试环境
|
npm run serve:test //本地运行,并且代理到测试环境
|
||||||
npm run serve:uat //本地运行,并且代理到预发布环境
|
npm run serve:uat //本地运行,并且代理到预发布环境
|
||||||
npm run serve:prod //本地运行,并且代理到生产环境
|
npm run serve //本地运行,并且代理到生产环境
|
||||||
```
|
```
|
||||||
|
|
||||||
## 打包
|
## 打包
|
||||||
@@ -27,7 +26,7 @@ npm run build:test
|
|||||||
npm run build:uat
|
npm run build:uat
|
||||||
|
|
||||||
// 生产环境
|
// 生产环境
|
||||||
npm run build:prod
|
npm run build
|
||||||
```
|
```
|
||||||
|
|
||||||
## 说明
|
## 说明
|
||||||
@@ -37,6 +36,10 @@ npm run build:prod
|
|||||||
|
|
||||||
## 常见问题
|
## 常见问题
|
||||||
|
|
||||||
|
### 环境变量
|
||||||
|
|
||||||
|
环境变量放在env目录下,.env文件必定会加载,mode=test时,.env.test会加载,变量优先级,.env.test > .env ,因此,相同变量名,.env里的会被忽略。
|
||||||
|
|
||||||
### 按需引入组件
|
### 按需引入组件
|
||||||
|
|
||||||
项目使用 unplugin-vue-components 插件,它可以自动引入组件,并按需引入组件的样式,无需手动引入样式。
|
项目使用 unplugin-vue-components 插件,它可以自动引入组件,并按需引入组件的样式,无需手动引入样式。
|
||||||
@@ -49,37 +52,37 @@ import {
|
|||||||
|
|
||||||
### 引入函数组件的样式
|
### 引入函数组件的样式
|
||||||
|
|
||||||
Vant 中有个别组件是以函数的形式提供的,包括 Toast,Dialog,Notify 和 ImagePreview 组件。在使用函数组件时,unplugin-vue-components 无法自动引入对应的样式,因此需要手动引入样式。
|
Vant 中有个别组件是以函数的形式提供的,包括 Toast,Dialog,Notify 和 ImagePreview 等组件。在使用函数组件时,unplugin-vue-components 无法自动引入对应的样式,因此需要手动引入样式。
|
||||||
|
|
||||||
```JS
|
```JS
|
||||||
// Toast
|
// Toast
|
||||||
import {
|
import {
|
||||||
Toast
|
showToast
|
||||||
} from 'vant';
|
} from 'vant';
|
||||||
import 'vant/es/toast/style';
|
import 'vant/es/toast/style';
|
||||||
|
|
||||||
// Dialog
|
// Dialog
|
||||||
import {
|
import {
|
||||||
Dialog
|
showDialog
|
||||||
} from 'vant';
|
} from 'vant';
|
||||||
import 'vant/es/dialog/style';
|
import 'vant/es/dialog/style';
|
||||||
|
|
||||||
// Notify
|
// Notify
|
||||||
import {
|
import {
|
||||||
Notify
|
showNotify
|
||||||
} from 'vant';
|
} from 'vant';
|
||||||
import 'vant/es/notify/style';
|
import 'vant/es/notify/style';
|
||||||
|
|
||||||
// ImagePreview
|
// ImagePreview
|
||||||
import {
|
import {
|
||||||
ImagePreview
|
showImagePreview
|
||||||
} from 'vant';
|
} from 'vant';
|
||||||
import 'vant/es/image-preview/style';
|
import 'vant/es/image-preview/style';
|
||||||
```
|
```
|
||||||
|
|
||||||
### 本地代理
|
### 本地代理
|
||||||
|
|
||||||
运行项目时的接口代理,可在 proxy.config.ts 中配置。
|
运行项目时的接口代理,可在 vite.util.ts 的 proxyConfig 方法中配置。
|
||||||
|
|
||||||
## 相关文档
|
## 相关文档
|
||||||
|
|
||||||
|
|||||||
Vendored
+90
@@ -0,0 +1,90 @@
|
|||||||
|
/* eslint-disable */
|
||||||
|
/* prettier-ignore */
|
||||||
|
// @ts-nocheck
|
||||||
|
// noinspection JSUnusedGlobalSymbols
|
||||||
|
// Generated by unplugin-auto-import
|
||||||
|
export {}
|
||||||
|
declare global {
|
||||||
|
const EffectScope: typeof import('vue')['EffectScope']
|
||||||
|
const acceptHMRUpdate: typeof import('pinia')['acceptHMRUpdate']
|
||||||
|
const computed: typeof import('vue')['computed']
|
||||||
|
const createApp: typeof import('vue')['createApp']
|
||||||
|
const createPinia: typeof import('pinia')['createPinia']
|
||||||
|
const createRouter: typeof import('vue-router')['createRouter']
|
||||||
|
const createWebHashHistory: typeof import('vue-router')['createWebHashHistory']
|
||||||
|
const createWebHistory: typeof import('vue-router')['createWebHistory']
|
||||||
|
const customRef: typeof import('vue')['customRef']
|
||||||
|
const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
|
||||||
|
const defineComponent: typeof import('vue')['defineComponent']
|
||||||
|
const defineStore: typeof import('pinia')['defineStore']
|
||||||
|
const effectScope: typeof import('vue')['effectScope']
|
||||||
|
const getActivePinia: typeof import('pinia')['getActivePinia']
|
||||||
|
const getCurrentInstance: typeof import('vue')['getCurrentInstance']
|
||||||
|
const getCurrentScope: typeof import('vue')['getCurrentScope']
|
||||||
|
const h: typeof import('vue')['h']
|
||||||
|
const inject: typeof import('vue')['inject']
|
||||||
|
const isProxy: typeof import('vue')['isProxy']
|
||||||
|
const isReactive: typeof import('vue')['isReactive']
|
||||||
|
const isReadonly: typeof import('vue')['isReadonly']
|
||||||
|
const isRef: typeof import('vue')['isRef']
|
||||||
|
const mapActions: typeof import('pinia')['mapActions']
|
||||||
|
const mapGetters: typeof import('pinia')['mapGetters']
|
||||||
|
const mapState: typeof import('pinia')['mapState']
|
||||||
|
const mapStores: typeof import('pinia')['mapStores']
|
||||||
|
const mapWritableState: typeof import('pinia')['mapWritableState']
|
||||||
|
const markRaw: typeof import('vue')['markRaw']
|
||||||
|
const nextTick: typeof import('vue')['nextTick']
|
||||||
|
const onActivated: typeof import('vue')['onActivated']
|
||||||
|
const onBeforeMount: typeof import('vue')['onBeforeMount']
|
||||||
|
const onBeforeRouteLeave: typeof import('vue-router')['onBeforeRouteLeave']
|
||||||
|
const onBeforeRouteUpdate: typeof import('vue-router')['onBeforeRouteUpdate']
|
||||||
|
const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
|
||||||
|
const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
|
||||||
|
const onDeactivated: typeof import('vue')['onDeactivated']
|
||||||
|
const onErrorCaptured: typeof import('vue')['onErrorCaptured']
|
||||||
|
const onMounted: typeof import('vue')['onMounted']
|
||||||
|
const onRenderTracked: typeof import('vue')['onRenderTracked']
|
||||||
|
const onRenderTriggered: typeof import('vue')['onRenderTriggered']
|
||||||
|
const onScopeDispose: typeof import('vue')['onScopeDispose']
|
||||||
|
const onServerPrefetch: typeof import('vue')['onServerPrefetch']
|
||||||
|
const onUnmounted: typeof import('vue')['onUnmounted']
|
||||||
|
const onUpdated: typeof import('vue')['onUpdated']
|
||||||
|
const onWatcherCleanup: typeof import('vue')['onWatcherCleanup']
|
||||||
|
const provide: typeof import('vue')['provide']
|
||||||
|
const reactive: typeof import('vue')['reactive']
|
||||||
|
const readonly: typeof import('vue')['readonly']
|
||||||
|
const ref: typeof import('vue')['ref']
|
||||||
|
const resolveComponent: typeof import('vue')['resolveComponent']
|
||||||
|
const setActivePinia: typeof import('pinia')['setActivePinia']
|
||||||
|
const setMapStoreSuffix: typeof import('pinia')['setMapStoreSuffix']
|
||||||
|
const shallowReactive: typeof import('vue')['shallowReactive']
|
||||||
|
const shallowReadonly: typeof import('vue')['shallowReadonly']
|
||||||
|
const shallowRef: typeof import('vue')['shallowRef']
|
||||||
|
const storeToRefs: typeof import('pinia')['storeToRefs']
|
||||||
|
const toRaw: typeof import('vue')['toRaw']
|
||||||
|
const toRef: typeof import('vue')['toRef']
|
||||||
|
const toRefs: typeof import('vue')['toRefs']
|
||||||
|
const toValue: typeof import('vue')['toValue']
|
||||||
|
const triggerRef: typeof import('vue')['triggerRef']
|
||||||
|
const unref: typeof import('vue')['unref']
|
||||||
|
const useAttrs: typeof import('vue')['useAttrs']
|
||||||
|
const useCssModule: typeof import('vue')['useCssModule']
|
||||||
|
const useCssVars: typeof import('vue')['useCssVars']
|
||||||
|
const useId: typeof import('vue')['useId']
|
||||||
|
const useLink: typeof import('vue-router')['useLink']
|
||||||
|
const useModel: typeof import('vue')['useModel']
|
||||||
|
const useRoute: typeof import('vue-router')['useRoute']
|
||||||
|
const useRouter: typeof import('vue-router')['useRouter']
|
||||||
|
const useSlots: typeof import('vue')['useSlots']
|
||||||
|
const useTemplateRef: typeof import('vue')['useTemplateRef']
|
||||||
|
const watch: typeof import('vue')['watch']
|
||||||
|
const watchEffect: typeof import('vue')['watchEffect']
|
||||||
|
const watchPostEffect: typeof import('vue')['watchPostEffect']
|
||||||
|
const watchSyncEffect: typeof import('vue')['watchSyncEffect']
|
||||||
|
}
|
||||||
|
// for type re-export
|
||||||
|
declare global {
|
||||||
|
// @ts-ignore
|
||||||
|
export type { Component, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue'
|
||||||
|
import('vue')
|
||||||
|
}
|
||||||
Vendored
+5
-6
@@ -1,13 +1,12 @@
|
|||||||
// generated by unplugin-vue-components
|
/* eslint-disable */
|
||||||
// We suggest you to commit this file into source control
|
/* prettier-ignore */
|
||||||
|
// @ts-nocheck
|
||||||
|
// Generated by unplugin-vue-components
|
||||||
// Read more: https://github.com/vuejs/core/pull/3399
|
// Read more: https://github.com/vuejs/core/pull/3399
|
||||||
import '@vue/runtime-core'
|
|
||||||
|
|
||||||
export {}
|
export {}
|
||||||
|
|
||||||
declare module '@vue/runtime-core' {
|
declare module 'vue' {
|
||||||
export interface GlobalComponents {
|
export interface GlobalComponents {
|
||||||
_index: typeof import('./src/components/abnormal/_index.vue')['default']
|
|
||||||
Abnormal: typeof import('./src/components/abnormal/index.vue')['default']
|
Abnormal: typeof import('./src/components/abnormal/index.vue')['default']
|
||||||
HelloWorld: typeof import('./src/components/HelloWorld.vue')['default']
|
HelloWorld: typeof import('./src/components/HelloWorld.vue')['default']
|
||||||
IconAndText: typeof import('./src/components/abnormal/iconAndText.vue')['default']
|
IconAndText: typeof import('./src/components/abnormal/iconAndText.vue')['default']
|
||||||
|
|||||||
Vendored
-15
@@ -1,15 +0,0 @@
|
|||||||
export declare const appName: string;
|
|
||||||
|
|
||||||
export declare const passid: string;
|
|
||||||
|
|
||||||
export declare const VITE_APP_ENV: string;
|
|
||||||
|
|
||||||
export declare let proxyTarget: string;
|
|
||||||
|
|
||||||
export declare const vconsoleDebug: boolean;
|
|
||||||
|
|
||||||
export declare const scriptSrcStr: string;
|
|
||||||
|
|
||||||
export declare let temp: string;
|
|
||||||
|
|
||||||
export declare const injectScriptStr: string;
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
const appName = "协同办公XX管理后台";
|
|
||||||
|
|
||||||
const passid = "paasid";
|
|
||||||
|
|
||||||
const ENV: any = import.meta.env || process.env;
|
|
||||||
const VITE_APP_ENV: string = ENV.VITE_APP_ENV;
|
|
||||||
|
|
||||||
let proxyTarget = "";
|
|
||||||
switch (VITE_APP_ENV) {
|
|
||||||
case "test":
|
|
||||||
proxyTarget = "https://xxxxxx.com";
|
|
||||||
break;
|
|
||||||
case "uat":
|
|
||||||
proxyTarget = "https://xxxxxx.com";
|
|
||||||
break;
|
|
||||||
case "prod":
|
|
||||||
proxyTarget = "https://xxxxxx.com";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
proxyTarget = "https://xxxxxx.com";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
const vconsoleDebug = true;
|
|
||||||
const scriptSrcStr = "var src = '/midjs/mjs/vconsole/v3.14.6/vconsole.min.js';document.write('<scr' + 'ipt src=\"' + src + '\"></scr' + 'ipt>');document.write('<scr' + 'ipt>new window.VConsole();</scr' + 'ipt>');";
|
|
||||||
let temp = "";
|
|
||||||
if (vconsoleDebug && (VITE_APP_ENV === "test" || VITE_APP_ENV === "uat")) {
|
|
||||||
temp = scriptSrcStr;
|
|
||||||
} else {
|
|
||||||
temp = `if (/vconsole=true/.test(window.location)) {${scriptSrcStr}};`;
|
|
||||||
}
|
|
||||||
const injectScriptStr = `<script>;(function () {${temp}})();</script>`;
|
|
||||||
|
|
||||||
export {
|
|
||||||
appName,
|
|
||||||
proxyTarget,
|
|
||||||
passid,
|
|
||||||
injectScriptStr
|
|
||||||
};
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
/// <reference types="vite/client" />
|
/// <reference types="vite/client" />
|
||||||
declare interface ImportMetaEnv {
|
declare interface ImportMetaEnv {
|
||||||
readonly VITE_APP_ENV: string
|
readonly VITE_APP_NAME: string
|
||||||
|
readonly VITE_APP_SYSTEMCODE: string
|
||||||
// 更多环境变量...
|
// 更多环境变量...
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9,5 +10,12 @@ declare interface ImportMeta {
|
|||||||
}
|
}
|
||||||
|
|
||||||
declare interface Window {
|
declare interface Window {
|
||||||
wx: any;
|
wx: any
|
||||||
|
printLog: boolean | undefined | null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
declare module "*.vue" {
|
||||||
|
import type { DefineComponent } from "vue";
|
||||||
|
const component: DefineComponent<{}, {}, any>;
|
||||||
|
export default component;
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
# VITE_APP_ 开头的变量可在浏览器环境使用:import.meta.env.VITE_APP_XXXX
|
||||||
|
VITE_APP_NAME=vue3-template-h5
|
||||||
|
VITE_APP_SYSTEMCODE=paasid
|
||||||
|
|
||||||
|
# NODE_ 开头的变量可在serve和build环境使用:process.env.NODE_XXXX
|
||||||
|
NODE_PROXY_TARGET=https://xtbg.gdzwfw.gov.cn
|
||||||
|
NODE_VCONSOLE_SCRIPST=<script>printLog=/vconsole=true/.test(window.location);if(!printLog){console.log=function(){}}</script><script>;(function () {if (printLog) {var src = '/midjs/mjs/vconsole/v3.14.6/vconsole.min.js';document.write('<scr' + 'ipt src=\"' + src + '\"></scr' + 'ipt>');document.write('<scr' + 'ipt>new window.VConsole();</scr' + 'ipt>');};})();</script>
|
||||||
Vendored
+2
@@ -0,0 +1,2 @@
|
|||||||
|
NODE_PROXY_TARGET=https://xtbgtest.digitalgd.com.cn
|
||||||
|
NODE_VCONSOLE_SCRIPST=<script src="/midjs/mjs/vconsole/v3.14.6/vconsole.min.js"></script><script>new window.VConsole();</script>
|
||||||
Vendored
+2
@@ -0,0 +1,2 @@
|
|||||||
|
NODE_PROXY_TARGET=https://xtbg.digitalgd.com.cn
|
||||||
|
NODE_VCONSOLE_SCRIPST=<script src="/midjs/mjs/vconsole/v3.14.6/vconsole.min.js"></script><script>new window.VConsole();</script>
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
import { globalIgnores } from 'eslint/config'
|
||||||
|
import globals from 'globals'
|
||||||
|
import js from '@eslint/js'
|
||||||
|
import pluginVue from 'eslint-plugin-vue'
|
||||||
|
import {
|
||||||
|
defineConfigWithVueTs,
|
||||||
|
vueTsConfigs,
|
||||||
|
} from '@vue/eslint-config-typescript'
|
||||||
|
import pluginOxlint from 'eslint-plugin-oxlint'
|
||||||
|
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting'
|
||||||
|
|
||||||
|
export default defineConfigWithVueTs([
|
||||||
|
{
|
||||||
|
name: 'app/files-to-lint',
|
||||||
|
files: ['**/*.{ts,js,mjs,jsx,vue}'],
|
||||||
|
},
|
||||||
|
|
||||||
|
globalIgnores(['**/dist/**', '**/dist-ssr/**', '**/coverage/**']),
|
||||||
|
|
||||||
|
{
|
||||||
|
languageOptions: {
|
||||||
|
globals: {...globals.browser},
|
||||||
|
},
|
||||||
|
|
||||||
|
rules: {
|
||||||
|
'no-console': 'warn',
|
||||||
|
'no-debugger': 'warn',
|
||||||
|
"quotes": ["warn", "double"],
|
||||||
|
"semi": [2, "always"],
|
||||||
|
"comma-dangle": [2, "never"],
|
||||||
|
"eqeqeq": "warn",
|
||||||
|
"no-var": "warn",
|
||||||
|
"no-multi-spaces": "warn",
|
||||||
|
"no-trailing-spaces": "warn",
|
||||||
|
"camelcase": "warn",
|
||||||
|
"indent": ["warn", 2],
|
||||||
|
"space-infix-ops": "warn",
|
||||||
|
"space-unary-ops": "warn",
|
||||||
|
"switch-colon-spacing": "warn",
|
||||||
|
"arrow-spacing": "warn",
|
||||||
|
"array-bracket-spacing": "warn",
|
||||||
|
"vue/no-unused-vars": "warn",
|
||||||
|
"vue/multi-word-component-names": "off",
|
||||||
|
'vue/html-indent': [
|
||||||
|
'error',
|
||||||
|
2,
|
||||||
|
{
|
||||||
|
attribute: 1,
|
||||||
|
baseIndent: 1,
|
||||||
|
closeBracket: 0,
|
||||||
|
alignAttributesVertically: true,
|
||||||
|
ignores: []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'vue/max-attributes-per-line': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
singleline: {
|
||||||
|
max: 3
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'vue/html-closing-bracket-newline': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
singleline: 'never',
|
||||||
|
multiline: 'always'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
js.configs.recommended,
|
||||||
|
...pluginVue.configs['flat/essential'],
|
||||||
|
vueTsConfigs.recommended,
|
||||||
|
...pluginOxlint.configs['flat/recommended'],
|
||||||
|
skipFormatting,
|
||||||
|
{
|
||||||
|
rules: {
|
||||||
|
"@typescript-eslint/no-explicit-any": "warn"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
])
|
||||||
+7
-7
@@ -1,20 +1,20 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="zh-Hans">
|
<html lang="zh-Hans">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg"/>
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg"/>
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0"/>
|
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0"/>
|
||||||
<title><%- title %></title>
|
<title>%VITE_APP_NAME%</title>
|
||||||
<style>.xtbg-loading {display:inline-block;width:80px;height:80px;background-image:url("/favicon.svg");background-size:40px auto;background-repeat:no-repeat;background-position:center;position:fixed;margin-left:-40px;margin-top:-40px;left:50%;top:50%;}
|
<style>.xtbg-loading {display:inline-block;width:80px;height:80px;background-image:url("/favicon.svg");background-size:40px auto;background-repeat:no-repeat;background-position:center;position:fixed;margin-left:-40px;margin-top:-40px;left:50%;top:50%;}
|
||||||
.xtbg-loading:after {content:" ";display:block;width:80px;height:80px;box-sizing:border-box;border-radius:50%;border:4px solid #99bff3;border-color:#99bff3 transparent #99bff3 transparent;animation:xtbg-loading 1.3s linear infinite;}
|
.xtbg-loading:after {content:" ";display:block;width:80px;height:80px;box-sizing:border-box;border-radius:50%;border:4px solid #99bff3;border-color:#99bff3 transparent #99bff3 transparent;animation:xtbg-loading 1.3s linear infinite;}
|
||||||
@keyframes xtbg-loading {0% {transform:rotate(0deg);}
|
@keyframes xtbg-loading {0% {transform:rotate(0deg);}
|
||||||
100% {transform:rotate(360deg);}
|
100% {transform:rotate(360deg);}
|
||||||
}</style>
|
}</style>
|
||||||
|
%NODE_VCONSOLE_SCRIPST%
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"><div class="xtbg-loading"></div></div>
|
<div id="app"><div class="xtbg-loading"></div></div>
|
||||||
<%- injectScript %>
|
|
||||||
<script type="module" src="/src/main.ts"></script>
|
<script type="module" src="/src/main.ts"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Generated
+6873
File diff suppressed because it is too large.
Load diff
+43
-36
@@ -1,48 +1,55 @@
|
|||||||
{
|
{
|
||||||
"name": "vue3-template-h5",
|
"name": "mytest",
|
||||||
"description": "一个h5项目",
|
"description": "vue3-template-h5",
|
||||||
"author": "dengtongyu",
|
"author": "dengtongyu",
|
||||||
"private": true,
|
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"serve:test": "vite --mode test",
|
||||||
"serve:test": "cross-env VITE_APP_ENV=test vite",
|
"serve:uat": "vite --mode uat",
|
||||||
"serve:uat": "cross-env VITE_APP_ENV=uat vite",
|
"serve": "vite",
|
||||||
"serve:prod": "cross-env VITE_APP_ENV=prod vite",
|
"build:test": "run-p type-check \"build-only {@}\" -- -- --mode test",
|
||||||
"build:test": "vue-tsc --noEmit && cross-env VITE_APP_ENV=test vite build",
|
"build:uat": "run-p type-check \"build-only {@}\" -- -- --mode uat",
|
||||||
"build:uat": "vue-tsc --noEmit && cross-env VITE_APP_ENV=uat vite build",
|
"build": "run-p type-check \"build-only {@}\" --",
|
||||||
"build:prod": "vue-tsc --noEmit && cross-env VITE_APP_ENV=prod vite build",
|
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"lint": "eslint --fix config/*.{ts} && eslint --fix src/*.{ts,vue} && eslint --fix src/**/*.{ts,vue}"
|
"build-only": "vite build",
|
||||||
|
"type-check": "vue-tsc --noEmit -p tsconfig.app.json --composite false",
|
||||||
|
"lint:oxlint": "oxlint . --fix -D correctness --ignore-path .gitignore",
|
||||||
|
"lint:eslint": "eslint . --fix",
|
||||||
|
"lint": "run-s lint:*",
|
||||||
|
"format": "prettier --write src/"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^0.27.2",
|
"axios": "^1.6.2",
|
||||||
"pinia": "^2.0.19",
|
"pinia": "^2.1.7",
|
||||||
"vant": "^3.5.4",
|
"vant": "^4.8.0",
|
||||||
"vue": "^3.2.37",
|
"vue": "^3.3.4",
|
||||||
"vue-router": "^4.1.3"
|
"vue-router": "^4.2.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^18.11.18",
|
"@oxlint/darwin-x64": "^0.16.9",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.40.1",
|
"@rushstack/eslint-patch": "^1.11.0",
|
||||||
"@typescript-eslint/parser": "^5.40.1",
|
"@tsconfig/node18": "^18.2.2",
|
||||||
"@vitejs/plugin-legacy": "^2.0.1",
|
"@types/node": "^18.18.5",
|
||||||
"@vitejs/plugin-vue": "^3.0.0",
|
"@vitejs/plugin-legacy": "^6.1.1",
|
||||||
"@vue/eslint-config-prettier": "^7.0.0",
|
"@vitejs/plugin-vue": "^5.2.3",
|
||||||
"@vue/eslint-config-typescript": "^11.0.2",
|
"@vitejs/plugin-vue-jsx": "^4.1.2",
|
||||||
"cross-env": "^7.0.3",
|
"@vue/eslint-config-prettier": "^10.2.0",
|
||||||
"eslint": "^8.25.0",
|
"@vue/eslint-config-typescript": "^14.5.0",
|
||||||
"eslint-plugin-html": "^7.1.0",
|
"@vue/tsconfig": "^0.4.0",
|
||||||
"eslint-plugin-vue": "^9.6.0",
|
"eslint": "^9.26.0",
|
||||||
"less": "^4.1.3",
|
"eslint-plugin-oxlint": "^0.16.10",
|
||||||
"postcss-px-to-viewport": "^1.1.1",
|
"eslint-plugin-vue": "^10.1.0",
|
||||||
"prettier": "^2.7.1",
|
"less": "^4.2.0",
|
||||||
"typescript": "^4.6.4",
|
"npm-run-all2": "^6.1.1",
|
||||||
"unplugin-vue-components": "^0.22.4",
|
"postcss-px-conversion": "^0.0.4",
|
||||||
"vite": "^3.0.9",
|
"prettier": "^3.0.3",
|
||||||
"vite-plugin-html": "^3.2.0",
|
"terser": "^5.26.0",
|
||||||
"vite-plugin-vue-setup-extend": "^0.4.0",
|
"typescript": "~5.2.0",
|
||||||
"vue-tsc": "^0.38.4"
|
"unplugin-auto-import": "^0.17.3",
|
||||||
|
"unplugin-vue-components": "^0.26.0",
|
||||||
|
"vite": "^6.3.5",
|
||||||
|
"vue-tsc": "^1.8.19"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
import { proxyTarget } from "./config"
|
|
||||||
|
|
||||||
let proxyTable = {
|
|
||||||
"/zuul": {
|
|
||||||
target: proxyTarget,
|
|
||||||
changeOrigin: true
|
|
||||||
},
|
|
||||||
"/media/": {
|
|
||||||
target: proxyTarget,
|
|
||||||
changeOrigin: true
|
|
||||||
},
|
|
||||||
"/zwwxgzt": {
|
|
||||||
target: proxyTarget,
|
|
||||||
changeOrigin: true
|
|
||||||
},
|
|
||||||
"/midjs": {
|
|
||||||
target: proxyTarget,
|
|
||||||
changeOrigin: true
|
|
||||||
},
|
|
||||||
"/irc": {
|
|
||||||
target: proxyTarget,
|
|
||||||
changeOrigin: true
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export default proxyTable;
|
|
||||||
+5
-2
@@ -1,6 +1,9 @@
|
|||||||
<script setup lang="ts" name="App">
|
<script setup lang="ts">
|
||||||
|
defineOptions({
|
||||||
|
name: "App"
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<router-view />
|
<RouterView />
|
||||||
</template>
|
</template>
|
||||||
+2
-4
@@ -1,14 +1,12 @@
|
|||||||
import ajax from "../lib/ajax";
|
import ajax from "../lib/ajax";
|
||||||
// import { passid } from "../../config";
|
|
||||||
|
|
||||||
|
|
||||||
const HOST = "/zwwxgzt/workstation";
|
const HOST = "/zwwxgzt/workstation";
|
||||||
|
|
||||||
// 获取用户信息
|
// 获取用户信息
|
||||||
const getUserInfo = function (param: any) {
|
const getUserInfo = function (param: any) {
|
||||||
return ajax.post(`${HOST}/LoginUserInfo`, param);
|
return ajax.post(`${HOST}/LoginUserInfo`, param);
|
||||||
};
|
};
|
||||||
|
|
||||||
export {
|
export {
|
||||||
getUserInfo
|
getUserInfo
|
||||||
};
|
};
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import ajax from "../lib/ajax";
|
||||||
|
|
||||||
|
// 获取用户信息
|
||||||
|
const getJsApi = function () {
|
||||||
|
return ajax.get(`/${import.meta.env.VITE_APP_SYSTEMCODE}/jsapi`);
|
||||||
|
};
|
||||||
|
|
||||||
|
const getJSApiTicket = () => {
|
||||||
|
return ajax.get(
|
||||||
|
`/sgbackend/api/r/bc/zwwxapiagent/JSApiTicket?url=${location.href}`
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export {
|
||||||
|
getJsApi,
|
||||||
|
getJSApiTicket
|
||||||
|
};
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
<script setup lang="ts" name="HelloWorld">
|
<script setup lang="ts">
|
||||||
|
defineOptions({
|
||||||
|
name: "HelloWorld"
|
||||||
|
});
|
||||||
defineProps<{
|
defineProps<{
|
||||||
msg?: string;
|
msg?: string;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const logo = new URL(
|
const logo = new URL("../assets/svg/logo.svg",import.meta.url).href;
|
||||||
"../assets/svg/logo.svg",
|
|
||||||
import.meta.url
|
|
||||||
).href;
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<script setup lang="ts" name="IconAndText">
|
<script setup lang="ts">
|
||||||
import { computed } from "vue";
|
defineOptions({
|
||||||
|
name: "IconAndText"
|
||||||
|
});
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
icon?: string;
|
icon?: string;
|
||||||
text?: string;
|
text?: string;
|
||||||
@@ -14,7 +15,7 @@ const viewportWidth = 375;
|
|||||||
const unit = "vw";
|
const unit = "vw";
|
||||||
|
|
||||||
const pxToVw = (val:number) => {
|
const pxToVw = (val:number) => {
|
||||||
return viewportWidth/100 * val + unit;
|
return viewportWidth / 100 * val + unit;
|
||||||
};
|
};
|
||||||
|
|
||||||
const iconStyle = computed(() => {
|
const iconStyle = computed(() => {
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
<script setup lang="ts" name="Abnormal">
|
<script setup lang="ts">
|
||||||
import { computed } from "vue";
|
import type { LocationQueryValue } from "vue-router";
|
||||||
import { useRouter } from "vue-router";
|
import type { ButtonType } from "vant/es/button/types";
|
||||||
import { ButtonType } from "vant/es/button/types";
|
|
||||||
import IconAndText from "./iconAndText.vue";
|
import IconAndText from "./iconAndText.vue";
|
||||||
|
defineOptions({
|
||||||
|
name: "Abnormal"
|
||||||
|
});
|
||||||
interface buttonItem {
|
interface buttonItem {
|
||||||
text: string;
|
text: string;
|
||||||
code: string;
|
code: string;
|
||||||
@@ -20,7 +21,7 @@ interface buttonInfo {
|
|||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
icon?: string;
|
icon?: string;
|
||||||
text?: string;
|
text?: string;
|
||||||
from?: string;
|
from?: LocationQueryValue;
|
||||||
buttonHidden?: boolean;
|
buttonHidden?: boolean;
|
||||||
buttonList?: Array<string>;
|
buttonList?: Array<string>;
|
||||||
}>();
|
}>();
|
||||||
@@ -32,19 +33,19 @@ const defaultIcon = new URL("../../assets/svg/failed.svg", import.meta.url).href
|
|||||||
const defaultText = "抱歉,出现意外错误了";
|
const defaultText = "抱歉,出现意外错误了";
|
||||||
|
|
||||||
const backHandler = () => {
|
const backHandler = () => {
|
||||||
router.back();
|
router.back();
|
||||||
};
|
};
|
||||||
|
|
||||||
const homeHandler = () => {
|
const homeHandler = () => {
|
||||||
router.push({
|
router.push({
|
||||||
path: "/"
|
path: "/"
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const reloadHandler = () => {
|
const reloadHandler = () => {
|
||||||
router.push({
|
router.push({
|
||||||
path: props.from || "/"
|
path: props.from || "/"
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const defaultButtonList = ["back", "reload"]; // back, reload, home
|
const defaultButtonList = ["back", "reload"]; // back, reload, home
|
||||||
@@ -52,34 +53,34 @@ const defaultButtonList = ["back", "reload"]; // back, reload, home
|
|||||||
const renderButtonList = (props.buttonList && props.buttonList.length > 0) ? props.buttonList : defaultButtonList;
|
const renderButtonList = (props.buttonList && props.buttonList.length > 0) ? props.buttonList : defaultButtonList;
|
||||||
|
|
||||||
const buttonItemInfo: buttonInfo = {
|
const buttonItemInfo: buttonInfo = {
|
||||||
"reload": {
|
"reload": {
|
||||||
text: "重试",
|
text: "重试",
|
||||||
type: "primary",
|
type: "primary",
|
||||||
code: "reload",
|
code: "reload",
|
||||||
handler: reloadHandler
|
handler: reloadHandler
|
||||||
},
|
},
|
||||||
"back": {
|
"back": {
|
||||||
text: "返回",
|
text: "返回",
|
||||||
type: "default",
|
type: "default",
|
||||||
code: "back",
|
code: "back",
|
||||||
handler: backHandler
|
handler: backHandler
|
||||||
},
|
},
|
||||||
"home": {
|
"home": {
|
||||||
text: "首页",
|
text: "首页",
|
||||||
type: "primary",
|
type: "primary",
|
||||||
code: "home",
|
code: "home",
|
||||||
handler: homeHandler
|
handler: homeHandler
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderItemList = computed(() => {
|
const renderItemList = computed(() => {
|
||||||
const arr = [];
|
const arr = [];
|
||||||
for (let index = 0; index < renderButtonList.length; index++) {
|
for (let index = 0; index < renderButtonList.length; index++) {
|
||||||
const key = renderButtonList[index];
|
const key = renderButtonList[index];
|
||||||
const item = buttonItemInfo[key as keyof typeof buttonItemInfo];
|
const item = buttonItemInfo[key as keyof typeof buttonItemInfo];
|
||||||
arr.push(item);
|
arr.push(item);
|
||||||
}
|
}
|
||||||
return arr;
|
return arr;
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
|
import type { App } from "vue";
|
||||||
import { Button, Empty } from "vant";
|
import { Button, Empty } from "vant";
|
||||||
|
|
||||||
const install = function (app: any) {
|
const install = function (app: App) {
|
||||||
app.use(Button);
|
app.use(Button);
|
||||||
app.use(Empty);
|
app.use(Empty);
|
||||||
};
|
};
|
||||||
|
|
||||||
export {
|
export {
|
||||||
install
|
install
|
||||||
};
|
};
|
||||||
+1
-1
@@ -12,7 +12,7 @@ const browser = {
|
|||||||
android: u.indexOf("Android") > -1 || u.indexOf("Adr") > -1, //android终端
|
android: u.indexOf("Android") > -1 || u.indexOf("Adr") > -1, //android终端
|
||||||
iPad: u.indexOf("iPad") > -1, //是否iPad
|
iPad: u.indexOf("iPad") > -1, //是否iPad
|
||||||
webApp: u.indexOf("Safari") === -1, //是否web应该程序,没有头部与底部
|
webApp: u.indexOf("Safari") === -1, //是否web应该程序,没有头部与底部
|
||||||
zwwx: u.indexOf("zwwx-customized") > -1 //是否政务微信
|
yzy: u.indexOf("zwwx-customized") > -1 //是否粤政易
|
||||||
};
|
};
|
||||||
})()
|
})()
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,69 @@
|
|||||||
|
import { getJsApi } from "@/api/wx";
|
||||||
|
import { browser } from "@/lib/util";
|
||||||
|
|
||||||
|
const wxConfig = function (config: any, cb?: Function) {
|
||||||
|
//注入权限配置,获取经纬度
|
||||||
|
window["wx"].config({
|
||||||
|
beta: true, // 必须这么写,否则wx.invoke调用形式的jsapi会有问题
|
||||||
|
debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
|
||||||
|
appId: config.appid, // 必填,企业微信的corpID
|
||||||
|
timestamp: config.timestamp, // 必填,生成签名的时间戳
|
||||||
|
nonceStr: config.nonce, // 必填,生成签名的随机串
|
||||||
|
signature: config.signature, // 必填,签名,见附录1
|
||||||
|
jsApiList: ["openUrl"] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
|
||||||
|
});
|
||||||
|
window["wx"].ready(function () {
|
||||||
|
console.log("wx.ready");
|
||||||
|
// alert("wx.ready");
|
||||||
|
if (cb) cb();
|
||||||
|
// config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中。
|
||||||
|
//wx.closeWindow();
|
||||||
|
});
|
||||||
|
window["wx"].error(function (res: any) {
|
||||||
|
// alert("wx.error");
|
||||||
|
// config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。
|
||||||
|
console.log("wx.error", res);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 初始化微信js-sdk配置
|
||||||
|
const initConfig = function (cb?: Function) {
|
||||||
|
getJsApi().then((data: any) => {
|
||||||
|
data && wxConfig(data, cb);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const openWebViewUrl = function (url: string) {
|
||||||
|
if (browser.versions.yzy) {
|
||||||
|
window["wx"].invoke(
|
||||||
|
"openUrl",
|
||||||
|
{
|
||||||
|
type: 0, //0或不填表示使用内部浏览器新窗口打开,1表示用系统浏览器打开
|
||||||
|
url: url //url地址
|
||||||
|
},
|
||||||
|
(res: any) => {
|
||||||
|
console.log("打开新窗口回调:", res);
|
||||||
|
if (res.err_msg === "openUrl:ok") {
|
||||||
|
console.log("打开新窗口成功");
|
||||||
|
} else {
|
||||||
|
//错误处理
|
||||||
|
if (res.err_msg === "openUrl:need_real_time_auth") {
|
||||||
|
initConfig(() => {
|
||||||
|
if (url) {
|
||||||
|
openWebViewUrl(url);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
console.log("打开新窗口出错:", res.err_msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
window.location.href = url;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export {
|
||||||
|
initConfig,
|
||||||
|
openWebViewUrl
|
||||||
|
};
|
||||||
+1
-2
@@ -1,9 +1,8 @@
|
|||||||
import { createApp } from "vue";
|
import "./styles/index.less";
|
||||||
import routes from "./routes";
|
import routes from "./routes";
|
||||||
import App from "./App.vue";
|
import App from "./App.vue";
|
||||||
import pinia from "./store/pinia";
|
import pinia from "./store/pinia";
|
||||||
import { install } from "./installComponents";
|
import { install } from "./installComponents";
|
||||||
import "./styles/index.less";
|
|
||||||
|
|
||||||
const app = createApp(App);
|
const app = createApp(App);
|
||||||
app.use(pinia);
|
app.use(pinia);
|
||||||
|
|||||||
+5
-4
@@ -1,8 +1,9 @@
|
|||||||
<script setup lang="ts" name="Home">
|
<script setup lang="ts">
|
||||||
import { ref } from "vue";
|
|
||||||
import HelloWorld from "../components/HelloWorld.vue";
|
import HelloWorld from "../components/HelloWorld.vue";
|
||||||
import { baseInfo } from "../store";
|
import { baseInfo } from "../store";
|
||||||
|
defineOptions({
|
||||||
|
name: "Home"
|
||||||
|
});
|
||||||
const baseInfoStore = baseInfo();
|
const baseInfoStore = baseInfo();
|
||||||
const user = baseInfoStore.userInfo;
|
const user = baseInfoStore.userInfo;
|
||||||
|
|
||||||
@@ -11,7 +12,7 @@ const count = ref(0);
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="home">
|
<div class="home">
|
||||||
<hello-world :msg="user.name" />
|
<HelloWorld :msg="user.name" />
|
||||||
<p>{{count}}</p>
|
<p>{{count}}</p>
|
||||||
<van-button type="primary" @click="count++">按钮</van-button>
|
<van-button type="primary" @click="count++">按钮</van-button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
<script setup lang="ts" name="Login">
|
<script setup lang="ts">
|
||||||
import { useRoute, useRouter } from "vue-router";
|
import type { LocationQueryValue } from "vue-router";
|
||||||
import pinia from "../store/pinia";
|
import pinia from "../store/pinia";
|
||||||
import { baseInfo } from "../store";
|
import { baseInfo } from "../store";
|
||||||
|
defineOptions({
|
||||||
|
name: "Initing"
|
||||||
|
});
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const baseInfoStore = baseInfo(pinia);
|
const baseInfoStore = baseInfo(pinia);
|
||||||
const rediret: any = route.query.rediret;
|
const rediret: LocationQueryValue | LocationQueryValue[] = route.query.rediret;
|
||||||
|
|
||||||
baseInfoStore
|
baseInfoStore
|
||||||
.loginUserInfo()
|
.loginUserInfo()
|
||||||
@@ -15,7 +17,7 @@ baseInfoStore
|
|||||||
const { errcode, errmsg } = res;
|
const { errcode, errmsg } = res;
|
||||||
if (errcode === 401) return;
|
if (errcode === 401) return;
|
||||||
if (errcode === 0) {
|
if (errcode === 0) {
|
||||||
router.replace(rediret);
|
router.replace(rediret as string);
|
||||||
}
|
}
|
||||||
else if (errcode === 400) {
|
else if (errcode === 400) {
|
||||||
router.replace({
|
router.replace({
|
||||||
@@ -1,14 +1,16 @@
|
|||||||
<script setup lang="ts" name="DeviceAbnormal">
|
<script setup lang="ts">
|
||||||
import { useRoute } from "vue-router";
|
import type { LocationQueryValue } from "vue-router";
|
||||||
import Abnormal from "@/components/abnormal/index.vue";
|
import Abnormal from "@/components/abnormal/index.vue";
|
||||||
|
defineOptions({
|
||||||
|
name: "DeviceAbnormal"
|
||||||
|
});
|
||||||
defineProps<{
|
defineProps<{
|
||||||
text?: string;
|
text?: string;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const from: any = route.query.from;
|
const from: LocationQueryValue = route.query.from as LocationQueryValue;
|
||||||
const msg: any = route.query.text;
|
const msg: LocationQueryValue = route.query.text as LocationQueryValue;
|
||||||
|
|
||||||
const icon = new URL("../../assets/svg/device_abnormal.svg", import.meta.url).href;
|
const icon = new URL("../../assets/svg/device_abnormal.svg", import.meta.url).href;
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
<script setup lang="ts" name="404">
|
<script setup lang="ts">
|
||||||
import { useRoute } from "vue-router";
|
import type { LocationQueryValue } from "vue-router";
|
||||||
import Abnormal from "@/components/abnormal/index.vue";
|
import Abnormal from "@/components/abnormal/index.vue";
|
||||||
|
defineOptions({
|
||||||
|
name: "Error404"
|
||||||
|
});
|
||||||
defineProps<{
|
defineProps<{
|
||||||
text?: string;
|
text?: string;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const from: any = route.query.from;
|
const from: LocationQueryValue = route.query.from as LocationQueryValue;
|
||||||
|
|
||||||
|
|
||||||
const icon = new URL("../../assets/svg/404.svg", import.meta.url).href;
|
const icon = new URL("../../assets/svg/404.svg", import.meta.url).href;
|
||||||
@@ -1,14 +1,16 @@
|
|||||||
<script setup lang="ts" name="500">
|
<script setup lang="ts">
|
||||||
import { useRoute } from "vue-router";
|
import type { LocationQueryValue } from "vue-router";
|
||||||
import Abnormal from "../../components/abnormal/index.vue";
|
import Abnormal from "../../components/abnormal/index.vue";
|
||||||
|
defineOptions({
|
||||||
|
name: "Error500"
|
||||||
|
});
|
||||||
defineProps<{
|
defineProps<{
|
||||||
text?: string;
|
text?: string;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const from: any = route.query.from;
|
const from: LocationQueryValue = route.query.from as LocationQueryValue;
|
||||||
const msg: any = route.query.text;
|
const msg: LocationQueryValue = route.query.text as LocationQueryValue;
|
||||||
|
|
||||||
const icon = new URL("../../assets/svg/500.svg", import.meta.url).href;
|
const icon = new URL("../../assets/svg/500.svg", import.meta.url).href;
|
||||||
|
|
||||||
@@ -1,14 +1,16 @@
|
|||||||
<script setup lang="ts" name="Failed">
|
<script setup lang="ts">
|
||||||
import { useRoute } from "vue-router";
|
import type { LocationQueryValue } from "vue-router";
|
||||||
import Abnormal from "@/components/abnormal/index.vue";
|
import Abnormal from "@/components/abnormal/index.vue";
|
||||||
|
defineOptions({
|
||||||
|
name: "Failed"
|
||||||
|
});
|
||||||
defineProps<{
|
defineProps<{
|
||||||
text?: string;
|
text?: string;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const from: any = route.query.from;
|
const from: LocationQueryValue = route.query.from as LocationQueryValue;
|
||||||
const msg: any = route.query.text;
|
const msg: LocationQueryValue = route.query.text as LocationQueryValue;
|
||||||
|
|
||||||
const icon = new URL("../../assets/svg/failed.svg", import.meta.url).href;
|
const icon = new URL("../../assets/svg/failed.svg", import.meta.url).href;
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,16 @@
|
|||||||
<script setup lang="ts" name="NoAccess">
|
<script setup lang="ts">
|
||||||
import { useRoute } from "vue-router";
|
import type { LocationQueryValue } from "vue-router";
|
||||||
import Abnormal from "@/components/abnormal/index.vue";
|
import Abnormal from "@/components/abnormal/index.vue";
|
||||||
|
defineOptions({
|
||||||
|
name: "NoAccess"
|
||||||
|
});
|
||||||
defineProps<{
|
defineProps<{
|
||||||
text?: string;
|
text?: string;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const from: any = route.query.from;
|
const from: LocationQueryValue = route.query.from as LocationQueryValue;
|
||||||
const msg: any = route.query.text;
|
const msg: LocationQueryValue = route.query.text as LocationQueryValue;
|
||||||
|
|
||||||
const icon = new URL("../../assets/svg/no_permission.svg", import.meta.url).href;
|
const icon = new URL("../../assets/svg/no_permission.svg", import.meta.url).href;
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,16 @@
|
|||||||
<script setup lang="ts" name="NoNetwork">
|
<script setup lang="ts">
|
||||||
import { useRoute } from "vue-router";
|
import type { LocationQueryValue } from "vue-router";
|
||||||
import Abnormal from "@/components/abnormal/index.vue";
|
import Abnormal from "@/components/abnormal/index.vue";
|
||||||
|
defineOptions({
|
||||||
|
name: "NoData"
|
||||||
|
});
|
||||||
defineProps<{
|
defineProps<{
|
||||||
text?: string;
|
text?: string;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const from: any = route.query.from;
|
const from: LocationQueryValue = route.query.from as LocationQueryValue;
|
||||||
const msg: any = route.query.text;
|
const msg: LocationQueryValue = route.query.text as LocationQueryValue;
|
||||||
|
|
||||||
const icon = new URL("../../assets/svg/no_data.svg", import.meta.url).href;
|
const icon = new URL("../../assets/svg/no_data.svg", import.meta.url).href;
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,16 @@
|
|||||||
<script setup lang="ts" name="NoNetwork">
|
<script setup lang="ts">
|
||||||
import { useRoute } from "vue-router";
|
import type { LocationQueryValue } from "vue-router";
|
||||||
import Abnormal from "@/components/abnormal/index.vue";
|
import Abnormal from "@/components/abnormal/index.vue";
|
||||||
|
defineOptions({
|
||||||
|
name: "NoNetwork"
|
||||||
|
});
|
||||||
defineProps<{
|
defineProps<{
|
||||||
text?: string;
|
text?: string;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const from: any = route.query.from;
|
const from: LocationQueryValue = route.query.from as LocationQueryValue;
|
||||||
const msg: any = route.query.text;
|
const msg: LocationQueryValue = route.query.text as LocationQueryValue;
|
||||||
|
|
||||||
const icon = new URL("../../assets/svg/no_network.svg", import.meta.url).href;
|
const icon = new URL("../../assets/svg/no_network.svg", import.meta.url).href;
|
||||||
|
|
||||||
|
|||||||
+2
-3
@@ -1,4 +1,3 @@
|
|||||||
import { createWebHashHistory, createRouter } from "vue-router";
|
|
||||||
import routes from "./routes";
|
import routes from "./routes";
|
||||||
import pinia from "../store/pinia";
|
import pinia from "../store/pinia";
|
||||||
import { baseInfo } from "../store";
|
import { baseInfo } from "../store";
|
||||||
@@ -14,12 +13,12 @@ const router = createRouter({
|
|||||||
|
|
||||||
router.beforeEach((to, from, next) => {
|
router.beforeEach((to, from, next) => {
|
||||||
if (to.meta && to.meta.power) {
|
if (to.meta && to.meta.power) {
|
||||||
const user = baseInfoStore.userInfo.value;
|
const user = baseInfoStore.userInfo;
|
||||||
if (user.uin) {
|
if (user.uin) {
|
||||||
next();
|
next();
|
||||||
} else {
|
} else {
|
||||||
next({
|
next({
|
||||||
path: "/loginfo",
|
path: "/initing",
|
||||||
query: {
|
query: {
|
||||||
rediret: to.fullPath
|
rediret: to.fullPath
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
const routes = [
|
const routes = [
|
||||||
{ path: "/", name: "root", redirect: "/home" },
|
{ path: "/", name: "root", redirect: "/home" },
|
||||||
{ path: "/home", name: "home", meta: { power: true }, component: () => import("../pages/Home.vue") },
|
{ path: "/home", name: "home", meta: { power: true }, component: () => import("../pages/Home.vue") },
|
||||||
{ path: "/loginfo", name: "loginfo", component: () => import("../pages/Login.vue") },
|
{ path: "/initing", name: "initing", component: () => import("../pages/Initing.vue") },
|
||||||
{ path: "/nonetwork:text?", name: "nonetwork", props: true, component: () => import("../pages/error/NoNetwork.vue") },
|
{ path: "/nonetwork:text?", name: "nonetwork", props: true, component: () => import("../pages/error/NoNetwork.vue") },
|
||||||
{ path: "/noaccess/:text?", name: "noaccess", props: true, component: () => import("../pages/error/NoAccess.vue") },
|
{ path: "/noaccess/:text?", name: "noaccess", props: true, component: () => import("../pages/error/NoAccess.vue") },
|
||||||
{ path: "/empty/:text?", name: "empty", props: true, component: () => import("../pages/error/NoData.vue") },
|
{ path: "/empty/:text?", name: "empty", props: true, component: () => import("../pages/error/NoData.vue") },
|
||||||
{ path: "/deviceabnormal/:text?", name: "deviceabnormal", props: true, component: () => import("../pages/error/DeviceAbnormal.vue") },
|
{ path: "/deviceabnormal/:text?", name: "deviceabnormal", props: true, component: () => import("../pages/error/DeviceAbnormal.vue") },
|
||||||
{ path: "/failed/:text?", name: "failed", props: true, component: () => import("../pages/error/Failed.vue") },
|
{ path: "/failed/:text?", name: "failed", props: true, component: () => import("../pages/error/Failed.vue") },
|
||||||
{ path: "/500/:text?", name: "500", props: true, component: () => import("../pages/error/500.vue") },
|
{ path: "/500/:text?", name: "error500", props: true, component: () => import("../pages/error/Error500.vue") },
|
||||||
{ path: "/404", name: "404", component: () => import("../pages/error/404.vue") },
|
{ path: "/404", name: "error404", component: () => import("../pages/error/Error404.vue") },
|
||||||
{ path: "/:catchAll(.*)", redirect: "/404", hidden: true }
|
{ path: "/:catchAll(.*)", redirect: "/404", hidden: true }
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
import { defineStore } from "pinia";
|
|
||||||
import { ref, computed } from "vue";
|
|
||||||
import { getUserInfo } from "../api";
|
import { getUserInfo } from "../api";
|
||||||
|
|
||||||
const baseInfo = defineStore("baseInfo", () => {
|
const baseInfo = defineStore("baseInfo", () => {
|
||||||
@@ -21,7 +19,7 @@ const baseInfo = defineStore("baseInfo", () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
const userInfo = computed(() => {
|
const userInfo = computed(() => {
|
||||||
return user;
|
return user.value;
|
||||||
});
|
});
|
||||||
|
|
||||||
return { loginUserInfo, userInfo };
|
return { loginUserInfo, userInfo };
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
import baseInfo from "./baseInfo";
|
import baseInfo from "./baseInfo";
|
||||||
|
|
||||||
export {
|
export {
|
||||||
baseInfo
|
baseInfo
|
||||||
};
|
};
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
import { createPinia } from "pinia";
|
|
||||||
|
|
||||||
const pinia = createPinia();
|
const pinia = createPinia();
|
||||||
|
|
||||||
export default pinia;
|
export default pinia;
|
||||||
+93
-68
@@ -1,77 +1,102 @@
|
|||||||
:root {
|
:root {
|
||||||
font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
|
line-height: 24px;
|
||||||
font-size: 16px;
|
-webkit-font-smoothing: antialiased;
|
||||||
line-height: 24px;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
font-weight: 400;
|
}
|
||||||
|
|
||||||
color-scheme: light dark;
|
body,
|
||||||
color: rgba(255, 255, 255, 0.87);
|
div,
|
||||||
background-color: #242424;
|
dl,
|
||||||
|
dt,
|
||||||
font-synthesis: none;
|
dd,
|
||||||
text-rendering: optimizeLegibility;
|
ul,
|
||||||
-webkit-font-smoothing: antialiased;
|
ol,
|
||||||
-moz-osx-font-smoothing: grayscale;
|
li,
|
||||||
-webkit-text-size-adjust: 100%;
|
h1,
|
||||||
}
|
h2,
|
||||||
|
h3,
|
||||||
html,
|
h4,
|
||||||
body,
|
h5,
|
||||||
#app {
|
h6,
|
||||||
width: 100%;
|
pre,
|
||||||
height: 100%;
|
code,
|
||||||
|
form,
|
||||||
|
fieldset,
|
||||||
|
legend,
|
||||||
|
input,
|
||||||
|
textarea,
|
||||||
|
p,
|
||||||
|
blockquote,
|
||||||
|
th,
|
||||||
|
td,
|
||||||
|
hr,
|
||||||
|
button,
|
||||||
|
article,
|
||||||
|
aside,
|
||||||
|
details,
|
||||||
|
figcaption,
|
||||||
|
figure,
|
||||||
|
footer,
|
||||||
|
header,
|
||||||
|
hgroup,
|
||||||
|
menu,
|
||||||
|
nav,
|
||||||
|
section {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
padding: 0
|
||||||
|
}
|
||||||
|
|
||||||
ul,
|
html,body {
|
||||||
li,
|
width: 100vw;
|
||||||
p,
|
height: 100vh;
|
||||||
h1,
|
}
|
||||||
h2,
|
#app {
|
||||||
h3,
|
width: 100%;
|
||||||
h4,
|
height: 100%;
|
||||||
h5,
|
}
|
||||||
h6 {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#app {
|
#app {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
color: #000;
|
color: #000;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-family: "Helvetica", "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", SimSun, sans-serif;
|
font-family: "Helvetica", "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", SimSun, sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
.xtbg-tips-page {
|
.xtbg-tips-page {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
&-image {
|
|
||||||
width: 200px;
|
&-image {
|
||||||
height: 200px;
|
width: 200px;
|
||||||
& > img {
|
height: 200px;
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
&>img {
|
||||||
object-fit: cover;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&-text {
|
|
||||||
margin-top: 10px;
|
|
||||||
padding: 0 16px;
|
|
||||||
line-height: 26px;
|
|
||||||
color: #888;
|
|
||||||
font-size: 16px;
|
|
||||||
}
|
|
||||||
&-btn {
|
|
||||||
margin-top: 20px;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
height: 100%;
|
||||||
justify-content: center;
|
object-fit: cover;
|
||||||
&-class {
|
|
||||||
min-width: 100px;
|
|
||||||
margin: 0 8px !important;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&-text {
|
||||||
|
margin-top: 10px;
|
||||||
|
padding: 0 16px;
|
||||||
|
line-height: 26px;
|
||||||
|
color: #888;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-btn {
|
||||||
|
margin-top: 20px;
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
&-class {
|
||||||
|
min-width: 100px;
|
||||||
|
margin: 0 8px !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Vendored
-7
@@ -1,7 +0,0 @@
|
|||||||
/// <reference types="vite/client" />
|
|
||||||
|
|
||||||
declare module "*.vue" {
|
|
||||||
import type { DefineComponent } from "vue";
|
|
||||||
const component: DefineComponent<{}, {}, any>;
|
|
||||||
export default component;
|
|
||||||
}
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
import axios from "axios";
|
|
||||||
|
|
||||||
// 初始化微信js-sdk配置
|
|
||||||
const initConfig = (config: any) => {
|
|
||||||
function jsdkCB(data: any) {
|
|
||||||
let jsApiList = ["showWatermark"];
|
|
||||||
if (typeof window.wx !== "object") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!config) {
|
|
||||||
config = {};
|
|
||||||
}
|
|
||||||
jsApiList = jsApiList.concat(config.jsApiList || []);
|
|
||||||
const wxError = {
|
|
||||||
status: "",
|
|
||||||
errmsg: "配置失败,请退出重试"
|
|
||||||
};
|
|
||||||
if (data.appid) {
|
|
||||||
window.wx.config({
|
|
||||||
beta: true,
|
|
||||||
debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
|
|
||||||
appId: data.appid, // 必填,政务微信的cropID
|
|
||||||
timestamp: data.timestamp, // 必填,生成签名的时间戳
|
|
||||||
nonceStr: data.nonce, // 必填,生成签名的随机串
|
|
||||||
signature: data.signature, // 必填,签名,见附录1
|
|
||||||
jsApiList: jsApiList // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
|
|
||||||
});
|
|
||||||
window.wx.ready(function (e: any) {
|
|
||||||
console.log("config注册成功");
|
|
||||||
// window['_initSuccess'] = true;
|
|
||||||
// 注册政务微信权限API,需要AgentId
|
|
||||||
// wxApi.registerAgentConfig(data, config);
|
|
||||||
typeof config.sucesscb === "function" && config.sucesscb(e);
|
|
||||||
});
|
|
||||||
window.wx.error(function (e: any) {
|
|
||||||
console.log("initConfig wx error:", e);
|
|
||||||
typeof config.errorcb === "function" && config.errorcb(wxError);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
axios.get("/zwwxgzt/jsapi").then((res) => {
|
|
||||||
res && jsdkCB(res);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
export {
|
|
||||||
initConfig
|
|
||||||
};
|
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"extends": "@vue/tsconfig/tsconfig.dom.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
||||||
|
"paths": {
|
||||||
|
"@/*": ["./src/*"]
|
||||||
|
},
|
||||||
|
|
||||||
|
/* Linting */
|
||||||
|
"strict": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"noUnusedParameters": true,
|
||||||
|
"erasableSyntaxOnly": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"noUncheckedSideEffectImports": true
|
||||||
|
},
|
||||||
|
"include": ["*.d.ts", "src/**/*", "src/**/*.vue", "src/**/*.json"],
|
||||||
|
"exclude": ["src/**/__tests__/*"],
|
||||||
|
}
|
||||||
+3
-39
@@ -1,43 +1,7 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"files": [],
|
||||||
"target": "ESNext",
|
|
||||||
"useDefineForClassFields": true,
|
|
||||||
"module": "ESNext",
|
|
||||||
"moduleResolution": "Node",
|
|
||||||
"strict": true,
|
|
||||||
"jsx": "preserve",
|
|
||||||
"sourceMap": true,
|
|
||||||
"resolveJsonModule": true,
|
|
||||||
"isolatedModules": true,
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"lib": [
|
|
||||||
"ESNext",
|
|
||||||
"DOM"
|
|
||||||
],
|
|
||||||
"skipLibCheck": true,
|
|
||||||
"allowSyntheticDefaultImports": true,
|
|
||||||
"baseUrl": "./",
|
|
||||||
"paths": {
|
|
||||||
"@/*": [
|
|
||||||
"src/*"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"types": [
|
|
||||||
"vite/client",
|
|
||||||
"node"
|
|
||||||
],
|
|
||||||
},
|
|
||||||
"include": [
|
|
||||||
"./*.d.ts",
|
|
||||||
"src/**/*.ts",
|
|
||||||
"src/**/*.d.ts",
|
|
||||||
"src/**/*.tsx",
|
|
||||||
"src/**/*.vue",
|
|
||||||
"config/**/*.ts"
|
|
||||||
],
|
|
||||||
"references": [
|
"references": [
|
||||||
{
|
{ "path": "./tsconfig.app.json" },
|
||||||
"path": "./tsconfig.node.json"
|
{ "path": "./tsconfig.node.json" }
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
+24
-4
@@ -1,9 +1,29 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"composite": true,
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
||||||
|
"target": "ES2022",
|
||||||
|
"lib": ["ES2023"],
|
||||||
"module": "ESNext",
|
"module": "ESNext",
|
||||||
"moduleResolution": "Node",
|
"skipLibCheck": true,
|
||||||
"allowSyntheticDefaultImports": true
|
|
||||||
|
/* Bundler mode */
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"allowImportingTsExtensions": true,
|
||||||
|
"verbatimModuleSyntax": true,
|
||||||
|
"moduleDetection": "force",
|
||||||
|
"noEmit": true,
|
||||||
|
|
||||||
|
/* Linting */
|
||||||
|
"strict": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"noUnusedParameters": true,
|
||||||
|
"erasableSyntaxOnly": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"noUncheckedSideEffectImports": true
|
||||||
},
|
},
|
||||||
"include": ["vite.config.ts", "proxy.config.ts", "config/**/*.ts", "./*.d.ts",]
|
"include": [
|
||||||
|
"vite.config.ts",
|
||||||
|
"src/styles/theme.json",
|
||||||
|
"vite.util.ts"
|
||||||
|
],
|
||||||
}
|
}
|
||||||
+46
-72
@@ -1,101 +1,75 @@
|
|||||||
|
import { fileURLToPath, URL } from "node:url";
|
||||||
import { defineConfig, loadEnv } from "vite";
|
import { defineConfig, loadEnv } from "vite";
|
||||||
import vue from "@vitejs/plugin-vue";
|
import vue from "@vitejs/plugin-vue";
|
||||||
|
import vueJsx from "@vitejs/plugin-vue-jsx";
|
||||||
|
import AutoImport from "unplugin-auto-import/vite";
|
||||||
import Components from "unplugin-vue-components/vite";
|
import Components from "unplugin-vue-components/vite";
|
||||||
import { VantResolver } from "unplugin-vue-components/resolvers";
|
import { VantResolver } from "unplugin-vue-components/resolvers";
|
||||||
import postcsspxtoviewport from "postcss-px-to-viewport";
|
import postcssPxConversion from "postcss-px-conversion";
|
||||||
import { createHtmlPlugin } from "vite-plugin-html";
|
|
||||||
import VueSetupExtend from "vite-plugin-vue-setup-extend";
|
|
||||||
import legacy from "@vitejs/plugin-legacy";
|
import legacy from "@vitejs/plugin-legacy";
|
||||||
import proxyConfig from "./proxy.config";
|
import {
|
||||||
import { appName, injectScriptStr } from "./config";
|
setCrossoriginUseCredentials,
|
||||||
import path from "path";
|
injectHtmlVars,
|
||||||
|
proxyConfig
|
||||||
|
} from "./vite.util";
|
||||||
|
|
||||||
type enforceType = "post" | "pre";
|
|
||||||
const enforceValue:enforceType = "post";
|
|
||||||
const setCrossoriginUseCredentials = () => {
|
export default defineConfig(({ mode }) => {
|
||||||
|
const envDir = `${process.cwd()}/env`;
|
||||||
|
const env = loadEnv(mode, envDir, "NODE_");
|
||||||
return {
|
return {
|
||||||
name: "set-crossorigin",
|
|
||||||
enforce: enforceValue,
|
|
||||||
transformIndexHtml(html) {
|
|
||||||
return html.replace(/crossorigin/g, "crossorigin=\"use-credentials\"");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
|
||||||
export default (opt: any) => {
|
|
||||||
const { mode } = opt;
|
|
||||||
const env: any = loadEnv(mode, process.cwd());
|
|
||||||
|
|
||||||
return defineConfig({
|
|
||||||
base: "./",
|
base: "./",
|
||||||
envDir: "./env",
|
envDir: "./env",
|
||||||
build: {
|
|
||||||
target: "es2015"
|
|
||||||
},
|
|
||||||
plugins: [
|
plugins: [
|
||||||
createHtmlPlugin({
|
vue(),
|
||||||
inject: {
|
vueJsx(),
|
||||||
data: {
|
AutoImport({
|
||||||
title: appName,
|
imports: ["vue", "pinia", {
|
||||||
injectScript: injectScriptStr
|
"vue-router": [
|
||||||
}
|
"useLink",
|
||||||
|
"useRoute",
|
||||||
|
"useRouter",
|
||||||
|
"onBeforeRouteLeave",
|
||||||
|
"onBeforeRouteUpdate",
|
||||||
|
"createRouter",
|
||||||
|
"createWebHistory",
|
||||||
|
"createWebHashHistory"
|
||||||
|
]
|
||||||
|
}],
|
||||||
|
eslintrc: {
|
||||||
|
// 会在项目根目录自动生成.eslintrc-auto-import.json
|
||||||
|
enabled: true
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
vue(),
|
|
||||||
VueSetupExtend(),
|
|
||||||
Components({
|
Components({
|
||||||
resolvers: [VantResolver()]
|
resolvers: [VantResolver()]
|
||||||
}),
|
}),
|
||||||
legacy({
|
legacy({
|
||||||
// targets: ['defaults', 'not IE 11'],
|
targets: ["chrome 87"]
|
||||||
targets: ["chrome 52"],
|
|
||||||
additionalLegacyPolyfills: ["regenerator-runtime/runtime"],
|
|
||||||
renderLegacyChunks: true,
|
|
||||||
polyfills: [
|
|
||||||
"es.symbol",
|
|
||||||
"es.array.filter",
|
|
||||||
"es.promise",
|
|
||||||
"es.promise.finally",
|
|
||||||
"es/map",
|
|
||||||
"es/set",
|
|
||||||
"es.array.for-each",
|
|
||||||
"es.object.define-properties",
|
|
||||||
"es.object.define-property",
|
|
||||||
"es.object.get-own-property-descriptor",
|
|
||||||
"es.object.get-own-property-descriptors",
|
|
||||||
"es.object.keys",
|
|
||||||
"es.object.to-string",
|
|
||||||
"web.dom-collections.for-each",
|
|
||||||
"esnext.global-this",
|
|
||||||
"esnext.string.match-all"
|
|
||||||
]
|
|
||||||
}),
|
}),
|
||||||
setCrossoriginUseCredentials()
|
setCrossoriginUseCredentials(),
|
||||||
|
injectHtmlVars(env)
|
||||||
],
|
],
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
"@": fileURLToPath(new URL("./src", import.meta.url))
|
||||||
|
}
|
||||||
|
},
|
||||||
css: {
|
css: {
|
||||||
preprocessorOptions: {
|
|
||||||
less: {
|
|
||||||
javascriptEnabled: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
postcss: {
|
postcss: {
|
||||||
plugins: [
|
plugins: [
|
||||||
postcsspxtoviewport({
|
postcssPxConversion({
|
||||||
viewportWidth: 375
|
viewportWidth: 375
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
server: {
|
server: {
|
||||||
proxy: proxyConfig
|
proxy: proxyConfig(env)
|
||||||
},
|
},
|
||||||
resolve: {
|
build: {
|
||||||
alias: {
|
modulePreload: false
|
||||||
"@": path.resolve(__dirname, "src")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
});
|
||||||
};
|
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
type enforceType = "post" | "pre";
|
||||||
|
const enforceValue: enforceType = "post";
|
||||||
|
|
||||||
|
const setCrossoriginUseCredentials = () => {
|
||||||
|
return {
|
||||||
|
name: "set-crossorigin",
|
||||||
|
enforce: enforceValue,
|
||||||
|
transformIndexHtml(html: string) {
|
||||||
|
return html.replace(/crossorigin/g, "crossorigin=\"use-credentials\"");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
const injectHtmlVars = (env: Record<string, string>) => {
|
||||||
|
return {
|
||||||
|
name: "inject-html-vars",
|
||||||
|
enforce: enforceValue,
|
||||||
|
transformIndexHtml(html: string) {
|
||||||
|
let str = html;
|
||||||
|
for (const key in env) {
|
||||||
|
if (Object.prototype.hasOwnProperty.call(env, key)) {
|
||||||
|
const element = env[key];
|
||||||
|
const reg = new RegExp(`%${key}%`, "g");
|
||||||
|
str = str.replace(reg, element);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
const proxyConfig = (env: Record<string, string>) => {
|
||||||
|
const { NODE_PROXY_TARGET } = env;
|
||||||
|
const proxyTarget = NODE_PROXY_TARGET || "";
|
||||||
|
const proxyTable = {
|
||||||
|
"/zuul": {
|
||||||
|
target: proxyTarget,
|
||||||
|
changeOrigin: true
|
||||||
|
},
|
||||||
|
"/media/": {
|
||||||
|
target: proxyTarget,
|
||||||
|
changeOrigin: true
|
||||||
|
},
|
||||||
|
"/zwwxgzt": {
|
||||||
|
target: proxyTarget,
|
||||||
|
changeOrigin: true
|
||||||
|
},
|
||||||
|
"/midjs": {
|
||||||
|
target: proxyTarget,
|
||||||
|
changeOrigin: true
|
||||||
|
},
|
||||||
|
"/irc": {
|
||||||
|
target: proxyTarget,
|
||||||
|
changeOrigin: true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return proxyTable;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default {
|
||||||
|
setCrossoriginUseCredentials,
|
||||||
|
injectHtmlVars,
|
||||||
|
proxyConfig
|
||||||
|
};
|
||||||
|
|
||||||
|
export {
|
||||||
|
setCrossoriginUseCredentials,
|
||||||
|
injectHtmlVars,
|
||||||
|
proxyConfig
|
||||||
|
};
|
||||||
Reference in new issue
Block a user