isTrackFollow.vue 3.9 KB

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