isTrackFollow.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <template>
  2. <view style="height: 66rpx" v-if="isShowFollowButton">
  3. <view class="track-follow-page">
  4. <view class="container-track-follow">
  5. <view>若无需此赛道更新推送,请点击 </view>
  6. <view class="cancel-follow" @click="isFollowHandler">{{ isFollowData ? "取消关注" : "已取消" }} </view>
  7. <icon @click="followInfoHandler" type="info" size="16" color="#E37318 " />
  8. <van-icon @click="cancelFollowClick" class="close-follow" name="cross" size="16" color="#999" />
  9. </view>
  10. <van-dialog use-slot :show="show" close-on-click-overlay show-cancel-button :showConfirmButton="false" :showCancelButton="false" @close="onClickHide">
  11. <view class="content-dialog">
  12. <view class="close"><van-icon name="cross" color="#333" @click="onClickHide" /></view>
  13. <text class="tips">提示</text>
  14. <text>取消关注后,该赛道下的更新内容都不会对您做消息推送,您也可以在【查研观向小助手】公众号菜单栏【推送规则】下修改您关注的赛道</text>
  15. <image show-menu-by-longpress src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/follow_dialog.png"></image>
  16. </view>
  17. </van-dialog>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. import { User, Reports } from "@/config/api.js";
  23. export default {
  24. name: "",
  25. components: {},
  26. props: {
  27. isShowFollowButton: {
  28. type: Boolean,
  29. required: true,
  30. default: false,
  31. },
  32. source: {
  33. type: String,
  34. required: true,
  35. default: "",
  36. },
  37. sourceId: {
  38. type: Number,
  39. required: true,
  40. default: null,
  41. },
  42. isFollowData: {
  43. type: Boolean,
  44. required: true,
  45. default: false,
  46. },
  47. },
  48. data() {
  49. return {
  50. show: false,
  51. };
  52. },
  53. computed: {},
  54. watch: {},
  55. created() {},
  56. mounted() {},
  57. methods: {
  58. // 开启弹框
  59. followInfoHandler() {
  60. this.show = true;
  61. },
  62. // 关闭弹框
  63. onClickHide() {
  64. this.show = false;
  65. },
  66. // 取消或者添加关注
  67. async isFollowHandler() {
  68. const res =
  69. this.source == "resources"
  70. ? await Reports.reportFllow({
  71. IndustrialManagementId: this.sourceId,
  72. })
  73. : await User.userIndustryFollow({
  74. SourceId: this.sourceId,
  75. Source: "activity",
  76. DoType: this.isFollowData ? "cancel" : "add",
  77. });
  78. if (res.Ret === 200) {
  79. uni.showToast({
  80. title: res.Msg,
  81. duration: 2000,
  82. });
  83. this.$emit("update:isFollowData", res.Data.Status == 1 ? true : false);
  84. }
  85. },
  86. // 点击关闭感兴趣条幅
  87. cancelFollowClick() {
  88. this.$emit("update:isShowFollowButton", false);
  89. },
  90. },
  91. };
  92. </script>
  93. <style scoped lang="scss">
  94. .track-follow-page {
  95. position: fixed;
  96. width: 100%;
  97. left: 0;
  98. top: 0;
  99. z-index: 9;
  100. .container-track-follow {
  101. position: relative;
  102. display: flex;
  103. align-items: center;
  104. justify-content: center;
  105. width: 100%;
  106. height: 60rpx;
  107. padding-right: 30rpx;
  108. background-color: #fff1e9;
  109. color: #e37318;
  110. .cancel-follow {
  111. width: 136rpx;
  112. height: 44rpx;
  113. background-color: #e37318;
  114. color: #fff;
  115. text-align: center;
  116. line-height: 46rpx;
  117. margin: 0 20rpx 0 15rpx;
  118. }
  119. .close-follow {
  120. position: absolute;
  121. top: 50%;
  122. right: 20rpx;
  123. transform: translateY(-50%);
  124. width: 30rpx;
  125. height: 30rpx;
  126. }
  127. }
  128. .content-dialog {
  129. text-align: center;
  130. font-size: 32rpx;
  131. color: #666;
  132. line-height: 40rpx;
  133. padding: 0 20rpx;
  134. .close {
  135. display: flex;
  136. justify-content: flex-end;
  137. align-items: center;
  138. height: 60rpx;
  139. padding-right: 10rpx;
  140. }
  141. .tips {
  142. color: #333;
  143. font-size: 34rpx;
  144. font-weight: 500;
  145. margin-bottom: 12rpx;
  146. }
  147. image {
  148. margin-top: 35rpx;
  149. width: 545rpx;
  150. height: 579rpx;
  151. }
  152. }
  153. }
  154. </style>