index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441
  1. <template>
  2. <div style="font-size: 0; background-color: #fff">
  3. <div class="content">
  4. <img
  5. :src="
  6. 'https://cxzx.smcic.net/zhoubao/assets/moblie' +
  7. $route.params.date +
  8. '.jpg'
  9. "
  10. width="100%"
  11. class="content"
  12. style="margin-bottom: 1em; display: block"
  13. alt=""
  14. />
  15. <p
  16. class="content"
  17. :style="
  18. 'text-indent: 2em; font-weight: 700; padding: 0.5em 3px;font-size: ' +
  19. fontSize +
  20. 'px;'
  21. "
  22. v-html="desc"
  23. ></p>
  24. </div>
  25. <div class="tv-list" :style="'font-size:' + fontSize + 'px'">
  26. <div class="content">
  27. <van-cell-group border title="部门排行">
  28. <div class="itemHead">
  29. <van-row>
  30. <van-col span="3" class="td"> 排名 </van-col>
  31. <van-col span="7" class="td"> 部门 </van-col>
  32. <van-col span="7" class="td"> 传播量(次) </van-col>
  33. <!-- td2 :style="width > 667 ? 'line-height: 2.5em' : 'line-height: 1.5em'" -->
  34. <van-col span="5" class="td"> 发稿量(条) </van-col>
  35. <van-col span="2" class="td">
  36. <img
  37. src="../../../assets/image/shou.gif"
  38. width="26px"
  39. alt=""
  40. style="vertical-align: middle"
  41. />
  42. </van-col>
  43. </van-row>
  44. </div>
  45. <div v-for="(v, o) in dep || []" :key="v.name">
  46. <div
  47. style="border-bottom: 1px dashed #eee; margin: 11px 0 0 0"
  48. v-if="o === 20"
  49. ></div>
  50. <van-row class="item" @click="() => showPopup(o)">
  51. <van-col
  52. span="3"
  53. :class="{ td: true }"
  54. :style="{ color: color[o] || '#000', fontWeight: 600 }"
  55. >
  56. {{ o + 1 }}
  57. </van-col>
  58. <van-col span="7" :class="{ td: true }">
  59. {{ v.name }}
  60. </van-col>
  61. <van-col span="7" :class="{ td: true }">
  62. {{ timeFormat(v.read_count) }}
  63. <van-icon
  64. v-if="v.read_change !== '相等'"
  65. name="down"
  66. :color="v.read_change === '上涨' ? '#f00' : '#0f0'"
  67. :class="{ rise: v.read_change === '上涨' }"
  68. />
  69. </van-col>
  70. <van-col span="5" :class="{ td: true }">
  71. {{ timeFormat(v.publish_count) }}
  72. <van-icon
  73. v-if="v.publish_change !== '相等'"
  74. name="down"
  75. :color="v.publish_change === '上涨' ? '#f00' : '#0f0'"
  76. :class="{ rise: v.publish_change === '上涨' }"
  77. />
  78. </van-col>
  79. <van-col span="2" class="td" style="cursor: pointer">
  80. <van-icon name="arrow" />
  81. </van-col>
  82. </van-row>
  83. </div>
  84. <van-popup
  85. :style="{ height: '100%', width: '100%' }"
  86. position="right"
  87. v-model="show"
  88. >
  89. <div class="main">
  90. <van-cell
  91. title-style="flex: 3"
  92. :title="ratios.schedulename"
  93. :label="ratios.channelname"
  94. >
  95. <div
  96. @click="show = false"
  97. style="color: #5470c6; cursor: pointer"
  98. >
  99. <van-icon name="revoke" />
  100. {{ ratios.name }}
  101. </div>
  102. </van-cell>
  103. <van-row>
  104. <van-col span="7" class="td"> 发稿量: </van-col>
  105. <van-col span="5" class="td">
  106. {{ratios.publish_count}}
  107. </van-col>
  108. <van-col span="7" class="td"> 阅读量: </van-col>
  109. <van-col span="5" class="td">
  110. {{ratios.read_count}}
  111. </van-col>
  112. </van-row>
  113. <van-cell-group border title="平台账号">
  114. <van-tabs v-model="active">
  115. <van-tab
  116. :title="index"
  117. v-for="(item, index) in ratios.detail"
  118. :key="index"
  119. >
  120. <van-cell
  121. v-for="(v, i) in item || []"
  122. :key="i + v.nick_name"
  123. title-style="flex: 3"
  124. :title="v.nick_name"
  125. :label="ratios.channelname"
  126. >
  127. <template #label>
  128. <div style="font-size: 14px; color: #000">
  129. <van-tag
  130. size="large"
  131. type="success"
  132. style="margin-right: 3px"
  133. >
  134. 发稿量:{{ timeFormat(v.publish_count) }}
  135. </van-tag>
  136. <van-tag
  137. size="large"
  138. type="danger"
  139. style="margin-right: 3px"
  140. >
  141. 阅读量:{{ timeFormat(v.read_count) }}
  142. </van-tag>
  143. <van-tag
  144. size="large"
  145. type="warning"
  146. style="margin-right: 3px"
  147. >
  148. 环比:{{ v.read_huanbi || 0 }}%
  149. </van-tag>
  150. </div>
  151. </template>
  152. </van-cell>
  153. </van-tab>
  154. </van-tabs>
  155. </van-cell-group>
  156. <van-cell-group border title="热门稿件">
  157. <van-cell
  158. v-for="(v, i) in ratios.article"
  159. :key="i"
  160. title-style="flex: 3"
  161. :title="i + 1 + '、' + v.title"
  162. >
  163. <template #label>
  164. <van-tag size="large" type="primary"
  165. >传播量:{{ timeFormat(v.play_count) }}</van-tag
  166. >
  167. {{ v.dep_name + "-" + v.nick_name }}
  168. </template>
  169. </van-cell>
  170. </van-cell-group>
  171. </div>
  172. </van-popup>
  173. </van-cell-group>
  174. <van-cell-group border title="爆款话题">
  175. <p
  176. :style="
  177. 'text-indent: 2em; font-weight: 700; padding: 0.5em 3px;font-size: ' +
  178. fontSize +
  179. 'px;'
  180. "
  181. v-html="topic_desc"
  182. ></p>
  183. <van-cell
  184. v-for="(v, i) in topic"
  185. :key="i"
  186. title-style="flex: 3"
  187. :title="i + 1 + '、' + v.topic"
  188. >
  189. <template #label>
  190. <van-tag size="large" type="primary"
  191. >传播量:{{ timeFormat(v.read_count) }}</van-tag
  192. >
  193. {{ v.dep + "-" + v.zhuchiren }}
  194. </template>
  195. </van-cell>
  196. </van-cell-group>
  197. <van-cell-group border title="热门稿件">
  198. <van-cell
  199. v-for="(v, i) in article"
  200. :key="i"
  201. title-style="flex: 3"
  202. :title="i + 1 + '、' + v.title"
  203. >
  204. <template #label>
  205. <van-tag size="large" type="primary"
  206. >传播量:{{ timeFormat(v.play_count) }}</van-tag
  207. >
  208. {{ v.dep_name + "-" + v.nick_name }}
  209. </template>
  210. </van-cell>
  211. </van-cell-group>
  212. </div>
  213. <div class="bottom content">
  214. 本数据由“陕西广电融媒体集团大数据平台”提供。
  215. <p>
  216. 技术支持 <span style="white-space: nowrap">白帆13325452244;</span
  217. ><span style="white-space: nowrap">陈科18629350958。</span>
  218. </p>
  219. </div>
  220. </div>
  221. </div>
  222. </template>
  223. <script>
  224. // @ is an alias to /src
  225. import watermark from "watermark-package";
  226. import {
  227. Col as vanCol,
  228. Row as vanRow,
  229. Icon as vanIcon,
  230. Popup as vanPopup,
  231. Cell as vanCell,
  232. Tag as vanTag,
  233. Tab as vanTab,
  234. Tabs as vanTabs,
  235. cellGroup as vanCellGroup,
  236. } from "vant";
  237. import "vant/lib/tab/style/index";
  238. import "vant/lib/tabs/style/index";
  239. import "vant/lib/tag/style/index";
  240. import "vant/lib/cell/style/index";
  241. import "vant/lib/cell-group/style/index";
  242. import "vant/lib/popup/style/index";
  243. import "vant/lib/icon/style/index";
  244. import "vant/lib/col/style/index";
  245. import "vant/lib/row/style/index";
  246. // import {} from "../utils/tool";
  247. import { jsonZhouMobile } from "../../../api/index";
  248. // import echarts from "../../../utils/echarts";
  249. export default {
  250. name: "Mobile",
  251. data() {
  252. return {
  253. active: "",
  254. fontSize: 17,
  255. show: false,
  256. charts: undefined,
  257. ratios: {},
  258. article: [],
  259. topic: [],
  260. dep: [],
  261. color: ["#ff0036", "#ff9b00", "#ffcc00"],
  262. echarts: undefined,
  263. dayEcharts: undefined,
  264. width: document.body.offsetWidth || 0,
  265. desc: "",
  266. topic_desc: "",
  267. };
  268. },
  269. watch: {},
  270. mounted() {
  271. if (
  272. this.$route.query.auto !==
  273. "06fd56cdf5a6cfc3a2139cc8514d05aa0439ee8c1fb4d81145bc9647"
  274. )
  275. return;
  276. console.log(this.$route.params.date);
  277. this.fontSize = (document.body.offsetWidth / 24).toFixed(2) - 0;
  278. if (document.body.offsetWidth > 677) this.fontSize = 22;
  279. watermark.setWaterMark({
  280. w_texts: ["陕西新媒体大数据"],
  281. w_options: {
  282. w_opacity: "0.1",
  283. },
  284. });
  285. jsonZhouMobile({
  286. date: this.$route.params.date,
  287. time: Date.now(),
  288. }).then(res => {
  289. this.article = res.article || [];
  290. this.dep = res.dep || [];
  291. this.topic = res.topic || [];
  292. this.desc = res.desc || "";
  293. this.topic_desc = res.topic_desc || "";
  294. });
  295. },
  296. computed: {},
  297. methods: {
  298. valueDate(v) {
  299. let out = "";
  300. for (let i = 0; i < v.length; i++) {
  301. const item = v[i];
  302. if (i === 4 || i === 6 || i === 13 || i === 15) out += "/";
  303. out += item;
  304. }
  305. return out;
  306. },
  307. formatNum(num, w) {
  308. if (isNaN(num)) return 0;
  309. return Number(num).toFixed(w || 4) - 0;
  310. },
  311. formatType(num) {
  312. let N = this.formatNum(num, 2);
  313. let wei = "";
  314. if (N >= 100000000) {
  315. N = (N / 100000000).toFixed(1);
  316. wei = "亿";
  317. } else if (N >= 10000) {
  318. N = (N / 10000).toFixed(0);
  319. wei = "万";
  320. }
  321. N = N.toString().split(".");
  322. return {
  323. N: (N[0] || 0) * 1,
  324. P: N[1] || 0,
  325. wei,
  326. };
  327. },
  328. timeFormat(t) {
  329. let Time = t || 0;
  330. if (Time >= 100000000) Time = (Time / 100000000).toFixed(1) - 0 + "亿";
  331. else if (Time >= 10000) Time = (Time / 10000).toFixed(0) - 0 + "万";
  332. return Time;
  333. },
  334. showPopup(i) {
  335. this.show = true;
  336. const ratios = JSON.parse(JSON.stringify(this.dep[i] || {}));
  337. let publish_count = this.timeFormat(ratios.publish_count);
  338. ratios.publish_count = publish_count;
  339. let read_count = this.timeFormat(ratios.read_count);
  340. ratios.read_count = read_count;
  341. const detail = ratios.detail || [];
  342. const new_detail = {};
  343. for (let i = 0; i < detail.length; i++) {
  344. const v = detail[i];
  345. v.read_huanbi = (v.read_huanbi * 100).toFixed(2) - 0;
  346. if (new_detail[v.platform]) new_detail[v.platform].push(v);
  347. else new_detail[v.platform] = [v];
  348. }
  349. ratios.detail = new_detail;
  350. this.ratios = ratios;
  351. this.$nextTick(() => {});
  352. },
  353. },
  354. beforeUnmount() {},
  355. components: {
  356. vanCol,
  357. vanRow,
  358. vanIcon,
  359. vanPopup,
  360. vanCell,
  361. vanTag,
  362. vanCellGroup,
  363. vanTab,
  364. vanTabs,
  365. },
  366. };
  367. </script>
  368. <style scoped>
  369. .tv-list {
  370. background-color: #fff;
  371. padding: 5px;
  372. height: 100%;
  373. overflow-y: auto;
  374. box-sizing: border-box;
  375. }
  376. .bottom {
  377. border: 4px solid #0983a8;
  378. margin-top: 1em;
  379. padding: 10px;
  380. font-size: 0.9rem;
  381. padding-left: 5px;
  382. font-weight: 600;
  383. overflow: hidden;
  384. }
  385. .td {
  386. text-align: center;
  387. line-height: 2.5em;
  388. overflow: hidden;
  389. white-space: nowrap;
  390. text-overflow: ellipsis;
  391. }
  392. .td2 {
  393. line-height: 1.5em;
  394. white-space: initial;
  395. }
  396. .item {
  397. overflow: hidden;
  398. border-radius: 3px;
  399. margin-top: 11px;
  400. background-color: #f5f6f8;
  401. }
  402. .itemHead {
  403. margin-top: 0;
  404. background-color: #f5f6f8;
  405. }
  406. .main {
  407. padding: 0.5em;
  408. }
  409. .content {
  410. margin: 0 auto;
  411. max-width: 667px;
  412. }
  413. .rise {
  414. /* 上升 */
  415. transform: rotate(180deg);
  416. }
  417. .titleTop {
  418. height: 80px;
  419. line-height: 80px;
  420. background-image: linear-gradient(to right, #014392, #008fc4, #00428c);
  421. color: #fff;
  422. text-align: center;
  423. }
  424. </style>
  425. <style>
  426. .van-cell-group__title {
  427. font-size: 1.1rem;
  428. color: #000;
  429. font-weight: 600;
  430. }
  431. .van-tab,
  432. .van-cell,
  433. .van-cell__label {
  434. font-size: 1rem;
  435. color: #000;
  436. }
  437. </style>