12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139 |
- <!-- -->
- <template>
- <div :class="['Big-Book-PictureBox']" v-if="isShowTemp">
- <!-- <ul class="Big-Book-PictureBox-item" v-for="(item,index) in curQue.queList" :key="index"> -->
- <h2>{{curQue.title}}</h2>
- <li v-for="(items, indexs) in curQue.option" :key="indexs">
- <span class="xuhao" v-if="items.xuhao">{{items.xuhao}}</span>
- <template v-if="ChildType != 'image_gdcy' && items.hanziSite == 'top'">
- <div class="hanzi-box hanzi-box-top" v-if="items.pinyin || items.hanzi">
- <span
- v-if="
- items.pinyin && (!items.pinyinSite || items.pinyinSite == 'top')
- "
- class="pinyin"
- >{{ items.pinyin }}</span
- >
- <p v-if="items.hanzi">{{ items.hanzi }}</p>
- <span
- v-if="items.pinyin && items.pinyinSite == 'bottom'"
- class="pinyin"
- >{{ items.pinyin }}</span
- >
- </div>
- </template>
- <div v-for="(itemss, indexss) in items.img_list" :key="indexss">
- <el-image
- :src="itemss.id"
- fit="scale-down"
- class="img_url"
- @click="playmicrophone(items.mp3_list[0].id, 'mp3')"
- >
- <div slot="placeholder" class="image-slot">
- <img src="../../../assets/common/icon-imgloading.png" />
- </div>
- </el-image>
- </div>
- <template
- v-if="
- ChildType != 'image_gdcy' &&
- (!items.hanziSite || items.hanziSite == 'bottom')
- "
- >
- <div class="hanzi-box" v-if="items.pinyin || items.hanzi">
- <span
- v-if="
- items.pinyin && (!items.pinyinSite || items.pinyinSite == 'top')
- "
- class="pinyin"
- >{{ items.pinyin }}</span
- >
- <p v-if="items.hanzi">{{ items.hanzi }}</p>
- <span
- v-if="items.pinyin && items.pinyinSite == 'bottom'"
- class="pinyin"
- >{{ items.pinyin }}</span
- >
- </div>
- </template>
- <template
- v-if="
- ChildType == 'image_input' ||
- ChildType == 'image_input_three' ||
- ChildType == 'image_wordInput'
- "
- >
- <template v-if="judgeAnswer == 'standardAnswer'">
- <input
- v-model="curQue.correct[0].input[0]"
- placeholder=""
- @blur="handleInput('input', 0)"
- :readonly="TaskModel == 'ANSWER'"
- maxlength="200"
- :class="['singleInput', 'userRight', inputAnswerClass('input', 0)]"
- />
- </template>
- <template v-else>
- <input
- v-model="curQue.Bookanswer[0].input.input[0].value"
- placeholder=""
- @blur="handleInput('input', 0)"
- :readonly="TaskModel == 'ANSWER'"
- maxlength="200"
- :class="['singleInput', inputAnswerClass('input', 0)]"
- />
- </template>
- </template>
- <!-- <input class="singleInput" placeholder="输入" @blur="handleInput(index,indexs)" v-if="fn_list_obj[index]&&fn_list_obj[index].indexOf('input')>-1"> -->
- <!-- 补齐输入 -->
- <template v-if="ChildType == 'image_gdcy'">
- <div class="fill-box">
- <b v-if="items.hanzi">{{ items.hanzi }}</b>
- <template v-if="judgeAnswer == 'standardAnswer'">
- <input
- v-model="curQue.correct[0].input[0]"
- placeholder=""
- @blur="handleInput('input', 0)"
- :readonly="true"
- maxlength="200"
- :class="inputAnswerClass('input', 0)"
- />
- </template>
- <template v-else>
- <input
- v-model="curQue.Bookanswer[0].input.input[0].value"
- placeholder=""
- @blur="handleInput('input', 0)"
- :readonly="TaskModel == 'ANSWER'"
- maxlength="200"
- :class="inputAnswerClass('input', 0)"
- />
- </template>
- </div>
- </template>
- <!-- 双输入 -->
- <template v-if="ChildType == 'image_dobleinput'">
- <div class="DoubleInput-box">
- <template v-if="judgeAnswer == 'standardAnswer'">
- <input
- placeholder=""
- v-model="curQue.correct[0].input[0]"
- :readonly="true"
- maxlength="200"
- :class="inputAnswerClass('input', 0)"
- />
- <input
- placeholder=""
- v-model="curQue.correct[0].input[1]"
- :readonly="true"
- maxlength="200"
- :class="inputAnswerClass('input', 1)"
- />
- </template>
- <template v-else>
- <input
- placeholder=""
- @blur="handleInput('input', 0)"
- v-model="curQue.Bookanswer[0].input.input[0].value"
- :readonly="TaskModel == 'ANSWER'"
- maxlength="200"
- :class="inputAnswerClass('input', 0)"
- />
- <input
- placeholder=""
- @blur="handleInput('input', 1)"
- v-model="curQue.Bookanswer[0].input.input[1].value"
- :readonly="TaskModel == 'ANSWER'"
- maxlength="200"
- :class="inputAnswerClass('input', 1)"
- />
- </template>
- </div>
- </template>
- <!-- 判断 -->
- <template v-if="ChildType == 'image_judge'">
- <div class="judge-box">
- <a
- :class="[
- 'right-btn',
- TaskModel != 'ANSWER' ? 'right-btn-hover' : '',
- judgeAnswerClass('true'),
- ]"
- @click="handleSelectJudge('true')"
- ></a>
- <a
- :class="[
- 'error-btn',
- TaskModel != 'ANSWER' ? 'error-btn-hover' : '',
- judgeAnswerClass('false'),
- ]"
- @click="handleSelectJudge('false')"
- ></a>
- </div>
- </template>
- <template
- v-if="ChildType == 'image_single' || ChildType == 'image_checkBox'"
- >
- <div class="option_main">
- <div
- v-for="(itemss, indexss) in items.option"
- :key="'op' + indexss"
- :class="[
- 'xxoption',
- 'option' + curQue.numberList.con,
- singleAnswerClass(indexss),
- checkBoxAnswerClass(indexss),
- ]"
- >
- <template v-if="judgeAnswer == 'standardAnswer'">
- <!-- 单选 -->
- <template v-if="ChildType == 'image_single'">
- <el-radio
- v-model="curQue.correct[0].single[0]"
- :label="indexss"
- :disabled="TaskModel == 'ANSWER'"
- @input="changeSingle"
- >
- <div
- class="hanzi-box hanzi-box-top"
- v-if="itemss.pinyin || itemss.hanzi"
- >
- <span
- v-if="
- itemss.pinyin &&
- (!items.pinyinSite || items.pinyinSite == 'top')
- "
- class="pinyin"
- >{{ itemss.pinyin }}</span
- >
- <p v-if="itemss.hanzi">{{ itemss.hanzi }}</p>
- <span
- v-if="itemss.pinyin && items.pinyinSite == 'bottom'"
- class="pinyin"
- >{{ itemss.pinyin }}</span
- >
- </div>
- </el-radio>
- </template>
- <!-- 复选 -->
- <template v-if="ChildType == 'image_checkBox'">
- <el-checkbox
- v-model="curQue.correct[0].checkBox"
- :label="indexss"
- :disabled="TaskModel == 'ANSWER'"
- >
- <div
- class="hanzi-box hanzi-box-top"
- v-if="itemss.pinyin || itemss.hanzi"
- >
- <span
- v-if="
- itemss.pinyin &&
- (!items.pinyinSite || items.pinyinSite == 'top')
- "
- class="pinyin"
- >{{ itemss.pinyin }}</span
- >
- <p v-if="itemss.hanzi">{{ itemss.hanzi }}</p>
- <span
- v-if="itemss.pinyin && items.pinyinSite == 'bottom'"
- class="pinyin"
- >{{ itemss.pinyin }}</span
- >
- </div>
- </el-checkbox>
- </template>
- </template>
- <template v-else>
- <!-- 单选 -->
- <template v-if="ChildType == 'image_single'">
- <el-radio
- v-model="curQue.Bookanswer[0].single[0].value"
- :label="indexss"
- :disabled="TaskModel == 'ANSWER'"
- @input="changeSingle"
- @click.native.prevent="overallClick(indexss)"
- >
- <div
- class="hanzi-box hanzi-box-top"
- v-if="itemss.pinyin || itemss.hanzi"
- >
- <span
- v-if="
- itemss.pinyin &&
- (!items.pinyinSite || items.pinyinSite == 'top')
- "
- class="pinyin"
- >{{ itemss.pinyin }}</span
- >
- <p v-if="itemss.hanzi">{{ itemss.hanzi }}</p>
- <span
- v-if="itemss.pinyin && items.pinyinSite == 'bottom'"
- class="pinyin"
- >{{ itemss.pinyin }}</span
- >
- </div>
- </el-radio>
- </template>
- <!-- 复选 -->
- <template v-if="ChildType == 'image_checkBox'">
- <el-checkbox
- v-model="curQue.Bookanswer[0].checkBox[0].value"
- :label="indexss"
- :disabled="TaskModel == 'ANSWER'"
- @change="changeCheckBox"
- >
- <div
- class="hanzi-box hanzi-box-top"
- v-if="itemss.pinyin || itemss.hanzi"
- >
- <span
- v-if="
- itemss.pinyin &&
- (!items.pinyinSite || items.pinyinSite == 'top')
- "
- class="pinyin"
- >{{ itemss.pinyin }}</span
- >
- <p v-if="itemss.hanzi">{{ itemss.hanzi }}</p>
- <span
- v-if="itemss.pinyin && items.pinyinSite == 'bottom'"
- class="pinyin"
- >{{ itemss.pinyin }}</span
- >
- </div>
- </el-checkbox>
- </template>
- </template>
- </div>
- </div>
- </template>
- <!-- 三件套 -->
- <div
- class="luyinVoice-box"
- v-if="
- items.mp3_list.length > 0 ||
- (fn_list_obj && fn_list_obj.indexOf('image_record') > -1) ||
- items.RecordControl
- "
- >
- <template v-if="items.mp3_list.length > 0">
- <span
- :class="['voice', mp3Play]"
- @click="playmicrophone(items.mp3_list[0].id, 'mp3')"
- ></span>
- </template>
- <Soundrecord
- @handleWav="handleWav"
- :answerRecordList="
- judgeAnswer != 'standardAnswer'
- ? curQue.Bookanswer[0].recordList
- : []
- "
- :TaskModel="TaskModel"
- :type="items.RecordControl ? items.RecordControl : 'normal'"
- class="luyin-box"
- :class="[items.RecordControl]"
- v-if="fn_list_obj.indexOf('image_record') > -1 || items.RecordControl"
- />
- <!-- <span :class="['luyin',microphoneStatus?'active':'']" @click="microphone"></span>
- <span :class="['play',hasMicro]" @click="playmicrophone(wavblob)"></span> -->
- </div>
- </li>
- <!-- </ul> -->
- </div>
- </template>
- <script>
- import Soundrecord from "../preview/Soundrecord.vue"; // 录音模板
- import Recorder from "js-audio-recorder"; //录音插件
- export default {
- components: { Soundrecord },
- props: ["curQue", "ChildType", "TaskModel", "judgeAnswer"],
- data() {
- return {
- fn_list_obj: "",
- answer: [],
- userAnswer: {
- input: { input: [] }, //输入
- judge: [], // 判断
- single: [],
- checkBox: [],
- recordList: [],
- }, // 记录用户答题内容
- recorder: new Recorder({
- sampleBits: 16, // 采样位数,支持 8 或 16,默认是16
- sampleRate: 16000, // 采样率,支持 11025、16000、22050、24000、44100、48000,根据浏览器默认值,我的chrome是48000
- numChannels: 1, // 声道,支持 1 或 2, 默认是1
- }),
- microphoneStatus: false,
- hasMicro: "", // 录音后的样式class
- wavblob: null,
- audio: new window.Audio(),
- oldUrl: null, // 存储上个播放音频地址
- mp3Play: "", // 音频播放
- userErrorNumberTotal: 0,
- };
- },
- computed: {
- isShowTemp() {
- let _this = this;
- let bool = false;
- if (_this.curQue && _this.curQue.Bookanswer) {
- if (_this.judgeAnswer == "standardAnswer") {
- if (_this.userErrorNumberTotal > 0) {
- bool = true;
- } else {
- bool = false;
- }
- } else {
- bool = true;
- }
- }
- return bool;
- },
- inputAnswerClass() {
- return function (key, index) {
- let _this = this;
- let classname = "";
- if (_this.judgeAnswer == "standardAnswer") {
- classname = "userRight";
- } else if (
- _this.judgeAnswer == "studentAnswer" ||
- _this.judgeAnswer == "userAnswer"
- ) {
- let answer = _this.curQue.Bookanswer[0].input.input[index].value;
- let correct = _this.curQue.correct[0][key][index];
- if (correct) {
- if (answer == correct) {
- classname = "userRight";
- } else {
- classname = "userError";
- }
- }
- }
- return classname;
- };
- },
- judgeAnswerClass() {
- return function (type) {
- let _this = this;
- let classname = "";
- let answer = _this.curQue.Bookanswer[0].judge[0].value;
- let correct = _this.curQue.correct[0].judge[0];
- if (_this.judgeAnswer == "standardAnswer") {
- if (correct == type) {
- classname = "userRight_" + type;
- }
- } else if (
- _this.judgeAnswer == "studentAnswer" ||
- _this.judgeAnswer == "userAnswer"
- ) {
- if (answer == type) {
- if (correct) {
- if (answer == correct) {
- classname = "userRight_" + type;
- } else {
- classname = "userError_" + type;
- }
- } else {
- classname = "active";
- }
- }
- } else {
- if (answer == type) {
- classname = "active";
- }
- }
- return classname;
- };
- },
- singleModel() {
- let _this = this;
- let result =
- _this.judgeAnswer == "standardAnswer"
- ? _this.curQue.correct[0].single[0]
- : _this.curQue.Bookanswer[0].single[0].value;
- return result;
- },
- singleAnswerClass() {
- return function (index) {
- let _this = this;
- let classname = "";
- if (_this.ChildType == "image_single") {
- let answer = _this.curQue.Bookanswer[0].single[0].value;
- let correct = _this.curQue.correct[0].single[0];
- if (_this.judgeAnswer == "standardAnswer") {
- if ((correct || correct === 0) && index === correct) {
- classname = "userRight";
- }
- } else if (
- _this.judgeAnswer == "studentAnswer" ||
- _this.judgeAnswer == "userAnswer"
- ) {
- if (correct || correct === 0) {
- if (answer === correct) {
- if (correct === index) {
- classname = "userRight";
- }
- } else {
- if (answer === index) {
- classname = "userError";
- }
- }
- }
- }
- }
- return classname;
- };
- },
- checkBoxAnswerClass() {
- return function (index) {
- let _this = this;
- let classname = "";
- if (_this.ChildType == "image_checkBox") {
- let answer = _this.curQue.Bookanswer[0].checkBox[0].value;
- let correct = _this.curQue.correct[0].checkBox;
- if (_this.judgeAnswer == "standardAnswer") {
- if (correct && correct.length > 0) {
- if (correct.indexOf(index) > -1) {
- classname = "userRight";
- }
- }
- } else if (
- _this.judgeAnswer == "studentAnswer" ||
- _this.judgeAnswer == "userAnswer"
- ) {
- if (correct && correct.length > 0) {
- if (correct.indexOf(index) > -1 && answer.indexOf(index) > -1) {
- classname = "userRight";
- } else if (
- answer.indexOf(index) > -1 &&
- correct.indexOf(index) < 0
- ) {
- classname = "userError";
- }
- }
- }
- }
- return classname;
- };
- },
- },
- watch: {},
- //方法集合
- methods: {
- handleFnList() {
- let _this = this;
- _this.userErrorNumberTotal = 0;
- if (!_this.curQue.Bookanswer) {
- _this.curQue.correct.forEach((item, index) => {
- //单输入/补全输入
- if (
- _this.ChildType == "image_input" ||
- _this.ChildType == "image_gdcy" ||
- _this.ChildType == "image_input_three" ||
- _this.ChildType == "image_wordInput"
- ) {
- let obj = {
- input: [
- {
- value: "",
- userAnswerJudge:
- item.input[0] || item.input[0] === 0
- ? "[JUDGE##F##JUDGE]"
- : "",
- },
- ],
- };
- _this.userAnswer.input = JSON.parse(JSON.stringify(obj));
- }
- //双输入
- if (_this.ChildType == "image_dobleinput") {
- let obj = {
- input: [
- {
- value: "",
- userAnswerJudge:
- item.input[0] || item.input[0] === 0
- ? "[JUDGE##F##JUDGE]"
- : "",
- },
- {
- value: "",
- userAnswerJudge:
- item.input[1] || item.input[1] === 0
- ? "[JUDGE##F##JUDGE]"
- : "",
- },
- ],
- };
- this.userAnswer.input = JSON.parse(JSON.stringify(obj));
- }
- //判断
- if (_this.ChildType == "image_judge") {
- let obj_judge = {
- value: "",
- userAnswerJudge: item.judge.length > 0 ? "[JUDGE##F##JUDGE]" : "",
- };
- _this.userAnswer.judge.push(JSON.parse(JSON.stringify(obj_judge)));
- }
- //单选
- if (_this.ChildType == "image_single") {
- let obj_single = {
- value: "",
- userAnswerJudge:
- item.single.length > 0 ? "[JUDGE##F##JUDGE]" : "",
- };
- _this.userAnswer.single.push(
- JSON.parse(JSON.stringify(obj_single))
- );
- }
- //单选
- if (_this.ChildType == "image_checkBox") {
- let obj_box = {
- value: [],
- userAnswerJudge:
- item.checkBox.length > 0 ? "[JUDGE##F##JUDGE]" : "",
- };
- _this.userAnswer.checkBox.push(JSON.parse(JSON.stringify(obj_box)));
- }
- });
- _this.$set(_this.curQue, "Bookanswer", []);
- this.curQue.Bookanswer.push(
- JSON.parse(JSON.stringify(this.userAnswer))
- );
- } else {
- let BookanswerStr = JSON.stringify(_this.curQue.Bookanswer);
- let errReg = /\[JUDGE##F##JUDGE\]/g;
- if (errReg.test(BookanswerStr)) {
- let errorArr = BookanswerStr.match(/\[JUDGE##F##JUDGE\]/g);
- _this.userErrorNumberTotal = errorArr.length;
- }
- }
- let obj = "";
- this.curQue.fn_list.forEach((node) => {
- if (node.isFn) {
- obj += node.type + ",";
- }
- });
- this.fn_list_obj = obj;
- },
- // 修改正确选项中得某一个为正确答案
- changAnswer(index, type) {
- if (type == "single") {
- } else if (type == "checkBox") {
- let correct = [];
- this.curQue.option.forEach((item, i) => {
- if (item.isChecked) {
- correct.push(i);
- }
- });
- this.answer[0].checkBox = correct;
- } else if (type == "judge") {
- //console.log(this.answer);
- }
- },
- // 去掉前后空格
- handleInput(key, indexs) {
- if (indexs || indexs === 0) {
- let res = this.curQue.Bookanswer[0][key].input[indexs].value.trim();
- this.$set(this.curQue.Bookanswer[0][key].input[indexs], "value", res);
- let hasError = false,
- hasRight = false;
- this.curQue.correct[0].input.forEach((item, index) => {
- let answer = this.curQue.Bookanswer[0][key].input[index].value;
- if (item) {
- if (item != answer) {
- this.$set(
- this.curQue.Bookanswer[0][key].input[index],
- "userAnswerJudge",
- "[JUDGE##F##JUDGE]"
- );
- } else {
- this.$set(
- this.curQue.Bookanswer[0][key].input[index],
- "userAnswerJudge",
- "[JUDGE##T##JUDGE]"
- );
- }
- }
- });
- // if (hasError) {
- // this.$set(
- // this.curQue.Bookanswer[0][key],
- // "userAnswerJudge",
- // "[JUDGE##F##JUDGE]"
- // );
- // }
- // if (!hasError && hasRight) {
- // this.$set(
- // this.curQue.Bookanswer[0][key],
- // "userAnswerJudge",
- // "[JUDGE##T##JUDGE]"
- // );
- // }
- } else {
- this.curQue.Bookanswer[0][key] = this.curQue.Bookanswer[0][key].trim();
- }
- this.$forceUpdate();
- },
- overallClick(value){
- this.curQue.Bookanswer[0].single[0].value = value===this.curQue.Bookanswer[0].single[0].value?'':value
- this.changeSingle(this.curQue.Bookanswer[0].single[0].value)
- },
- changeSingle(value) {
- let _this = this;
- let correct = _this.curQue.correct[0].single[0];
- if (correct || correct == 0) {
- if (value === correct) {
- _this.$set(
- _this.curQue.Bookanswer[0].single[0],
- "userAnswerJudge",
- "[JUDGE##T##JUDGE]"
- );
- } else {
- _this.$set(
- _this.curQue.Bookanswer[0].single[0],
- "userAnswerJudge",
- "[JUDGE##F##JUDGE]"
- );
- }
- }
- _this.$forceUpdate();
- },
- changeCheckBox() {
- let _this = this;
- let value = _this.curQue.Bookanswer[0].checkBox[0].value;
- let valueStr = value.sort().toString();
- let correct = _this.curQue.correct[0].checkBox;
- let correctStr = correct.sort().toString();
- if (correct && correct.length > 0) {
- if (valueStr == correctStr) {
- _this.$set(
- _this.curQue.Bookanswer[0].checkBox[0],
- "userAnswerJudge",
- "[JUDGE##T##JUDGE]"
- );
- } else {
- _this.$set(
- _this.curQue.Bookanswer[0].checkBox[0],
- "userAnswerJudge",
- "[JUDGE##F##JUDGE]"
- );
- }
- }
- _this.$forceUpdate();
- },
- playmicrophone(url, type) {
- if (url) {
- let _this = this;
- if (!this.audio.paused) {
- this.audio.pause();
- if (type == "mp3") {
- _this.mp3Play = "";
- }
- } else if (this.audio.paused && _this.oldUrl == url) {
- _this.audio.play();
- if (type == "mp3") {
- _this.mp3Play = "active";
- }
- } else {
- _this.audio.pause();
- _this.audio.load();
- if (type == "mp3") {
- _this.mp3Play = "active";
- _this.audio.src = url;
- }
- _this.oldUrl = url;
- _this.audio.play();
- }
- }
- },
- // 判断题选择
- handleSelectJudge(obj) {
- let _this = this;
- if (_this.TaskModel != "ANSWER" || !judgeAnswer) {
- _this.$set(_this.curQue.Bookanswer[0].judge[0], "value", obj);
- let correct = _this.curQue.correct[0].judge[0];
- if (correct) {
- if (correct == obj) {
- _this.$set(
- _this.curQue.Bookanswer[0].judge[0],
- "userAnswerJudge",
- "[JUDGE##T##JUDGE]"
- );
- } else {
- _this.$set(
- _this.curQue.Bookanswer[0].judge[0],
- "userAnswerJudge",
- "[JUDGE##F##JUDGE]"
- );
- }
- }
- }
- _this.$forceUpdate();
- },
- handleWav(list, tmIndex) {
- tmIndex = tmIndex ? tmIndex : 0;
- this.$set(this.curQue.Bookanswer[tmIndex], "recordList", list);
- },
- },
- //生命周期 - 创建完成(可以访问当前this实例)
- created() {},
- //生命周期 - 挂载完成(可以访问DOM元素)
- mounted() {
- if (this.curQue) {
- this.handleFnList();
- let obj = {
- single: [],
- checkBox: [],
- judge: [],
- input: [],
- spell: [],
- };
- this.answer.push(obj);
- }
- let _this = this;
- _this.audio.addEventListener("ended", function () {
- _this.mp3Play = "";
- _this.hasMicro = "normal";
- });
- },
- beforeCreate() {}, //生命周期 - 创建之前
- beforeMount() {}, //生命周期 - 挂载之前
- beforeUpdate() {}, //生命周期 - 更新之前
- updated() {}, //生命周期 - 更新之后
- beforeDestroy() {}, //生命周期 - 销毁之前
- destroyed() {}, //生命周期 - 销毁完成
- activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
- };
- </script>
- <style lang='scss' scoped>
- //@import url(); 引入公共css类
- .Big-Book-PictureBox {
- width: 100%;
- margin-bottom: 24px;
- // &.PictureBoxFlex{
- // display: flex;
- // justify-content: space-between;
- // .Big-Book-PictureBox-item{
- // width: 384px;
- // }
- // }
- // .Big-Book-PictureBox-item{
- // list-style: none;
- // background: #F3F3F3;
- // border-radius: 8px;
- // padding: 16px;
- // margin: 0;
- // display: flex;
- // flex-flow: wrap;
- h2{
- word-break: break-word;
- font-family: 'robot';
- font-weight: 700;
- font-size: 20px;
- line-height: 150%;
- margin: 0 0 16px;
- color: #000000;
- }
- li {
- list-style: none;
- padding: 8px;
- border-radius: 8px;
- border: 1px solid rgba(0, 0, 0, 0.1);
- background: #fff;
- position: relative;
- .xuhao{
- position: absolute;
- top: -4px;
- left: -4px;
- font-weight: 400;
- font-size: 12px;
- line-height: 14px;
- font-family: 'robot';
- color: #FFFFFF;
- padding: 1px 4px;
- background: #e35454;
- border-radius: 8px;
- display: block;
- min-width: 16px;
- text-align: center;
- }
- .option_main {
- display: flex;
- flex-wrap: wrap;
- .xxoption {
- display: flex;
- align-items: center;
- justify-content: center;
- margin-bottom: 8px;
- border: 1px transparent solid;
- border-radius: 4px;
- &.userRight {
- background: rgba(44, 167, 103, 0.1);
- border-color: #2ca767;
- }
- &.userError {
- background: rgba(237, 52, 45, 0.1);
- border-color: #ed342d;
- }
- }
- .option1 {
- width: 100%;
- }
- .option2 {
- width: 50%;
- }
- .option3 {
- width: 33.33%;
- }
- .option4 {
- width: 25%;
- }
- }
- .hanzi-box {
- margin-top: 8px;
- &.hanzi-box-top {
- margin-top: 0px;
- }
- > span.pinyin {
- display: block;
- text-align: center;
- font-family: "GB-PINYINOK-B";
- font-size: 14px;
- line-height: 1.3;
- color: #000000;
- }
- > p {
- color: #000000;
- font-size: 16px;
- line-height: 150%;
- text-align: center;
- margin: 0;
- width: 100%;
- font-family: "FZJCGFKTK";
- }
- }
- input {
- flex: 1;
- width: 100%;
- border: 1px solid rgba(0, 0, 0, 0.15);
- box-sizing: border-box;
- border-radius: 4px;
- outline: none;
- height: 32px;
- padding: 4px 8px;
- color: #000000;
- text-align: center;
- font-size: 16px;
- line-height: 150%;
- &.singleInput {
- margin-top: 8px;
- }
- &.userRight {
- color: #2ca767;
- }
- &.userError {
- color: #ed342d;
- }
- }
- .luyinVoice-box {
- width: 100%;
- margin-top: 8px;
- display: flex;
- -ms-flex-pack: justify;
- align-items: center;
- span {
- width: 24px;
- height: 24px;
- background-position: center;
- background-repeat: no-repeat;
- background-size: 24px;
- margin-right: 8px;
- cursor: pointer;
- &:first-child {
- margin-left: 0px;
- }
- &.voice {
- background-image: url("../../../assets/newImage/common/icon-voice-red.png");
- }
- &.active {
- background-image: url("../../../assets/newImage/common/icon-voice-play-red.png");
- }
- // &.luyin{
- // background-image: url('../../../assets/newImage/common/luyin.png');
- // &.active {
- // background-image: url('../../../assets/newImage/common/luyin-active.png');
- // }
- // }
- // &.play{
- // background-image: url('../../../assets/newImage/common/luyin-play.png');
- // &.normal {
- // background-image: url('../../../assets/newImage/common/luyin-play-active.png');
- // }
- // &.stop {
- // background-image: url('../../../assets/newImage/common/luyin-play-stop.png');
- // }
- // }
- }
- .luyin-box {
- flex: 1;
- justify-content: start;
- padding: 0 12px;
- border: 1px solid rgba(0, 0, 0, 0.1);
- border-radius: 8px;
- &.mini {
- width: 64px;
- }
- &.normal {
- width: 129px;
- }
- &.pro {
- width: 200px;
- }
- &.promax {
- width: 280px;
- }
- }
- }
- .fill-box {
- display: flex;
- align-items: center;
- margin-top: 8px;
- b {
- margin-right: 8px;
- color: #000000;
- font-weight: normal;
- font-size: 16px;
- }
- }
- .DoubleInput-box {
- display: flex;
- align-items: center;
- margin-top: 8px;
- > input:first-child {
- margin-right: 8px;
- }
- }
- .el-radio,
- .el-checkbox {
- // width: 100%;
- // margin: 8px 0 0;
- // text-align: center;
- // height: 32px;
- // line-height: 32px;
- margin-right: 8px;
- }
- .judge-box {
- margin-top: 8px;
- display: flex;
- justify-content: center;
- a {
- width: 70px;
- height: 32px;
- background: #f7f7f7 url("../../../assets/newImage/common/right-btn.png")
- center no-repeat;
- background-size: 24px;
- border-radius: 4px;
- border: 1px solid #f7f7f7;
- &.right-btn-hover:hover,
- &.active {
- background-color: #e5fff0;
- border-color: #00c850;
- }
- &.error-btn {
- background: #f7f7f7
- url("../../../assets/newImage/common/error-btn.png") center
- no-repeat;
- background-size: 24px;
- margin-left: 4px;
- &.error-btn-hover:hover,
- &.active {
- background-color: #ffe5e5;
- border-color: #de4444;
- }
- }
- &.userRight_true {
- background-color: rgba(44, 167, 103, 0.1);
- border: 1px solid #2ca767;
- }
- &.userError_true {
- border: 1px solid #ed342d;
- background: rgba(237, 52, 45, 0.1)
- url("../../../assets/newImage/common/judge-dui.png") center
- no-repeat;
- background-size: 24px;
- }
- &.userRight_false {
- border: 1px solid #2ca767;
- background: rgba(44, 167, 103, 0.1)
- url("../../../assets/newImage/common/judge-cuo.png") center
- no-repeat;
- background-size: 24px;
- }
- &.userError_false {
- background-color: rgba(237, 52, 45, 0.1);
- border: 1px solid #ed342d;
- }
- }
- }
- }
- .img_url {
- width: 100%;
- height: 128px;
- cursor: pointer;
- }
- // }
- }
- .NNPE-tableList-tr-last {
- .Big-Book-PictureBox {
- margin-bottom: 0;
- }
- }
- .NPC-Big-Book-preview-green {
- .Big-Book-PictureBox {
- li{
- .xuhao{
- background: #24b99e;
- }
- }
- }
- }
- .NPC-Big-Book-preview-brown {
- .Big-Book-PictureBox {
- li{
- .xuhao{
- background: #bd8865;
- }
- }
- }
- }
- </style>
- <style lang="scss">
- ul,
- li {
- list-style: none;
- padding: 0;
- margin: 0;
- }
- .Big-Book-PictureBox {
- .el-checkbox__label,
- .el-radio__label {
- padding: 0;
- }
- }
- .xxoption {
- label {
- display: flex;
- justify-content: center;
- align-items: center;
- > .el-radio__label {
- margin-left: 8px;
- }
- }
- }
- </style>
|