1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513 |
- <template>
- <div class="manage-root organize-manage">
- <Header />
- <div class="manage-root-contain">
- <nav-menu
- class="manage-root-contain-left"
- :activeMenuIndex="activeMenuIndex"
- ></nav-menu>
- <div class="manage-root-contain-right personnel-manage-right">
- <div class="top">
- <span>数据中心</span>
- <b>{{ queryTime }}</b>
- </div>
- <div class="day-stat-data" v-if="curDayStatData">
- <div class="day-item" v-if="curDayStatData.person_count">
- <div class="day-item-left">
- <p>用户总数</p>
- <span
- >{{ curDayStatData.person_count.total_count | formatNumber
- }}<b>人</b></span
- >
- </div>
- <div class="day-item-center">
- <p>较上周</p>
- <span
- :class="[
- curDayStatData.person_count.add_count_pre_week > 0
- ? 'add'
- : curDayStatData.person_count.add_count_pre_week === 0
- ? 'flat'
- : 'down',
- ]"
- >
- <img
- :src="
- curDayStatData.person_count.add_count_pre_week > 0
- ? require('../../assets/caret-up.png')
- : curDayStatData.person_count.add_count_pre_week === 0
- ? require('../../assets/caret-flat.png')
- : require('../../assets/caret-down.png')
- "
- />
- <a>{{ curDayStatData.person_count.add_count_pre_week }}</a>
- </span>
- </div>
- <div class="day-item-right">
- <p>较上月</p>
- <span
- :class="[
- curDayStatData.person_count.add_count_pre_week > 0
- ? 'add'
- : curDayStatData.person_count.add_count_pre_week === 0
- ? 'flat'
- : 'down',
- ]"
- >
- <img
- :src="
- curDayStatData.person_count.add_count_pre_month > 0
- ? require('../../assets/caret-up.png')
- : curDayStatData.person_count.add_count_pre_month === 0
- ? require('../../assets/caret-flat.png')
- : require('../../assets/caret-down.png')
- "
- />
- <a>{{ curDayStatData.person_count.add_count_pre_month }}</a>
- </span>
- </div>
- </div>
- <div class="day-item" v-if="curDayStatData.org_count">
- <div class="day-item-left">
- <p>机构总数</p>
- <span
- >{{ curDayStatData.org_count.total_count | formatNumber
- }}<b>个</b></span
- >
- </div>
- <div class="day-item-center">
- <p>较上周</p>
- <span
- :class="[
- curDayStatData.org_count.add_count_pre_week > 0
- ? 'add'
- : curDayStatData.org_count.add_count_pre_week === 0
- ? 'flat'
- : 'down',
- ]"
- >
- <img
- :src="
- curDayStatData.org_count.add_count_pre_week > 0
- ? require('../../assets/caret-up.png')
- : curDayStatData.org_count.add_count_pre_week === 0
- ? require('../../assets/caret-flat.png')
- : require('../../assets/caret-down.png')
- "
- />
- <a>{{ curDayStatData.org_count.add_count_pre_week }}</a>
- </span>
- </div>
- <div class="day-item-right">
- <p>较上月</p>
- <span
- :class="[
- curDayStatData.org_count.add_count_pre_week > 0
- ? 'add'
- : curDayStatData.org_count.add_count_pre_week === 0
- ? 'flat'
- : 'down',
- ]"
- >
- <img
- :src="
- curDayStatData.org_count.add_count_pre_month > 0
- ? require('../../assets/caret-up.png')
- : curDayStatData.org_count.add_count_pre_month === 0
- ? require('../../assets/caret-flat.png')
- : require('../../assets/caret-down.png')
- "
- />
- <a>{{ curDayStatData.org_count.add_count_pre_month }}</a>
- </span>
- </div>
- </div>
- <div class="day-item" v-if="curDayStatData.course_play_person_count">
- <div class="day-item-left">
- <p>累计上课人数</p>
- <span
- >{{
- curDayStatData.course_play_person_count.total_count
- | formatNumber
- }}<b>人</b></span
- >
- </div>
- <div class="day-item-center">
- <p>较上周</p>
- <span
- :class="[
- curDayStatData.course_play_person_count.add_count_pre_week > 0
- ? 'add'
- : curDayStatData.course_play_person_count
- .add_count_pre_week === 0
- ? 'flat'
- : 'down',
- ]"
- >
- <img
- :src="
- curDayStatData.course_play_person_count.add_count_pre_week >
- 0
- ? require('../../assets/caret-up.png')
- : curDayStatData.course_play_person_count
- .add_count_pre_week === 0
- ? require('../../assets/caret-flat.png')
- : require('../../assets/caret-down.png')
- "
- />
- <a>{{
- curDayStatData.course_play_person_count.add_count_pre_week
- }}</a>
- </span>
- </div>
- <div class="day-item-right">
- <p>较上月</p>
- <span
- :class="[
- curDayStatData.course_play_person_count.add_count_pre_week > 0
- ? 'add'
- : curDayStatData.course_play_person_count
- .add_count_pre_week === 0
- ? 'flat'
- : 'down',
- ]"
- >
- <img
- :src="
- curDayStatData.course_play_person_count
- .add_count_pre_month > 0
- ? require('../../assets/caret-up.png')
- : curDayStatData.course_play_person_count
- .add_count_pre_month === 0
- ? require('../../assets/caret-flat.png')
- : require('../../assets/caret-down.png')
- "
- />
- <a>{{
- curDayStatData.course_play_person_count.add_count_pre_month
- }}</a>
- </span>
- </div>
- </div>
- <div class="day-item" v-if="curDayStatData.course_play_count">
- <div class="day-item-left">
- <p>累计上课人次</p>
- <span
- >{{ curDayStatData.course_play_count.total_count | formatNumber
- }}<b>人次</b></span
- >
- </div>
- <div class="day-item-center">
- <p>较上周</p>
- <span
- :class="[
- curDayStatData.course_play_count.add_count_pre_week > 0
- ? 'add'
- : curDayStatData.course_play_count.add_count_pre_week === 0
- ? 'flat'
- : 'down',
- ]"
- >
- <img
- :src="
- curDayStatData.course_play_count.add_count_pre_week > 0
- ? require('../../assets/caret-up.png')
- : curDayStatData.course_play_count.add_count_pre_week ===
- 0
- ? require('../../assets/caret-flat.png')
- : require('../../assets/caret-down.png')
- "
- />
- <a>{{ curDayStatData.course_play_count.add_count_pre_week }}</a>
- </span>
- </div>
- <div class="day-item-right">
- <p>较上月</p>
- <span
- :class="[
- curDayStatData.course_play_count.add_count_pre_week > 0
- ? 'add'
- : curDayStatData.course_play_count.add_count_pre_week === 0
- ? 'flat'
- : 'down',
- ]"
- >
- <img
- :src="
- curDayStatData.course_play_count.add_count_pre_month > 0
- ? require('../../assets/caret-up.png')
- : curDayStatData.course_play_count.add_count_pre_month ===
- 0
- ? require('../../assets/caret-flat.png')
- : require('../../assets/caret-down.png')
- "
- />
- <a>{{
- curDayStatData.course_play_count.add_count_pre_month
- }}</a>
- </span>
- </div>
- </div>
- <div class="day-item" v-if="curDayStatData.article_reading_duration">
- <div class="day-item-left">
- <p>平台总阅读时长</p>
- <span
- >{{
- Math.ceil(
- curDayStatData.article_reading_duration.total_duration /
- 3600
- ) | formatNumber
- }}<b>时</b></span
- >
- </div>
- <div class="day-item-center">
- <p>较上周</p>
- <span
- :class="[
- curDayStatData.article_reading_duration
- .add_duration_pre_week > 0
- ? 'add'
- : curDayStatData.article_reading_duration
- .add_duration_pre_week === 0
- ? 'flat'
- : 'down',
- ]"
- >
- <img
- :src="
- curDayStatData.article_reading_duration
- .add_duration_pre_week > 0
- ? require('../../assets/caret-up.png')
- : curDayStatData.article_reading_duration
- .add_duration_pre_week === 0
- ? require('../../assets/caret-flat.png')
- : require('../../assets/caret-down.png')
- "
- />
- <a>{{
- curDayStatData.article_reading_duration.add_duration_pre_week
- }}</a>
- </span>
- </div>
- <div class="day-item-right">
- <p>较上月</p>
- <span
- :class="[
- curDayStatData.article_reading_duration
- .add_duration_pre_month > 0
- ? 'add'
- : curDayStatData.article_reading_duration
- .add_duration_pre_month === 0
- ? 'flat'
- : 'down',
- ]"
- >
- <img
- :src="
- curDayStatData.article_reading_duration
- .add_duration_pre_month > 0
- ? require('../../assets/caret-up.png')
- : curDayStatData.article_reading_duration
- .add_duration_pre_month === 0
- ? require('../../assets/caret-flat.png')
- : require('../../assets/caret-down.png')
- "
- />
- <a>{{
- curDayStatData.article_reading_duration.add_duration_pre_month
- }}</a>
- </span>
- </div>
- </div>
- <div
- class="day-item"
- v-if="curDayStatData.article_reading_word_count"
- >
- <div class="day-item-left">
- <p>平台总阅读词数</p>
- <span
- >{{
- curDayStatData.article_reading_word_count.total_count
- | formatNumber
- }}<b>词</b></span
- >
- </div>
- <div class="day-item-center">
- <p>较上周</p>
- <span
- :class="[
- curDayStatData.article_reading_word_count.add_count_pre_week >
- 0
- ? 'add'
- : curDayStatData.article_reading_word_count
- .add_count_pre_week === 0
- ? 'flat'
- : 'down',
- ]"
- >
- <img
- :src="
- curDayStatData.article_reading_word_count
- .add_count_pre_week > 0
- ? require('../../assets/caret-up.png')
- : curDayStatData.article_reading_word_count
- .add_count_pre_week === 0
- ? require('../../assets/caret-flat.png')
- : require('../../assets/caret-down.png')
- "
- />
- <a>{{
- curDayStatData.article_reading_word_count.add_count_pre_week
- }}</a>
- </span>
- </div>
- <div class="day-item-right">
- <p>较上月</p>
- <span
- :class="[
- curDayStatData.article_reading_word_count.add_count_pre_week >
- 0
- ? 'add'
- : curDayStatData.article_reading_word_count
- .add_count_pre_week === 0
- ? 'flat'
- : 'down',
- ]"
- >
- <img
- :src="
- curDayStatData.article_reading_word_count
- .add_count_pre_month > 0
- ? require('../../assets/caret-up.png')
- : curDayStatData.article_reading_word_count
- .add_count_pre_month === 0
- ? require('../../assets/caret-flat.png')
- : require('../../assets/caret-down.png')
- "
- />
- <a>{{
- curDayStatData.article_reading_word_count.add_count_pre_month
- }}</a>
- </span>
- </div>
- </div>
- </div>
- <div class="echart-box">
- <div class="echart-require">
- <el-cascader
- size="medium"
- :props="props"
- collapse-tags
- clearable
- :options="$provinceCityList"
- v-model="selectedOptions"
- class="cascader-option"
- >
- </el-cascader>
- <el-date-picker
- v-model="dataValue"
- type="daterange"
- align="right"
- unlink-panels
- range-separator="-"
- start-placeholder="开始日期"
- end-placeholder="结束日期"
- :picker-options="pickerOptions"
- value-format="yyyy-MM-dd"
- >
- </el-date-picker>
- <el-button type="primary" size="small" @click="searchStatDaily"
- >查询</el-button
- >
- </div>
- <div class="echart-item-box">
- <div class="echart-item" id="echart1"></div>
- <div class="echart-item" id="echart2"></div>
- <div class="echart-item" id="echart3"></div>
- <div class="echart-item" id="echart4"></div>
- <div class="echart-item" id="echart5"></div>
- <div class="echart-item" id="echart6"></div>
- </div>
- <div class="read-info" v-if="readInfo">
- <!-- <span>文章数:{{ readInfo.article_count }}篇</span> -->
- <el-button
- type="primary"
- size="small"
- @click="handleExport"
- :loading="exportLoading"
- >导出阅读数据</el-button
- >
- </div>
- <el-table
- :data="articleList"
- v-loading="tableLoading"
- stripe
- @sort-change="handleSort"
- :default-sort="dataSort"
- >
- <el-table-column
- type="index"
- label="#"
- width="60"
- :index="(pageNumber - 1) * pageSize + 1"
- >
- </el-table-column>
- <el-table-column
- prop="person_name"
- sortable="custom"
- label="人员姓名"
- width="100"
- >
- </el-table-column>
- <el-table-column
- prop="article_title"
- sortable="custom"
- label="文章"
- >
- </el-table-column>
- <el-table-column
- prop="goods_type"
- sortable="custom"
- width="100"
- label="类型"
- >
- <template slot-scope="scope">
- <span
- class="items-type"
- :style="{
- background: goodsTypeListCss[scope.row.goods_type]
- ? goodsTypeListCss[scope.row.goods_type].bg
- : '',
- color: goodsTypeListCss[scope.row.goods_type]
- ? goodsTypeListCss[scope.row.goods_type].color
- : '',
- }"
- >{{ goodsTypeListCss[scope.row.goods_type].text }}</span
- >
- </template>
- </el-table-column>
- <el-table-column
- prop="study_phase_name"
- sortable="custom"
- label="学段"
- width="81"
- >
- </el-table-column>
- <el-table-column
- prop="issue_no_name"
- sortable="custom"
- label="来源"
- width="197"
- >
- </el-table-column>
- <el-table-column prop="words" label="词数/长度" width="140">
- <template slot-scope="scope">
- {{
- scope.row.article_diff_word_count +
- "/" +
- scope.row.article_word_count
- }}
- </template>
- </el-table-column>
- <el-table-column
- prop="duration"
- sortable="custom"
- label="阅读时长"
- width="140"
- >
- <template slot-scope="scope">
- {{ formatterDuration(scope.row) }}
- </template>
- </el-table-column>
- <el-table-column
- prop="reading_time"
- sortable="custom"
- label="阅读时间"
- width="160"
- >
- <template slot-scope="scope">
- {{
- scope.row.reading_time
- ? scope.row.reading_time.substring(0, 16)
- : "-"
- }}
- </template>
- </el-table-column>
- </el-table>
- <el-pagination
- background
- @size-change="
- (val) => handleSizeChange(val, 'pageSize', 'pageNumber')
- "
- @current-change="(val) => handleCurrentChange(val, 'pageNumber')"
- :current-page="pageNumber"
- :page-sizes="[10, 20, 30, 40, 50]"
- :page-size="pageSize"
- layout="total, prev, pager, next, sizes, jumper"
- :total="total_count_a"
- >
- </el-pagination>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- //这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
- //例如:import 《组件名称》from ‘《组件路径》';
- import Header from "../../components/Header.vue";
- import NavMenu from "../../components/NavMenu.vue";
- import { getLogin } from "@/api/ajax";
- import { formatNumber } from "@/utils/defined";
- import { mapState } from "vuex";
- import * as echarts from "echarts";
- import { formatSeconds } from "@/utils/index";
- export default {
- //import引入的组件需要注入到对象中才能使用
- components: { Header, NavMenu },
- props: {},
- filters: {
- formatNumber,
- },
- data() {
- //这里存放数据
- return {
- activeMenuIndex: "data_center",
- tableHeight: "", // 表格高度
- tableLoading: false,
- queryTime: this.getCurrentDateTime(),
- curDayStatData: null, // 当日统计数据
- selectedOptions: [],
- dataValue: [
- new Date(new Date().getTime() - 3600 * 1000 * 24 * 7)
- .toISOString()
- .split("T")[0],
- new Date(new Date()).toISOString().split("T")[0],
- ],
- pickerOptions: {
- shortcuts: [
- {
- text: "最近一周",
- onClick(picker) {
- const end = new Date();
- const start = new Date();
- start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
- picker.$emit("pick", [start, end]);
- },
- },
- {
- text: "最近一个月",
- onClick(picker) {
- const end = new Date();
- const start = new Date();
- start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
- picker.$emit("pick", [start, end]);
- },
- },
- {
- text: "最近三个月",
- onClick(picker) {
- const end = new Date();
- const start = new Date();
- start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
- picker.$emit("pick", [start, end]);
- },
- },
- ],
- },
- props: { multiple: true },
- pageSize: 10,
- pageNumber: 1,
- articleList: [],
- tableLoading: false,
- total_count_a: 0,
- readInfo: null,
- dataSort: {},
- goodsTypeListCss: {
- 2: {
- text: "报纸",
- color: "#165DFF",
- bg: "#E8F7FF",
- },
- 21: {
- text: "文章",
- color: "#165DFF",
- bg: "#E8F7FF",
- },
- 3: {
- text: "精读",
- color: "#0FC6C2",
- bg: "#E8FFFB",
- },
- 0: {
- text: "课程",
- color: "#722ED1",
- bg: "#F5E8FF",
- },
- 1: {
- text: "课程",
- color: "#722ED1",
- bg: "#F5E8FF",
- },
- 10: {
- text: "课程",
- color: "#722ED1",
- bg: "#F5E8FF",
- },
- // '5':{
- // text:'报纸专辑',
- // color:'#165DFF',
- // bg:'#E8F7FF'
- // },
- 4: {
- text: "画刊",
- color: "#F53F3F",
- bg: "#FFECE8",
- },
- },
- exportLoading: false,
- };
- },
- //计算属性 类似于data概念
- computed: {
- ...mapState(["$provinceCityList"]),
- },
- //监控data中数据变化
- watch: {},
- //方法集合
- methods: {
- //计算table高度(动态设置table高度)
- getTableHeight() {
- let tableH = 420; //距离页面下方的高度
- let tableHeightDetil = window.innerHeight - tableH;
- if (tableHeightDetil <= 300) {
- this.tableHeight = 300;
- } else {
- this.tableHeight = window.innerHeight - tableH;
- }
- },
- // 获取数据
- getData() {
- // 得到当日统计数据
- let MethodName1 = "/ShopServer/Manager/DataStat/GetCurDayStatData";
- getLogin(MethodName1, {}).then((res) => {
- if (res.status === 1) {
- this.curDayStatData = res;
- }
- });
- // 统计用户区域分布(购买物品的用户)
- let MethodName2 =
- "/ShopServer/Manager/DataStat/StatUserAreaDistribution_BuyGoods";
- getLogin(MethodName2, {
- goods_type: -1,
- }).then((res) => {});
- },
- // 获取时间
- getCurrentDateTime() {
- const now = new Date();
- const year = now.getFullYear();
- const month = this.padNumber(now.getMonth() + 1); // 月份是从0开始的
- const day = this.padNumber(now.getDate());
- const hours = this.padNumber(now.getHours());
- const minutes = this.padNumber(now.getMinutes());
- return `${year}-${month}-${day} ${hours}:${minutes}`;
- },
- padNumber(num) {
- return num < 10 ? "0" + num : num;
- },
- // 折线图数据
- searchStatDaily() {
- // 统计每日人员数量
- let MethodName3 = "/ShopServer/Manager/DataStat/StatDailyPersonCount";
- let province_id_list = [];
- let city_id_list = [];
- this.selectedOptions.forEach((item) => {
- if (province_id_list.indexOf(item[0]) === -1) {
- province_id_list.push(item[0]);
- }
- city_id_list.push(item[1] ? item[1] : "");
- });
- let data1 = {
- province_id_list: province_id_list,
- city_id_list: city_id_list,
- begin_date:
- this.dataValue && this.dataValue[0] ? this.dataValue[0] : "",
- end_date: this.dataValue && this.dataValue[1] ? this.dataValue[1] : "",
- };
- getLogin(MethodName3, data1).then((res) => {
- let xAxisData = [];
- let yAxisData = [];
- if (res.status === 1) {
- res.date_list.forEach((item) => {
- xAxisData.push(item.date);
- yAxisData.push(item.count);
- });
- }
- const chartDom = document.getElementById("echart1");
- const myChart = echarts.init(chartDom);
- let option = {
- title: {
- text: "用户总数",
- },
- tooltip: {
- trigger: "axis",
- },
- grid: {
- left: "3%",
- right: "4%",
- bottom: "3%",
- containLabel: true,
- },
- xAxis: {
- type: "category",
- boundaryGap: false,
- data: xAxisData,
- splitLine: {
- // 设置 y 轴分割线为虚线
- show: true,
- lineStyle: {
- type: "line",
- },
- },
- },
- yAxis: {
- type: "value",
- splitLine: {
- // 设置 y 轴分割线为虚线
- show: true,
- lineStyle: {
- type: "dashed",
- },
- },
- },
- series: [
- {
- type: "line",
- data: yAxisData,
- lineStyle: {
- color: "#4080FF", // 这里设置为红色
- width: 2, // 线条宽度
- },
- smooth: true, // 可选,是否平滑曲线
- areaStyle: {
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
- {
- offset: 0,
- color: "rgba(128, 166, 255, 1)", // 渐变颜色,可以设置多个不同的颜色
- },
- {
- offset: 1,
- color: "rgba(128, 166, 255, 0)", // 渐变颜色
- },
- ]),
- },
- },
- ],
- };
- option && myChart.setOption(option);
- });
- // 统计每日机构数量
- let MethodName4 = "/ShopServer/Manager/DataStat/StatDailyOrgCount";
- getLogin(MethodName4, data1).then((res) => {
- let xAxisData = [];
- let yAxisData = [];
- if (res.status === 1) {
- res.date_list.forEach((item) => {
- xAxisData.push(item.date);
- yAxisData.push(item.count);
- });
- }
- const chartDom = document.getElementById("echart2");
- const myChart = echarts.init(chartDom);
- let option = {
- title: {
- text: "机构总数",
- },
- tooltip: {
- trigger: "axis",
- },
- grid: {
- left: "3%",
- right: "4%",
- bottom: "3%",
- containLabel: true,
- },
- xAxis: {
- type: "category",
- boundaryGap: false,
- data: xAxisData,
- splitLine: {
- // 设置 y 轴分割线为虚线
- show: true,
- lineStyle: {
- type: "line",
- },
- },
- },
- yAxis: {
- type: "value",
- splitLine: {
- // 设置 y 轴分割线为虚线
- show: true,
- lineStyle: {
- type: "dashed",
- },
- },
- },
- series: [
- {
- type: "line",
- data: yAxisData,
- lineStyle: {
- color: "#00B2FF", // 这里设置为红色
- width: 2, // 线条宽度
- },
- smooth: true, // 可选,是否平滑曲线
- areaStyle: {
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
- {
- offset: 0,
- color: "rgba(3, 186, 226, 1)", // 渐变颜色,可以设置多个不同的颜色
- },
- {
- offset: 1,
- color: "rgba(3, 159, 226, 0)", // 渐变颜色
- },
- ]),
- },
- },
- ],
- };
- option && myChart.setOption(option);
- });
- // 统计每日累计上课人数
- let MethodName5 =
- "/ShopServer/Manager/DataStat/StatDailyAccCoursePlayPersonCount";
- getLogin(MethodName5, data1).then((res) => {
- let xAxisData = [];
- let yAxisData = [];
- if (res.status === 1) {
- res.date_list.forEach((item) => {
- xAxisData.push(item.date);
- yAxisData.push(item.count);
- });
- }
- const chartDom = document.getElementById("echart3");
- const myChart = echarts.init(chartDom);
- let option = {
- title: {
- text: "累计上课人数",
- },
- tooltip: {
- trigger: "axis",
- },
- grid: {
- left: "3%",
- right: "4%",
- bottom: "3%",
- containLabel: true,
- },
- xAxis: {
- type: "category",
- boundaryGap: false,
- data: xAxisData,
- splitLine: {
- // 设置 y 轴分割线为虚线
- show: true,
- lineStyle: {
- type: "line",
- },
- },
- },
- yAxis: {
- type: "value",
- splitLine: {
- // 设置 y 轴分割线为虚线
- show: true,
- lineStyle: {
- type: "dashed",
- },
- },
- },
- series: [
- {
- type: "line",
- data: yAxisData,
- lineStyle: {
- color: "#4080FF", // 这里设置为红色
- width: 2, // 线条宽度
- },
- smooth: true, // 可选,是否平滑曲线
- areaStyle: {
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
- {
- offset: 0,
- color: "rgba(128, 166, 255, 1)", // 渐变颜色,可以设置多个不同的颜色
- },
- {
- offset: 1,
- color: "rgba(128, 166, 255, 0)", // 渐变颜色
- },
- ]),
- },
- },
- ],
- };
- option && myChart.setOption(option);
- });
- // 统计每日累计阅读时长
- let MethodName6 =
- "/ShopServer/Manager/DataStat/StatDailyAccArticleReadingDuration";
- getLogin(MethodName6, data1).then((res) => {
- let xAxisData = [];
- let yAxisData = [];
- if (res.status === 1) {
- res.date_list.forEach((item) => {
- xAxisData.push(item.date);
- yAxisData.push(item.duration);
- });
- }
- const chartDom = document.getElementById("echart5");
- const myChart = echarts.init(chartDom);
- let option = {
- title: {
- text: "平台总阅读时长",
- },
- tooltip: {
- trigger: "axis",
- },
- grid: {
- left: "3%",
- right: "4%",
- bottom: "3%",
- containLabel: true,
- },
- xAxis: {
- type: "category",
- boundaryGap: false,
- data: xAxisData,
- splitLine: {
- // 设置 y 轴分割线为虚线
- show: true,
- lineStyle: {
- type: "line",
- },
- },
- },
- yAxis: {
- type: "value",
- splitLine: {
- // 设置 y 轴分割线为虚线
- show: true,
- lineStyle: {
- type: "dashed",
- },
- },
- },
- series: [
- {
- type: "line",
- data: yAxisData,
- lineStyle: {
- color: "#4080FF", // 这里设置为红色
- width: 2, // 线条宽度
- },
- smooth: true, // 可选,是否平滑曲线
- areaStyle: {
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
- {
- offset: 0,
- color: "rgba(128, 166, 255, 1)", // 渐变颜色,可以设置多个不同的颜色
- },
- {
- offset: 1,
- color: "rgba(128, 166, 255, 0)", // 渐变颜色
- },
- ]),
- },
- },
- ],
- };
- option && myChart.setOption(option);
- });
- // 统计每日累计阅读词数
- let MethodName7 =
- "/ShopServer/Manager/DataStat/StatDailyAccArticleReadingWordCount";
- getLogin(MethodName7, data1).then((res) => {
- let xAxisData = [];
- let yAxisData = [];
- if (res.status === 1) {
- res.date_list.forEach((item) => {
- xAxisData.push(item.date);
- yAxisData.push(item.count);
- });
- }
- const chartDom = document.getElementById("echart6");
- const myChart = echarts.init(chartDom);
- let option = {
- title: {
- text: "平台总阅读词数",
- },
- tooltip: {
- trigger: "axis",
- },
- grid: {
- left: "3%",
- right: "4%",
- bottom: "3%",
- containLabel: true,
- },
- xAxis: {
- type: "category",
- boundaryGap: false,
- data: xAxisData,
- splitLine: {
- // 设置 y 轴分割线为虚线
- show: true,
- lineStyle: {
- type: "line",
- },
- },
- },
- yAxis: {
- type: "value",
- splitLine: {
- // 设置 y 轴分割线为虚线
- show: true,
- lineStyle: {
- type: "dashed",
- },
- },
- },
- series: [
- {
- type: "line",
- data: yAxisData,
- lineStyle: {
- color: "#00B2FF", // 这里设置为红色
- width: 2, // 线条宽度
- },
- smooth: true, // 可选,是否平滑曲线
- areaStyle: {
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
- {
- offset: 0,
- color: "rgba(3, 186, 226, 1)", // 渐变颜色,可以设置多个不同的颜色
- },
- {
- offset: 1,
- color: "rgba(3, 159, 226, 0)", // 渐变颜色
- },
- ]),
- },
- },
- ],
- };
- option && myChart.setOption(option);
- });
- // 统计每日累计上课人次
- let MethodName8 =
- "/ShopServer/Manager/DataStat/StatDailyAccCoursePlayCount";
- getLogin(MethodName8, data1).then((res) => {
- let xAxisData = [];
- let yAxisData = [];
- if (res.status === 1) {
- res.date_list.forEach((item) => {
- xAxisData.push(item.date);
- yAxisData.push(item.count);
- });
- }
- const chartDom = document.getElementById("echart4");
- const myChart = echarts.init(chartDom);
- let option = {
- title: {
- text: "累计上课人次",
- },
- tooltip: {
- trigger: "axis",
- },
- grid: {
- left: "3%",
- right: "4%",
- bottom: "3%",
- containLabel: true,
- },
- xAxis: {
- type: "category",
- boundaryGap: false,
- data: xAxisData,
- splitLine: {
- // 设置 y 轴分割线为虚线
- show: true,
- lineStyle: {
- type: "line",
- },
- },
- },
- yAxis: {
- type: "value",
- splitLine: {
- // 设置 y 轴分割线为虚线
- show: true,
- lineStyle: {
- type: "dashed",
- },
- },
- },
- series: [
- {
- type: "line",
- data: yAxisData,
- lineStyle: {
- color: "#00B2FF", // 这里设置为红色
- width: 2, // 线条宽度
- },
- smooth: true, // 可选,是否平滑曲线
- areaStyle: {
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
- {
- offset: 0,
- color: "rgba(3, 186, 226, 1)", // 渐变颜色,可以设置多个不同的颜色
- },
- {
- offset: 1,
- color: "rgba(3, 159, 226, 0)", // 渐变颜色
- },
- ]),
- },
- },
- ],
- };
- option && myChart.setOption(option);
- });
- this.getReadList();
- },
- formatterDuration(row) {
- let studyCn = "";
- if (row.duration) {
- studyCn = formatSeconds(row.duration);
- } else {
- studyCn = "0";
- }
- return studyCn;
- },
- handleSizeChange(val, type, page) {
- this[type] = val;
- this[page] = 1;
- this.getReadList();
- },
- handleCurrentChange(val, type) {
- this[type] = val;
- this.getReadList();
- },
- handleSort(value) {
- let dataSort = {
- prop: value.prop,
- order: value.order,
- };
- this.dataSort = dataSort;
- this.getReadList();
- },
- getReadList() {
- // 阅读数据
- let order_column_list = [];
- if (this.dataSort != {}) {
- if (this.dataSort.order == "descending") {
- order_column_list = [this.dataSort.prop + ":desc"];
- } else if (this.dataSort.order == "ascending") {
- // 升序不传值
- order_column_list = [this.dataSort.prop];
- } else {
- order_column_list = ["create_time:desc"];
- }
- } else {
- order_column_list = ["create_time:desc"];
- }
- let province_id_list = [];
- let city_id_list = [];
- this.selectedOptions.forEach((item) => {
- if (province_id_list.indexOf(item[0]) === -1) {
- province_id_list.push(item[0]);
- }
- city_id_list.push(item[1] ? item[1] : "");
- });
- let MethodName9 =
- "/ShopServer/Manager/LogManager/PageQueryReadingRecord_Article";
- let data2 = {
- reading_date_begin:
- this.dataValue && this.dataValue[0] ? this.dataValue[0] : "",
- reading_date_end:
- this.dataValue && this.dataValue[1] ? this.dataValue[1] : "",
- page_capacity: this.pageSize,
- cur_page: this.pageNumber,
- order_column_list: order_column_list,
- province_id_list: province_id_list,
- city_id_list: city_id_list,
- };
- getLogin(MethodName9, data2).then((res) => {
- if (res.status === 1) {
- this.readInfo = res.sum_info;
- this.total_count_a = res.total_count;
- this.articleList = res.reading_record_list;
- if (res.sum_info.duration < 3600) {
- this.readInfo.durationStr = "<1";
- } else {
- this.readInfo.durationStr = Math.ceil(res.sum_info.duration / 3600);
- }
- }
- });
- },
- // 导出阅读数据
- handleExport() {
- let _this = this;
- _this.exportLoading = true;
- let MethodName =
- "/ShopServer/Manager/FileExport/StartCreateArticleReadingRecordExportFile";
- let order_column_list = [];
- if (this.dataSort != {}) {
- if (this.dataSort.order == "descending") {
- order_column_list = [this.dataSort.prop + ":desc"];
- } else if (this.dataSort.order == "ascending") {
- // 升序不传值
- order_column_list = [this.dataSort.prop];
- } else {
- order_column_list = ["create_time:desc"];
- }
- } else {
- order_column_list = ["create_time:desc"];
- }
- let province_id_list = [];
- let city_id_list = [];
- this.selectedOptions.forEach((item) => {
- if (province_id_list.indexOf(item[0]) === -1) {
- province_id_list.push(item[0]);
- }
- city_id_list.push(item[1] ? item[1] : "");
- });
- let data2 = {
- reading_date_begin:
- this.dataValue && this.dataValue[0] ? this.dataValue[0] : "",
- reading_date_end:
- this.dataValue && this.dataValue[1] ? this.dataValue[1] : "",
- page_capacity: this.pageSize,
- cur_page: this.pageNumber,
- order_column_list: order_column_list,
- province_id_list: province_id_list,
- city_id_list: city_id_list,
- };
- getLogin(MethodName, data2)
- .then((res) => {
- let MethodName2 =
- "/ShopServer/Manager/FileExport/GetArticleReadingRecordExportFileTaskProgress";
- let timer = setTimeout(() => {
- getLogin(MethodName2, {
- export_file_task_id: res.export_file_task_id,
- })
- .then((res) => {
- if (res.is_finish === "true") {
- clearTimeout(timer);
- timer = null;
- _this.exportLoading = false;
- location.href = res.export_file_url;
- }
- })
- .catch((res) => {
- this.loading = false;
- });
- }, 1000);
- })
- .catch((res) => {
- this.loading = false;
- });
- },
- },
- //生命周期 - 创建完成(可以访问当前this实例)
- created() {},
- //生命周期 - 挂载完成(可以访问DOM元素)
- mounted() {
- this.getTableHeight();
- this.getData();
- this.searchStatDaily();
- },
- //生命周期-创建之前
- beforeCreated() {},
- //生命周期-挂载之前
- beforeMount() {},
- //生命周期-更新之前
- beforUpdate() {},
- //生命周期-更新之后
- updated() {},
- //生命周期-销毁之前
- beforeDestory() {},
- //生命周期-销毁完成
- destoryed() {},
- //如果页面有keep-alive缓存功能,这个函数会触发
- activated() {},
- };
- </script>
- <style lang="scss" scoped>
- /* @import url(); 引入css类 */
- .manage-root-contain-right {
- padding-top: 24px;
- overflow: auto;
- }
- .top {
- border-radius: 6px;
- background: #2460ff;
- padding: 20px 24px;
- display: flex;
- justify-content: space-between;
- color: #fff;
- font-weight: 500;
- align-items: center;
- span {
- font-size: 20px;
- line-height: 28px; /* 140% */
- }
- b {
- font-size: 12px;
- line-height: 20px; /* 166.667% */
- }
- }
- .day-stat-data {
- display: flex;
- gap: 16px;
- margin-top: 24px;
- flex-flow: wrap;
- .day-item {
- width: calc(50% - 8px);
- border-radius: 6px;
- background: #fff;
- flex-shrink: 0;
- display: flex;
- justify-content: space-between;
- padding: 16px 40px;
- column-gap: 24px;
- align-items: center;
- p {
- color: #4e5969;
- font-size: 12px;
- font-weight: 400;
- line-height: 20px;
- margin: 0;
- }
- .day-item-left {
- flex: 1;
- p {
- margin-bottom: 8px;
- }
- span {
- color: #1d2129;
- font-size: 22px;
- font-weight: 700;
- line-height: 24px;
- b {
- color: #4e5969;
- font-size: 12px;
- font-weight: 400;
- line-height: 20px;
- margin-left: 4px;
- }
- }
- }
- .day-item-center,
- .day-item-right {
- width: 80px;
- text-align: right;
- img {
- width: 16px;
- height: 16px;
- }
- a {
- font-size: 16px;
- font-weight: 600;
- line-height: 22px;
- }
- span {
- display: flex;
- justify-content: end;
- align-items: center;
- &.up {
- color: #fc4d42;
- }
- &.flat {
- color: #165dff;
- }
- &.down {
- color: #34b531;
- }
- }
- }
- }
- }
- .echart-box {
- border-radius: 4px;
- background: #fff;
- margin-top: 24px;
- padding: 16px;
- .echart-require {
- display: flex;
- align-items: center;
- width: 100%;
- column-gap: 8px;
- }
- .cascader-option {
- width: 206px;
- height: 37px;
- :deep .el-input {
- width: 206px;
- height: 37px !important;
- }
- }
- :deep .el-range-editor.el-input__inner {
- height: 37px;
- }
- :deep .el-date-editor .el-range-separator {
- line-height: 30px;
- }
- }
- .echart-item-box {
- display: flex;
- flex-wrap: wrap;
- gap: 16px;
- padding-top: 16px;
- .echart-item {
- width: calc(50% - 8px);
- height: 420px;
- border-radius: 4px;
- background: #f8f9fb;
- padding: 24px;
- }
- }
- .read-info {
- margin: 20px 0 10px 0;
- display: flex;
- column-gap: 15px;
- flex-flow: wrap;
- align-items: center;
- }
- :deep th.el-table__cell {
- border-bottom: 1px solid #e5e6eb;
- background: #f2f3f5;
- padding: 8px 0px;
- }
- :deep .cell {
- word-break: normal;
- }
- .items-type {
- padding: 1px 8px;
- font-weight: 500;
- font-size: 14px;
- line-height: 22px;
- border-radius: 2px;
- }
- </style>
|