global.js 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. export default {
  2. data() {
  3. return {
  4. // 静态资源路径
  5. staticUrl: 'https://static.caimei365.com/app/mini-hehe/icon/'
  6. }
  7. },
  8. methods: {
  9. jumpAction(data) {
  10. const { jumpType, jumpLink, jumpProductId, jumpImage } = data
  11. if (jumpType === 1 && !jumpLink) return
  12. if (jumpType === 2 && !jumpProductId) return
  13. if (jumpType === 3 && !jumpImage) return
  14. // jumpType 跳转类型:1链接,2商品,3图片
  15. const jumpMap = {
  16. 1: `others/web-view?websit=${encodeURIComponent(jumpLink)}`,
  17. 2: `goods/goods-detail?productId=${jumpProductId}&jumpState=0`,
  18. 3: `others/image-view?imageUrl=${encodeURIComponent(jumpImage)}`
  19. }
  20. this.$router.navigateTo(jumpMap[jumpType])
  21. },
  22. initSetSystemInfo() {
  23. let self = this
  24. uni.getSystemInfo({
  25. success: function(e) {
  26. let modelmes = e.model
  27. console.log(e)
  28. if (modelmes.search('iPhone 11') !== -1 || modelmes.search('iPhone 11 Pro Max') !==
  29. -1 || modelmes.search('iPhone X') != -1) { //XS,XR,XS MAX均可以适配
  30. self.$store.dispatch('setVariableFun', true)
  31. } else {
  32. self.$store.dispatch('setVariableFun', false)
  33. }
  34. // #ifndef MP
  35. Vue.prototype.StatusBar = e.statusBarHeight
  36. if (e.platform == 'android') {
  37. Vue.prototype.CustomBar = e.statusBarHeight + 50
  38. Vue.prototype.platformClass = true
  39. } else {
  40. Vue.prototype.CustomBar = e.statusBarHeight + 45
  41. Vue.prototype.platformClass = false
  42. };
  43. // #endif
  44. // #ifdef MP-WEIXIN || MP-QQ
  45. console.log(e.platform)
  46. if (e.platform == 'android') {
  47. Vue.prototype.platformClass = 'left'
  48. self.$store.dispatch('setVariableFun', false)
  49. } else {
  50. Vue.prototype.platformClass = 'center'
  51. self.$store.dispatch('setIsIphoneFun', true)
  52. }
  53. Vue.prototype.StatusBar = e.statusBarHeight
  54. Vue.prototype.fontSizeSetting = e.fontSizeSetting
  55. Vue.prototype.screenWidth = e.screenWidth
  56. let capsule = wx.getMenuButtonBoundingClientRect()
  57. Vue.prototype.capsule = capsule
  58. if (capsule) {
  59. Vue.prototype.Custom = capsule
  60. Vue.prototype.CustomBar = capsule.bottom + capsule.top - e.statusBarHeight
  61. } else {
  62. Vue.prototype.CustomBar = e.statusBarHeight + 50
  63. }
  64. // #endif
  65. // #ifdef MP-ALIPAY
  66. Vue.prototype.StatusBar = e.statusBarHeight
  67. Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight
  68. // #endif
  69. }
  70. })
  71. }
  72. }
  73. }