zhongshujie
2024-08-08 3c3336804abaee7ce364cfb7be10d3849f6dd9cc
src/books/artAndDrama/view/components/chapter002.vue
@@ -4,7 +4,7 @@
      <div v-if="showPageList.indexOf(14) > -1">
        <h1 id="a004">
          <img class="img-0" alt="" src="../../assets/images/dy2.jpg" />
          <audio :src="auidoPathOne" controls class="audio" @play="audioPlay"></audio>
          <audio :src="auidoPathOne" controls controlslist="noplaybackrate nodownload" class="audio"></audio>
        </h1>
        <div class="bodystyle">
          <div class="bk">
@@ -39,17 +39,17 @@
          </h3>
          <p class="text"><span class="hs1">◇</span>我是小画家</p>
          <p class="text">保持头部不动,试着用眼神画出下面的图案吧!</p>
          <p class="center">
          <p class="center openImgBox">
            <img class="img-e" alt="" src="../../assets/images/0016-1.jpg" />
          </p>
          <p class="text"><span class="hs1">◇</span>嗅觉大冒险</p>
          <p class="text">
            你最爱吃的食物是 <input v-model="questionData.warnUp.one" class="input-bottom-border fz-18"
              @change="setBookQuestion" style="width: 10%" />。当闻到它的味道时,你会做出什么表情呢?
              @change="setBookQuestion" style="width: 13%" />。当闻到它的味道时,你会做出什么表情呢?
          </p>
          <p class="text">
            你最不爱吃的食物是 <input v-model="questionData.warnUp.two" class="input-bottom-border fz-18"
              @change="setBookQuestion" style="width: 10%" />。当闻到它的味道时,你会做出什么表情呢?
              @change="setBookQuestion" style="width: 13%" />。当闻到它的味道时,你会做出什么表情呢?
          </p>
          <h3 class="lefth3 openImgBox" id="c012">
            <img class="img-gn1" alt="" src="../../assets/images/czysj.jpg" />
@@ -80,24 +80,20 @@
          <h3 class="lefth3" id="c013"><img class="img-gn1" alt="" src="../../assets/images/rhybx.jpg" /></h3>
          <p class="text"><span class="hs1">◇</span>我们的世界五彩斑斓。请你填一填,提到这些颜色,你想到了哪些事物?</p>
          <p class="text">黄色:柠檬、<input v-model="questionData.warnUp.three" class="input-bottom-border fz-18"
              @change="setBookQuestion" style="width: 15%" />、<input v-model="questionData.warnUp.four"
              class="input-bottom-border fz-18" @change="setBookQuestion" style="width: 15%" />。</p>
          <p class="text">红色:鞭炮、<input v-model="questionData.warnUp.five" class="input-bottom-border fz-18"
              @change="setBookQuestion" style="width: 15%" />、<input v-model="questionData.warnUp.six"
              class="input-bottom-border fz-18" @change="setBookQuestion" style="width: 15%" />。</p>
          <p class="text">绿色:叶子、<input v-model="questionData.warnUp.seven" class="input-bottom-border fz-18"
              @change="setBookQuestion" style="width: 15%" />、<input v-model="questionData.warnUp.eight"
              class="input-bottom-border fz-18" @change="setBookQuestion" style="width: 15%" />。</p>
          <p class="text">黑色:黑板、<input v-model="questionData.warnUp.nine" class="input-bottom-border fz-18"
              @change="setBookQuestion" style="width: 15%" />、<input v-model="questionData.warnUp.ten"
              class="input-bottom-border fz-18" @change="setBookQuestion" style="width: 15%" />。</p>
          <p class="text">蓝色:大海、<input v-model="questionData.warnUp.eleven" class="input-bottom-border fz-18"
              @change="setBookQuestion" style="width: 15%" />、<input v-model="questionData.warnUp.twelve"
              class="input-bottom-border fz-18" @change="setBookQuestion" style="width: 15%" />。</p>
              @change="setBookQuestion" style="width: 70%" /></p>
          <p class="text">红色:鞭炮、<input v-model="questionData.warnUp.four" class="input-bottom-border fz-18"
              @change="setBookQuestion" style="width: 70%" /></p>
          <p class="text">绿色:叶子、<input v-model="questionData.warnUp.five" class="input-bottom-border fz-18"
              @change="setBookQuestion" style="width: 70%" /></p>
          <p class="text">黑色:黑板、<input v-model="questionData.warnUp.six" class="input-bottom-border fz-18"
              @change="setBookQuestion" style="width: 70%" /></p>
          <p class="text">蓝色:大海、<input v-model="questionData.warnUp.seven" class="input-bottom-border fz-18"
              @change="setBookQuestion" style="width: 70%" /></p>
          <h3 class="lefth3" id="c014" style="margin-top: 7%;"><img class="img-gn1" alt=""
              src="../../assets/images/czysj.jpg" /></h3>
          <p class="text"><span class="hs1">◇</span>阅读下面的文字,为小蚂蚁选择一种性格吧。</p>
          <choice class="text" :questions="questions"></choice>
          <!-- <p class="text"><span class="hs1">◇</span>阅读下面的文字,为小蚂蚁选择一种性格吧。</p> -->
          <drag :question="dragQuestion" :page="16" class="drag-text" />
          <!-- <choice class="text" :questions="questions"  :primaryColor="accentColor"  hoverBackgroundColor="green" hoverColor="white"></choice> -->
          <p class="center  openImgBox"><img class="img-e" alt="" src="../../assets/images/2-2.gif" /></p>
        </div>
        <!-- 此次为页脚部分(需要设置页码) -->
