diff --git a/pages/index/category.vue b/pages/index/category.vue
index 36999cbc..2317d1d9 100644
--- a/pages/index/category.vue
+++ b/pages/index/category.vue
@@ -1,231 +1,236 @@
-
+
-
-
-
+
+
+
-
+
-
-
-
-
-
-
-
+
+
+
+
+
-
-
-
-
+ }"
+ @tap="loadMore"
+ />
+
+
+
+
\ No newline at end of file
+ .banner-img {
+ width: calc(100vw - 130px);
+ border-radius: 5px;
+ margin-bottom: 20rpx;
+ }
+ }
+ }
+
diff --git a/pages/index/components/first-one.vue b/pages/index/components/first-one.vue
index 792fcd92..2decc86f 100644
--- a/pages/index/components/first-one.vue
+++ b/pages/index/components/first-one.vue
@@ -1,23 +1,20 @@
+
-
+
+ />
diff --git a/pages/index/components/first-two.vue b/pages/index/components/first-two.vue
index f1479974..482931cc 100644
--- a/pages/index/components/first-two.vue
+++ b/pages/index/components/first-two.vue
@@ -1,15 +1,15 @@
-
+
-
+
-
+
{{ item.title }}
- ¥{{ item.price[0] }}
+ ¥{{ fen2yuan(item.price) }}
@@ -19,12 +19,9 @@
diff --git a/pages/index/components/second-one.vue b/pages/index/components/second-one.vue
index 817c144a..86b70782 100644
--- a/pages/index/components/second-one.vue
+++ b/pages/index/components/second-one.vue
@@ -4,14 +4,14 @@
- {{ props.data.children[activeMenu].name }}
+ {{ props.data[activeMenu].name }}
({}),
},
- activeMenu: [Number, String]
+ activeMenu: [Number, String],
});
diff --git a/sheep/api/product/category.js b/sheep/api/product/category.js
new file mode 100644
index 00000000..6549acf5
--- /dev/null
+++ b/sheep/api/product/category.js
@@ -0,0 +1,12 @@
+import request from '@/sheep/request';
+
+const CategoryApi = {
+ // 查询分类列表
+ getCategoryList: () => {
+ return request({
+ url: '/app-api/product/category/list',
+ method: 'GET'
+ });
+ }
+};
+export default CategoryApi;
diff --git a/sheep/util/index.js b/sheep/util/index.js
index 355d53af..2a3ca202 100644
--- a/sheep/util/index.js
+++ b/sheep/util/index.js
@@ -53,8 +53,6 @@ export const convertToInteger = (num) => {
return Math.round(parsedNumber * 100)
}
-
-
/**
* 时间日期转换
* @param {dayjs.ConfigType} date 当前时间,new Date() 格式
@@ -77,3 +75,28 @@ export function formatDate(date, format) {
}
return dayjs(date).format(format)
}
+
+/**
+ * 构造树型结构数据
+ *
+ * @param {*} data 数据源
+ * @param {*} id id字段 默认 'id'
+ * @param {*} parentId 父节点字段 默认 'parentId'
+ * @param {*} children 孩子节点字段 默认 'children'
+ * @param {*} rootId 根Id 默认 0
+ */
+export function handleTree(data, id = 'id', parentId = 'parentId', children = 'children', rootId = 0) {
+ // 对源数据深度克隆
+ const cloneData = JSON.parse(JSON.stringify(data))
+ // 循环所有项
+ const treeData = cloneData.filter(father => {
+ let branchArr = cloneData.filter(child => {
+ //返回每一项的子级数组
+ return father[id] === child[parentId]
+ });
+ branchArr.length > 0 ? father.children = branchArr : '';
+ //返回第一层
+ return father[parentId] === rootId;
+ });
+ return treeData !== '' ? treeData : data;
+}
\ No newline at end of file