Commit 23dfc763 authored by leon's avatar leon

feat:add reports list

parent 4114eed3
const baseUrl = 'https://api.charleskeith.cn/api' // 请求的本域名 // 请求的本域名
const reportUrl = 'http://192.168.138.55:8081/api' const baseUrl = 'https://api.charleskeith.cn/api' // 正式环境
const reportUrl = 'http://192.168.138.55:8081/api' // 测试环境
// const reportUrl = 'http://47.101.191.49:8083/api' // 外网测试环境
const install = (Vue, vm) => { const install = (Vue, vm) => {
let getHttp = (url, params, config) => vm.$http.get(url, { params }, config) let getHttp = (url, params, config) => vm.$http.get(url, { params }, config)
let postHttp = (url, params, config) => vm.$http.post(url, params, config) let postHttp = (url, params, config) => vm.$http.post(url, params, config)
...@@ -10,7 +11,9 @@ const install = (Vue, vm) => { ...@@ -10,7 +11,9 @@ const install = (Vue, vm) => {
// 注册 // 注册
let register = params => postHttp(`${baseUrl}/report/user/register`, params) let register = params => postHttp(`${baseUrl}/report/user/register`, params)
// 报表列表 // 报表列表
const getReportList = params => getHttp(`${reportUrl}/report/chart/getList`, params) const getReportList = params => getHttp(`${reportUrl}/report/screen/getList`, params)
// 报表组件列表
const getReportCharts = params => getHttp(`${reportUrl}/report/chart/getList`, params)
// 数据集 // 数据集
const dataSetPreview = params => postHttp(`${reportUrl}/report/dataset/preview`, params, { const dataSetPreview = params => postHttp(`${reportUrl}/report/dataset/preview`, params, {
custom: { custom: {
...@@ -36,6 +39,7 @@ const install = (Vue, vm) => { ...@@ -36,6 +39,7 @@ const install = (Vue, vm) => {
quickLogin, quickLogin,
register, register,
getReportList, getReportList,
getReportCharts,
dataSetPreview, dataSetPreview,
getAuthorized, getAuthorized,
getUserListCount, getUserListCount,
......
...@@ -3,8 +3,9 @@ const http = new Request(); ...@@ -3,8 +3,9 @@ const http = new Request();
const install = (Vue, vm) => { const install = (Vue, vm) => {
http.setConfig(config => { http.setConfig(config => {
// config.baseURL = 'https://api.charleskeith.cn' // config.baseURL = 'https://api.charleskeith.cn' // 正式环境
config.baseURL = 'http://192.168.138.55:8081' // config.baseURL = 'http://47.101.191.49:8083' // 外网测试环境
config.baseURL = 'http://192.168.138.55:8081' // 测试环境
config.custom = { config.custom = {
loading: true loading: true
}, },
......
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
{ {
"path": "pages/index/index", "path": "pages/index/index",
"style": { "style": {
"navigationBarTitleText": "首页" "navigationBarTitleText": "首页",
"enablePullDownRefresh": true
} }
}, { }, {
"path": "pages/center/index", "path": "pages/center/index",
...@@ -59,6 +60,25 @@ ...@@ -59,6 +60,25 @@
} }
} }
,{
"path" : "pages/reports/reports",
"style" :
{
"navigationBarTitleText": "小程序报表",
"enablePullDownRefresh": true,
"onReachBottomDistance": 50
}
}
,{
"path" : "pages/reports/detail",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": true
}
}
], ],
"globalStyle": { "globalStyle": {
"navigationBarTextStyle": "black", "navigationBarTextStyle": "black",
...@@ -76,6 +96,11 @@ ...@@ -76,6 +96,11 @@
"iconPath": "static/icon/user_report_normal.png", "iconPath": "static/icon/user_report_normal.png",
"selectedIconPath": "static/icon/user_report_selected.png", "selectedIconPath": "static/icon/user_report_selected.png",
"text": "实时数据" "text": "实时数据"
}, {
"pagePath": "pages/reports/reports",
"iconPath": "static/icon/admin_normal.png",
"selectedIconPath": "static/icon/admin_selected.png",
"text": "报表"
}, { }, {
"pagePath": "pages/center/index", "pagePath": "pages/center/index",
"iconPath": "static/icon/admin_normal.png", "iconPath": "static/icon/admin_normal.png",
......
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
}, },
onLoad() { onLoad() {
this.userAuthCheck() this.userAuthCheck()
this.getReportList() this.getReportCharts()
/** /**
* 组件交互 - 参数 * 组件交互 - 参数
*/ */
...@@ -146,9 +146,9 @@ ...@@ -146,9 +146,9 @@
/** /**
* 获取页面报表配置 * 获取页面报表配置
*/ */
async getReportList() { async getReportCharts() {
clearInterval(this.timename) clearInterval(this.timename)
let res = await this.$u.api.getReportList({id: '61cd2ba1c06bffbdae442c4f'}) let res = await this.$u.api.getReportCharts({id: '61cd2ba1c06bffbdae442c4f'})
const { Status, Result: { info, list } } = res.data const { Status, Result: { info, list } } = res.data
if (Status === 'true') { if (Status === 'true') {
if(info.dataUrl) { if(info.dataUrl) {
...@@ -198,6 +198,9 @@ ...@@ -198,6 +198,9 @@
}, },
onReachBottom() { onReachBottom() {
},
onPullDownRefresh() {
this.getReportCharts()
} }
} }
</script> </script>
......
<template>
<view>
<u-waterfall v-model="reportList">
<template v-slot:left="{leftList}">
<view class="water-list" v-for="(item, index) in leftList" :key="index" @click="onClick(item)">
<u-lazy-load class="water-image" img-mode="aspectFit" threshold="-450" height="150" border-radius="10" :image="item.previewImg" :index="index"></u-lazy-load>
<view class="water-name">
{{item.name}}
</view>
<view class="water-name">
{{item.updateTime}}
</view>
</view>
</template>
<template v-slot:right="{rightList}">
<view class="water-list" v-for="(item, index) in rightList" :key="index" @click="onClick(item)">
<u-lazy-load class="water-image" img-mode="aspectFit" threshold="-450" height="150" border-radius="10" :image="item.previewImg" :index="index"></u-lazy-load>
<view class="water-name">
{{item.name}}
</view>
<view class="water-name">
{{item.updateTime}}
</view>
</view>
</template>
</u-waterfall>
</view>
</template>
<script>
export default {
data() {
return {
reportList: [],
params: {
pageNumber: 1,
pageSize: 10,
totalPages: 0,
totals: 0,
folderId: '61cd45a8c06bffbdae442d09',
superAdmin: true
}
}
},
onLoad() {
this.getReportList()
},
methods: {
/**
* 获取页面报表配置
*/
async getReportList() {
let res = await this.$u.api.getReportList(this.params)
const { Status, Result } = res.data
if (Status === 'true') {
if(this.params.pageNumber === 1) {
this.reportList = Result.content
} else {
this.reportList = this.reportList.concat(Result.content)
}
this.params.totals = Result.total
this.params.totalPages = Result.totalPages
}
},
// 点击查看
onClick(item) {
const url = "/pages/reports/detail?id=" + item.id
uni.navigateTo({
url: url
})
}
},
onPullDownRefresh() {
this.getReportList()
},
onReachBottom() {
if(this.params.pageNumber < this.params.totalPages) {
this.params.pageNumber += 1
this.getReportList()
}
}
}
</script>
<style>
/* page不能写带scope的style标签中,否则无效 */
page {
background-color: rgb(240, 240, 240);
}
</style>
<style lang="scss" scoped>
.water-list {
border-radius: 8px;
margin: 5px;
background-color: #ffffff;
padding: 8px;
position: relative;
}
.water-image {
width: 100%;
border-radius: 4px;
}
.water-name {
font-size: 30rpx;
margin-top: 5px;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment