|
@@ -40,10 +40,21 @@ Component({
|
|
|
type: Array,
|
|
|
value: [],
|
|
|
observer: function observer() {
|
|
|
- if (!this.data.isSwiper) return;
|
|
|
- var newVal = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
|
-
|
|
|
- this._videoListChanged(newVal);
|
|
|
+ console.log('数据更新111111', arguments)
|
|
|
+ let newValue = arguments[0];
|
|
|
+ let oldValue = arguments[1];
|
|
|
+ if (newValue && oldValue && (this.data.activeIndex || this.data.activeIndex === 0)) {
|
|
|
+ let newVideoShow = newValue[this.data.activeIndex].videoShow;
|
|
|
+ let oldVideoShow = oldValue[this.data.activeIndex].videoShow;
|
|
|
+ if (newVideoShow !== oldVideoShow && oldVideoShow) {
|
|
|
+ console.log('把值设置为true')
|
|
|
+ newValue[this.data.activeIndex].videoShow = true;
|
|
|
+ this.setData({
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let newVal = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
|
+ this.updateSonList(newVal);
|
|
|
}
|
|
|
},
|
|
|
nextMargin: {
|
|
@@ -53,6 +64,8 @@ Component({
|
|
|
}
|
|
|
},
|
|
|
data: {
|
|
|
+ sonVideoList: [], // 子组件里的视频组件
|
|
|
+ activeType: '',
|
|
|
nextQueue: [],
|
|
|
prevQueue: [],
|
|
|
curQueue: [],
|
|
@@ -73,6 +86,13 @@ Component({
|
|
|
this.data._videoContexts = [wx.createVideoContext('video_0', this), wx.createVideoContext('video_1', this), wx.createVideoContext('video_2', this)];
|
|
|
}
|
|
|
},
|
|
|
+ /* observers: {
|
|
|
+ '**': function() {
|
|
|
+ // 每次 setData 都触发
|
|
|
+ console.log('数据更新333333',this.data)
|
|
|
+
|
|
|
+ },
|
|
|
+ }, */
|
|
|
methods: {
|
|
|
_videoListChanged: function _videoListChanged(newVal) {
|
|
|
var _this = this;
|
|
@@ -91,6 +111,12 @@ Component({
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
+ updateSonList: function updateSonList(newVal) {
|
|
|
+ this.setData({
|
|
|
+ sonVideoList: newVal,
|
|
|
+ activeIndex: ''
|
|
|
+ })
|
|
|
+ },
|
|
|
animationfinish: function animationfinish(e) {
|
|
|
var _data = this.data,
|
|
|
_last = _data._last,
|
|
@@ -223,15 +249,19 @@ Component({
|
|
|
},
|
|
|
openComment: function openComment(e) {
|
|
|
console.log(e)
|
|
|
+ let index = e.currentTarget.dataset.index;
|
|
|
+ this.setData({
|
|
|
+ activeIndex:index
|
|
|
+ })
|
|
|
this.trigger(e, 'openComment')
|
|
|
},
|
|
|
// 展示视频
|
|
|
showVideo: function showVideo(e) {
|
|
|
let index = e.target.dataset.index ? e.target.dataset.index : e.currentTarget.dataset.index;
|
|
|
console.log('showVideo')
|
|
|
- const str = `videoList[${index}].videoShow`;
|
|
|
+ const str = `sonVideoList[${index}].videoShow`;
|
|
|
if (this.data.lastIndex || this.data.lastIndex === 0) {
|
|
|
- const lastStr = `videoList[${this.data.lastIndex}].videoShow`;
|
|
|
+ const lastStr = `sonVideoList[${this.data.lastIndex}].videoShow`;
|
|
|
this.setData({
|
|
|
lastIndex: index,
|
|
|
[lastStr]: false,
|
|
@@ -285,6 +315,9 @@ Component({
|
|
|
favoritesType: e.target.dataset.type ? e.target.dataset.type : e.currentTarget.dataset.type
|
|
|
}
|
|
|
const index = e.target.dataset.index ? e.target.dataset.index : e.currentTarget.dataset.index;
|
|
|
+ this.setData({
|
|
|
+ activeIndex:index
|
|
|
+ })
|
|
|
console.log('视频index', index);
|
|
|
if (this.data.curQueue.length <= 0) {
|
|
|
let str = `videoList[${index}].isFavorite`
|
|
@@ -335,7 +368,9 @@ Component({
|
|
|
const id = e.target.dataset.id ? e.target.dataset.id : e.currentTarget.dataset.id;
|
|
|
const index = e.target.dataset.index ? e.target.dataset.index : e.currentTarget.dataset.index;
|
|
|
this.setData({
|
|
|
- addComeOut: index
|
|
|
+ addComeOut: index,
|
|
|
+ activeIndex: index,
|
|
|
+ activeType: 'like'
|
|
|
})
|
|
|
setTimeout(() => {
|
|
|
if (this.data.addComeOut) {
|
|
@@ -373,10 +408,10 @@ Component({
|
|
|
},
|
|
|
addShareAmount: function (e) {
|
|
|
console.log('+++++1', e.detail.index);
|
|
|
-
|
|
|
+
|
|
|
this.triggerEvent('addShareAmount', {
|
|
|
- index:e.detail.index
|
|
|
- })
|
|
|
+ index: e.detail.index
|
|
|
+ })
|
|
|
},
|
|
|
// 下载视频
|
|
|
download: function (e) {
|
|
@@ -516,7 +551,7 @@ Component({
|
|
|
var activeIndex = e.target.dataset.index ? e.target.dataset.index : e.currentTarget.dataset.index;
|
|
|
this.triggerEvent(type, {
|
|
|
activeId: activeId,
|
|
|
- activeIndex:activeIndex
|
|
|
+ activeIndex: activeIndex
|
|
|
}, {
|
|
|
bubbles: false
|
|
|
});
|