PageSourceSearch

https://www.stpaper.cn/child/xmodule/ClassificationCountry-e3e21ad7.js

js stpaper.cn collected 2026-10-07 22:40:28 UTC 7,481 bytes, 263 lines download raw bytes

1import { G as GetClassification } from "./index-dca3c81b.js";
2import { A as AppMixin } from "./index-a3d0ed15.js";
3import { i as init } from "./index-58dae3bc.js";
4import { o as oE } from "./index.min-bc62360e.js";
5import { n as normalizeComponent } from "./vueComponentNormalizer-9c6b8b3d.js";
6import "./vuex.esm-267d8be7.js";
7import "./vue.runtime.esm-c480512b.js";
8import "./_commonjsHelpers-7a7fcd32.js";
9var render = function() {
10  var _vm = this;
11  var _h = _vm.$createElement;
12  var _c = _vm._self._c || _h;
13  return _c("div", {
14    staticClass: "Subject__wrap"
15  }, [_vm.loading ? _c("div", {
16    staticClass: "Subject__loading"
17  }, [_c("BounceLoading")], 1) : _vm._e(), _vm._l(_vm.data, function(item, index) {
18    return _c("div", {
19      key: "item" + index,
20      staticClass: "Subject__chart"
21    }, [_c("div", {
22      staticClass: "Subject__title"
23    }, [_vm._v(" " + _vm._s(item.key) + " ")]), _c("div", {
24      ref: "chart" + index,
25      refInFor: true,
26      staticClass: "Subject__chart--wrap"
27    })]);
28  })], 2);
29};
30var staticRenderFns = [];
31const ClassificationCountry_vue_vue_type_style_index_0_scoped_true_lang = "";
32const __vue2_script = {
33  mixins: [AppMixin],
34  components: {
35    BounceLoading: oE
36  },
37  data() {
38    return {
39      data: [],
40      loading: false
41    };
42  },
43  props: {
44    module: Object
45  },
46  created() {
47    this.getData();
48  },
49  methods: {
50    getData() {
51      let year = this.module.year || 5;
52      let startYear = new Date().getFullYear() - year;
53      let endYear = new Date().getFullYear() - 1;
54      let oldStartYear = startYear - year;
55      let oldEndYear = endYear - year;
56      this.loading = true;
57      Promise.all([
58        GetClassification({
59          range: `${oldStartYear}-${oldEndYear}`,
60          topic: this.topicId,
61          extendParams: {
62            ShanghaiAcademicCollection: "country"
63          }
64        }),
65        GetClassification({
66          range: `${startYear}-${endYear}`,
67          topic: this.topicId,
68          extendParams: {
69            ShanghaiAcademicCollection: "country"
70          }
71        })
72      ]).then((e) => {
73        let oldData = e[0];
74        let newData = e[1];
75        this.data = Object.keys(newData).map((key) => {
76          let obj = newData[key];
77          obj["key"] = key;
78          obj["oldCountryList"] = oldData[key] ? oldData[key].countryList : 0;
79          obj["oldTotal"] = oldData[key] ? oldData[key].total : 0;
80          return obj;
81        });
82        this.$nextTick(() => {
83          this.data.forEach((item, index) => {
84            this.initChart(item, index);
85          });
86        });
87      }).finally(() => {
88        this.loading = false;
89      });
90    },
91    initChart(item, index) {
92      var myChart = init(this.$refs["chart" + index][0]);
93      let data0_5_key = [];
94      let data0_5_count = [];
95      let data5_10_key = [];
96      let data5_10_count = [];
97      item.countryList.filter((item2) => item2.key != "中国").slice(0, this.module.size || 10).forEach((item2) => {
98        data0_5_count.push("-" + item2.doc_count);
99        data0_5_key.push(item2.key);
100      });
101      item.oldCountryList.filter((item2) => item2.key != "中国").slice(0, this.module.size || 10).forEach((item2) => {
102        data5_10_count.push(item2.doc_count);
103        data5_10_key.push(item2.key);
104      });
105      if (data0_5_key.length > 0 || data5_10_key.length > 0) {
106        myChart.setOption({
107          color: ["#ff791a", "#2a3483"],
108          tooltip: {
109            trigger: "axis",
110            order: "seriesDesc",
111            axisPointer: {
112              type: "shadow"
113            },
114            formatter: function(params) {
115              let res = "";
116              params.forEach((v, i) => {
117                res += `<div style="display:flex;align-items:center">
118                        <span
119                            style="display:inline-block;
120                            margin-right:5px;
121                            border-radius:10px;
122                            width:10px;
123                            height:10px;
124                            background-color:${v.color}"
125                        ></span>
126                        <span>${v.seriesName}: ${Math.abs(v.value)}个</span>
127                        </div>`;
128              });
129              return res;
130            }
131          },
132          legend: {
133            top: "0%",
134            left: "center"
135          },
136          grid: {
137            left: "10%",
138            right: "10%",
139            bottom: "10%",
140            containLabel: true
141          },
142          xAxis: [
143            {
144              name: "个",
145              type: "value",
146              axisLabel: {
147                interval: 0,
148                rotate: 30,
149                formatter: (value) => {
150                  if (value < 0)
151                    return -value;
152                  else
153                    return value;
154                }
155              }
156            }
157          ],
158          yAxis: [
159            {
160              type: "category",
161              axisTick: {
162                show: false
163              },
164              label: {
165                position: "left"
166              },
167              offset: 30,
168              data: data0_5_key.reverse()
169            },
170            {
171              type: "category",
172              axisTick: {
173                show: false
174              },
175              label: {
176                position: "right"
177              },
178              offset: 30,
179              data: data5_10_key.reverse()
180            }
181          ],
182          series: [
183            {
184              name: "过去五年",
185              type: "bar",
186              stack: "Total",
187              label: {
188                normal: {
189                  //正常情况
190                  show: true,
191                  //是否显示标签
192                  position: "left",
193                  formatter: function(params) {
194                    return Math.abs(params.value);
195                  }
196                  //返回绝对值
197                }
198              },
199              emphasis: {
200                focus: "series"
201              },
202              data: data0_5_count.reverse()
203            },
204            {
205              name: "近五年",
206              type: "bar",
207              stack: "Total",
208              label: {
209                normal: {
210                  //正常情况
211                  show: true,
212                  //是否显示标签
213                  position: "right"
214                }
215              },
216              emphasis: {
217                focus: "series"
218              },
219              data: data5_10_count.reverse()
220            }
221          ]
222        });
223        window.addEventListener("resize", function() {
224          myChart.resize();
225        });
226      } else {
227        myChart.setOption({
228          title: {
229            text: "暂无数据",
230            x: "center",
231            y: "center",
232            textStyle: {
233              fontFamily: "Manteka",
234              fontSize: "12"
235            }
236          }
237        });
238      }
239    }
240  }
241};
242const __cssModules = {};
243var __component__ = /* @__PURE__ */ normalizeComponent(
244  __vue2_script,
245  render,
246  staticRenderFns,
247  false,
248  __vue2_injectStyles,
249  "31fee422",
250  null,
251  null
252);
253function __vue2_injectStyles(context) {
254  for (let o in __cssModules) {
255    this[o] = __cssModules[o];
256  }
257}
258const ClassificationCountry = /* @__PURE__ */ function() {
259  return __component__.exports;
260}();
261export {
262  ClassificationCountry as default
263};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.