Commit 69330632bfcc2aa93f8c2de08b792fdf586df01c
1 parent
98a55296
fix: prod2.sh-24-25
Showing
2 changed files
with
83 additions
and
82 deletions
components/MobileCategoryList.vue
... | ... | @@ -118,86 +118,87 @@ const CATEGORY_IMG = [ |
118 | 118 | ]; |
119 | 119 | |
120 | 120 | watchEffect(async () => { |
121 | - if (route.query.categories) { | |
122 | - // 1. 提取 query.category 的内容 | |
123 | - productStore.updateKeyword(""); | |
124 | - const categories = route.query.categories.split(","); | |
125 | - const mainCategory = categories[0].trim(); // 取第一个值 | |
126 | - const subCategoryName = ref(""); | |
127 | - subCategoryName.value = categories[1] | |
128 | - ? categories[1].trim() | |
129 | - : "Not specified"; // 取第二个值(如果存在) | |
130 | - | |
131 | - // 2. 更新选中的主分类 | |
132 | - categoryStore.updateCategory(mainCategory); | |
133 | - routeQuery.updateCategories(mainCategory + "," + subCategoryName.value); | |
134 | - // 3. 如果有子分类名称,查找其对应的 ID | |
135 | - if (subCategoryName.value) { | |
136 | - // if (subCategoryName.value && mainCategory !== "Energy materials") { | |
137 | - const subCategoryList = computed(() => { | |
138 | - if (categoryStore.selectedCategory) { | |
139 | - const tmp = categoryStore.list.filter( | |
140 | - (item) => | |
141 | - item.categoryDisplayName === categoryStore.selectedCategory | |
142 | - ); | |
143 | - return tmp?.[0]?.list || []; | |
144 | - } | |
145 | - return []; | |
146 | - }); | |
147 | - | |
148 | - // 4. 查找对应的子分类 ID | |
149 | - const foundFuncCategory = subCategoryList.value.find( | |
150 | - (func) => func.name === subCategoryName.value | |
151 | - ); | |
152 | - | |
153 | - if (foundFuncCategory) { | |
154 | - const funcCategoryId = foundFuncCategory.id; | |
155 | - // 你可以在这里使用找到的 funcCategoryId | |
156 | - categoryStore.updateSubCategory(funcCategoryId); | |
157 | - } | |
158 | - } | |
159 | - // 5. 判断 query 中是否存在 function,并查找对应的 ID | |
160 | - if (route.query.function) { | |
161 | - const functionName = route.query.function.trim(); | |
162 | - routeQuery.updateFunction(functionName); | |
163 | - const funcCategoryList = computed(() => { | |
164 | - if (categoryStore.selectedCategory) { | |
165 | - const tmp = categoryStore.list.filter( | |
166 | - (item) => | |
167 | - item.categoryDisplayName === categoryStore.selectedCategory | |
168 | - ); | |
169 | - return tmp?.[0]?.productFunctions || []; | |
170 | - } | |
171 | - return []; | |
172 | - }); | |
173 | - const foundFuncCategory = funcCategoryList.value.find( | |
174 | - (func) => func.name === functionName | |
175 | - ); | |
176 | - | |
177 | - if (foundFuncCategory) { | |
178 | - const funcCategoryId = foundFuncCategory.id; | |
179 | - // 你可以在这里使用找到的 funcCategoryId | |
180 | - categoryStore.updateFuncCategory(funcCategoryId); | |
181 | - } | |
182 | - // // 6. 查找对应的功能分类 ID | |
183 | - // const foundFuncCategory = funcCategories.find( | |
184 | - // (func) => func.name === functionName | |
185 | - // ); | |
186 | - | |
187 | - // if (foundFuncCategory) { | |
188 | - // const funcCategoryId = foundFuncCategory.id; | |
189 | - // // 使用找到的 funcCategoryId | |
190 | - // categoryStore.updateFuncCategory(funcCategoryId); | |
191 | - // } | |
192 | - } else if (route.query.categories.includes("Energy materials")) { | |
193 | - //没有function默认为第一个 | |
194 | - const defaultCategory = categoryStore.list[0]; | |
195 | - const defaultFuncCategory = defaultCategory.productFunctions[1]; | |
196 | - if (defaultFuncCategory) { | |
197 | - categoryStore.updateFuncCategory(defaultFuncCategory.id); | |
198 | - } | |
199 | - } | |
200 | - } else if ( | |
121 | + // if (route.query.categories) { | |
122 | + // // 1. 提取 query.category 的内容 | |
123 | + // productStore.updateKeyword(""); | |
124 | + // const categories = route.query.categories.split(","); | |
125 | + // const mainCategory = categories[0].trim(); // 取第一个值 | |
126 | + // const subCategoryName = ref(""); | |
127 | + // subCategoryName.value = categories[1] | |
128 | + // ? categories[1].trim() | |
129 | + // : "Not specified"; // 取第二个值(如果存在) | |
130 | + // | |
131 | + // // 2. 更新选中的主分类 | |
132 | + // categoryStore.updateCategory(mainCategory); | |
133 | + // routeQuery.updateCategories(mainCategory + "," + subCategoryName.value); | |
134 | + // // 3. 如果有子分类名称,查找其对应的 ID | |
135 | + // if (subCategoryName.value) { | |
136 | + // // if (subCategoryName.value && mainCategory !== "Energy materials") { | |
137 | + // const subCategoryList = computed(() => { | |
138 | + // if (categoryStore.selectedCategory) { | |
139 | + // const tmp = categoryStore.list.filter( | |
140 | + // (item) => | |
141 | + // item.categoryDisplayName === categoryStore.selectedCategory | |
142 | + // ); | |
143 | + // return tmp?.[0]?.list || []; | |
144 | + // } | |
145 | + // return []; | |
146 | + // }); | |
147 | + // | |
148 | + // // 4. 查找对应的子分类 ID | |
149 | + // const foundFuncCategory = subCategoryList.value.find( | |
150 | + // (func) => func.name === subCategoryName.value | |
151 | + // ); | |
152 | + // | |
153 | + // if (foundFuncCategory) { | |
154 | + // const funcCategoryId = foundFuncCategory.id; | |
155 | + // // 你可以在这里使用找到的 funcCategoryId | |
156 | + // categoryStore.updateSubCategory(funcCategoryId); | |
157 | + // } | |
158 | + // } | |
159 | + // // 5. 判断 query 中是否存在 function,并查找对应的 ID | |
160 | + // if (route.query.function) { | |
161 | + // const functionName = route.query.function.trim(); | |
162 | + // routeQuery.updateFunction(functionName); | |
163 | + // const funcCategoryList = computed(() => { | |
164 | + // if (categoryStore.selectedCategory) { | |
165 | + // const tmp = categoryStore.list.filter( | |
166 | + // (item) => | |
167 | + // item.categoryDisplayName === categoryStore.selectedCategory | |
168 | + // ); | |
169 | + // return tmp?.[0]?.productFunctions || []; | |
170 | + // } | |
171 | + // return []; | |
172 | + // }); | |
173 | + // const foundFuncCategory = funcCategoryList.value.find( | |
174 | + // (func) => func.name === functionName | |
175 | + // ); | |
176 | + // | |
177 | + // if (foundFuncCategory) { | |
178 | + // const funcCategoryId = foundFuncCategory.id; | |
179 | + // // 你可以在这里使用找到的 funcCategoryId | |
180 | + // categoryStore.updateFuncCategory(funcCategoryId); | |
181 | + // } | |
182 | + // // // 6. 查找对应的功能分类 ID | |
183 | + // // const foundFuncCategory = funcCategories.find( | |
184 | + // // (func) => func.name === functionName | |
185 | + // // ); | |
186 | + // | |
187 | + // // if (foundFuncCategory) { | |
188 | + // // const funcCategoryId = foundFuncCategory.id; | |
189 | + // // // 使用找到的 funcCategoryId | |
190 | + // // categoryStore.updateFuncCategory(funcCategoryId); | |
191 | + // // } | |
192 | + // } else if (route.query.categories.includes("Energy materials")) { | |
193 | + // //没有function默认为第一个 | |
194 | + // const defaultCategory = categoryStore.list[0]; | |
195 | + // const defaultFuncCategory = defaultCategory.productFunctions[1]; | |
196 | + // if (defaultFuncCategory) { | |
197 | + // categoryStore.updateFuncCategory(defaultFuncCategory.id); | |
198 | + // } | |
199 | + // } | |
200 | + // } else | |
201 | + if ( | |
201 | 202 | Object.keys(route.query).length === 0 && |
202 | 203 | !route.path.includes("/products/detail") |
203 | 204 | ) { | ... | ... |
deploy/prod2.sh