Browse Source

增加unocss规则,修复popup弹框样式错乱的问题

lisy 4 weeks ago
parent
commit
6cb6046c21

+ 1 - 2
src/App.vue

@@ -23,8 +23,7 @@ onHide(() => {
 });
 </script>
 <style lang="scss">
-    
-@import "uview-plus/index.scss";
+// @import "uview-plus/index.scss";
 @import '@/assets/styles/public.scss';
 @import '@/assets/styles/common.scss';
 @import '@/assets/styles/uview-plus.scss';

+ 159 - 0
src/components/ut-confirm-dialog/ut-confirm-dialog.vue

@@ -0,0 +1,159 @@
+<template>
+    <up-popup :show="internalShow" mode="center" :round="16" :closeable="false" @close="handleClose" bgColor="transparent">
+        <view class="confirm-dialog">
+            <!-- 标题区域 -->
+            <view class="dialog-header pd-32">
+                <text class="dialog-title f-s-32 f-w-6 c-#333">{{ title }}</text>
+                <up-icon v-if="closeable" name="close" size="20" color="#999" class="close-icon" @click="handleClose" />
+            </view>
+            <!-- 内容区域(slot插槽) -->
+            <view class="dialog-content pd-32 pt-0">
+                <slot></slot>
+            </view>
+            <!-- 按钮区域 -->
+            <view class="dialog-footer pd-32 pt-0">
+                <up-button v-if="showCancel" class="cancel-btn" :style="{ backgroundColor: cancelBgColor, color: cancelColor }" :customStyle="{ height: '80rpx', fontSize: '32rpx', borderRadius: '8rpx', flex: 1 }" @click="handleCancel">
+                    {{ cancelText }}
+                </up-button>
+                <up-button class="confirm-btn" :style="{ backgroundColor: confirmBgColor, color: confirmColor }" :customStyle="{ height: '80rpx', fontSize: '32rpx', borderRadius: '8rpx', flex: 1, marginLeft: showCancel ? '24rpx' : '0' }" @click="handleConfirm">
+                    {{ confirmText }}
+                </up-button>
+            </view>
+        </view>
+    </up-popup>
+</template>
+
+<script setup lang="ts">
+import { ref, watch, computed } from 'vue';
+interface Props {
+    // 弹框标题,默认"系统提示"
+    title?: string;
+    // 是否显示关闭按钮
+    closeable?: boolean;
+    // 控制弹框显示/隐藏
+    show?: boolean;
+    // 取消按钮文字
+    cancelText?: string;
+    // 确认按钮文字
+    confirmText?: string;
+    // 取消按钮背景色
+    cancelBgColor?: string;
+    // 取消按钮文字颜色
+    cancelColor?: string;
+    // 确认按钮背景色
+    confirmBgColor?: string;
+    // 确认按钮文字颜色
+    confirmColor?: string;
+    // 是否显示取消按钮
+    showCancel?: boolean;
+}
+
+const props = withDefaults(defineProps<Props>(), {
+    title: '系统提示',
+    closeable: true,
+    show: false,
+    cancelText: '取消',
+    confirmText: '确认',
+    cancelBgColor: '#F2F2F2',
+    cancelColor: '#333',
+    confirmBgColor: '#37A954',
+    confirmColor: '#fff',
+    showCancel: true,
+});
+
+const emit = defineEmits<{
+    // 取消事件(关闭弹框)
+    (e: 'cancel'): void;
+    // 确认事件
+    (e: 'confirm'): void;
+    // 关闭事件
+    (e: 'close'): void;
+    // 更新 show 状态
+    (e: 'update:show', value: boolean): void;
+}>();
+
+// 内部显示状态
+const internalShow = ref(props.show);
+
+// 监听 props.show 变化
+watch(
+    () => props.show,
+    (newVal) => {
+        internalShow.value = newVal;
+    }
+);
+
+// 处理关闭
+const handleClose = () => {
+    internalShow.value = false;
+    emit('update:show', false);
+    emit('close');
+};
+
+// 处理取消
+const handleCancel = () => {
+    internalShow.value = false;
+    emit('update:show', false);
+    emit('cancel');
+};
+
+// 处理确认
+const handleConfirm = () => {
+    internalShow.value = false;
+    emit('update:show', false);
+    emit('confirm');
+};
+</script>
+
+<style lang="scss" scoped>
+.confirm-dialog {
+    display: flex;
+    flex-direction: column;
+    background-color: #fff;
+    border-radius: 16rpx;
+    overflow: hidden;
+
+    .dialog-header {
+        display: flex;
+        justify-content: space-between;
+        align-items: center;
+        border-bottom: 1rpx solid #f2f2f2;
+
+        .dialog-title {
+            font-size: 32rpx;
+            font-weight: 600;
+            color: #333;
+        }
+
+        .close-icon {
+            padding: 8rpx;
+            border-radius: 50%;
+
+            &:active {
+                background-color: #f5f5f5;
+            }
+        }
+    }
+
+    .dialog-content {
+        flex: 1;
+        min-height: 120rpx;
+        font-size: 28rpx;
+        color: #666;
+        line-height: 1.6;
+    }
+
+    .dialog-footer {
+        display: flex;
+        justify-content: space-between;
+        border-top: 1rpx solid #f2f2f2;
+
+        .cancel-btn,
+        .confirm-btn {
+            :deep(.u-button) {
+                border: none !important;
+            }
+        }
+    }
+}
+</style>

