You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

124 lines
2.5 KiB

// pages/component/TitleHeader.js
import commonApi from "../../../utils/https/common.js"
import util from '../../../utils/util'
var app = getApp()
Component({
options: {
styleIsolation: 'apply-shared',
addGlobalClass: true
},
/**
* 组件的属性列表
*/
properties: {
title: {
type: String,
value: ""
},
transparent: {
type: String,
value: "0"
},
clickid: {
type: String,
value: ""
},
ids:{
type: String,
value: ""
}
},
observers:{
'ids': function(newVal,oldVal){
console.log('newVal--------',newVal)
console.log('oldVal--------',oldVal)
if (newVal) {
this.getTj(newVal)
}
}
},
lifetimes: {
created() {
this.data.tjList=[]
// commonApi._post("product/get_product_by_type", {
// offset: 0,
// limit: 6,
// rand: true,
// type: "venue,post,line,ticket",
// product_ids:this.data.ids
// }).then(res => {
// this.setData({
// showLoading: false
// })
// try {
// this.setData({
// tjList: res.data.list
// })
// } catch (error) {
// console.log(error);
// }
// })
}
},
/**
* 组件的初始数据
*/
data: {
tjList: [],
},
/**
* 组件的方法列表
*/
methods: {
getTj() {
this.data.tjList = []
commonApi._post("search/product_recommend", {
offset: 0,
limit: 6,
rand: true,
type: "venue,post,line,ticket",
product_ids:this.data.ids
}).then(res => {
this.setData({
showLoading: false
})
try {
this.setData({
tjList: res.data.list
})
} catch (error) {
console.log(error);
}
console.log('tjList',this.data.tjList);
})
},
gotoDetail: function (e) {
let item = e.currentTarget.dataset.item;
util.pagePoint({
event: 'recommend_click',
param: {
id: item.id,
type: item.type
}
}, 1)
// if (item.goods_jump_type == "changshu" || item.goods_jump_type == "yjks") {
// util.goProdInOtherPlatform(item)
// return
// }
if (item.type == 'travels') {
// 游记做特殊处理 其他都按照原来的来
wx.navigateTo({
url: '/pages/info/strategyInfo/index?id=' + item.s_id,
})
} else {
util.gotoDetail(item);
}
},
},
})