app-my-app.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <view class="app-view">
  3. <view class="app-my-app point-box"
  4. v-if='is_add_show'
  5. :style="[hiddenHeight()]"
  6. >
  7. <view class='triangle'
  8. :style="{'border-bottom':'16rpx solid ' + setting.add_app_bg_color,'opacity': setting.add_app_bg_transparency / 100}"
  9. ></view>
  10. <view class='dir-left-nowrap cross-center'>
  11. <image @click='close'
  12. v-if='setting.add_app_icon_color_type == 1'
  13. class='icon-fork'
  14. src='/static/image/icon/fork_white.png'
  15. ></image>
  16. <image @click='close'
  17. v-else-if='setting.add_app_icon_color_type == 2'
  18. class='icon-fork'
  19. src='/static/image/icon/fork_black.png'
  20. ></image>
  21. <view class='cross-center point-text'
  22. :style="{'color':setting.add_app_text_color}">
  23. {{setting.add_app_text}}
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. import { mapState } from "vuex";
  31. export default {
  32. name: "app-my-app",
  33. data() {
  34. return {
  35. is_add_show: false,
  36. }
  37. },
  38. computed: {
  39. //可首先定义
  40. hiddenHeight() {
  41. return (type) => {
  42. let top = null;
  43. function changePx(num) {
  44. return uni.upx2px(num);
  45. }
  46. let barHeight;
  47. // #ifdef MP-WEIXIN || MP-BAIDU || MP-TOUTIAO
  48. barHeight = this.systemInfo.statusBarHeight + this.mBarHeight;
  49. // #endif
  50. barHeight = barHeight || 0;
  51. top = {top: (barHeight + changePx(16)) + 'px',}
  52. return Object.assign({
  53. backgroundColor: this.setting.add_app_bg_color,
  54. opacity: this.setting.add_app_bg_transparency / 100,
  55. borderRadius: this.setting.add_app_bg_radius + `rpx`
  56. }, top);
  57. }
  58. },
  59. ...mapState({
  60. systemInfo: state => state.gConfig.systemInfo,
  61. mBarHeight: state => state.gConfig.mBarHeight
  62. }),
  63. ...mapState('mallConfig', {
  64. setting: state => state.mall.setting
  65. }),
  66. },
  67. methods: {
  68. close: function () {
  69. this.is_add_show = false;
  70. this.$storage.setStorageSync('_IS_ADD_APP', !this.is_add_show);
  71. }
  72. },
  73. created() {
  74. this.is_add_show = !this.$storage.getStorageSync('_IS_ADD_APP');
  75. }
  76. }
  77. </script>
  78. <style scoped lang="scss">
  79. .point-box {
  80. position: fixed;
  81. z-index: 9999;
  82. top: 16#{rpx};
  83. right: 24#{rpx};
  84. height: 72#{rpx};
  85. .triangle {
  86. width: 0;
  87. height: 0;
  88. border-right: 16#{rpx} solid transparent;
  89. border-left: 16#{rpx} solid transparent;
  90. position: absolute;
  91. top: -15#{rpx};
  92. right: 114#{rpx};
  93. }
  94. .icon-fork {
  95. width: 72#{rpx};
  96. height: 72#{rpx};
  97. }
  98. .point-text {
  99. margin: 0 28#{rpx};
  100. font-size: $uni-font-size-general-one;
  101. }
  102. }
  103. </style>