Commit 4c022e85 authored by LiZongLin's avatar LiZongLin

新增答题排行

parent f27dce45
...@@ -107,3 +107,27 @@ export function selectexamType(examType) { ...@@ -107,3 +107,27 @@ export function selectexamType(examType) {
} }
//查询某个用户总分
export function getCumulativeScore(activityId,signupId) {
return request({
url: `/tjt-race/rank/select/${activityId}/${signupId}`,
method: 'get',
})
}
//添加某个用户总分
export function updateCumulativeScore(tjtSignupScore) {
return request({
url: `/tjt-race/rank/update/TjtSignupScore`,
method: 'post',
data:tjtSignupScore
})
}
//查询某个答题活动积分排行
export function selectTjtSignupScoreList(activityId,pageNum) {
return request({
url: `/tjt-race/rank/list/${activityId}/${pageNum}`,
method: 'get',
})
}
...@@ -307,7 +307,16 @@ ...@@ -307,7 +307,16 @@
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}] } ,{
"path" : "tjt_rank/tjt_rank",
"style" :
{
"navigationBarTitleText": "答题排行",
"enablePullDownRefresh": false
}
}
]
}, },
{ {
"root": "pages_feedback", "root": "pages_feedback",
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<!-- 登录按钮 --> <!-- 登录按钮 -->
<!-- 可以从 @getuserinfo 事件处理函数的形参中,获取到用户的基本信息 --> <!-- 可以从 @getuserinfo 事件处理函数的形参中,获取到用户的基本信息 -->
<button :disabled="flag" type="primary" class="btn-login" @click="getWXUserCode()">一键登录</button> <button :disabled="flag" type="primary" class="btn-login" @click="getWXUserCode()">一键登录</button>
<button :disabled="flag" type="primary" class="cancel-login" @click="gotoAbove()">取消</button>
<!-- <button class="avatar-wrapper" open-type="chooseAvatar" @chooseavatar="onChooseAvatar"> <!-- <button class="avatar-wrapper" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
<image class="avatar" :src="avatarUrl"></image> <image class="avatar" :src="avatarUrl"></image>
</button> </button>
...@@ -74,6 +75,11 @@ ...@@ -74,6 +75,11 @@
} }
}); });
}, },
gotoAbove(){
uni.reLaunch({
url:'/pages_home/tjty_home_page/tjty_home_page',
})
},
getUserProfile() { getUserProfile() {
uni.getUserProfile({ uni.getUserProfile({
desc: '获取微信用户的昵称与头像', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 desc: '获取微信用户的昵称与头像', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
...@@ -163,6 +169,12 @@ ...@@ -163,6 +169,12 @@
background-color: #c00000; background-color: #c00000;
} }
.cancel-login{
width: 90%;
border-radius: 100px;
margin: 15px 0;
background-color: #8C8C8C;
}
// 按钮下方提示消息的样式 // 按钮下方提示消息的样式
// .tips-text { // .tips-text {
// font-size: 12px; // font-size: 12px;
......
<template>
<view class="rank-page">
<noData v-if="haveFlag"></noData>
<view class="rank-pages">
<view class="rank-top">
<view>排名</view>
<view>参赛人</view>
<view>积分</view>
<view>累计用时</view>
</view>
<view class="rank-content">
<view class="rank-item" v-for="(item,index) in tjtSignupScoreList" :key="index">
<view>{{item.rank}}</view>
<view>{{item.tjtActivitySignupExam.name}}</view>
<view>{{item.score}}</view>
<view>{{item.totalTime}}</view>
</view>
</view>
<view class="rank-bottom">
<uni-load-more :icon-size="14" :status="status" :content-text="contentText" @clickLoadMore="getMore()"/>
</view>
</view>
</view>
</template>
<script>
import {
selectTjtSignupScoreList
} from '@/api/dailyAnswer.js'
export default {
data() {
return {
haveFlag: false,
pageNum: 1,
tjtSignupScoreList: [],
status: 'more',
contentText: {
contentdown: '加载更多',
contentrefresh: '加载中',
contentnomore: '没有更多啦'
},
reload: false,
};
},
methods: {
getTjtSignupScoreList() {
return new Promise((resolve, reject) => {
selectTjtSignupScoreList(this.activityId, this.pageNum).then(res => {
console.log(res);
if (res.code == 200) {
this.tjtSignupScoreList = [...this.tjtSignupScoreList, ...res.rows]
if(this.tjtSignupScoreList.length<res.total){
this.status = 'more'
}else{
this.status = 'nomore'
}
} else {
this.haveFlag = true
}
})
resolve();
})
},
getMore(){
if(this.status == 'nomore' || this.status == 'loading'){
return
}else{
this.status = 'loading'
this.pageNum += 1
this.getTjtSignupScoreList()
}
}
},
onLoad(options) {
this.activityId = options.activityId
this.getTjtSignupScoreList()
}
}
</script>
<style lang="scss">
.rank-page {
width: 100%;
min-height: 100%;
height: auto;
.rank-pages {
min-height: 90%;
height: auto;
.rank-top {
width: 94%;
height: 70rpx;
margin-top: 40rpx;
margin-left: 3%;
display: flex;
flex-direction: row;
background-color: #A4ADB3;
text-align: center;
font-family: PingFangSC-regular;
font-size: 16px;
:nth-child(n) {
margin-top: 2%;
}
:nth-child(1) {
width: 20%;
}
:nth-child(2) {
width: 28%;
}
:nth-child(3) {
width: 22%;
}
:nth-child(4) {
width: 30%;
}
}
.rank-content {
margin-left: 3%;
width: 94%;
min-height: calc(90vh-110rpx);
height: auto;
font-size: 14px;
text-align: center;
font-family: PingFangSC-regular;
padding-bottom: 10%;
.rank-item {
display: flex;
flex-direction: row;
width: 100%;
margin-top: 8.5%;
:nth-child(1) {
width: 20%;
}
:nth-child(2) {
width: 28%;
}
:nth-child(3) {
width: 22%;
}
:nth-child(4) {
width: 30%;
}
}
}
.rank-bottom {
position: relative;
z-index: 2;
bottom: 10rpx;
// left: 40%;
}
}
}
</style>
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<view class="answer-day"> <view class="answer-day">
<scroll-view class="scroll-view_H" scroll-x> <scroll-view class="scroll-view_H" scroll-x>
<view class="scroll-view-item" v-for="i in dayTotal" :key="i"> <view class="scroll-view-item" v-for="i in dayTotal" :key="i">
<view v-if="finishSituationList[i].flag === true" style="color: #999999;">已完成 <view v-if="finishSituationList[i].flag === true" style="color: #36b25b;">已完成
</view> </view>
<view <view
v-else-if="(i+1 === day && finishSituationList[i].flag === false) || (i+1 === day && flagCode === 201)" v-else-if="(i+1 === day && finishSituationList[i].flag === false) || (i+1 === day && flagCode === 201)"
...@@ -31,16 +31,16 @@ ...@@ -31,16 +31,16 @@
@click="getNotFinish(dateList[i].examTime,i)"> @click="getNotFinish(dateList[i].examTime,i)">
<!-- <view id="titleline" @click="clickChange($event)">未完成</view> --> <!-- <view id="titleline" @click="clickChange($event)">未完成</view> -->
<view v-if="titleTime == dateList[i].examTime" style="color: #36b25b;">补答中</view> <view v-if="titleTime == dateList[i].examTime" style="color: #36b25b;">补答中</view>
<view v-else>未完成</view> <view v-else style="color: #D62727;">未完成</view>
</view> </view>
<view v-if="i+1 > day">未开始</view> <view v-if="i+1 > day">未开始</view>
<view class="item-bottom"> <view class="item-bottom">
<text v-if="finishSituationList[i].flag === true">{{i+1}}</text> <text v-if="finishSituationList[i].flag === true" style="color: #36b25b;">{{i+1}}</text>
<text <text
v-else-if="(i+1 === day && finishSituationList[i].flag === false) || (i+1 === day && flagCode === 201) ||(titleTime == dateList[i].examTime)" v-else-if="(i+1 === day && finishSituationList[i].flag === false) || (i+1 === day && flagCode === 201) ||(titleTime == dateList[i].examTime)"
style="color: #36b25b;">{{i+1}}</text> style="color: #36b25b;">{{i+1}}</text>
<text v-else>{{i+1}}</text> <text v-else style="color: #D62727;">{{i+1}}</text>
</view> </view>
</view> </view>
...@@ -69,7 +69,6 @@ ...@@ -69,7 +69,6 @@
<uni-popup ref="popup" background-color="#ffffff" :isMaskClick="false"> <uni-popup ref="popup" background-color="#ffffff" :isMaskClick="false">
<view class="result-popup"> <view class="result-popup">
<view class="popup-title">您已经完成本次答题</view> <view class="popup-title">您已经完成本次答题</view>
<image src="../../static/dailyAnswer/datidefen.png"></image>
<view class="popup-scores">{{score}}</view> <view class="popup-scores">{{score}}</view>
<view class="popup-content"> <view class="popup-content">
<view class="popup-item"> <view class="popup-item">
...@@ -85,9 +84,22 @@ ...@@ -85,9 +84,22 @@
<view>{{ti}}</view> <view>{{ti}}</view>
</view> </view>
</view> </view>
<view class="cumulativeScore">
<view class="cumulativeScore-item">
<view>累计积分</view>
<view>{{signupScoreInfo.score}}</view>
</view>
<view class="cumulativeScore-item">
<view>当前排名</view>
<view v-if="signupScoreInfo.rank<10000">{{signupScoreInfo.rank}}</view>
<view v-else>万名以上</view>
</view>
</view>
<view class="cumulative-time">*截止到{{nowTime}},排名仅供参考</view>
<view class="result-button"> <view class="result-button">
<button @click="gotoActivity('返回答题')">返回答题</button> <button @click="gotoActivity('返回答题')">继续答题</button>
<button @click="gotoActivity('返回活动')">返回活动</button> <button @click="gotoActivity('返回活动')">返回活动</button>
<button @click="gotoRank()">更多排行</button>
</view> </view>
</view> </view>
</uni-popup> </uni-popup>
...@@ -106,7 +118,9 @@ ...@@ -106,7 +118,9 @@
addScore, addScore,
selectScore, selectScore,
selectExamTime, selectExamTime,
getExamPapers getExamPapers,
getCumulativeScore,
updateCumulativeScore
} from '@/api/dailyAnswer.js' } from '@/api/dailyAnswer.js'
import { import {
getActivity getActivity
...@@ -114,9 +128,20 @@ ...@@ -114,9 +128,20 @@
import { import {
formatDate formatDate
} from '@/api/formatDate.js' } from '@/api/formatDate.js'
import {
get
} from 'https';
export default { export default {
data() { data() {
return { return {
nowTime: '', //排行截止时间
signupScoreInfo: {
activityId: '',
signupId: '',
score: 0,
rank: '',
totalTime: '00:00:00'
}, //该报名人累计分数信息
titleTime: '', //当前试题应该是哪一天的卷子 titleTime: '', //当前试题应该是哪一天的卷子
marginHight: '', //页面内容到手机顶部的距离 marginHight: '', //页面内容到手机顶部的距离
flagCode: '', //完成情况 flagCode: '', //完成情况
...@@ -152,6 +177,12 @@ ...@@ -152,6 +177,12 @@
}; };
}, },
methods: { methods: {
//跳转到该活动排行页面
gotoRank(){
uni.redirectTo({
url:`/pages_daily_answer/tjt_rank/tjt_rank?activityId=${this.activityId}`
})
},
//答题完成返回赛事活动页面 //答题完成返回赛事活动页面
gotoActivity(back) { gotoActivity(back) {
console.log("时间标志", this.flagTime); console.log("时间标志", this.flagTime);
...@@ -230,6 +261,70 @@ ...@@ -230,6 +261,70 @@
begin() { begin() {
this.timer = setInterval(this.startTimer, 1000); this.timer = setInterval(this.startTimer, 1000);
}, },
timeCompute() {
return new Promise((resolve, reject) => {
let hour = this.ti.substr(0, 2)
let hour1 = this.signupScoreInfo.totalTime.substr(0, 2)
if (hour == '00') {
hour = 0
} else {
hour = Number(hour)
}
if (hour1 == '00') {
hour1 = 0
} else {
hour1 = Number(hour1)
}
let minute = this.ti.substr(3, 2)
let minute1 = this.signupScoreInfo.totalTime.substr(3, 2)
if (minute == '00') {
minute = 0
} else {
minute = Number(minute)
}
if (minute1 == '00') {
minute1 = 0
} else {
minute1 = Number(minute1)
}
let seconds = this.ti.substr(6, 2)
let seconds1 = this.signupScoreInfo.totalTime.substr(6, 2)
if (seconds == '00') {
seconds = 0
} else {
seconds = Number(seconds)
}
if (seconds1 == '00') {
seconds1 = 0
} else {
seconds1 = Number(seconds1)
}
let hour2 = hour + hour1
let minute2 = minute + minute1
console.log(minute);
console.log(minute1);
console.log(minute2);
let seconds2 = seconds + seconds1
console.log(seconds);
console.log(seconds1);
console.log(seconds2);
if (seconds2 >= 60) {
seconds2 = seconds2 - 60;
minute2 = minute2 + 1;
}
if (minute2 >= 60) {
minute2 = minute2 - 60;
hour2 = hour2 + 1;
}
this.signupScoreInfo.totalTime = (hour2 < 10 ? '0' + hour2 : hour2) + ':' + (minute2 < 10 ?
'0' + minute2 :
minute2) + ':' + (seconds2 < 10 ? '0' + seconds2 : seconds2);
console.log(this.signupScoreInfo.totalTime);
resolve();
})
},
startTimer() { startTimer() {
this.seconds += 1; this.seconds += 1;
if (this.seconds >= 60) { if (this.seconds >= 60) {
...@@ -246,10 +341,9 @@ ...@@ -246,10 +341,9 @@
}, },
// 结束计时,并显示弹出层 // 结束计时,并显示弹出层
pause() { pause() {
this.$refs.popup.open('center') this.signupScoreInfo.score = this.cumulativeScore
console.log("hehe"); console.log("hehe");
if (this.timer) { if (this.timer) {
clearInterval(this.timer) clearInterval(this.timer)
// this.timer = null // this.timer = null
} }
...@@ -266,7 +360,15 @@ ...@@ -266,7 +360,15 @@
console.log('成绩录入', res); console.log('成绩录入', res);
this.scoreFlag = false this.scoreFlag = false
}) })
console.log(this.ti) this.timeCompute().then(() => {
this.updateCumulative(this.signupScoreInfo).then(() => {
this.nowTime = formatDate(new Date(), 'yyyy-MM-dd hh:mm:ss')
this.getCumulative().then(() => {
this.$refs.popup.open('center')
})
})
})
console.log("本次用时", this.ti)
}, },
//得到考试时间 //得到考试时间
getExamTime() { getExamTime() {
...@@ -319,7 +421,7 @@ ...@@ -319,7 +421,7 @@
console.log("date", date); console.log("date", date);
// dailyQuestion(this.signupId, date).then(res => { // dailyQuestion(this.signupId, date).then(res => {
getExamPapers(this.signupId, this.activityId, date).then(res => { getExamPapers(this.signupId, this.activityId, date).then(res => {
console.log("试卷",res); console.log("试卷", res);
if (res.code === 200) { if (res.code === 200) {
// this.flagTime = formatDate(res.data[0].examTime, 'yyyy-MM-dd') //标志时间 // this.flagTime = formatDate(res.data[0].examTime, 'yyyy-MM-dd') //标志时间
this.flagTime = res.data[0].examTime //标志时间 this.flagTime = res.data[0].examTime //标志时间
...@@ -562,8 +664,35 @@ ...@@ -562,8 +664,35 @@
}) })
}) })
},
//获取总分
getCumulative() {
return new Promise((resolve, reject) => {
getCumulativeScore(this.activityId, this.signupId).then(res => {
console.log("getCumulativeScore", res);
if (res.code === 200) {
this.signupScoreInfo = res.data
} else {
this.signupScoreInfo.activityId = this.activityId
this.signupScoreInfo.signupId = this.signupId
}
resolve();
})
})
},
//添加某个用户的总分
updateCumulative() {
return new Promise((resolve, reject) => {
updateCumulativeScore(this.signupScoreInfo).then(res => {
console.log(res);
if (res.code == 200) {
resolve();
} else {
resolve();
}
})
})
} }
}, },
onLoad(options) { onLoad(options) {
this.examTime = options.examTime this.examTime = options.examTime
...@@ -584,11 +713,7 @@ ...@@ -584,11 +713,7 @@
uni.setStorageSync('title', '每日答题') uni.setStorageSync('title', '每日答题')
}, },
onShow() { onShow() {
// let titleTime = new Date().toISOString().substring(0, 10) this.getCumulative()
// if(titleTime != this.examTime){
// this.titleTime = this.examTime
// console.log('titleTime',this.titleTime);
// }
}, },
destroyed() { destroyed() {
clearInterval(this.timer); clearInterval(this.timer);
...@@ -767,7 +892,7 @@ ...@@ -767,7 +892,7 @@
width: 100%; width: 100%;
bottom: 0; bottom: 0;
height: 72px; height: 72px;
background: #ffffff; background: #efefef;
button { button {
position: relative; position: relative;
...@@ -852,22 +977,52 @@ ...@@ -852,22 +977,52 @@
} }
} }
.cumulativeScore {
height: 15%;
width: 76%;
margin-left: 12%;
margin-top: 10%;
display: flex;
.cumulativeScore-item {
width: 49.33%;
height: 100%;
font-size: 16px;
font-family: Source Han Sans CN, Source Han Sans CN-Regular;
font-weight: 400;
text-align: center;
color: #666666;
line-height: 32px;
}
}
.cumulative-time {
height: 10%;
width: 80%;
margin-left: 10%;
margin-top: 8%;
margin-bottom: 1%;
color: #B6B4B4;
font-size: 12px;
text-align: center;
font-family: PingFangSC-regular;
}
.result-button { .result-button {
margin-top: 6%; margin-top: 6%;
margin-left: 10%; margin-left: 5%;
height: 10%; height: 10%;
width: 80%; width: 90%;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
button { button {
border-radius: 16px; border-radius: 16px;
background: #3b7cde; background: #3b7cde;
width: 40%; width: 30%;
// height: 10%;
color: #ffffff; color: #ffffff;
font-size: 28rpx; font-size: 25rpx;
line-height: 3.5; padding-top: 2.5%;
} }
} }
} }
......
...@@ -174,8 +174,8 @@ ...@@ -174,8 +174,8 @@
...mapState('m_user', ['token']) ...mapState('m_user', ['token'])
}, },
onPullDownRefresh() { onPullDownRefresh() {
this.activityList = [], this.activityList = []
this.exerciseList = [], this.exerciseList = []
this.login() this.login()
uni.stopPullDownRefresh() uni.stopPullDownRefresh()
}, },
......
...@@ -20,7 +20,7 @@ const url_all = { ...@@ -20,7 +20,7 @@ const url_all = {
// 开发版 // 开发版
develop: 'https://www.aiwanyundong.com/stage-api', develop: 'https://www.aiwanyundong.com/stage-api',
// develop: 'https://www.aiwanyundong.com/api', // develop: 'https://www.aiwanyundong.com/api',
// develop: 'http://192.168.0.63:8080', // develop: 'http://127.0.0.1:8080',
// 体验版 // 体验版
trial: 'https://www.aiwanyundong.com/stage-api', trial: 'https://www.aiwanyundong.com/stage-api',
// 正式版 // 正式版
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment