CourseStart.vue 6.6 KB

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