添加:消息相关接口对接

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"> <mescroll-uni ref="mescroll" @getData="getList" top="320">
<block slot="list"> <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" v-for="(item,index) in list" :key="index">
<view class="message-block-top"> <view class="message-block-top">
<view class="message-block-top-image"> <view class="message-block-top-image">
<image class="top-image" :src="$util.img('public/static/img/message/business.png')" mode="widthFix"></image> <image class="top-image" :src="$util.img(titles[item.type].icon)" mode="widthFix"></image>
<text class="top-drop"></text> <text class="top-drop" v-if="parseInt(item.is_see) === 0"></text>
</view> </view>
<view class="message-block-top-title">交易信息</view> <view class="message-block-top-title">{{ titles[item.type].title }}</view>
</view> </view>
<view class="message-block-message"> <view class="message-block-message">{{ item.message_content }}</view>
消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容 <view class="message-block-bottom" @click="seeDetails(item,index)">
</view>
<view class="message-block-bottom">
<view class="message-block-bottom-left">查看详情</view> <view class="message-block-bottom-left">查看详情</view>
<view class="message-block-bottom-right"> <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> </view>
</view> </view>
<view v-else>
<ns-empty :isIndex="false" text="暂无消息通知"></ns-empty>
</view>
</block> </block>
</mescroll-uni> </mescroll-uni>
</view> </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> <ns-login ref="login"></ns-login>
<!--加载动画--> <!--加载动画-->
@ -54,20 +59,26 @@
</template> </template>
<script> <script>
import uniPopup from '@/components/uni-popup-new/uni-popup.vue';
import uniPopupDialog from '@/components/uni-popup-dialog/uni-popup-dialog.vue';
export default { export default {
components: {
uniPopup,
uniPopupDialog
},
data() { data() {
return { return {
// // 1=2=3=4=
titles:[ titles: {
{ title: '交易信息', type: 'business', icon: 'public/static/img/message/business.png' }, 1: {title: '交易信息', type: 'business', icon: 'public/static/img/message/business.png'},
{ title: '系统消息', type: 'system', icon: 'public/static/img/message/system.png' }, 2: {title: '系统消息', type: 'system', icon: 'public/static/img/message/system.png'},
{ title: '通知消息', type: 'notice', icon: 'public/static/img/message/notice.png' }, 3: {title: '通知消息', type: 'notice', icon: 'public/static/img/message/notice.png'},
{ title: '留言反馈', type: 'words', icon: 'public/static/img/message/words.png' }, 4: {title: '留言反馈', type: 'words', icon: 'public/static/img/message/words.png'},
], },
list: [], list: [],
message: '',
}; };
}, },
components: {},
mixins: [], mixins: [],
onLoad(option) {}, onLoad(option) {},
onShow() {}, onShow() {},
@ -76,14 +87,13 @@ export default {
if (!uni.getStorageSync('token')) this.$refs.login.open('/pages_promotion/message/index'); if (!uni.getStorageSync('token')) this.$refs.login.open('/pages_promotion/message/index');
}, },
methods: { methods: {
// todo: //
getList(mescroll) { getList(mescroll) {
this.$api.sendRequest({ this.$api.sendRequest({
url: '/futures/api/futures/myList', url: '/message/api/message/messageList',
data: { data: {
page: mescroll.num || 1, page: mescroll.num || 1,
page_size: mescroll.size || 10, page_size: mescroll.size || 10,
status: this.tabs_active,
}, },
success: res => { success: res => {
if(parseInt(res.code) === 0){ if(parseInt(res.code) === 0){
@ -94,8 +104,6 @@ export default {
this.list = []; // this.list = []; //
} }
this.list = this.list.concat(res.data.list); // this.list = this.list.concat(res.data.list); //
}else {
this.msg = res.message;
} }
if (this.$refs.loadingCover) this.$refs.loadingCover.hide(); 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) { onBackPress(options) {
if (options.from === 'navigateBack') return false; if (options.from === 'navigateBack') return false;

View File

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