business_tms_program 0.0.0
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/.editorconfig +12 -0
- package/.eslintrc-auto-import.json +113 -0
- package/.eslintrc.js +121 -0
- package/.prettierrc.js +9 -0
- package/.stylelintignore +4 -0
- package/README.md +43 -0
- package/components.d.ts +23 -0
- package/index.html +20 -0
- package/package.json +70 -0
- package/shims-uni.d.ts +10 -0
- package/src/App.vue +81 -0
- package/src/api/afterSale.ts +184 -0
- package/src/api/context.ts +26 -0
- package/src/api/device.ts +134 -0
- package/src/api/index.ts +80 -0
- package/src/api/installtion.ts +155 -0
- package/src/api/model/index.ts +15 -0
- package/src/api/model/userModel.ts +62 -0
- package/src/api/order.ts +49 -0
- package/src/api/system.ts +19 -0
- package/src/api/user.ts +171 -0
- package/src/auto-imports.d.ts +108 -0
- package/src/components/ConfirmDialog.vue +101 -0
- package/src/components/DaySelect.vue +212 -0
- package/src/components/Drawer.vue +104 -0
- package/src/components/DrawerSelect.vue +105 -0
- package/src/components/DropMenu.vue +144 -0
- package/src/components/Empty.vue +49 -0
- package/src/components/Loading.vue +41 -0
- package/src/components/RippleBtn.vue +159 -0
- package/src/components/SinglePick.vue +120 -0
- package/src/components/Skeleton.vue +43 -0
- package/src/components/Timeline.vue +85 -0
- package/src/components/Upload.vue +217 -0
- package/src/config/app.ts +32 -0
- package/src/config/env.ts +29 -0
- package/src/dict/afterSale.ts +161 -0
- package/src/dict/device.ts +29 -0
- package/src/dict/installtion.ts +141 -0
- package/src/dict/systems.ts +4 -0
- package/src/env.d.ts +8 -0
- package/src/hooks/useForm.ts +222 -0
- package/src/hooks/useUpload.ts +80 -0
- package/src/main.ts +8 -0
- package/src/manifest.json +39 -0
- package/src/pages/acceptance/DeviceInfo.vue +132 -0
- package/src/pages/acceptance/list.vue +276 -0
- package/src/pages/afterSale/DeviceInfo.vue +128 -0
- package/src/pages/afterSale/Step.vue +0 -0
- package/src/pages/afterSale/faultReport.vue +552 -0
- package/src/pages/afterSale/orderDetail.vue +327 -0
- package/src/pages/afterSale/orderFinish.vue +517 -0
- package/src/pages/afterSale/orderList.vue +305 -0
- package/src/pages/afterSale/returnVisit.vue +288 -0
- package/src/pages/afterSale/searchDeviceList.vue +148 -0
- package/src/pages/device/Search.vue +201 -0
- package/src/pages/device/acceptance.vue +270 -0
- package/src/pages/device/detail.vue +165 -0
- package/src/pages/device/index.vue +322 -0
- package/src/pages/device/info.vue +140 -0
- package/src/pages/device/list.vue +219 -0
- package/src/pages/device/materialTowerCode.vue +589 -0
- package/src/pages/device/searchList.vue +224 -0
- package/src/pages/installtion/Record.vue +145 -0
- package/src/pages/installtion/StatusTimeline.vue +85 -0
- package/src/pages/installtion/addAcceptance.vue +409 -0
- package/src/pages/installtion/addRecord.vue +338 -0
- package/src/pages/installtion/orderDetail.vue +220 -0
- package/src/pages/installtion/orderList.vue +100 -0
- package/src/pages/user/component/PersonAgree.vue +226 -0
- package/src/pages/user/component/PrivayAgree.vue +221 -0
- package/src/pages/user/component/SliderCode.vue +173 -0
- package/src/pages/user/forgetPassword.vue +249 -0
- package/src/pages/user/index.vue +139 -0
- package/src/pages/user/login.vue +342 -0
- package/src/pages/user/register.vue +348 -0
- package/src/pages/user/repassword.vue +329 -0
- package/src/pages/user/utils/mcaptcha.js +75 -0
- package/src/pages/user/utils/verifyCode.ts +41 -0
- package/src/pages/workspace/index.vue +225 -0
- package/src/pages.json +203 -0
- package/src/shime-uni.d.ts +6 -0
- package/src/static/icon/system/breeder_icon.png +0 -0
- package/src/static/icon/system/check.png +0 -0
- package/src/static/icon/system/factory_icon.png +0 -0
- package/src/static/icon/system/plus.png +0 -0
- package/src/static/icon/system/right.png +0 -0
- package/src/static/icon/system/unCheck.png +0 -0
- package/src/static/icon/tab/search.png +0 -0
- package/src/static/icon/tab/user.png +0 -0
- package/src/static/icon/tab/user_active.png +0 -0
- package/src/static/icon/tab/workspace.png +0 -0
- package/src/static/icon/tab/workspace_active.png +0 -0
- package/src/static/img/active_dot.png +0 -0
- package/src/static/img/afterSale_icon.png +0 -0
- package/src/static/img/check.png +0 -0
- package/src/static/img/close.png +0 -0
- package/src/static/img/confirm.png +0 -0
- package/src/static/img/empty.png +0 -0
- package/src/static/img/equipment_icon.png +0 -0
- package/src/static/img/fault_icon.png +0 -0
- package/src/static/img/install_icon.png +0 -0
- package/src/static/img/login_bg2.png +0 -0
- package/src/static/img/movable_right.png +0 -0
- package/src/static/img/navigation.png +0 -0
- package/src/static/img/psw_off.png +0 -0
- package/src/static/img/psw_on.png +0 -0
- package/src/static/img/scan.png +0 -0
- package/src/static/img/scan_icon.png +0 -0
- package/src/static/img/search.png +0 -0
- package/src/static/img/turn_right.png +0 -0
- package/src/static/img/unActive_dot.png +0 -0
- package/src/static/img/verifyBg.png +0 -0
- package/src/stores/index.ts +11 -0
- package/src/stores/modules/customer.ts +146 -0
- package/src/stores/modules/installtion.ts +30 -0
- package/src/stores/modules/system.ts +56 -0
- package/src/stores/modules/user.ts +133 -0
- package/src/stores/types.ts +16 -0
- package/src/stores/utils.ts +6 -0
- package/src/styles/index.less +63 -0
- package/src/types/chengyiApi.d.ts +36 -0
- package/src/types/index.d.ts +95 -0
- package/src/utils/address.ts +17 -0
- package/src/utils/cipher.ts +61 -0
- package/src/utils/form.ts +155 -0
- package/src/utils/httpEnum.ts +31 -0
- package/src/utils/image.ts +21 -0
- package/src/utils/index.ts +111 -0
- package/src/utils/request.ts +139 -0
- package/src/utils/requestCancelHandle.ts +67 -0
- package/stylelint.config.js +87 -0
- package/tsconfig.docs.json +11 -0
- package/tsconfig.json +30 -0
- package/typedoc.json +6 -0
- package/vite.config.ts +55 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import type { RequestOptions, ResponseObject } from '@/types/chengyiApi';
|
|
2
|
+
import { setObjToUrlParams } from './index';
|
|
3
|
+
import { ContentTypeEnum, ResultEnum, unauthorizedCodes } from '@/utils/httpEnum';
|
|
4
|
+
import { useUserStoreWithOut } from '@/stores/modules/user';
|
|
5
|
+
import { APPID } from '@/config/app';
|
|
6
|
+
import RequestCancelHandler, { AXIOS_CONFIGS } from './requestCancelHandle';
|
|
7
|
+
|
|
8
|
+
const isDef = (val: any) => val !== undefined && val !== null
|
|
9
|
+
const apiBaseUrl = ''//env.apiBaseUrl;
|
|
10
|
+
// 默认自定义请求参数
|
|
11
|
+
const defaultRequestOptions: RequestOptions = {
|
|
12
|
+
isTransformResponse: true,
|
|
13
|
+
loading: true,
|
|
14
|
+
// post请求的时候添加参数到url
|
|
15
|
+
joinParamsToUrl: false,
|
|
16
|
+
withToken: true,
|
|
17
|
+
showResToast: true,
|
|
18
|
+
|
|
19
|
+
[AXIOS_CONFIGS.autoCancel]: true
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
function baseRequest(
|
|
23
|
+
params: UniNamespace.RequestOptions,
|
|
24
|
+
options: RequestOptions
|
|
25
|
+
) {
|
|
26
|
+
return new Promise((resolve, reject) => {
|
|
27
|
+
// 合并默认和传入的参数
|
|
28
|
+
options = { ...defaultRequestOptions, ...options };
|
|
29
|
+
const { header = {}, ...restParams } = params;
|
|
30
|
+
if (options.joinParamsToUrl) {
|
|
31
|
+
restParams.url = setObjToUrlParams(restParams.url, restParams.data);
|
|
32
|
+
}
|
|
33
|
+
// 请求头添加token
|
|
34
|
+
const store = useUserStoreWithOut();
|
|
35
|
+
const token = store.getToken;
|
|
36
|
+
|
|
37
|
+
if (token && options.withToken !== false) {
|
|
38
|
+
// jwt token
|
|
39
|
+
header['Authorization'] = token;
|
|
40
|
+
}
|
|
41
|
+
if (options.permActionName) {
|
|
42
|
+
header["X-Perms"] = APPID + ":" + options.permActionName
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const requestTask = uni.request({
|
|
46
|
+
header: {
|
|
47
|
+
'Content-Type': ContentTypeEnum.JSON,
|
|
48
|
+
'X-APP-ID': APPID, // 应用ID 用于区分不同应用的接口请求
|
|
49
|
+
...header
|
|
50
|
+
},
|
|
51
|
+
...restParams,
|
|
52
|
+
success: (res) => {
|
|
53
|
+
const { isTransformResponse, isReturnNativeResponse, showResToast } = options;
|
|
54
|
+
// 是否返回原生响应头 比如:需要获取响应头时使用该属性
|
|
55
|
+
if (isReturnNativeResponse) {
|
|
56
|
+
resolve(res);
|
|
57
|
+
}
|
|
58
|
+
// 用于页面代码可能需要直接获取code,data,message这些信息时开启
|
|
59
|
+
if (!isTransformResponse) {
|
|
60
|
+
resolve(res.data);
|
|
61
|
+
}
|
|
62
|
+
const response = res.data as ResponseObject;
|
|
63
|
+
|
|
64
|
+
// 这里逻辑可以根据项目进行修改
|
|
65
|
+
const { code, data, msg } = response;
|
|
66
|
+
const hasSuccess = (code === ResultEnum.SUCCESS || code === ResultEnum.SUCCESS2);
|
|
67
|
+
if (hasSuccess) {
|
|
68
|
+
resolve(data);
|
|
69
|
+
} else if (unauthorizedCodes.includes(code)) {
|
|
70
|
+
uni.navigateTo({ url: '/pages/user/login' })
|
|
71
|
+
uni.showToast({
|
|
72
|
+
title: '登录已过期,请重新登录',
|
|
73
|
+
icon: 'none'
|
|
74
|
+
});
|
|
75
|
+
} else if (code === ResultEnum.ERROR) {
|
|
76
|
+
uni.showToast({
|
|
77
|
+
title: msg || '服务异常,请稍联系客服',
|
|
78
|
+
icon: 'none'
|
|
79
|
+
});
|
|
80
|
+
resolve('')
|
|
81
|
+
} else if (showResToast) {
|
|
82
|
+
uni.showToast({
|
|
83
|
+
title: msg || '网络异常,请稍后重试',
|
|
84
|
+
icon: 'none'
|
|
85
|
+
});
|
|
86
|
+
resolve('')
|
|
87
|
+
} else {
|
|
88
|
+
resolve('')
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
fail: (err) => {
|
|
92
|
+
uni.showToast({
|
|
93
|
+
title: '网络异常,请稍后重试',
|
|
94
|
+
icon: 'none'
|
|
95
|
+
});
|
|
96
|
+
reject('');
|
|
97
|
+
},
|
|
98
|
+
complete: (res) => {
|
|
99
|
+
//RequestCancelHandler.getInstance().requestFulfilled({ ...options, ...restParams })
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
//RequestCancelHandler.getInstance().requestAutoCancelHandle({ ...options, ...restParams }, requestTask)
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const http = {
|
|
108
|
+
get: <T>(params: UniNamespace.RequestOptions, options: RequestOptions = {}) =>
|
|
109
|
+
baseRequest({ ...params, method: 'GET' }, options) as Promise<T>,
|
|
110
|
+
|
|
111
|
+
post: <T>(params: UniNamespace.RequestOptions, options: RequestOptions = {}) =>
|
|
112
|
+
baseRequest({ ...params, method: 'POST' }, options) as Promise<T>,
|
|
113
|
+
|
|
114
|
+
delete: <T>(params: UniNamespace.RequestOptions, options: RequestOptions = {}) =>
|
|
115
|
+
baseRequest({ ...params, method: 'DELETE' }, options) as Promise<T>
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
// 请求拦截器
|
|
119
|
+
uni.addInterceptor('request', {
|
|
120
|
+
invoke(args: UniNamespace.RequestOptions) {
|
|
121
|
+
// request 触发前
|
|
122
|
+
args.url = apiBaseUrl + args.url;
|
|
123
|
+
// args.header.Authorization = `${encryptByBase64(
|
|
124
|
+
// 'csf-v:csf-v_secret'
|
|
125
|
+
// )}`;
|
|
126
|
+
},
|
|
127
|
+
success(args: UniNamespace.RequestSuccessCallbackResult) {
|
|
128
|
+
// 这里做接口权限判断,401为未登录状态
|
|
129
|
+
// if (args.statusCode === ResultEnum.Unauthorized) {
|
|
130
|
+
// router.push('user/login');
|
|
131
|
+
// }
|
|
132
|
+
},
|
|
133
|
+
fail(err: UniNamespace.RequestSuccessCallbackResult) {
|
|
134
|
+
},
|
|
135
|
+
complete(err: UniNamespace.RequestSuccessCallbackResult) {
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
export default http;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// 导出axios的自定义配置变量
|
|
2
|
+
export const AXIOS_CONFIGS = {
|
|
3
|
+
autoAlertError: 'autoAlertError', // 默认true。 false不自动提示
|
|
4
|
+
autoDownload: 'autoDownload', // 默认true。 false在blob类型的请求不自动下载
|
|
5
|
+
autoCancel: 'autoCancel', // 默认false。 true, 与requestId配合标识的同一个请求再多次异步请求中,后发起的请求会取消掉已经提交的请求
|
|
6
|
+
requestId: 'requestId',
|
|
7
|
+
timestampKey: '_timestamp',
|
|
8
|
+
captcha: 'captcha', // 默认undefined, 若存在此值,表明当前请求需要在header部分配置captcha, captcha用于避免当前接口可直接请求和二次请求
|
|
9
|
+
rewriteUrl: 'rewriteUrl', // 使用新的url拼接,防止不同参数放在url里导致识别不了一样的请求,例如`api/test/${param}`
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
type requestConfigType = { [x: string]: any; url: any; method: any; }
|
|
13
|
+
/**
|
|
14
|
+
* 处理重复请求问题,避免 后请求但响应更快的结果被先请求但响应很久的结果覆盖
|
|
15
|
+
*/
|
|
16
|
+
export default class RequestCancelHandler {
|
|
17
|
+
private executors: any;
|
|
18
|
+
static instance: any;
|
|
19
|
+
static getInstance() {
|
|
20
|
+
if (!this.instance) {
|
|
21
|
+
this.instance = new RequestCancelHandler()
|
|
22
|
+
this.instance.executors = new Map()
|
|
23
|
+
}
|
|
24
|
+
return this.instance
|
|
25
|
+
}
|
|
26
|
+
// 拼接 请求的唯一标识
|
|
27
|
+
getRequestKey(config: requestConfigType) {
|
|
28
|
+
// url 需要去除 baseURL的前缀,所有queryString的后缀。 用于取消请求后的回调和再次请求时识别请求的唯一性
|
|
29
|
+
const requestUrl = config[AXIOS_CONFIGS.rewriteUrl] || config.url
|
|
30
|
+
return `${config.method}.${config[AXIOS_CONFIGS.requestId] || '_blank_requestId_'}.${requestUrl.split('?')[0]}`
|
|
31
|
+
}
|
|
32
|
+
// 主动取消请求
|
|
33
|
+
cancelRequest(config: requestConfigType) {
|
|
34
|
+
const key = this.getRequestKey(config)
|
|
35
|
+
// 1. 从缓存中检查是否有未完成的请求,有则取消
|
|
36
|
+
if (this.executors.has(key)) {
|
|
37
|
+
this.executors.get(key)?.abort()
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
// 请求取消配置
|
|
41
|
+
requestAutoCancelHandle(config: requestConfigType, requestTask: any) {
|
|
42
|
+
if (config[AXIOS_CONFIGS.autoCancel]) {
|
|
43
|
+
const key = this.getRequestKey(config)
|
|
44
|
+
// 1. 从缓存中检查是否有未完成的请求,有则取消
|
|
45
|
+
if (this.executors.has(key)) {
|
|
46
|
+
this.executors.get(key)?.abort()
|
|
47
|
+
}
|
|
48
|
+
this.executors.set(key, requestTask)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
// 请求完成
|
|
52
|
+
requestFulfilled(config: requestConfigType) {
|
|
53
|
+
if (config[AXIOS_CONFIGS.autoCancel]) {
|
|
54
|
+
const key = this.getRequestKey(config)
|
|
55
|
+
if (this.executors.has(key)) {
|
|
56
|
+
this.executors.delete(key)
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// requestRejected(error: { isCancel: boolean; }) {
|
|
61
|
+
// if (axios.isCancel(error)) {
|
|
62
|
+
// // isCancel 配合业务使用, 继续显示loading
|
|
63
|
+
// error.isCancel = true
|
|
64
|
+
// }
|
|
65
|
+
// }
|
|
66
|
+
}
|
|
67
|
+
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
/** @type {import("stylelint").Config} */
|
|
4
|
+
export default {
|
|
5
|
+
extends: [
|
|
6
|
+
"stylelint-config-standard",
|
|
7
|
+
"stylelint-config-html/vue",
|
|
8
|
+
"stylelint-config-recess-order"
|
|
9
|
+
],
|
|
10
|
+
plugins: ["stylelint-scss", "stylelint-order", "stylelint-prettier"],
|
|
11
|
+
overrides: [
|
|
12
|
+
{
|
|
13
|
+
files: ["**/*.(css|html|vue)"],
|
|
14
|
+
customSyntax: "postcss-html"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
files: ["*.scss", "**/*.scss"],
|
|
18
|
+
customSyntax: "postcss-scss",
|
|
19
|
+
extends: [
|
|
20
|
+
"stylelint-config-standard-scss",
|
|
21
|
+
"stylelint-config-recommended-vue/scss"
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
rules: {
|
|
26
|
+
"prettier/prettier": true,
|
|
27
|
+
"selector-class-pattern": null,
|
|
28
|
+
"no-descending-specificity": null,
|
|
29
|
+
"scss/dollar-variable-pattern": null,
|
|
30
|
+
"selector-pseudo-class-no-unknown": [
|
|
31
|
+
true,
|
|
32
|
+
{
|
|
33
|
+
ignorePseudoClasses: ["deep", "global"]
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"selector-pseudo-element-no-unknown": [
|
|
37
|
+
true,
|
|
38
|
+
{
|
|
39
|
+
ignorePseudoElements: ["v-deep", "v-global", "v-slotted"]
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
"at-rule-no-unknown": [
|
|
43
|
+
true,
|
|
44
|
+
{
|
|
45
|
+
ignoreAtRules: [
|
|
46
|
+
"tailwind",
|
|
47
|
+
"apply",
|
|
48
|
+
"variants",
|
|
49
|
+
"responsive",
|
|
50
|
+
"screen",
|
|
51
|
+
"function",
|
|
52
|
+
"if",
|
|
53
|
+
"each",
|
|
54
|
+
"include",
|
|
55
|
+
"mixin",
|
|
56
|
+
"use"
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
"rule-empty-line-before": [
|
|
61
|
+
"always",
|
|
62
|
+
{
|
|
63
|
+
ignore: ["after-comment", "first-nested"]
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
"unit-no-unknown": [true, { ignoreUnits: ["rpx"] }],
|
|
67
|
+
"order/order": [
|
|
68
|
+
[
|
|
69
|
+
"dollar-variables",
|
|
70
|
+
"custom-properties",
|
|
71
|
+
"at-rules",
|
|
72
|
+
"declarations",
|
|
73
|
+
{
|
|
74
|
+
type: "at-rule",
|
|
75
|
+
name: "supports"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
type: "at-rule",
|
|
79
|
+
name: "media"
|
|
80
|
+
},
|
|
81
|
+
"rules"
|
|
82
|
+
],
|
|
83
|
+
{ severity: "warning" }
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
ignoreFiles: ["**/*.js", "**/*.ts", "**/*.jsx", "**/*.tsx", "report.html"]
|
|
87
|
+
};
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "@vue/tsconfig/tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"sourceMap": true,
|
|
5
|
+
"baseUrl": ".",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"jsx": "preserve",
|
|
8
|
+
"moduleResolution": "node",
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"importHelpers": true,
|
|
12
|
+
"allowSyntheticDefaultImports": true,
|
|
13
|
+
"useDefineForClassFields": true,
|
|
14
|
+
"resolveJsonModule": true,
|
|
15
|
+
"verbatimModuleSyntax": true,
|
|
16
|
+
"importsNotUsedAsValues": "remove",
|
|
17
|
+
"preserveValueImports": false,
|
|
18
|
+
"paths": {
|
|
19
|
+
"@/*": ["./src/*"]
|
|
20
|
+
},
|
|
21
|
+
"lib": ["esnext", "dom"],
|
|
22
|
+
"types": ["@dcloudio/types", "vue"]
|
|
23
|
+
},
|
|
24
|
+
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
|
|
25
|
+
"exclude": [
|
|
26
|
+
"node_modules",
|
|
27
|
+
"unpackage",
|
|
28
|
+
"src/**/*.nvue"
|
|
29
|
+
]
|
|
30
|
+
}
|
package/typedoc.json
ADDED
package/vite.config.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { defineConfig } from "vite";
|
|
2
|
+
import uni from "@dcloudio/vite-plugin-uni";
|
|
3
|
+
import AutoImport from 'unplugin-auto-import/vite';
|
|
4
|
+
import Components from '@uni-helper/vite-plugin-uni-components'
|
|
5
|
+
|
|
6
|
+
// https://vitejs.dev/config/
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
plugins: [
|
|
9
|
+
uni(),
|
|
10
|
+
Components({
|
|
11
|
+
dts: true,
|
|
12
|
+
dirs: ['src/components'],
|
|
13
|
+
include: [/\.vue$/, /\.vue\?vue/],
|
|
14
|
+
}),
|
|
15
|
+
AutoImport({
|
|
16
|
+
dts: 'src/auto-imports.d.ts',
|
|
17
|
+
imports: [
|
|
18
|
+
'vue',
|
|
19
|
+
'uni-app',
|
|
20
|
+
'pinia',
|
|
21
|
+
{
|
|
22
|
+
'@/helper/pinia-auto-refs': ['useStore']
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
exclude: ['createApp'],
|
|
26
|
+
eslintrc: {
|
|
27
|
+
enabled: true
|
|
28
|
+
}
|
|
29
|
+
}),
|
|
30
|
+
],
|
|
31
|
+
define: {
|
|
32
|
+
'process.env.VUE_APP_DEV': JSON.stringify('dev'),
|
|
33
|
+
},
|
|
34
|
+
build: {
|
|
35
|
+
minify: 'terser',
|
|
36
|
+
sourcemap: false,
|
|
37
|
+
// terserOptions: {
|
|
38
|
+
// compress: {
|
|
39
|
+
// drop_console: false,
|
|
40
|
+
// pure_funcs: ['console.log'], // 移除 console.log
|
|
41
|
+
// },
|
|
42
|
+
// },
|
|
43
|
+
},
|
|
44
|
+
server: {
|
|
45
|
+
open: true, // 自动打开
|
|
46
|
+
proxy: {
|
|
47
|
+
// 本地开发环境通过代理实现跨域,生产环境使用 nginx 转发
|
|
48
|
+
// '/tms': {
|
|
49
|
+
// target: 'http://192.168.101.23:8184',
|
|
50
|
+
// changeOrigin: true,
|
|
51
|
+
// rewrite: (path) => path.replace(/^\/tms/, 'tms')
|
|
52
|
+
// }
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
});
|