magazineDetail.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541
  1. <template>
  2. <div class="magazine-detail">
  3. <Header
  4. :LoginNavIndex="1"
  5. />
  6. <div class="navBar">
  7. <div class="navBar-left">
  8. <a class="goback" @click="$router.go(-1)"><i class="el-icon-arrow-left"></i> 第 856 期</a>
  9. <div class="border"></div>
  10. <p class="article-title">Making room for the pet boom</p>
  11. </div>
  12. </div>
  13. <div class="magazine-inner">
  14. <div class="btn-box">
  15. <el-button round class="btn-left" @click="handlePage('-')"><svg-icon icon-class="arrow-left-s-line"></svg-icon>上一页</el-button>
  16. <!-- <el-button round class="explain-video" @click="handleVideo"><svg-icon icon-class="video-line"></svg-icon>讲解视频</el-button> -->
  17. <div class="audio-box">
  18. <div
  19. class="aduioLine-content aduioLine-box"
  20. v-if="
  21. art_sound_url
  22. "
  23. >
  24. <AudioLine
  25. audioId="artMagazineAudio"
  26. :mp3="art_sound_url"
  27. :getCurTime="getCurTime"
  28. ref="audioLine"
  29. :mp3Source="'mp3'"
  30. type="audioLine"
  31. :ed="ed"
  32. :showEd="showEd"
  33. @emptyEd="emptyEd"
  34. />
  35. <!-- <svg-icon icon-class="icon-wrapper" class="wrapper" @click="fullScreen"></svg-icon> -->
  36. </div>
  37. </div>
  38. <el-button round class="btn-right" @click="handlePage('+')">下一页<svg-icon icon-class="arrow-right-s-line"></svg-icon></el-button>
  39. </div>
  40. <div class="magazine-box">
  41. <a class="btn-left" @click="handlePage('-')"><svg-icon icon-class="arrow-left-s-line"></svg-icon></a>
  42. <a class="btn-right" @click="handlePage('+')"><svg-icon icon-class="arrow-right-s-line"></svg-icon></a>
  43. <template v-for="(item,index) in magazineList">
  44. <div :key="index" class="magazine" :style="{top:24+(index-activePage)*16+'px',marginLeft:-554+(index-activePage)*16+'px',zIndex:(10-index),height:783-(index-activePage)*16+'px'}" v-if="index>=activePage&&index<=activePage+3">
  45. <img :src="item.img"/>
  46. <div v-for="(itemP,indexP) in item.positionList" :key="indexP" :class="['position-item',mageazineDetailIndex===indexP?'active':'']" :style="{width:itemP.width,height:itemP.height,left:itemP.x,top:itemP.y}" @click="handleChangePosition(indexP)"></div>
  47. </div>
  48. </template>
  49. </div>
  50. </div>
  51. <el-dialog
  52. :visible.sync="magazineVideoShow"
  53. :show-close="false"
  54. :close-on-click-modal="false"
  55. width="800px"
  56. class="login-dialog"
  57. v-if="magazineVideoShow">
  58. <magazine-video @closeWord="closeWord"></magazine-video>
  59. </el-dialog>
  60. <el-dialog
  61. :visible.sync="mageazineDetailShow"
  62. :show-close="false"
  63. :close-on-click-modal="false"
  64. width="500px"
  65. class="login-dialog magazine-detail-dialog"
  66. v-if="mageazineDetailShow">
  67. <magazine-sentence :fontSize="fontSize" :sentenceTheme="sentenceTheme" :data="magazineList[activePage].sentenceList" :activeIndex="mageazineDetailIndex" @closeWord="closeMagazineSentence" @changeTheme="changeTheme" :mp3Url="art_sound_url"></magazine-sentence>
  68. </el-dialog>
  69. </div>
  70. </template>
  71. <script>
  72. //这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  73. //例如:import 《组件名称》from ‘《组件路径》';
  74. import Header from "../../components/Header.vue";
  75. import MagazineVideo from "./components/MagazineVideo.vue"
  76. import MagazineSentence from "./components/MagazineSentence.vue"
  77. import AudioLine from "@/components/common/AudioLine.vue"
  78. export default {
  79. //import引入的组件需要注入到对象中才能使用
  80. components: { Header,MagazineVideo,MagazineSentence,AudioLine},
  81. props: [],
  82. data() {
  83. //这里存放数据
  84. return {
  85. magazineList:[
  86. {
  87. img:require('../../assets/ed88685cd9fe892adb12382427d3c429.jpg'),
  88. positionList:[
  89. {
  90. width:'270px',
  91. height:'140px',
  92. x:'390px',
  93. y:'37px'
  94. },
  95. {
  96. width:'288px',
  97. height:'120px',
  98. x:'500px',
  99. y:'237px'
  100. },
  101. {
  102. width:'130px',
  103. height:'100px',
  104. x:'525px',
  105. y:'587px'
  106. },
  107. ],
  108. sentenceList:[
  109. {
  110. sentence:"I have a super ‘mouth’",
  111. wordList:['I','have','a','super','‘mouth’'],
  112. s: 22500,
  113. e: 25000,
  114. timeList:[
  115. {
  116. s:22500,
  117. e:22800
  118. },
  119. {
  120. s:22800,
  121. e:23200
  122. },
  123. {
  124. s:23200,
  125. e:23400
  126. },
  127. {
  128. s:23400,
  129. e:23900
  130. },
  131. {
  132. s:23900,
  133. e:24900
  134. }
  135. ]
  136. },
  137. {
  138. sentence:"I am a shoebill (鲸头鹳). I live in Africa (非洲). I get my name because of my big bill (鸟喙). Does it look like a Dutch clog (荷兰木屐)?",
  139. wordList:['I','am','a','shoebill (鲸头鹳).','I','live',"in","Africa (非洲).","I","get","my","name","because","of","my","big","bill (鸟喙).","Does","it","look","like","a","Dutch","clog (荷兰木屐)?"],
  140. s: 35000,
  141. e: 47300,
  142. timeList: [
  143. {
  144. s:35000,
  145. e:35400
  146. },
  147. {
  148. s:35400,
  149. e:35600
  150. },
  151. {
  152. s:35600,
  153. e:36000
  154. },
  155. {
  156. s:36000,
  157. e:37000
  158. },
  159. {
  160. s:38000,
  161. e:38300
  162. },
  163. {
  164. s:38300,
  165. e:38600
  166. },
  167. {
  168. s:38600,
  169. e:38900
  170. },
  171. {
  172. s:38900,
  173. e:39900
  174. },
  175. {
  176. s:39900,
  177. e:40300
  178. },
  179. {
  180. s:40300,
  181. e:40800
  182. },
  183. {
  184. s:40800,
  185. e:41400
  186. },
  187. {
  188. s:41400,
  189. e:41900
  190. },
  191. {
  192. s:41900,
  193. e:42700
  194. },
  195. {
  196. s:42700,
  197. e:42900
  198. },
  199. {
  200. s:42900,
  201. e:43500
  202. },
  203. {
  204. s:43500,
  205. e:43900
  206. },
  207. {
  208. s:43900,
  209. e:44800
  210. },
  211. {
  212. s:45000,
  213. e:45200
  214. },
  215. {
  216. s:45200,
  217. e:45500
  218. },
  219. {
  220. s:45500,
  221. e:45800
  222. },
  223. {
  224. s:45800,
  225. e:46000
  226. },
  227. {
  228. s:46000,
  229. e:46200
  230. },
  231. {
  232. s:46200,
  233. e:46600
  234. },
  235. {
  236. s:46600,
  237. e:47300
  238. },
  239. ]
  240. },
  241. {
  242. sentence:"My bill is important. It helps me a lot.",
  243. wordList:['My','bill','is','important.','It','helps','me',"a","lot."],
  244. s: 48000,
  245. e: 52000,
  246. timeList:[
  247. {
  248. s:48000,
  249. e:48400
  250. },
  251. {
  252. s:48400,
  253. e:48700
  254. },
  255. {
  256. s:48700,
  257. e:48900
  258. },
  259. {
  260. s:48900,
  261. e:49900
  262. },
  263. {
  264. s:49900,
  265. e:50200
  266. },
  267. {
  268. s:50200,
  269. e:50800
  270. },
  271. {
  272. s:50800,
  273. e:51100
  274. },
  275. {
  276. s:51100,
  277. e:51400
  278. },
  279. {
  280. s:51400,
  281. e:52000
  282. },
  283. ]
  284. }
  285. ]
  286. },
  287. {
  288. img:require('../../assets/f70b022cce193716cc091e5c8c54d6e5.jpg'),
  289. }
  290. ],
  291. art_sound_url:require('../../assets/21hk_99_165420_1.mp3'),
  292. activePage:0, // 当前显示第几页
  293. magazineVideoShow:false, // 讲解视频是否显示
  294. mageazineDetailIndex:null, // 当前画刊高亮第几个
  295. mageazineDetailShow:false,
  296. fontSize:32,
  297. sentenceTheme:0,
  298. sentenceList:[
  299. {
  300. sentence:"With a lot of water in a cactus' body, a grown-up plant may weigh 6 tons or more. That's as heavy as an elephant!",
  301. wordList:['With','a','lot','of','water','in','a',"cactus'","body,","a","grown-up","plant","may","weigh","6","tons","or","more.","That's","as","heavy","as","an","elephant!"]
  302. },
  303. {
  304. sentence:"With a lot of water in a cactus' body, a grown-up plant may weigh 6 tons or more. That's as heavy as an elephant!",
  305. wordList:['With','a','lot','of','water','in','a',"cactus'","body,","a","grown-up","plant","may","weigh","6","tons","or","more.","That's","as","heavy","as","an","elephant!"]
  306. },
  307. {
  308. sentence:"With a lot of water in a cactus' body, a grown-up plant may weigh 6 tons or more. That's as heavy as an elephant!",
  309. wordList:['With','a','lot','of','water','in','a',"cactus'","body,","a","grown-up","plant","may","weigh","6","tons","or","more.","That's","as","heavy","as","an","elephant!"]
  310. },
  311. {
  312. sentence:"With a lot of water in a cactus' body, a grown-up plant may weigh 6 tons or more. That's as heavy as an elephant!",
  313. wordList:['With','a','lot','of','water','in','a',"cactus'","body,","a","grown-up","plant","may","weigh","6","tons","or","more.","That's","as","heavy","as","an","elephant!"]
  314. }
  315. ],
  316. ed: undefined,
  317. showEd: false, //是否看ed的值
  318. curTime: 0, //单位s
  319. }
  320. },
  321. //计算属性 类似于data概念
  322. computed: {},
  323. //监控data中数据变化
  324. watch: {},
  325. //方法集合
  326. methods: {
  327. // 翻页
  328. handlePage(type){
  329. if(type==='-'){
  330. if(this.activePage>0){
  331. this.activePage--
  332. this.mageazineDetailIndex = null
  333. }else{
  334. this.$message.warning('已经是第一张')
  335. }
  336. }else{
  337. if(this.activePage<this.magazineList.length-1){
  338. this.activePage++
  339. this.mageazineDetailIndex = null
  340. }else{
  341. this.$message.warning('已经是最后一张')
  342. }
  343. }
  344. },
  345. // 讲解视频
  346. handleVideo(){
  347. this.magazineVideoShow = true
  348. },
  349. // 关闭视频
  350. closeWord(){
  351. this.magazineVideoShow = false
  352. },
  353. // 切换画刊里面的卡片
  354. handleChangePosition(index){
  355. if(this.$refs.audioLine.audio.playing){
  356. this.$refs.audioLine.PlayAudio()
  357. }
  358. this.mageazineDetailIndex = index
  359. this.mageazineDetailShow = true
  360. },
  361. // 关闭画刊卡片
  362. closeMagazineSentence(){
  363. this.mageazineDetailShow = false
  364. },
  365. // 切换主题色和文字大小
  366. changeTheme(theme,size){
  367. if(theme!=='') this.sentenceTheme = theme
  368. if(size) this.fontSize = size
  369. },
  370. getCurTime(curTime) {
  371. this.curTime = curTime * 1000;
  372. for(let i=0; i<this.magazineList[this.activePage].sentenceList.length;i++){
  373. if(this.curTime>=this.magazineList[this.activePage].sentenceList[i].s&&this.curTime<this.magazineList[this.activePage].sentenceList[i].e){
  374. this.mageazineDetailIndex = i
  375. break
  376. }else{
  377. this.mageazineDetailIndex = null
  378. }
  379. }
  380. },
  381. emptyEd(flag) {
  382. this.ed = undefined;
  383. if(flag){
  384. this.showEd = false
  385. }
  386. },
  387. },
  388. //生命周期 - 创建完成(可以访问当前this实例)
  389. created() {
  390. },
  391. //生命周期 - 挂载完成(可以访问DOM元素)
  392. mounted() {
  393. },
  394. //生命周期-创建之前
  395. beforeCreated() { },
  396. //生命周期-挂载之前
  397. beforeMount() { },
  398. //生命周期-更新之前
  399. beforUpdate() { },
  400. //生命周期-更新之后
  401. updated() { },
  402. //生命周期-销毁之前
  403. beforeDestory() { },
  404. //生命周期-销毁完成
  405. destoryed() { },
  406. //如果页面有keep-alive缓存功能,这个函数会触发
  407. activated() { }
  408. }
  409. </script>
  410. <style lang="scss" scoped>
  411. /* @import url(); 引入css类 */
  412. .magazine-inner{
  413. padding-top: 96px;
  414. .btn-box{
  415. width: 1108px;
  416. margin: 0 auto;
  417. display: flex;
  418. justify-content: space-between;
  419. align-items: center;
  420. .el-button{
  421. width: 96px;
  422. height: 32px;
  423. padding: 0;
  424. background: transparent;
  425. border-color: #165DFF;
  426. color: #165DFF;
  427. font-weight: 400;
  428. font-size: 14px;
  429. }
  430. .btn-left,.explain-video{
  431. .svg-icon{
  432. margin-right: 8px;
  433. }
  434. }
  435. .btn-right{
  436. .svg-icon{
  437. margin-left: 8px;
  438. }
  439. }
  440. .explain-video{
  441. background: #FFB224;
  442. border-color: #FFB224;
  443. color: #FFFFFF;
  444. width: 110px;
  445. }
  446. }
  447. .magazine-box{
  448. position: relative;
  449. padding-top: 24px;
  450. min-height: 820px;
  451. width: 1108px;
  452. margin: 0 auto;
  453. .btn-left,.btn-right{
  454. position: absolute;
  455. color: #175DFF;
  456. top: 50%;
  457. margin-top: 24px;
  458. left: -57px;
  459. .svg-icon{
  460. width: 48px;
  461. height: 48px;
  462. }
  463. }
  464. .btn-right{
  465. left: auto;
  466. right: -100px;
  467. }
  468. .magazine{
  469. background: #FFFFFF;
  470. padding: 16px;
  471. border: 1px solid #E5E6EB;
  472. border-radius: 16px;
  473. width: 1108px;
  474. height: 783px;
  475. position: absolute;
  476. margin: 0 auto;
  477. top: 24px;
  478. left: 50%;
  479. margin-left: -554px;
  480. text-align: center;
  481. img{
  482. max-width: 100%;
  483. height: 100%;
  484. }
  485. .position-item{
  486. position: absolute;
  487. z-index: 1;
  488. cursor: pointer;
  489. border: 3px solid transparent;
  490. &.active{
  491. border-color: #FF1616;
  492. }
  493. &:hover{
  494. border-color: #FF1616;
  495. }
  496. }
  497. }
  498. }
  499. }
  500. .audio-box{
  501. width: 500px;
  502. display: flex;
  503. align-items: center;
  504. justify-content: space-between;
  505. }
  506. .aduioLine-box{
  507. width: 516px;
  508. height: 48px;
  509. background: #FFFFFF;
  510. border: 1px solid #EBEBEB;
  511. border-radius: 30px;
  512. display: flex;
  513. align-items: center;
  514. padding: 8px 24px;
  515. .wrapper{
  516. width: 24px;
  517. height: 24px;
  518. flex-shrink: 0;
  519. color: #175DFF;
  520. margin-left: 8px;
  521. }
  522. .Audio{
  523. // width: 430px;
  524. }
  525. }
  526. </style>
  527. <style lang="scss">
  528. .magazine-detail-dialog{
  529. .el-dialog{
  530. box-shadow: 0px 6px 30px 5px rgba(0, 0, 0, 0.05), 0px 16px 24px 2px rgba(0, 0, 0, 0.04), 0px 8px 10px -5px rgba(0, 0, 0, 0.08);
  531. border-radius: 16px;
  532. border: none;
  533. }
  534. }
  535. </style>