Index.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <Layout>
  3. <div class="blank-page no-folio">
  4. <!-- Page blanche -->
  5. </div>
  6. <div class="v-center grow no-folio">
  7. <h1 class="pre-title center" v-html="$static.metaData.titreDuProjet" />
  8. <h2 class="pre-sub-title center" v-html="$static.metaData.sousTitre" />
  9. </div>
  10. <div class="blank-page no-folio">
  11. </div>
  12. <div class="column no-folio">
  13. <div class="bold center" v-for="auteur in $static.metaData.auteurs">
  14. {{auteur}}
  15. </div>
  16. <div class="v-center grow">
  17. <h1 class="main-title center" v-html="$static.metaData.titreDuProjet" />
  18. <h2 class="main-pre-title center" v-html="$static.metaData.sousTitre" />
  19. </div>
  20. <div class="center">
  21. Logo popsu
  22. </div>
  23. </div>
  24. <div class="column image-cover" v-bind:style='{ backgroundImage: "url(https://popsu.strapi.figli.io/" + $page.fonds.edges[1].node.url + ")", }'>
  25. <!-- Page fond 1 -->
  26. </div>
  27. <!-- Sommaire -->
  28. <div class="column column">
  29. <div class="column justify-end table-of-content">
  30. <span v-for="edge in $page.chapters.edges.slice().reverse()" :key="'content'+edge.node.id">
  31. <a :href="'#chapter'+edge.node.id">{{ edge.node.titre }}</a>
  32. </span>
  33. </div>
  34. </div>
  35. <div class="blank-page no-folio">
  36. <!-- Page blanche -->
  37. </div>
  38. <div class="hyphen" v-for="(edge,index) in $page.chapters.edges.slice().reverse()" :key="'chapter'+edge.node.id">
  39. <h2 v-bind:id="'chapter'+edge.node.id" class="chapter-title" v-bind:class="{ canbreak: isNotFirst(index) }" >{{ edge.node.titre }}</h2>
  40. <p lang="fr" class="chapter-content">{{ edge.node.contenu }}</p>
  41. </div>
  42. <div class="blank-page no-folio">
  43. <!-- Page blanche -->
  44. </div>
  45. <!-- Pleine pages avant les sections -->
  46. <div class="column image-cover cover-left green" v-bind:style='{ backgroundImage: "url(https://popsu.strapi.figli.io/" + $page.fonds.edges[0].node.url + ")", }'>
  47. <!-- Page fond 2 -->
  48. </div>
  49. <div class="column image-cover cover-right green" v-bind:style='{ backgroundImage: "url(https://popsu.strapi.figli.io/" + $page.fonds.edges[0].node.url + ")", }'>
  50. <!-- Page fond 2 -->
  51. </div>
  52. <div class="blank-page no-folio">
  53. <!-- Page blanche -->
  54. </div>
  55. <div v-for="(edge,index) in $page.sections.edges.slice().reverse()" :key="'section'+edge.node.id">
  56. <h3 class="section-title" v-bind:class="{ canbreak: isNotFirst(index) }">{{ edge.node.titre }}</h3>
  57. <p lang="fr" class="section-content">{{ edge.node.contenu }}</p>
  58. </div>
  59. </Layout>
  60. </template>
  61. <page-query>
  62. {
  63. chapters : allchapitres{
  64. edges{node{id,titre,contenu}}
  65. }
  66. sections : allsections{
  67. edges{node{id,titre,contenu}}
  68. }
  69. fonds : allfonds{
  70. edges{node{id,url}}
  71. }
  72. }
  73. </page-query>
  74. <static-query>
  75. query {
  76. metaData {
  77. titreDuProjet
  78. sousTitre
  79. auteurs
  80. }
  81. }
  82. </static-query>
  83. <script>
  84. import {
  85. Previewer
  86. } from 'pagedjs';
  87. import css from '~/css/print.css'
  88. export default {
  89. metaInfo: {
  90. title: 'HTML2print',
  91. },
  92. methods:{
  93. isNotFirst: function(index){
  94. if(index != 0) return true;
  95. return false;
  96. }
  97. },
  98. mounted() {
  99. this.$nextTick(function () {
  100. let hyphenopoly = document.createElement('script'),
  101. hyph = document.createElement('script');
  102. hyphenopoly.setAttribute('src', 'lib/Hyphenopoly-master/Hyphenopoly_Loader.js')
  103. hyph.setAttribute('src', 'lib/hyph.js')
  104. document.head.appendChild(hyph)
  105. document.head.appendChild(hyphenopoly)
  106. // HELP
  107. let previewer = new Previewer();
  108. previewer.preview()
  109. })
  110. }
  111. }
  112. </script>
  113. <style>
  114. @media screen {
  115. body {
  116. background-color: whitesmoke;
  117. display:flex;
  118. flex-direction:column;
  119. align-items:center;
  120. }
  121. .pagedjs_pages{
  122. display:grid;
  123. grid-row-gap:1cm;
  124. grid-template-columns: 1fr 1fr;
  125. }
  126. .pagedjs_page:first-child{
  127. grid-column:2;
  128. }
  129. .pagedjs_page {
  130. background-color: #fdfdfd;
  131. flex: none;
  132. box-shadow: 0 0 1px rgba(0,0,0,0.2);
  133. }
  134. }
  135. </style>