@@ -117,12 +113,16 @@
          <h2 id="b008" class="problem">第三课 闻声识人</h2>
          <h3 class="lefth3" id="c015"><img class="img-gn1" alt="" src="../../assets/images/rhybx.jpg" /></h3>
          <p class="text">常言道:良言一句三冬暖,恶语伤人六月寒。语言在人与人的交往中起着重要的作用,有着无穷的力量。</p>
          <p class="text"><span class="hs1">◇</span>如果朋友心情不好,你该怎么安慰他/她呢?</p>
          <p class="text">“<input v-model="questionData.warnUp.thirteen" class="input-bottom-border fz-18"
              @change="setBookQuestion" style="width: 80%" />。”</p>
          <p class="text"><span class="hs1">◇</span>如果你邀请好朋友来家里做客,你该说什么来欢迎他/她呢?</p>
          <p class="text">“<input v-model="questionData.warnUp.fourteen" class="input-bottom-border fz-18"
              @change="setBookQuestion" style="width: 80%" />。”</p>
          <p class="text t-l" ><span class="hs1">◇</span>如果朋友心情不好,你该怎么安慰他/她呢?
            <textarea v-model="questionData.reading.one" placeholder="请输入内容" rows="6"
              style="margin-left: 40px; width: 92%" class="" @change="setBookQuestion" :class="{ 'textarea-focused': isFocused === 'one' }"  @focus="handleFocus('one')"  @blur="handleBlur('one')" ></textarea>
          </p>
          <p class="text t-l"><span class="hs1">◇</span>如果你邀请好朋友来家里做客,你该说什么来欢迎他/她呢?
            <textarea v-model="questionData.reading.two" placeholder="请输入内容" rows="6"
              style="margin-left: 40px; width: 92%" class="" @change="setBookQuestion"  :class="{ 'textarea-focused': isFocused === 'two' }"  @focus="handleFocus('two')"  @blur="handleBlur('two')" ></textarea>
          </p>
          <h3 class="lefth3" id="c016" style="margin-top: 7%;"><img class="img-gn1" alt=""
              src="../../assets/images/czysj.jpg" /></h3>
          <p class="text"><span class="hs1">◇</span>请根据提示读出句子,注意声音和语气的变化。</p>
