app_evaluating/pages/index/index.vue
itgaojian163 a70dce6f44 适配H5
2023-02-07 21:47:50 +08:00

333 lines
8.2 KiB
Vue
Executable File

<template>
<view>
<view class="search">
<view class="input-box">
<input class="input-font" placeholder="请输入关键字" type="text" v-model="keyword"
placeholder-class="input-placeholder" />
<image src="../../static/ic_search.png" style="width: 70rpx;height: 70rpx;margin-right: 20rpx;"></image>
</view>
</view>
<view v-if="evaluations.length>0"
style="display: flex;flex-direction: column;justify-content: center;width: 100%;">
<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">
<view v-if="evaluation.taskType === 1" style="display: flex;flex-direction: row;">
<view style="color: #000000;">{{evaluation.taskTypeContent.split('|')[1]}} </view>
<view style="color: #757575;"><text>&nbsp;</text>[被测评部门]</view>
</view>
<view v-if="evaluation.taskType === 2" style="display: flex;flex-direction: row;">
<view style="color: #000000;">{{evaluation.taskTypeContent.split('|')[2]}}</view>
<view style="color: #757575;"><text>&nbsp;</text>[被测评人员]</view>
</view>
</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>
</view>
<view v-else>
<emptyView></emptyView>
</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: '没有更多数据了'
}
}
},
onShow() {
var appToken = uni.getStorageSync('appToken');
if (!appToken) {
uni.reLaunch({
url: '../login/index'
});
}
_self.token = appToken
// console.log(_self.token);
uni.startPullDownRefresh({});
// _self.initData();
},
onLoad() {
_self = this;
var appToken = uni.getStorageSync('appToken');
if (!appToken) {
uni.reLaunch({
url: '../login/index'
});
}
_self.token = appToken
// #ifdef APP-PLUS
_self.checkAppVersion();
// #endif
},
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() {
uni.showLoading({
title: '加载中...',
})
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();
uni.hideLoading()
if (res.data != undefined && res.data.length > 0) {
_self.evaluations = res.data
} else {
// uni.showToast({
// title: '暂无数据',
// duration: 1000
// })
_self.evaluations = [];
}
},
fail(error) {
uni.hideLoading()
uni.stopPullDownRefresh();
uni.showToast({
title: '加载失败,请重试',
duration: 2000
})
_self.evaluations = [];
}
})
},
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;
}
.search {
width: 100%;
position: relative;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
z-index: 999;
position: fixed;
top: 0;
background-color: #FFFFFF;
}
.input-box {
margin-top: 10rpx;
width: 90%;
min-height: 50rpx;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
background-color: #F5F5F5;
border: #666666 solid #555555;
border-radius: 20rpx;
}
.input-font {
color: #000000;
width: 90%;
margin-left: 10rpx;
padding-left: 10rpx;
align-self: center;
font-size: 30rpx;
min-height: 50rpx;
border: #666666 solid #555555;
border-radius: 15rpx;
}
.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;
align-self: center;
justify-content: space-between;
align-items: flex-start;
width: 92%;
min-height: 180rpx;
background: #FFFFFF;
/* background: #008B8B; */
padding: 15rpx;
border-radius: 10rpx;
box-shadow: 3rpx 3rpx 5rpx #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: 100%;
}
.item-time {
font-size: 25rpx;
color: #000000;
}
.item-tag {
color: #888888;
display: flex;
justify-content: center;
align-items: flex-start;
text-align: left;
font-size: 25rpx;
}
</style>