|
@@ -1,4 +1,4 @@
|
|
|
-import { moduleRequest } from '@/utils/request'
|
|
|
|
|
|
|
+import {moduleRequest} from '@/utils/request'
|
|
|
import Mock from 'mockjs'
|
|
import Mock from 'mockjs'
|
|
|
import ForEach from "lodash-es/forEach";
|
|
import ForEach from "lodash-es/forEach";
|
|
|
|
|
|
|
@@ -117,7 +117,7 @@ const generateMockData = (filters = {}) => {
|
|
|
const formatCounts = generateFormatCounts()
|
|
const formatCounts = generateFormatCounts()
|
|
|
|
|
|
|
|
return {
|
|
return {
|
|
|
- filterResponse : getFilterData(),
|
|
|
|
|
|
|
+ filterResponse: getFilterData(),
|
|
|
// 摘要数据
|
|
// 摘要数据
|
|
|
summaryData: {
|
|
summaryData: {
|
|
|
code: 200,
|
|
code: 200,
|
|
@@ -243,17 +243,17 @@ export const getSummaryData = async (params = {}) => {
|
|
|
// }, Mock.mock('@integer(200, 500)')) // 随机延迟
|
|
// }, Mock.mock('@integer(200, 500)')) // 随机延迟
|
|
|
// })
|
|
// })
|
|
|
|
|
|
|
|
- let res = await request('/resourceStatistic/totalStatistic', params, 'get')
|
|
|
|
|
- console.log('什么呢1233',res)
|
|
|
|
|
|
|
+ let res = await request('/resourceStatistic/totalStatistic', params, 'get')
|
|
|
|
|
+ console.log('什么呢1233', res)
|
|
|
let json = {
|
|
let json = {
|
|
|
- code : 200,
|
|
|
|
|
- data : {
|
|
|
|
|
- totalResources : res.RESOURCE_TOTAL,
|
|
|
|
|
- totalStorage : `${kbToTb(res.storageSize)}TB`,
|
|
|
|
|
- totalCapacity : `${kbToTb(res.totalStorageSize)}TB`,
|
|
|
|
|
- usageRate : `${((parseFloat(res.storageSize) / res.totalStorageSize) * 100).toFixed(0)}%`,
|
|
|
|
|
- totalViews : res.WATCH_TOTAL,
|
|
|
|
|
- totalFavorites : res.COLLECT_TOTAL
|
|
|
|
|
|
|
+ code: 200,
|
|
|
|
|
+ data: {
|
|
|
|
|
+ totalResources: res.RESOURCE_TOTAL,
|
|
|
|
|
+ totalStorage: `${kbToTb(res.storageSize)}TB`,
|
|
|
|
|
+ totalCapacity: `${kbToTb(res.totalStorageSize)}TB`,
|
|
|
|
|
+ usageRate: `${((parseFloat(res.storageSize) / res.totalStorageSize) * 100).toFixed(0)}%`,
|
|
|
|
|
+ totalViews: res.WATCH_TOTAL,
|
|
|
|
|
+ totalFavorites: res.COLLECT_TOTAL
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
// {
|
|
// {
|
|
@@ -264,17 +264,18 @@ export const getSummaryData = async (params = {}) => {
|
|
|
// "storageSize": 1726487824,
|
|
// "storageSize": 1726487824,
|
|
|
// "totalStorageSize": 21474836480
|
|
// "totalStorageSize": 21474836480
|
|
|
// }
|
|
// }
|
|
|
- // totalResources: '0',
|
|
|
|
|
- // totalStorage: '0 TB',
|
|
|
|
|
- // totalCapacity: '10 TB',
|
|
|
|
|
- // usageRate: '0%',
|
|
|
|
|
- // totalViews: '0',
|
|
|
|
|
- // totalFavorites: '0'
|
|
|
|
|
|
|
+ // totalResources: '0',
|
|
|
|
|
+ // totalStorage: '0 TB',
|
|
|
|
|
+ // totalCapacity: '10 TB',
|
|
|
|
|
+ // usageRate: '0%',
|
|
|
|
|
+ // totalViews: '0',
|
|
|
|
|
+ // totalFavorites: '0'
|
|
|
// 真实接口调用:
|
|
// 真实接口调用:
|
|
|
// return request('/resource-library/summary', params, 'get')
|
|
// return request('/resource-library/summary', params, 'get')
|
|
|
- console.log('什么呢',json)
|
|
|
|
|
|
|
+ console.log('什么呢', json)
|
|
|
return json
|
|
return json
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
function kbToTb(kb) {
|
|
function kbToTb(kb) {
|
|
|
const tb = kb / 1073741824;
|
|
const tb = kb / 1073741824;
|
|
|
return parseFloat(tb.toFixed(2));
|
|
return parseFloat(tb.toFixed(2));
|
|
@@ -283,13 +284,13 @@ function kbToTb(kb) {
|
|
|
export const getFilterData = async (params = {}) => {
|
|
export const getFilterData = async (params = {}) => {
|
|
|
let colleges = await request('resourceStatistic/selectOrgList', params, 'get')
|
|
let colleges = await request('resourceStatistic/selectOrgList', params, 'get')
|
|
|
colleges.unshift({
|
|
colleges.unshift({
|
|
|
- id : 'all',
|
|
|
|
|
- name : '全部院系'
|
|
|
|
|
|
|
+ id: 'all',
|
|
|
|
|
+ name: '全部院系'
|
|
|
})
|
|
})
|
|
|
- console.log("什么呢sss",colleges)
|
|
|
|
|
|
|
+ console.log("什么呢sss", colleges)
|
|
|
let json = {
|
|
let json = {
|
|
|
code: 200,
|
|
code: 200,
|
|
|
- data : colleges
|
|
|
|
|
|
|
+ data: colleges
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return json
|
|
return json
|
|
@@ -297,7 +298,7 @@ export const getFilterData = async (params = {}) => {
|
|
|
|
|
|
|
|
export const getResourceTypeData = async (params = {}) => {
|
|
export const getResourceTypeData = async (params = {}) => {
|
|
|
let resourceTypeStatistic = await request('resourceStatistic/resourceTypeStatistic', params, 'get')
|
|
let resourceTypeStatistic = await request('resourceStatistic/resourceTypeStatistic', params, 'get')
|
|
|
- console.log('左面的',resourceTypeStatistic)
|
|
|
|
|
|
|
+ console.log('左面的', resourceTypeStatistic)
|
|
|
let types = []
|
|
let types = []
|
|
|
let typeCounts = []
|
|
let typeCounts = []
|
|
|
ForEach(resourceTypeStatistic, (item) => {
|
|
ForEach(resourceTypeStatistic, (item) => {
|
|
@@ -309,10 +310,10 @@ export const getResourceTypeData = async (params = {}) => {
|
|
|
// typeCounts: typeCounts,
|
|
// typeCounts: typeCounts,
|
|
|
let json = {
|
|
let json = {
|
|
|
code: 200,
|
|
code: 200,
|
|
|
- data : {
|
|
|
|
|
|
|
+ data: {
|
|
|
types,
|
|
types,
|
|
|
typeCounts,
|
|
typeCounts,
|
|
|
- typeStorage : []
|
|
|
|
|
|
|
+ typeStorage: []
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
return json
|
|
return json
|
|
@@ -327,7 +328,7 @@ export const getResourceTypeData = async (params = {}) => {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-export const getDepartmentData = async(params = {}) => {
|
|
|
|
|
|
|
+export const getDepartmentData = async (params = {}) => {
|
|
|
let collegeStatistic = await request('resourceStatistic/collegeStatistic', params, 'get')
|
|
let collegeStatistic = await request('resourceStatistic/collegeStatistic', params, 'get')
|
|
|
let departments = []
|
|
let departments = []
|
|
|
let departmentCounts = []
|
|
let departmentCounts = []
|
|
@@ -337,10 +338,10 @@ export const getDepartmentData = async(params = {}) => {
|
|
|
})
|
|
})
|
|
|
let json = {
|
|
let json = {
|
|
|
code: 200,
|
|
code: 200,
|
|
|
- data : {
|
|
|
|
|
|
|
+ data: {
|
|
|
departments,
|
|
departments,
|
|
|
departmentCounts,
|
|
departmentCounts,
|
|
|
- departmentStorage : []
|
|
|
|
|
|
|
+ departmentStorage: []
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
return json
|
|
return json
|
|
@@ -358,7 +359,7 @@ export const getDepartmentData = async(params = {}) => {
|
|
|
// return request('/resource-library/department-distribution', params, 'get')
|
|
// return request('/resource-library/department-distribution', params, 'get')
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-export const getVisibilityData = async(params = {}) => {
|
|
|
|
|
|
|
+export const getVisibilityData = async (params = {}) => {
|
|
|
// return new Promise((resolve) => {
|
|
// return new Promise((resolve) => {
|
|
|
// setTimeout(() => {
|
|
// setTimeout(() => {
|
|
|
// const mockData = generateMockData(params)
|
|
// const mockData = generateMockData(params)
|
|
@@ -366,7 +367,7 @@ export const getVisibilityData = async(params = {}) => {
|
|
|
// }, Mock.mock('@integer(200, 500)'))
|
|
// }, Mock.mock('@integer(200, 500)'))
|
|
|
// })
|
|
// })
|
|
|
let resourcePublicStatistic = await request('resourceStatistic/resourcePublicStatistic', params, 'get')
|
|
let resourcePublicStatistic = await request('resourceStatistic/resourcePublicStatistic', params, 'get')
|
|
|
- let visibility = ['非公开','公开']
|
|
|
|
|
|
|
+ let visibility = ['非公开', '公开']
|
|
|
let visibilityCounts = []
|
|
let visibilityCounts = []
|
|
|
ForEach(resourcePublicStatistic, (item) => {
|
|
ForEach(resourcePublicStatistic, (item) => {
|
|
|
visibilityCounts.push(item.num)
|
|
visibilityCounts.push(item.num)
|
|
@@ -378,26 +379,26 @@ export const getVisibilityData = async(params = {}) => {
|
|
|
let hotStatistic = await request('resourceStatistic/hotStatistic', params, 'get')
|
|
let hotStatistic = await request('resourceStatistic/hotStatistic', params, 'get')
|
|
|
ForEach(hotStatistic, (item) => {
|
|
ForEach(hotStatistic, (item) => {
|
|
|
//1推荐 2热门 3推荐和热门
|
|
//1推荐 2热门 3推荐和热门
|
|
|
- if(item.type == 1){
|
|
|
|
|
|
|
+ if (item.type == 1) {
|
|
|
hotness.push('推荐')
|
|
hotness.push('推荐')
|
|
|
}
|
|
}
|
|
|
- if(item.type == 2){
|
|
|
|
|
|
|
+ if (item.type == 2) {
|
|
|
hotness.push('热门')
|
|
hotness.push('热门')
|
|
|
}
|
|
}
|
|
|
- if(item.type == 3){
|
|
|
|
|
|
|
+ if (item.type == 3) {
|
|
|
hotness.push('推荐和热门')
|
|
hotness.push('推荐和热门')
|
|
|
}
|
|
}
|
|
|
hotnessCounts.push(item.num)
|
|
hotnessCounts.push(item.num)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
- console.log('接口看看',hotStatistic)
|
|
|
|
|
- let recommendedCounts = [12,13]
|
|
|
|
|
|
|
+ console.log('接口看看', hotStatistic)
|
|
|
|
|
+ let recommendedCounts = [12, 13]
|
|
|
|
|
|
|
|
|
|
|
|
|
let json = {
|
|
let json = {
|
|
|
code: 200,
|
|
code: 200,
|
|
|
- data : {
|
|
|
|
|
|
|
+ data: {
|
|
|
visibility,
|
|
visibility,
|
|
|
visibilityCounts,
|
|
visibilityCounts,
|
|
|
hotness,
|
|
hotness,
|
|
@@ -426,12 +427,10 @@ export const getVisibilityData = async(params = {}) => {
|
|
|
// }
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
// return request('/resource-library/visibility-analysis', params, 'get')
|
|
// return request('/resource-library/visibility-analysis', params, 'get')
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-export const getFormatData = async(params = {}) => {
|
|
|
|
|
|
|
+export const getFormatData = async (params = {}) => {
|
|
|
// return new Promise((resolve) => {
|
|
// return new Promise((resolve) => {
|
|
|
// setTimeout(() => {
|
|
// setTimeout(() => {
|
|
|
// const mockData = generateMockData(params)
|
|
// const mockData = generateMockData(params)
|
|
@@ -446,7 +445,7 @@ export const getFormatData = async(params = {}) => {
|
|
|
formatCounts.push(item.num)
|
|
formatCounts.push(item.num)
|
|
|
})
|
|
})
|
|
|
let storageStatistic = await request('resourceStatistic/storageStatistic', params, 'get')
|
|
let storageStatistic = await request('resourceStatistic/storageStatistic', params, 'get')
|
|
|
- console.log('内存',storageStatistic)
|
|
|
|
|
|
|
+ console.log('内存', storageStatistic)
|
|
|
let formatAvgSize = []
|
|
let formatAvgSize = []
|
|
|
ForEach(storageStatistic, (item) => {
|
|
ForEach(storageStatistic, (item) => {
|
|
|
formatAvgSize.push(item.extendName)
|
|
formatAvgSize.push(item.extendName)
|
|
@@ -454,21 +453,21 @@ export const getFormatData = async(params = {}) => {
|
|
|
|
|
|
|
|
let json = {
|
|
let json = {
|
|
|
code: 200,
|
|
code: 200,
|
|
|
- data : {
|
|
|
|
|
|
|
+ data: {
|
|
|
formats,
|
|
formats,
|
|
|
formatCounts,
|
|
formatCounts,
|
|
|
formatStorage: storageStatistic.map((item) => {
|
|
formatStorage: storageStatistic.map((item) => {
|
|
|
let size = (item.FILESIZE) * parseFloat(1).toFixed(2)
|
|
let size = (item.FILESIZE) * parseFloat(1).toFixed(2)
|
|
|
- console.log("asdasd",item.FILESIZE)
|
|
|
|
|
- return `${(item.FILESIZE/1000/1000).toFixed(2)}`
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ console.log("asdasd", item.FILESIZE)
|
|
|
|
|
+ return `${(item.FILESIZE / 1000 / 1000).toFixed(2)}`
|
|
|
|
|
+ }
|
|
|
),
|
|
),
|
|
|
formatAvgSize: storageStatistic.map((format, index) => {
|
|
formatAvgSize: storageStatistic.map((format, index) => {
|
|
|
- // 根据文件类型设置合理的平均大小
|
|
|
|
|
- const size = format.avgSize
|
|
|
|
|
- // if (size > 1000) return `${(size / 1000).toFixed(1)}MB`
|
|
|
|
|
- return `${(size/1000/1000).toFixed(2)}MB`
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ // 根据文件类型设置合理的平均大小
|
|
|
|
|
+ const size = format.avgSize
|
|
|
|
|
+ // if (size > 1000) return `${(size / 1000).toFixed(1)}MB`
|
|
|
|
|
+ return `${(size / 1000 / 1000).toFixed(2)}MB`
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
return json
|
|
return json
|
|
@@ -504,26 +503,50 @@ export const getFormatData = async(params = {}) => {
|
|
|
// },
|
|
// },
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
// return request('/resource-library/format-distribution', params, 'get')
|
|
// return request('/resource-library/format-distribution', params, 'get')
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-export const getEngagementData = async(params = {}) => {
|
|
|
|
|
|
|
+export const getEngagementData = async (params = {}) => {
|
|
|
// return new Promise((resolve) => {
|
|
// return new Promise((resolve) => {
|
|
|
// setTimeout(() => {
|
|
// setTimeout(() => {
|
|
|
// const mockData = generateMockData(params)
|
|
// const mockData = generateMockData(params)
|
|
|
// resolve(mockData.engagementData)
|
|
// resolve(mockData.engagementData)
|
|
|
// }, Mock.mock('@integer(200, 500)'))
|
|
// }, Mock.mock('@integer(200, 500)'))
|
|
|
// })
|
|
// })
|
|
|
- let totalStatistic = await request('resourceStatistic/totalStatistic', params, 'get')
|
|
|
|
|
- console.log('001 ',totalStatistic)
|
|
|
|
|
|
|
+ let selectResourceUse = await request('resourceStatistic/selectResourceUse', params, 'get')
|
|
|
|
|
+ let selectResourceCans = await request('resourceStatistic/selectResourceCans', params, 'get')
|
|
|
|
|
+ console.log('001 ', selectResourceUse)
|
|
|
|
|
+ console.log('003 ', selectResourceCans)
|
|
|
|
|
+ let engagement = []
|
|
|
|
|
+ let engagementCounts = []
|
|
|
|
|
+ let typeViewCounts = []
|
|
|
|
|
+ ForEach(selectResourceUse, (item) => {
|
|
|
|
|
+ //1、资源观看 2资源收藏 3资源分享
|
|
|
|
|
+ if (item.type == 1) {
|
|
|
|
|
+ engagement.push('资源观看')
|
|
|
|
|
+ engagementCounts.push(item.num)
|
|
|
|
|
+ }
|
|
|
|
|
+ if (item.type == 2) {
|
|
|
|
|
+ engagement.push('资源收藏')
|
|
|
|
|
+ engagementCounts.push(item.num)
|
|
|
|
|
+ }
|
|
|
|
|
+ if (item.type == 3) {
|
|
|
|
|
+ engagement.push('资源分享')
|
|
|
|
|
+ engagementCounts.push(item.num)
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ ForEach(selectResourceCans, (item) => {
|
|
|
|
|
+ //1、资源观看 2资源收藏 3资源分享
|
|
|
|
|
+ typeViewCounts.push(item.num)
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
let json = {
|
|
let json = {
|
|
|
code: 200,
|
|
code: 200,
|
|
|
- data : {
|
|
|
|
|
- engagement: ['观看', '收藏', '分享'],
|
|
|
|
|
- engagementCounts: [
|
|
|
|
|
- //船锚
|
|
|
|
|
- ],
|
|
|
|
|
|
|
+ data: {
|
|
|
|
|
+ engagement,
|
|
|
|
|
+ engagementCounts,
|
|
|
|
|
+ typeViewCounts
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
return json
|
|
return json
|
|
@@ -544,12 +567,45 @@ export const getEngagementData = async(params = {}) => {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-export const getTrendData = (params = {}) => {
|
|
|
|
|
- return new Promise((resolve) => {
|
|
|
|
|
- setTimeout(() => {
|
|
|
|
|
- const mockData = generateMockData(params)
|
|
|
|
|
- resolve(mockData.trendData)
|
|
|
|
|
- }, Mock.mock('@integer(200, 500)'))
|
|
|
|
|
|
|
+export const getTrendData = async (params = {}) => {
|
|
|
|
|
+ // return new Promise((resolve) => {
|
|
|
|
|
+ // setTimeout(() => {
|
|
|
|
|
+ // const mockData = generateMockData(params)
|
|
|
|
|
+ // resolve(mockData.trendData)
|
|
|
|
|
+ // }, Mock.mock('@integer(200, 500)'))
|
|
|
|
|
+ // })
|
|
|
|
|
+ let selectResourceUpload = await request('resourceStatistic/selectResourceUpload', params, 'get')
|
|
|
|
|
+ console.log('002 ',selectResourceUpload)
|
|
|
|
|
+ let engagement = []
|
|
|
|
|
+ let trendLabels = []
|
|
|
|
|
+ let uploadTrend = []
|
|
|
|
|
+ let viewTrend = []
|
|
|
|
|
+ ForEach(selectResourceUpload, (item) => {
|
|
|
|
|
+ //1、资源观看 2资源收藏 3资源分享
|
|
|
|
|
+ trendLabels.push(item.createMonth)
|
|
|
|
|
+ uploadTrend.push(item.uploadNum)
|
|
|
|
|
+ viewTrend.push(item.seeNum)
|
|
|
})
|
|
})
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ let json = {
|
|
|
|
|
+ code: 200,
|
|
|
|
|
+ data : {
|
|
|
|
|
+ trendLabels,
|
|
|
|
|
+ uploadTrend,
|
|
|
|
|
+ viewTrend
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return json
|
|
|
|
|
+ // 时间趋势数据
|
|
|
|
|
+ // trendData: {
|
|
|
|
|
+ // code: 200,
|
|
|
|
|
+ // data: {
|
|
|
|
|
+ // trendLabels: months,
|
|
|
|
|
+ // uploadTrend: months.map(() => Math.floor((adjustedTotalResources / 12) * (0.6 + Math.random() * 0.8))), // 月均上传量有波动
|
|
|
|
|
+ // viewTrend: months.map(() => Math.floor((adjustedViews / 12) * (0.7 + Math.random() * 0.6))) // 月均观看量有波动
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
// return request('/resource-library/trend-analysis', params, 'get')
|
|
// return request('/resource-library/trend-analysis', params, 'get')
|
|
|
}
|
|
}
|