app_evaluating/pages/index/index.vue
2020-01-13 17:08:20 +08:00

254 lines
6.0 KiB
Vue

<template>
<view>
<view class="content" v-for="(evaluation,index) in evaluations" :key="index" @tap="itemClick(evaluation)"
:data-taskid="evaluation.taskId">
<view class="item-li">
<view class="item-title">{{index + 1}}.{{evaluation.taskName}}</view>
<view class="item-content">{{evaluation.evaluationName}}</view>
<view class="item-bottom-box">
<view class="item-tag-box">
<view class="item-time">
{{evaluation.taskStartTime.substring(0, 10)}}至{{evaluation.taskEndTime.substring(0, 10)}}
</view>
<view class="item-tag">
<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 class="item-count-tag">
<view class="item-count-yet">{{evaluation.taskRecordSubmitCount.substring(0,evaluation.taskRecordSubmitCount.lastIndexOf('|'))}}
</view>
<text style="color: #FFFFFF;" space="emsp" decode="true">{{divider}}</text>
<view class="item-count-not">
{{evaluation.taskRecordSubmitCount.substring(evaluation.taskRecordSubmitCount.lastIndexOf('未'),evaluation.taskRecordSubmitCount.length)}}</view>
</view>
</view>
</view>
</view>
<yomol-upgrade :type="upgradeType" :url="upgradeUrl" title="发现新版本" :content="upgradeContent" ref="yomolUpgrade"></yomol-upgrade>
</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'
import yomolUpgrade from '@/components/yomol-upgrade/yomol-upgrade.vue'
var _self;
export default {
components: {
uniList,
uniListItem,
uniLoadMore,
yomolUpgrade
},
data() {
return {
token: '',
/* 版本更新 */
upgradeType: 'pkg', //pkg 整包 wgt 升级包
upgradeContent: '', //更新内容
upgradeUrl: '', //更新地址
divider: '&nbsp;|&nbsp;',
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();
_self.checkAppVersion();
},
onPullDownRefresh() {
var self = this;
uni.startPullDownRefresh({});
self.initData();
},
methods: {
checkAppVersion() {
var versionUrl = common.userCenterBaseUrl +
'/app/appversion/getappversionnumber/240fbf7a-aa32-4cde-9674-5147a7d5eb2f'
var downloadUrl = common.userCenterBaseUrl + '/app/appversion/downloadapp/240fbf7a-aa32-4cde-9674-5147a7d5eb2f'
uni.request({
url: versionUrl,
header: {
'token': _self.token
},
success(res) {
plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
var appId = wgtinfo.appid;
var appVersion = wgtinfo.versionCode;
if (res.data.data && res.data.data > appVersion) {
_self.upgradeType = 'pkg'
_self.upgradeContent = "新增部分更能,请更新;"
_self.upgradeUrl = downloadUrl
_self.$refs.yomolUpgrade.show()
} else {
}
});
},
fail(error) {
}
})
},
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) {
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 {
width: 100%;
display: flex;
margin-top: 20rpx;
flex-direction: column;
align-items: center;
justify-content: center;
}
.item-count {
font-size: 15rpx;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
.item-li {
display: flex;
flex-direction: column;
height: auto;
justify-content: space-between;
align-items: flex-start;
min-width: 50%;
width: 95%;
min-width: 95%;
min-height: 180rpx;
margin: 10rpx;
background: #FFFFFF;
padding: 5rpx;
border-radius: 10rpx;
box-shadow: 8rpx 8rpx 10rpx #d9d9d9;
}
.item-title {
font-size: 28rpx;
font-weight: bold;
color: #000000;
}
.item-content {
font-size: 30rpx;
color: #000000;
}
.item-count-tag {
display: flex;
font-size: 20rpx;
color: #000000;
background: #008B8B;
padding: 10rpx;
height: 35rpx;
align-items: center;
text-align: center;
border-radius: 10rpx;
box-shadow: 8rpx 8rpx 10rpx #d9d9d9;
}
.item-count-yet {
color: #FFFFFF;
}
.item-count-not {
color: #f9e9c3;
}
.item-tag-box {
display: flex;
flex-direction: column;
align-items: flex-start;
}
.item-bottom-box {
display: flex;
margin-top: 15rpx;
flex-direction: row;
align-items: center;
justify-content: space-between;
width: 97%;
}
.item-time {
font-size: 25rpx;
color: #000000;
}
.item-tag {
display: flex;
justify-content: center;
align-items: flex-start;
text-align: left;
font-size: 25rpx;
}
</style>