Guide.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <template>
  2. <div v-if="show && isMobile" class="user-guide-overlay">
  3. <div class="user-guide-mobile">
  4. <div class="zh">
  5. <div class="btn" @click="onSet"></div>
  6. </div>
  7. </div>
  8. </div>
  9. </template>
  10. <script setup>
  11. import { onMounted, watch, computed, ref, nextTick } from 'vue'
  12. import { useApp } from '@/app'
  13. import browser from "@/utils/browser";
  14. import { useStore } from "vuex";
  15. const isMobile = browser.isMobile()
  16. const show = computed(() => store.getters["player"].showUserGuide);
  17. const store = useStore();
  18. const onSet = () => {
  19. store.commit("showUserGuide", false);
  20. localStorage.setItem('user_guide', Date.now())
  21. }
  22. const getTips = tips => {
  23. let text = tips.split('<br />')
  24. return `<span>${text[0]}</span><div>${text[1]}</div>`
  25. }
  26. useApp().then(app => {
  27. app.Scene.on('loaded', () => {
  28. if (!localStorage.getItem('user_guide')) {
  29. store.commit("showUserGuide", true);
  30. }
  31. })
  32. })
  33. </script>
  34. <style lang="scss" scoped>
  35. .user-guide-overlay {
  36. position: fixed;
  37. left: 0;
  38. top: 0;
  39. width: 100%;
  40. height: 100%;
  41. z-index: 109;
  42. background-color: rgba(0, 0, 0, 0.7);
  43. }
  44. .user-guide {
  45. white-space: normal;
  46. position: absolute;
  47. top: 50%;
  48. left: 1.2rem;
  49. right: 1.2rem;
  50. border-radius: 0.15rem;
  51. color: #fff;
  52. transform: translateY(-50%);
  53. background-color: rgba(0, 0, 0, 0.7);
  54. z-index: 999999;
  55. .main {
  56. padding: 0.8rem;
  57. padding-bottom: 0;
  58. h4 {
  59. margin: 0;
  60. font-size: 0.5rem;
  61. text-align: center;
  62. }
  63. ul,
  64. li {
  65. list-style: none;
  66. padding: 0;
  67. margin: 0;
  68. width: 100%;
  69. }
  70. ul {
  71. margin: 0.4rem 0;
  72. }
  73. li {
  74. display: flex;
  75. align-items: center;
  76. padding: 0.6rem 0;
  77. i {
  78. font-size: 1.2rem;
  79. }
  80. > div {
  81. line-height: 1.6;
  82. font-size: 0.4rem;
  83. margin-left: 0.35rem;
  84. }
  85. }
  86. button {
  87. width: 100%;
  88. margin-bottom: 0.5rem;
  89. background-color: #fff;
  90. font-size: 0.4rem;
  91. color: #444;
  92. height: 1.1rem;
  93. border: none;
  94. border-radius: 0.15rem;
  95. &[type='submit'] {
  96. color: #fff;
  97. background-color: transparent;
  98. }
  99. }
  100. }
  101. @media (orientation: landscape) {
  102. width: 400px;
  103. left: 50% !important;
  104. right: auto !important;
  105. margin-left: -200px;
  106. .main {
  107. padding: 0.5rem;
  108. h4 {
  109. font-size: 0.35rem;
  110. }
  111. ul {
  112. margin: 0.3rem 0;
  113. }
  114. li {
  115. padding: 0.1rem 0;
  116. i {
  117. font-size: 0.6rem;
  118. }
  119. > div {
  120. font-size: 0.25rem;
  121. }
  122. }
  123. button {
  124. margin-bottom: 0rem;
  125. font-size: 0.3rem;
  126. height: 0.8rem;
  127. }
  128. }
  129. }
  130. }
  131. .user-guide-mobile {
  132. position: absolute;
  133. top: 3.15789rem;
  134. left: 50%;
  135. width: 7.89474rem;
  136. transform: translateX(-50%);
  137. .zh {
  138. width: 100%;
  139. height: 7rem;
  140. background-image: url(~@/assets/images/guide/novice_guide_text@2x.png);
  141. background-size: contain;
  142. background-position: center top;
  143. background-repeat: no-repeat;
  144. }
  145. .en {
  146. width: 100%;
  147. color: #fff;
  148. ul,
  149. li {
  150. list-style: none;
  151. padding: 0;
  152. margin: 0;
  153. width: 100%;
  154. }
  155. ul {
  156. margin: 0;
  157. }
  158. li {
  159. display: flex;
  160. align-items: flex-start;
  161. padding: 0.5rem 0;
  162. &:first-child {
  163. padding-top: 0;
  164. }
  165. i {
  166. font-size: 1.32rem;
  167. }
  168. > div {
  169. font-size: 0.4rem;
  170. margin-left: 0.3rem;
  171. :deep(span) {
  172. font-size: 0.6rem;
  173. color: #00c2c4;
  174. }
  175. :deep(div) {
  176. font-size: 0.5rem;
  177. margin-top: 0.1rem;
  178. white-space: pre-line;
  179. line-height: 1.3;
  180. }
  181. }
  182. }
  183. .btn {
  184. background-image: none;
  185. color: #00c2c4;
  186. line-height: 1.2rem;
  187. text-align: center;
  188. font-size: 0.52632rem;
  189. background-image: url(~@/assets/images/guide/novice_guide_button_empty@2x.png);
  190. }
  191. }
  192. .btn {
  193. position: absolute;
  194. bottom: -3.15789rem;
  195. left: 50%;
  196. width: 3.5rem;
  197. height: 1.31579rem;
  198. background-image: url(~@/assets/images/guide/novice_guide_button@2x.png);
  199. background-size: contain;
  200. background-position: center top;
  201. background-repeat: no-repeat;
  202. transform: translateX(-50%);
  203. }
  204. @media (orientation: landscape) {
  205. top: 0.5rem;
  206. .zh {
  207. height: 4rem;
  208. .btn {
  209. width: 2.5rem;
  210. height: 0.8rem;
  211. bottom: -1.4rem;
  212. }
  213. }
  214. .en {
  215. li {
  216. padding: 0.15rem 0;
  217. i {
  218. font-size: 1rem;
  219. }
  220. > div {
  221. margin-left: 0.3rem;
  222. :deep(span) {
  223. font-size: 0.3rem;
  224. }
  225. :deep(div) {
  226. font-size: 0.25rem;
  227. margin-top: 0.1rem;
  228. }
  229. }
  230. }
  231. .btn {
  232. height: 0.7rem;
  233. line-height: 0.63rem;
  234. font-size: 0.25rem;
  235. bottom: -0.7rem;
  236. }
  237. }
  238. }
  239. }
  240. </style>