app_evaluating/pages/index/index.vue

169 lines
4.0 KiB
Vue
Raw Normal View History

2020-01-09 16:29:09 +08:00
<template>
<view class="content">
<uni-list class="task-content">
<uni-list-item :showArrow="false" v-for="(evaluation,index) in evaluations" :key="index" @tap="itemClick(evaluation)"
:data-taskid="evaluation.taskId">
<view class="task-content-item task-name">{{index + 1}}.{{evaluation.taskName}}</view>
<view class="task-content-item evalutaion-name">{{evaluation.evaluationName}}</view>
<view style="display: flex;flex-direction: row;justify-content: space-between;align-items: center;">
<view>{{evaluation.taskRecordSubmitCount}}</view>
<view>
<view class="task-content-item task-time">{{evaluation.taskStartTime.substring(0, 10)}} ~
{{evaluation.taskEndTime.substring(0, 10)}}</view>
<view class="task-content-item task-type">
<text v-if="evaluation.taskType === 1">{{evaluation.taskTypeContent.split('|')[1]}} [测评部门]</text>
<text v-if="evaluation.taskType === 2">{{evaluation.taskTypeContent.split('|')[2]}} [测评人员]</text>
</view>
</view>
</view>
</uni-list-item>
</uni-list>
<!-- <uni-load-more v-if="evaluations.length >= 20" :status="more" @clickLoadMore="clickLoadMore" :contentText="uploadContentText"></uni-load-more> -->
</view>
</template>
<script>
import uniList from "@/components/uni-list/uni-list.vue"
import uniListItem from "@/components/uni-list-item/uni-list-item.vue"
import uniLoadMore from "@/components/uni-load-more/uni-load-more.vue"
import common from '../../common/common.js'
var _self;
export default {
components: {
uniList,
uniListItem,
uniLoadMore
},
data() {
return {
token: '',
evaluations: [],
more: 'more',
uploadContentText: {
contentdown: '点击加载更多',
contentrefresh: '正在加载...',
contentnomore: '没有更多数据了'
}
}
},
onLoad() {
_self = this;
var appToken = uni.getStorageSync('appToken');
if (!appToken) {
uni.reLaunch({
url: '../login/index'
});
}
_self.token = appToken;
uni.startPullDownRefresh({});
_self.initData();
},
onPullDownRefresh() {
var self = this;
uni.startPullDownRefresh({});
self.initData();
// setTimeout(() => {
// uni.stopPullDownRefresh();
// }, 1000);
},
methods: {
initData() {
var self = this;
var listUrl = common.evalutaionBaseUrl + '/app/apptask/listtasktoapp';
uni.request({
url: listUrl,
data: {
taskRecordIsSubmit: '0'
},
header: {
'token': _self.token
},
success(res) {
uni.stopPullDownRefresh();
if (res.data != undefined && res.data.length > 0) {
_self.evaluations = res.data
} else {
uni.showToast({
title: '暂无数据',
duration: 2000
})
}
},
fail(error) {
uni.stopPullDownRefresh();
uni.showToast({
title: '加载失败,请重试',
duration: 2000
})
}
})
},
itemClick(e) {
console.log(e);
uni.navigateTo({
url: '../evaluation/doEvaluation?taskId=' + e.taskId
})
},
clickLoadMore(e) {
var self = this;
self.more = 'loading';
setTimeout(() => {
self.more = 'noMore';
setTimeout(() => {
self.more = 'more';
}, 1000);
}, 2000);
}
}
}
</script>
<style>
.content {
display: flex;
flex-direction: column;
/* align-items: center;
justify-content: center; */
}
.content .task-content {}
.content .task-content .task-content-item {
padding: 5upx 0;
}
.content .task-content .task-count {
text-align: left|center;
font-size: 25upx;
}
.content .task-content-hover {
background-color: #effaff;
}
.content .task-content:last-child {
border: none;
}
.content .task-content .task-name {
font-size: 30upx;
font-weight: bold;
}
.content .task-content .evalutaion-name {
font-size: 30upx;
}
.content .task-content .task-time {
text-align: right;
font-size: 25upx;
}
.content .task-content .task-type {
text-align: right;
font-size: 25upx;
}
</style>