iphoneX.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. const state = {
  2. emptyHeight: 0,
  3. botNavHei: 110,
  4. XBoolean: false
  5. };
  6. const getters = {
  7. getBoolEmpty(state) {
  8. return {
  9. emptyHeight: state.emptyHeight,
  10. XBoolean: state.XBoolean,
  11. }
  12. },
  13. getNavHei(state) {
  14. return state.botNavHei;
  15. },
  16. getBotHeight(state) {
  17. return state.emptyHeight + state.botNavHei;
  18. },
  19. getAll(state) {
  20. return state;
  21. },
  22. getEmpty(state) {
  23. return state.emptyHeight;
  24. }
  25. };
  26. const mutations = {
  27. setXBoolean(state, data) {
  28. state.XBoolean = data;
  29. },
  30. setEmptyHeight(state, data) {
  31. state.emptyHeight = data;
  32. },
  33. };
  34. const actions = {
  35. setIphone(content, data) {
  36. // #ifdef MP-ALIPAY
  37. if (data.model.indexOf('iPhone11') > -1 || data.model.indexOf('iPhone12') > -1|| data.model.indexOf('iPhone 11') > -1) {
  38. content.commit('setXBoolean', true);
  39. content.commit('setEmptyHeight', 50);
  40. }
  41. // #endif
  42. // #ifdef MP-WEIXIN
  43. if (data.model.indexOf('iPhone X') > -1 || data.model.indexOf('iPhone12') > -1|| data.model.indexOf('iPhone 11') > -1) {
  44. content.commit('setXBoolean', true);
  45. content.commit('setEmptyHeight', 50);
  46. }
  47. // #endif
  48. // #ifdef MP-TOUTIAO
  49. if (data.model.indexOf('iPhone X') > -1 || data.model.indexOf('Unknown Device') > -1|| data.model.indexOf('iPhone 11') > -1) {
  50. content.commit('setXBoolean', true);
  51. content.commit('setEmptyHeight', 50);
  52. }
  53. // #endif
  54. // #ifdef MP-BAIDU
  55. if (data.model.indexOf('iPhone X') > -1 || data.model.indexOf('iPhone12') > -1|| data.model.indexOf('iPhone 11') > -1) {
  56. content.commit('setXBoolean', true);
  57. content.commit('setEmptyHeight', 50);
  58. }
  59. // #endif
  60. }
  61. };
  62. export default {
  63. namespaced:true,
  64. state,
  65. getters,
  66. mutations,
  67. actions
  68. }