@@ -193,13 +193,25 @@
        <div class="bodystyle" style="margin-top: 3%">
          <h2 id="b010" class="problem">单元活动任务</h2>
          <h3 class="lefth3" id="c019"><img class="img-gn1" alt="" src="../../assets/images/xsyty.jpg" /></h3>
          <p class="text"><span class="hs1">◇</span>吹纸练习</p>
          <p class="text ends">
            <span><span class="hs1">◇</span>吹纸练习</span>
            <span> <audio :src="auidoPathTwo" controls controlslist="noplaybackrate nodownload"
                class="audio"></audio></span>
          </p>
          <p class="center text" style="margin: 4% 0"><img class="img-e" alt="" src="../../assets/images/0021-1.jpg" />
          </p>
          <p class="text">找一张纸巾,将它按在墙上。移开双手,努力用气息将纸“钉”在墙面上,不要让它向下滑落。</p>
          <p class="text"><span class="hs1">◇</span>吹笔练习</p>
          <p class="text ends">
            <span> <span class="hs1">◇</span>吹笔练习</span>
            <span> <audio :src="auidoPathThree" controls controlslist="noplaybackrate nodownload"
                class="audio"></audio></span>
          </p>
          <p class="text">将一支笔立于桌面,看看你能不能用一口气将它吹倒。</p>
          <p class="text"><span class="hs1">◇</span>吹袋子练习</p>
          <p class="text ends">
            <span><span class="hs1">◇</span>吹袋子练习</span>
            <span> <audio :src="auidoPathFour" controls controlslist="noplaybackrate nodownload"
                class="audio"></audio></span>
          </p>
          <p class="text">将一只塑料袋抛至空中,和你的小伙伴一起轮流吹气,避免塑料袋落地。</p>
        </div>
        <!-- 此处为页脚部分(需要设置页码) -->
@@ -216,22 +228,28 @@
        </h1>
        <img class="headerimg" src="../../assets/images/page5.png" alt="" />
        <div class="bodystyle" style="margin-top: 3%;">
          <p class="text"><span class="hs1">◇</span>吹乒乓球练习</p>
          <p class="text ends">
            <span> <span class="hs1">◇</span>吹乒乓球练习</span>
            <span> <audio :src="auidoPathFive" controls controlslist="noplaybackrate nodownload"
                class="audio"></audio></span>
          </p>
          <p class="text">用气息将桌面上的乒乓球从“起点”运送至“终点”,运送过程中避免乒乓球触碰障碍物。</p>
          <h3 class="lefth3" id="c020" style="margin-top: 7%"><img class="img-gn1" alt=""
              src="../../assets/images/tzyys.jpg" /></h3>
          <p class="text"><span class="hs1">◇</span>请走进剧场观看不同剧种的现场演出,感受戏剧的魅力吧!</p>
          <p class="text">
            <span class="hs1">◇</span>请走进剧场观看不同剧种的现场演出,感受戏剧的魅力吧!
          </p>
          <p class="center text">
            <video :src="videoPathOne" webkit-playsinline="true" x-webkit-airplay="true" playsinline="true"
              x5-video-orientation="h5" x5-video-player-fullscreen="true" x5-playsinline="" controls
              controlslist="nodownload" class="w100 video" @play="videoPlay"
              controlslist="nodownload" class="w100 video"
              style="margin-top: 40px; border-radius: 10px; border: 2px solid green;"></video>
          </p>
          <p class="center videoname">
            <span>视频:惟妙惟肖的人物 </span>
            <el-tooltip class="item" effect="dark" :content="chapterData.isCollectVideo ? '点击取消' : '点击收藏'"
              placement="top-start">
              <img :src="chapterData.isCollectVideo ? collectCheck : collectImg" alt="" class="collect-btn"
              <img :src="collectResourceList.findIndex(item => item.id == 'a3c9b55ac8227e4c885384ff2fc6c0e7') > -1 ? collectCheck : collectImg" alt="" class="collect-btn"
                @click="handleCollect('video')" />
            </el-tooltip>
          </p>
