getList.js 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. import {
  2. getBase,
  3. getPlatform,
  4. getList,
  5. getAllPlatform,
  6. // getCould,
  7. } from "@/api/getList";
  8. export default {
  9. data() {
  10. return {
  11. timeout: undefined,
  12. isdou: false,
  13. iskuai: false,
  14. could: "",
  15. };
  16. },
  17. methods: {
  18. select() {
  19. let season = sessionStorage.getItem("season");
  20. let title = this.$route.query.title;
  21. getBase({
  22. topic_name: title,
  23. season,
  24. }).then(x => {
  25. x = x || {};
  26. this.allList = {
  27. read: x.total_pv || 0,
  28. talk: x.total_comment || 0,
  29. keyWord: title,
  30. totalLikes: x.total_digg || 0,
  31. totalForward: x.total_forward || 0,
  32. totalOri: x.total_ori || 0,
  33. live_comment: x.live_comment,
  34. live_digg: x.live_digg,
  35. live_uv: x.live_uv,
  36. };
  37. this.isdou = x.has_live_douyin_data;
  38. this.iskuai = x.has_live_kuaishou_data;
  39. this.could = x.word_cloud_url || ""
  40. });
  41. getAllPlatform({
  42. topic_name: title,
  43. season
  44. }).then(x => {
  45. const list = [];
  46. this.platformList.map(className => {
  47. let keyValue = "total_forward";
  48. className === "浏览" && (keyValue = "total_pv");
  49. className === "点赞" && (keyValue = "total_digg");
  50. className === "评论" && (keyValue = "total_comment");
  51. if (className === "浏览") {
  52. (x || []).map(v => {
  53. list.push({
  54. name: className,
  55. nickname: v.platform,
  56. value: v[keyValue],
  57. });
  58. });
  59. }
  60. });
  61. this.platformSort = list;
  62. });
  63. getPlatform({
  64. topic_name: title,
  65. platform: "ALL",
  66. season,
  67. }).then(x => {
  68. this.userSortAll = x || [];
  69. this.clickBtn(this.selectIndex);
  70. });
  71. getPlatform({
  72. topic_name: title,
  73. platform: "douyin",
  74. season,
  75. }).then(x => {
  76. this.douAllList = (x || []).map(v => {
  77. // v.nickname = v.nickname.replace(/(?=(\B)(\S{2})+$)/g, "\n");
  78. // v.nickname = v.nickname.replace(/^\n/g, "");
  79. const li = v.nickname.split("");
  80. v.nickname = li
  81. .map((nameString, i) => {
  82. i !== 0 && (i + 1) % 2 === 0 && (nameString = nameString + "\n");
  83. return nameString;
  84. })
  85. .join("");
  86. return v;
  87. });
  88. });
  89. getPlatform({
  90. topic_name: title,
  91. platform: "kuaishou",
  92. season
  93. }).then(x => {
  94. this.kuaiAllList = (x || []).map(v => {
  95. // v.nickname = v.nickname.replace(/(?=(\B)(\S{2})+$)/g, "\n");
  96. // v.nickname = v.nickname.replace(/^\n/g, "");
  97. const li = v.nickname.split("");
  98. v.nickname = li
  99. .map((nameString, i) => {
  100. i !== 0 && (i + 1) % 2 === 0 && (nameString = nameString + "\n");
  101. return nameString;
  102. })
  103. .join("");
  104. return v;
  105. });
  106. });
  107. getPlatform({
  108. topic_name: title,
  109. platform: "yangshi",
  110. season
  111. }).then(x => {
  112. this.yangAllList = (x || []).map(v => {
  113. // v.nickname = v.nickname.replace(/(?=(\B)(\S{2})+$)/g, "\n");
  114. // v.nickname = v.nickname.replace(/^\n/g, "");
  115. const li = v.nickname.split("");
  116. v.nickname = li
  117. .map((nameString, i) => {
  118. i !== 0 && (i + 1) % 2 === 0 && (nameString = nameString + "\n");
  119. return nameString;
  120. })
  121. .join("");
  122. return v;
  123. });
  124. });
  125. // let Filename = this.$utils.getUrl("id");
  126. // getCould({}, this.$store.state.p[Filename]).then(res => {
  127. // let ori = res || [];
  128. // let listOri = [];
  129. // ori.map(v => {
  130. // listOri.push({
  131. // x: v.name,
  132. // value: v.value - 0,
  133. // });
  134. // });
  135. // this.listOri = listOri;
  136. // });
  137. this.getAllWeibo();
  138. },
  139. selectRead(dateT) {
  140. let season = sessionStorage.getItem("season");
  141. getList({
  142. topic_name: this.$route.query.title,
  143. time: dateT.type,
  144. season
  145. }).then(res => {
  146. this.read = (res.read || []).map(v => {
  147. return {
  148. date: v.time,
  149. type: "微博-阅读量趋势",
  150. value: v.value,
  151. };
  152. });
  153. this.readType = dateT.type;
  154. });
  155. },
  156. selectMe(dateT) {
  157. let season = sessionStorage.getItem("season");
  158. getList({
  159. topic_name: this.$route.query.title,
  160. time: dateT.type,
  161. season
  162. }).then(res => {
  163. this.me = (res.me || []).map(v => {
  164. return {
  165. date: v.time,
  166. type: "微博-讨论趋势",
  167. value: v.value,
  168. };
  169. });
  170. this.meType = dateT.type;
  171. });
  172. },
  173. selectOri(dateT) {
  174. let season = sessionStorage.getItem("season");
  175. getList({
  176. topic_name: this.$route.query.title,
  177. time: dateT.type,
  178. season
  179. }).then(res => {
  180. this.ori = (res.ori || []).map(v => {
  181. return {
  182. date: v.time,
  183. type: "微博-原创趋势",
  184. value: v.value,
  185. };
  186. });
  187. this.oriType = dateT.type;
  188. });
  189. },
  190. getAllWeibo() {
  191. let season = sessionStorage.getItem("season");
  192. getList({
  193. topic_name: this.$route.query.title,
  194. time: "30d",
  195. season
  196. })
  197. .then(res => {
  198. this.read = (res.read || []).map(v => {
  199. return {
  200. date: v.time,
  201. type: "微博-阅读量趋势",
  202. value: v.value,
  203. };
  204. });
  205. this.ori = (res.ori || []).map(v => {
  206. return {
  207. date: v.time,
  208. type: "微博-原创趋势",
  209. value: v.value,
  210. };
  211. });
  212. this.me = (res.me || []).map(v => {
  213. return {
  214. date: v.time,
  215. type: "微博-讨论趋势",
  216. value: v.value,
  217. };
  218. });
  219. })
  220. .catch(() => {
  221. // window.clearInterval(this.timeout)
  222. });
  223. },
  224. },
  225. created() {},
  226. mounted() {},
  227. };