Blame view
src/store/modules/index.js
14.2 KB
c300654f9 首页部分功能 |
1 2 3 4 |
import urlAlias from '../url'; import request from '../request'; const { |
83e446d4d 修正订单数据 |
5 6 7 |
category, shopList, search, |
c300654f9 首页部分功能 |
8 |
} = urlAlias; |
53bcba4f8 文件分包,首页添加骨架屏幕 |
9 10 11 12 13 14 15 16 |
let initData = {"name":"志平防蓝光-防辐射电脑网课眼镜","id":"9","imgurl":"", "price":0,"trade_num":"102","rsSon":{"pic":"9_FDB33D.jpg","model_pic":null,"in_price":"6000","sku_value":"80_83", "discount":"45","kc":"0","sku_name":"1.56非球面防蓝光_黑透+蓝纹","Max_Price":158,"Min_Price":99}} var initArr = [1,2,3,4,5,6,7,8] let list = [] initArr.forEach(function (value) { list.push(initData) }); |
e40e790a3 首页bug修改 |
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 |
let categoryList = [ { "type": "checkbox", "name": "产品", "value": "category", "submenu": [ { "label": "镜框", "name": "镜框", "value": "1" }, { "label": "镜片", "name": "镜片", "value": "2" }, { "label": "特种镜", "name": "特种镜", "value": "146" } ], "groups": [ "001" ] }, { "type": "radio", "name": "规则", "value": "px", "submenu": [ { "name": "按价格排", "value": "1" }, { "name": "按销量排", "value": "2" } ], "groups": [ "002" ] }, { "type": "radio", "name": "排序", "value": "sort", "submenu": [ { "name": "从高到低", "value": "1" }, { "name": "从低到高", "value": "2" } ], "groups": [ "003" ] }, { "type": "filter", "name": "筛选", "value": "filter", "submenu": [ { "type": "checkbox", "name": "性别", "value": "sex", "submenu": [ { "label": "男性", "name": "男性", "value": "27" }, { "label": "女性", "name": "女性", "value": "28" } ] }, { "type": "checkbox", "name": "年龄", "value": "age", "submenu": [ { "label": "通用", "name": "通用", "value": "24" } ] }, { "type": "checkbox", "name": "适用场景", "value": "sense", "submenu": [ { "label": "行政风", "name": "行政风", "value": "53" }, { "label": "青春学子风", "name": "青春学子风", "value": "54" }, { "label": "运动风", "name": "运动风", "value": "55" }, { "label": "简约-极简文艺范", "name": "简约-极简文艺范", "value": "56" }, { "label": "奶奶风", "name": "奶奶风", "value": "57" }, { "label": "流线洛可可", "name": "流线洛可可", "value": "58" }, { "label": "自然舒视角", "name": "自然舒视角", "value": "59" }, { "label": "无界人文系", "name": "无界人文系", "value": "60" }, { "label": "有机未来时", "name": "有机未来时", "value": "61" }, { "label": "立体巴洛克", "name": "立体巴洛克", "value": "62" }, { "label": "多元新风尚", "name": "多元新风尚", "value": "63" }, { "label": "理性几何派", "name": "理性几何派", "value": "64" }, { "label": "轻简北欧风", "name": "轻简北欧风", "value": "65" }, { "label": "质感哥特潮", "name": "质感哥特潮", "value": "66" }, { "label": "时尚", "name": "时尚", "value": "67" }, { "label": "复古", "name": "复古", "value": "68" }, { "label": "商务", "name": "商务", "value": "69" }, { "label": "休闲", "name": "休闲", "value": "70" }, { "label": "折射率", "name": "折射率", "value": "285" } ] }, { "type": "checkbox", "name": "价格", "value": "price", "submenu": [ { "name": "100以下", "value": "1,100" }, { "name": "100-300", "value": "100,300" }, { "name": "300-1000", "value": "300,1000" }, { "name": "1000以上", "value": "1000,-1" } ] }, { "type": "checkbox", "name": "材质", "value": "glasscate", "submenu": [ { "label": "购易", "name": "购易", "value": "72" }, { "label": "海俪恩", "name": "海俪恩", "value": "73" }, { "label": "沙漠风暴", "name": "沙漠风暴", "value": "74" }, { "label": "古诗", "name": "古诗", "value": "75" }, { "label": "暴龙", "name": "暴龙", "value": "76" }, { "label": "犀牛", "name": "犀牛", "value": "77" }, { "label": "Ray-Ban雷朋", "name": "Ray-Ban雷朋", "value": "78" }, { "label": "PARIM派丽蒙", "name": "PARIM派丽蒙", "value": "79" }, { "label": "石狼", "name": "石狼", "value": "80" }, { "label": "木九十", "name": "木九十", "value": "81" } ] }, { "type": "checkbox", "name": "品牌", "value": "brand", "submenu": [ { "label": "购易", "name": "购易", "value": "72" }, { "label": "海俪恩", "name": "海俪恩", "value": "73" }, { "label": "沙漠风暴", "name": "沙漠风暴", "value": "74" }, { "label": "古诗", "name": "古诗", "value": "75" }, { "label": "暴龙", "name": "暴龙", "value": "76" }, { "label": "犀牛", "name": "犀牛", "value": "77" }, { "label": "Ray-Ban雷朋", "name": "Ray-Ban雷朋", "value": "78" }, { "label": "PARIM派丽蒙", "name": "PARIM派丽蒙", "value": "79" }, { "label": "石狼", "name": "石狼", "value": "80" }, { "label": "木九十", "name": "木九十", "value": "81" } ] } ], "groups": [ "001", "002", "003" ], } ] |
53bcba4f8 文件分包,首页添加骨架屏幕 |
360 |
//初始化数据是为了显示默认骨架 |
83e446d4d 修正订单数据 |
361 362 |
const state = { categoryList: [], |
53bcba4f8 文件分包,首页添加骨架屏幕 |
363 |
list: list |
83e446d4d 修正订单数据 |
364 |
}; |
53bcba4f8 文件分包,首页添加骨架屏幕 |
365 |
|
83e446d4d 修正订单数据 |
366 367 368 369 370 371 372 373 |
const mutations = { LIST: (state, list) => { state.list = list; }, CATEGORY: (state, categoryList) => { state.categoryList = categoryList; } }; |
c300654f9 首页部分功能 |
374 |
|
83e446d4d 修正订单数据 |
375 376 377 378 |
const actions = { category({ commit }, param) { |
53bcba4f8 文件分包,首页添加骨架屏幕 |
379 |
return new Promise((resolve) => request({ |
83e446d4d 修正订单数据 |
380 381 |
url: category, success: (res) => { |
78c1e1372 auto commit the c... |
382 383 |
//分类的镜架 let data = res.data.data.list; |
83e446d4d 修正订单数据 |
384 385 386 387 388 389 390 391 392 393 |
for (let i = 0; i <= data.length; i++) { if (data[i] && data[i].type !== 'filter') { data[i].type = 'hierarchy'; } } data.unshift({ type: "hierarchy", name: "全部", value: "all", isNoPull: true, |
83e446d4d 修正订单数据 |
394 395 |
}); commit('CATEGORY', data); |
53bcba4f8 文件分包,首页添加骨架屏幕 |
396 |
resolve(data) |
83e446d4d 修正订单数据 |
397 398 399 |
}, fail: (res) => { console.log("fail status === > ", res); |
53bcba4f8 文件分包,首页添加骨架屏幕 |
400 401 402 |
} })) |
83e446d4d 修正订单数据 |
403 404 405 406 |
}, list({ commit }, param) { |
53bcba4f8 文件分包,首页添加骨架屏幕 |
407 |
return new Promise((resolve) => request({ |
83e446d4d 修正订单数据 |
408 409 |
url: shopList, success: (res) => { |
78c1e1372 auto commit the c... |
410 411 |
console.log('shopListshopListshopListshopListshopListshopListshopListshopListshopListshopListshopListshopList',res.data.data.list); commit('LIST', res.data.data.list) |
e40e790a3 首页bug修改 |
412 |
resolve(res.data) |
83e446d4d 修正订单数据 |
413 414 415 416 417 |
}, fail: (res) => { console.log("fail status === > ", res); }, complete: (res) => { |
83e446d4d 修正订单数据 |
418 419 |
state.isLoading = false; }, |
53bcba4f8 文件分包,首页添加骨架屏幕 |
420 |
})) |
83e446d4d 修正订单数据 |
421 422 423 424 425 426 427 |
}, search({ commit }, { params, keyword }) { |
53bcba4f8 文件分包,首页添加骨架屏幕 |
428 429 |
const uid = uni.getStorageSync('uid'); return new Promise((resolve) => request({ |
83e446d4d 修正订单数据 |
430 431 432 433 434 435 436 437 438 |
url: search, data: { params: JSON.stringify(params), uid, way: 1, keyword, }, success: (res) => { commit('LIST', res.data.data); |
53bcba4f8 文件分包,首页添加骨架屏幕 |
439 |
resolve(res.data) |
83e446d4d 修正订单数据 |
440 441 442 |
}, fail: (res) => { console.log("fail status === > ", res); |
53bcba4f8 文件分包,首页添加骨架屏幕 |
443 444 445 |
} })) |
83e446d4d 修正订单数据 |
446 447 448 449 450 451 452 453 454 |
}, }; export default { namespaced: true, state, mutations, actions, }; |