|
@@ -19,19 +19,20 @@
|
|
|
@touchend="touchEndEvent($event, item.otherUserId)"
|
|
@touchend="touchEndEvent($event, item.otherUserId)"
|
|
|
:x="moveInfo[item.otherUserId]"
|
|
:x="moveInfo[item.otherUserId]"
|
|
|
class="move-view"
|
|
class="move-view"
|
|
|
- out-of-bounds
|
|
|
|
|
inertia
|
|
inertia
|
|
|
>
|
|
>
|
|
|
<member :info="item"></member>
|
|
<member :info="item"></member>
|
|
|
- <div class="del">删除</div>
|
|
|
|
|
|
|
+ <div class="del" @click="del(item.otherUserId)">删除</div>
|
|
|
</movable-view>
|
|
</movable-view>
|
|
|
</movable-area>
|
|
</movable-area>
|
|
|
</block>
|
|
</block>
|
|
|
|
|
+ <van-dialog id="van-dialog" />
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
<script>
|
|
<script>
|
|
|
import Member from '../components/Member.vue';
|
|
import Member from '../components/Member.vue';
|
|
|
import { mapState } from 'vuex';
|
|
import { mapState } from 'vuex';
|
|
|
|
|
+import Dialog from '../native/vant/dialog/dialog';
|
|
|
export default {
|
|
export default {
|
|
|
components: { Member },
|
|
components: { Member },
|
|
|
data() {
|
|
data() {
|
|
@@ -90,10 +91,14 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
- setMove() {
|
|
|
|
|
|
|
+ setMove(extraId) {
|
|
|
const info = {};
|
|
const info = {};
|
|
|
[...this.showList].forEach(item => {
|
|
[...this.showList].forEach(item => {
|
|
|
- info[item.otherUserId] = 60;
|
|
|
|
|
|
|
+ if (extraId !== item.otherUserId) {
|
|
|
|
|
+ info[item.otherUserId] = 60;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ info[extraId] = this.moveInfo[extraId];
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
this.moveInfo = {
|
|
this.moveInfo = {
|
|
|
...info
|
|
...info
|
|
@@ -103,7 +108,6 @@ export default {
|
|
|
this.$store.dispatch('getUnreadNumber');
|
|
this.$store.dispatch('getUnreadNumber');
|
|
|
},
|
|
},
|
|
|
touchStartEvent(e, id) {
|
|
touchStartEvent(e, id) {
|
|
|
- this.setMove();
|
|
|
|
|
this.touchMap.set(id, {
|
|
this.touchMap.set(id, {
|
|
|
startX: e.changedTouches[0].clientX
|
|
startX: e.changedTouches[0].clientX
|
|
|
});
|
|
});
|
|
@@ -111,9 +115,11 @@ export default {
|
|
|
touchEndEvent(e, id) {
|
|
touchEndEvent(e, id) {
|
|
|
if (this.touchMap.has(id)) {
|
|
if (this.touchMap.has(id)) {
|
|
|
const touchInfo = this.touchMap.get(id);
|
|
const touchInfo = this.touchMap.get(id);
|
|
|
- this.moveX = e.changedTouches[0].clientX < touchInfo.startX ? 0 : 60;
|
|
|
|
|
-
|
|
|
|
|
- this.moveInfo[id] = e.changedTouches[0].clientX < touchInfo.startX ? 0 : 60;
|
|
|
|
|
|
|
+ if (touchInfo.source) {
|
|
|
|
|
+ this.setMove(id);
|
|
|
|
|
+ this.moveX = e.changedTouches[0].clientX < touchInfo.startX ? 0 : 60;
|
|
|
|
|
+ this.moveInfo[id] = e.changedTouches[0].clientX < touchInfo.startX ? 0 : 60;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
touchMoveEvent(e, id) {
|
|
touchMoveEvent(e, id) {
|
|
@@ -121,6 +127,29 @@ export default {
|
|
|
...this.touchMap.get(id),
|
|
...this.touchMap.get(id),
|
|
|
...e.detail
|
|
...e.detail
|
|
|
});
|
|
});
|
|
|
|
|
+ },
|
|
|
|
|
+ del(id) {
|
|
|
|
|
+ Dialog.confirm({
|
|
|
|
|
+ title: this.$t('ti-shi'),
|
|
|
|
|
+ message: '确定要删除该咨询消息吗?',
|
|
|
|
|
+ confirmButtonColor: this.$colors.warn,
|
|
|
|
|
+ confirmButtonText: '删除'
|
|
|
|
|
+ })
|
|
|
|
|
+ .then(() => {
|
|
|
|
|
+ return this.$http.post('/message/delBox?otherUserId=' + id);
|
|
|
|
|
+ })
|
|
|
|
|
+ .then(() => {
|
|
|
|
|
+ this.toast('删除成功!', 'success');
|
|
|
|
|
+ this.loginMethods();
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch(e => {
|
|
|
|
|
+ // on cancel
|
|
|
|
|
+ if (e.error) {
|
|
|
|
|
+ this.toast(e.error);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.moveInfo[id] = 60;
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
onShareAppMessage(from, target) {
|
|
onShareAppMessage(from, target) {
|