CourseStart.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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">{{itemCon.pinyin}}</span>
  15. <span class="hanzi content-con">{{itemCon.chs}}</span>
  16. </div>
  17. <div style="text-align: left">
  18. <span class="pinyin">{{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">{{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. };
  51. },
  52. //计算属性 类似于data概念
  53. computed: {},
  54. //监控data中数据变化
  55. watch: {},
  56. //方法集合
  57. methods: {
  58. // 处理数据
  59. handleData(){
  60. let _this = this
  61. let curQue = JSON.parse(JSON.stringify(this.curQue));
  62. let paraArr = []
  63. curQue.detail.wordsList.forEach((sItem, sIndex) => {
  64. let obj = {
  65. pinyin: sItem.pinyin,
  66. chs: sItem.chs,
  67. isShow: true,
  68. };
  69. paraArr.push(obj);
  70. })
  71. this.$set(_this.curQue.detail,'resArr',paraArr)
  72. }
  73. },
  74. //生命周期 - 创建完成(可以访问当前this实例)
  75. created() {
  76. this.handleData()
  77. },
  78. //生命周期 - 挂载完成(可以访问DOM元素)
  79. mounted() {},
  80. //生命周期-创建之前
  81. beforeCreated() {},
  82. //生命周期-挂载之前
  83. beforeMount() {},
  84. //生命周期-更新之前
  85. beforUpdate() {},
  86. //生命周期-更新之后
  87. updated() {},
  88. //生命周期-销毁之前
  89. beforeDestory() {},
  90. //生命周期-销毁完成
  91. destoryed() {},
  92. //如果页面有keep-alive缓存功能,这个函数会触发
  93. activated() {},
  94. };
  95. </script>
  96. <style lang="scss" scoped>
  97. /* @import url(); 引入css类 */
  98. .NPC-courseStart{
  99. width: 100%;
  100. background: #E35454;
  101. color: rgba(255, 255, 255, 0.85);
  102. padding: 40px;
  103. h2{
  104. font-size: 24px;
  105. line-height: 32px;
  106. font-weight: normal;
  107. text-align: center;
  108. font-family: 'robot';
  109. margin: 0;
  110. &.hanzi{
  111. font-family: 'FZJCGFKTK';
  112. }
  113. }
  114. .item-content{
  115. text-align: center;
  116. padding: 24px 0;
  117. }
  118. .content-con{
  119. font-size: 40px;
  120. line-height: 48px;
  121. font-family: 'FZJCGFKTK';
  122. margin: 0;
  123. &.content-con-small{
  124. font-size: 16px;
  125. }
  126. }
  127. .content-en{
  128. font-weight: normal;
  129. font-size: 20px;
  130. line-height: 28px;
  131. font-family: 'robot';
  132. display: block;
  133. }
  134. .con-box{
  135. display: flex;
  136. flex-flow: wrap;
  137. justify-content: center;
  138. .con-item{
  139. text-align: center;
  140. padding: 0 3px;
  141. }
  142. span{
  143. display: block;
  144. }
  145. .pinyin{
  146. font-family: 'GB-PINYINOK-B';
  147. font-size: 24px;
  148. line-height: 32px;
  149. height: 32px;
  150. }
  151. .synthesis-box{
  152. display: flex;
  153. }
  154. }
  155. .item-intro{
  156. background: #C43C3C;
  157. border: 1px solid rgba(0, 0, 0, 0.1);
  158. box-sizing: border-box;
  159. border-radius: 8px;
  160. padding: 24px;
  161. font-size: 16px;
  162. line-height: 150%;
  163. white-space: pre-wrap;
  164. word-break: break-word;
  165. min-height: 272px;
  166. }
  167. .start-btn{
  168. width: 160px;
  169. height: 40px;
  170. box-shadow: 0px 8px 24px rgba(103, 0, 0, 0.25);
  171. border-radius: 8px;
  172. background: #FFFFFF;
  173. border: 1px solid rgba(0, 0, 0, 0.1);
  174. display: block;
  175. margin: 24px auto;
  176. color: #E35454;
  177. font-size: 20px;
  178. line-height: 28px;
  179. text-align: center;
  180. line-height: 40px;
  181. &:active{
  182. background: rgba(255, 255, 255, 0.85);
  183. }
  184. }
  185. }
  186. .NNPE-Big-Book-preview-green{
  187. .NPC-courseStart{
  188. background: #24B99E;
  189. .item-intro{
  190. background: #1FA189;
  191. }
  192. .start-btn{
  193. color: #24B99E;
  194. }
  195. }
  196. }
  197. .NNPE-Big-Book-preview-brown{
  198. .NPC-courseStart{
  199. background: #BD8865;
  200. .item-intro{
  201. background: #A37557;
  202. }
  203. .start-btn{
  204. color: #BD8865;
  205. }
  206. }
  207. }
  208. </style>