Guide.vue 5.4 KB

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