authorPages.vue 7.9 KB

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