+ 3 - 2
src/main.ts

@@ -1,7 +1,7 @@
 import { createSSRApp } from 'vue';
 import App from './App.vue';
 import * as Pinia from 'pinia';
-import 'uno.css'
+import 'uno.css';
 import { selectDictLabel, selectDictLabels } from './utils/ruoyi';
 import { useDict } from '@/utils/dict';
 import uviewPlus, { setConfig } from 'uview-plus';
@@ -30,7 +30,7 @@ const uviewProps: any = {
             color: '#333',
             fontSize: '30rpx',
             placeholderStyle: 'color: #ccc; font-weight: 400;',
-        }
+        },
     },
 };
 export function createApp() {
@@ -50,6 +50,7 @@ export function createApp() {
         whiteList: [
             '/pages/login/login', // 登录页
             '/pages/plant/index',
+            '/plant/species/config/index',
         ],
 
         // 自定义登录检查函数(返回 true 表示已登录)

+ 9 - 9
src/pages.json

@@ -2,9 +2,9 @@
     "easycom": {
         "autoscan": true,
         "custom": {
-           	"^u--(.*)": "uview-plus/components/u-$1/u-$1.vue",
-			"^up-(.*)": "uview-plus/components/u-$1/u-$1.vue",
-	        "^u-([^-].*)": "uview-plus/components/u-$1/u-$1.vue",
+            "^u--(.*)": "uview-plus/components/u-$1/u-$1.vue",
+            "^up-(.*)": "uview-plus/components/u-$1/u-$1.vue",
+            "^u-([^-].*)": "uview-plus/components/u-$1/u-$1.vue",
             "^ut-(.*)": "@/src/components/ut-$1/ut-$1.vue",
             "^(?!z-paging-refresh|z-paging-load-more)z-paging(.*)": "z-paging/components/z-paging$1/z-paging$1.vue"
         }
@@ -89,9 +89,9 @@
             "root": "plant/species",
             "pages": [
                 {
-                    "path": "species-list/index",
+                    "path": "config/index",
                     "style": {
-                        "navigationBarTitleText": "主营物种"
+                        "navigationBarTitleText": "配置主营物种"
                     }
                 }
             ]
@@ -99,22 +99,22 @@
         {
             "root": "tools",
             "pages": [
-               {
+                {
                     "path": "map-draw-area/index",
                     "style": {
                         "navigationBarTitleText": "地图绘制面积图",
                         "disableScroll": true,
                         "enablePullDownRefresh": false
                     }
-               },
-               {
+                },
+                {
                     "path": "map-gd/index",
                     "style": {
                         "navigationBarTitleText": "地图绘制面积图",
                         "disableScroll": true,
                         "enablePullDownRefresh": false
                     }
-               }
+                }
             ]
         }
     ],

+ 11 - 11
src/pages/plant/index.vue

@@ -36,13 +36,13 @@
                             <view v-if="!speciesArray.length" class="pd-20"></view>
                             <view v-if="speciesArray.length" class="d-flex pr-15">
                                 <view class="flex1"></view>
-                                <view class="f-s-22 c-primary">去修改{{ '>' }}</view>
+                                <view class="f-s-22 c-primary" @click="$u.route({ url: '/plant/species/config/index' })">去修改{{ '>' }}</view>
                             </view>
                             <view v-if="speciesArray.length" class="c-#333 f-s-24 d-flex pl-30 pr-15 pb-15 pt-15">
                                 <view class="ov-hd tx-ov w-s-no">三七、天麻、徐长卿、白及、徐长卿、白及、三七、天麻、徐长卿、白及、徐长卿、白及</view>
-                                <view class="flex1 w-s-no">等120个种</view>
+                                <view class="flex1 w-s-no">等120个种</view>
                             </view>
-                            <view v-if="!speciesArray.length" class="c-primary bg-#E3F6E7 f-s-22 mg-at radius-10 w-250 h-50 d-flex a-c j-c"> 暂未配置种,去配置> </view>
+                            <view v-if="!speciesArray.length" class="c-primary bg-#E3F6E7 f-s-22 mg-at radius-10 w-250 h-50 d-flex a-c j-c"> 暂未配置种,去配置> </view>
                             <view v-if="!speciesArray.length" class="pd-7"></view>
                         </view>
                     </view>
@@ -55,15 +55,15 @@
                     </view>
                     <view class="">
                         <view class="d-flex a-c pt-20 mb-20">
-                            <view class="w-200">
+                            <view class="min-w-170 flex1">
                                 <ut-action-sheet v-model="form.type" :tabs="[{ label: '全部', value: '' }]" @change="onRefresh" title="选择原料类型">
                                     <view class="d-flex search-select-item a-c">
-                                        <view class="flex1 ov-hd f-s-28 c-333 text-center f-w-5">{{ '全部' }}</view>
-                                        <up-icon size="26rpx" color="#333" name="arrow-down-fill" class="mr-10"></up-icon>
+                                        <view class="flex1 ov-hd f-s-28 c-333 text-center f-w-5 w-s-no">{{ '全部' }}</view>
+                                        <up-icon size="24rpx" color="#333" name="arrow-down-fill" class="mr-5"></up-icon>
                                     </view>
                                 </ut-action-sheet>
                             </view>
-                            <view class="h-86 pl-20 pr-20">
+                            <view class="h-86 pl-20 w-100%">
                                 <ut-search ref="searchRef" v-model="form.keywords" @search="changeSeach" margin="0" :border="false" :placeholder="form.placeholder" bgColor="#fff" height="86rpx" borderRadius="10rpx"></ut-search>
                             </view>
                         </view>
@@ -87,9 +87,9 @@
                                     <text class="f-w-5">云南省红河州个旧市卡房镇田心村小田心村268号</text>
                                 </view>
                                 <view class="c-333 f-s-28 pd-5 d-flex">
-                                    <text class="c-#666 w-s-no">当前在地种:</text>
+                                    <text class="c-#666 w-s-no">当前在地种:</text>
                                     <text class="ov-hd tx-ov w-s-no f-w-5">三七、天麻、徐长卿、白及、徐长卿、白及、三七、天麻、徐长卿、白及、徐长卿、白及</text>
-                                    <text class="flex1 w-s-no f-w-5">等120个种</text>
+                                    <text class="flex1 w-s-no f-w-5">等120个种</text>
                                 </view>
                                 <view class="pd-10"></view>
                                 <view class="p-rtv">
@@ -139,8 +139,8 @@ const onRefresh = () => {
     background-color: #fff;
     border-radius: 10rpx;
     box-sizing: border-box;
-    padding-left: 6rpx;
-    padding-right: 20rpx;
+    padding-left: 16rpx;
+    padding-right: 16rpx;
     padding-top: 14rpx;
     padding-bottom: 14rpx;
 }

+ 143 - 0
src/plant/species/config/index.vue

@@ -0,0 +1,143 @@
+<template>
+    <z-paging ref="paging" v-model="list" @onRefresh="onRefresh" bgColor="#fff" @query="query" :auto="false" safe-area-inset-bottom>
+        <up-navbar :title="title" @leftClick="navigateBackOrHome()" :fixed="false"></up-navbar>
+        <up-sticky offset-top="10" class="pd-20">
+            <ut-search ref="searchRef" v-model="form.keywords" @search="changeSeach" @change="changeSeach" margin="0" :border="false" :placeholder="placeholder" bgColor="#f7f7f7" height="86rpx" borderRadius="16rpx"></ut-search>
+        </up-sticky>
+        <template v-if="list.length == 0 && !form.keywords.trim()">
+            <view class="pd-20">
+                <view class="f-s-32 c-333 f-w-5 mb-20">已配置的主营品种</view>
+                <!-- speLable 组件使用示例 -->
+                <view class="d-flex a-c f-w-wrap">
+                    <spe-lable class="mr-20 mb-20" v-for="(item, index) in speArray" :key="index" :text="item?.name" size="30rpx" :id="item?.id" @close="() => handleLabelClose(item?.id)" />
+                </view>
+                <ut-empty class="mg-at" v-if="speArray.length == 0">
+                    <view class="d-flex a-c j-c f-s-28 c-ccc">暂未配置单位主营品种 </view>
+                    <view class="d-flex a-c j-c f-s-28 c-ccc">点击上方搜索框搜索后添加~</view>
+                </ut-empty>
+            </view>
+        </template>
+        <template v-for="(item, index) in list" :key="index">
+            <spe-list :text="item?.name" :searchText="form.keywords" :check="item?.check" @update:check="(value) => handleCheckChange(value, item.id)"> </spe-list>
+        </template>
+        <template #empty>
+            <ut-empty class="mg-at">
+                <view class="d-flex a-c j-c f-s-28 c-ccc">暂未搜索到该品种</view>
+            </ut-empty>
+        </template>
+        <template #bottom v-if="form.keywords.trim()">
+            <view class="base-bottom-wrap pd-20 pb-0">
+                <up-button type="primary" @click="subMit">确认</up-button>
+            </view>
+        </template>
+    </z-paging>
+    <ut-confirm-dialog v-model:show="showDeleteDialog" title="删除确认" :confirmText="'删除'" :cancelText="'取消'" @confirm="handleDeleteConfirm" @cancel="handleDeleteCancel">
+        <text>确定要删除这个品种吗?删除后不可恢复。</text>
+    </ut-confirm-dialog>
+</template>
+<script setup lang="ts">
+import speLable from '../models/speLable.vue';
+import SpeList from '../models/speList.vue';
+interface ListItem {
+    id: number;
+    name: string;
+    check: boolean;
+}
+//定义speArray
+interface speArray {
+    id: number;
+    name: string;
+}
+const list = ref<ListItem[]>([]);
+const paging = ref();
+const title = ref('配置单位主营品种');
+const placeholder = ref('请搜索药材品种名称选择添加');
+const form = ref({
+    keywords: '',
+});
+const speArray = ref<speArray[]>([]);
+// 删除确认相关状态
+const showDeleteDialog = ref(false);
+const currentDeleteId = ref<number | null>(null);
+
+setTimeout(() => {
+    speArray.value = [
+        { id: 1, name: '三七' },
+        { id: 2, name: '天麻' },
+        { id: 3, name: '白及' },
+    ];
+}, 200);
+// 处理标签关闭事件
+const handleLabelClose = (id: string | number) => {
+    currentDeleteId.value = id as number;
+    showDeleteDialog.value = true;
+};
+const handleCheckChange = (newCheckValue: boolean, id: number) => {
+    // 根据ID找到对应的列表项并更新
+    const item = list.value.find((item) => item.id === id);
+    if (item) {
+        item.check = newCheckValue;
+    }
+};
+const query = async (pageNum: number, pageSize: number) => {
+    const params = {
+        pageNum,
+        pageSize,
+        ...form.value,
+    };
+    if (!params.keywords?.trim()) {
+        // 处理空、null、undefined、纯空格的情况
+        return;
+    }
+    // const res = await cpyList(params);
+    let res: ListItem[] = [];
+    //循环push10条数据
+    for (let i = 0; i < 10; i++) {
+        res.push({
+            id: i + 1,
+            name: `${params.keywords}${i + 1}${params.keywords}`,
+            check: false,
+        });
+    }
+    // const { rows } = res;
+    paging.value.complete(res);
+};
+const changeSeach = () => {
+    paging.value.reload();
+    console.log(form.value?.keywords, 'keywords');
+};
+const onRefresh = () => {
+    paging.value.reload();
+};
+const subMit = () => {
+    list.value.forEach((item) => {
+        if (item.check) {
+            console.log(item, 'item');
+            //判断item.id是否不在speArray中
+            if (!speArray.value.find((speItem) => speItem.id === item.id)) {
+                speArray.value.push({
+                    id: item.id,
+                    name: item.name,
+                });
+            }
+        }
+    });
+    form.value.keywords = '';
+    onRefresh();
+};
+
+// 处理删除确认
+const handleDeleteConfirm = () => {
+    if (currentDeleteId.value !== null) {
+        speArray.value = speArray.value.filter((item) => item.id !== currentDeleteId.value);
+    }
+    showDeleteDialog.value = false;
+    currentDeleteId.value = null;
+};
+
+// 处理删除取消
+const handleDeleteCancel = () => {
+    showDeleteDialog.value = false;
+    currentDeleteId.value = null;
+};
+</script>

+ 63 - 0
src/plant/species/models/speLable.vue

@@ -0,0 +1,63 @@
+<template>
+    <view class="spe-label" :style="{ backgroundColor }">
+        <text class="label-text" :style="{ color: textColor, fontSize: size }">{{ text }}</text>
+        <up-icon class="close-icon" name="close-circle-fill" size="24rpx" color="#D81E06" @click="handleClose" />
+    </view>
+</template>
+
+<script setup lang="ts">
+const props = defineProps({
+    text: {
+        type: String,
+        required: true,
+    },
+    textColor: {
+        type: String,
+        default: '#333',
+    },
+    backgroundColor: {
+        type: String,
+        default: '#f7f7f7',
+    },
+    size: {
+        type: String,
+        default: '26rpx',
+    },
+    id: {
+        type: [String, Number],
+        required: true,
+    },
+});
+
+const emit = defineEmits<{
+    close: [id: string | number];
+}>();
+
+const handleClose = () => {
+    emit('close', props.id);
+};
+</script>
+
+<style lang="scss" scoped>
+.spe-label {
+    position: relative;
+    display: inline-flex;
+    align-items: center;
+    justify-content: center;
+    padding: 10rpx 32rpx;
+    border-radius: 8rpx;
+    min-height: 40rpx;
+}
+
+.label-text {
+    font-size: 24rpx;
+    line-height: 1.4;
+}
+
+.close-icon {
+    position: absolute;
+    top: -8rpx;
+    right: -8rpx;
+    cursor: pointer;
+}
+</style>

+ 119 - 0
src/plant/species/models/speList.vue

@@ -0,0 +1,119 @@
+<template>
+    <view class="spe-list-item" @click="handleClick">
+        <!-- 左侧搜索图标 -->
+        <up-icon name="search" size="50rpx" color="#ccc" class="search-icon" />
+        <!-- 中间文本区域(间隔30rpx) -->
+        <view class="text-container">
+            <!-- 使用 view + text 显示高亮文本 -->
+            <view class="text-content">
+                <text v-for="(part, index) in textParts" :key="index" :style="part.isHighlight ? highlightStyle : {}">
+                    {{ part.text }}
+                </text>
+            </view>
+        </view>
+        <!-- 右侧勾选图标(根据check状态显示) -->
+        <up-icon v-if="check" name="checkmark" size="45rpx" color="#37A954" class="check-icon" />
+    </view>
+</template>
+
+<script setup lang="ts">
+import { computed } from 'vue';
+const props = defineProps({
+    // 显示的完整文本
+    text: {
+        type: String,
+        required: true,
+    },
+    // 搜索文本,用于高亮匹配部分
+    searchText: {
+        type: String,
+        default: '',
+    },
+    // 高亮颜色
+    highlightColor: {
+        type: String,
+        default: '#37A954',
+    },
+    // 是否选中状态
+    check: {
+        type: Boolean,
+        default: false,
+    },
+});
+
+const emit = defineEmits<{
+    // 更新check状态的事件
+    'update:check': [check: boolean];
+    // 点击事件
+    click: [];
+}>();
+
+// 高亮样式
+const highlightStyle = computed(() => ({
+    color: props.highlightColor,
+    fontWeight: 'bold',
+}));
+
+// 将文本分割为高亮和非高亮部分
+const textParts = computed(() => {
+    if (!props.searchText || !props.text) {
+        return [{ text: props.text || '', isHighlight: false }];
+    }
+
+    // 创建正则表达式进行匹配(不区分大小写)
+    const regex = new RegExp(`(${props.searchText.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')})`, 'gi');
+    const parts = props.text.split(regex);
+
+    // 过滤空字符串并标记高亮部分
+    return parts
+        .filter((part) => part !== '')
+        .map((part) => ({
+            text: part,
+            isHighlight: part.toLowerCase() === props.searchText.toLowerCase(),
+        }));
+});
+
+// 处理点击事件
+const handleClick = () => {
+    emit('update:check', !props.check);
+    emit('click');
+};
+</script>
+
+<style lang="scss" scoped>
+.spe-list-item {
+    display: flex;
+    align-items: center;
+    padding: 20rpx 24rpx;
+    background-color: #fff;
+    margin-bottom: 16rpx;
+    transition: all 0.2s ease;
+}
+
+.search-icon {
+    flex-shrink: 0;
+    margin-right: 25rpx;
+}
+
+.text-container {
+    flex: 1;
+    overflow: hidden;
+}
+
+.text-content {
+    font-size: 28rpx;
+    color: #333;
+    line-height: 1.5;
+    display: flex;
+    flex-wrap: wrap;
+}
+
+.check-icon {
+    flex-shrink: 0;
+    margin-left: 20rpx;
+}
+.search_icon {
+    width: 38rpx;
+    height: 38rpx;
+}
+</style>

+ 0 - 3
src/plant/species/species-list/index.vue

@@ -1,3 +0,0 @@
-<template>
-    <view>页面内容</view>
-</template>

File diff suppressed because it is too large
+ 0 - 0
stats.html


+ 31 - 10
unocss.config.js

@@ -107,6 +107,7 @@ export default defineConfig({
         ],
         // 百分比高度
         [/^h-([\.\d]+)%$/, ([_, num]) => ({ height: `${num}%` })],
+        [/^w-([\.\d]+)%$/, ([_, num]) => ({ width: `${num}%` })],
         [
             /^wrapper-([\.\d]+)-([\.\d]+)$/,
             ([_, maxWidth, minWidth]) => ({
@@ -155,15 +156,35 @@ export default defineConfig({
             }),
         ],
     ],
-    theme: {
-        colors: {
-            /** 主题色,用法如: text-primary */
-            primary: 'var(--wot-color-theme,#0957DE)',
-        },
-        fontSize: {
-            /** 提供更小号的字体,用法如:text-2xs */
-            '2xs': ['20rpx', '28rpx'],
-            '3xs': ['18rpx', '26rpx'],
+    transformers: [
+        {
+            name: 'remove-custom-classes',
+            enforce: 'pre',
+            transform(code, id) {
+                // 只在相关文件中处理
+                if (id.endsWith('.vue')) {
+                    // 移除特定的类名
+                    const modified = code.replace(/\bclass=["']([^"']*)u-popup__content—transition([^"']*)["']/g, (match, before, after) => {
+                        return `class="${before}${after}"`;
+                    });
+                    return {
+                        code: modified,
+                        map: null,
+                    };
+                }
+                return { code, map: null };
+            },
         },
-    },
+    ],
+    // theme: {
+    //     colors: {
+    //         /** 主题色,用法如: text-primary */
+    //         primary: 'var(--wot-color-theme,#0957DE)',
+    //     },
+    //     fontSize: {
+    //         /** 提供更小号的字体,用法如:text-2xs */
+    //         '2xs': ['20rpx', '28rpx'],
+    //         '3xs': ['18rpx', '26rpx'],
+    //     },
+    // },
 });

+ 19 - 24
vite.config.ts

@@ -1,22 +1,22 @@
-import { defineConfig } from "vite";
-import uni from "@dcloudio/vite-plugin-uni";
-import path from "path";
-import AutoImport from "unplugin-auto-import/vite";
-import { visualizer } from "rollup-plugin-visualizer";
-import UniUnoCSS from 'uni-unocss'
+import { defineConfig } from 'vite';
+import uni from '@dcloudio/vite-plugin-uni';
+import path from 'path';
+import AutoImport from 'unplugin-auto-import/vite';
+import { visualizer } from 'rollup-plugin-visualizer';
+import UniUnoCSS from 'uni-unocss';
 export default async () => {
-    const UnoCss = await import('unocss/vite').then(i => i.default)
+    const UnoCss = await import('unocss/vite').then((i) => i.default);
     return defineConfig({
         define: {
-            "process.env": process.env, // 配置变量在业务代码内生效
+            'process.env': process.env, // 配置变量在业务代码内生效
         },
         plugins: [
             AutoImport({
                 imports: [
                     // 预设
-                    "vue",
-                    "uni-app",
-                    "pinia",
+                    'vue',
+                    'uni-app',
+                    'pinia',
                 ],
                 dts: true,
             }),
@@ -28,31 +28,26 @@ export default async () => {
             preprocessorOptions: {
                 scss: {
                     // 取消sass废弃API的报警
-                    silenceDeprecations: [
-                        "legacy-js-api",
-                        "color-functions",
-                        "import",
-                    ],
+                    silenceDeprecations: ['legacy-js-api', 'color-functions', 'import'],
                 },
             },
         },
         resolve: {
             alias: {
-                "@": path.resolve(__dirname, "src"),
+                '@': path.resolve(__dirname, 'src'),
             },
         },
         server: {
             proxy: {
-                "/subpackage": {
-                    target: "https://yunnan.yujin.yunyaozhuisu.com",
+                '/subpackage': {
+                    target: 'https://yunnan.yujin.yunyaozhuisu.com',
                     changeOrigin: true,
-                    rewrite: (path) =>
-                        path.replace(/^\/subpackage/, "/subpackage"),
+                    rewrite: (path) => path.replace(/^\/subpackage/, '/subpackage'),
                 },
-                "/pyapi": {
-                    target: "https://yunnan.yujin.yunyaozhuisu.com",
+                '/pyapi': {
+                    target: 'https://yunnan.yujin.yunyaozhuisu.com',
                     changeOrigin: true,
-                    rewrite: (path) => path.replace(/^\/pyapi/, "/pyapi"),
+                    rewrite: (path) => path.replace(/^\/pyapi/, '/pyapi'),
                 },
             },
             // 启动端口

Some files were not shown because too many files changed in this diff