App.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <script>
  2. import {
  3. getGoodsTypeObj,
  4. getUserDetail
  5. } from '@/api/common.js';
  6. import {getGdShopInfo} from '@/api/study.js';
  7. // 腾讯地图
  8. // var QQMapWX = require('@/libs/qqmap-wx-jssdk.min.js');
  9. // var qqmapsdk = new QQMapWX({key:'KX5BZ-B64RC-RO62W-AMWAZ-VVTC3-YAFXF'});
  10. export default {
  11. onLaunch: function() {
  12. console.log('App Launch')
  13. },
  14. onShow: function() {
  15. console.log('App Show')
  16. // 获取商品类型字段
  17. getGoodsTypeObj().then(res => {
  18. if (res.state == 'Success') {
  19. uni.setStorageSync('goodsTypeObj',JSON.stringify(res.content))
  20. }
  21. })
  22. // 获取贵大文创ID
  23. getGdShopInfo().then(res=>{
  24. console.log('res',res);
  25. if(res.state == "Success"){
  26. uni.setStorageSync('gdShopId',res.content.shopId)
  27. uni.setStorageSync("gdTeaId",res.content.teaShop.shopId)
  28. uni.setStorageSync("teaCateId",res.content.teaCateId)
  29. }
  30. })
  31. },
  32. onHide: function() {
  33. console.log('App Hide')
  34. // 解决我的页面多个登录窗堆叠问题
  35. let pages = getCurrentPages()
  36. let currentPage = pages[pages.length - 1]
  37. if(currentPage.route == 'pages/my/index'){
  38. uni.reLaunch({
  39. url:'/pages/index/index'
  40. })
  41. }
  42. },
  43. }
  44. </script>
  45. <style lang="scss">
  46. /*每个页面公共css */
  47. @import "@/uni_modules/uview-ui/index.scss";
  48. </style>