examTeamApp/pages/PublicCards/PublicCards.vue

422 lines
9.1 KiB
Vue

<template>
<view class="content ">
<view class="tabbar">
<scroll-view class="scroll-menu" scroll-x="true" style="white-space: nowrap;">
<view v-for="(item,index) in labelList" :class="[active==index?'active':'']"
@click="handleActive(item,index)">
<text>{{item}}</text>
</view>
</scroll-view>
</view>
<!-- -->
<view class="desc">
<view class="statuevue">
<view class="bi">
<view class="peobox" :style="'left:'+Number(offset)+'%'">
<view class="xx"></view>
</view>
<view class="item" v-for="(ite,ind) in lineList" :key="ind" :style="{backgroundColor:ite.color}">
<view class="span1">{{ite.text}}</view>
<view class="span" v-if="ind<lineList.length-1">{{ite.max_val}}</view>
</view>
</view>
</view>
</view>
<!-- -->
<view v-for="(ite,ind) in label_data" v-if="active == ind">
<view class="info">
<view class="table">
<text class="time">{{ite.record_time}}</text>
<text class="name2">训练成绩为</text>
</view>
<view class="left">
<view class="left_view">
<view class="title">{{ite.this_time_title}}:</view>
<view class="val">
<text class="yello"></text>
{{ite.this_time_value?ite.this_time_value:'-'}}
</view>
</view>
<view class="left_view">
<view class="title">{{ite.today_time_title}}:</view>
<view class="val">
<text class="yello"></text>
{{ite.today_time_value?ite.today_time_value:'-'}}
</view>
</view>
<view class="left_view">
<view class="title"></view>
<view class="val">
<text class="blues yello"></text>
{{ite.today_times?ite.today_times:'-'}}
</view>
</view>
<view class="left_view">
<view class="title">{{ite.all_time_title}}:</view>
<view class="val">
<text class="yello"></text>
{{ite.all_time_value?ite.all_time_value:'-'}}
</view>
</view>
<view class="left_view">
<view class="title"></view>
<view class="val">
<text class="blues yello"></text>
{{ite.all_times?ite.all_times:'-'}}
</view>
</view>
</view>
<view class="right">
<view class="charts">
<qiun-data-charts type="arcbar" :chartData="chartData" :Height="130" :Width="130" :canvas2d="true"/>
<view class="name">{{ite.score?ite.score:'-'}}</view>
</view>
<view class="standard" v-if="ite.standard">
<text :style="{backgroundColor:ite.color}">{{ite.standard}}</text>
</view>
<view v-if="ite.max_score" class="size12 c999"> 总成绩为{{ite.max_score}}分</view>
</view>
</view>
<!-- 说明 -->
<view class="info describe" v-if="ite.describe">
{{ite.describe}}
</view>
</view>
<!-- -->
<view class="gridList">
<view class="data">
<view class="item" @click="navTo('/pageTwo/PublicCards/charts?acd_id='+acd_id)">
<view class="image">
<image src="@/static/charts.png"></image>
</view>
<view class="name">{{$t("common.titleCharts")}}</view>
</view>
<view class="item" @click="navTo('/pageTwo/PublicCards/history?acd_id='+acd_id)">
<view class="image">
<image src="@/static/add.png"></image>
</view>
<view class="name">{{$t("common.titleHistory")}}</view>
</view>
<view class="item" @click="navTo('/pageTwo/PublicCards/contrast?acd_id='+acd_id)">
<view class="image">
<image src="@/static/pk.png"></image>
</view>
<view class="name">{{$t("common.titleContrast")}}</view>
</view>
<view class="item" @click="$store.commit('changePublicAdd',true)">
<view class="image">
<image src="@/static/history.png"></image>
</view>
<view class="name">{{$t("common.btnAdd")}}{{$t("common.titleHome")}}</view>
</view>
</view>
</view>
<!-- 手动记录 -->
<publicAdd :rtype='acd_id' :active="active"></publicAdd>
</view>
</template>
<script>
import {
mapState
} from "vuex";
import publicAdd from '@/element/manuallyAdd/publicAdd.vue';
import qiunDataCharts from '@/uni_modules/qiun-data-charts/components/qiun-data-charts/qiun-data-charts.vue';
export default {
data() {
return {
active: 0,
acd_id: null,
lineList: [],
label_data: [],
offset: 0,
labelName: "",
chartData: {
series: [{
name: "正确率",
color: "#4687F9",
data: 0
}]
},
}
},
components: {
publicAdd,
qiunDataCharts
},
computed: {
...mapState(["PublicContent"]),
labelList() {
let that = this
if (that.PublicContent) {
that.labelName = that.PublicContent.label_list[that.active]
that.lineList = that.PublicContent.line_list
that.label_data = that.PublicContent.label_data
that.offset = that.PublicContent.label_data[that.active].offset
that.chartData.series[0].data = that.PublicContent.label_data[that.active].score.split('分')[0]/that.PublicContent.label_data[that.active].max_score
}
return that.PublicContent ? that.PublicContent.label_list : []
},
},
onLoad(options) {
let that = this
that.acd_id = options.acd_id
that.$store.dispatch("getPublicContent", {
acd_id: that.acd_id,
aud_id: uni.getStorageSync('userid')
})
},
methods: {
handleActive(ite, ind) {
let that = this
that.active = ind
that.labelName = ite
that.offset = that.label_data[ind].offset
that.chartData.series[0].data = Number(that.label_data[ind].offset) / 100
},
// 历史数据删除时重新加载接口
reload() {
let that = this
console.log('返回历史页', that.acd_id)
this.$nextTick(() => {
that.$store.dispatch("getPublicContent", {
acd_id: that.acd_id,
aud_id: uni.getStorageSync('userid')
})
})
},
navTo(url) {
uni.navigateTo({
url: url
})
},
}
}
</script>
<style scoped lang="scss">
.content {
width: calc(100% - 30px);
min-height: calc(100vh - 80px);
padding: 65px 15px 15px;
background-color: #f7f7f7;
}
.tabbar {
display: flex;
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 999;
justify-content: space-between;
border-bottom: 1px solid #f7f7f7;
box-shadow: 0px 1px 5px 2px #dfe2e1fc;
background-color: #fff;
.scroll-menu {
width: 100%;
white-space: nowrap;
view {
height: 55px;
line-height: 55px;
display: inline-block;
min-width: 100px;
margin: 0 10px;
text-align: center;
}
}
.active {
color: $maincolor;
font-weight: bold;
border-bottom: 2px solid $maincolor;
}
}
.desc {
padding: 15px;
text-align: left;
width: calc(100%-20px);
height: auto;
border-radius: 5px;
font-size: 30rpx;
color: #999;
margin-top: 15px;
background: #fff;
.statuevue {
height: 35px;
position: relative;
width: 100% !important;
margin: 20px auto 10px;
.bi {
display: flex;
justify-content: space-between;
width: auto;
padding-top: 10px;
.peobox {
position: absolute;
right: 0;
top: -1px;
.xx {
width: 5px;
height: 5px;
border-radius: 50%;
background: #fff;
position: absolute;
z-index: 9;
border: 2px solid #1b2086;
top: 9px;
}
}
}
.item {
position: relative;
margin: 0;
flex: 1;
height: 5px;
color: #666;
font-size: 30rpx;
.span1 {
width: 100%;
text-align: center;
position: absolute;
top: -23px;
}
.span {
margin-top: 8px;
position: absolute;
right: -8px;
}
}
}
}
.describe {
color: #666;
font-size: 28rpx;
line-height: 25px;
}
.info {
background-color: #fff;
padding: 15px;
margin-top: 15px;
border-radius: 5px;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
.table {
width: 100%;
display: flex;
flex-wrap: wrap;
.name2 {
width: 260rpx;
text-align: center;
font-weight: bold;
font-size: 36rpx;
}
.time {
width: calc(100% - 260rpx);
color: #999;
font-size: 32rpx;
margin-bottom: 5px;
display: inline-block;
}
}
.left {
width: calc(100% - 280rpx);
display: flex;
flex-wrap: wrap;
.left_view {
width: 100%;
display: flex;
align-items: center;
}
.title {
width: 80px;
font-weight: bold;
margin-right: 10px;
}
}
.right {
width: 260rpx;
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: center;
.charts {
width: 260upx;
height: 260upx;
margin: 10px 0;
position: relative;
display: flex;
align-items: center;
justify-content: center;
z-index: 9;
.name {
width: 100%;
text-align: center;
font-size: 56rpx;
color: #4687F9;
position: absolute;
}
}
.title {
width: 100%;
text-align: center;
}
}
}
.standard {
width: 100%;
text-align: center;
margin-top: 0px;
margin-bottom: 8px;
text {
width: 100px;
color: #fff;
font-size: 14px;
padding: 2px 10px;
border-radius: 5px;
}
}
.yello {
width: 8px;
height: 8px;
border-radius: 50%;
display: inline-block;
margin-right: 5px;
background-color: $btncolor;
}
.blues {
background-color: $maincolor;
}
.gridList {
margin: 0;
}
</style>