1、优化空组件; 2、处理作业详情放回数据图片展示问题;3、添加答题器; 4、添加主页答题器入口;5、添加网络打印测试页(不可使用)
parent
8f0855a0e7
commit
600a7b9a6e
@ -0,0 +1,23 @@
|
||||
import request from '@/utils/network/request';
|
||||
|
||||
/**
|
||||
* 获取答题器选项
|
||||
*/
|
||||
export function getIClickerData(data, config = {}) {
|
||||
return request({
|
||||
url: '/api/user.ashx?act=studenticlicker',
|
||||
method: 'GET',
|
||||
data
|
||||
}, config)
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交答题器数据
|
||||
*/
|
||||
export function submitIClickerData(data, config = {}) {
|
||||
return request({
|
||||
url: '/api/user.ashx?act=studenticlicker',
|
||||
method: 'POST',
|
||||
data
|
||||
}, config)
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 6.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 39 KiB |
@ -0,0 +1,13 @@
|
||||
.uni-modal {
|
||||
max-width: 400px!important;
|
||||
}
|
||||
|
||||
.uni-modal__bd {
|
||||
max-height: 460px!important;
|
||||
font-size: $uni-font-size-mini!important;
|
||||
}
|
||||
|
||||
.uni-modal__ft {
|
||||
font-size: $uni-font-size-mini!important;
|
||||
line-height: 66px!important;
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
$optionW: 120px;
|
||||
$optionH: 120px;
|
||||
|
||||
.answer-options {
|
||||
height: calc(100vh - 66px);
|
||||
}
|
||||
|
||||
.option {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: $optionW;
|
||||
height: $optionH;
|
||||
border-radius: 10rpx;
|
||||
font-size: $uni-font-size-lg;
|
||||
font-weight: bold;
|
||||
background-color: $uni-bg-color-grey;
|
||||
|
||||
&.select {
|
||||
background-color: $uni-color-primary;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.handle-icon {
|
||||
+ .handle-icon {
|
||||
margin-left: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.option {
|
||||
&.selected {
|
||||
color: #fff;
|
||||
background-color: $uni-color-primary;
|
||||
}
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
<template>
|
||||
<view class="i-clicker-page">
|
||||
<ch-nav-bar title="答题器" :height="66">
|
||||
<template v-slot:right>
|
||||
<uni-icons class="handle-icon" type="reload" size="56" color="#fff" @tap="refresh"/>
|
||||
<uni-icons class="handle-icon" type="checkmarkempty" size="56" color="#fff" @tap="submitAnswer"/>
|
||||
</template>
|
||||
</ch-nav-bar>
|
||||
<ch-empty emptyText="暂无答题任务" v-if="!options.length"></ch-empty>
|
||||
<ch-flex class="answer-options" justify="around" items="center" @tap.native="selectOpt" v-else>
|
||||
<block v-for="option in options" :key="option.id">
|
||||
<view class="option" :class="{ 'selected': selectOpts.includes(option.id) }" :data-opt="option">
|
||||
{{ option.text }}
|
||||
</view>
|
||||
</block>
|
||||
</ch-flex>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { getIClickerData, submitIClickerData } from '@/api/iClicker.js'
|
||||
import { reactive, toRefs } from 'vue';
|
||||
|
||||
const defaultOptions = [
|
||||
{
|
||||
id: '001',
|
||||
text: 'A'
|
||||
},
|
||||
{
|
||||
id: '002',
|
||||
text: 'B'
|
||||
},
|
||||
{
|
||||
id: '003',
|
||||
text: 'C'
|
||||
},
|
||||
{
|
||||
id: '004',
|
||||
text: 'D'
|
||||
},
|
||||
]
|
||||
|
||||
const data = reactive({
|
||||
options: [...defaultOptions],
|
||||
selectOpts: []
|
||||
})
|
||||
|
||||
const { options, selectOpts } = toRefs(data);
|
||||
|
||||
function selectOpt (e) {
|
||||
const opt = e.target.dataset.opt || null;
|
||||
if (!opt) return;
|
||||
const index = selectOpts.value.findIndex(id => id == opt.id)
|
||||
selectOpts.value = index == -1 ? [...selectOpts.value, opt.id]
|
||||
: selectOpts.value.filter(id => id !== opt.id)
|
||||
}
|
||||
|
||||
function submitAnswer () {
|
||||
uni.showModal({
|
||||
content: '确定要提交答案?',
|
||||
confirmText: '提交',
|
||||
cancelText: '放弃',
|
||||
success: () => {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function refresh () {
|
||||
selectOpts.value = [];
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import './IClicker.scss'
|
||||
</style>
|
Loading…
Reference in New Issue