Merge branch 'test'
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "jdt-user",
|
"name": "jdt-user",
|
||||||
"version": "3.0.3",
|
"version": "3.0.4",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "",
|
"description": "",
|
||||||
"templateInfo": {
|
"templateInfo": {
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
"css": "sass"
|
"css": "sass"
|
||||||
},
|
},
|
||||||
"taroConfig": {
|
"taroConfig": {
|
||||||
"version": "3.0.3"
|
"version": "3.0.4"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build:weapp": "taro build --type weapp",
|
"build:weapp": "taro build --type weapp",
|
||||||
|
|||||||
@@ -74,3 +74,7 @@ export const getGoodList = (data: object) =>
|
|||||||
// // 获取活动商家商品
|
// // 获取活动商家商品
|
||||||
// export const getHotGoodList = (data: object) =>
|
// export const getHotGoodList = (data: object) =>
|
||||||
// request("/store/goods", data, "POST");
|
// request("/store/goods", data, "POST");
|
||||||
|
|
||||||
|
// 获取全部商家类目
|
||||||
|
export const getAllMerCategory = () =>
|
||||||
|
request("/home/all/classify", {}, "POST");
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ export const userSign = () => request("/sign/user", {}, "POST");
|
|||||||
|
|
||||||
// 获取签到记录
|
// 获取签到记录
|
||||||
export const getSignRecord = () => request("/sign/pulse/count", {}, "POST");
|
export const getSignRecord = () => request("/sign/pulse/count", {}, "POST");
|
||||||
|
|
||||||
// 获取赠送总记录
|
// 获取赠送总记录
|
||||||
export const getGiftRecord = (data: object) =>
|
export const getGiftRecord = (data: object) =>
|
||||||
request("/user/giftPulseRecord", data, "POST");
|
request("/user/giftPulseRecord", data, "POST");
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ export default defineAppConfig({
|
|||||||
"pages/category/index",
|
"pages/category/index",
|
||||||
"pages/cart/index",
|
"pages/cart/index",
|
||||||
"pages/user/index",
|
"pages/user/index",
|
||||||
|
"pages/allClassList/index",
|
||||||
],
|
],
|
||||||
subPackages: [
|
subPackages: [
|
||||||
{
|
{
|
||||||
|
|||||||
3
src/pages/allClassList/index.config.ts
Normal file
3
src/pages/allClassList/index.config.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
export default definePageConfig({
|
||||||
|
navigationBarTitleText: "全部服务",
|
||||||
|
});
|
||||||
84
src/pages/allClassList/index.vue
Normal file
84
src/pages/allClassList/index.vue
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
<template>
|
||||||
|
<view class="app">
|
||||||
|
<view class="container" v-for="(item, index) in list" :key="index">
|
||||||
|
<view class="title">{{ item.name }}</view>
|
||||||
|
<view class="navbar" v-if="Array.isArray(item.Classify)">
|
||||||
|
<nut-grid :border="false" column-num="5">
|
||||||
|
<nut-grid-item
|
||||||
|
v-for="itm in item.Classify"
|
||||||
|
:key="itm.ID"
|
||||||
|
:text="itm.name"
|
||||||
|
@click="toDetails(itm)"
|
||||||
|
>
|
||||||
|
<image :src="itm.icon" />
|
||||||
|
</nut-grid-item>
|
||||||
|
</nut-grid>
|
||||||
|
</view>
|
||||||
|
<nut-empty v-else description="该分类暂无类目" image-size="0"></nut-empty>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from "vue";
|
||||||
|
import Taro from "@tarojs/taro";
|
||||||
|
import { getAllMerCategory } from "@/api/goods";
|
||||||
|
|
||||||
|
const list = ref<
|
||||||
|
{
|
||||||
|
ID?: number;
|
||||||
|
name?: string;
|
||||||
|
Classify: {
|
||||||
|
ID?: number;
|
||||||
|
name?: string;
|
||||||
|
icon?: string;
|
||||||
|
}[];
|
||||||
|
}[]
|
||||||
|
>([]);
|
||||||
|
|
||||||
|
Taro.useLoad(() => {
|
||||||
|
get_all_mer_category();
|
||||||
|
});
|
||||||
|
|
||||||
|
const get_all_mer_category = async () => {
|
||||||
|
const res = await getAllMerCategory();
|
||||||
|
list.value = res.data.data || [];
|
||||||
|
};
|
||||||
|
|
||||||
|
const toDetails = (item: any) => {
|
||||||
|
Taro.navigateTo({
|
||||||
|
url: `/pages/search/index?id=${item.ID}&name=${item.name}`,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.app {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
background-color: #fff;
|
||||||
|
padding: 10px;
|
||||||
|
border-radius: 10px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
|
||||||
|
.title {
|
||||||
|
font-weight: bold;
|
||||||
|
margin: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar {
|
||||||
|
background-color: #ffffff;
|
||||||
|
|
||||||
|
.nut-grid-item__content {
|
||||||
|
padding: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
image {
|
||||||
|
width: 80px;
|
||||||
|
height: 80px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -5,34 +5,27 @@
|
|||||||
v-model="searchValue"
|
v-model="searchValue"
|
||||||
placeholder="要搜索点什么?"
|
placeholder="要搜索点什么?"
|
||||||
></nut-searchbar>
|
></nut-searchbar>
|
||||||
<!-- 幻灯片 -->
|
<view class="banner">
|
||||||
<nut-swiper
|
<nut-swiper
|
||||||
:init-page="0"
|
:init-page="0"
|
||||||
:pagination-visible="true"
|
:pagination-visible="true"
|
||||||
pagination-color="#000"
|
pagination-color="#ff0000"
|
||||||
duration="1000"
|
auto-play="3000"
|
||||||
:loop="false"
|
>
|
||||||
>
|
<nut-swiper-item v-for="(itm, idx) in bannerList" :key="idx">
|
||||||
<nut-swiper-item v-for="(itm, idx) in swiperList" :key="idx">
|
<img :src="itm.url" :alt="itm.ID.toString()" />
|
||||||
<view
|
</nut-swiper-item>
|
||||||
class="item"
|
</nut-swiper>
|
||||||
v-for="(item, index) in itm"
|
</view>
|
||||||
:key="index"
|
|
||||||
@click="toDetails(item)"
|
|
||||||
>
|
|
||||||
<image :src="item.icon" />
|
|
||||||
<text>{{ item.name }}</text>
|
|
||||||
</view>
|
|
||||||
</nut-swiper-item>
|
|
||||||
</nut-swiper>
|
|
||||||
<!-- 金刚区 -->
|
<!-- 金刚区 -->
|
||||||
<view class="navbar">
|
<view class="navbar">
|
||||||
<nut-grid :gutter="10" :border="false">
|
<nut-grid :border="false" column-num="5">
|
||||||
<nut-grid-item
|
<nut-grid-item
|
||||||
v-for="item in userMenuList"
|
v-for="item in swiperList"
|
||||||
:key="item.id"
|
:key="item.ID"
|
||||||
:text="item.label"
|
:text="item.name"
|
||||||
@click="toPage(item.url)"
|
@click="toDetails(item)"
|
||||||
>
|
>
|
||||||
<image :src="item.icon" />
|
<image :src="item.icon" />
|
||||||
</nut-grid-item>
|
</nut-grid-item>
|
||||||
@@ -50,46 +43,25 @@ import Taro from "@tarojs/taro";
|
|||||||
import Popup from "@/components/Popup.vue";
|
import Popup from "@/components/Popup.vue";
|
||||||
import MerList from "@/components/MerList.vue";
|
import MerList from "@/components/MerList.vue";
|
||||||
import { getHomeList } from "@/api/home";
|
import { getHomeList } from "@/api/home";
|
||||||
|
import { getBanner } from "@/api/user";
|
||||||
|
|
||||||
const searchValue = ref("");
|
const searchValue = ref("");
|
||||||
|
|
||||||
interface SwiperList {
|
interface SwiperList {
|
||||||
ID: number;
|
ID?: number;
|
||||||
icon: string;
|
icon?: string;
|
||||||
name: string;
|
name?: string;
|
||||||
|
url?: string;
|
||||||
|
type?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
const swiperList = ref<Array<Array<SwiperList>>>([]);
|
const swiperList = ref<Array<SwiperList>>([]);
|
||||||
|
|
||||||
const userMenuList = ref([
|
const bannerList = ref<any[]>([]);
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
label: "活动游戏",
|
|
||||||
url: `/pages/game/gamehome/index?uid=${Taro.getStorageSync("token")}`,
|
|
||||||
icon: "//jdt168.com/uploads/merchant/20220829/caad6be8983e88c41d28da7d124bc37b.png",
|
|
||||||
},
|
|
||||||
// {
|
|
||||||
// id: 2,
|
|
||||||
// label: "活动商品",
|
|
||||||
// url: "/pages/hotGoods/index/index",
|
|
||||||
// icon: "//jdt168.com/uploads/def/20230509/d59e7fcb65a88bc56694dae4f9d21b51.png",
|
|
||||||
// },
|
|
||||||
{
|
|
||||||
id: 3,
|
|
||||||
label: "商户入驻",
|
|
||||||
url: "/pages/users/settled_mer/index",
|
|
||||||
icon: "//jdt168.com/uploads/merchant/20220829/6fe67b93721a42aedc842c4f19d6f2d3.png",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 4,
|
|
||||||
label: "最新资讯",
|
|
||||||
url: "",
|
|
||||||
icon: "//jdt168.com/uploads/merchant/20220829/b975136a9b64aab69bf11d75a194f1ea.png",
|
|
||||||
},
|
|
||||||
]);
|
|
||||||
|
|
||||||
Taro.useDidShow(async () => {
|
Taro.useDidShow(async () => {
|
||||||
await getBannerList();
|
await getBannerList();
|
||||||
|
await get_banner_list();
|
||||||
});
|
});
|
||||||
|
|
||||||
Taro.useShareAppMessage(() => ({
|
Taro.useShareAppMessage(() => ({
|
||||||
@@ -100,59 +72,96 @@ Taro.useShareAppMessage(() => ({
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
const getBannerList = async () => {
|
const getBannerList = async () => {
|
||||||
|
swiperList.value = [
|
||||||
|
{
|
||||||
|
ID: 11224,
|
||||||
|
type: 1,
|
||||||
|
name: "全部服务",
|
||||||
|
url: "/pages/allClassList/index",
|
||||||
|
icon: "//upload.jdt168.com/1702296870765673412_%E5%85%A8%E9%83%A8%E6%9C%8D%E5%8A%A1.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ID: 11225,
|
||||||
|
type: 1,
|
||||||
|
name: "活动游戏",
|
||||||
|
url: `/pages/game/gamehome/index?uid=${Taro.getStorageSync("token")}`,
|
||||||
|
icon: "//jdt168.com/uploads/merchant/20220829/caad6be8983e88c41d28da7d124bc37b.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ID: 11226,
|
||||||
|
type: 1,
|
||||||
|
name: "商户入驻",
|
||||||
|
url: "/pages/users/settled_mer/index",
|
||||||
|
icon: "//jdt168.com/uploads/merchant/20220829/6fe67b93721a42aedc842c4f19d6f2d3.png",
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// ID: 11227,
|
||||||
|
// type: 1,
|
||||||
|
// name: "最新资讯",
|
||||||
|
// url: "",
|
||||||
|
// icon: "//jdt168.com/uploads/merchant/20220829/b975136a9b64aab69bf11d75a194f1ea.png",
|
||||||
|
// },
|
||||||
|
];
|
||||||
const { data } = await getHomeList();
|
const { data } = await getHomeList();
|
||||||
if (data.data.length > 0) {
|
if (data.data.length > 0) {
|
||||||
// for (let i = 0; i < 31; i++) {
|
for (let i = 0; i < data.data.length; i++) {
|
||||||
// data.data.push({
|
swiperList.value.push({
|
||||||
// ID: i,
|
type: 2,
|
||||||
// icon: "//jdt168.com/uploads/def/20230509/d59e7fcb65a88bc56694dae4f9d21b51.png",
|
...data.data[i],
|
||||||
// name: "活动商品",
|
});
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// 数组分组
|
|
||||||
const arr = [];
|
|
||||||
for (let i = 0; i < data.data.length; i += 10) {
|
|
||||||
arr.push(data.data.slice(i, i + 10));
|
|
||||||
}
|
}
|
||||||
swiperList.value = arr;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const toPage = (url: string) => {
|
const get_banner_list = async () => {
|
||||||
Taro.navigateTo({
|
const { data }: any = await getBanner();
|
||||||
url: url,
|
bannerList.value = data.data;
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const toDetails = (item: SwiperList) => {
|
const toDetails = (item: SwiperList) => {
|
||||||
Taro.navigateTo({
|
item.type !== 1
|
||||||
url: `/pages/search/index?id=${item.ID}&name=${item.name}`,
|
? Taro.navigateTo({
|
||||||
});
|
url: `/pages/search/index?id=${item.ID}&name=${item.name}`,
|
||||||
|
})
|
||||||
|
: Taro.navigateTo({
|
||||||
|
url: item.url as string,
|
||||||
|
});
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.nut-swiper {
|
.swiper {
|
||||||
background: #ffffff;
|
.nut-swiper {
|
||||||
|
background: #ffffff;
|
||||||
|
|
||||||
.nut-swiper-item {
|
.nut-swiper-item {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(5, 1fr);
|
grid-template-columns: repeat(5, 1fr);
|
||||||
|
|
||||||
.item {
|
.item {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
image {
|
image {
|
||||||
width: 100px;
|
width: 100px;
|
||||||
height: 100px;
|
height: 100px;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.banner {
|
||||||
|
padding: 10px;
|
||||||
|
.nut-swiper-item img {
|
||||||
|
border-radius: 26rpx;
|
||||||
|
width: 100%;
|
||||||
|
height: 350px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.titleImg {
|
.titleImg {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -171,6 +180,10 @@ const toDetails = (item: SwiperList) => {
|
|||||||
.navbar {
|
.navbar {
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
|
|
||||||
|
.nut-grid-item__content {
|
||||||
|
padding: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
image {
|
image {
|
||||||
width: 80px;
|
width: 80px;
|
||||||
height: 80px;
|
height: 80px;
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import MerList from "@/components/MerList.vue";
|
|||||||
const classId = ref<null | number>(null);
|
const classId = ref<null | number>(null);
|
||||||
|
|
||||||
Taro.useLoad((e) => {
|
Taro.useLoad((e) => {
|
||||||
console.log(e);
|
|
||||||
Taro.setNavigationBarTitle({
|
Taro.setNavigationBarTitle({
|
||||||
title: e.name,
|
title: e.name,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user