123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636 |
- <template>
- <view class="content">
- <view class="list-box" v-if="userInfo.user_type==2">
- <view class="list-item" v-for="(item,index) in list"
- @click="navTo('/pages/index/main?id='+item.id+'&pid='+project_id)">
- <view class="list-bg">
- <image :src="baseURL + item.backgroundimage" mode=""></image>
- </view>
- <image class="list-icon" :src="baseURL+item.iocnimage" mode=""></image>
- <view class="list-name">
- {{item.name}}
- </view>
- </view>
- </view>
- <view v-else>
- <view class="top">
- <view class="top-bg">
- <image src="../../static/img/top.png" mode=""></image>
- </view>
- <view class="top-box">
- <view class="top-item" v-for="(item,index) in list" @click="tabClick(index)">
- <view class="top-main">
- <image v-if="tabCurrentIndex == index" class="top-icon" :src="baseURL + item.iconimage"
- mode="">
- </image>
- <image v-if="tabCurrentIndex != index" class="top-icon" :src="baseURL + item.icon2image"
- mode="">
- </image>
- <view class="top-name" :class="{curret:tabCurrentIndex==index}">
- {{item.name}}
- </view>
- </view>
- <image class="jt" v-if="index != list.length -1" src="../../static/img/jt.png" mode=""></image>
- </view>
- </view>
- <swiper :current="tabCurrentIndex" :style="{ height: height }" class="swiper-box" duration="300"
- @change="changeTab">
- <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in list" :key="tabIndex">
- <scroll-view scroll-y="true" style="height: 100%;">
- <view class="student-box flex">
- <view class="student-left">
- <view class="shu">
- </view>
- <view class="student-name">
- 组: <text>{{dquser.group}}</text>
- </view>
- </view>
- <view class="student-right" @click="qh()">
- <view class="student-qh">
- 切换
- </view>
- <image class="student-back" src="../../static/icon/back.png" mode=""></image>
- </view>
- </view>
- <view class="step" v-for="(item,index) in tabItem.item" :key="index">
- <view class="step-top">
- <view class="shu"></view>
- <view class="step-title">{{item.name}}</view>
- </view>
- <view class="step-main flex">
- <view class="step-left">分数(共{{item.max_score}}分)</view>
- <view class="step-right">
- <input class="step-input" type="digit" v-model="item.score"
- :max="item.max_score*1" placeholder-class="place" placeholder="请输入分数">
- <view class="step-font">分</view>
- </view>
- </view>
- <view class="step-info" v-if="item.info">
- <view class="set-info-title">说明:</view>
- <view class="set-info-mian">{{item.info}}</view>
- </view>
- </view>
- <view class="btn" @click="tj(tabItem)">
- 确认提交
- </view>
- <view style="height:50px;">
- </view>
- </scroll-view>
- </swiper-item>
- </swiper>
- </view>
- <uni-popup ref="student" type="bottom">
- <view class="popup-box">
- <view class="popup-title flex">
- <view class="qx" @click="cancel">取消</view>
- <view class="qd" @click="cancel">确定</view>
- </view>
- <view class="popup">
- <scroll-view class="popup-right" scroll-y="true">
- <view v-for="(item,index) in userlist" :key="index" class="popup-right-item"
- :class="{currRight:item.id==dquser.id}" @click="changepeople(item,index)">
- {{item.group}}
- </view>
- <view class="bottom" style="height: 50px"></view>
- </scroll-view>
- </view>
- </view>
- </uni-popup>
- <!-- 111 -->
- </view>
- </view>
- </template>
- <script>
- import {
- mapState,
- mapMutations
- } from 'vuex';
- import * as mTabbar from '@/components/m-tabbar/m-tabbar.vue'
- import {
- getproject,
- new_project,
- misssion,
- user_list,
- score
- } from '@/api/project.js'
- export default {
- data() {
- return {
- id: '',
- list: [],
- userlist: [],
- height: '',
- dquser: '',
- dqdjg: '',
- tabCurrentIndex: 0,
- project_id: '',
- };
- },
- computed: {
- ...mapState('user', ['userInfo', 'hasLogin', 'urlFile']),
- ...mapState(['baseURL'])
- },
- onLoad() {},
- onShow() {
- if (this.userInfo.user_type != 2) {
- uni.setTabBarItem({
- index: 1,
- "pagePath": "pages/user/grade",
- "iconPath": "../../static/tabbar/tab-grade.png",
- "selectedIconPath": "../../static/tabbar/tab-grade-current.png",
- "text": "我的成绩",
- "visible": true
- });
- } else {
- uni.setTabBarItem({
- index: 1,
- "pagePath": "pages/user/grade",
- "iconPath": "../../static/tabbar/tab-grade.png",
- "selectedIconPath": "../../static/tabbar/tab-grade-current.png",
- "text": "我的成绩",
- "visible": false
- });
- }
- this.loadData()
- },
- onReachBottom() {},
- onReady(res) {
- var _this = this;
- uni.getSystemInfo({
- success: resu => {
- const query = uni.createSelectorQuery();
- query.select('.swiper-box').boundingClientRect();
- query.exec(function(res) {
- _this.height = resu.windowHeight - res[0].top + 'px';
- console.log('打印页面的剩余高度', _this.height);
- });
- },
- fail: res => {}
- });
- },
- methods: {
- loadData() {
- const obj = this
- new_project({}).then(er => {
- if (!er.data.new) {
- this.$api.msg('暂无考试')
- }
- getproject({}, er.data.new.id).then(({
- data
- }) => {
- this.project_id = data.id;
- console.log(data);
- if (this.userInfo.user_type == 2) {
- this.list = data.mission
- } else {
- data.mission.forEach(e => {
- misssion({}, e.id, obj.userInfo.group_id, obj.project_id).then(
- er => {
- if (er.data.step.length != 0) {
- obj.id = er.data.id
- console.log(obj.id);
- obj.studentpf()
- }
- })
- console.log(e);
- })
- }
- })
- })
- },
- qh() {
- this.$refs.student.open()
- },
- cancel() {
- this.$refs.student.close()
- },
- studentpf() {
- user_list({}).then(({
- data
- }) => {
- if (data.length == 0) {
- return this.$api.msg('暂无组员')
- }
- this.dquser = data[0]
- this.dqdjg = 0
- this.userlist = data
- this.getproject()
- })
- },
- changepeople(item, index) {
- this.dquser = item
- this.dqdjg = index
- this.cancel()
- this.getproject()
- },
- //swiper 切换
- changeTab(e) {
- this.tabCurrentIndex = e.detail.current;
- },
- //顶部tab点击
- tabClick(index) {
- this.tabCurrentIndex = index * 1;
- console.log(index == this.tabCurrentIndex);
- },
- getproject() {
- uni.showLoading({
- title: '加载中'
- })
- misssion({}, this.id, this.dquser.id, this.project_id).then(({
- data
- }) => {
- uni.hideLoading()
- this.list = data.step
- })
- },
- next() {
- const obj = this
- obj.dqdjg++
- if (obj.dqdjg >= this.userlist.length) {
- uni.showModal({
- title: '提示',
- content: '当前关的全部组已全部评完',
- success: function(res) {
- if (res.confirm) {
- uni.switchTab({
- url: '/pages/index/index'
- })
- } else if (res.cancel) {}
- }
- })
- } else {
- console.log(obj.dqdjg);
- obj.$api.msg('当前组已评价,切换到下一个')
- obj.dquser = obj.userlist[obj.dqdjg]
- this.tabCurrentIndex = 0
- this.getproject()
- }
- },
- tj(opt) {
- const obj = this
- let isok = 0;
- try {
- opt.item.forEach(e => {
- if (!e.score) {
- obj.$api.msg('请输入' + e.name + '的分数')
- isok = 1
- throw Error()
- }
- if (e.score * 1 > e.max_score) {
- obj.$api.msg(e.name + '的最大分数为' + e.max_score + ',请不要超过这个分数')
- isok = 1
- throw Error()
- }
- score({
- score: e.score
- }, e.id, obj.dquser.id, obj.project_id).then(e => {})
- })
- if (isok == 1) {
- throw Error()
- } else {
- obj.$api.msg('该组已评价完成')
- // if (obj.tabCurrentIndex != obj.list.length - 1 && isok == 0) {
- // obj.tabCurrentIndex++
- // } else {
- // obj.next()
- // }
- }
- } catch (e) {
- //TODO handle the exception
- }
- },
- navTo(url) {
- uni.navigateTo({
- url,
- })
- }
- }
- };
- </script>
- <style lang="scss">
- page,
- .content {
- min-height: 100%;
- height: auto;
- }
- .list-item {
- width: 700rpx;
- margin: 30rpx auto;
- position: relative;
- padding: 40rpx 40rpx;
- display: flex;
- align-items: center;
- .list-bg {
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- width: 100%;
- height: 100%;
- image {
- width: 100%;
- height: 100%;
- }
- }
- .list-icon {
- width: 112rpx;
- height: 112rpx;
- border-radius: 24rpx;
- }
- .list-name {
- position: relative;
- z-index: 2;
- margin-left: 40rpx;
- font-size: 36rpx;
- font-family: Source Han Sans CN;
- font-weight: bold;
- color: #FFFFFF;
- }
- }
- .top {
- width: 750rpx;
- height: 300rpx;
- position: relative;
- .top-bg {
- width: 750rpx;
- height: 300rpx;
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- image {
- width: 100%;
- height: 100%;
- }
- }
- .top-box {
- padding-top: 44rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- .top-item {
- display: flex;
- .top-main {
- margin: 0 10rpx;
- display: flex;
- flex-direction: column;
- align-items: center;
- .top-icon {
- width: 80rpx;
- height: 80rpx;
- background: #FFFFFF;
- border-radius: 50%;
- }
- .top-name {
- position: relative;
- z-index: 2;
- margin-top: 16rpx;
- font-size: 24rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: rgba(#ffffff, 0.7);
- }
- .curret {
- font-weight: bold;
- color: #2A9CEC;
- -webkit-text-stroke: 1rpx #FFFFFF;
- text-stroke: 1rpx #FFFFFF;
- }
- }
- .jt {
- margin-top: 40rpx;
- width: 38rpx;
- height: 22rpx;
- }
- }
- }
- }
- .student-box {
- margin: 34rpx auto 0;
- width: 698rpx;
- background: #FFFFFF;
- box-shadow: 0px 6rpx 12rpx 1rpx rgba(101, 101, 101, 0.06);
- border-radius: 28rpx;
- padding: 28rpx 22rpx;
- .student-left {
- display: flex;
- align-items: center;
- .shu {
- width: 6rpx;
- height: 30rpx;
- background: #F9A81B;
- border-radius: 3rpx;
- }
- .student-name {
- margin-left: 16rpx;
- font-size: 30rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #000000;
- text {
- color: #40547E;
- }
- }
- }
- .student-right {
- display: flex;
- align-items: center;
- .student-qh {
- font-size: 26rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #666666;
- margin-right: 10rpx;
- }
- .student-back {
- width: 12rpx;
- height: 23rpx;
- }
- }
- }
- .step {
- margin: 34rpx auto 0;
- width: 698rpx;
- background: #FFFFFF;
- box-shadow: 0px 6rpx 12rpx 1rpx rgba(101, 101, 101, 0.06);
- border-radius: 20rpx;
- padding: 28rpx 22rpx;
- .step-top {
- display: flex;
- align-items: center;
- .shu {
- width: 6rpx;
- height: 30rpx;
- background: #F9A81B;
- border-radius: 3rpx;
- }
- .step-title {
- margin-left: 16rpx;
- font-size: 30rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #000000;
- }
- }
- .step-main {
- padding: 50rpx 20rpx 32rpx;
- line-height: 1;
- .step-left {
- font-size: 28rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #666666;
- }
- .step-right {
- display: flex;
- align-items: center;
- .step-input {
- text-align: right;
- font-size: 32rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #FF4C4C;
- }
- .place {
- line-height: 1;
- font-size: 28rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #999999;
- }
- .step-font {
- margin-left: 10rpx;
- font-size: 28rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #000000;
- }
- }
- }
- .step-info {
- margin-right: 20rpx;
- border-top: 1px solid #ECECEC;
- padding: 32rpx 20rpx 0;
- display: flex;
- align-items: flex-start;
- .set-info-title {
- width: 80rpx;
- flex-shrink: 0;
- margin-right: 10rpx;
- font-size: 24rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #666666;
- line-height: 41rpx;
- }
- .set-info-mian {
- font-size: 24rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #666666;
- line-height: 41rpx;
- }
- }
- }
- .btn {
- margin: 50rpx auto 0;
- width: 674rpx;
- height: 88rpx;
- background: #2A9CEC;
- border-radius: 20rpx;
- text-align: center;
- line-height: 88rpx;
- font-size: 36rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #FFFFFF;
- }
- .popup-box {
- width: 750rpx;
- background: #FFFFFF;
- border-top-left-radius: 30rpx;
- border-top-right-radius: 30rpx;
- .popup-title {
- padding: 32rpx 38rpx;
- .qx {
- font-size: 28rpx;
- font-family: PingFang SC;
- font-weight: 500;
- color: #666666;
- }
- .qd {
- font-size: 28rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #2A9CEC;
- }
- }
- }
- .popup {
- display: flex;
- align-items: center;
- .popup-right {
- width: 100%;
- height: 500rpx;
- padding: 0 20rpx;
- .popup-right-item {
- text-align: center;
- padding: 30rpx 20rpx;
- border-bottom: 1px solid #f7f7f7;
- }
- .currRight {
- color: #2A9CEC;
- }
- }
- }
- </style>
|