App.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <script>
  2. import {
  3. getGoodsTypeObj,
  4. getUserDetail
  5. } from '@/api/common.js';
  6. import {getVipLog,mealList,getTmpVip} from '@/api/combo.js'
  7. import {Test} from '@/utils/tool.js';
  8. export default {
  9. onLaunch: function() {
  10. console.log('App Launch')
  11. },
  12. onShow: function() {
  13. console.log('App Show')
  14. // if(uni.getStorageSync('token')){
  15. // getVipLog().then(res=>{
  16. // console.log(res);
  17. // if(res.content&&!res.content.length){
  18. // uni.showModal({
  19. // title:'提示',
  20. // content:'免费领取7天会员,畅享专属权益,点击“领取”体验!',
  21. // cancelText:'取消',
  22. // confirmText:'领取',
  23. // success: function (r) {
  24. // if (r.confirm) {
  25. // console.log('用户点击确定');
  26. // mealList({source:2}).then(result=>{
  27. // if(result.content.records.length){
  28. // getTmpVip(result.content.records[0].setMealCode).then(res1=>{
  29. // if(res1.state == 'Success'){
  30. // uni.showToast({
  31. // title:'领取成功',
  32. // icon:'none'
  33. // })
  34. // }
  35. // })
  36. // }else{
  37. // uni.showToast({
  38. // title:'未配置临时会员',
  39. // icon:'none'
  40. // })
  41. // }
  42. // })
  43. // }
  44. // }
  45. // })
  46. // }
  47. // })
  48. // }
  49. // 获取商品类型字段
  50. // getGoodsTypeObj().then(res => {
  51. // if (res.state == 'Success') {
  52. // uni.setStorageSync('goodsTypeObj',JSON.stringify(res.content))
  53. // }
  54. // })
  55. },
  56. onHide: function() {
  57. console.log('App Hide')
  58. // 解决我的页面多个登录窗堆叠问题
  59. let pages = getCurrentPages()
  60. let currentPage = pages[pages.length - 1]
  61. if(currentPage.route == 'pages/my/index'){
  62. uni.reLaunch({
  63. url:'/pages/index/index'
  64. })
  65. }
  66. },
  67. }
  68. </script>
  69. <style lang="scss">
  70. /*每个页面公共css */
  71. @import "@/uni_modules/uview-ui/index.scss";
  72. .tag1{
  73. display: inline-block;
  74. width: 70rpx;
  75. height: 24rpx;
  76. line-height: 24rpx;
  77. text-align: center;
  78. background: #E4F5FF;
  79. border-radius: 4rpx 4rpx 12rpx 4rpx;
  80. font-size: 16rpx;
  81. color: #222222;
  82. margin-left: 8rpx;
  83. }
  84. .tag2{
  85. display: inline-block;
  86. width: 70rpx;
  87. height: 24rpx;
  88. line-height: 24rpx;
  89. text-align: center;
  90. background: #FAEBFF;
  91. border-radius: 4rpx 4rpx 12rpx 4rpx;
  92. font-size: 16rpx;
  93. color: #222222;
  94. margin-left: 8rpx;
  95. }
  96. .tag3{
  97. display: inline-block;
  98. width: 70rpx;
  99. height: 24rpx;
  100. line-height: 24rpx;
  101. text-align: center;
  102. background: linear-gradient( 180deg, #272624 0%, #FFE1A5 100%);
  103. border-radius: 4rpx 4rpx 12rpx 4rpx;
  104. font-size: 16rpx;
  105. color: #FFE1A5;
  106. margin-left: 8rpx;
  107. }
  108. </style>