<template>
  <div class="m-container">
    <img :src="imgList.topBanner" width="100%" class="topBanner" alt />
    <div class="card">
      <p class="title">
        <img :src="imgList.squrt" class="squrt" alt />
        练习表现
      </p>
      <div class="cell" :class="one==1?'activce':''" @click="one=1">
        <img :src="imgList.excellent" class="icons" alt />
        表现优异！你就是最闪亮的星！
      </div>
      <div class="cell" :class="one==2?'activce':''" @click="one=2">
        <img :src="imgList.good" class="icons" alt />
        表现良好！你非常有潜力！
      </div>
      <div class="cell" :class="one==3?'activce':''" @click="one=3">
        <img :src="imgList.normal" class="icons" alt />
        偶尔开小差，还要加油哦！
      </div>
    </div>
    <div class="card1">
      <p class="title">
        <img :src="imgList.squrt" class="squrt" alt />
        节奏准确度
      </p>
      <div class="cell" :class="two==1?'activce':''" @click="two=1">
        <img :src="imgList.excellent" class="icons" alt />
        节奏优异！堪称人肉节拍器！
      </div>
      <div class="cell" :class="two==2?'activce':''" @click="two=2">
        <img :src="imgList.good" class="icons" alt />
        基本准确！注意时值饱满哦！
      </div>
      <div class="cell" :class="two==3?'activce':''" @click="two=3">
        <img :src="imgList.normal" class="icons" alt />
        中等稳定！搭配练习节拍器会更好哦！
      </div>
    </div>
    <div class="card">
      <p class="title">
        <img :src="imgList.squrt" class="squrt" alt />
        音符准确度
      </p>
      <div class="cell" :class="three==1?'activce':''" @click="three=1">
        <img :src="imgList.excellent" class="icons" alt />
        百发百中！棒极了！
      </div>
      <div class="cell" :class="three==2?'activce':''" @click="three=2">
        <img :src="imgList.good" class="icons" alt />
        准确度良好！距离完美只有一步之遥！
      </div>
      <div class="cell" :class="three==3?'activce':''" @click="three=3">
        <img :src="imgList.normal" class="icons" alt />
        中等准确！稍加练习你一定会更好！
      </div>
    </div>
    <div class="card1">
      <p class="title">
        <img :src="imgList.squrt" class="squrt" alt />
        演奏连贯度
      </p>
      <div class="cell" :class="four==1?'activce':''" @click="four=1">
        <img :src="imgList.excellent" class="icons" alt />
        非常棒！你演奏一气呵成！
      </div>
      <div class="cell" :class="four==2?'activce':''" @click="four=2">
        <img :src="imgList.good" class="icons" alt />
        良好！多注意乐句末的音符时值哦！
      </div>
      <div class="cell" :class="four==3?'activce':''" @click="four=3">
        <img :src="imgList.normal" class="icons" alt />
        继续努力！告诉自己，你一定能行的！
      </div>
    </div>
    <div class="submit" @click="submietInfo">
      <img :src="imgList.btn" width="100%" alt />
    </div>
  </div>
