forked from zhongyuanhaiju/uniapp
添加:消息相关接口对接
This commit is contained in:
parent
992bb55fa6
commit
644dc2012d
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue