Commit 0d650242 authored by LiZongLin's avatar LiZongLin

修改

parent 74fd0240
......@@ -11,7 +11,7 @@
success: (result) => {
// 获取手机系统的状态栏高度(不同手机的状态栏高度不同) ( 不要使用uni-app官方文档的var(--status-bar-height) 官方这个是固定的20px 不对的 )
// console.log('当前手机的状态栏高度',result.statusBarHeight)
let statusBarHeight = result.statusBarHeight + 'px'
let statusBarHeight = result.statusBarHeight
uni.setStorageSync('statusBarHeight', statusBarHeight)
// 获取右侧胶囊的信息 单位px
const menuButtonInfo = uni.getMenuButtonBoundingClientRect()
......@@ -23,11 +23,12 @@
//width: 胶囊宽度
// console.log(menuButtonInfo.width, menuButtonInfo.height, menuButtonInfo.top)
// console.log('计算胶囊右侧距离屏幕右边距离', result.screenWidth - menuButtonInfo.right)
let navBarHeight = menuButtonInfo.height + (menuButtonInfo.top - statusBarHeight) * 2
let menuWidth = menuButtonInfo.width + 'px'
let menuHeight = menuButtonInfo.height + 'px'
let menuBorderRadius = menuButtonInfo.height / 2 + 'px'
let menuRight = result.screenWidth - menuButtonInfo.right + 'px'
let menuTop = menuButtonInfo.top + 'px'
let menuTop = menuButtonInfo.top
let contentTop = result.statusBarHeight + 44 + 'px'
let menuInfo = {
......@@ -38,6 +39,7 @@
menuRight: menuRight, //右侧的胶囊距离右侧屏幕距离--用来给自定义导航条页面的左侧胶囊设置使用
menuTop: menuTop, //右侧的胶囊顶部距离屏幕顶部的距离--用来给自定义导航条页面的左侧胶囊设置使用
contentTop: contentTop, //内容区距离页面最上方的高度--用来给自定义导航条页面的内容区定位距离使用
navBarHeight:navBarHeight, //导航栏高度
}
uni.setStorageSync('menuInfo', menuInfo)
},
......
......@@ -69,3 +69,11 @@ export function getCount(activityId,signupId) {
})
}
//查询考试时间,总共有几天
export function selectExamTime(activityId) {
return request({
url: `/tjt-race/answerQuestion/selectExamTime/${activityId}`,
method: 'get',
})
}
......@@ -29,12 +29,12 @@
export default {
data() {
return {
statusBarHeight: uni.getStorageSync('menuInfo').statusBarHeight, //状态栏的高度(可以设置为顶部导航条的padding-top)
statusBarHeight: uni.getStorageSync('menuInfo').statusBarHeight + 'px', //状态栏的高度(可以设置为顶部导航条的padding-top)
menuWidth: uni.getStorageSync('menuInfo').menuWidth,
menuHeight: uni.getStorageSync('menuInfo').menuHeight,
menuBorderRadius: uni.getStorageSync('menuInfo').menuBorderRadius,
menuRight: uni.getStorageSync('menuInfo').menuRight,
menuTop: uni.getStorageSync('menuInfo').menuTop,
menuTop: uni.getStorageSync('menuInfo').menuTop + 'px',
contentTop: uni.getStorageSync('menuInfo').contentTop,
title: uni.getStorageSync('title'),
pages:uni.getStorageSync('pages'),
......
......@@ -63,17 +63,8 @@
onLoad() {
this.login()
this.getList()
console.log(pages);
},
created() {
// uni.setStorageSync("title", '赛事活动')
},
onShow() {
// uni.setStorageSync('pages','activity')
// uni.setStorageSync("title", '赛事活动')
},
onHide() {
// uni.setStorageSync("title", '')
this.flag = true
},
methods: {
......@@ -81,7 +72,7 @@
...mapMutations('m_user', ['updateUserInfo']),
//登录判断
login() {
if (JSON.stringify(this.userInfo) === '{}') {
if (!this.token) {
console.log("userInfo", this.userInfo);
uni.reLaunch({
url: '/pages/login/login?url=' + this.url
......
<template>
<view class="answer-page">
<view class="answer-page" :style="{marginTop:marginHight}">
<navTop></navTop>
<view style="height: auto;position: relative;padding-bottom: 160rpx;">
<view class="answer-top">
......@@ -8,13 +8,13 @@
</view>
<view class="answer-info">
<view class="days">
<view style="margin-top: 10%;">累计分数</view>
<view style="margin-top: 8%;color: #fca624;">{{cumulativeScore}}</view>
<view style="padding-top: 6%;height: 40%;">累计分数</view>
<view style="color: #fca624;">{{cumulativeScore}}</view>
</view>
<view style="float: left;width: 1px;height: 88%;background: #ffffff;margin-top: 2%;"></view>
<view style="float: left;width: 1px;height: 66%;background: #ffffff;margin-top: 4%;"></view>
<view class="scores">
<view style="margin-top: 10%;">活动天数</view>
<view style="margin-top: 8%;color: #fca624;">{{day}}</view>
<view style="padding-top: 6%;height: 40%;">活动天数</view>
<view style="color: #fca624;">{{day}}</view>
</view>
</view>
<view class="answer-day">
......@@ -22,18 +22,23 @@
<view class="scroll-view-item" v-for="i in dayTotal" :key="i">
<view
v-if="(i+1 === day && finishSituationList[i].flag === false) || (i+1 === day && flagCode === 201)"
style="color: #36b25b;" @click="getNotFinish(finishSituationList[i].date)">进行中
style="color: #36b25b;" @click="getNotFinish(dateList[i].examTime,i)">进行中
</view>
<view v-else-if="i+1 <= day && finishSituationList[i].flag === true"
style="color: #999999;">已完成
</view>
<view
v-else-if="(i+1 <= day && finishSituationList[i].flag === false) || (i+1 <= day && flagCode === 201)"
@click="getNotFinish(finishSituationList[i].date)">未完成</view>
@click="getNotFinish(dateList[i].examTime,i)">
<!-- <view id="titleline" @click="clickChange($event)">未完成</view> -->
<view v-if="titleTime == dateList[i].examTime" style="color: #36b25b;">补答中</view>
<view v-else>未完成</view>
</view>
<view v-else-if="i+1 > day">未开始</view>
<view class="item-bottom">
<text v-if="i+1 === day && finishSituationList[i].flag === false"
<text
v-if="(i+1 === day && finishSituationList[i].flag === false) || (i+1 === day && flagCode === 201) ||(titleTime == dateList[i].examTime)"
style="color: #36b25b;">{{i+1}}</text>
<text v-else>{{i+1}}</text>
......@@ -80,7 +85,10 @@
<view>{{ti}}</view>
</view>
</view>
<button @click="gotoActivity">我知道了</button>
<view class="result-button">
<button @click="gotoActivity('返回答题')">返回答题</button>
<button @click="gotoActivity('返回活动')">返回活动</button>
</view>
</view>
</uni-popup>
</view>
......@@ -90,7 +98,8 @@
import {
dailyQuestion,
addScore,
selectScore
selectScore,
selectExamTime
} from '@/api/dailyAnswer.js'
import {
getActivity
......@@ -101,6 +110,8 @@
export default {
data() {
return {
titleTime: '',
marginHight: '',
flagCode: '', //完成情况
status: '',
dateList: [], //从活动开始到现在的日期
......@@ -134,31 +145,42 @@
},
methods: {
//答题完成返回赛事活动页面
gotoActivity() {
addScore(this.signupId, this.examId, this.score).then(res => {
console.log('成绩录入', res);
})
gotoActivity(back) {
console.log("时间标志", this.flagTime);
let today = new Date().toISOString().substring(0, 10)
let flag = this.getDaysBetween(this.flagTime, today)
console.log("天数", flag);
if (flag === 1) {
if (back === '返回活动') {
if (uni.getSystemInfoSync('pages') === 'activityDetail') {
uni.navigateBack({
// url: '/pages_events/tjty_ans_detail/tjty_ans_detail?activityId=' + this.activityId
delta: 1
})
} else {
uni.navigateBack({
// url: '/pages_events/tjty_ans_detail/tjty_ans_detail?activityId=' + this.activityId
delta: 2
})
}
} else {
// uni.setStorageSync('pages', 'dailyActivity')
console.log(flag);
this.getFinishSituation()
this.$refs.popup.close()
this.getFinishSituation().then(()=>{
console.log("finishSituationList", this.finishSituationList);
for (let i = 0; i < this.dayTotal; i++) {
if (i < this.day) {
if (this.finishSituationList[i].flag === false) {
console.log(this.finishSituationList[i]);
this.getNotFinish(this.finishSituationList[i].date, i)
}
}
if (i === this.dayTotal - 1) {
uni.showToast({
title: '所有答题已完成,请退出答题页面'
})
}
}
})
}
},
//下一题
......@@ -217,30 +239,37 @@
clearInterval(this.timer)
// this.timer = null
}
addScore(this.signupId, this.examId, this.score).then(res => {
console.log('成绩录入', res);
})
console.log(this.ti)
},
//获取状态
// getStatus(i) {
// let flag = this.finishStatus.some(item => {
// console.log(item);
// })
// if (flag == true) {
// this.flag = 1
// } else {
// flag = 0
// }
// return flag
// console.log('hehe', this.dateList);
// },
//计算日期
dateCalculation(day) {
let date = new Date(this.examTime);
date.setDate(date.getDate() - day);
let month = date.getMonth() + 1; //月份从0开始所以需要+1
var day = date.getDate();
let date1 = date.getFullYear() + '-' + month + '-' + day
this.dateList.push(date1)
//得到考试时间
getExamTime() {
selectExamTime(this.activityId).then(res => {
console.log("考试时间", res);
if (res.code === 200) {
this.dayTotal = res.data[0].count
this.dateList = res.data
}
})
},
//计算日期
// dateCalculation(day) {
// let date = new Date(this.examTime);
// date.setDate(date.getDate() - day);
// let month = date.getMonth() + 1; //月份从0开始所以需要+1
// var day = date.getDate();
// let date1 = date.getFullYear() + '-' + month + '-' + day
// this.dateList.push(date1)
// },
// clickChange(e){
// console.log(e);
// let id = e.currentTarget.id
// let titleLine = this.$refs.id
// titleLine.innerHTML = '补答中'
// document.write(titleLine.innerHTML)
// },
//获取当前是第几天
getDaysBetween(date1, date2) {
let startDate = Date.parse(date1);
......@@ -253,7 +282,12 @@
console.log(this.day);
},
//获取未完成的试卷
getNotFinish(date) {
getNotFinish(date, index) {
console.log('index', index);
if (index <= this.day - 1) {
this.titleTime = this.dateList[index].examTime
console.log(this.titleTime);
}
let question = []
let questionId = new Array()
let questionItem = {
......@@ -262,20 +296,13 @@
questionId: 0,
question: ''
}
console.log("date", date);
dailyQuestion(this.signupId, date).then(res => {
console.log(res);
// console.log(res);
if (res.code === 200) {
// this.bannerImage = res.data[0].bannerImage
// this.total = res.data[0].questionsNum
this.flagTime = res.data[0].examTime //标志时间
// this.day = this.getDaysBetween(res.data[0].activityStart, res.data[0]
// .examTime) //今天是答题活动的第几天
// for (let i = 0; i < this.day; i++) {
// this.dateCalculation(i)
// }
// this.flagTime = formatDate(res.data[0].examTime, 'yyyy-MM-dd') //标志时间
this.flagTime =res.data[0].examTime//标志时间
this.examId = res.data[0].examId
// this.dayTotal = this.getDaysBetween(res.data[0].activityStart, res.data[0].activityEnd)
// this.getFinishSituationList()
let question1 = new Array()
res.data.forEach(e => {
question1.push(e.questionId)
......@@ -288,6 +315,7 @@
questionId.push(val)
}
})
this.total = res.data[0].questionsNum
//将取到的题目id集合反转
questionId = questionId.reverse()
for (let i = 0; i < res.data.length / 4; i++) {
......@@ -369,18 +397,28 @@
this.bannerImage = res.data[0].bannerImage
this.total = res.data[0].questionsNum
this.flagTime = res.data[0].examTime
// this.flagTime = formatDate(res.data[0].examTime, 'yyyy-MM-dd')
this.examTime = res.data[0].examTime //今天的日期
this.day = this.getDaysBetween(res.data[0].activityStart, res.data[0]
.examTime) //今天是答题活动的第几天
// console.log("今天是活动的第几天", this.day);
for (let i = 0; i < this.day; i++) {
this.dateCalculation(i)
// this.examTime = formatDate(res.data[0].examTime, 'yyyy-MM-dd') //今天的日期
// this.day = this.getDaysBetween(res.data[0].activityStart, res.data[0]
// .examTime) //今天是答题活动的第几天
console.log("examTime", this.examTime);
console.log("dataList", this.dateList);
for (let j = 0; j < this.dateList.length; j++) {
if (this.dateList[j].examTime == res.data[0].examTime) {
// if (formatDate(this.dateList[j].examTime, 'yyyy-MM-dd') == formatDate(res.data[0].examTime, 'yyyy-MM-dd')) {
this.day = j + 1
}
}
console.log("今天是活动的第几天", this.day);
// for (let i = 0; i < this.day; i++) {
// this.dateCalculation(i)
// }
this.examId = res.data[0].examId
console.log(this.dateList);
this.dayTotal = this.getDaysBetween(res.data[0].activityStart, res.data[0].activityEnd)
// console.log(this.dateList);
// this.dayTotal = this.getDaysBetween(res.data[0].activityStart, res.data[0].activityEnd)
// this.getFinishSituationList()
console.log("该活动总共多少天", this.dayTotal);
// console.log("该活动总共多少天", this.dayTotal);
let question1 = new Array()
res.data.forEach(e => {
question1.push(e.questionId)
......@@ -396,12 +434,11 @@
//将取到的题目id集合反转
questionId = questionId.reverse()
console.log("试卷总共多少题", res.data.length / 4);
const length = res.data.length / 4
for (let i = 0; i < length; i++) {
for (let i = 0; i < res.data.length / 4; i++) {
// console.log('i', i);
let questionNum = questionId[i]
res.data.forEach(item => {
if (item.questionId === questionNum) {
if (item.questionId === questionId[i]) {
questionItem.question = item.topic
questionItem.questionId = item.questionId
if (item.answer === '1') {
......@@ -458,10 +495,10 @@
let flag = {}
this.finishSituationList = []
// this.finishSituationList.length = 0
return new Promise((resolve, reject) => {
selectScore(this.signupId, this.examTime).then(res => {
console.log('完成情况', res);
console.log("dateList", this.dateList);
// debugger
if (res.code === 200) {
this.finishStatus = res.data
this.cumulativeScore = res.data[0].cumulativeScore
......@@ -471,14 +508,12 @@
flag: ''
}
this.dateList.forEach(temp => {
flag = ''
temp = formatDate(temp, 'yyyy-MM-dd')
// console.log('time', formatDate(item.tjtActivityProject.examTime, 'yyyy-MM-dd'));
// flag = formatDate(item.tjtActivityProject.examTime, 'yyyy-MM-dd') == temp
flag = this.finishStatus.some(item =>
formatDate(item.tjtActivityProject.examTime, 'yyyy-MM-dd') === temp
formatDate(item.tjtActivityProject.examTime,'yyyy-MM-dd') === temp.examTime
)
situation.date = temp
//昨天
// situation.date = temp
situation.date = temp.examTime
situation.flag = flag
this.finishSituationList.push(situation)
situation = {
......@@ -486,11 +521,13 @@
flag: ''
}
})
this.finishSituationList = this.finishSituationList.reverse()
// this.finishSituationList = this.finishSituationList.reverse()
console.log('flag', this.finishSituationList);
this.titleTime = ''
// this.getDailyQuestion()
} else {
this.flagCode = res.code
console.log(this.flagCode);
// let situation = {
// date: '',
// flag: ''
......@@ -516,6 +553,9 @@
// }
// console.log('flag', this.finishSituationList);
}
resolve()
})
})
}
......@@ -524,38 +564,31 @@
this.examTime = new Date().toISOString().substring(0, 10)
this.signupId = Number(options.signupId)
this.activityId = Number(options.activityId)
// console.log(options);
this.marginHight = uni.getStorageSync('menuInfo').statusBarHeight + uni.getStorageSync('menuInfo')
.navBarHeight + 15 + 'px'
console.log("marginHight", this.marginHight);
this.begin()
this.getExamTime()
this.getFinishSituation() //判断是否完成答题
this.getDailyQuestion()
uni.setStorageSync('title','每日答题')
// this.getActivityDetail()
},
onShow() {
},
onHide() {
console.log("haha");
uni.setStorageSync('title', '每日答题')
},
destroyed() {
clearInterval(this.timer);
console.log("哈哈");
}
}
</script>
<style lang="scss" scoped>
.answer-page {
// position: relative;
min-height: 100%;
height: auto;
margin-top: 30rpx;
margin-top: 180rpx;
.answer-top {
position: relative;
// bottom: 20rpx;
width: 96%;
height: 45vh;
height: 40%;
background: #ffffff;
border-radius: 16px;
box-shadow: 0px 3px 10px 0px #dddddd;
......@@ -564,11 +597,11 @@
.answer-image {
position: relative;
width: 100%;
height: 30vh;
height: 165px;
// border-radius: 30rpx;
image {
border-radius: 30rpx;
border-top-right-radius: 30rpx;
border-top-left-radius: 30rpx;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0);
......@@ -578,11 +611,11 @@
.answer-info {
display: flex;
position: absolute;
bottom: 22%;
bottom: 24%;
left: 15%;
z-index: 4;
width: 70%;
height: 26%;
height: 25%;
background: #2481e0;
border-radius: 16px;
......@@ -611,12 +644,13 @@
}
.answer-day {
margin-top: 10%;
margin-top: 12%;
width: 100%;
height: 20%;
background: rgba(245, 245, 245, 0.00);
border-bottom-left-radius: 16px;
border-bottom-right-radius: 16px;
padding-bottom: 2%;
.scroll-view_H {
min-width: 100%;
......@@ -632,7 +666,6 @@
text-align: center;
font-size: 16px;
color: #666666;
// margin-left: 2%;
.item-bottom {
text-align: center;
......@@ -761,10 +794,10 @@
}
image {
margin: 5% 30% 0 25%;
width: 50%;
height: 30%;
border: 1px dashed #009DFF;
margin: 10% 30% 5% 30%;
width: 40%;
height: 20%;
// border: 1px dashed #009DFF;
}
.popup-scores {
......@@ -801,15 +834,23 @@
}
}
.result-button {
margin-top: 6%;
margin-left: 10%;
height: 10%;
width: 80%;
display: flex;
justify-content: space-between;
button {
border-radius: 16px;
background: #3b7cde;
width: 40%;
height: 10%;
margin-top: 6%;
margin-left: 30%;
// height: 10%;
color: #ffffff;
}
}
}
}
</style>
......@@ -73,24 +73,13 @@
},
onShow() {
uni.setStorageSync('pages','activityDetail')
// uni.setStorageSync("title", '赛事活动详情')
this.getRegister(this.activityId)
// this.getRegister(+this.activityInfo.activityId)
},
onHide() {
// uni.setStorageSync('pages','activity')
// uni.setStorageSync("title", '赛事活动')
},
onLoad(options) {
this.activityId = options.activityId
this.getActivityDetial(this.activityId)
this.wechatId = this.userInfo.wechatId
},
created() {
// uni.setStorageSync("title", '赛事活动详情')
// uni.setStorageSync('pages','activityDetail')
},
methods: {
//计算到截止报名还有几天
getDaysBetween(endDate) {
......@@ -132,7 +121,7 @@
if (this.flag > 0) {
return uni.$showMsg('今日答题已完成')
} else {
uni.reLaunch({
uni.navigateTo({
url: `/pages_daily_answer/tjty_dailyAnswer/tjty_dailyAnswer?signupId=${this.signupId}&activityId=${this.activityInfo.activityId}`
})
}
......@@ -254,7 +243,7 @@
height: 72rpx;
opacity: 0.6;
background: #000000;
top: -86rpx;
top: -82rpx;
z-index: 9;
font-size: 18px;
font-family: Source Han Sans CN, Source Han Sans CN-Medium;
......
......@@ -294,7 +294,7 @@
title: '报名成功!',
icon: 'none'
})
uni.reLaunch({
uni.navigateTo({
url: `/pages_daily_answer/tjty_dailyAnswer/tjty_dailyAnswer?activityId=${this.info.activityId}&signupId=${res}`
})
}else{
......
......@@ -2,9 +2,10 @@
<view class="feedback-page">
<view class="feedback-content">
<view class="content-item" style="width: 100%;">
<view>
<view class="content-textarea">
<!-- <textarea class="content-textarea" v-model="uploadOpus.opusBrief" @blur="bindTextAreaBlur" placeholder="请输入内容"/> -->
<textarea class="content-textarea" v-model.trim="uploadOpus.question" placeholder="请输入内容" />
<uni-easyinput styles="" v-model="uploadOpus.question" placeholder="请输入内容" :inputBorder="false"
:trim="both" type="textarea" ></uni-easyinput>
</view>
</view>
<view class="content-item" style="width: 100%;">
......@@ -120,7 +121,25 @@
onLoad() {
this.uploadOpus.wechatId = this.userInfo.wechatId
},
// watch: {
// 'uploadOpus.question': {
// handler(newName, oldName) {
// console.log(newName);
// this.uploadOpus.question = newName.replace('[^\\s\\r\\n]+', "")
// },
// immediate: true
// }
// },
methods: {
contentInpt(e) {
console.log(e);
// let value = e.target.value;
if (!e || e == " " || e=='\n') {
return '';
}
this.uploadOpus.question = e.replace('[^\\s\\r\\n]+', "")
},
//清空
clearList() {
// this.uploadOpus.wechatId = ''
this.uploadOpus.phone = ''
......@@ -217,18 +236,14 @@
opusList = this.imageList
this.uploadOpus.wechatId = this.wechatId
// 上传数据
uni.showLoading({
title: '上传中',
mask: true
});
addFeedBack(this.uploadOpus).then(response => {
console.log("上传作品后端获取的数据:", response)
// 接收后端传回的作品id,在作为附带信息和文件传到后端
uni.showToast({
title: '反馈成功!',
icon: 'none',
duration: 3000
})
let feedbackId = response.data
// if (opusList.length <= 0) return
for (let i = 0; i < opusList.length; i++) {
......@@ -255,9 +270,11 @@
setTimeout(function() {
uni.hideLoading();
}, 100);
console.log("上传结果:", response)
this.clearList()
this.imageList = []
uni.navigateBack({
delta: 1
})
})
},
}
......@@ -428,20 +445,21 @@
.feedback-bottom {
width: 100%;
height: 10%;
// position: relative;
position: relative;
bottom: 0;
background: #ffffff;
button {
width: 80%;
height: 80%;
top: 13%;
top: 12%;
background: #3b7cde;
border-radius: 16px;
font-size: 18px;
font-family: Source Han Sans CN, Source Han Sans CN-Regular;
font-weight: 400;
color: #ffffff;
line-height: 3;
}
}
}
......
......@@ -4,10 +4,10 @@ const url_all = {
// 'DEV': 'http://192.168.1.161:8080', // 开发
// 'DEV': 'http://192.168.1.13:8080', // 英伟姐
// DEV: "http://116.205.136.218:8088/api", //线上服务
// 'DEV': 'http://127.0.0.1:8080', // 开发
'DEV': 'http://192.168.1.4:8080'
// 'DEV': 'http://127.0.0.1:8080' // 开发
// 'DEV': 'http://192.168.1.11:8080'
// 'DEV': 'http://192.168.0.72:8080'
// 'DEV':'https://www.aiwanyundong.com/api'
'DEV':'https://www.aiwanyundong.com/api'
};
let BASEURL = url_all["DEV"];
......
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