Files
GX.O3.WMS/APK/APP_Report/pages/tabbar/home/moerNews.vue
T

252 lines
5.7 KiB
Vue
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view class="page">
<view class="msg" v-for="(item,index) in list" :key='index' @click="Detail(item)" v-if="!list.length == 0">
<view class="my-body">
<view style="height: 180rpx;width: 180rpx;">
<image class="dot" :src="'data:image/jpeg;base64,'+item.FImage"/>
</view>
<view style="display: flex;flex-direction: column;align-items: flex-start;justify-content: center;height: 200rpx;">
<text class='dot-text-notread'>{{item.FName}}</text>
<text class="dot-text-notread">日期:{{item.C_YMD.split(" ")[0]}}</text>
</view>
</view>
</view>
<view class="msg" v-for="(item,index) in listNewsBlank" :key='index' @click="Detail(item)" v-if="list.length == 0">
<view class="my-body">
<view style="height: 180rpx;width: 180rpx;">
<image style="height: 180rpx;width: 180rpx;" :src="item.FImageBase64"/>
</view>
<view style="display: flex;flex-direction: column;align-items: flex-start;justify-content: center;height: 200rpx;">
<text class='dot-text-notread'>{{item.FName}}</text>
<text class="dot-text-notread">日期:{{item.C_YMD.split(" ")[0]}}</text>
</view>
</view>
</view>
</view>
</template>
<script>
import {
mapState
} from 'vuex';
import errorUtil from '@/common/errorutil.js';
export default {
data() {
return {
orgid:'',
list:[],
pageIndex:1,
pageSize:6,
showTips:false,
listNewsBlank:[
{"FImageBase64":'../../../static/home/news1.png',"FName":"电子公司引入WMS解决仓储","C_YMD":"2021-1-11 18:00:00"},
{"FImageBase64":'../../../static/home/news2.png',"FName":"电子公司引入WMS解决仓储","C_YMD":"2021-1-11 18:00:00"},
{"FImageBase64":'../../../static/home/news3.png',"FName":"电子公司引入WMS解决仓储","C_YMD":"2021-1-11 18:00:00"},
],
}
},
computed: {
...mapState(['hasLogin', 'userInfo'])
},
onLoad() {
this.pageIndex = 1;
let count = 1;
this.getNews(1, this.pageSize,count);
},
onShow() {
this.list = uni.getStorageSync('infoList')
},
onPullDownRefresh:function(){
this.showTips = false;
this.getInfo(1, this.pageSize);
setTimeout(()=>{
//停止下拉样式
uni.stopPullDownRefresh();
//隐藏标题读取
uni.hideNavigationBarLoading();
},
500);
},
onReachBottom:function(){
if(!this.showTips) {
this.getInfo(this.pageIndex, this.pageSize);
}
else {
uni.showToast({
icon: 'none',
title: '已经到底了'
});
}
},
methods: {
getNews(count){
let _self = this;
this.orgid = uni.getStorageSync('orgid');
if(count) {
count = count + 1;
if(count>4){
return;
}
}
else {
count = 1;
}
let requestParams;
let tokenpara = uni.getStorageSync('tokenpara');
if(count > 1) {
requestParams = {
"id": this.userInfo.token,
"basicType":2,
"uid":0,
"pageSize":1,
"pageIndex":6,
"tokenpara": tokenpara
};
}
else {
requestParams = {
"id": this.userInfo.token,
"basicType":2,
"uid":0,
"pageSize":1,
"pageIndex":6,
};
}
this.$request.post({
data: {
action: 'Notice',
params: requestParams
}
}).then(res => {
let datalist = JSON.parse(res);
_self.list = datalist;
}).catch(err => {
if(err.state ==400){
this.getNews(count);
if(count > 4) {
errorUtil.handle(err);
return;
}
}else{
errorUtil.handle(err);
}
});
},
Detail:function(item){
uni.setStorageSync('newsDetail',item);
uni.navigateTo({
url:'./newsDetail'
})
}
}
}
</script>
<style>
page{
background-color: #F2F2F2;
}
.msg{
display: flex;
flex-direction: column;
margin-left: 43.47rpx;
margin-right: 43.47rpx;
margin-top: 43.47rpx;
background: #FFFFFF;
border-radius: 9.05rpx;
height: 200rpx;
}
.my-body{
display: flex;
flex-direction: row;
margin-top: 10rpx;
background: #FFFFFF;
border-radius: 9.05rpx;
font-size: 16px;
justify-items: center;
align-items: center;
justify-content: center;
}
.dot{
height: 180rpx;
width: 180rpx;
background: #E24848;
/* border-radius: 50%; */
margin-right: 5rpx;
}
.dot-text-read{
margin-right: 10rpx;
color: #232323;
flex-grow: 0;
flex-shrink: 0;
}
.dot-text-notread{
margin-right: 10rpx;
color: #4688FD;
flex-grow: 0;
flex-shrink: 0;
}
.end{
height: 32.6rpx;
width: 32.6rpx;
margin-right: 21.73rpx;
}
.my-body view{
margin-left: 21.73rpx;
width: 100%;
display: flex;
align-items: center;
font-size: 16px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #4688FD;
}
.detail{
margin-left: 21.73rpx;
/* width: 100%; */
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #585858;
margin-top: 14.49rpx;
}
.sender{
margin-left: 21.73rpx;
width: 100%;
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #585858;
}
.time{
margin-left: 21.73rpx;
width: 100%;
font-size: 12px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #838383;
margin-top: 14.49rpx;
margin-bottom: 21.73rpx;
}
.list-title{
font-weight: bold;
font-size: 16px;
margin-right: 5%;
/* 文字不换行 */
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap; //文本不换行,这样超出一行的部分被截取,显示...
}
</style>