authorPages.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <template>
  2. <view class="container author-container">
  3. <view class="author-box">
  4. <view class="author-img">
  5. <image :src="list.ImgUrl"></image>
  6. <text class="">{{ list.NickName }}</text>
  7. </view>
  8. <text :class="!isFollw ? 'cancel-attention' : 'attention'" @click="isAttention">
  9. {{ isFollw ? "+ 关注": "取消关注" }}
  10. </text>
  11. </view>
  12. <view class="author-num">
  13. <view class="num-box">
  14. <text class="">{{ list.FllowNum }}</text>
  15. <text class="text">粉丝</text>
  16. </view>
  17. <view class="num-box">
  18. <text class="">{{ list.ArticleNum }}</text>
  19. <text class="text">报告</text>
  20. </view>
  21. <view class="num-box">
  22. <text class="">{{ list.CollectNum }}</text>
  23. <text class="text">获得收藏</text>
  24. </view>
  25. </view>
  26. <view class="content-item" v-for="item in list.List" :key="item.ArticleId">
  27. <view class="item-title">
  28. <text style="display: inline" @click="goDetail(item)">
  29. {{ item.Title }}
  30. </text>
  31. <text class="item-industry" @click="themeDetails(item)">&nbsp;&nbsp;&nbsp;#{{ item.IndustryName }}</text>
  32. </view>
  33. <view class="item-more">
  34. <text>{{ item.PublishDate }}</text>
  35. <view class="pv-ollect">
  36. <view>
  37. <image class="pv" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/examine_icon.png"></image>
  38. {{ item.Pv }}
  39. </view>
  40. <view @click="collectClick(item)">
  41. <image v-if="item.IsCollect" src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/collect_act.png"></image>
  42. <image v-else src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/collect_ico.png"></image>
  43. {{ item.CollectNum }}人收藏
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <u-modal
  49. v-model="goFollowShow"
  50. :content-style="{ fontSize: '32rpx' }"
  51. @confirm="goFollowShowBtn"
  52. :show-cancel-button="isCancelBtn"
  53. :confirm-text="confirmText"
  54. @cancel="isCancelBtn = false"
  55. :show-title="false"
  56. :cancel-style="{ borderRight: '1rpx solid #EBEBEB' }"
  57. :confirm-style="{ fontWeight: '700' }"
  58. >
  59. <view class="slot-content">
  60. <rich-text :nodes="accounts"></rich-text>
  61. </view>
  62. </u-modal>
  63. </view>
  64. </template>
  65. <script>
  66. import { Reports, Research, Report } from "@/config/api.js";
  67. export default {
  68. data() {
  69. return {
  70. list: [],
  71. isFollw: false,
  72. goFollowShow: false,
  73. confirmText: "知道了",
  74. isCancelBtn: false,
  75. accounts: "",
  76. };
  77. },
  78. methods: {
  79. async departmentIdDetail(id) {
  80. const res = await Research.departmentIdDetail({
  81. DepartmentId: id || 56,
  82. });
  83. if (res.Ret === 200) {
  84. this.list = res.Data || {};
  85. this.isFollw = res.Data.IsFollw;
  86. }
  87. },
  88. //关注
  89. async isAttention() {
  90. const res = await Reports.reportFllowDepartment({ DepartmentId: this.list.DepartmentId });
  91. if (res.Ret === 200) {
  92. this.isFollw = !this.isFollw;
  93. if (res.Data.Status == 1) {
  94. this.goFollowShow = true;
  95. this.confirmText = res.Data.GoFollow ? "去关注" : "知道了";
  96. if (res.Data.GoFollow) {
  97. this.accounts = `作者关注成功 <br> 想要及时获取该作者的报告更新提示,请关注【查研观向小助手】公众号`;
  98. this.isCancelBtn = true;
  99. } else {
  100. this.accounts = "作者关注成功<br>请关注【查研观向小助手】公众号,及时获取作者的报告更新提示";
  101. }
  102. } else {
  103. uni.showToast({
  104. title: "已取消关注",
  105. icon: "none",
  106. duration: 2000,
  107. });
  108. }
  109. }
  110. },
  111. //收藏
  112. async collectClick(item) {
  113. const res = await Report.collectRpt({ ArticleId: item.ArticleId });
  114. if (res.Ret === 200) {
  115. item.IsCollect = !item.IsCollect;
  116. item.IsCollect
  117. ? (item.CollectNum += 1) &&
  118. uni.showToast({
  119. title: "收藏成功",
  120. icon: "none",
  121. duration: 2000,
  122. })
  123. : (item.CollectNum -= 1);
  124. !item.IsCollect &&
  125. uni.showToast({
  126. title: "已取消收藏",
  127. icon: "none",
  128. duration: 2000,
  129. });
  130. }
  131. },
  132. //点击了去关注
  133. goFollowShowBtn() {
  134. if (this.confirmText == "去关注") {
  135. uni.navigateTo({
  136. url: "/activityPages/accountsOfficial/accountsOfficial",
  137. });
  138. }
  139. this.goFollowShow = false;
  140. },
  141. //去往文章详情页面
  142. goDetail(item) {
  143. this.$store.dispatch("checkHandle", "/pageMy/reportDetail/reportDetail?id=" + item.ArticleId);
  144. },
  145. //去往主题详情
  146. themeDetails(item) {
  147. this.$store.dispatch("checkHandle", "/reportPages/researchTheme/researchTheme?id=" + item.IndustrialManagementId);
  148. },
  149. },
  150. onLoad(options) {
  151. this.departmentIdDetail(options.id);
  152. },
  153. };
  154. </script>
  155. <style lang="scss" scoped>
  156. .author-container {
  157. background-color: #f5f5f5;
  158. color: #333333;
  159. padding: 30rpx;
  160. .author-box {
  161. display: flex;
  162. align-items: center;
  163. justify-content: space-between;
  164. margin-bottom: 30rpx;
  165. .author-img {
  166. display: flex;
  167. align-items: center;
  168. font-size: 34rpx;
  169. font-weight: 600;
  170. image {
  171. width: 81rpx;
  172. height: 81rpx;
  173. border-radius: 8rpx;
  174. margin-right: 30rpx;
  175. }
  176. }
  177. }
  178. .attention {
  179. flex-shrink: 0;
  180. padding: 7rpx 28rpx;
  181. border-radius: 37rpx 37rpx 37rpx 37rpx;
  182. color: #fff;
  183. background: #3385ff;
  184. font-weight: 400;
  185. font-size: 24rpx;
  186. }
  187. .cancel-attention {
  188. background-color: #d3d3d3 !important;
  189. }
  190. .author-num {
  191. padding: 25rpx 48rpx 25rpx 77rpx;
  192. margin-bottom: 20rpx;
  193. background-color: #fff;
  194. display: flex;
  195. justify-content: space-between;
  196. border-radius: 4rpx;
  197. .num-box {
  198. text-align: center;
  199. font-size: 28rpx;
  200. font-weight: 600;
  201. .text {
  202. font-size: 24rpx;
  203. font-weight: 400;
  204. color: #999999;
  205. }
  206. }
  207. }
  208. .content-item {
  209. background-color: #fff;
  210. padding: 30rpx 20rpx 0;
  211. .item-title {
  212. font-weight: 500;
  213. .item-industry {
  214. margin-left: 10rpx;
  215. color: #3385ff;
  216. display: inline-block;
  217. }
  218. }
  219. .item-more {
  220. display: flex;
  221. justify-content: space-between;
  222. color: #cecece;
  223. margin: 20rpx 0 0;
  224. padding-bottom: 30rpx;
  225. border-bottom: 1rpx solid #ececec;
  226. .pv-ollect {
  227. display: flex;
  228. align-items: center;
  229. width: 40%;
  230. justify-content: space-between;
  231. image {
  232. width: 22rpx;
  233. height: 21rpx;
  234. margin-right: 10rpx;
  235. }
  236. .pv {
  237. height: 16rpx;
  238. }
  239. }
  240. }
  241. }
  242. }
  243. </style>