App.vue 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <script>
  2. import store from '@/store'
  3. import { mapMutations, mapActions, mapGetters } from 'vuex'
  4. import { setTimeout } from 'timers'
  5. import { getUser, wxLoginFn } from '@/utils/auth'
  6. import { getDictionaries } from '@/api/mini'
  7. import util from "./utils/util";
  8. import priceSocket from "./mixins/priceSocket";
  9. export default {
  10. mixins:[priceSocket],
  11. // 全端,数据共享,还可以解决页面初始化模板访问不到值得
  12. // 有坑 分包里的页面访问不到
  13. globalData: {},
  14. onLaunch() {
  15. // #ifdef H5
  16. // H5开发环境无法微信授权,使用固定的用户 shish 2020.4.30
  17. if (process.env.NODE_ENV == "development") {
  18. uni.setStorageSync("token","eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImp0aSI6IjBfMSJ9.eyJpc3MiOiJodHRwOlwvXC9hcGkuc2hvcC5oemdoZC5jb20iLCJhdWQiOiJodHRwOlwvXC9hcGkuc2hvcC5oemdoZC5jb20iLCJqdGkiOiIwXzEiLCJpYXQiOjE2MTg0MDg4NTcsIm5iZiI6MTYxODQwODg1NywiZXhwIjoxNjI3MDQ4ODU3LCJ1bmlxdWVJZCI6IjEiLCJzb3VyY2VJZCI6MH0.iDSEqewx8D1vdiyhQDkfBJBDWljF4zK19M0uqhGmLe4")
  19. uni.setStorageSync("account", "0")
  20. getDictionaries({ token: uni.getStorageSync('token') }).then(res => {
  21. if (util.isEmpty(res)) {
  22. return false
  23. }
  24. store.commit('setDictionariesInfo', {
  25. ...res.data.dict,
  26. ...res.data
  27. })
  28. store.commit('setMyShopInfo', {
  29. ...res.data.shop,
  30. ...res.data
  31. })
  32. })
  33. }
  34. // #endif
  35. // 删除缓存
  36. if (process.env.NODE_ENV == 'production') {
  37. uni.removeStorageSync('shopUser')
  38. }
  39. // #ifdef MP-WEIXIN
  40. // wxLoginFn()
  41. // uni.clearStorage()
  42. const extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {}
  43. uni.setStorageSync('account', extConfig.account)
  44. // #endif
  45. },
  46. onLoad(){
  47. // const pages = getCurrentPages();
  48. // const currentPage = pages[pages.length - 1];
  49. // const url = `/${currentPage.route}`;
  50. // console.log(1111,url)
  51. },
  52. onShow() {
  53. },
  54. onHide() {},
  55. onError(err) {
  56. console.error(err, '错误捕获')
  57. },
  58. methods: {
  59. ...mapActions(['setUserShopAll'])
  60. }
  61. }
  62. </script>
  63. <style lang="scss">
  64. //没有scss变量方法的,主要引入 这样打包的时候就不会所有的组件都打包进去
  65. @import './static/iconfont/iconfont.css';
  66. @import './static/css/uni2.css';
  67. @import './static/css/base.scss';
  68. @import './static/css/common.scss';
  69. @import './static/css/reset.scss';
  70. page {
  71. height: 100%;
  72. }
  73. /**开单-扎和支切换样式**/
  74. .switchover-unit{
  75. position: fixed;
  76. left: calc(170rpx / 2 - 50rpx);
  77. bottom: 140rpx;
  78. display: flex;
  79. align-items: center;
  80. justify-content: center;
  81. width: 100rpx;
  82. height: 100rpx;
  83. color: #FFFFFF;
  84. background: #4b8cf4;
  85. border-radius: 50%;
  86. font-size: 42rpx;
  87. font-weight: 700;
  88. z-index: 2;
  89. }
  90. /**开单-增加减少动画**/
  91. .animation{animation:imgmove 0.3s 1;animation-iteration-count:1;}
  92. @-webkit-keyframes imgmove{0%{transform: scale(0.7);}100%{transform: scale(1);}}
  93. </style>