Browse Source

全局正式测试tagid切换

master
jiazhipeng 3 weeks ago
parent
commit
64a908730f
  1. 33
      src/main.js
  2. 8
      src/views/Index.vue
  3. 4
      src/views/ProductPage/Index.vue

33
src/main.js

@ -15,6 +15,39 @@ Vue.use(utils)
Vue.config.productionTip = false
Vue.use(ElementUI)
let env = process.env.NODE_ENV;
console.log(env)
Vue.prototype.VUE_APP_GLOBAL_TAGS = {
// 正式数据
pc_all: 675, // pc-分类集合
all_prod: 676, // 全部商品
// mmy: 677, //米面油
// twgh: 678, // 调味干货
// xxls: 679, //休闲零食
// qxrd: 680, // 禽畜肉蛋
// xgsz: 681, //鲜果蔬菜
// zhjs: 682, //组合集市
pc_index_recommend: 683, //PC-首页-今日推荐
pc_index_hot: 684, //pc-首页-热销排行
pc_index_new: 685, // pc-首页-新品上市
}
if (env === 'development') {
Vue.prototype.VUE_APP_GLOBAL_TAGS = {
// 测试数据
pc_all: 662, // pc-分类集合
all_prod: 663, // 全部商品
// mmy: 664, //米面油
// twgh: 665, // 调味干货
// xxls: 666, //休闲零食
// qxrd: 667, // 禽畜肉蛋
// xgsz: 668, //鲜果蔬菜
// zhjs: 669, //组合集市
pc_index_recommend: 670, //PC-首页-今日推荐
pc_index_hot: 671, //pc-首页-热销排行
pc_index_new: 672, // pc-首页-新品上市
}
}
// 配置图片懒加载
Vue.use(VueLazyload, {
preLoad: 1.3, // 预加载高度比例

8
src/views/Index.vue

@ -34,17 +34,17 @@ export default {
tagList: [],
prouctList: [
{
id: 670,
id: this.VUE_APP_GLOBAL_TAGS.pc_index_recommend,
title: "今日推荐",
list: [],
},
{
id: 671,
id: this.VUE_APP_GLOBAL_TAGS.pc_index_hot,
title: "热销排行",
list: [],
},
{
id: 672,
id: this.VUE_APP_GLOBAL_TAGS.pc_index_new,
title: "新品上市",
list: [],
},
@ -122,7 +122,7 @@ export default {
"/api/product/tag_list"
).then((res) => {
this.tagList = res.data;
this.tagList[0].id = 662;
this.tagList[0].id = this.VUE_APP_GLOBAL_TAGS.pc_all;
});
},
//

4
src/views/ProductPage/Index.vue

@ -170,9 +170,9 @@ export default {
"/api/product/tag_list"
).then((res) => {
this.categories = res.data;
this.categories[0].id = 662;
this.categories[0].id = this.VUE_APP_GLOBAL_TAGS.pc_all;
// id
const routeId = this.$route.query.id || 662;
const routeId = this.$route.query.id || this.VUE_APP_GLOBAL_TAGS.pc_all;
if (routeId) {
// id
this.id = routeId;

Loading…
Cancel
Save