You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
353 lines
7.4 KiB
353 lines
7.4 KiB
<template>
|
|
<view class="pages">
|
|
<view>
|
|
<view v-for="(item,index) in dataList" class="newslist" @click="itemClick(item)">
|
|
|
|
<view class="item-top">
|
|
|
|
<view class="item-top-text">{{item.messageName}}</view>
|
|
<image class="item-top-img" src="../../static/baseIcon/zy.png" mode="aspectFill"></image>
|
|
</view>
|
|
|
|
<view class="item-con">
|
|
<view>
|
|
<text class="item-con-text">提交人:</text>
|
|
<text class="item-con-text">{{item.name}}</text>
|
|
</view>
|
|
<view style="margin-top: 8px;">
|
|
<text class="item-con-text">提交时间:</text>
|
|
<text class="item-con-text">{{item.date}}</text>
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<!-- <uni-load-more :status="loadingType"></uni-load-more> -->
|
|
|
|
</view>
|
|
<!-- 加载....没有更多 -->
|
|
<view style="line-height: 60rpx;margin-bottom: 50rpx;">
|
|
<u-loadmore :status="status" :icon-type="iconType" :load-text="loadText" />
|
|
</view>
|
|
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
triggered: true,
|
|
status: 'loadmore',
|
|
iconType: 'flower',
|
|
loadText: {
|
|
loadmore: '轻轻上拉',
|
|
loading: '努力加载中',
|
|
nomore: '拉也没用,没有了'
|
|
},
|
|
listQuery: {
|
|
current: 1,
|
|
size: 10,
|
|
params: {
|
|
userSid: "",
|
|
messageName: "",
|
|
state:"0", //0未读 1 已读 2全部
|
|
}
|
|
},
|
|
loadingType: 'more', //加载更多状态
|
|
dataList: [
|
|
// {
|
|
// messageName: "36524质物库存汇总",
|
|
// name: "张磊",
|
|
// date: "2023-08-13 17:14"
|
|
|
|
// },
|
|
// {
|
|
// messageName: "36524质物库存汇总",
|
|
// name: "张磊",
|
|
// date: "2023-08-13 17:14"
|
|
|
|
// },
|
|
// {
|
|
// messageName: "36524质物库存汇总",
|
|
// name: "张磊",
|
|
// date: "2023-08-13 17:14"
|
|
|
|
// },
|
|
// {
|
|
// messageName: "36524质物库存汇总",
|
|
// name: "张磊",
|
|
// date: "2023-08-13 17:14"
|
|
|
|
// },
|
|
// {
|
|
// messageName: "36524质物库存汇总",
|
|
// name: "张磊",
|
|
// date: "2023-08-13 17:14"
|
|
|
|
// },
|
|
// {
|
|
// messageName: "36524质物库存汇总",
|
|
// name: "张磊",
|
|
// date: "2023-08-13 17:14"
|
|
|
|
// },
|
|
// {
|
|
// messageName: "36524质物库存汇总",
|
|
// name: "张磊",
|
|
// date: "2023-08-13 17:14"
|
|
|
|
// },
|
|
// {
|
|
// messageName: "36524质物库存汇总",
|
|
// name: "张磊",
|
|
// date: "2023-08-13 17:14"
|
|
|
|
// },
|
|
// {
|
|
// messageName: "36524质物库存汇总",
|
|
// name: "张磊",
|
|
// date: "2023-08-13 17:14"
|
|
|
|
// },
|
|
// {
|
|
// messageName: "36524质物库存汇总",
|
|
// name: "张磊",
|
|
// date: "2023-08-13 17:14"
|
|
|
|
// },
|
|
// {
|
|
// messageName: "36524质物库存汇总",
|
|
// name: "张磊",
|
|
// date: "2023-08-13 17:14"
|
|
|
|
// },
|
|
|
|
// {
|
|
// messageName: "36524质物库存汇总",
|
|
// name: "张磊",
|
|
// date: "2023-08-13 17:14"
|
|
|
|
// },
|
|
// {
|
|
// messageName: "36524质物库存汇总",
|
|
// name: "张磊",
|
|
// date: "2023-08-13 17:14"
|
|
|
|
// },
|
|
|
|
],
|
|
};
|
|
},
|
|
onPullDownRefresh() {
|
|
this.listQuery.current = 1
|
|
this.loadData('refresh');
|
|
setTimeout(function() {
|
|
uni.stopPullDownRefresh();
|
|
}, 2000);
|
|
},
|
|
//加载更多
|
|
onReachBottom() {
|
|
this.listQuery.current = this.listQuery.current + 1
|
|
this.loadData();
|
|
},
|
|
onShow() {
|
|
console.log('onShow', getApp().globalData.isLogin)
|
|
|
|
let token = uni.getStorageSync("Global-Auth-Token")
|
|
if (token != null && token.length != 0) {
|
|
getApp().globalData.token = token
|
|
}
|
|
let isLogin = uni.getStorageSync("isLogin")
|
|
if (isLogin != null && isLogin == 1) {
|
|
getApp().globalData.isLogin = isLogin
|
|
}
|
|
let sid = uni.getStorageSync("sid")
|
|
if (sid != null && sid.length != 0) {
|
|
getApp().globalData.sid = sid
|
|
}
|
|
|
|
console.log('用户Sid', getApp().globalData.sid)
|
|
console.log('token', getApp().globalData.token)
|
|
console.log('是否登陆', getApp().globalData.isLogin)
|
|
|
|
// setTimeout(() => {
|
|
if (getApp().globalData.isLogin) {
|
|
var userSid = getApp().globalData.sid
|
|
console.log(">>>>>", userSid)
|
|
|
|
this.listQuery.params.userSid = userSid
|
|
|
|
this.loadData();
|
|
// uni.setTabBarBadge({ //显示数字
|
|
// index: 0, //tabbar下标
|
|
// text: '100' //数字
|
|
// })
|
|
} else {
|
|
|
|
/* #ifdef MP-WEIXIN */
|
|
this.WxSilentLogin()
|
|
/* #endif */
|
|
|
|
/* #ifdef APP-PLUS */
|
|
uni.redirectTo({
|
|
url: '../login/login'
|
|
})
|
|
/* #endif */
|
|
}
|
|
},
|
|
methods: {
|
|
itemClick(item) {
|
|
console.log('item', item.pagepath)
|
|
uni.navigateTo({
|
|
url: "/" + item.pagepath
|
|
})
|
|
},
|
|
//加载商品 ,带下拉刷新和上滑加载
|
|
async loadData(type = 'add', loading) {
|
|
//没有更多直接返回
|
|
if (type === 'add') {
|
|
if (this.loadingType === 'nomore') {
|
|
return;
|
|
}
|
|
this.loadingType = 'loading';
|
|
} else {
|
|
this.loadingType = 'more';
|
|
}
|
|
|
|
var list = []
|
|
|
|
this.$api.messageListPage(this.listQuery).then((resp) => {
|
|
// if (resp.success) {
|
|
console.log('1111', resp)
|
|
|
|
// list = resp.records
|
|
|
|
for (var i = 0; i < resp.records.length; i++) {
|
|
var item = resp.records[i]
|
|
var title = item.map.thing2
|
|
console.log("title", title)
|
|
|
|
list.push({
|
|
messageName: title,
|
|
name: item.map.thing3,
|
|
date: item.map.time1,
|
|
pagepath: item.pagepath
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
console.log("消息列表", list)
|
|
if (type === 'refresh') {
|
|
this.dataList = [];
|
|
}
|
|
|
|
this.dataList = this.dataList.concat(list);
|
|
console.log("消息列表>>>>>", this.dataList.length)
|
|
//判断是否还有下一页,有是more 没有是nomore(测试数据判断大于20就没有了)
|
|
this.loadingType = this.dataList.length > list.total ? 'nomore' : 'more';
|
|
if (type === 'refresh') {
|
|
if (loading == 1) {
|
|
uni.hideLoading();
|
|
} else {
|
|
uni.stopPullDownRefresh();
|
|
}
|
|
}
|
|
|
|
}).catch(e => {
|
|
console.log('eeeee', e)
|
|
})
|
|
|
|
},
|
|
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.pages {
|
|
width: 100%;
|
|
height: 100%;
|
|
|
|
.newslist {
|
|
display: flex;
|
|
flex-direction: column;
|
|
background: #fff;
|
|
border-radius: 12px;
|
|
margin-left: 12px;
|
|
margin-right: 12px;
|
|
margin-top: 12px;
|
|
padding: 15px 20px;
|
|
|
|
.item-top {
|
|
display: flex;
|
|
flex-direction: row;
|
|
align-items: center;
|
|
padding-bottom: 12px;
|
|
padding-left: 5px;
|
|
padding-right: 5px;
|
|
border-bottom: 1px solid #F1F3F5;
|
|
|
|
.item-top-img {
|
|
width: 18px;
|
|
height: 18px;
|
|
}
|
|
|
|
.item-top-text {
|
|
flex: 1;
|
|
margin-right: 10px;
|
|
font-size: 16px;
|
|
color: #101010;
|
|
font-weight: 600;
|
|
font-family: sans-serif;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
display: -webkit-box;
|
|
-webkit-line-clamp: 1;
|
|
-webkit-box-orient: vertical;
|
|
}
|
|
|
|
.item-top-text2 {
|
|
font-size: 14px;
|
|
color: #0A59F7;
|
|
}
|
|
}
|
|
|
|
.item-con {
|
|
margin-top: 12px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
|
|
.item-con-text {
|
|
font-size: 15px;
|
|
color: #666666;
|
|
}
|
|
}
|
|
|
|
.item-bom {
|
|
width: 100%;
|
|
margin-top: 12px;
|
|
padding-top: 10px;
|
|
border-top: 1px solid #F1F3F5;
|
|
display: flex;
|
|
flex-direction: row;
|
|
align-items: center;
|
|
justify-content: end;
|
|
|
|
.item-bom-img {
|
|
width: 14px;
|
|
height: 14px;
|
|
}
|
|
|
|
.item-bom-text {
|
|
margin-left: 5px;
|
|
font-size: 14px;
|
|
color: #999;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|