|
@@ -127,7 +127,16 @@
|
|
|
onShow() {
|
|
|
// #ifdef H5
|
|
|
this.getGoods()
|
|
|
- this.getNewList()
|
|
|
+ this.getMsgList(2, () => {
|
|
|
+ this.getNewList()
|
|
|
+ this.$nextTick(() => {
|
|
|
+ uni.createSelectorQuery().select('.message_view_scroll').boundingClientRect(data => {
|
|
|
+ uni.createSelectorQuery().select('.scrollviewDiv').boundingClientRect(data2 => {
|
|
|
+ this.scrollTop = data2.height - data.height
|
|
|
+ }).exec()
|
|
|
+ }).exec()
|
|
|
+ })
|
|
|
+ })
|
|
|
// #endif
|
|
|
},
|
|
|
onHide() {
|
|
@@ -137,6 +146,13 @@
|
|
|
}
|
|
|
// #endif
|
|
|
},
|
|
|
+ destroyed() {
|
|
|
+ // #ifdef H5
|
|
|
+ if (this.timeId) {
|
|
|
+ clearTimeout(this.timeId)
|
|
|
+ }
|
|
|
+ // #endif
|
|
|
+ },
|
|
|
methods: {
|
|
|
// #ifdef H5
|
|
|
getGoods() {
|
|
@@ -145,25 +161,28 @@
|
|
|
}
|
|
|
api.postJson('/goods/detail', {
|
|
|
id: this.pam.goodsId,
|
|
|
- }).then(res => {
|
|
|
+ }, false).then(res => {
|
|
|
this.goodsDetail = res.data
|
|
|
- console.log(res)
|
|
|
})
|
|
|
},
|
|
|
getNewList() {
|
|
|
if (this.timeId) {
|
|
|
clearTimeout(this.timeId)
|
|
|
}
|
|
|
- this.getMsgList(0, () => {
|
|
|
- this.timeId = setTimeout(this.getNewList, 3000)
|
|
|
- uni.createSelectorQuery().select('.message_view_scroll').boundingClientRect(data => {
|
|
|
- uni.createSelectorQuery().select('.scrollviewDiv').boundingClientRect(data2 => {
|
|
|
- if ((this.scrollTop + data.height + 10) >= data2.height) {
|
|
|
- this.scrollTop = data2.height
|
|
|
- }
|
|
|
- }).exec()
|
|
|
- }).exec()
|
|
|
- })
|
|
|
+ uni.createSelectorQuery().select('.scrollviewDiv').boundingClientRect(data1 => {
|
|
|
+ this.getMsgList(0, () => {
|
|
|
+ this.timeId = setTimeout(this.getNewList, 3000)
|
|
|
+ this.$nextTick(() => {
|
|
|
+ uni.createSelectorQuery().select('.message_view_scroll').boundingClientRect(data => {
|
|
|
+ uni.createSelectorQuery().select('.scrollviewDiv').boundingClientRect(data2 => {
|
|
|
+ if (data1.height - data.height - this.scrollTop < 10) {
|
|
|
+ this.scrollTop = data2.height - data.height
|
|
|
+ }
|
|
|
+ }).exec()
|
|
|
+ }).exec()
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }).exec()
|
|
|
},
|
|
|
getMsgList(flag, cb) {
|
|
|
api.postJson('/user/talk/list', {
|