authorPages.vue 7.6 KB

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