@@ -57,6 +57,7 @@ import petItem from "@/components/pet/item";
5757import luckyItem from " @/components/pet/lucky" ;
5858import { clone , debounce } from " lodash" ;
5959import { isPhone } from " @/utils/index" ;
60+ import Type from " @/assets/data/pet_type.json" ;
6061import { getPets , getPetSearchOptions , getPetLucky , getSliders , getMapList } from " @/service/pet" ;
6162import dayjs from " @/plugins/day" ;
6263
@@ -72,7 +73,7 @@ export default {
7273 return {
7374 tabsData: {}, // 标签筛选数据
7475 active: " " , // 当前激活的分类ID
75- Type: [], // 宠物类型配置
76+ Type, // 宠物类型配置
7677 Source: [], // 宠物来源配置
7778 list: [], // 单分类宠物列表
7879 page: 1 , // 当前页码
@@ -88,7 +89,12 @@ export default {
8889 count: 0 , // 每行卡片数
8990 searchReady: false , // 筛选项是否已加载
9091 // 分类宠物列表(首页按分类展示)
91- list_type: [],
92+ list_type: [
93+ { class: 1 , type: 1 , name: " 水族" , list: [] },
94+ { class: 2 , type: 2 , name: " 禽鸟" , list: [] },
95+ { class: 3 , type: 3 , name: " 走兽" , list: [] },
96+ { class: 4 , type: 4 , name: " 机关" , list: [] },
97+ ],
9298 };
9399 },
94100 computed: {
@@ -152,32 +158,20 @@ export default {
152158 methods: {
153159 /**
154160 * 获取宠物筛选项
155- * 种类对应宠物 Class 字段, 来源对应宠物 Source 字段
161+ * 来源对应宠物 Source 字段;种类仍遵循本地 Class 配置
156162 */
157163 getPetSearchOptions () {
158164 return getPetSearchOptions ()
159165 .then ((res ) => {
160166 const data = Array .isArray (res .data ) ? res .data : [];
161- const typeOptions = data
162- .filter ((item ) => item .Type === 1 && item .TypeName )
163- .map ((item ) => ({
164- class: item .ID ,
165- type: item .ID ,
166- name: item .TypeName ,
167- }));
168167 const sourceOptions = data
169168 .filter ((item ) => item .Type === 2 && item .TypeName )
170169 .map ((item ) => ({
171170 source: item .ID ,
172171 name: item .TypeName ,
173172 }));
174173
175- this .Type = [{ class: " " , type: 0 , name: " 所有种类" }, ... typeOptions];
176174 this .Source = [{ source: " " , name: " 所有途径" }, ... sourceOptions];
177- this .list_type = typeOptions .map ((item ) => ({
178- ... item,
179- list: [],
180- }));
181175 })
182176 .catch ((err ) => {
183177 console .error (" 获取宠物筛选项失败" , err);
0 commit comments