Index.vue 5.4 KB

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