Index.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <template>
  2. <Layout>
  3. <!-- Titre, sous-titre -->
  4. <div class="blank-page no-folio fill-green" />
  5. <div class="v-center grow no-folio">
  6. <!-- <h1 class="pre-title center" v-html="$static.metaData.titreDuProjet" /> -->
  7. <!-- <h2 class="pre-sub-title center" v-html="$static.metaData.sousTitre" /> -->
  8. </div>
  9. <div class="blank-page no-folio fill-motif-cross-left" />
  10. <!-- Auteurs, titre, sous-titre -->
  11. <div class="column no-folio">
  12. <div class="fill-motif-cross-right layer-1">
  13. </div>
  14. <div class="column layer-2">
  15. <div
  16. class="bold center"
  17. v-for="auteur in $static.metaData.auteurs"
  18. >
  19. {{auteur}}
  20. </div>
  21. <div class="v-center grow">
  22. <h1
  23. class="main-title center highlight-white"
  24. v-html="$static.metaData.titreDuProjet"
  25. />
  26. <h2
  27. class="main-pre-title center highlight-white"
  28. v-html="$static.metaData.sousTitre"
  29. />
  30. </div>
  31. <div class="center">
  32. <img src="/logo_popsu.png" alt="" style="width:2cm;">
  33. </div>
  34. </div>
  35. </div>
  36. <!-- Page de fond -->
  37. <div
  38. class="column image-cover image-bleed"
  39. v-bind:style='{ backgroundImage: "url(https://popsu.strapi.figli.io/" + $page.fonds.edges[1].node.url + ")", }'
  40. />
  41. <!-- Sommaire -->
  42. <div class="column">
  43. <div class="section-title">
  44. Sommaire
  45. </div>
  46. <div class="column justify-end table-of-content">
  47. <span
  48. v-for="edge in $page.chapters.edges.slice().reverse()"
  49. :key="'content'+edge.node.id"
  50. >
  51. <a :href="'#chapter'+edge.node.id">{{ edge.node.titre }}</a>
  52. </span>
  53. </div>
  54. </div>
  55. <!-- Page blanche -->
  56. <div class="blank-page no-folio" />
  57. <!-- Chapitres -->
  58. <div
  59. class="hyphen"
  60. v-for="(edge,index) in $page.chapters.edges.slice().reverse()"
  61. :key="'chapter'+edge.node.id"
  62. >
  63. <h2
  64. v-bind:data-rubrique="edge.node.rubrique"
  65. v-bind:id="'chapter'+edge.node.id" class="chapter-title"
  66. v-bind:class="{ canbreak: isNotFirst(index) }"
  67. >
  68. {{ edge.node.titre }}
  69. </h2>
  70. <VueMarkdown
  71. lang="fr"
  72. class="chapter-content justify"
  73. >
  74. {{edge.node.contenu}}
  75. </VueMarkdown>
  76. </div>
  77. <!-- Notes de fin de document -->
  78. <h3 class="section-title canbreak">NOTES</h3>
  79. <ol v-for="note in footnote">
  80. <li>{{note}}</li>
  81. </ol>
  82. <!-- Pleine pages avant les sections -->
  83. <div
  84. class="column image-cover cover-left green image-bleed"
  85. v-bind:style='{ backgroundImage: "url(https://popsu.strapi.figli.io/" + $page.fonds.edges[0].node.url + ")", }'
  86. />
  87. <div
  88. class="column image-cover cover-right green image-bleed"
  89. v-bind:style='{ backgroundImage: "url(https://popsu.strapi.figli.io/" + $page.fonds.edges[0].node.url + ")", }'
  90. />
  91. <!-- Page blanche -->
  92. <div class="blank-page no-folio" />
  93. <!-- Sections -->
  94. <div
  95. class="hyphen"
  96. v-for="(edge,index) in $page.sections.edges.slice().reverse()"
  97. :key="'section'+edge.node.id"
  98. >
  99. <h3
  100. class="section-title"
  101. v-bind:class="{ canbreak: isNotFirst(index) }"
  102. >
  103. {{ edge.node.titre }}
  104. </h3>
  105. <VueMarkdown lang="fr" class="section-content justify">{{ edge.node.contenu }}</VueMarkdown>
  106. </div>
  107. <!-- Credits -->
  108. <div class="credits canbreak">
  109. <h3 class="section-title">Crédits</h3>
  110. <div
  111. class="credit"
  112. v-for="(edge,index) in $page.credits.edges.slice().reverse()"
  113. :key="'credits'+edge.node.id"
  114. >
  115. <h4>{{ edge.node.role }}</h4>
  116. <VueMarkdown lang="fr" class="section-content">{{ edge.node.nom }}</VueMarkdown>
  117. </div>
  118. </div>
  119. <div class="blank-page no-folio fill-green" />
  120. </Layout>
  121. </template>
  122. <page-query>
  123. {
  124. chapters : allchapitres{
  125. edges{node{id,titre,contenu,rubrique}}
  126. }
  127. sections : allsections{
  128. edges{node{id,titre,contenu}}
  129. }
  130. fonds : allfonds{
  131. edges{node{id,url}}
  132. }
  133. credits : allcredits{
  134. edges{node{id,nom,role}}
  135. }
  136. }
  137. </page-query>
  138. <static-query>
  139. query {
  140. metaData {
  141. titreDuProjet
  142. sousTitre
  143. auteurs
  144. }
  145. }
  146. </static-query>
  147. <script>
  148. import VueMarkdown from 'vue-markdown'
  149. import { Previewer } from 'pagedjs'
  150. export default {
  151. data:function(){
  152. return{
  153. footnote:[],
  154. }
  155. },
  156. components: {
  157. VueMarkdown
  158. },
  159. metaInfo: {
  160. title: 'HTML2print',
  161. },
  162. methods:{
  163. isNotFirst: function(index){
  164. if(index != 0) return true;
  165. return false;
  166. }
  167. },
  168. mounted() {
  169. Array.from(document.querySelectorAll("span[data-note]")).forEach(note=>{
  170. this.footnote.push(note.getAttribute("data-note"));
  171. });
  172. this.$nextTick(function () {
  173. // let hyphenopoly = document.createElement('script'),
  174. // hyph = document.createElement('script');
  175. // hyphenopoly.setAttribute('src', 'lib/Hyphenopoly-master/Hyphenopoly_Loader.js')
  176. // hyph.setAttribute('src', 'lib/hyph.js')
  177. // document.head.appendChild(hyph)
  178. // document.head.appendChild(hyphenopoly)
  179. // hyph.onload = ()=>{
  180. // Hyphenopoly.handleEvent = {
  181. // hyphenopolyEnd:(e)=>{
  182. let previewer = new Previewer();
  183. console.log('previewer', previewer);
  184. previewer.preview();
  185. document.documentElement.style.cssText = 'visibility:visible !important';
  186. // }
  187. // }
  188. // }
  189. })
  190. }
  191. }
  192. </script>