116 lines
2.7 KiB
JavaScript
116 lines
2.7 KiB
JavaScript
// packageA/mycomponent/invitation/invitation.js
|
|
const app = getApp();
|
|
Component({
|
|
/**
|
|
* 组件的属性列表
|
|
*/
|
|
properties: {
|
|
goods_plugin: {
|
|
type: null
|
|
}
|
|
},
|
|
lifetimes: {
|
|
attached() {
|
|
this.setData({
|
|
show: false,
|
|
boxShow: false
|
|
});
|
|
if (this.data.goods_plugin.plugin && this.data.goods_plugin.plugin.micro_communities) {
|
|
this.setData({
|
|
boxShow: true,
|
|
micro_communities: this.data.goods_plugin.plugin.micro_communities,
|
|
min_micr: this.data.goods_plugin.plugin.micro_communities.list.slice(0, 2)
|
|
});
|
|
}
|
|
}
|
|
},
|
|
/**
|
|
* 组件的初始数据
|
|
*/
|
|
data: {
|
|
show: false,
|
|
boxShow: false,
|
|
micro_communities: [],
|
|
min_micr: [],
|
|
page: 1
|
|
},
|
|
|
|
/**
|
|
* 组件的方法列表
|
|
*/
|
|
methods: {
|
|
tapShow() {
|
|
this.setData({
|
|
show: true,
|
|
page:1
|
|
});
|
|
let that = this;
|
|
let urlStr = app.getNetAddresss("plugin.micro-communities.api.goods.index");
|
|
app._getNetWork({
|
|
url: urlStr,
|
|
data: {
|
|
page: this.data.page,
|
|
goods_id: this.data.goods_plugin.get_goods.id,
|
|
},
|
|
success: function (resdata) {
|
|
var res = resdata.data;
|
|
if (res.result == 1) {
|
|
that.setData({
|
|
['micro_communities.list']: res.data.data,
|
|
last_page: res.data.last_page
|
|
});
|
|
}
|
|
},
|
|
fail: function (res) {
|
|
console.log(res);
|
|
},
|
|
});
|
|
},
|
|
getMore() {
|
|
this.setData({
|
|
page: this.data.page + 1
|
|
});
|
|
wx.showLoading({
|
|
title: '加载中',
|
|
});
|
|
let that = this;
|
|
let urlStr = app.getNetAddresss("plugin.micro-communities.api.goods.index");
|
|
app._getNetWork({
|
|
url: urlStr,
|
|
data: {
|
|
page: this.data.page,
|
|
goods_id: this.data.goods_plugin.get_goods.id,
|
|
},
|
|
success: function (resdata) {
|
|
var res = resdata.data;
|
|
if (res.result == 1) {
|
|
that.setData({
|
|
['micro_communities.list']: that.data.micro_communities.list.concat(res.data.data),
|
|
last_page: res.data.last_page
|
|
});
|
|
}
|
|
wx.hideLoading({
|
|
success: (res) => {},
|
|
});
|
|
},
|
|
fail: function (res) {
|
|
console.log(res);
|
|
},
|
|
});
|
|
},
|
|
errorImg(err){
|
|
console.log(err);
|
|
},
|
|
closeShow() {
|
|
this.setData({
|
|
show: false
|
|
});
|
|
},
|
|
goMicro(e) {
|
|
let id = e.currentTarget.dataset.id;
|
|
wx.navigateTo({
|
|
url: '/packageC/micro_communities/microCommentDetails/microCommentDetails?stickId=' + id,
|
|
});
|
|
},
|
|
}
|
|
}); |