</template>
<script>
/* eslint-disable */
import { browser } from "@/common/common";
import { addStudyReport } from "@/api/teacher";
// addStudyReport
export default {
  data() {
    return {
      imgList: {
        topBanner: require("@/assets/images/start/topBanner.png"),
        squrt: require("@/assets/images/start/squrt.png"),
        excellent: require("@/assets/images/start/excellent.png"),
        good: require("@/assets/images/start/good.png"),
        normal: require("@/assets/images/start/normal.png"),
        btn: require("@/assets/images/start/button.png")
      },
      one: "",
      two: "",
      three: "",
      four: "",
      json: {
        one: {
          "1":
            "保持日常练习，与老师良好的互动是进步的开始 ！稳定的节奏就像是音乐的脉搏，搭配良好的音符准确度，也许将来会成为职业音乐家也不一定哦！",
          "2":
            "练习时不要怕出错，有疑问时也多多提出，问题的改正+疑惑的解开会让你有意想不到的收获！",
          "3":
            "专注是进步的基石，练习在“精”不在“长”，打开节拍器练习，认真读谱再演奏，高质量的练习会让你在课程中突飞猛进！"
        },
        two: {
          "1":
            "节奏是音乐的心跳，恭喜你有一颗良好跳动的音乐之心！保持你的优势，同时提升其他方面综合水平，相信未来的你会更好！",
          "2":
            "节拍器是练习的好帮手！在它的帮助下会让你的节奏更精准，现阶段要注意休止符空拍准确和长音演奏的饱满。",
          "3":
            "俗话说“错音不错节奏”，音乐的风格与律动与节奏有着离不开的关系，想要提升节奏稳定度，要严格对照节拍器练习。"
        },
        three: {
          "1":
            "识谱能力非凡的你，在日常练习中可以针对其他环节做更多的练习，音乐是多元素的艺术表现方式，综合能力的提升才是硬道理！",
          "2":
            "重视每一个“小错误”，演奏前首先注意调号，还要关注临时变音记号通常会持续整个小节，马马虎虎的话可是会谬以千里哦！",
          "3":
            "识谱慢？没关系！你知道吗，管乐器常用的音符一共才不超过36个呦！熟悉它们的位置，分清线上和线间，包你读谱赛神仙！"
        },
        four: {
          "1":
            "你的演奏行云流水！现在可以在曲目演奏过程中加上一些你对音乐的理解，音乐的表达是重要的一环哦！",
          "2":
            "练习要目标明确，在不连贯的地方针对练习，会让你的练习更加高效！",
          "3":
            "经常卡壳？心急吃不了热豆腐，注意力集中的慢练才是“制胜法宝” ！"
        }
      },
      classGroupId: null,
      comment: null,
      item: null
    };
  },
  created() {
    this.classGroupId = this.$route.query.classGroupId;
    this.token = localStorage.getItem("Authorization");
    if (!this.token || !this.classGroupId) {
      this.onAppBack();
      return;
    }
  },
  methods: {
    submietInfo() {
      // console.log(this.one)
      // console.log(this.json.one[this.one])
      if (!this.one || !this.two || !this.three || !this.four) {
        this.$toast("请认真选择每一项");
        return;
      }
      this.comment =
        this.json.one[this.one] +'#'+
        this.json.two[this.two] +'#'+
        this.json.three[this.three] +'#'+
        this.json.four[this.four];
      this.item =
        this.one + "," + this.two + "," + this.three + "," + this.four;
      addStudyReport({
        classGroupId: this.classGroupId,
        item: this.item,
        comment: this.comment
      }).then(res => {
        if (res.data.code == 200) {
          this.$toast("提交成功");
          setTimeout(() => {
            this.$router.push({
              path: "/reportDetail",
              query: { classGroupId: this.classGroupId }
            });
          }, 2000);
        } else {
          this.$toast(res.data.msg);
          // setTimeout(() => {
          //   // this.$router.push({
          //   //   path: "/studyReport",
          //   //   query: { classGroupId: this.classGroupId }
          //   // });
          // }, 2000);
        }
      });
    },
    onAppBack() {
      if (browser().android) {
        DAYA.postMessage(JSON.stringify({ api: "back" }));
      } else if (browser().iPhone) {
        window.webkit.messageHandlers.DAYA.postMessage(
          JSON.stringify({ api: "back" })
        );
      }
    }
  }
};
</script>
<style lang="less" scoped>
.m-container {
  background: url("../../assets/images/start/bg.png") no-repeat;
  background-size: 100% 100%;
  width: 100%;
  min-height: 16.97rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  .topBanner {
    position: relative;
    top: 0.1rem;
  }
  .card {
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    background: url("../../assets/images/start/topCard.png") no-repeat;
    background-size: 100% 100%;
    width: 3.38rem;
    height: 3.28rem;
    padding: 0.41rem 0.16rem 0;
    margin-bottom: 0.2rem;
  }
  .card1 {
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    background: url("../../assets/images/start/card.png") no-repeat;
    background-size: 100% 100%;
    width: 3.38rem;
    height: 3.28rem;
    padding: 0.41rem 0.16rem 0rem;
    margin-bottom: 0.2rem;
  }
  .title {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    font-size: 0.22rem;
    height: 0.22rem;
    line-height: 0.22rem;
    margin-bottom: 0.365rem;
    .squrt {
      width: 0.05rem;
      height: 0.22rem;
      margin-right: 0.1rem;
    }
  }
  .cell.activce {
    border: 1px solid #28babd;
    color: #28babd;
  }
  .cell {
    width: 3.05rem;
    height: 0.42rem;
    line-height: 0.42rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    flex-direction: row;
    align-items: center;
    border-radius: 21px;
    box-shadow: 0px 0px 9px 0px rgba(0, 0, 0, 0.14);
    background-color: #fff;
    font-size: 0.15rem;
    margin-bottom: 0.245rem;
    border: 1px solid transparent;
    .icons {
      width: 0.26rem;
      height: 0.26rem;
      margin: 0 0.105rem;
    }
  }
  .submit {
    width: 3.2rem;
  }
}
</style>