@@ -247,24 +265,29 @@
</template>
<script>
import drag from "@/components/dragQuestion/index.vue"
import { getResourcePath } from "@/assets/methods/resources";
import choice from "@/components/choice/choice.vue"
import { getCollectResource, setCollectResource } from "@/assets/methods/resources";
export default {
  name: "chapterTwo",
  components: { choice },
  components: { drag },
  props: {
    showPageList: {
      type: Array,
    },
  },
  //在这里对调用的方法进行挂载
  mounted() {
  async mounted() {
    this.getVidoePath();
    const bookQuestion = localStorage.getItem("artAndDrama-book-question-two");
    if (bookQuestion) {
      this.questionData = JSON.parse(bookQuestion);
    }
    const data = localStorage.getItem("artAndDrama-chapter02-Data");
    if (data) {
      this.chapterData = JSON.parse(data);
    }
    this.collectResourceList = await getCollectResource(this.config.activeBook.bookId)
  },
  data() {
    return {
@@ -272,6 +295,12 @@
      collectCheck: require("../../assets/images/icon/heart-check.png"),
      videoPathOne: "",
      auidoPathOne: "",
      auidoPathTwo: "",
      auidoPathThree: "",
      auidoPathFour: "",
      auidoPathFive: "",
      isFocused: null, // 用于跟踪textarea的聚焦状态
      collectResourceList:[],
      chapterData: {
        isCollectImg: false,
        isCollectVideo: false,
@@ -287,13 +316,6 @@
          five: "",
          six: "",
          seven: "",
          eight: "",
          nine: "",
          ten: "",
          eleven: "",
          twelve: "",
          thirteen: "",
          fourteen: "",
        },
        reading: {
          one: "",
@@ -311,50 +333,125 @@
          nine: "",
        },
      },
      dragQuestion: [
        {
          analysisCon: null,
          answer: ['C', 'A', 'B'],
          difficulty: 0,
          id: "7BC7B760",
          isCollect: false,
          isComplete: false,
          isRight: null,
          isUnfold: "",
          isUserAnswer: false,
          number: 1,
          option: [
            {
              img: "",
              index: "010311",
              txt: "胆小的",
              value: "A",
              isShow: true
            },
            {
              img: "",
              index: "010312",
              txt: "善良的",
              value: "B",
              isShow: true
            },
            {
              img: "",
              index: "010313",
              txt: "沉稳的",
              value: "C",
              isShow: true
            },
          ],
          optionStyle: "Txt",
          questionType: "drag",
          score: 2,
          stem: {
            0: "蚂蚁队长走路昂首挺胸、步伐坚定,它是一只(",
            1: {
              data: "span",
              num: 0
            },
            2: ")蚂蚁;小蚂蚁走起路来小心翼翼,眼神飘忽不定,它是一只(",
            3: {
              data: "span",
              num: 1
            },
            4: ")蚂蚁;蚂蚁小妹面带微笑,时刻愿意帮助大家,它是一只(",
            5: {
              data: "span",
              num: 2,
            },
            6: " )蚂蚁"
          },
          stemStyle: "RichTxt",
          type: "拖拽题",
          userAnswer: [
            {
              vlaue: '',
              txt: ''
            },
            {
              vlaue: '',
              txt: ''
            },
            {
              vlaue: '',
              txt: ''
            },
          ]
        },
      ],
      questions: [
                {
                    analysisCon: "undefined",
                    answer: ['C', 'A', 'B'],
                    difficulty: 0,
                    id: 47775,
                    isCollect: false,
                    isComplete: false,
                    isRight: null,
                    isUnfold: "",
                    isUserAnswer: false,
                    number: 1,
                    options: [
                        {
                            "img": "",
                            "index": "3CA6",
                            "txt": "胆小的",
                            "value": "A"
                        },
                        {
                            "img": "",
                            "index": "73EE",
                            "txt": "善良的",
                            "value": "B"
                        },
                        {
                            "img": "",
                            "index": "6AEF",
                            "txt": "沉稳的",
                            "value": "C"
                        },
                    ],
                    optionStyle: "Image",
                    questionType: "singleChoice",
                    score: 2,
                    stem: {
                        "stemTxt": "蚂蚁队长走路昂首挺胸、步伐坚定,它是一只(  )蚂蚁;小蚂蚁走起路来小心翼翼,眼神飘忽不定,它是一只(  )蚂蚁;蚂蚁小妹面带微笑,时刻愿意帮助大家,它是一只(  )蚂蚁。"
                    },
                    stemStyle: "Txt",
                    userAnswer: "",
                    // 单选题这里的字段内容就是"单选题"
                    type: 'sort'
                },
            ],
        {
          analysisCon: "undefined",
          answer: ['C', 'A', 'B'],
          difficulty: 0,
          id: 47775,
          isCollect: false,
          isComplete: false,
          isRight: null,
          isUnfold: "",
          isUserAnswer: false,
          number: 1,
          options: [
            {
              "img": "",
              "index": "3CA6",
              "txt": "胆小的",
              "value": "A"
            },
            {
              "img": "",
              "index": "73EE",
              "txt": "善良的",
              "value": "B"
            },
            {
              "img": "",
              "index": "6AEF",
              "txt": "沉稳的",
              "value": "C"
            },
          ],
          optionStyle: "Image",
          questionType: "singleChoice",
          score: 2,
          stem: {
            "stemTxt": "蚂蚁队长走路昂首挺胸、步伐坚定,它是一只(  )蚂蚁;小蚂蚁走起路来小心翼翼,眼神飘忽不定,它是一只(  )蚂蚁;蚂蚁小妹面带微笑,时刻愿意帮助大家,它是一只(  )蚂蚁。"
          },
          stemStyle: "Txt",
          userAnswer: "",
          // 单选题这里的字段内容就是"单选题"
          type: 'sort'
        },
      ],
      accentColor: 'green',
    };
  },
  methods: {
@@ -363,39 +460,64 @@
      this.videoPathOne = await getResourcePath(
        "a3c9b55ac8227e4c885384ff2fc6c0e7"
      );
      // this.auidoPathOne = await getResourcePath(
      //   "2c5f6c69b0f9f7a3c03e473cb8c977f5"
      // );
      this.auidoPathOne = await getResourcePath(
        "0c147c73d67672d1538f76fa22793ff1"
      );
      this.auidoPathTwo = await getResourcePath(
        "daf62713e056d875baa37283c6190a46"
      );
      this.auidoPathThree = await getResourcePath(
        "126edb6a476971840e4c6abf0a3e9da5"
      );
      this.auidoPathFour = await getResourcePath(
        "2485785e9a21a78bcfc58db132537ffd"
      );
      this.auidoPathFive = await getResourcePath(
        "a37bb621b2591e3666e94d1a3bc23bc0"
      );
    },
    handleFocus(id) {
      this.isFocused = id; // 当textarea聚焦时,设置为true
    },
    handleBlur(id) {
      this.isFocused = null; // 当textarea失去焦点时,设置为false
    },
    setBookQuestion() {
      console.log("保存");
      localStorage.setItem(
        "artAndDrama-book-question-two",
        JSON.stringify(this.questionData)
      );
    },
    //音频
    audioPlay(e) {
      this.$emit('closeAudio', e.srcElement.currentSrc)
    },
    //视频
    videoPlay(e) {
      this.$emit('closeVideo', e.srcElement.currentSrc)
    },
    handleChapterData() {
      localStorage.setItem(
        "math-chapterData",
        "artAndDrama-chapter02-Data",
        JSON.stringify(this.chapterData)
      );
    },
    handleCollect(type) {
      if (type == "img") {
        this.chapterData.isCollectImg = !this.chapterData.isCollectImg;
      } else if (type == "video") {
        this.chapterData.isCollectVideo = !this.chapterData.isCollectVideo;
      }
      if (type == "video") {
        this.handleCollectResource("a3c9b55ac8227e4c885384ff2fc6c0e7","a3c9b55ac8227e4c885384ff2fc6c0e7",'',"视频","bits",'视频:惟妙惟肖的人物')
      }
      this.handleChapterData();
    },
      //资源收藏事件
      handleCollectResource(id, md5, resourcePath, resourceType, source, resourceName) {
      let list = this.collectResourceList
      if (list.findIndex(item => item.id == id) > -1) {
        list = list.filter(item => item.id != id)
      } else {
        list.push({
          id,
          md5,
          resourcePath,
          resourceType,
          source,
          resourceName,
        })
      }
      this.collectResourceList = list
      setCollectResource(this.config.activeBook.bookId, this.collectResourceList)
    }
  },
};
</script>
@@ -424,4 +546,10 @@
  height: 100%;
  background-color: red;
}
.drag-text {
  margin: 0 4%;
  font-family: "STKaiti";
  font-size: 19px;
}
</style>