Index.vue 5.6 KB

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