Merge branch 'sqlsugar-dev' of https://gitee.com/ccnetcore/Yi into sqlsugar-dev
This commit is contained in:
@@ -3,7 +3,6 @@ import { ArticleEntity } from '@/type/interface/ArticleEntity'
|
||||
|
||||
export default {
|
||||
add(data:any) {
|
||||
console.log(data)
|
||||
return myaxios({
|
||||
url: `/article/add`,
|
||||
method: 'post',
|
||||
|
||||
18
Yi.Vue3.x.Vant/src/api/skuApi.ts
Normal file
18
Yi.Vue3.x.Vant/src/api/skuApi.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import myaxios from '@/utils/myaxios'
|
||||
|
||||
export default {
|
||||
add(data:any) {
|
||||
return myaxios({
|
||||
url: `/sku/add`,
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
},
|
||||
pageList(data:any) {
|
||||
return myaxios({
|
||||
url: '/sku/pageList',
|
||||
method: 'get',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
}
|
||||
18
Yi.Vue3.x.Vant/src/api/spuApi.ts
Normal file
18
Yi.Vue3.x.Vant/src/api/spuApi.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import myaxios from '@/utils/myaxios'
|
||||
|
||||
export default {
|
||||
add(data:any) {
|
||||
return myaxios({
|
||||
url: `/spu/add`,
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
},
|
||||
pageList(data:any) {
|
||||
return myaxios({
|
||||
url: '/spu/pageList',
|
||||
method: 'get',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,8 @@ let tabbar=ref([
|
||||
{icon:"wap-home",to:"/",title:"主页"},
|
||||
{icon:"location-o",to:"",title:"发现"},
|
||||
{icon:"",to:"",title:""},
|
||||
{icon:"friends-o",to:"",title:"商城"},
|
||||
{icon:"friends-o",to:"/shopIndex",title:"商城"},
|
||||
// {icon:"friends-o",to:"",title:"商城"},
|
||||
{icon:"setting-o",to:"/my",title:"我的"},
|
||||
])
|
||||
const onChange=(index:number)=>{
|
||||
@@ -43,7 +44,8 @@ const onChange=(index:number)=>{
|
||||
{icon:"wap-home-o",to:"/",title:"主页"},
|
||||
{icon:"location-o",to:"",title:"发现"},
|
||||
{icon:"",to:"",title:""},
|
||||
{icon:"friends-o",to:"",title:"商城"},
|
||||
{icon:"friends-o",to:"/shopIndex",title:"商城"},
|
||||
// {icon:"friends-o",to:"",title:"商城"},
|
||||
{icon:"setting-o",to:"/my",title:"我的"},
|
||||
];
|
||||
tabbar.value[index].icon=tabbar.value[index].icon.replace("-o","")
|
||||
|
||||
9
Yi.Vue3.x.Vant/src/layout/head/index.vue
Normal file
9
Yi.Vue3.x.Vant/src/layout/head/index.vue
Normal file
@@ -0,0 +1,9 @@
|
||||
<template>
|
||||
<van-nav-bar
|
||||
title="标题"
|
||||
left-text="返回"
|
||||
left-arrow
|
||||
/>
|
||||
<br>
|
||||
<router-view />
|
||||
</template>
|
||||
@@ -1,14 +1,20 @@
|
||||
import { createWebHistory, createRouter } from 'vue-router';
|
||||
import Layout from '@/layout/index.vue';
|
||||
import HeadLayout from '@/layout/head/index.vue'
|
||||
|
||||
export const constantRoutes = [
|
||||
|
||||
|
||||
{
|
||||
name:'Layout',
|
||||
path: '/',
|
||||
component: Layout,
|
||||
redirect:"/recommend",
|
||||
children: [
|
||||
{
|
||||
path: '/shopIndex',
|
||||
component: () => import('@/view/shop/shopIndex.vue'),
|
||||
name: 'ShopIndex',
|
||||
},
|
||||
{
|
||||
path: '/my',
|
||||
component: () => import('@/view/my.vue'),
|
||||
@@ -49,6 +55,25 @@ export const constantRoutes = [
|
||||
component: () => import('@/view/login.vue'),
|
||||
name: 'Login',
|
||||
},
|
||||
|
||||
{
|
||||
name:'Shop',
|
||||
path: '/shop',
|
||||
component: HeadLayout,
|
||||
redirect:"/shopIndex",
|
||||
children: [
|
||||
{
|
||||
path: '/shopDetails',
|
||||
component: () => import('@/view/shop/shopDetails.vue'),
|
||||
name: 'ShopDetails',
|
||||
},
|
||||
{
|
||||
path: '/shopSearch',
|
||||
component: () => import('@/view/shop/shopSearch.vue'),
|
||||
name: 'ShopSearch',
|
||||
},
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
const router = createRouter({
|
||||
|
||||
@@ -42,7 +42,15 @@ myaxios.interceptors.request.use(function(config:any) {
|
||||
myaxios.interceptors.response.use(async function(response) {
|
||||
//成功
|
||||
const resp = response.data
|
||||
|
||||
if(resp.code==401)
|
||||
{
|
||||
Notify({ type: 'warning', message: '登录过期' });
|
||||
//登出
|
||||
useUserStore().logOut().then(() => {
|
||||
location.href = '/';
|
||||
})
|
||||
isRelogin.show = false;
|
||||
}
|
||||
// store.dispatch("closeLoad");
|
||||
return resp;
|
||||
}, async function(error) {
|
||||
|
||||
5
Yi.Vue3.x.Vant/src/view/shop/shopDetails.vue
Normal file
5
Yi.Vue3.x.Vant/src/view/shop/shopDetails.vue
Normal file
@@ -0,0 +1,5 @@
|
||||
<template>
|
||||
这里是商品详情页
|
||||
<br>
|
||||
<router-link to="/shopIndex">返回商品首页</router-link>
|
||||
</template>
|
||||
23
Yi.Vue3.x.Vant/src/view/shop/shopIndex.vue
Normal file
23
Yi.Vue3.x.Vant/src/view/shop/shopIndex.vue
Normal file
@@ -0,0 +1,23 @@
|
||||
<template>
|
||||
这里是商城主页
|
||||
<van-swipe class="my-swipe" :autoplay="3000" indicator-color="white" lazy-render>
|
||||
<van-swipe-item>1</van-swipe-item>
|
||||
<van-swipe-item>2</van-swipe-item>
|
||||
<van-swipe-item>3</van-swipe-item>
|
||||
<van-swipe-item>4</van-swipe-item>
|
||||
</van-swipe>
|
||||
<van-grid :column-num="4">
|
||||
<van-grid-item v-for="value in 8" :key="value" icon="photo-o" text="文字" />
|
||||
</van-grid>
|
||||
<router-link to="/shopSearch">点击前往搜索</router-link>
|
||||
<br>
|
||||
</template>
|
||||
<style>
|
||||
.my-swipe .van-swipe-item {
|
||||
color: #fff;
|
||||
font-size: 20px;
|
||||
line-height: 150px;
|
||||
text-align: center;
|
||||
background-color: #39a9ed;
|
||||
}
|
||||
</style>
|
||||
37
Yi.Vue3.x.Vant/src/view/shop/shopSearch.vue
Normal file
37
Yi.Vue3.x.Vant/src/view/shop/shopSearch.vue
Normal file
@@ -0,0 +1,37 @@
|
||||
<template>
|
||||
这里是商品搜索页
|
||||
<br>
|
||||
<router-link to="/shopDetails">点击进入商品详情</router-link>
|
||||
<br>
|
||||
<router-link to="/shopIndex">返回商品首页</router-link>
|
||||
这个是spu:
|
||||
<div v-for="item in spuList" :key="item.id">商品名称:{{item.spuName}}
|
||||
<div v-for="spec in item.specsSpuAllInfo" :key="spec">规格组: {{spec.specsGroupName}}
|
||||
<div v-for="name in spec.specsNames" :key="name">规格值: {{name}}
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {ref,reactive,toRefs} from 'vue'
|
||||
import spuApi from "@/api/spuApi";
|
||||
const data = reactive({
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
// dictName: undefined,
|
||||
// dictType: undefined,
|
||||
isDeleted: false,
|
||||
},
|
||||
});
|
||||
const spuList = ref<any[]>([]);
|
||||
const { queryParams } = toRefs(data);
|
||||
spuApi.pageList(queryParams.value).then((response:any)=>{
|
||||
spuList.value=response.data.data;
|
||||
})
|
||||
</script>
|
||||
Reference in New Issue
Block a user