Index.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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. >{{ edge.node.contenu }}</VueMarkdown>
  74. </div>
  75. <!-- Notes de fin de document -->
  76. <h3 class="section-title canbreak">NOTES</h3>
  77. <ol v-for="note in footnote">
  78. <li>
  79. <VueMarkdown
  80. lang="fr"
  81. >{{note}}</VueMarkdown>
  82. </li>
  83. </ol>
  84. <!-- Pleine pages avant les sections -->
  85. <div
  86. class="column image-cover cover-left green image-bleed"
  87. v-bind:style='{ backgroundImage: "url(https://popsu.strapi.figli.io/" + $page.fonds.edges[0].node.url + ")", }'
  88. />
  89. <div
  90. class="column image-cover cover-right green image-bleed"
  91. v-bind:style='{ backgroundImage: "url(https://popsu.strapi.figli.io/" + $page.fonds.edges[0].node.url + ")", }'
  92. />
  93. <!-- Page blanche -->
  94. <div class="blank-page no-folio" />
  95. <!-- Sections -->
  96. <div
  97. class="hyphen"
  98. v-for="(edge,index) in $page.sections.edges.slice().reverse()"
  99. :key="'section'+edge.node.id"
  100. >
  101. <h3
  102. class="section-title"
  103. v-bind:class="{ canbreak: isNotFirst(index) }"
  104. >
  105. {{ edge.node.titre }}
  106. </h3>
  107. <VueMarkdown lang="fr" class="section-content justify">{{ edge.node.contenu }}</VueMarkdown>
  108. </div>
  109. <!-- Credits -->
  110. <div class="credits canbreak">
  111. <h3 class="section-title">Crédits</h3>
  112. <div
  113. class="credit"
  114. v-for="(edge,index) in $page.credits.edges.slice().reverse()"
  115. :key="'credits'+edge.node.id"
  116. >
  117. <h4>{{ edge.node.role }}</h4>
  118. <VueMarkdown lang="fr" class="section-content">{{ edge.node.nom }}</VueMarkdown>
  119. </div>
  120. </div>
  121. <div class="blank-page no-folio fill-green" />
  122. </Layout>
  123. </template>
  124. <page-query>
  125. {
  126. chapters : allchapitres{
  127. edges{node{id,titre,contenu,rubrique}}
  128. }
  129. sections : allsections{
  130. edges{node{id,titre,contenu}}
  131. }
  132. fonds : allfonds{
  133. edges{node{id,url}}
  134. }
  135. credits : allcredits{
  136. edges{node{id,nom,role}}
  137. }
  138. }
  139. </page-query>
  140. <static-query>
  141. query {
  142. metaData {
  143. titreDuProjet
  144. sousTitre
  145. auteurs
  146. }
  147. }
  148. </static-query>
  149. <script>
  150. import VueMarkdown from 'vue-markdown'
  151. import { Previewer } from 'pagedjs'
  152. export default {
  153. data:function(){
  154. return{
  155. footnote:[],
  156. }
  157. },
  158. components: {
  159. VueMarkdown
  160. },
  161. metaInfo: {
  162. title: 'HTML2print',
  163. },
  164. methods:{
  165. isNotFirst: function(index){
  166. if(index != 0) return true;
  167. return false;
  168. }
  169. },
  170. mounted() {
  171. Array.from(document.querySelectorAll("span[data-note]")).forEach(note=>{
  172. this.footnote.push(note.getAttribute("data-note"));
  173. });
  174. this.$nextTick(function () {
  175. // let hyphenopoly = document.createElement('script'),
  176. // hyph = document.createElement('script');
  177. // hyphenopoly.setAttribute('src', 'lib/Hyphenopoly-master/Hyphenopoly_Loader.js')
  178. // hyph.setAttribute('src', 'lib/hyph.js')
  179. // document.head.appendChild(hyph)
  180. // document.head.appendChild(hyphenopoly)
  181. // hyph.onload = ()=>{
  182. // Hyphenopoly.handleEvent = {
  183. // hyphenopolyEnd:(e)=>{
  184. let previewer = new Previewer();
  185. console.log('previewer', previewer);
  186. previewer.preview();
  187. document.documentElement.style.cssText = 'visibility:visible !important';
  188. // }
  189. // }
  190. // }
  191. })
  192. }
  193. }
  194. </script>