Files

840 lines
23 KiB
Vue
Executable File

<template>
<view class="home">
<view class="topBar">
<view class="topBar-text">首页</view>
<view class="msg" @click="msgClick">
<image class="msg-img" src="../../../static/home/msg.png"/>
<text class="msg-text" v-show="count !== 0">{{count}}</text>
</view>
</view>
<view class="home-apply">
<view class="home-news-title">
<text class="news-info">常用应用</text>
</view>
<view class="home-apply-item">
<uni-grid :column="4" :show-border="false" :square="false">
<uni-grid-item v-for="(subitem ,subindex) in comList" :key="subindex">
<view class="grid-item-box" @click="NavigateApplyKanban(subitem)" v-if="subitem.PrgType==4">
<image class="image" src="../../../static/icon/unchecked.png" />
<text class="text">{{subitem.NAME}}</text>
</view>
<view class="grid-item-box" @click="NavigateApply(subitem.KEY)" v-else>
<view class="image" :style="{backgroundImage:'url('+subitem.src+')'}"/>
<text class="text">{{subitem.NAME}}</text>
</view>
</uni-grid-item>
<uni-grid-item>
<view class="grid-item-box" @click="PageNavigate('../../apply/applymanage/applymanage')">
<image class="image" src="../../../static/home/more_apply.png" />
<text class="text">应用设置</text>
</view>
</uni-grid-item>
</uni-grid>
</view>
</view>
<view class="divider"></view>
<view class="home-card">
<view class="home-news-title">
<text class="news-info">新闻资讯</text>
<text class="news-more" @click="loadMore()">更多</text>
</view>
<view class="home-news-detail">
<scroll-view scroll-x="true" show-scrollbar="false">
<view class="home-news-detail-outline">
<view class="home-news-detail-item" v-if="listNews.length>0"
v-for="(item,index) in listNews" :key='index'>
<view class="home-news-detail-item-img"
:style="{'height':newsHeight+'px','width':newsWidth+'px',backgroundImage: 'url(' + item.FImageBase64 + ')'}"
@click="goDetail(item,index)"></view>
<view class="home-news-detail-item-text" :style="{'width':newsWidth-2+'px'}" @click="goDetail(item,index)">
<text class="home-news-detail-item-text-title">{{item.FName}}</text>
<text class="home-news-detail-item-text-time">{{item.C_YMD}}</text>
</view>
</view>
<view class="home-news-detail-item" v-if="listNews.length==0"
v-for="(item,index) in listNewsBlank" :key='index'>
<view class="home-news-detail-item-img"
:style="{'height':newsHeight+'px','width':newsWidth+'px',backgroundImage: 'url(' + item.FImageBase64 + ')'}"
@click="goDetail(item,index)"></view>
<view class="home-news-detail-item-text" :style="{'width':newsWidth-2+'px'}" @click="goDetail(item,index)">
<text class="home-news-detail-item-text-title">{{item.FName}}</text>
<text class="home-news-detail-item-text-time">{{item.C_YMD}}</text>
</view>
</view>
</view>
</scroll-view>
</view>
</view>
<view class="divider"></view>
<view class="home-card" style="margin-bottom: 70px;padding-bottom: 30rpx;">
<view class="home-news-title">
<text class="news-info">我的待办</text>
</view>
<view class="home-news-title" v-if="arrangeList.length==0">
<text class="news-info-none">当前无待办事项</text>
</view>
<view v-for="(item,index) in arrangeList" v-else>
<view class="home-news-detail">
<view class="card-date">
<view class="date-item">
<view class="arrange-time">
<image class="img-date" src="../../../static/tabbar/cleandar.png"></image>
<text class="time">{{item.FSTARTTIME}}~{{item.FENDTIME}}</text>
</view>
<view class="detail-info">{{item.FCONTENT ? item.FCONTENT : ''}}</view>
</view>
<checkbox class="checkbox" :checked="item.isDel" @click="arrangeDel(item,index)" :key="keys"></checkbox>
</view>
</view>
</view>
</view>
<view class="tabBar">
<view class="tabBar-item" @click="mainSelectF">
<view v-show="mainSelect" class="tabBar-item-view">
<image class="tabBar-item-img" src="../../../static/tabbar/main2x.png"></image>
<text class="tabBar-item-text" style="color:#007AFF">首页</text>
</view>
<view v-show="!mainSelect" class="tabBar-item-view">
<image class="tabBar-item-img" src="../../../static/tabbar/main2x.png"></image>
<text class="tabBar-item-text" style="color: #666666;">首页</text>
</view>
</view>
<view class="tabBar-item" @click="applySelectF">
<view v-show="applySelect" class="tabBar-item-view">
<image class="tabBar-item-img" src="../../../static/tabbar/apply2x.png"></image>
<text class="tabBar-item-text" style="color:#007AFF">应用</text>
</view>
<view v-show="!applySelect" class="tabBar-item-view">
<image class="tabBar-item-img" src="../../../static/tabbar/apply2x.png"></image>
<text class="tabBar-item-text" style="color: #666666;">应用</text>
</view>
</view>
<view class="tabBar-item" @click="cleandarSelectF">
<view v-show="cleandarSelect" class="tabBar-item-view">
<image class="tabBar-item-img" src="../../../static/tabbar/cleandar2x.png"></image>
<text class="tabBar-item-text" style="color:#007AFF">日程</text>
</view>
<view v-show="!cleandarSelect" class="tabBar-item-view">
<image class="tabBar-item-img" src="../../../static/tabbar/cleandar2x.png"></image>
<text class="tabBar-item-text" style="color: #666666;">日程</text>
</view>
</view>
<view class="tabBar-item" @click="mySelectF">
<view v-show="mySelect" class="tabBar-item-view">
<image class="tabBar-item-img" src="../../../static/tabbar/my2x.png"></image>
<text class="tabBar-item-text" style="color:#007AFF">我的</text>
</view>
<view v-show="!mySelect" class="tabBar-item-view">
<image class="tabBar-item-img" src="../../../static/tabbar/my2x.png"></image>
<text class="tabBar-item-text" style="color: #666666;">我的</text>
</view>
</view>
</view>
<!-- 系统升级 -->
<yomol-upgrade ref="yomolUpgrade"></yomol-upgrade>
<opsoft-dialog-notice
:dialogNoticeShow="showDialog"
:dialogNoticeType="dialogNoticeType"
:dialogNoticeTitle="dialogNoticeTitle"
:dialogNoticeContent="dialogNoticeContent"
@dialogNoticeConfirmClick="dialogNoticeConfirmClick"
>
</opsoft-dialog-notice>
</view>
</template>
<script>
import uniBadge from "@/components/uni-badge/uni-badge.vue"
import faIcon from "@/components/fa-icon/fa-icon.vue";
import mediaList from '@/components/tab-nvue/mediaList.vue';
import navigationTitle from '@/components/navigation-title/navigation-title.vue';
import uniGrid from '@/components/uni-grid/uni-grid.vue';
import uniGridItem from '@/components/uni-grid-item/uni-grid-item.vue';
import yomolUpgrade from '@/components/yomol-upgrade/yomol-upgrade.vue';
import opsoftDialogNotice from '@/components/opsoft-dialog-notice/opsoft-dialog-notice.vue';
import errorStrUntil from '@/common/errorStrUntil.js';
import version from '@/common/version.js';
import Vue from 'vue';
import { mapState } from 'vuex';
export default {
components: {
faIcon,
mediaList,
navigationTitle,
yomolUpgrade,
uniBadge,
opsoftDialogNotice
},
data() {
return {
keys:0,
infoList:[],
count:0,
orgid:"",
windowWidth:"",
windowHeight:"",
bannerHeight:"",
bannerWidth:"",
newsHeight:"",
newsWidth:"",
currentBanner:'',
mainSelect:true,
applySelect:false,
cleandarSelect:false,
mySelect:false,
listBanner: [],
listBannerBlank:[
{"url":'../../../static/home/banner1.png'},
{"url":'../../../static/home/banner2.png'},
{"url":'../../../static/home/banner3.png'},
],
listNews: [],
listNewsBlank:[
{"FImageBase64":'../../../static/home/big_1.png',"FName":"电子公司引入WMS解决仓储诸点","C_YMD":"2021-1-11 18:00:00"},
{"FImageBase64":'../../../static/home/big_2.png',"FName":"WMS管理软件如实现精细化管理","C_YMD":"2021-1-11 18:00:00"},
{"FImageBase64":'../../../static/home/big_3.png',"FName":"智能仓储管理系统的设计方案","C_YMD":"2021-1-11 18:00:00"},
],
list:[],
pageIndex: 0,
loadingText: '下拉加载',
comList: [],
dialogNoticeContent:'',
dialogNoticeTitle:'',
dialogNoticeType:'',
showDialog:false,
arrangeList: [],
}
},
computed: {
...mapState(['hasLogin', 'userInfo'])
},
onShow() {
setTimeout(() => {
this.getFavoritesMenu();
this.getInfoNumber();
},400)
let date = new Date();
let curDate = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate();
this.getPersonalInfo(curDate);
},
onLoad() {
const res = uni.getSystemInfoSync();
this.windowHeight = res.windowHeight;
this.windowWidth = res.windowWidth;
let sWindow = this.windowHeight*this.windowWidth;
let sBaseBanner = 366*200;
let sBaseWindow = 414*896;
let basePrecent = sBaseBanner/sBaseWindow;
let baseWHprecent = 366/200;233
let sWindowBanner = sWindow*basePrecent;
this.bannerHeight = Math.sqrt((sWindowBanner/baseWHprecent));
this.bannerWidth = this.bannerHeight*baseWHprecent;
let sBaseNews = 140*90;
let basePrecentNews = sBaseNews/sBaseWindow;
let baseWHprecentNews = 140/90;
let sWindowNews = sWindow*basePrecentNews;
this.newsHeight = Math.sqrt((sWindowNews/baseWHprecentNews));
this.newsWidth = this.newsHeight*baseWHprecentNews;
this.getAllMenu();
this.getFavoritesMenu();
this.GetOrgInfo();
this.checkVersion();
this.getUnReadCount();
},
methods: {
getPersonalInfo(curDate) {
let _self = this;
let requestParams = {
"dateTime":curDate,
"fInterID":this.FINTERID ? this.FINTERID : "''"
};
uni.showLoading({
title:'加载中……',
mask:true
})
// log.writeLog(requestParams, false);
this.$request.get('/SysConfigData/PersonDiary',{params:requestParams})
.then(res => {
uni.hideLoading();
let datalist = res;
if (datalist) {
this.arrangeList = datalist;
this.arrangeList.forEach(
function(el){
let sTime = el.FSTARTTIME.split(" ");
let eTime = el.FENDTIME.split(" ");
sTime = sTime[1].split(":");
eTime = eTime[1].split(":");
el.FSTARTTIME = sTime[0]+":"+sTime[1];
el.FENDTIME = eTime[0]+":"+eTime[1];
el.isDel = false;
}
);
}
})
.catch(err => {
uni.hideLoading();
console.log()
if(err.message == '未找到日志信息'){
this.arrangeList = [];
this.clickDayList = [];
}else{
this.dialogProps(err)
}
});
},
arrangeDel(item,index){
let requestParams = {
"interId": item.FINTERID ? item.FINTERID : ''
};
uni.showLoading({
title:'加载中……',
mask:true
})
this.$request.get('/SysConfigData/DelPersonDiary',{params:requestParams})
.then(res => {
uni.hideLoading();
this.arrangeList.splice(index,1);
this.arrangeList.forEach(e => {
e.isDel = false
})
uni.showToast({
title:"删除成功",
icon:'none'
})
this.keys++
})
.catch(err => {
uni.hideLoading();
this.dialogProps(err)
});
},
dialogNoticeConfirmClick(){
this.showDialog = false;
},
getUnReadCount(){
let _self = this;
let loginId = uni.getStorageSync('userName')
let requestParams = {
userId: loginId,
};
this.$request.get('/PersonalMessage/GetCountUnReadPersonalMessage',{params:requestParams})
.then(res => {
_self.count = res.SumCount;
}).catch(err => {
uni.hideLoading();
this.dialogProps(err)
});
},
getInfoNumber(){
let _self = this;
let loginId = uni.getStorageSync('userName');
let requestParams;
},
msgClick(){
uni.navigateTo({
url:'./msg'
});
},
bannerChange(event) {
let current = event.detail.current;
this.currentBanner = current;
},
NavigateApplyKanban(subitem) {
let page=subitem.KEY;
if (page) {
let tempurl='../../views/KanBan/KanBan'+'?pageNumber='+page;
uni.navigateTo({
url: tempurl
});
}
},
NavigateApply(page) {
// #ifdef APP-PLUS || H5
uni.navigateTo({
url: '../../views/' + page + '/' + page
});
// #endif
},
PageNavigate: function(url) {
uni.navigateTo({
url: url
});
},
mainSelectF(){
this.mainSelect = true;
this.applySelect = false;
this.cleandarSelect = false;
this.mySelect = false;
},
applySelectF(){
this.mainSelect = false;
this.applySelect = true;
this.cleandarSelect = false;
this.mySelect = false;
uni.redirectTo({
url:'../apply/apply'
});
},
cleandarSelectF(){
this.mainSelect = false;
this.applySelect = false;
this.cleandarSelect = true;
this.mySelect = false;
uni.redirectTo({
url:'../calendar/calender'
});
},
mySelectF(){
this.mainSelect = false;
this.applySelect = false;
this.cleandarSelect = false;
this.mySelect = true;
uni.redirectTo({
url:'../myinfo/myinfo'
});
},
//更多
loadMore: function() {
uni.navigateTo({
url: `./moerNews`
});
},
//新闻详情
goDetail(item, index) {
uni.setStorageSync('newsDetail',item);
uni.navigateTo({
url: `./newsDetail`
});
},
//系统升级
checkVersion() {
let verCode = version.versionCode;
// #ifdef APP-PLUS
plus.runtime.getProperty(plus.runtime.appid,(wgtinfo)=>{
verCode = wgtinfo.versionCode;
});
// #endif
let requestParams = {
"appType":2
};
this.$request.get('/SysConfigData/GetLatestAppInfo',{params: requestParams}).then(res => {
let data = res;
if (data && data.Fversioncode) {
let urlVerCode = parseInt(data.Fversioncode);
if(urlVerCode > verCode ){
this.$refs.yomolUpgrade.show(data);
}
}
else {
uni.hideLoading();
}
}).catch(err => {
uni.hideLoading();
this.dialogProps(err)
});
},
getAllMenu(){
this.$request.post('/Service/GetAllMenu')
.then(res => {
let data = res.MainMenu;
if(data&&data.length>0){
data = data.filter(e => {
return e.NAME != "生产汇报"
});
data = data.filter(e => {
return e.NAME != "生产检验"
});
data = data.filter(e => {
return e.NAME != "安灯预警"
});
data = data.filter(e => {
return e.NAME != "预警平台"
});
}
data.forEach(
function(item){
item.SubMenus.forEach(
function(el) {
el.src = '../../../static/icon/'+el.KEY+'.png';
}
);
}
);
uni.setStorageSync('AllMenu',data);
})
.catch(err => {
uni.hideLoading();
this.dialogProps(err)
});
},
getFavoritesMenu(){
this.$request.post('/Service/GetFavoritesMenu')
.then(res => {
let datas = res;
datas.forEach((item, index) => {
let subdata = item.SubMenus
subdata.forEach((item, index) => {
if (item.NAME.length > 6) {
item.NAME = item.NAME.substr(0, 6)
}
});
});
this.comList = datas;
this.comList.forEach(
function(el) {
el.src = '../../../static/icon/'+el.KEY+'.png';
}
);
uni.setStorageSync('ComMenu',this.comList);
})
.catch(err => {
uni.hideLoading();
this.dialogProps(err)
});
},
GetOrgInfo:function(){
uni.showLoading({
mask: true
});
this.$request.get('/Service/GetSysOrgForUser').then(res => {
uni.hideLoading()
let orgInfo = res;
orgInfo.forEach((item) => {
item.FItemID = item.FINTERID
});
uni.setStorageSync('orgInfo',orgInfo);
}).catch(err => {
uni.hideLoading();
this.dialogProps(err)
});
},
dialogProps(err){
err = errorStrUntil.handle(err);
this.showDialog = true;
this.dialogNoticeType = 'error';
this.dialogNoticeTitle = '异常提示';
this.dialogNoticeContent = err;
}
}
}
</script>
<style>
page{background: #FFFFFF;}
.home {
height: 100%;
width: 100%;
}
.topBar{
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
height: 120rpx;
line-height: 120rpx;
width: 100%;
background: #2560C9;
font-size: 32.6rpx;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
color: #FFFFFF;
text-align: center;
position: fixed;
top: 0;
z-index: 999;
}
.topBar-text{
width: 100%;
height: 120rpx;
line-height: 120rpx;
font-size: 32.6rpx;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
color: #FFFFFF;
/* margin-left: 48rpx; */
text-align: center;
}
.msg{
position: relative;
display: flex;
margin-right: 48rpx;
}
.msg-img{
height: 36.23rpx;
width: 36.23rpx;
}
.msg-text{
height: 13px;
line-height: 13px;
background: #FF5353;
text-align: center;
color: #FFFFFF;
border-radius: 90px;
font-size: 12px;
position: absolute;
left: 21.73rpx;
top: -12px;
padding: 3px;
}
.home-swiper view {
height: 100%;
}
.swiper-item{
display: flex;
align-items: center;
}
.swiper-item-image {
border-radius: 10upx;
height: 100%;
width: 100%;
}
.swiper-item-banner{
display: flex;
align-items: center;
}
.swiper-item-banner-image{
border-radius: 10upx;
height: 80%;
width: 100%;
}
.divider{
height: 20rpx;
width: 100%;
background: #e5e5e5;
}
.home-card{width: 100%;background: #FFFFFF;padding-bottom: 20rpx;}
.home-news-title{
width: 100%;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
align-items: center;
background: #FFFFFF;
padding: 30rpx 0;
}
.news-info{
height: 45.28rpx;
line-height: 45.28rpx;
width: 100%;
font-size: 32.6rpx;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #000000;
margin-left: 48rpx;
}
.news-info-none{
height: 45.28rpx;
line-height: 45.28rpx;
width: 100%;
color: rgba(120, 120, 120, 1);
font-size: 14px;
font-weight: 400;
margin-left: 48rpx;
}
.news-more{
height: 45.28rpx;
line-height: 45.28rpx;
width: 72.46rpx;
font-size: 25.36rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #4688FD;
margin-right: 48rpx;
}
.home-news-detail{
margin-left: 48rpx;margin-right: 48rpx;
}
.home-news-detail-outline{
display: flex;flex-direction: row;
}
.home-news-detail-item{
display: flex;flex-direction: column;margin-right: 48rpx;margin-left: 1px;margin-bottom: 48rpx;
}
.home-news-detail-item-img{
border-radius: 9.05rpx 9.05rpx 0 0;
background-repeat: no-repeat;
background-size: cover;
}
.home-news-detail-item-text{
display: flex;flex-direction: column;border-radius: 0 0 9.05rpx 9.05rpx;
/* border: #333333 solid 1.81rpx; */
background: #FFFFFF;
/* border-bottom: 1px solid rgba(0, 0, 0, 0.1);
border-left: 1px solid rgba(0, 0, 0, 0.1);
border-right: 1px solid rgba(0, 0, 0, 0.1); */
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1)
}
.home-news-detail-item-text-title{
font-size: 21.73rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #000000;
overflow: hidden;
text-overflow: ellipsis;
/* white-space: nowrap; */
word-break: break-all;
width: 90%;
margin-left: 5%;
margin-right: 5%;
margin-top: 21.73rpx;
}
.home-news-detail-item-text-time{
font-size: 18.11rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #787878;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
word-break: break-all;
width: 90%;
margin-left: 5%;
margin-right: 5%;
}
.home-apply{width: 100%;margin-top: 60px;}
.home-apply-item{
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
padding: 0;
font-size: 14px;
background-color: #ffffff;
}
.grid-item-box {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding-bottom: 30rpx;
}
.image{
height: 79.71rpx;
width: 79.71rpx;
background-repeat: no-repeat;
background-size: cover;
}
.text {
padding: 10upx 0;
word-break: break-all;
text-align: center;
line-height: 16px;
width: 64px;
}
.card-date{
height: 180rpx;
background: #e5e5e5;
/* padding: 20rpx 0; */
border-radius: 7.25px;
margin-bottom: 10rpx;
box-sizing: border-box;
display: flex;
flex-direction: row;
align-items: center;
}
.date-item{
display: flex;
flex-direction: column;
width: calc(100% - 80rpx);
}
.arrange-time {
display: flex;
flex-direction: row;
align-items: center;
margin-left: 40rpx;
}
.img-date {
height: 54.34rpx;
width: 54.34rpx;
}
.time {
height: 54.34rpx;
line-height: 54.34rpx;
font-size: 28.98rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #000000;
margin-left: 21.73rpx;
}
.detail-info {
height: 45.28rpx;
line-height: 45.28rpx;
font-size: 32.6rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #000000;
margin-left: 119.56rpx;
overflow: hidden;
text-overflow: ellipsis;
}
.checkbox{margin-right: 0;}
.tabBar{
display: flex;
position: fixed;
flex-direction: row;
left: 0;
right: 0;
bottom: 0;
height: 119.56rpx;
background: rgba(255, 255, 255, 1);
box-shadow:2px 2px 3px rgba(0, 0, 0, 1);
}
.tabBar-item{
display: flex;
flex-direction: column;
flex-shrink: 1;
flex-grow: 1;
align-items: center ;
width: 100%;
}
.tabBar-item-view{
display: flex;
flex-direction: column;
flex-shrink: 1;
flex-grow: 1;
align-items: center ;
}
.tabBar-item-img{
height: 54.34rpx;
width: 54.34rpx;
margin-top: 16.3rpx;
}
.tabBar-item-text{
text-align: center;
height: 28.98rpx;
font-size: 28.98rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #515151;
line-height: 28.98rpx;
}
</style>