123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- // components/listItem/listItem.js
- const app = getApp();
- const $request = require('../../utils/request.js');
- Component({
- /**
- * 组件的属性列表
- */
- properties: {
- // 数据
- item: {
- type: Object,
- },
- // index => 首页 detatil => 详情 homepage => 个人主页
- pageStatus: {
- type: String,
- value: 'index',
- },
- // 是否收藏
- isCollect: {
- type: Boolean,
- value: false,
- },
- // 是否显示收藏
- isShowCollect: {
- type: Boolean,
- value: false,
- },
- // 是否其他查看主页---用于是否显示聊一聊
- isOther: {
- type: Boolean,
- value: true,
- },
- // 类名
- listClass: {
- type: String,
- value: "",
- },
- customerId: {
- type: Number,
- value: null,
- },
- },
- /**
- * 组件的初始数据
- */
- data: {
- },
-
- /**
- * 组件的方法列表
- */
- methods: {
- getCustomerId() {
- return 123
- },
- // 进入详情
- goDetails(e) {
- if (this.data.listClass == 'disabled-model-view') {
- return
- }
- let value = e.currentTarget.dataset.value;
- this.triggerEvent('getItem', value);
- },
- // 进入个人主页
- goHomePage(e) {
- let customerid = e.currentTarget.dataset.customerid;
- wx.navigateTo({
- url: '/pages/index/components/homepage/homepage',
- success: function (res) {
- // 通过eventChannel向被打开页面传送数据
- res.eventChannel.emit('customerid', { customerid })
- }
- })
- },
- // 收藏
- productCollect(e) {
- this.triggerEvent('changeCollect');
- },
- // 聊一聊
- goToChat(e) {
- if (!app.globalData.customerId) {
- app.goLogin();
- return
- }
- let item = e.currentTarget.dataset.item;
- // console.log(e,'e')
- if(item.state != 0){
- return
- }
- let businessCommunicationDemandId = item.businessCommunicationDemandId;
- $request.post('/statisticsBusinessCommunicationDemand/saveDemandCollect.action',
- { businessCommunicationDemandId }
- ).then(res => { }).catch(err => { console.log(err) })
- $request.post('/statisticsBusinessCommunicationDemand/demandPageView.action',
- { businessCommunicationDemandId, customerId: app.globalData.customerId }
- ).then(res => { }).catch(err => { console.log(err) })
- wx.navigateTo({
- url: "/pages/msgModule/wechat2/wechat2",
- success: function (res) {
- // 通过eventChannel向被打开页面传送数据
- res.eventChannel.emit('customerid', {
- customerid: item.customerId,
- businessCommunicationDemandId,
- chatHeads: item.chatHeads,
- info: item.info
- })
- }
- })
- },
- }
- })
|