book_giveaway.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <template>
  2. <div class="box">
  3. <el-image class="return-button" :src="require_('@/assets/img/list_return_button.png')" fit="cover"
  4. @click="act_return"></el-image>
  5. <el-row class="box-content">
  6. <el-col :span="18" :offset="3" style="height: 100%;">
  7. <el-scrollbar>
  8. <el-row v-for="item in bookPromoteDataList" :key="item.id">
  9. <el-col :span="23">
  10. <span class="title" @click="act_showArticle(item)">
  11. {{ item.title }}
  12. </span>
  13. </el-col>
  14. </el-row>
  15. </el-scrollbar>
  16. </el-col>
  17. </el-row>
  18. <el-dialog v-model="g_dialogTableVisible" width="80%" style="background-color: #e6e6e6;">
  19. <el-image style="width: 100%; height: auto; padding-bottom: 1vh;" v-for="(article, aindex) in g_articlePath"
  20. :key="aindex" :src="article" fit="contain" />
  21. </el-dialog>
  22. </div>
  23. </template>
  24. <script setup>
  25. /************************************************
  26. * 引入文件 *
  27. ************************************************/
  28. import { ref, onMounted } from "vue";
  29. import { useRouter, useRoute } from "vue-router";
  30. import { require_ } from "@/utils/require";
  31. import { getBooksDataList } from "@/http/pages/library";
  32. /************************************************
  33. * 全局变量
  34. *
  35. * 格式: g_ + 事件名 例如: g_route
  36. ************************************************/
  37. const g_useRouter = useRouter();
  38. // 介绍框
  39. const g_dialogTableVisible = ref(false);
  40. // 介绍框高度
  41. const g_introductionHeight = ref(`${window.innerHeight * 0.6}px`);
  42. // 书本数据
  43. const bookPromoteDataList = ref([]);
  44. // 文章路径
  45. const g_articlePath = ref([]);
  46. /************************************************
  47. * 生命周期函数
  48. ************************************************/
  49. onMounted(() => {
  50. get_dataList();
  51. })
  52. /************************************************
  53. * 事件处理
  54. *
  55. * 格式: act_ + 事件名 例如: act_resolvingIdentity
  56. ************************************************/
  57. // 返回
  58. const act_return = () => {
  59. g_useRouter.go(-1);
  60. }
  61. /**
  62. * 显示文章
  63. */
  64. const act_showArticle = (item) => {
  65. g_introductionHeight.value = window.innerHeight * 0.7 + 'px';
  66. g_articlePath.value = item.path;
  67. g_dialogTableVisible.value = true;
  68. }
  69. /************************************************
  70. * 获取数据
  71. *
  72. * 格式: get_ + 事件名 例如: get_dataList
  73. ************************************************/
  74. // 获取数据
  75. const get_dataList = async () => {
  76. const params = {
  77. company_app_id: "3",
  78. data_type: "6"
  79. };
  80. const dataList = await getBooksDataList(params);
  81. if (dataList.code == 200) {
  82. dataList.data.forEach((item, index) => {
  83. const tempFilePath = `https://seaelibrary.xmu.edu.cn/prod-api${item.path}`;
  84. const filePathArray = [tempFilePath];
  85. if (item.count > 1) {
  86. let temp = tempFilePath.substring(0, tempFilePath.length - 6);
  87. for (let j = 1; j < item.count; j++) {
  88. if (j < 10) {
  89. filePathArray.push(temp + '0' + j + '.png');
  90. } else {
  91. filePathArray.push(temp + j + '.png');
  92. }
  93. }
  94. }
  95. item.path = [...new Set(filePathArray)];
  96. })
  97. bookPromoteDataList.value = dataList.data
  98. }
  99. }
  100. </script>
  101. <style scoped>
  102. .box {
  103. background-image: url("@/assets/img/list.png");
  104. background-repeat: no-repeat;
  105. background-size: cover;
  106. background-position: center;
  107. width: 100%;
  108. height: 100%;
  109. }
  110. .box-content {
  111. height: 100%;
  112. padding: 11vh 0;
  113. }
  114. .title {
  115. font-size: 2rem;
  116. line-height: 4.5rem;
  117. font-weight: bold;
  118. color: #421205;
  119. margin-left: 30px;
  120. border-bottom: 2px solid rgba(66, 18, 5, 0.5);
  121. letter-spacing: 0.25rem;
  122. cursor: pointer;
  123. }
  124. .title::before {
  125. content: '';
  126. position: absolute;
  127. top: 50%;
  128. left: -20px;
  129. transform: translateY(-50%);
  130. visibility: hidden;
  131. width: 50px;
  132. height: 50px;
  133. background-image: url("@/assets/img/selected.png");
  134. background-repeat: no-repeat;
  135. background-size: cover;
  136. background-position: center;
  137. opacity: 0;
  138. transition: all .3s;
  139. }
  140. .title:hover::before {
  141. visibility: visible;
  142. opacity: 1;
  143. transition: all 0.3s;
  144. }
  145. .return-button {
  146. visibility: visible;
  147. position: absolute;
  148. top: 8px;
  149. right: 0;
  150. background-repeat: no-repeat;
  151. background-size: cover;
  152. background-position: center;
  153. min-width: 80px;
  154. width: 8vw;
  155. z-index: 100;
  156. }
  157. @media screen and (max-width: 1200px) {
  158. .title {
  159. font-size: 1rem;
  160. line-height: 2.5rem;
  161. }
  162. }
  163. @media screen and (orientation: portrait) {
  164. .return-button {
  165. width: 16vw;
  166. }
  167. }
  168. </style>