perf:购物车跳转详情,购物车返回首页,个人中心返回首页,顶部菜单高亮优化

This commit is contained in:
郭永超 2025-09-01 14:10:40 +08:00
parent 30470ee192
commit d7aaad4c91
15 changed files with 146 additions and 106 deletions

View File

@ -12,5 +12,5 @@ VITE_APP_BASE_API = '/apis'
VITE_APP_BASE_URL = ''
VITE_APP_UPLOAD_API = '/uploadApis'
VITE_APP_UPLOAD_URL = ''
VITE_APP_VIST_URL = 'https://app.yingyijt.com'
VITE_APP_VIST_URL = 'http://47.109.205.240'

View File

@ -13,7 +13,7 @@ export const leftApps = [
{
name: 'sub-operation-admin',
entry: VITE_APP_SUB_OA,
activeRule: `/sub-operation-admin`,
activeRule: `${VITE_APP_VIST_URL}:82/login`,
title: '管理后台',
icon: 'images/platform/icon-admin.png',
},
@ -44,7 +44,7 @@ export const rightApps = [
{
name: 'sub-government-admin',
entry: VITE_APP_SUB_GAS,
activeRule: `/sub-government-admin`,
activeRule: `${VITE_APP_VIST_URL}:81/login`,
title: '管理后台',
icon: 'images/platform/icon-admin.png',
},

View File

@ -12,7 +12,6 @@ declare module 'vue' {
'CenterMap copy': typeof import('./src/components/centerMap copy.vue')['default']
CodeDialog: typeof import('./src/components/code-dialog/index.vue')['default']
Components: typeof import('./src/components/index.js')['default']
copy: typeof import('./src/components/centerMap copy.vue')['default']
CurrentTime: typeof import('./src/components/currentTime.vue')['default']
CustomBack: typeof import('./src/components/customBack.vue')['default']
CustomCarouselPicture: typeof import('./src/components/custom-carousel-picture/index.vue')['default']

View File

@ -24,6 +24,14 @@ export default defineConfig(({ command, mode }) => {
minify: 'terser',
rollupOptions: {
external: ['echarts-liquidfill'], // 显式声明外部依赖
output: {
manualChunks: {
// 手动分块示例
vue: ['vue', 'vue-router', 'pinia'],
echarts: ['echarts'],
vendor: ['lodash', 'axios'],
},
},
},
},
server: {

View File

@ -21,47 +21,15 @@ const SettingStore = useSettingStore();
//
const size = computed(() => SettingStore.themeConfig.globalComSize);
const meuns = ref([
{
label: '智慧种植',
path: '/sub-operation-service/smartFarm',
},
{
label: '电商交易',
path: '/sub-operation-service/ecommerce',
},
{
label: '农事服务',
path: '/sub-operation-service/farmService',
},
{
label: '分拣包装',
path: '/sub-operation-service/packaging',
},
{
label: '仓储物流',
path: '/sub-operation-service/warehouseLogistics',
},
{
label: '涉农金融',
path: '/sub-operation-service/finance',
},
{
label: '公共品牌',
path: '/sub-operation-service/brand',
},
{
label: '综合看板',
path: '/sub-operation-service/dashboard',
},
]);
import menuList from '@/layouts/component/header/menu.js';
const meuns = ref(menuList);
import { useRoute } from 'vue-router';
import { useMenuStore } from '@/store/modules/menuStore';
const route = useRoute();
const menuStore = useMenuStore();
onMounted(() => {
let item = meuns.value.find((item) => route.path.indexOf(item.path) > -1);
console.log('item', item);
// console.log('item', item);
if (item) {
menuStore.setMenuLabel(item.label);
menuStore.setMenuPath(item.path);
@ -69,8 +37,8 @@ onMounted(() => {
menuStore.setMenuLabel('智慧种植');
menuStore.setMenuPath('/sub-operation-service/smartFarm');
}
console.log(menuStore.activeMenuLabel);
console.log(menuStore.activeMenuPath);
// console.log(menuStore.activeMenuLabel);
// console.log(menuStore.activeMenuPath);
});
</script>

View File

@ -83,40 +83,8 @@ const router = useRouter();
const keyword = ref('');
const meuns = ref([
{
label: '智慧种植',
path: '/sub-operation-service/smartFarm',
},
{
label: '电商交易',
path: '/sub-operation-service/ecommerce',
},
{
label: '农事服务',
path: '/sub-operation-service/farmService',
},
{
label: '分拣包装',
path: '/sub-operation-service/packaging',
},
{
label: '仓储物流',
path: '/sub-operation-service/warehouseLogistics',
},
{
label: '涉农金融',
path: '/sub-operation-service/finance',
},
{
label: '公共品牌',
path: '/sub-operation-service/brand',
},
{
label: '综合看板',
path: '/sub-operation-service/dashboard',
},
]);
import menuList from './menu.js';
const meuns = ref(menuList);
const menuStore = useMenuStore();
const activeLabel = ref(menuStore.activeMenuLabel);

View File

@ -0,0 +1,35 @@
const menuList = [
{
label: '智慧种植',
path: '/sub-operation-service/smartFarm',
},
{
label: '电商交易',
path: '/sub-operation-service/ecommerce',
},
{
label: '农事服务',
path: '/sub-operation-service/farmService',
},
{
label: '分拣包装',
path: '/sub-operation-service/packaging',
},
{
label: '仓储物流',
path: '/sub-operation-service/warehouseLogistics',
},
{
label: '涉农金融',
path: '/sub-operation-service/finance',
},
{
label: '公共品牌',
path: '/sub-operation-service/brand',
},
{
label: '综合看板',
path: '/sub-operation-service/dashboard',
},
];
export default menuList;

View File

@ -23,7 +23,7 @@ router.beforeEach(async (to, from, next) => {
const userStore = useUserStore();
const hasToken = userStore.hasToken();
console.log('sub-operation-service************hasToken', hasToken);
// console.log('sub-operation-service************hasToken', hasToken);
if (hasToken) {
if (to.path === '/login') {
// 如果已登录,请重定向到主页

View File

@ -208,7 +208,7 @@
<script setup>
import common from './components/common.vue';
import banner from './components/banner.vue';
import { onMounted, reactive, ref, computed } from 'vue';
import { onMounted, reactive, ref, computed, watch } from 'vue';
import { getAssetsFile } from '@/utils';
import { qrImg } from '@/layouts/component/Header/base64img.js';
import evaluate from './components/evaluate.vue';
@ -226,6 +226,7 @@ const goodId = route.query.id; // 获取参数
const pId = route.query.pid;
const currentWeight = ref(0);
const showPhone = ref(false);
const jumpType = ref('1');
let bannerList = reactive(['images/ecommerce/' + 'banner.png', 'images/ecommerce/' + 'banner.png']);
const tabList = reactive([
@ -401,6 +402,8 @@ let saveInfo = reactive({
});
onMounted(() => {
jumpType.value = route.query.type ?? '1';
showDetail.value = false;
// const num = Number(pId);
getGoodDetail(goodId)
@ -472,7 +475,14 @@ const formattedData = (data) => {
};
const toCodeDetail = () => {
router.push('/sub-operation-service/ecommerce-agricultural/ecommerce-agriculturalDetail/source?id=' + goodId);
console.log(jumpType.value);
if (jumpType.value === '1') {
//
router.push('/sub-operation-service/ecommerce-agricultural/ecommerce-agriculturalDetail/source?id=' + goodId);
} else if (jumpType.value === '2') {
//
router.push('/sub-operation-service/ecommerce-supplier/detail/source?id=' + goodId);
}
};
const toBack = (level) => {

View File

@ -64,6 +64,7 @@ import { useMethodsStore } from '@/store/modules/methods';
import { ElMessage, ElMessageBox } from 'element-plus';
const route = useRoute();
const router = useRouter();
const emit = defineEmits(['toDetail']);
const props = defineProps({
data: {
@ -151,10 +152,11 @@ const openDialog = (data) => {
const toDetail = (id, pid) => {
if (props.type === 2) {
router.push('/sub-operation-service/ecommerce-supplier/detail?id=' + id + '&pid=' + pid);
router.push('/sub-operation-service/ecommerce-supplier/detail?id=' + id + '&pid=' + pid + '&type=' + 2);
} else {
router.push('/sub-operation-service/ecommerce-agricultural/ecommerce-agriculturalDetail?id=' + id + '&pid=' + pid);
router.push('/sub-operation-service/ecommerce-agricultural/ecommerce-agriculturalDetail?id=' + id + '&pid=' + pid + '&type=' + 1);
}
// emit('toDetail', id, pid);
};
</script>
<style lang="scss" scoped>

View File

@ -33,14 +33,23 @@ let currentIndex = ref(0);
watch(
() => props.currentName,
() => {
console.info('currentName', props.currentName);
// console.info('currentName', props.currentName);
currentIndex.value = leftMenu.findIndex((m) => {
return m.name == props.currentName;
});
},
{ deep: true, immediate: true }
);
watch(
() => route.path,
() => {
// console.info('route.path', route.path);
currentIndex.value = leftMenu.findIndex((m) => {
return route.path.indexOf(m.path) > -1;
});
},
{ deep: true, immediate: true }
);
const toLink = (index) => {
currentIndex.value = index;
let path = index != undefined ? leftMenu[index].path : null;

View File

@ -38,7 +38,7 @@
<div class="goods-list">
<template v-for="(n, index) in list" :key="n.id">
<div class="goods-item">
<goodsItem :data="n"></goodsItem>
<goodsItem :data="n" :type="1"></goodsItem>
</div>
</template>
</div>

View File

@ -50,10 +50,22 @@ watch(
}
);
import menuList from '@/layouts/component/header/menu.js';
const meuns = ref(menuList);
import { useMenuStore } from '@/store/modules/menuStore';
const menuStore = useMenuStore();
const toLink = (item) => {
currentLink.value = item.name;
if (item.path && item.path != '') {
if (item.name == 'home') {
menuStore.setMenuLabel('智慧种植');
menuStore.setMenuPath('/sub-operation-service/smartFarm');
router.push(item.path);
} else {
let obj = meuns.value.find((el) => el.name == item.name);
console.log('obj', obj);
menuStore.setMenuLabel(obj.label);
menuStore.setMenuPath(obj.path);
router.push(obj.path);
}
};
</script>

View File

@ -44,30 +44,32 @@
<ischeck :value="g.ischeck" size="24px"></ischeck>
</div>
</div>
<div class="good-img" @click="toCheckGood(index, indexg)">
<!-- <costomImg :url="g.productImgUrl" :is-view="false"></costomImg> -->
<img class="good-img" style="border-radius: 5px" :src="g.productImgUrl.split('?')[0]" alt="" />
</div>
<div class="good-info" @click="toCheckGood(index, indexg)">
<div class="good-info-pos">
<div class="txt-ellipsis clamp2">{{ g.productName || '--' }}</div>
<div class="good-row-info" @click="goDetail(g, indexg)">
<div class="good-img">
<!-- <costomImg :url="g.productImgUrl" :is-view="false"></costomImg> -->
<img class="good-img" style="border-radius: 5px" :src="g.productImgUrl.split('?')[0]" alt="" />
</div>
</div>
<div class="good-price-num">
<div class="good-price-num-pos">
<div class="price" @click="toCheckGood(index, indexg)">{{ g.netWeightInfoVO?.goodSpecs }}</div>
<div class="total" @click="toCheckGood(index, indexg)">{{ (g.price * g.quantity).toFixed(2) }}</div>
<div class="num">
<div class="right-item">
<el-input-number v-model="g.quantity" :min="1" @change="numberChange(g.quantity, index, indexg)">
<!-- <template #suffix>
<div class="good-info">
<div class="good-info-pos">
<div class="txt-ellipsis clamp2">{{ g.productName || '--' }}</div>
</div>
</div>
<div class="good-price-num">
<div class="good-price-num-pos">
<div class="price">{{ g.netWeightInfoVO?.goodSpecs }}</div>
<div class="total">{{ (g.price * g.quantity).toFixed(2) }}</div>
<div class="num">
<div class="right-item">
<el-input-number v-model="g.quantity" :min="1" @change="numberChange(g.quantity, index, indexg)">
<!-- <template #suffix>
<span>{{ g.unit }}</span>
</template> -->
</el-input-number>
</el-input-number>
</div>
</div>
<div class="good-del" @click="doSingleDel(index, indexg)">
<span>删除</span>
</div>
</div>
<div class="good-del" @click="doSingleDel(index, indexg)">
<span>删除</span>
</div>
</div>
</div>
@ -170,6 +172,16 @@ const pagination = (value) => {
});
};
const jumpType = ref('1'); //12
const goDetail = (item, indexg) => {
console.log(item, indexg);
if (jumpType.value === 2) {
router.push('/sub-operation-service/ecommerce-supplier/detail?id=' + item.productId + '&type=' + 2);
} else {
router.push('/sub-operation-service/ecommerce-agricultural/ecommerce-agriculturalDetail?id=' + item.productId + '&type=' + 1);
}
};
function addIsCheckProperty(data) {
if (!data) return;
@ -584,6 +596,11 @@ function removeCheckedItems(data) {
width: 100%;
gap: 16px;
}
.good-row-info {
flex: 1;
display: flex;
gap: 16px;
}
.good-do,
.good-img,
.good-info,
@ -630,7 +647,7 @@ function removeCheckedItems(data) {
}
.price {
font-weight: 400;
width: 200px;
width: 180px;
}
.total {
font-weight: 700;

View File

@ -50,10 +50,22 @@ watch(
}
);
import menuList from '@/layouts/component/header/menu.js';
const meuns = ref(menuList);
import { useMenuStore } from '@/store/modules/menuStore';
const menuStore = useMenuStore();
const toLink = (item) => {
currentLink.value = item.name;
if (item.path && item.path != '') {
if (item.name == 'home') {
menuStore.setMenuLabel('智慧种植');
menuStore.setMenuPath('/sub-operation-service/smartFarm');
router.push(item.path);
} else {
let obj = meuns.value.find((el) => el.name == item.name);
console.log('obj', obj);
menuStore.setMenuLabel(obj.label);
menuStore.setMenuPath(obj.path);
router.push(obj.path);
}
};
</script>