@ -0,0 +1,22 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
.DS_Store
|
||||
dist
|
||||
*.local
|
||||
|
||||
# Editor directories and files
|
||||
.idea
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
.yarn/*
|
||||
@ -0,0 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<script>
|
||||
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
|
||||
CSS.supports('top: constant(a)'))
|
||||
document.write(
|
||||
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
|
||||
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
|
||||
</script>
|
||||
<title></title>
|
||||
<!--preload-links-->
|
||||
<!--app-context-->
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"><!--app-html--></div>
|
||||
<script type="module" src="/src/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,9 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"types": [
|
||||
"@dcloudio/types",
|
||||
"miniprogram-api-typings",
|
||||
"mini-types"
|
||||
]
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
{
|
||||
"name": "uni-preset-vue",
|
||||
"version": "0.0.0",
|
||||
"scripts": {
|
||||
"dev:app": "uni -p app",
|
||||
"dev:app-android": "uni -p app-android",
|
||||
"dev:app-ios": "uni -p app-ios",
|
||||
"dev:custom": "uni -p",
|
||||
"dev:h5": "uni",
|
||||
"dev:h5:ssr": "uni --ssr",
|
||||
"dev:mp-alipay": "uni -p mp-alipay",
|
||||
"dev:mp-baidu": "uni -p mp-baidu",
|
||||
"dev:mp-jd": "uni -p mp-jd",
|
||||
"dev:mp-kuaishou": "uni -p mp-kuaishou",
|
||||
"dev:mp-lark": "uni -p mp-lark",
|
||||
"dev:mp-qq": "uni -p mp-qq",
|
||||
"dev:mp-toutiao": "uni -p mp-toutiao",
|
||||
"dev:mp-weixin": "uni -p mp-weixin",
|
||||
"dev:quickapp-webview": "uni -p quickapp-webview",
|
||||
"dev:quickapp-webview-huawei": "uni -p quickapp-webview-huawei",
|
||||
"dev:quickapp-webview-union": "uni -p quickapp-webview-union",
|
||||
"build:app": "uni build -p app",
|
||||
"build:app-android": "uni build -p app-android",
|
||||
"build:app-ios": "uni build -p app-ios",
|
||||
"build:custom": "uni build -p",
|
||||
"build:h5": "uni build",
|
||||
"build:h5:ssr": "uni build --ssr",
|
||||
"build:mp-alipay": "uni build -p mp-alipay",
|
||||
"build:mp-baidu": "uni build -p mp-baidu",
|
||||
"build:mp-jd": "uni build -p mp-jd",
|
||||
"build:mp-kuaishou": "uni build -p mp-kuaishou",
|
||||
"build:mp-lark": "uni build -p mp-lark",
|
||||
"build:mp-qq": "uni build -p mp-qq",
|
||||
"build:mp-toutiao": "uni build -p mp-toutiao",
|
||||
"build:mp-weixin": "uni build -p mp-weixin",
|
||||
"build:quickapp-webview": "uni build -p quickapp-webview",
|
||||
"build:quickapp-webview-huawei": "uni build -p quickapp-webview-huawei",
|
||||
"build:quickapp-webview-union": "uni build -p quickapp-webview-union"
|
||||
},
|
||||
"dependencies": {
|
||||
"@dcloudio/uni-app": "3.0.0-3080420230531001",
|
||||
"@dcloudio/uni-app-plus": "3.0.0-3080420230531001",
|
||||
"@dcloudio/uni-components": "3.0.0-3080420230531001",
|
||||
"@dcloudio/uni-h5": "3.0.0-3080420230531001",
|
||||
"@dcloudio/uni-mp-alipay": "3.0.0-3080420230531001",
|
||||
"@dcloudio/uni-mp-baidu": "3.0.0-3080420230531001",
|
||||
"@dcloudio/uni-mp-jd": "3.0.0-3080420230531001",
|
||||
"@dcloudio/uni-mp-kuaishou": "3.0.0-3080420230531001",
|
||||
"@dcloudio/uni-mp-lark": "3.0.0-3080420230531001",
|
||||
"@dcloudio/uni-mp-qq": "3.0.0-3080420230531001",
|
||||
"@dcloudio/uni-mp-toutiao": "3.0.0-3080420230531001",
|
||||
"@dcloudio/uni-mp-weixin": "3.0.0-3080420230531001",
|
||||
"@dcloudio/uni-quickapp-webview": "3.0.0-3080420230531001",
|
||||
"@dcloudio/uni-ui": "^1.4.27",
|
||||
"dayjs": "^1.11.8",
|
||||
"vue": "^3.2.45",
|
||||
"vue-i18n": "^9.1.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@dcloudio/types": "^3.3.2",
|
||||
"@dcloudio/uni-automator": "3.0.0-3080420230531001",
|
||||
"@dcloudio/uni-cli-shared": "3.0.0-3080420230531001",
|
||||
"@dcloudio/uni-stacktracey": "3.0.0-3080420230531001",
|
||||
"@dcloudio/vite-plugin-uni": "3.0.0-3080420230531001",
|
||||
"sass": "^1.63.3",
|
||||
"sass-loader": "^13.3.2",
|
||||
"vite": "4.1.4"
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
<script>
|
||||
export default {
|
||||
// onLaunch: function() {
|
||||
// console.log('App Launch')
|
||||
// },
|
||||
// onShow: function() {
|
||||
// console.log('App Show')
|
||||
// },
|
||||
// onHide: function() {
|
||||
// console.log('App Hide')
|
||||
// },
|
||||
};
|
||||
</script>
|
||||
|
||||
<!-- <template>
|
||||
<uni-section title="对话框示例" type="line" class="hideOnPc">
|
||||
<view class="example-body box">
|
||||
<button class="button popup-success" @click="dialogToggle('success')"><text
|
||||
class="button-text success-text">成功</text></button>
|
||||
|
||||
</view>
|
||||
</uni-section>
|
||||
</template> -->
|
||||
|
||||
<style lang="scss">
|
||||
#app {
|
||||
padding: 0 24px;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 640px) {
|
||||
uni-view.uni-forms-item__label {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
uni-view.uni-forms-item.is-direction-left {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (min-width: 750px) {
|
||||
|
||||
.uni-forms {
|
||||
width: 700px;
|
||||
margin: 60px auto;
|
||||
|
||||
button {
|
||||
margin-top: 60px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,15 @@
|
||||
const apiEnv = 'dev'
|
||||
|
||||
const envMap = {
|
||||
dev: {
|
||||
// baseUrl: 'http://192.168.10.151:5100'
|
||||
baseUrl: location.origin == 'http://localhost:8888' ? 'http://192.168.10.151:5100' : location.origin,
|
||||
}
|
||||
}
|
||||
|
||||
function createEnv(apiEnv) {
|
||||
return envMap[apiEnv]
|
||||
}
|
||||
|
||||
const env = createEnv(apiEnv)
|
||||
export default env
|
||||
@ -0,0 +1,17 @@
|
||||
let loadingCount = 0;
|
||||
|
||||
export function showLoading(isLoading) {
|
||||
if (isLoading) {
|
||||
uni.showLoading({
|
||||
title: '加载中'
|
||||
});
|
||||
loadingCount = loadingCount + 1;
|
||||
}
|
||||
}
|
||||
|
||||
export function hideLoading() {
|
||||
loadingCount = loadingCount - 1;
|
||||
if (loadingCount === 0) {
|
||||
uni.hideLoading();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,77 @@
|
||||
import env from "./env";
|
||||
import { hideLoading, showLoading } from "./loading";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
function baseRequest(method, url, data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
showLoading(data.isLoading);
|
||||
delete data.isLoading;
|
||||
let responseDate;
|
||||
|
||||
uni.request({
|
||||
url: env.baseUrl + url,
|
||||
method,
|
||||
timeout: 20000,
|
||||
headers: {
|
||||
"Content-Type": "application/json;",
|
||||
},
|
||||
data: {
|
||||
jsonrpc: "2.0",
|
||||
method: data.url,
|
||||
params: data.params,
|
||||
id: "516355ac-8088-4ac7-a389-4d491ac6db34",
|
||||
timestampin: dayjs().valueOf() + "",
|
||||
session: uni.getStorageSync("imis-token") || "",
|
||||
},
|
||||
success: (res) => {
|
||||
console.log(res, res.data);
|
||||
|
||||
if (res.data?.error?.code === 200) {
|
||||
if (data.url == "/account/login") {
|
||||
uni.showToast({
|
||||
title: "登录成功",
|
||||
duration: 2000,
|
||||
});
|
||||
}
|
||||
resolve(res.data.result);
|
||||
} else {
|
||||
uni.showModal({
|
||||
showCancel: false,
|
||||
content: res.data?.error?.message,
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
console.log("用户点击确定");
|
||||
}
|
||||
},
|
||||
});
|
||||
uni.hideLoading();
|
||||
reject(new Error(res.data?.error?.message));
|
||||
}
|
||||
},
|
||||
|
||||
fail: () => {
|
||||
uni.showModal({
|
||||
showCancel: false,
|
||||
content: "网络不给力,请检查你的网络设置~",
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
uni.hideLoading();
|
||||
reject(new Error("Network error"));
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
complete: (data) => {
|
||||
// console.log(data, 'data');
|
||||
resolve(responseDate);
|
||||
hideLoading();
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
const http = {
|
||||
post: (params) => baseRequest("POST", "/jsonrpc", params),
|
||||
};
|
||||
|
||||
export default http;
|
||||
@ -0,0 +1,18 @@
|
||||
function showmodel(status) {
|
||||
if (status) {
|
||||
uni.showModal({
|
||||
title: status.title || '',
|
||||
content: status.content || '',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
console.log('用户点击确定');
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
export default showmodel
|
||||
@ -0,0 +1,12 @@
|
||||
import {
|
||||
createSSRApp
|
||||
} from "vue";
|
||||
import App from "./App.vue";
|
||||
|
||||
|
||||
export function createApp() {
|
||||
const app = createSSRApp(App);
|
||||
return {
|
||||
app,
|
||||
};
|
||||
}
|
||||
@ -0,0 +1,82 @@
|
||||
{
|
||||
"name" : "agv-uniapp-ad",
|
||||
"appid" : "__UNI__5787240",
|
||||
"description" : "",
|
||||
"versionName" : "1.0.0",
|
||||
"versionCode" : "100",
|
||||
"transformPx" : false,
|
||||
/* 5+App特有相关 */
|
||||
"app-plus" : {
|
||||
"usingComponents" : true,
|
||||
"nvueStyleCompiler" : "uni-app",
|
||||
"compilerVersion" : 3,
|
||||
"splashscreen" : {
|
||||
"alwaysShowBeforeRender" : true,
|
||||
"waiting" : true,
|
||||
"autoclose" : true,
|
||||
"delay" : 0
|
||||
},
|
||||
/* 模块配置 */
|
||||
"modules" : {},
|
||||
/* 应用发布信息 */
|
||||
"distribute" : {
|
||||
/* android打包配置 */
|
||||
"android" : {
|
||||
"permissions" : [
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
||||
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
||||
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
||||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
||||
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
||||
]
|
||||
},
|
||||
/* ios打包配置 */
|
||||
"ios" : {
|
||||
"dSYMs" : false
|
||||
},
|
||||
/* SDK配置 */
|
||||
"sdkConfigs" : {
|
||||
"ad" : {}
|
||||
}
|
||||
}
|
||||
},
|
||||
/* 快应用特有相关 */
|
||||
"quickapp" : {},
|
||||
/* 小程序特有相关 */
|
||||
"mp-weixin" : {
|
||||
"appid" : "",
|
||||
"setting" : {
|
||||
"urlCheck" : false
|
||||
},
|
||||
"usingComponents" : true
|
||||
},
|
||||
"mp-alipay" : {
|
||||
"usingComponents" : true
|
||||
},
|
||||
"mp-baidu" : {
|
||||
"usingComponents" : true
|
||||
},
|
||||
"mp-toutiao" : {
|
||||
"usingComponents" : true
|
||||
},
|
||||
"uniStatistics" : {
|
||||
"enable" : false
|
||||
},
|
||||
"vueVersion" : "3",
|
||||
"fallbackLocale" : "zh-Hans",
|
||||
"h5" : {
|
||||
"router" : {
|
||||
"mode" : "history"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,63 @@
|
||||
{
|
||||
"easycom": {
|
||||
"autoscan": true,
|
||||
"custom": {
|
||||
// uni-ui 规则如下配置
|
||||
"^uni-(.*)": "@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue"
|
||||
}
|
||||
},
|
||||
"pages": [
|
||||
// {
|
||||
// "path": "pages/login/index",
|
||||
// "style": {
|
||||
// "navigationBarTitleText": "登录"
|
||||
// }
|
||||
// },
|
||||
{
|
||||
"path": "pages/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "控制面板"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "pages/agvConfig",
|
||||
"style": {
|
||||
"navigationBarTitleText": "AGV配置"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tabBar": {
|
||||
"color": "#d4dbe3",
|
||||
"selectedColor": "#000000",
|
||||
"borderStyle": "black",
|
||||
"backgroundColor": "#ffffff",
|
||||
"list": [
|
||||
// {
|
||||
// "pagePath": "pages/login/index",
|
||||
// "iconPath": "static/icons5.png",
|
||||
// "selectedIconPath": "static/icons6.png",
|
||||
// "text": "登录"
|
||||
// },
|
||||
{
|
||||
"pagePath": "pages/index",
|
||||
"iconPath": "static/icons2.png",
|
||||
"selectedIconPath": "static/icons1.png",
|
||||
"text": "控制面板"
|
||||
},
|
||||
{
|
||||
"pagePath": "pages/agvConfig",
|
||||
"iconPath": "static/icons4.png",
|
||||
"selectedIconPath": "static/icons3.png",
|
||||
"text": "AGV配置"
|
||||
}
|
||||
]
|
||||
},
|
||||
"globalStyle": {
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "uni-app",
|
||||
"navigationBarBackgroundColor": "#F8F8F8",
|
||||
"pageOrientation": "auto",
|
||||
"backgroundColor": "#F8F8F8"
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,83 @@
|
||||
<template>
|
||||
<view class="box">
|
||||
<uni-forms ref="form" :modelValue="formData" :rules="rules">
|
||||
<uni-forms-item required label="AGV id" name="agvid">
|
||||
<uni-easyinput
|
||||
type="number"
|
||||
v-model="formData.agvid"
|
||||
placeholder="请输入AGV id"
|
||||
/>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item required label="组id" name="groupid">
|
||||
<uni-easyinput
|
||||
type="number"
|
||||
v-model="formData.groupid"
|
||||
placeholder="请输入组 id"
|
||||
/>
|
||||
</uni-forms-item>
|
||||
|
||||
<button type="primary" @click="submitForm">提交</button>
|
||||
</uni-forms>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
formData: {
|
||||
agvid: null,
|
||||
groupid: null,
|
||||
},
|
||||
rules: {
|
||||
agvid: {
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
errorMessage: "请输入AGV id",
|
||||
},
|
||||
],
|
||||
},
|
||||
groupid: {
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
errorMessage: "请输入组 id",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
submitForm() {
|
||||
this.$refs.form.validate().then((res) => {
|
||||
uni.setStorage({
|
||||
key: "agv_id",
|
||||
data: JSON.stringify(res),
|
||||
success: function () {
|
||||
uni.showToast({
|
||||
title: "提交成功",
|
||||
duration: 2000,
|
||||
});
|
||||
|
||||
uni.switchTab({
|
||||
url: "/pages/index",
|
||||
});
|
||||
},
|
||||
});
|
||||
});
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
const _this = this;
|
||||
uni.setStorageSync({
|
||||
key: "agv_id",
|
||||
success: function (res) {
|
||||
const data = JSON.parse(res.data);
|
||||
_this.formData = data;
|
||||
},
|
||||
});
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@ -0,0 +1,104 @@
|
||||
<template>
|
||||
<view class="box">
|
||||
<button type="primary" :loading="load1" @click="feed" class="feed">
|
||||
控制滚筒AGV送料
|
||||
</button>
|
||||
<div class="flex">
|
||||
<button type="primary" :loading="load2" @click="work">
|
||||
控制滚筒AGV至工位
|
||||
</button>
|
||||
<button type="primary" :loading="load3" @click="rest">
|
||||
控制滚筒AGV休息
|
||||
</button>
|
||||
</div>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { toRefs, onMounted, reactive, watch, ref } from "vue";
|
||||
import http from "../config/request.js";
|
||||
|
||||
let load1 = ref(false);
|
||||
let load2 = ref(false);
|
||||
let load3 = ref(false);
|
||||
let data = ref({});
|
||||
|
||||
const feed = async () => {
|
||||
// load1.value = true;
|
||||
const res = await http.post({
|
||||
url: "/agvinteractionlabel/Feeding",
|
||||
params: data.value,
|
||||
});
|
||||
// load1.value = false;
|
||||
console.log(res);
|
||||
};
|
||||
const work = async () => {
|
||||
// load2.value = true;
|
||||
const res = await http.post({
|
||||
url: "/agvinteractionlabel/GoToManualWorkstation",
|
||||
params: data.value,
|
||||
});
|
||||
// load2.value = false;
|
||||
console.log(res);
|
||||
};
|
||||
const rest = async () => {
|
||||
// load3.value = true;
|
||||
const res = await http.post({
|
||||
url: "/agvinteractionlabel/RestStation",
|
||||
params: data.value,
|
||||
});
|
||||
// load3.value = false;
|
||||
console.log(res);
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
const idData = uni.getStorageSync("agv_id");
|
||||
if (!idData) {
|
||||
uni.showToast({
|
||||
title: "请先填写配置页",
|
||||
duration: 2000,
|
||||
});
|
||||
uni.switchTab({
|
||||
url: "/pages/agvConfig",
|
||||
});
|
||||
} else {
|
||||
data.value = JSON.parse(idData);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.box {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
width: 80%;
|
||||
min-width: 320px;
|
||||
margin: 10% auto;
|
||||
button {
|
||||
display: block;
|
||||
margin-bottom: 2vh;
|
||||
}
|
||||
|
||||
button.feed {
|
||||
min-width: 320px;
|
||||
width: 46%;
|
||||
height: 20vh;
|
||||
line-height: 20vh;
|
||||
font-size: 2rem;
|
||||
}
|
||||
.flex {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
width: 46%;
|
||||
align-content: space-between;
|
||||
|
||||
button {
|
||||
min-width: 320px;
|
||||
width: 100%;
|
||||
height: 8vh;
|
||||
line-height: 8vh;
|
||||
font-size: 1.6rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,6 @@
|
||||
export {};
|
||||
|
||||
declare module "vue" {
|
||||
type Hooks = App.AppInstance & Page.PageInstance;
|
||||
interface ComponentCustomOptions extends Hooks {}
|
||||
}
|
||||
|
After Width: | Height: | Size: 8.8 KiB |
|
After Width: | Height: | Size: 8.2 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 6.9 KiB |
|
After Width: | Height: | Size: 7.4 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
@ -0,0 +1,52 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import uni from '@dcloudio/vite-plugin-uni'
|
||||
|
||||
const path = require('path')
|
||||
export default defineConfig({
|
||||
plugins: [uni()],
|
||||
build: {
|
||||
|
||||
terserOptions: {
|
||||
compress: {
|
||||
drop_console: true,
|
||||
},
|
||||
},
|
||||
// 打包输出的文件夹名称
|
||||
outDir: 'dist',
|
||||
// 静态资源文件保存的文件夹名称
|
||||
assetsDir: 'static',
|
||||
// 是否启用css代码拆分
|
||||
cssCodeSplit: true,
|
||||
// 打包构建后是否生成 source map 文件。
|
||||
sourcemap: true,
|
||||
// 打包构建时压缩混淆使用的混淆器
|
||||
minify: 'esbuild',
|
||||
rollupOptions: {
|
||||
// 输出配置
|
||||
output: {
|
||||
// 输出的文件自定义命名
|
||||
chunkFileNames: 'js/[name]-[hash].js',
|
||||
entryFileNames: 'js/[name]-[hash].js',
|
||||
assetFileNamesL: '[ext]/[name]-[hash].[text]'
|
||||
}
|
||||
}
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': path.resolve(__dirname, 'src'),
|
||||
},
|
||||
},
|
||||
|
||||
server: {
|
||||
host: true,
|
||||
port: '8888',
|
||||
open: true,
|
||||
https: false,
|
||||
proxy: {
|
||||
"^/jsonrpc": {
|
||||
target: '/',
|
||||
changeOrigin: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
})
|
||||