添加:消息相关接口对接

This commit is contained in:
wuhui_zzw 2023-03-04 16:35:32 +08:00
parent 992bb55fa6
commit 644dc2012d
2 changed files with 63 additions and 43 deletions

View File

@ -23,29 +23,34 @@
<!--消息列表-->
<mescroll-uni ref="mescroll" @getData="getList" top="320">
<block slot="list">
<view class="message-list">
<view class="message-list" v-if="Object.keys(list).length > 0">
<view class="message-block" v-for="(item,index) in list" :key="index">
<view class="message-block-top">
<view class="message-block-top-image">
<image class="top-image" :src="$util.img('public/static/img/message/business.png')" mode="widthFix"></image>
<text class="top-drop"></text>
<image class="top-image" :src="$util.img(titles[item.type].icon)" mode="widthFix"></image>
<text class="top-drop" v-if="parseInt(item.is_see) === 0"></text>
</view>
<view class="message-block-top-title">交易信息</view>
<view class="message-block-top-title">{{ titles[item.type].title }}</view>
</view>
<view class="message-block-message">
消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容
</view>
<view class="message-block-bottom">
<view class="message-block-message">{{ item.message_content }}</view>
<view class="message-block-bottom" @click="seeDetails(item,index)">
<view class="message-block-bottom-left">查看详情</view>
<view class="message-block-bottom-right">
2023-02-27 10:45<i class="icondiy icon-system-arrow-right-s-line"></i>
{{ $util.timeStampTurnTime(item.created_time) }}<i class="icondiy icon-system-arrow-right-s-line"></i>
</view>
</view>
</view>
</view>
<view v-else>
<ns-empty :isIndex="false" text="暂无消息通知"></ns-empty>
</view>
</block>
</mescroll-uni>
</view>
<!-- 消息详情 -->
<uni-popup ref="messageContent" type="dialog" class="order-remarks-content">
<uni-popup-dialog mode="base" :content="message" @close="$refs.messageContent.close()" @confirm="$refs.messageContent.close()"></uni-popup-dialog>
</uni-popup>
<!--登录弹框-->
<ns-login ref="login"></ns-login>
<!--加载动画-->
@ -54,20 +59,26 @@
</template>
<script>
import uniPopup from '@/components/uni-popup-new/uni-popup.vue';
import uniPopupDialog from '@/components/uni-popup-dialog/uni-popup-dialog.vue';
export default {
components: {
uniPopup,
uniPopupDialog
},
data() {
return {
//
titles:[
{ title: '交易信息', type: 'business', icon: 'public/static/img/message/business.png' },
{ title: '系统消息', type: 'system', icon: 'public/static/img/message/system.png' },
{ title: '通知消息', type: 'notice', icon: 'public/static/img/message/notice.png' },
{ title: '留言反馈', type: 'words', icon: 'public/static/img/message/words.png' },
],
// 1=2=3=4=
titles: {
1: {title: '交易信息', type: 'business', icon: 'public/static/img/message/business.png'},
2: {title: '系统消息', type: 'system', icon: 'public/static/img/message/system.png'},
3: {title: '通知消息', type: 'notice', icon: 'public/static/img/message/notice.png'},
4: {title: '留言反馈', type: 'words', icon: 'public/static/img/message/words.png'},
},
list: [],
message: '',
};
},
components: {},
mixins: [],
onLoad(option) {},
onShow() {},
@ -76,14 +87,13 @@ export default {
if (!uni.getStorageSync('token')) this.$refs.login.open('/pages_promotion/message/index');
},
methods: {
// todo:
//
getList(mescroll) {
this.$api.sendRequest({
url: '/futures/api/futures/myList',
url: '/message/api/message/messageList',
data: {
page: mescroll.num || 1,
page_size: mescroll.size || 10,
status: this.tabs_active,
},
success: res => {
if(parseInt(res.code) === 0){
@ -94,8 +104,6 @@ export default {
this.list = []; //
}
this.list = this.list.concat(res.data.list); //
}else {
this.msg = res.message;
}
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
@ -106,9 +114,24 @@ export default {
}
});
},
//
seeDetails(item,index){
//
this.message = item.message_content;
this.$refs.messageContent.open();
//
if(parseInt(item.is_see) === 0 && parseInt(item.type) !== 4){
this.list[index].is_see = 1;
this.$api.sendRequest({
url: '/message/api/message/see',
data: {
id: item.id,
},
success: res => {},
fail: res => {}
});
}
}
},
onBackPress(options) {
if (options.from === 'navigateBack') return false;

View File

@ -4,7 +4,7 @@
<!-- 列表内容 -->
<mescroll-uni ref="mescroll" @getData="getList" top="0">
<block slot="list">
<view class="message-list">
<view class="message-list" v-if="Object.keys(list).length > 0">
<view class="message-block" v-for="(item,index) in list" :key="index">
<view class="message-block-top">
<view class="message-block-top-image">
@ -12,12 +12,13 @@
</view>
<view class="message-block-top-title">{{ type_info.title }}</view>
</view>
<view class="message-block-message">
消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容
</view>
<view class="message-block-bottom">2023-02-27 10:45</view>
<view class="message-block-message">{{ item.message_content }}</view>
<view class="message-block-bottom">{{ $util.timeStampTurnTime(item.created_time) }}</view>
</view>
</view>
<view v-else>
<ns-empty :isIndex="false" text="暂无消息通知"></ns-empty>
</view>
</block>
</mescroll-uni>
<!--登录弹框-->
@ -35,14 +36,14 @@ export default {
//
message_type: 'business',
type_info: {},
// 1=2=3=4=
types: {
business: {title: '交易信息', type: 'business', icon: 'public/static/img/message/business.png'},
system: {title: '系统消息', type: 'system', icon: 'public/static/img/message/system.png'},
notice: {title: '通知消息', type: 'notice', icon: 'public/static/img/message/notice.png'},
words: {title: '留言反馈', type: 'words', icon: 'public/static/img/message/words.png'},
business: {title: '交易信息', type: 'business', value: 1, icon: 'public/static/img/message/business.png'},
system: {title: '系统消息', type: 'system', value: 2, icon: 'public/static/img/message/system.png'},
notice: {title: '通知消息', type: 'notice', value: 3, icon: 'public/static/img/message/notice.png'},
words: {title: '留言反馈', type: 'words', value: 4, icon: 'public/static/img/message/words.png'},
},
};
},
components: {},
@ -61,26 +62,22 @@ export default {
if (!uni.getStorageSync('token')) this.$refs.login.open('/pages_promotion/futures/list');
},
methods: {
// todo:
//
getList(mescroll) {
this.$api.sendRequest({
url: '/futures/api/futures/myList',
url: '/message/api/message/messageList',
data: {
page: mescroll.num || 1,
page_size: mescroll.size || 10,
status: this.tabs_active,
message_type: this.types[this.message_type].value,
},
success: res => {
if(parseInt(res.code) === 0){
mescroll.endSuccess(Object.keys(res.data.list).length);
//
if (parseInt(mescroll.num) === 1){
this.list = []; //
}
if (parseInt(mescroll.num) === 1) this.list = []; //
this.list = this.list.concat(res.data.list); //
}else {
this.msg = res.message;
}
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();