authorPages.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  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.IsFllow;
  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. uni.$emit("updateFllowAuthor", { isFollw: this.isFollw, id: this.list.DepartmentId });
  110. }
  111. },
  112. //收藏
  113. async collectClick(item) {
  114. const res = await Report.collectRpt({ ArticleId: item.ArticleId });
  115. if (res.Ret === 200) {
  116. item.IsCollect = !item.IsCollect;
  117. item.IsCollect
  118. ? (item.CollectNum += 1) &&
  119. uni.showToast({
  120. title: "收藏成功",
  121. icon: "none",
  122. duration: 2000,
  123. })
  124. : (item.CollectNum -= 1);
  125. !item.IsCollect &&
  126. uni.showToast({
  127. title: "已取消收藏",
  128. icon: "none",
  129. duration: 2000,
  130. });
  131. }
  132. },
  133. //点击了去关注
  134. goFollowShowBtn() {
  135. if (this.confirmText == "去关注") {
  136. uni.navigateTo({
  137. url: "/activityPages/accountsOfficial/accountsOfficial",
  138. });
  139. }
  140. this.goFollowShow = false;
  141. },
  142. //去往文章详情页面
  143. goDetail(item) {
  144. this.$store.commit("setRouterReport", "作者详情");
  145. this.$store.dispatch("checkHandle", "/pageMy/reportDetail/reportDetail?id=" + item.ArticleId);
  146. },
  147. //去往主题详情
  148. themeDetails(item) {
  149. this.$store.dispatch("checkHandle", "/reportPages/researchTheme/researchTheme?id=" + item.IndustrialManagementId);
  150. },
  151. },
  152. onLoad(options) {
  153. this.departmentIdDetail(options.id);
  154. },
  155. };
  156. </script>
  157. <style lang="scss" scoped>
  158. .author-container {
  159. background-color: #f5f5f5;
  160. color: #333333;
  161. padding: 30rpx;
  162. .author-box {
  163. display: flex;
  164. align-items: center;
  165. justify-content: space-between;
  166. margin-bottom: 30rpx;
  167. .author-img {
  168. display: flex;
  169. align-items: center;
  170. font-size: 34rpx;
  171. font-weight: 600;
  172. image {
  173. width: 81rpx;
  174. height: 81rpx;
  175. border-radius: 8rpx;
  176. margin-right: 30rpx;
  177. }
  178. }
  179. }
  180. .attention {
  181. flex-shrink: 0;
  182. padding: 7rpx 28rpx;
  183. border-radius: 37rpx 37rpx 37rpx 37rpx;
  184. color: #fff;
  185. background: #3385ff;
  186. font-weight: 400;
  187. font-size: 24rpx;
  188. }
  189. .cancel-attention {
  190. background-color: #d3d3d3 !important;
  191. }
  192. .author-num {
  193. padding: 25rpx 48rpx 25rpx 77rpx;
  194. margin-bottom: 20rpx;
  195. background-color: #fff;
  196. display: flex;
  197. justify-content: space-between;
  198. border-radius: 4rpx;
  199. .num-box {
  200. text-align: center;
  201. font-size: 28rpx;
  202. font-weight: 600;
  203. .text {
  204. font-size: 24rpx;
  205. font-weight: 400;
  206. color: #999999;
  207. }
  208. }
  209. }
  210. .content-item {
  211. background-color: #fff;
  212. padding: 30rpx 20rpx 0;
  213. .item-title {
  214. font-weight: 500;
  215. .item-industry {
  216. margin-left: 10rpx;
  217. color: #3385ff;
  218. display: inline-block;
  219. }
  220. }
  221. .item-more {
  222. display: flex;
  223. justify-content: space-between;
  224. color: #cecece;
  225. margin: 20rpx 0 0;
  226. padding-bottom: 30rpx;
  227. border-bottom: 1rpx solid #ececec;
  228. .pv-ollect {
  229. display: flex;
  230. align-items: center;
  231. width: 40%;
  232. justify-content: space-between;
  233. image {
  234. width: 22rpx;
  235. height: 21rpx;
  236. margin-right: 10rpx;
  237. }
  238. .pv {
  239. height: 16rpx;
  240. }
  241. }
  242. }
  243. }
  244. }
  245. </style>