CourseStart.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <template>
  2. <div class="NPC-courseStart">
  3. <h2 :class="[curQue.titleType == 'cn' ? 'hanzi' : '']">
  4. {{ curQue.title }}
  5. </h2>
  6. <div class="item-content">
  7. <template v-if="curQue.detail.wordsList.length == 0">
  8. <p :class="['content-con']" v-if="curQue.detail.sentence">
  9. {{ curQue.detail.sentence }}
  10. </p>
  11. </template>
  12. <template v-else>
  13. <div class="con-box">
  14. <div
  15. :class="['con-item', indexCon === 0 ? 'con-item-0' : '']"
  16. v-for="(itemCon, indexCon) in curQue.detail.resArr"
  17. :key="indexCon"
  18. v-show="itemCon.isShow"
  19. >
  20. <template
  21. v-if="
  22. curQue.detail.wordsList[indexCon + 1] &&
  23. curQue.detail.wordsList[indexCon + 1].chs &&
  24. chsFhList.indexOf(curQue.detail.wordsList[indexCon + 1].chs) >
  25. -1
  26. "
  27. >
  28. <div class="synthesis-box">
  29. <div>
  30. <span
  31. class="pinyin"
  32. :class="[
  33. noFont.indexOf(itemCon.pinyin) > -1 ? 'noFont' : '',
  34. ]"
  35. >{{ itemCon.pinyin }}</span
  36. >
  37. <span class="hanzi content-con">{{ itemCon.chs }}</span>
  38. </div>
  39. <div style="text-align: left">
  40. <span
  41. class="pinyin"
  42. :class="[
  43. noFont.indexOf(
  44. items.detail.wordsList[indexCon + 1].pinyin
  45. ) > -1
  46. ? 'noFont'
  47. : '',
  48. ]"
  49. >{{ curQue.detail.wordsList[indexCon + 1].pinyin }}</span
  50. >
  51. <span class="hanzi content-con">{{
  52. curQue.detail.wordsList[indexCon + 1].chs
  53. }}</span>
  54. </div>
  55. </div>
  56. </template>
  57. <template v-else>
  58. <span
  59. class="pinyin"
  60. :class="[noFont.indexOf(itemCon.pinyin) > -1 ? 'noFont' : '']"
  61. >{{ itemCon.pinyin }}</span
  62. >
  63. <span class="hanzi content-con">{{ itemCon.chs }}</span>
  64. </template>
  65. </div>
  66. </div>
  67. </template>
  68. <b class="content-en" v-if="curQue.en">{{ curQue.en }}</b>
  69. </div>
  70. <div class="item-intro-box">
  71. <div class="item-intro" v-if="curQue.con">
  72. {{ curQue.con }}
  73. </div>
  74. </div>
  75. <a class="start-btn" @click="handleNNPEnext">开始学习</a>
  76. </div>
  77. </template>
  78. <script>
  79. //这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  80. //例如:import 《组件名称》from ‘《组件路径》';
  81. export default {
  82. //import引入的组件需要注入到对象中才能使用
  83. components: {},
  84. props: ["curQue", "handleNNPEnext"],
  85. data() {
  86. //这里存放数据
  87. return {
  88. chsFhList: [",", "。", "“", ":", "》", "《", "?", "!", ";"],
  89. noFont: ["~", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")"], // 对应不要拼音字体
  90. };
  91. },
  92. //计算属性 类似于data概念
  93. computed: {},
  94. //监控data中数据变化
  95. watch: {},
  96. //方法集合
  97. methods: {
  98. // 处理数据
  99. handleData() {
  100. let _this = this;
  101. let curQue = JSON.parse(JSON.stringify(this.curQue));
  102. let paraArr = [];
  103. curQue.detail.wordsList.forEach((sItem, sIndex) => {
  104. let obj = {
  105. pinyin: sItem.pinyin,
  106. chs: sItem.chs,
  107. isShow: true,
  108. };
  109. paraArr.push(obj);
  110. });
  111. this.$set(_this.curQue.detail, "resArr", paraArr);
  112. },
  113. },
  114. //生命周期 - 创建完成(可以访问当前this实例)
  115. created() {
  116. this.handleData();
  117. },
  118. //生命周期 - 挂载完成(可以访问DOM元素)
  119. mounted() {},
  120. //生命周期-创建之前
  121. beforeCreated() {},
  122. //生命周期-挂载之前
  123. beforeMount() {},
  124. //生命周期-更新之前
  125. beforUpdate() {},
  126. //生命周期-更新之后
  127. updated() {},
  128. //生命周期-销毁之前
  129. beforeDestory() {},
  130. //生命周期-销毁完成
  131. destoryed() {},
  132. //如果页面有keep-alive缓存功能,这个函数会触发
  133. activated() {},
  134. };
  135. </script>
  136. <style lang="scss" scoped>
  137. /* @import url(); 引入css类 */
  138. .NPC-courseStart {
  139. width: 100%;
  140. background: #e35454;
  141. color: rgba(255, 255, 255, 0.85);
  142. padding: 40px;
  143. h2 {
  144. font-size: 24px;
  145. line-height: 32px;
  146. font-weight: normal;
  147. text-align: center;
  148. font-family: "robot";
  149. margin: 0;
  150. &.hanzi {
  151. font-family: "FZJCGFKTK";
  152. }
  153. }
  154. .item-content {
  155. text-align: center;
  156. padding: 24px 0;
  157. }
  158. .content-con {
  159. font-size: 40px;
  160. line-height: 48px;
  161. font-family: "FZJCGFKTK";
  162. margin: 0;
  163. &.content-con-small {
  164. font-size: 16px;
  165. }
  166. }
  167. .content-en {
  168. font-weight: normal;
  169. font-size: 20px;
  170. line-height: 28px;
  171. font-family: "robot";
  172. display: block;
  173. }
  174. .con-box {
  175. display: flex;
  176. flex-flow: wrap;
  177. justify-content: center;
  178. .con-item {
  179. text-align: center;
  180. padding: 0 3px;
  181. }
  182. span {
  183. display: block;
  184. }
  185. .pinyin {
  186. font-family: "GB-PINYINOK-B";
  187. font-size: 24px;
  188. line-height: 32px;
  189. height: 32px;
  190. &.noFont {
  191. font-family: initial;
  192. }
  193. }
  194. .synthesis-box {
  195. display: flex;
  196. }
  197. }
  198. .item-intro-box {
  199. min-height: 272px;
  200. .item-intro {
  201. background: #c43c3c;
  202. border: 1px solid rgba(0, 0, 0, 0.1);
  203. box-sizing: border-box;
  204. border-radius: 8px;
  205. padding: 24px;
  206. font-size: 16px;
  207. line-height: 150%;
  208. white-space: pre-wrap;
  209. word-break: break-word;
  210. text-align: justify;
  211. min-height: 96px;
  212. }
  213. }
  214. .start-btn {
  215. width: 160px;
  216. height: 40px;
  217. box-shadow: 0px 8px 24px rgba(103, 0, 0, 0.25);
  218. border-radius: 8px;
  219. background: #ffffff;
  220. border: 1px solid rgba(0, 0, 0, 0.1);
  221. display: block;
  222. margin: 24px auto;
  223. color: #e35454;
  224. font-size: 20px;
  225. line-height: 28px;
  226. text-align: center;
  227. line-height: 40px;
  228. &:active {
  229. background: rgba(255, 255, 255, 0.85);
  230. }
  231. }
  232. }
  233. .NPC-Big-Book-preview-green {
  234. .NPC-courseStart {
  235. background: #24b99e;
  236. .item-intro {
  237. background: #1fa189;
  238. }
  239. .start-btn {
  240. color: #24b99e;
  241. }
  242. }
  243. }
  244. .NPC-Big-Book-preview-brown {
  245. .NPC-courseStart {
  246. background: #bd8865;
  247. .item-intro {
  248. background: #a37557;
  249. }
  250. .start-btn {
  251. color: #bd8865;
  252. }
  253. }
  254. }
  255. </style>