|
|
- <template>
- <view class="container">
- <view v-for="(item,index) in radioData" :key="index">
- <view class="font28" style="font-weight: 600">
- <text style="color: red">*</text>
- {{ index + 1 }}、{{ item.questionStem }}
- </view>
- <up-radio-group
- v-model="radioValue[index]"
- placement="column"
- iconPlacement="right"
- size="40rpx"
- >
- <up-radio
- activeColor="#4cc0ec"
- :customStyle="{marginBottom: '10rpx'}"
- v-for="items in item.options"
- :key="items"
- :labelColor="radioValue[index]===items.value?'#4cc0ec':''"
- :label="items.content"
- :name="items.value"
- @change="radioChange"
- >
- </up-radio>
- </up-radio-group>
- <u-line margin="20rpx 0"></u-line>
- </view>
- </view>
- <submitBut text="下一步" @click="handleClick"></submitBut>
- </template>
-
- <script setup>
- import submitBut from "../../../components/submitBut/index.vue"
- import {ref} from "vue";
- import tab from "@/plugins/tab";
- import {getBasicQuestion, submitBasic} from "../../../api/work/work";
- import {getStorage, setStorage} from "../../../utils/auth";
- import {getPersonalInfo} from "../../../api/system/user";
- import modal from "../../../plugins/modal";
-
- const radioData = ref([])
- const radioValue = ref([])
- const handleClick = async () => {
- tab.navigateTo("/otherPages/workbenchManage/trainingExamination/index")
- if (3 - getStorage("userInfo").answerCount > 0) {
- if (radioValue.value.length === 33) {
- let flag = true
- console.log(radioValue.value);
- radioValue.value.forEach((item, i) => {
- if (radioData.value[i].answerNumber.indexOf(item) === -1) {
- flag = false
- }
- })
- await submitBasic({
- staffId: getStorage("userInfo").id,
- passed: flag
- })
- await getUserInfo()
- if (flag) {
- tab.navigateTo("/otherPages/workbenchManage/trainingExamination/index")
- } else {
- radioValue.value = []
- modal.msg("提目未全部回答对,请重新答题")
- tab.navigateBack()
- }
- } else {
- modal.msg("提目未全部作答,请检查")
- }
- } else {
- modal.msg("答题机会已用完")
- }
- }
- const getUserInfo = async () => {
- const {data} = await getPersonalInfo()
- setStorage('userInfo', data)
- }
- const getList = async () => {
- const {data} = await getBasicQuestion();
- radioData.value = data || []
- }
- getList()
- </script>
-
- <style lang="scss" scoped>
- @import "index";
- </style>
|