App.vue 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <script>
  2. import { ref, getCurrentInstance } from 'vue'
  3. export default {
  4. onLaunch: function () {
  5. const { $Http } = getCurrentInstance().proxy;
  6. if (wx.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. let currentPages = getCurrentPages()[getCurrentPages().length - 1];
  18. if (currentPages.route == 'pages/login/login') uni.redirectTo({
  19. url: '/pages/index/index',
  20. });
  21. }
  22. })
  23. }
  24. },
  25. onShow: function () {
  26. try {
  27. const { $Http } = getCurrentInstance().proxy;
  28. $Http.uploadNumber && $Http.uploadNumber();
  29. } catch (error) {
  30. }
  31. },
  32. onHide: function () {
  33. }
  34. }
  35. </script>
  36. <style lang="scss">
  37. /* 注意要写在第一行,注意不能引入至uni.scss,同时给style标签加入lang="scss"属性 */
  38. @import "@/uni_modules/uview-plus/index.scss";
  39. @import '/static/iconfont.css';
  40. page {
  41. background-color: #F7F7FF;
  42. }
  43. </style>