创建版本

This commit is contained in:
2021-02-22 12:17:00 +08:00
commit af555f49c3
2332 changed files with 369202 additions and 0 deletions
+295
View File
@@ -0,0 +1,295 @@
<template>
<view>
<view class="header" id="header">
<scroll-view id="tab-bar" class="scroll-h" :scroll-x="true" :show-scrollbar="false">
<view v-for="(tab, index) in tabBars" :key="index" class="uni-tab-item" :id="tab.id" @click="ontabtap(index)">
<text class="uni-tab-item-title" :class="tabIndex == index ? 'uni-tab-item-title-active' : ''">{{tab.name}}</text>
</view>
</scroll-view>
<view class="search-controller">
<uni-search-bar radius="50" placeholder="搜索主题或文号" @confirm="search" />
</view>
<view class="line-h"></view>
</view>
<view class="uni-list uni-list-controller" :style="'margin-top:' + listTop + 'px;'">
<view class="uni-list-cell" hover-class="uni-list-cell-hover" v-for="(row, key) in tabBars[tabIndex].data" :key="key" @click="goDetail(row)">
<view class="uni-media-list">
<view class="uni-media-list-body">
<view class="uni-media-list-text-top">{{ row.title }}</view>
<view class="uni-media-list-text-bottom">
<text class="desc">{{ row.name }}</text>
<text class="desc">{{ row.step.name }}</text>
</view>
</view>
</view>
</view>
</view>
<uni-load-more :status="tabBars[tabIndex].status" :icon-size="16" :content-text="tabBars[tabIndex].contentText" />
</view>
</template>
<script>
import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
export default {
components: {
uniLoadMore
},
data() {
return {
tabIndex: 0,
listTop: 103,
tabBars: [{
name: '待办中',
id: 'todo',
page: 1,
data: [],
status: 'more',
contentText: {
contentdown: '上拉加载更多',
contentrefresh: '加载中',
contentnomore: '没有更多'
}
}, {
name: '已办理',
id: 'trans',
page: 1,
data: [],
status: 'more',
contentText: {
contentdown: '上拉加载更多',
contentrefresh: '加载中',
contentnomore: '没有更多'
}
}, {
name: '已结束',
id: 'done',
page: 1,
data: [],
status: 'more',
contentText: {
contentdown: '上拉加载更多',
contentrefresh: '加载中',
contentnomore: '没有更多'
}
}],
reload: false
};
},
onLoad() {
var me = this;
me.getList(0);
},
mounted() {
let me = this;
uni.createSelectorQuery().in(this).select('#header').boundingClientRect(function(e) {
me.listTop = e.height - 1;
}).exec();
},
onPullDownRefresh() {
let me = this;
me.reload = true;
let tab = me.tabBars[me.tabIndex];
tab.page = 1;
tab.status = 'more';
me.getList(me.tabIndex);
},
onReachBottom() {
let me = this;
let tab = me.tabBars[me.tabIndex];
if (tab.status == 'noMore') {
return;
}
tab.status = 'more';
this.getList(me.tabIndex);
},
methods: {
ontabtap(index) {
var me = this;
me.tabIndex = index;
this.switchTab(index);
},
switchTab(index) {
var me = this;
let tab = me.tabBars[index];
if (tab.data.length == 0) {
me.getList(index);
}
},
formatDate(value) {
return dateUtils.formatDate(value);
},
getList(index) {
var me = this;
let tab = me.tabBars[index];
if (tab.status == 'noMore') {
if (me.reload) {
me.reload = false;
uni.stopPullDownRefresh();
}
return;
}
me.$api.post('workflow/workflow/index', {option: tab.id, page: tab.page}).then(res => {
if (me.reload) {
tab.data = [];
me.reload = false;
uni.stopPullDownRefresh();
}
tab.data = tab.data.concat(res.data);
if (res.current_page >= res.last_page) {
tab.status = 'noMore';
} else {
tab.page = res.current_page + 1;
}
}).catch(error => {
});
},
goDetail: function(row) {
uni.navigateTo({
url: '/pages/webview?title=流程详情&url=' + encodeURIComponent('workflow/workflow/edit?process_id=' + row.process_id),
});
}
}
};
</script>
<style>
page {
width: 100%;
height: 100%;
display: flex;
flex-wrap: wrap;
align-items: flex-start;
justify-content: center;
background: rgba(249, 249, 249, 1);
}
.header {
position: fixed;
top: 0;
right: 0;
left: 0;
z-index: 100;
background: #fff;
width: 100vw;
}
.uni-list-controller {
width: 100vw;
}
.uni-media-list-logo {
width: 140rpx;
height: 140rpx;
}
.uni-media-list-body {
height: auto;
justify-content: space-around;
}
.uni-media-list-text-top {
font-size: 28rpx;
overflow: hidden;
}
.uni-media-list-text-bottom {
/*
display: flex;
flex-direction: row;
justify-content: space-between;
*/
margin-top: 15rpx;
}
.uni-media-list-text-bottom .desc {
margin-bottom: 15rpx;
display: block;
}
.uni-media-list-text-bottom .desc:last-child {
margin-bottom: 0;
}
.tabs {
flex: 1;
flex-direction: column;
overflow: hidden;
background-color: #ffffff;
height: 100vh;
}
.scroll-h {
width: 750rpx;
height: 80rpx;
flex-direction: row;
white-space: nowrap;
align-items: center;
border-bottom: 1px solid #c8c7cc;
}
.line-h {
height: 1rpx;
background-color: #cccccc;
}
.uni-tab-item {
display: inline-block;
/*
padding-left: 70rpx;
padding-right: 70rpx;
*/
text-align: center;
width: 33.33333%;
}
.uni-tab-item-title {
color: #555;
font-size: 30rpx;
height: 80rpx;
line-height: 80rpx;
flex-wrap: nowrap;
white-space: nowrap;
}
.uni-tab-item-title-active {
color: #007AFF;
}
.swiper-box {
flex: 1;
height: 50vh;
}
.swiper-item {
flex: 1;
flex-direction: row;
}
.scroll-v {
flex: 1;
width: 750rpx;
}
.search-controller {
padding: 10rpx;
}
.search-result {
margin-top: 10px;
margin-bottom: 20px;
text-align: center;
}
.search-result-text {
text-align: center;
font-size: 14px;
}
</style>
+409
View File
@@ -0,0 +1,409 @@
<template>
<view class="tabs">
<view class="header">
<scroll-view id="tab-bar" class="scroll-h" :scroll-x="true" :show-scrollbar="false">
<view v-for="(tab, index) in tabBars" :key="index" class="uni-tab-item" :id="tab.id" :data-current="index" @click="ontabtap">
<text class="uni-tab-item-title" :class="tabIndex == index ? 'uni-tab-item-title-active' : ''">{{tab.name}}</text>
</view>
</scroll-view>
<view class="search-controller">
<uni-search-bar radius="50" placeholder="搜索主题或文号" @confirm="search" />
</view>
</view>
<view class="line-h"></view>
<swiper :current="tabIndex" class="swiper-box" style="flex:1;" :duration="300" @change="ontabchange">
<swiper-item class="swiper-item" v-for="(tab, index1) in newsList" :key="index1">
<!-- #ifndef APP-NVUE -->
<scroll-view class="scroll-v list" :show-scrollbar="true" refresher-enabled="true" enableBackToTop="true" scroll-y @scrolltolower="loadMore(index1)">
<view v-for="(newsitem, index2) in tab.data" :key="index2">
<media-item :options="newsitem" @click="goDetail(newsitem)"></media-item>
</view>
<view class="loading-more" v-if="tab.isLoading">
<text class="loading-more-text">{{tab.loadingText}}</text>
</view>
</scroll-view>
<!-- #endif -->
</swiper-item>
</swiper>
</view>
</template>
<script>
import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
import mediaItem from '@/pages/app/workflow/item.nvue';
import {dateUtils} from '@/util.js';
export default {
components: {
uniLoadMore,
mediaItem
},
data() {
return {
newsList: [],
cacheTab: [],
tabIndex: 0,
tabBars: [{
name: '待办中',
id: 'todo'
}, {
name: '已办理',
id: 'trans'
}, {
name: '已结束',
id: 'done'
}],
page: 1,
scrollInto: "",
showTips: false,
navigateFlag: false,
pulling: false,
refreshIcon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAB5QTFRFcHBw3Nzct7e39vb2ycnJioqK7e3tpqam29vb////D8oK7wAAAAp0Uk5T////////////ALLMLM8AAABxSURBVHja7JVBDoAgDASrjqj//7CJBi90iyYeOHTPMwmFZrHjYyyFYYUy1bwUZqtJIYVxhf1a6u0R7iUvWsCcrEtwJHp8MwMdvh2amHduiZD3rpWId9+BgPd7Cc2LIkPyqvlQvKxKBJ//Qwq/CacAAwDUv0a0YuKhzgAAAABJRU5ErkJggg=="
};
},
onLoad() {
var me = this;
me.tabBars.forEach((tabBar) => {
me.newsList.push({
data: [],
page: 1,
isLoading: false,
isComplete: false,
refreshText: "",
loadingText: '加载更多...'
});
});
this.getList(0);
},
methods: {
loadMore(e) {
this.getList(this.tabIndex);
},
ontabtap(e) {
var me = this;
let index = e.target.dataset.current || e.currentTarget.dataset.current;
// this.switchTab(index);
me.tabIndex = index;
//me.scrollInto = me.tabBars[index].id;
},
ontabchange(e) {
let index = e.target.current || e.detail.current;
this.switchTab(index);
},
switchTab(index) {
var me = this;
me.getList(index);
console.log(22);
/*
// 缓存 tabId
if (this.newsList[this.tabIndex].data.length > MAX_CACHE_DATA) {
let isExist = this.cacheTab.indexOf(this.tabIndex);
if (isExist < 0) {
this.cacheTab.push(this.tabIndex);
//console.log("cache index:: " + this.tabIndex);
}
}
*/
me.tabIndex = index;
me.scrollInto = me.tabBars[index].id;
/*
// 释放 tabId
if (this.cacheTab.length > MAX_CACHE_PAGE) {
let cacheIndex = this.cacheTab[0];
this.clearTabData(cacheIndex);
this.cacheTab.splice(0, 1);
//console.log("remove cache index:: " + cacheIndex);
}
*/
},
clearTabData(e) {
this.newsList[e].data.length = 0;
this.newsList[e].loadingText = "加载更多...";
},
refreshData() {
},
onrefresh(e) {
var tab = this.newsList[this.tabIndex];
if (!tab.refreshFlag) {
return;
}
tab.refreshing = true;
tab.refreshText = "正在刷新...";
setTimeout(() => {
this.refreshData();
this.pulling = true;
tab.refreshing = false;
tab.refreshFlag = false;
tab.refreshText = "已刷新";
setTimeout(() => { // TODO fix ios和Android 动画时间相反问题
this.pulling = false;
}, 500);
}, 2000);
},
onpullingdown(e) {
var tab = this.newsList[this.tabIndex];
if (tab.refreshing || this.pulling) {
return;
}
if (Math.abs(e.pullingDistance) > Math.abs(e.viewHeight)) {
tab.refreshFlag = true;
tab.refreshText = "释放立即刷新";
} else {
tab.refreshFlag = false;
tab.refreshText = "下拉可以刷新";
}
},
formatDate(value) {
return dateUtils.formatDate(value);
},
getList(index) {
var me = this;
let tab = me.newsList[index];
let option = me.tabBars[index].id;
if (tab.isComplete) {
return;
}
me.$api.post('workflow/workflow/index', {option: option, page: tab.page}).then(res => {
tab.data = tab.data.concat(res.data);
uni.stopPullDownRefresh();
if (res.current_page >= res.last_page) {
tab.isComplete = true;
} else {
tab.page = res.current_page + 1;
}
}).catch(error => {
});
},
goDetail: function(e) {
// if (!/前|刚刚/.test(e.published_at)) {
// e.published_at = dateUtils.format(e.published_at);
// }
let detail = {
author_name: e.author_name,
cover: e.cover,
id: e.id,
post_id: e.post_id,
published_at: e.published_at,
title: e.title
};
uni.navigateTo({
url: '../list2detail-detail/list2detail-detail?detailDate=' + encodeURIComponent(JSON.stringify(detail))
});
},
setTime: function(items) {
var newItems = [];
items.forEach(e => {
newItems.push({
author_name: e.author_name,
cover: e.cover,
id: e.id,
post_id: e.post_id,
published_at: dateUtils.format(e.published_at),
title: e.title
});
});
return newItems;
}
}
};
</script>
<style>
.uni-media-list-logo {
width: 140rpx;
height: 140rpx;
}
.uni-media-list-body {
height: auto;
justify-content: space-around;
}
.uni-media-list-text-top {
height: 50rpx;
font-size: 28rpx;
overflow: hidden;
}
.uni-media-list-text-bottom {
/*
display: flex;
flex-direction: row;
justify-content: space-between;
*/
}
.uni-media-list-text-bottom .desc {
margin-bottom: 15rpx;
display: block;
}
.uni-media-list-text-bottom .desc:last-child {
margin-bottom: 0;
}
.tabs {
flex: 1;
flex-direction: column;
overflow: hidden;
background-color: #ffffff;
height: 100vh;
}
.scroll-h {
width: 750rpx;
height: 80rpx;
flex-direction: row;
white-space: nowrap;
align-items: center;
border-bottom: 1px solid #c8c7cc;
}
.line-h {
height: 1rpx;
background-color: #cccccc;
}
.uni-tab-item {
display: inline-block;
/*
padding-left: 70rpx;
padding-right: 70rpx;
*/
text-align: center;
width: 33.33333%;
}
.uni-tab-item-title {
color: #555;
font-size: 30rpx;
height: 80rpx;
line-height: 80rpx;
flex-wrap: nowrap;
white-space: nowrap;
}
.uni-tab-item-title-active {
color: #007AFF;
}
.swiper-box {
flex: 1;
height: 50vh;
}
.swiper-item {
flex: 1;
flex-direction: row;
}
.scroll-v {
flex: 1;
/* #ifndef MP-ALIPAY */
flex-direction: column;
/* #endif */
width: 750rpx;
}
.update-tips {
position: absolute;
left: 0;
top: 41px;
right: 0;
padding-top: 5px;
padding-bottom: 5px;
background-color: #FDDD9B;
align-items: center;
justify-content: center;
text-align: center;
}
.update-tips-text {
font-size: 14px;
color: #ffffff;
}
.refresh {
width: 750rpx;
height: 64px;
justify-content: center;
}
.refresh-view {
flex-direction: row;
flex-wrap: nowrap;
align-items: center;
justify-content: center;
}
.refresh-icon {
width: 30px;
height: 30px;
transition-duration: .5s;
transition-property: transform;
transform: rotate(0deg);
transform-origin: 15px 15px;
}
.refresh-icon-active {
transform: rotate(180deg);
}
.loading-icon {
width: 20px;
height: 20px;
margin-right: 5px;
color: #999999;
}
.loading-text {
margin-left: 2px;
font-size: 16px;
color: #999999;
}
.loading-more {
align-items: center;
justify-content: center;
padding-top: 10px;
padding-bottom: 10px;
text-align: center;
}
.loading-more-text {
font-size: 28rpx;
color: #999;
}
.search-controller {
padding: 10rpx;
}
.search-result {
margin-top: 10px;
margin-bottom: 20px;
text-align: center;
}
.search-result-text {
text-align: center;
font-size: 14px;
}
</style>
+207
View File
@@ -0,0 +1,207 @@
<template>
<!-- remove list-cell layer fix android 4.x overflow limit error: 28 layers! -->
<!-- <view class="list-cell view" @click="click"></view> -->
<view class="media-item view" hover-class="media-item-hover" v-if="options.title" @click="click">
<!-- <view class="view" :style="options.article_type === 2 ? 'flex-direction: row';" :class="{'media-image-right': options.article_type === 2, 'media-image-left': options.article_type === 1}"> -->
<!-- TODO 在支付宝小程序下 需要用 style 覆盖标签的默认样式 -->
<view class="view" :style="{flexDirection: (options.article_type === 1 || options.article_type === 2)?(options.article_type === 2 ?'row':'row-reverse'):'column' }">
<text class="media-title" :class="{'media-title2': options.article_type === 1 || options.article_type === 2}">{{options.title}}</text>
<view v-if="options.image_list || options.image_url" class="image-section flex-row" :class="{'image-section-right': options.article_type === 2, 'image-section-left': options.article_type === 1}"
:style="{flexDirection: 'row' }">
<image class="image-list1" :class="{'image-list2': options.article_type === 1 || options.article_type === 2}" v-if="options.image_url"
:src="options.image_url"></image>
<image class="image-list3" v-if="options.image_list" :src="source.url" v-for="(source, i) in options.image_list"
:key="i" />
</view>
</view>
<view class="media-foot flex-row" style="flex-direction: row;">
<view class="media-info flex-row" style="flex-direction: row;">
<text class="info-text">{{options.source}}</text>
<text class="info-text">{{options.comment_count}}条评论</text>
<text class="info-text">{{options.datetime}}</text>
</view>
<!--
<view class="max-close-view" @click.stop="close">
<view class="close-l close-h"></view>
<view class="close-l close-v"></view>
</view>
-->
</view>
<view class="media-item-line" style="position: absolute;"></view>
</view>
</template>
<script>
export default {
props: {
options: {
type: Object,
default: function(e) {
return {}
}
}
},
methods: {
click() {
this.$emit('click');
},
close(e) {
this.$emit('close');
}
}
}
</script>
<style>
.view {
flex-direction: column;
}
.flex-row {
flex-direction: row;
}
.flex-col {
flex-direction: column;
}
.list-cell {
width: 750rpx;
padding: 0 30rpx;
}
.uni-list-cell-hover {
background-color: #eeeeee;
}
.media-item {
position: relative;
flex: 1;
flex-direction: column;
/* border-bottom-width: 1rpx;
border-bottom-style: solid;
border-bottom-color: #ebebeb; */
padding: 20rpx 30rpx 21rpx 30rpx;
}
.media-item-hover{
background-color: #eee;
}
.media-item-line {
position: absolute;
left: 30rpx;
right: 30rpx;
bottom: 0;
height: 1rpx;
background-color: #ebebeb;
}
.media-image-right {
flex-direction: row;
}
.media-image-left {
flex-direction: row-reverse;
}
.media-title {
flex: 1;
}
.media-title {
lines: 3;
text-overflow: ellipsis;
font-size: 30rpx;
color: #555555;
}
.media-title2 {
flex: 1;
margin-top: 6rpx;
line-height: 40rpx;
}
.image-section {
margin-top: 20rpx;
flex-direction: row;
justify-content: space-between;
}
.image-section-right {
margin-top: 0rpx;
margin-left: 10rpx;
width: 225rpx;
height: 146rpx;
}
.image-section-left {
margin-top: 0rpx;
margin-right: 10rpx;
width: 225rpx;
height: 146rpx;
}
.image-list1 {
width: 690rpx;
height: 481rpx;
}
.image-list2 {
width: 225rpx;
height: 146rpx;
}
.image-list3 {
width: 225rpx;
height: 146rpx;
}
.media-info {
flex-direction: row;
align-items: center;
}
.info-text {
margin-right: 20rpx;
color: #999999;
font-size: 24rpx;
}
.media-foot {
margin-top: 25rpx;
flex-direction: row;
align-items: center;
justify-content: space-between;
}
.max-close-view {
position: relative;
align-items: center;
flex-direction: row;
width: 40rpx;
height: 30rpx;
line-height: 30rpx;
border-width: 1rpx;
border-style: solid;
border-color: #aaaaaa;
border-radius: 4px;
justify-content: center;
text-align: center;
}
.close-l {
position: absolute;
width: 18rpx;
height: 1rpx;
background-color: #aaaaaa;
}
.close-h {
transform: rotate(45deg);
}
.close-v {
transform: rotate(-45deg);
}
</style>