Browse Source

演练完成及重新挑战

h5_css
yanyan 3 years ago
parent
commit
b6cb1bce14
  1. 6
      components/s-video/s-video.vue
  2. 1
      main.js
  3. 8
      pages.json
  4. 132
      subpkg/complete/complete.vue
  5. 85
      subpkg/rechallenge/rechallenge.vue
  6. 3
      utils/config.js

6
components/s-video/s-video.vue

@ -7,6 +7,7 @@
<!-- <view class="popup-layer-close" @click="question=false">关闭</view> -->
<view class="popup-layer">
<!-- <h2>请选择</h2> -->
<view>{{ask}}</view>
<view class="anitem" @click="nextQuestion(item.outs[0], item)" v-for="(item, index) in answerList">
<image class="animg" src="/static/videos/skin_bg_1a.png"></image>
<view class="antxt">{{item.channel}}</view>
@ -44,6 +45,7 @@
questionFreId: "",
preQuestionId: "",
correct: "",
ask: "",
};
},
computed: {
@ -89,7 +91,7 @@
this.answerList = [];
this.question = false;
uni.navigateTo({
url: '/subpkg/complete/complete'
url: '/subpkg/complete/complete?questionFreId='+this.questionFreId+'&roleId='+this.jsonId
})
}
},
@ -108,6 +110,7 @@
if(null!=obj) {
var param = {
answer : obj.channel,
ask : this.ask,
questionFreId : this.questionFreId,
questionId : this.preQuestionId,
correctAnswer : this.correct
@ -139,6 +142,7 @@
if(nodeId == this.videoObjList[i].nodeId) {
this.videoObj = this.videoObjList[i];
this.correct = this.videoObjList[i].correct;
this.ask = this.videoObjList[i].ask;
}
}
this.preQuestionId = this.videoObj.questionId;

1
main.js

@ -13,6 +13,7 @@ import * as filters from '@/utils/formatFilter'
uni.$http = $http
Vue.prototype.$api = api
// $http.baseUrl = 'http://146.56.223.227:9527'
$http.baseUrl = 'http://localhost:85'
$http.beforeRequest = function(options) {

8
pages.json

@ -138,6 +138,14 @@
"navigationBarTitleText" : "",
"enablePullDownRefresh" : false
}
},
{
"path" : "rechallenge/rechallenge",
"style" :
{
"navigationBarTitleText" : "",
"enablePullDownRefresh" : false
}
}]
}],
"globalStyle": {

132
subpkg/complete/complete.vue

@ -1,6 +1,33 @@
<template>
<view>
<view class="v-container">
<span class="title">本次演练完成</span>
<view class="question-list">
<view class="question-item" v-for="(item, i) in questionList" :key="i" @click="itemClickHandler(item)">
<span class="question-num">{{i+1}}</span>
</view>
</view>
<view class="answer-content">
<view>{{ask}}</view>
<view>{{answer}}</view>
</view>
<view class="question-record">
<span>演练记录</span>
<view class="list">
<view class="item" v-for="(item, i) in recordList" :key="i">
<span>{{item.createTime}}</span>
</view>
</view>
</view>
<view class="backIndex">
<button @click="backIndex()">返回首页</button>
</view>
<view class="perinfo">
<view class="myitem">
<span>炫耀一下</span>
<span>演练回顾</span>
<span @click="reChallenge()">重新挑战</span>
</view>
</view>
</view>
</template>
@ -8,12 +35,109 @@
export default {
data() {
return {
"questionFreId":"",
"roleId":"",
questionList: [],
recordList: [],
"ask":"",
"answer":"",
};
},
onLoad(options) {
this.roleId = options.roleId
this.questionFreId = options.questionFreId
this.getQuestionList()
this.getRecordList()
},
methods: {
async getQuestionList() {
const {
data: res
} = await uni.$http.post('/small/questionAnswer/listAll',{questionFreId:this.questionFreId})
if (!res.success) return uni.$showMsg()
this.questionList = res.data
if (this.questionList.length !=0) {
this.ask = this.questionList[0].ask;
this.answer = this.questionList[0].answer;
}
uni.$showMsg('数据请求成功!')
},
async getRecordList() {
const {
data: res
} = await uni.$http.post('/small/questionFre/listAll',{roleId:this.roleId})
if (!res.success) return uni.$showMsg()
this.recordList = res.data
uni.$showMsg('数据请求成功!')
},
backIndex(){
uni.switchTab({
url:'/pages/index/index'
})
},
reChallenge(){
uni.navigateTo({
url: '/subpkg/rechallenge/rechallenge?questionFreId='+this.questionFreId
})
},
itemClickHandler(item) {
if(item !== ""){
this.ask= item.ask
this.answer= item.answer
}
},
}
}
</script>
<style lang="scss">
.title{
font-size: 18px;
text-align: center;
}
.question-list {
display: flex;
justify-content: space-around;
margin: 15px 0;
.question-item{
width: 60rpx;
height: 60rpx;
align-items: center;
background-color: lightgreen;
color: white;
}
}
.answer-content{
border: 1px solid lightgreen;
width: 96%;
margin-left: 2%;
height: 400rpx;
border-radius: 10px;
}
.myitem span {
position: relative;
margin: 2% 17% 0 0;
padding-right: 0.6rem;
font-size: 0.8rem;
color: #666;
}
.myitem span b {
color: #333;
font-size: 1.3rem;
}
.myitem span i {
position: absolute;
top: 0;
right: 0;
width: 8px;
height: 8px;
border-radius: 100%;
background-color: #fb3737;
}
</style>

85
subpkg/rechallenge/rechallenge.vue

@ -0,0 +1,85 @@
<template>
<view>
<span class="title">重新挑战</span>
<view class="background-info">
您上次挑战的场景是{{sceneName}}挑战角色是 {{roleName}}共计{{total}}道题目您可从第1题开始重新挑战或者任意选择其中一道题重新挑战
</view>
<scroll-view class="question-info" scroll-y>
<view class="question-list">
<view class="question-item" v-for="(item, i) in questionList" :key="i" @click="itemClickHandler(item)">
<view class="question-num">{{i+1}}:{{item.ask}}</view>
<image :src="backgroundImg"></image>
</view>
</view>
</scroll-view>
</view>
</template>
<script>
export default {
data() {
return {
"sceneName":"",
"roleName":"",
"backgroundImg":"",
"total":0,
"questionFreId":"",
questionList:[]
}
},
onLoad(options) {
this.questionFreId = options.questionFreId
this.getQuestionList()
this.getRelationInfo()
},
methods: {
async getQuestionList() {
const {
data: res
} = await uni.$http.post('/small/questionAnswer/listAll',{questionFreId:this.questionFreId})
if (!res.success) return uni.$showMsg()
this.questionList = res.data
this.total = res.data.length
//uni.$showMsg('')
},
async getRelationInfo() {
const {
data: res
} = await uni.$http.post('/small/questionFre/getRelationInfo',this.questionFreId)
if (!res.success) return uni.$showMsg()
if (res.data != null) {
this.roleName = res.data.sceneRole != null ? res.data.sceneRole.name : ""
this.sceneName = res.data.sceneManage != null ? res.data.sceneManage.name : ""
this.backgroundImg = res.data.file.length!=0 ? uni.$http.baseUrl +res.data.file[0].uploadPath : ""
}
//uni.$showMsg('')
},
}
}
</script>
<style>
.title{
margin-left: 40%;
font-size: 20px;
}
.background-info{
border: 1px solid lightgreen;
width: 96%;
margin-left: 2%;
height: 200rpx;
border-radius: 10px;
}
.question-info{
border: 1px solid lightgreen;
width: 96%;
margin-top: 5%;
margin-left: 2%;
height: 880rpx;
border-radius: 10px;
}
.question-num{
width: 96%;
height: 60rpx;
}
</style>

3
utils/config.js

@ -1,2 +1,3 @@
let url_config = "http://localhost:85/"
// let url_config = 'http://146.56.223.227:9527/'
let url_config = 'http://localhost:85/'
export default url_config
Loading…
Cancel
Save