App.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <script>
  2. // #ifdef H5
  3. import { shareConfig, setShareData } from "./common/wechat";
  4. // #endif
  5. export default {
  6. onLaunch: function(options) {
  7. this.autoLogin();
  8. // #ifdef H5
  9. shareConfig()
  10. uni.getSystemInfo({
  11. success(e) {
  12. if (e.windowWidth > 420 && !/iOS|Android/i.test(e.system)) {
  13. window.location.pathname = '/wap/static/html/home.html';
  14. }
  15. }
  16. })
  17. setTimeout(() => {
  18. setShareData({
  19. title: '印山泓',
  20. desc: '做江西好茶搬运工,带你品遍江西名茶',
  21. link: 'https://mall.yinshanhong.com.cn/wap/static/html/home.html',
  22. imgUrl: 'https://mall.yinshanhong.com.cn/static/images/share.jpg',
  23. })
  24. }, 1000)
  25. // #endif
  26. },
  27. onShow: function() {
  28. let users = this.$storage.getJson("users");
  29. if(users){
  30. uni.setTabBarBadge({ index: 2, text: users.shop_count.toString() });
  31. }else{
  32. uni.removeTabBarBadge({ index: 2 })
  33. }
  34. },
  35. onHide: function() {
  36. console.log('App Hide')
  37. },
  38. methods: {
  39. autoLogin(){
  40. let users = this.$storage.getJson("users");
  41. if(users != null){
  42. this.$http.autoLogin().then(result=>{
  43. if(result.status===1000){
  44. this.$store.commit("UPDATEUSERS",result.data);
  45. }else{
  46. this.$storage.remove("users");
  47. }
  48. });
  49. }
  50. },
  51. }
  52. }
  53. </script>
  54. <style>
  55. @import '~@/style.css';
  56. page { background-color: #f8f8f8; }
  57. .clear:after { content:" "; font-size:0; display:block; height:0; clear:both; visibility:hidden; }
  58. uni-checkbox .uni-checkbox-input { border-radius: 50rpx; }
  59. // #ifdef H5
  60. uni-toast { z-index: 10099 !important; }
  61. uni-modal { z-index: 10099 !important; }
  62. // #endif
  63. ::-webkit-scrollbar {
  64. display: none;
  65. width: 0 !important;
  66. height: 0 !important;
  67. -webkit-appearance: none;
  68. background: transparent;
  69. }
  70. </style>