App.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  1. <template>
  2. <div class="scroll-wrapper" :class="[{ darkTheme: darkTheme }, routeName]" id="scroll-wrapper" ref="scroll"
  3. @scroll="scrollEvent" v-if="setting == false">
  4. <app-bar ref="bar"></app-bar>
  5. <router-view v-slot="{ Component }">
  6. <keep-alive :include="keeps">
  7. <component :is="Component" class="scroll-content" ref="content" :style="scrollStyle" />
  8. </keep-alive>
  9. </router-view>
  10. <phone-ver></phone-ver>
  11. <Transition>
  12. <swiper v-if="showSplash" pagination @reachEnd="reachEnd" class="appSwiper"
  13. :autoplay="{ delay: 3000, disableOnInteraction: false }">
  14. <swiper-slide>
  15. <img src="https://cdn.raex.vip/image/splash1.jpg" alt="" />
  16. </swiper-slide>
  17. <swiper-slide>
  18. <img src="https://cdn.raex.vip/image/splash2.jpg" alt="" />
  19. </swiper-slide>
  20. <swiper-slide>
  21. <img src="https://cdn.raex.vip/image/splash3.jpg" alt="" />
  22. </swiper-slide>
  23. <swiper-slide>
  24. <img src="https://cdn.raex.vip/image/splash4.jpg" alt="" />
  25. </swiper-slide>
  26. <swiper-slide>
  27. <img src="https://cdn.raex.vip/image/splash5.jpg" alt="" />
  28. </swiper-slide>
  29. <swiper-slide>
  30. <img src="https://cdn.raex.vip/image/splash6.jpg" alt="" />
  31. </swiper-slide>
  32. <div class="tiaozhuan" @click="goApp">跳过</div>
  33. </swiper>
  34. </Transition>
  35. </div>
  36. <div class="scroll-wrapper scroll-wrappers" :class="{ darkTheme: darkTheme }" id="scroll-wrapper" ref="scroll"
  37. @scroll="scrollEvent" v-else-if="setting == true">
  38. <app-bar ref="bar"></app-bar>
  39. <router-view v-slot="{ Component }">
  40. <keep-alive :include="keeps">
  41. <component :is="Component" class="scroll-content" ref="content" :style="scrollStyle" />
  42. </keep-alive>
  43. </router-view>
  44. <phone-ver></phone-ver>
  45. <Transition>
  46. <swiper v-if="showSplash" pagination @reachEnd="reachEnd" class="appSwiper"
  47. :autoplay="{ delay: 3000, disableOnInteraction: false }">
  48. <swiper-slide>
  49. <img src="https://cdn.raex.vip/image/splash1.jpg" alt="" />
  50. </swiper-slide>
  51. <swiper-slide>
  52. <img src="https://cdn.raex.vip/image/splash2.jpg" alt="" />
  53. </swiper-slide>
  54. <swiper-slide>
  55. <img src="https://cdn.raex.vip/image/splash3.jpg" alt="" />
  56. </swiper-slide>
  57. <swiper-slide>
  58. <img src="https://cdn.raex.vip/image/splash4.jpg" alt="" />
  59. </swiper-slide>
  60. <swiper-slide>
  61. <img src="https://cdn.raex.vip/image/splash5.jpg" alt="" />
  62. </swiper-slide>
  63. <swiper-slide>
  64. <img src="https://cdn.raex.vip/image/splash6.jpg" alt="" />
  65. </swiper-slide>
  66. <div class="tiaozhuan" @click="goApp">跳过</div>
  67. </swiper>
  68. </Transition>
  69. </div>
  70. </template>
  71. <script>
  72. import AppBar from './components/AppBar.vue';
  73. import { computed } from 'vue';
  74. import PhoneVer from './components/PhoneVer.vue';
  75. import { mapState } from 'vuex';
  76. import { Swiper, SwiperSlide } from 'swiper/vue';
  77. import 'swiper/swiper.min.css';
  78. import 'swiper/swiper-bundle.min.css';
  79. import SwiperCore, { Pagination, Autoplay } from 'swiper';
  80. import dayjs from 'dayjs';
  81. import { throwStatement } from '@babel/types';
  82. // install Swiper modules
  83. SwiperCore.use([Pagination, Autoplay]);
  84. export default {
  85. components: { AppBar, PhoneVer, Swiper, SwiperSlide },
  86. name: 'App',
  87. provide() {
  88. return {
  89. setKeeps: this.setKeeps,
  90. bar: computed(() => this.barValue),
  91. content: computed(() => this.$refs.content),
  92. scrollWrapper: computed(() => this.$el),
  93. changeScroll: this.changeScroll,
  94. keeps: computed(() => this.keeps),
  95. bodyScroll: computed(() => this.bodyScroll),
  96. changeTab: this.changeTab
  97. };
  98. },
  99. inject: ['barHeight'],
  100. computed: {
  101. ...mapState(['darkTheme']),
  102. barValue() {
  103. return this.$refs.bar;
  104. },
  105. scrollStyle() {
  106. return {
  107. boxSizing: 'border-box',
  108. minHeight: `calc(100vh - ${(this.barHeight || '0') + 'px'})`
  109. };
  110. }
  111. },
  112. data() {
  113. return {
  114. checkEvent: null,
  115. keeps: [],
  116. bodyScroll: 0,
  117. showSplash: false,
  118. setting: false,
  119. routeName: ''
  120. };
  121. },
  122. watch: {
  123. $route() {
  124. this.$nextTick(() => {
  125. this.$el.scrollTop = 0;
  126. });
  127. if (this.$route.name == 'userSettingComplete' || this.$route.name == 'userSetting') {
  128. this.setting = true;
  129. } else {
  130. this.setting = false;
  131. }
  132. this.routeName = this.$route.name;
  133. }
  134. },
  135. mounted() {
  136. if ('1' !== window.localStorage.getItem('AppSplash')) {
  137. this.showSplash = true;
  138. window.localStorage.setItem('AppSplash', '1');
  139. } else {
  140. if (window.cordova && StatusBar) {
  141. StatusBar.styleDefault();
  142. }
  143. this.getCard();
  144. }
  145. this.routeName = this.$route.name;
  146. },
  147. methods: {
  148. getCard() {
  149. this.$http
  150. .get('sysConfig/get/fu_startTime')
  151. .then(res => {
  152. if (res.value) {
  153. let date1 = dayjs(res.value);
  154. let dates = [];
  155. for (let i = 0; i < 10; i++) {
  156. dates.push(date1.add(i, 'days').format('YYYY-MM-DD'));
  157. }
  158. console.log(dates);
  159. console.log(dates.includes(dayjs().format('YYYY-MM-DD')));
  160. if (dates.includes(dayjs().format('YYYY-MM-DD'))) {
  161. if (!this.isLogin) {
  162. return Promise.resolve();
  163. } else {
  164. return this.$http.post('/dailySign/search', {
  165. userId: this.$store.state.userInfo.id,
  166. start: dayjs().format('YYYY-MM-DD'),
  167. end: dayjs().format('YYYY-MM-DD')
  168. });
  169. }
  170. }
  171. }
  172. return Promise.reject();
  173. })
  174. .then(res => {
  175. if (res && res.length > 0) {
  176. return Promise.reject();
  177. } else {
  178. return Promise.resolve();
  179. }
  180. })
  181. .then(() => {
  182. this.$router.push('/check');
  183. });
  184. },
  185. goApp() {
  186. this.showSplash = false;
  187. if (window.cordova && StatusBar) {
  188. StatusBar.styleDefault();
  189. }
  190. this.getCard();
  191. },
  192. reachEnd() {
  193. setTimeout(() => {
  194. this.goApp();
  195. }, 3000);
  196. },
  197. setKeeps(keep = [], isAdd = true, isClear = false) {
  198. let keeps = [...this.keeps];
  199. if (isAdd) {
  200. keeps = [...keeps, ...keep];
  201. } else {
  202. keeps = keeps.filter(item => {
  203. return !keep.includes(item);
  204. });
  205. }
  206. if (isClear) {
  207. keeps = [];
  208. }
  209. this.keeps = keeps;
  210. },
  211. changeScroll(scrollTop, isAnimate = false) {
  212. console.log(scrollTop);
  213. if (isAnimate) {
  214. this.$el.scrollTo({
  215. top: scrollTop || 0,
  216. behavior: 'smooth'
  217. });
  218. } else {
  219. this.$el.scrollTop = scrollTop || 0;
  220. }
  221. },
  222. scrollEvent() {
  223. // console.log(this.$el.scrollTop);
  224. this.bodyScroll = this.$el.scrollTop;
  225. },
  226. changeTab(color) {
  227. this.$refs.bar.getColor(color);
  228. }
  229. }
  230. };
  231. </script>
  232. <style lang="less" scoped>
  233. .scroll-content {
  234. box-sizing: border-box;
  235. // padding-top: 46px;
  236. &.index {
  237. background-color: #0f0f0f;
  238. }
  239. }
  240. .scroll-wrapper {
  241. background-color: @bg;
  242. &.digitalOrganization {
  243. background: #272b2e;
  244. }
  245. &.store {
  246. background-color: #0f0f0f;
  247. }
  248. &.quotationRecord {
  249. background: #0F0F0F;
  250. }
  251. &.ranking {
  252. background: #010225;
  253. }
  254. &.metaDomain,
  255. &.shoppingCart {
  256. background: #000000;
  257. }
  258. &.home {
  259. background-color: var(--bg);
  260. }
  261. &.productDetail,
  262. &.assetDetail,
  263. &.auctionDetail {
  264. background-color: #0f0f0f;
  265. }
  266. &.productSearchCorpse,
  267. &.discover,
  268. &.mine,
  269. &.creatorDetail,
  270. &.hopeMarket {
  271. background-color: #272b2e;
  272. }
  273. &.userLogin,
  274. &.userRegister {
  275. background-color: #101010;
  276. }
  277. &.chatList,
  278. &.chatDetail,
  279. &.teamSetting,
  280. &.ai {
  281. background-color: #1c1c1c;
  282. }
  283. &.auction {
  284. background-color: #030001;
  285. }
  286. &.domainname,
  287. &.domainSubmit,
  288. &.activityList,
  289. &.newsList {
  290. background-color: #030001;
  291. }
  292. &.activityDetail {
  293. background-color: #181818;
  294. }
  295. }
  296. .scroll-wrappers {
  297. background-color: #272b2e;
  298. }
  299. .appSwiper {
  300. position: fixed;
  301. width: 100vw;
  302. height: 100vh;
  303. // height: var(--app-height);
  304. top: 0;
  305. left: 0;
  306. right: 0;
  307. bottom: 0;
  308. z-index: 9999;
  309. object-fit: cover;
  310. opacity: 1;
  311. transition: opacity 0.8s ease-in-out;
  312. background-color: #000;
  313. --swiper-theme-color: #fff;
  314. .swiper-slide {
  315. img {
  316. width: 100%;
  317. height: 100%;
  318. object-fit: cover;
  319. }
  320. }
  321. /deep/.swiper-pagination {
  322. .fixedBottom(40px);
  323. }
  324. .tiaozhuan {
  325. height: 26px;
  326. background: rgba(0, 0, 0, 0.3);
  327. border-radius: 14px;
  328. font-size: 14px;
  329. font-weight: 400;
  330. color: #ffffff;
  331. line-height: 26px;
  332. padding: 0 16px;
  333. position: fixed;
  334. z-index: 30;
  335. top: calc(var(--safe-top) + 36px);
  336. right: 30px;
  337. }
  338. }
  339. .v-enter-active,
  340. .v-leave-active {
  341. transition: opacity 0.5s ease;
  342. }
  343. .v-enter-from,
  344. .v-leave-to {
  345. opacity: 0;
  346. }
  347. </style>