Bag.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <template>
  2. <div
  3. class="bag"
  4. >
  5. <div class="left-wrap">
  6. <div
  7. v-for="(item, idx) in sceneList"
  8. :key="idx"
  9. class="scene"
  10. :class="gameProgress.jagsawProgress[item.idxInConfig].isJagsawDone ? 'unlock' : 'lock'"
  11. :style="{
  12. width: `calc(${item.width} / 1080 * 100vh)`,
  13. height: `calc(${item.height} / 1080 * 100vh)`,
  14. top: `calc(${item.top} / 1080 * 100vh)`,
  15. left: `calc(${item.left} / 1080 * 100vh)`,
  16. }"
  17. >
  18. <img
  19. class=""
  20. :src="require(`@/assets/images/bg-${item.idxInConfig + 1}.jpg`)"
  21. alt=""
  22. draggable="false"
  23. >
  24. <div class="text-wrap">
  25. <span>{{ gameProgress.jagsawProgress[item.idxInConfig].name }} {{ gameProgress.jagsawProgress[item.idxInConfig].isJagsawDone ? '(已完成)' : '(未完成)' }}</span>
  26. <div class="bottom-right">
  27. <img
  28. class="fraction"
  29. :src="require(`@/assets/images/jagsaw-shade-${gameProgress.jagsawProgress[item.idxInConfig].isJagsawDone ? 'unlock' : 'lock'}.png`)"
  30. alt=""
  31. draggable="false"
  32. >
  33. &ensp;× {{ sceneTree[item.idxInConfig].children.reduce((a, b) => {
  34. return {
  35. jagsawNumber: a.jagsawNumber + b.jagsawNumber
  36. }
  37. }).jagsawNumber }}
  38. </div>
  39. </div>
  40. </div>
  41. </div>
  42. <div class="right-wrap">
  43. <img
  44. src="@/assets/images/title-game-rule.png"
  45. alt=""
  46. class="title"
  47. >
  48. <p>每完成一节课,即可获得一块碎片</p>
  49. <p>收集碎片完成拼图游戏,解锁章节图纸</p>
  50. <p>解锁所有章节图纸,建设古镇</p>
  51. <button class="build" />
  52. </div>
  53. </div>
  54. </template>
  55. <script>
  56. export default {
  57. name: 'BagView',
  58. data() {
  59. return {
  60. sceneList: [
  61. {
  62. idxInConfig: 0,
  63. width: 586,
  64. height: 360,
  65. top: 50,
  66. left: 40,
  67. },
  68. {
  69. idxInConfig: 4,
  70. width: 324,
  71. height: 360,
  72. top: 50,
  73. left: 637,
  74. },
  75. {
  76. idxInConfig: 5,
  77. width: 467,
  78. height: 204,
  79. top: 420,
  80. left: 40,
  81. },
  82. {
  83. idxInConfig: 3,
  84. width: 234,
  85. height: 186,
  86. top: 634,
  87. left: 40,
  88. },
  89. {
  90. idxInConfig: 1,
  91. width: 223,
  92. height: 186,
  93. top: 634,
  94. left: 283,
  95. },
  96. {
  97. idxInConfig: 2,
  98. width: 444,
  99. height: 400,
  100. top: 420,
  101. left: 516,
  102. },
  103. ]
  104. }
  105. },
  106. computed: {
  107. ...mapState([
  108. 'gameProgress',
  109. ]),
  110. sceneTree() {
  111. return config.sceneTree
  112. },
  113. },
  114. mounted() {
  115. },
  116. unmounted() {
  117. },
  118. methods: {
  119. ...mapMutations([
  120. ]),
  121. },
  122. }
  123. </script>
  124. <style lang="less" scoped>
  125. .bag {
  126. position: absolute;
  127. left: 0;
  128. top: 0;
  129. width: 100%;
  130. height: 100%;
  131. background-image: url(@/assets/images/bg-game.jpg);
  132. background-size: cover;
  133. background-repeat: no-repeat;
  134. background-position: center center;
  135. display: flex;
  136. justify-content: space-evenly;
  137. align-items: center;
  138. >.left-wrap {
  139. position: relative;
  140. background-image: url(@/assets/images/bg-bag-page-frame.jpg);
  141. background-size: contain;
  142. background-repeat: no-repeat;
  143. background-position: center center;
  144. width: 92.59vh;
  145. height: 80.56vh;
  146. padding: calc(50 / 1080 * 100vh) calc(40 / 1080 * 100vh);
  147. flex: 0 0 auto;
  148. >.scene {
  149. position: absolute;
  150. cursor: pointer;
  151. >img {
  152. position: absolute;
  153. left: 0;
  154. top: 0;
  155. width: 100%;
  156. height: 100%;
  157. object-fit: cover;
  158. }
  159. >.text-wrap {
  160. position: absolute;
  161. left: 0;
  162. background: rgba(255,255,255,0.7);
  163. bottom: 0;
  164. width: 100%;
  165. height: calc(40 / 1080 * 100vh);
  166. padding-left: calc(9 / 1080 * 100vh);
  167. padding-right: calc(9 / 1080 * 100vh);
  168. display: flex;
  169. justify-content: space-between;
  170. align-items: center;
  171. font-size: calc(16 / 1080 * 100vh);
  172. font-family: Source Han Sans CN-Bold, Source Han Sans CN;
  173. font-weight: bold;
  174. >span {
  175. }
  176. >.bottom-right {
  177. display: flex;
  178. justify-content: center;
  179. align-items: center;
  180. >img.fraction {
  181. }
  182. }
  183. }
  184. }
  185. .scene.unlock {
  186. >.text-wrap {
  187. color: #30B07A;
  188. }
  189. }
  190. .scene.lock {
  191. >.text-wrap {
  192. color: #C26827;
  193. }
  194. }
  195. }
  196. >.right-wrap {
  197. width: 51.39vh;
  198. height: 100vh;
  199. counter-reset: game-rule;
  200. display: flex;
  201. flex-direction: column;
  202. justify-content: center;
  203. >img.title {
  204. width: calc(311 / 1080 * 100vh);
  205. height: calc(74 / 1080 * 100vh);
  206. margin-bottom: calc(60 / 1080 * 100vh);
  207. }
  208. >p {
  209. margin-bottom: 1em;
  210. font-size: calc(30 / 1080 * 100vh);
  211. font-family: Source Han Sans CN-Bold, Source Han Sans CN;
  212. font-weight: bold;
  213. color: #C26827;
  214. counter-increment: game-rule;
  215. &::before {
  216. display: inline-block;
  217. content: counter(game-rule) '.' ' ';
  218. white-space: pre;
  219. }
  220. }
  221. >button.build {
  222. margin-top: calc(60 / 1080 * 100vh);
  223. background-image: url(@/assets/images/btn-build-town.png);
  224. background-size: cover;
  225. background-repeat: no-repeat;
  226. background-position: center center;
  227. width: calc(323 / 1080 * 100vh);
  228. height: calc(120 / 1080 * 100vh);
  229. margin-left: auto;
  230. margin-right: auto;
  231. }
  232. }
  233. }
  234. </style>