123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480 |
- <template>
- <view class="visit" v-if="workList.length>0">
- <view class="notify-list" v-for="(item,i) in workList" :key="i">
- <!-- <view class="card-bg">
- <db-list :list="worksList" :path="'/pages/message/content?id='"></db-list>
- </view> -->
- <view class="list-item" @click="clickItem(item)">
- <view class="notify-wrapper">
- <view class="title in1line">{{item.title}}</view>
- <view class="clear">
- <view class="time">{{item.createTime|time}}</view>
- <uni-tag class="tag" type="error" :text="item.taskName | notifyTypeFilter" size="small" />
- </view>
-
- </view>
- </view>
- </view>
- </view>
- <view v-else class="noMes">
- 没有待办工作
- </view>
- </template>
- <script>
- import {
- worksList
- } from '@/api/userInfo';
- import rfLoadMore from '@/components/oa-load-more/oa-load-more';
- import moment from '@/common/moment';
- import $mAssetsPath from '@/config/assets.config';
- import oaEmpty from '@/components/oa-empty';
- import dbList from '@/components/leo-list/db-list.vue'
- export default {
- components: {
- rfLoadMore,
- oaEmpty,
- dbList
- },
- data() {
- return {
- workList: [],
- page: 1,
- // cate_id: '',
- loadingType: 'more',
- loading: true,
- hasLogin: false,
- moneySymbol: this.moneySymbol,
- // 控制滑动效果
- theIndex: null,
- oldIndex: null
- };
- },
- filters: {
- time(val) {
- // 拿到当前时间戳和发布时的时间戳,然后得出时间戳差
- var curTime = new Date();
- var postTime = new Date(val);
- var timeDiff = curTime.getTime() - postTime.getTime();
- // 单位换算
- var min = 60 * 1000;
- var hour = min * 60;
- var day = hour * 24;
- var week = day * 7;
- // 计算发布时间距离当前时间的周、天、时、分
- var exceedWeek = Math.floor(timeDiff / week);
- var exceedDay = Math.floor(timeDiff / day);
- var exceedHour = Math.floor(timeDiff / hour);
- var exceedMin = Math.floor(timeDiff / min);
- // 最后判断时间差到底是属于哪个区间,然后return
- if (exceedWeek > 0) {
- if (curTime.getFullYear() == postTime.getFullYear()) {
- return moment(val).format('MM-DD');
- } else {
- return moment(val).format('YYYY-MM-DD');
- }
- } else {
- if (exceedDay < 7 && exceedDay > 0) {
- return exceedDay + '天前';
- } else {
- if (exceedHour < 24 && exceedHour > 0) {
- return exceedHour + '小时前';
- } else {
- if(exceedMin<1){
- exceedMin=0
- }
- return exceedMin + '分钟前';
- }
- }
- }
- },
- notifyTypeFilter(val) {
- return val;
- }
- },
- async onShow(options) {
- await this.initData();
- },
- // 下拉刷新
- onPullDownRefresh() {
- this.page = 1;
- this.workList = [];
- this.loading = true;
- this.getworksList('refresh');
- },
- // 加载更多
- onReachBottom() {
- if (this.loadingType === 'nomore') return;
- this.page = parseInt(this.page) + 1;
- this.getworksList('getmore');
- },
- methods: {
- // 数据初始化
- initData() {
- this.hasLogin = this.$mStore.getters.hasLogin;
- this.page = 1;
- this.workList.length = 0;
- this.getworksList();
- uni.setNavigationBarColor({
- frontColor: '#ffffff',
- backgroundColor: this.themeColor.color,
- animation: {
- duration: 400,
- timingFunc: 'easeIn'
- }
- })
- },
- // 获取资料列表
- getworksList(type) {
- var that = this;
- console.log(66666);
- if (!this.hasLogin) {
- this.loading = false;
- uni.reLaunch({
- url: '../public/login'
- })
- return;
- }
- var url = this.$mConfig.baseUrl + '/fw/queryDocumentAndNotice';
- var token = this.$preToken + ' ' + this.$store.state.accessToken;
- this.$http.request({
- url: url,
- timeout:60*1000*100,
- header: {
- 'content-type': 'application/json',
- 'Authorization': token
- },
- data: {
- pageNum: this.page,
- pageSize: 20,
- orderByColumn: "ID",
- isAsc: "desc",
- }
- }).then(r => {
- this.loading = false;
- if (type === 'refresh') {
- that.workList = [];
- uni.stopPullDownRefresh();
- }
- if (r.total > that.workList.length + r.rows.length) {
- that.loadingType = 'more';
- } else {
- that.loadingType = 'nomore';
- }
- that.workList = [...that.workList, ...r.rows];
- if (r.total > 0) {
- uni.setTabBarBadge({
- index: 1,
- text: r.total.toString()
- })
- }else{
- uni.removeTabBarBadge({
- index:1
- })
- }
- })
- },
- navToLogin(route) {
- this.$mRouter.push({
- route
- });
- },
- navTo(route) {
- this.$mRouter.push({
- route
- });
- },
- clickItem(item) {
- if (item.taskName === '文件通知')
- this.navTo('/pages/gongwen/content?businessKey=' + item.businessKey + '&qianshou=false')
- else
- this.navTo('/pages/gongwen/meetingNotice?businessKey=' + item.businessKey + '&qianshou=false')
- /* this.navTo('/pages/notify/content?id=' + item.id + '&qianshou=0') */
- }
- }
- };
- </script>
- <style lang="scss">
- page {
- background-color: $page-color-base;
- }
- .noMes {
- color: gray;
- text-align: center;
- margin: 9px;
- }
- .visit {
- .uni-media-list-logo {
- width: 180rpx;
- height: 140rpx;
- }
- .uni-media-list-body {
- height: auto;
- justify-content: space-around;
- }
- .uni-media-list-text-top {
- height: 74rpx;
- font-size: 28rpx;
- overflow: hidden;
- }
- .uni-media-list-text-bottom {
- display: flex;
- flex-direction: row;
- justify-content: space-between;
- }
- .add-round {
- position: fixed;
- z-index: 999;
- right: 30rpx;
- bottom: 30rpx;
- border-radius: 50%;
- width: 120rpx;
- height: 120rpx;
- color: #fff;
- text-align: center;
- line-height: 120rpx;
- font-weight: 100;
- font-size: 80rpx;
- }
- .notify-list {
- border-radius: 5px;
- background: $page-color-base;
- /* #ifdef APP-PLUS */
- //padding-top: var(--status-bar-height);
- /* #endif */
- /* #ifndef APP-PLUS */
- padding-top: 1rpx;
- /* #endif */
- padding-bottom: 1rpx;
- .card-bg {
- margin: 0 24rpx;
- padding: 0 32rpx 0 0;
- background: #ffffff;
- border-radius: 20rpx;
- box-shadow: 0px 4rpx 20rpx 0rpx rgba(235, 241, 244, 0.35);
- }
- .read {
- text-align: right;
- margin-right: $spacing-base;
- margin-top: $spacing-base;
- margin-bottom: $spacing-sm;
- text {
- margin-left: $spacing-base;
- }
- }
- .list-item {
- margin: 0 24rpx;
- //padding: 0 0 30rpx 0;
- border-bottom: 1px solid #E5E5E5;
- }
- .row {
- width: calc(94%);
- height: calc(22vw + 40upx);
- margin: 0 auto $spacing-base;
- border-radius: 15upx;
- box-shadow: 0upx 5upx 20upx rgba(0, 0, 0, 0.1);
- display: flex;
- align-items: center;
- position: relative;
- overflow: hidden;
- z-index: 4;
- border: 0;
- .menu {
- .iconfont {
- color: #fff;
- font-size: 60upx;
- }
- position: absolute;
- width: 29%;
- height: 100%;
- right: 0;
- display: flex;
- justify-content: center;
- align-items: center;
- color: #fff;
- z-index: 2;
- }
- .carrier {
- @keyframes showMenu {
- 0% {
- transform: translateX(0);
- }
- 100% {
- transform: translateX(-30%);
- }
- }
- @keyframes closeMenu {
- 0% {
- transform: translateX(-30%);
- }
- 100% {
- transform: translateX(0);
- }
- }
- &.open {
- animation: showMenu 0.25s linear both;
- }
- &.close {
- animation: closeMenu 0.15s linear both;
- }
- background-color: #fff;
- position: absolute;
- width: 100%;
- padding: 0 0;
- height: 100%;
- z-index: 3;
- display: flex;
- align-items: center;
- }
- }
- // $spacing-base
- .notify-wrapper {
- background-color: $color-white;
- width: 100%;
- padding: $spacing-base $spacing-lg $spacing-base $spacing-lg;
- margin: 0 0;
- border-radius: 15upx;
- position: relative;
- .title {
- //width: 80%;
- font-size: $font-lg;
- color: $font-color-dark;
- font-weight: 500;
- margin: 0 0 $spacing-sm;
- line-height:1.5;
- }
- .content {
- font-size: $font-sm;
- color: $font-color-base;
- height: 75upx;
- line-height: 36upx;
- }
- .time {
- //position: absolute;
- //right: 10upx;
- font-size: $font-sm;
- color: $font-color-light;
- //top:65upx;
- width:40%;
- float: left;
- }
- .tag {
- //position: absolute;
- //top: 20upx;
- //right: 10upx;
- border: none;
- font-size: $font-sm;
- opacity: 0.8;
- float: right;
- }
- .clear{clear: both;overflow: hidden;}
- .type {
- position: absolute;
- top: 26upx;
- left: -10upx;
- border: none;
- font-size: $font-sm;
- opacity: 0.8;
- }
- .un-read {
- display: inline-block;
- width: 12upx;
- height: 12upx;
- border-radius: 50%;
- position: absolute;
- top: 32upx;
- right: 30upx;
- }
- }
- }
- .notify-empty {
- position: fixed;
- left: 0;
- top: 0;
- width: 100%;
- height: 100vh;
- padding-bottom: 100upx;
- display: flex;
- justify-content: center;
- flex-direction: column;
- align-items: center;
- background: #fff;
- .iconfont {
- font-size: $font-lg + 100upx;
- }
- .empty-tips {
- display: flex;
- font-size: $font-sm + 2upx;
- color: $font-color-disabled;
- .navigator {
- margin-left: 16upx;
- }
- }
- }
- .works-empty {
- position: fixed;
- left: 0;
- top: 0;
- width: 100%;
- height: 100vh;
- padding-bottom: 100upx;
- display: flex;
- justify-content: center;
- flex-direction: column;
- align-items: center;
- background: #fff;
- .iconfont {
- font-size: $font-lg + 100upx;
- }
- .empty-tips {
- display: flex;
- font-size: $font-sm + 2upx;
- color: $font-color-disabled;
- .navigator {
- margin-left: 16upx;
- }
- }
- }
- }
- </style>
|