首页更新

This commit is contained in:
zhangjunwen 2024-05-10 18:12:28 +08:00
parent f425a592f6
commit f35e8c1892
5 changed files with 659 additions and 61 deletions

View File

@ -39,11 +39,11 @@ public class CommunityPostHeatController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('community:heat:list')")
@GetMapping("/list")
public TableDataInfo list(CommunityPostHeat communityPostHeat)
public AjaxResult list(CommunityPostHeat communityPostHeat)
{
startPage();
// startPage();
List<CommunityPostHeat> list = communityPostHeatService.selectCommunityPostHeatList(communityPostHeat);
return getDataTable(list);
return AjaxResult.success(list);
}
/**

View File

@ -44,7 +44,7 @@ public class CommunityPostHeatServiceImpl implements ICommunityPostHeatService
{
//排序
List<CommunityPostHeat> heatList = communityPostHeatMapper.selectCommunityPostHeatList(communityPostHeat);
heatList.stream().sorted((o1, o2) -> heatSortCalculate(o1).compareTo(heatSortCalculate(o2))).collect(Collectors.toList());
// heatList.stream().sorted((o1, o2) -> heatSortCalculate(o1).compareTo(heatSortCalculate(o2))).collect(Collectors.toList());
return heatList;
}

View File

@ -37,6 +37,8 @@
<if test="postId != null and postId != ''"> and post_id = #{postId}</if>
<if test="likes != null "> and likes = #{likes}</if>
<if test="views != null "> and views = #{views}</if>
order by 0.6 * a.replies + 0.4 * a.views desc
limit 5
</select>
<select id="selectCommunityPostHeatByPostId" parameterType="String" resultMap="CommunityPostHeatResult">

View File

@ -202,19 +202,6 @@
<div></div>
</li>
</ul>
<div
class="more"
@click="dealType"
>
<i
v-if="moreType"
class="el-icon-arrow-down"
></i>
<i
v-else
class="el-icon-arrow-up"
></i>
</div>
</el-card>
<el-card
style="background-color: rgba(255,255,255,0.9)"
@ -241,19 +228,6 @@
</div>
</div>
</div>
<div
class="more"
@click="dealTag"
>
<i
v-if="moreTag"
class="el-icon-arrow-down"
></i>
<i
v-else
class="el-icon-arrow-up"
></i>
</div>
</el-card>
<el-card
style="background-color: rgba(255,255,255,0.9)"
@ -289,19 +263,6 @@
</div>
</div>
</div>
<div
class="more"
@click="dealTag"
>
<i
v-if="moreTag"
class="el-icon-arrow-down"
></i>
<i
v-else
class="el-icon-arrow-up"
></i>
</div>
</el-card>
<el-card
style="background-color: rgba(255,255,255,0.9)"
@ -337,19 +298,6 @@
</div>
</div>
</div>
<div
class="more"
@click="dealTag"
>
<i
v-if="moreTag"
class="el-icon-arrow-down"
></i>
<i
v-else
class="el-icon-arrow-up"
></i>
</div>
</el-card>
</el-col>
<el-col
@ -507,7 +455,7 @@ export default {
//
async getHeatList() {
listHeat(this.queryParams).then((response) => {
this.heatList = response.rows;
this.heatList = response.data;
});
// getForumDetail(this.$route.query.id).then((response) => {
// for (let i = 0; i < response.types.length; i++) {
@ -645,7 +593,7 @@ export default {
<style scoped>
.app-container {
background-image: url("../../../assets/images/login-background.jpg");
background-image: url("../../../assets/images/community_back.png");
background-repeat: no-repeat;
background-size: cover;
background-position: center;

View File

@ -1,22 +1,524 @@
<template>
<div> <el-button @click="getData">首页</el-button>
<div class="app-container">
<!-- <el-button @click="getData">首页</el-button> -->
<el-card
class="box-card"
style="margin:10px 0 0 10px"
>
<div
slot="header"
class="clearfix"
>
<span style=" font-size: 25px;
font-weight: bold;">总览</span>
</div>
<el-row :gutter="5">
<el-col
:span="4"
class="operation"
>
<el-card>
<span class="title">运营团队数</span>
<br />
<span class="vlaue">{{totalNums.teamNum}}</span>
</el-card>
</el-col>
<el-col
:span="4"
class="order"
>
<el-card>
<span class="title">订单数量</span>
<br />
<span class="vlaue">{{totalNums.orderNum}}</span>
</el-card>
</el-col>
<el-col
:span="4"
class="knowledge"
>
<el-card>
<span class="title">知识库数量</span>
<br />
<span class="vlaue">{{totalNums.kbNum}}</span>
</el-card>
</el-col>
<el-col
:span="4"
class="course"
>
<el-card>
<span class="title">课程数量</span>
<br />
<span class="vlaue">{{totalNums.courseNUm}}</span>
</el-card>
</el-col>
<el-col
:span="4"
class="examinees"
>
<el-card>
<span class="title">考试人数</span>
<br />
<span class="vlaue">{{totalNums.examinerNum}}</span>
</el-card>
</el-col>
<el-col
:span="4"
class="post"
>
<el-card>
<span class="title">贴子数量</span>
<br />
<span class="vlaue">{{totalNums.postNum}}</span>
</el-card>
</el-col>
</el-row>
</el-card>
<el-row :gutter="20">
<el-col :span="12">
<el-card
class="box-card"
style="margin:10px 0 0 10px"
>
<div
slot="header"
class="clearfix"
>
<span style=" font-size: 25px;font-weight: bold;">每月订单数量</span>
</div>
<div
class="echarts-body"
ref="orderChart"
/>
</el-card>
</el-col>
<el-col :span="12">
<el-card
class="box-card"
style="margin:10px 0 0 10px"
>
<div
slot="header"
class="clearfix"
>
<span style=" font-size: 25px;font-weight: bold;">每月运维社区贴子数量</span>
<div
class="echarts-body"
ref="postChart"
/>
</div>
</el-card>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-card
class="box-card"
style="margin:10px 0 0 10px"
>
<div
slot="header"
class="clearfix"
>
<span style=" font-size: 25px;font-weight: bold;">每月考试通过率及人数</span>
</div>
<div
class="echarts-body"
ref="examChart"
/>
</el-card>
</el-col>
<el-col :span="6">
<el-card
class="box-card"
style="margin:10px 0 0 10px"
>
<div
slot="header"
class="clearfix"
>
<span style=" font-size: 25px;font-weight: bold;">知识库数量</span>
</div>
<div
class="echarts-body"
ref="knowledgeChart"
/>
</el-card>
</el-col>
<el-col :span="6">
<el-card
class="box-card"
style="margin:10px 0 0 10px"
>
<div
slot="header"
class="clearfix"
>
<span style=" font-size: 25px;font-weight: bold;">各课程数量</span>
</div>
<div
class="echarts-body"
ref="courseChart"
/>
</el-card>
</el-col>
</el-row>
</div>
</template>
<script>
import { getHomepageData } from "@/api/order/analysis";
import * as echarts from "echarts";
export default {
name: "Index",
data() {
return {};
return {
homeData: {},
totalNums: {},
monthExamPassNum: [],
monthExamPassRate: [],
monthOrderNum: [],
monthPostNum: [],
knowledgeNum: {},
courseNum: {},
};
},
created() {
this.getData();
// this.getOrderChart();
// this.getPostChart();
// this.getExamChart();
// this.getKnowledgeChart();
// this.getCourseChart();
},
methods: {
//
getCourseChart(data) {
let p = new Promise((resolve) => {
resolve();
});
p.then(() => {
let courseChart = echarts.init(this.$refs.courseChart);
let option = {
title: {
text: "课程库",
left: "center",
},
tooltip: {
trigger: "item",
},
legend: {
orient: "vertical",
left: "left",
},
series: [
{
name: "课程库",
type: "pie",
radius: "50%",
data: this.setCoursePie(data),
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: "rgba(0, 0, 0, 0.5)",
},
},
},
],
};
courseChart.setOption(option);
});
},
setCoursePie(data) {
let d = [];
d[0] = { name: "培训资料", value: data.documentNum };
d[1] = { name: "在线课程", value: data.onlineNum };
d[2] = { name: "视频课程", value: data.videoNum };
return d;
},
//
getKnowledgeChart(data) {
let p = new Promise((resolve) => {
resolve();
});
p.then(() => {
let knowledgeChart = echarts.init(this.$refs.knowledgeChart);
let option = {
title: {
text: "知识库",
left: "center",
},
tooltip: {
trigger: "item",
},
legend: {
orient: "vertical",
left: "left",
},
series: [
{
name: "知识库",
type: "pie",
radius: "50%",
label: {
position: "inner",
fontSize: 10,
},
data: this.setKnowledgePie(data),
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: "rgba(0, 0, 0, 0.5)",
},
},
},
],
};
knowledgeChart.setOption(option);
});
},
setKnowledgePie(data) {
let d = [];
d[0] = { name: "陶瓷行业", value: data.ceramics };
d[1] = { name: "化工行业", value: data.chemicalIndustry };
d[2] = { name: "造纸行业", value: data.papermaking };
d[3] = { name: "历史", value: data.history };
return d;
},
//线
getExamChart(num, rate) {
let p = new Promise((resolve) => {
resolve();
});
p.then(() => {
let examChart = echarts.init(this.$refs.examChart);
let option = {
tooltip: {
trigger: "axis",
axisPointer: {
type: "cross",
crossStyle: {
color: "#999",
},
},
},
// toolbox: {
// feature: {
// dataView: { show: true, readOnly: false },
// magicType: { show: true, type: ["line", "bar"] },
// restore: { show: true },
// saveAsImage: { show: true },
// },
// },
legend: {
data: ["通过人数", "通过率"],
},
xAxis: [
{
type: "category",
data: [
"1月",
"2月",
"3月",
"4月",
"5月",
"6月",
"7月",
"8月",
"9月",
"10月",
"11月",
"12月",
],
axisPointer: {
type: "shadow",
},
},
],
yAxis: [
{
type: "value",
name: "通过人数",
// min: 0,
// max: 250,
interval: 1,
// axisLabel: {
// formatter: "{value} ml",
// },
},
{
type: "value",
name: "通过率",
// min: 0,
// max: 25,
interval: 20,
// axisLabel: {
// formatter: "{value} °C",
// },
},
],
series: [
{
name: "通过人数",
type: "bar",
tooltip: {
// valueFormatter: function (value) {
// return value + " ml";
// },
},
data: num,
},
{
name: "通过率",
type: "line",
yAxisIndex: 1,
tooltip: {
// valueFormatter: function (value) {
// return value + " °C";
// },
},
data: rate,
},
],
};
examChart.setOption(option);
});
},
//线
getPostChart(data) {
let p = new Promise((resolve) => {
resolve();
});
p.then(() => {
let postChart = echarts.init(this.$refs.postChart);
let option = {
tooltip: {
trigger: "axis",
axisPointer: {
type: "shadow",
},
},
grid: {
left: "3%",
right: "4%",
bottom: "3%",
containLabel: true,
},
xAxis: [
{
type: "category",
data: [
"1月",
"2月",
"3月",
"4月",
"5月",
"6月",
"7月",
"8月",
"9月",
"10月",
"11月",
"12月",
],
axisTick: {
alignWithLabel: true,
},
},
],
yAxis: [
{
type: "value",
},
],
series: [
{
name: "Direct",
type: "bar",
barWidth: "60%",
data: data,
},
],
};
postChart.setOption(option);
});
},
//线
getOrderChart(data) {
let p = new Promise((resolve) => {
resolve();
});
p.then(() => {
let orderChart = echarts.init(this.$refs.orderChart);
let option = {
tooltip: {
trigger: "axis",
axisPointer: {
type: "shadow",
},
},
grid: {
left: "3%",
right: "4%",
bottom: "3%",
containLabel: true,
},
xAxis: [
{
type: "category",
data: [
"1月",
"2月",
"3月",
"4月",
"5月",
"6月",
"7月",
"8月",
"9月",
"10月",
"11月",
"12月",
],
axisTick: {
alignWithLabel: true,
},
},
],
yAxis: [
{
type: "value",
},
],
series: [
{
name: "Direct",
type: "bar",
barWidth: "60%",
data: data,
},
],
};
orderChart.setOption(option);
});
},
getData() {
getHomepageData().then((res) => {
console.log(res);
this.homeData = res.data;
this.totalNums = this.homeData.totalNum;
this.getOrderChart(this.homeData.monthOrderNum);
this.getPostChart(this.homeData.monthPostNum);
this.getExamChart(
this.homeData.monthExamPassNum,
this.homeData.monthExamPassRate
);
this.getKnowledgeChart(this.homeData.pieKbNum);
this.getCourseChart(this.homeData.piecourseNum);
});
},
goTarget(href) {
@ -27,5 +529,151 @@ export default {
</script>
<style scoped lang="scss">
.operation {
height: 100%;
// background: url(../assets/images/index/team.png) center no-repeat;
// background-size: 95% 100%;
// border: 1px solid #d3dce6; /* */
// border-radius: 4px; /* */
// margin: 10px 0 0 10px;
text-align: center;
.title {
font-size: 20px;
font-weight: bold;
left: 50px;
top: 50px;
// position: relative;
}
.vlaue {
font-size: 32px;
font-weight: bold;
color: #3e7bfa;
left: 70px;
top: 60px;
// position: relative;
}
}
.order {
height: 100%;
// background: url(../assets/images/index/run.png) center no-repeat;
// background-size: 95% 100%;
// margin: 10px 0 0 10px;
text-align: center;
.title {
font-size: 20px;
font-weight: bold;
left: 40px;
top: 50px;
// position: relative;
}
.vlaue {
font-size: 32px;
font-weight: bold;
color: #06c270;
left: 80px;
top: 60px;
// position: relative;
}
}
.knowledge {
height: 100%;
// background: url(../assets/images/index/notRun.png) center no-repeat;
// background-size: 95% 100%;
// margin: 10px 0 0 10px;
text-align: center;
.title {
font-size: 20px;
font-weight: bold;
left: 40px;
top: 50px;
// position: relative;
}
.vlaue {
font-size: 32px;
font-weight: bold;
color: #ff8800;
left: 70px;
top: 60px;
// position: relative;
}
}
.course {
height: 100%;
// background: url(../assets/images/index/notRun.png) center no-repeat;
// background-size: 95% 100%;
// margin: 10px 0 0 10px;
text-align: center;
.title {
font-size: 20px;
font-weight: bold;
left: 40px;
top: 50px;
// position: relative;
}
.vlaue {
font-size: 32px;
font-weight: bold;
color: #def079;
left: 70px;
top: 60px;
// position: relative;
}
}
.examinees {
height: 100%;
// background: url(../assets/images/index/notRun.png) center no-repeat;
// background-size: 95% 100%;
// margin: 10px 0 0 10px;
text-align: center;
.title {
font-size: 20px;
font-weight: bold;
left: 40px;
top: 50px;
// position: relative;
}
.vlaue {
font-size: 32px;
font-weight: bold;
color: #e711b9;
left: 70px;
top: 60px;
// position: relative;
}
}
.post {
height: 100%;
// background: url(../assets/images/index/notRun.png) center no-repeat;
// background-size: 95% 100%;
// margin: 10px 0 0 10px;
text-align: center;
.title {
font-size: 20px;
font-weight: bold;
left: 40px;
top: 50px;
// position: relative;
}
.vlaue {
font-size: 32px;
font-weight: bold;
color: #156c04;
left: 70px;
top: 60px;
// position: relative;
}
}
.clearfix:before,
.clearfix:after {
display: table;
content: "";
}
.clearfix:after {
clear: both;
}
.echarts-body {
height: 400px;
}
</style>