App.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <script>
  2. import { ref, getCurrentInstance } from 'vue'
  3. export default {
  4. onLaunch: function () {
  5. const { $Http } = getCurrentInstance().proxy;
  6. if (uni.getStorageSync('userMsg').token) {
  7. $Http.basic({
  8. "classname": "webmanage.site.site",
  9. "method": "querySite_Parameter", //查询站点数据
  10. content: {
  11. nocache: true
  12. }
  13. }).then(res => {
  14. if (res.code == 1) {
  15. uni.removeStorageSync('siteP');
  16. uni.setStorageSync("siteP", res.data)
  17. try {
  18. let currentPages = getCurrentPages().pop();
  19. if (currentPages.route == 'pages/login/login' || currentPages.$page.fullPath == "/pages/login/login") uni.redirectTo({
  20. url: '/pages/index/index',
  21. });
  22. } catch (error) {
  23. uni.redirectTo({
  24. url: '/pages/index/index',
  25. });
  26. }
  27. }
  28. })
  29. }
  30. },
  31. onShow: function () {
  32. try {
  33. const { $Http } = getCurrentInstance().proxy;
  34. $Http.uploadNumber && $Http.uploadNumber();
  35. } catch (error) {
  36. }
  37. },
  38. onHide: function () {
  39. }
  40. }
  41. </script>
  42. <style lang="scss">
  43. /* 注意要写在第一行,注意不能引入至uni.scss,同时给style标签加入lang="scss"属性 */
  44. @import "@/uni_modules/uview-plus/index.scss";
  45. @import '/static/iconfont.css';
  46. page {
  47. background-color: #F7F7FF;
  48. }
  49. </style>