feat:优化

This commit is contained in:
lijianzhong 2024-02-29 17:31:11 +08:00
parent 0c6a42aa64
commit 915452ef49
6 changed files with 43 additions and 130 deletions

3
app.js
View File

@ -55,7 +55,8 @@ App({
}, },
// 文件服务器地址 // 文件服务器地址
FILE_SERVER_URL: "http://42.193.40.239:8888", //查看 FILE_SERVER_URL: "http://192.168.110.186", //查看
// FILE_SERVER_URL: "http://42.193.40.239:8888", //查看
FILE_SERVER_UP_URL: "http://42.193.40.239:8017/", //上传 FILE_SERVER_UP_URL: "http://42.193.40.239:8017/", //上传
// 文件类型 // 文件类型

View File

@ -1,5 +1,5 @@
<!--pages/msg/push/index.wxml--> <!--pages/msg/push/index.wxml-->
<title-bar title="突发事件上报"></title-bar> <title-bar title="指挥体系"></title-bar>
<scroll-view scroll-y refresher-enabled style="height: calc(100vh - {{topBarH}}px);"> <scroll-view scroll-y refresher-enabled style="height: calc(100vh - {{topBarH}}px);">
<view class="item"> <view class="item">
<!-- 时间 --> <!-- 时间 -->

View File

@ -1,117 +1,5 @@
import * as echarts from '../../ec-canvas/echarts';
import {
getMonthStartEnd,
formatTime
} from '../../utils/util'
let chart = null;
const app = getApp() const app = getApp()
/**
* 获取像素比
*/
const getPixelRatio = () => {
let pixelRatio = 0
wx.getSystemInfo({
success: function (res) {
pixelRatio = res.pixelRatio
},
fail: function () {
pixelRatio = 0
}
})
return pixelRatio
}
/**
* 设置echarts
*/
function initChart(data) {
if (chart == null) return
chart.init((canvas, width, height) => {
var dpr = getPixelRatio();
const chart = echarts.init(canvas, null, {
width: width,
height: height,
devicePixelRatio: dpr
});
canvas.setChart(chart);
var colorList = ["#FF9C00", "#FF4E00", "#2678FF"]
var dataList = [data.resolving || 1, data.unresolved || 1, data.resolved || 1];
var totalNum = data.dangerTotal || -1;
var seriesList = []
dataList.forEach((item, index) => {
var obj = {
value: Math.floor(item / totalNum * 100),
}
seriesList.push({
type: 'bar',
data: [obj],
stack: 'one',
roundCap: true,
coordinateSystem: 'polar',
itemStyle: {
normal: {
color: colorList[index],
borderWidth: 2,
borderColor: colorList[index]
}
},
})
})
const option = {
title: [{
text: '{num|' + (totalNum < 0 ? 0 : totalNum) + '}',
x: '48%',
y: '35%',
textAlign: 'center',
textStyle: {
rich: {
num: {
fontSize: 28,
fontWeight: 'bold',
lineHeight: 40,
color: '#000000'
},
}
},
}],
grid: {
bottom: '0%'
},
angleAxis: {
max: 100,
clockwise: true, // 逆时针
show: false
},
radiusAxis: {
type: 'category',
show: true,
axisLabel: {
show: false,
},
axisLine: {
show: false,
},
axisTick: {
show: false
},
},
polar: {
center: ['50%', '50%'],
radius: ['70%', '90%'],
},
series: seriesList
};
chart.clear();
chart.setOption(option);
return chart;
})
}
Page({ Page({
data: { data: {
baseImgUrl: app.FILE_SERVER_URL, baseImgUrl: app.FILE_SERVER_URL,
@ -220,7 +108,7 @@ Page({
}, },
{ {
icon: "icon_yj_2", icon: "icon_yj_2",
name: "事件上报", name: "指挥体系",
href: "/pages/emergency/s-b/index/index" href: "/pages/emergency/s-b/index/index"
}, },
{ {
@ -231,12 +119,7 @@ Page({
], ],
// 公告 // 公告
notice: [ notice: [],
'https://mmbiz.qpic.cn/mmbiz_jpg/QFxgibMOdV09EdiaTK8M4z7EWPD0kor6RkRibJ9Zfte1GtdQyeTY7zMCeXnMd8LPeGHOX1icWcSB4C9BmdSia5Tjxpw/640?wx_fmt=jpeg&wxfrom=5&wx_lazy=1&wx_co=1',
'https://mmbiz.qpic.cn/mmbiz_png/QFxgibMOdV09NttuUu5jDN3YSKC2vRS8A3Yr35STiaibKwzGPAmvZr9dcqtqrSVFCph7jA0HL7T4JXhfOwMqRWI7A/640?wx_fmt=png&wxfrom=5&wx_lazy=1&wx_co=1',
'https://mmbiz.qpic.cn/mmbiz_png/QFxgibMOdV09enRGm9zrUxjTib9ibyfjY87diafrU5AljEONticxlcdzgS4ebQhQpNxeeHWTC9PjkjR0srSFvYria1Tw/640?wx_fmt=png&wxfrom=5&wx_lazy=1&wx_co=1',
'https://mmbiz.qpic.cn/mmbiz_png/QFxgibMOdV0icADgOhoofBPu01aYr9SrF1oHicDlckKibzKoEMneNibcNgsNXmmEX4jlTmVbSYMFuz4zYfVfNK20e8w/640?wx_fmt=png&wxfrom=5&wx_lazy=1&wx_co=1'
],
showPop: false, showPop: false,
msgData: null, msgData: null,
@ -262,14 +145,15 @@ Page({
* 获取banner * 获取banner
*/ */
getBanner: function () { getBanner: function () {
app.axios("GET", "app", "/work/wkDynamicsPage", { app.axios("GET", "app", "/notice/lastFourNotice", {
page: 1, page: 1,
limit: 4, limit: 4,
userId: app.globalData.userInfo.userId userId: app.globalData.userInfo.userId
}, false).then(res => { }, false).then(res => {
wx.stopPullDownRefresh();
if (res.code == 1) { if (res.code == 1) {
// this.data.notice = res.data.list; this.data.notice = res.data;
// this.setData(this.data) this.setData(this.data)
} }
}) })
}, },
@ -280,7 +164,10 @@ Page({
}, },
onReady() { onReady() {
chart = this.selectComponent('#d-chart')
this.setData(this.data)
}, },
onPullDownRefresh() {
this.getBanner();
}
}) })

View File

@ -10,7 +10,8 @@
<!-- 消息 --> <!-- 消息 -->
<swiper class="item-bg swiper-msg" autoplay indicator-dots indicator-active-color='#ffffff'> <swiper class="item-bg swiper-msg" autoplay indicator-dots indicator-active-color='#ffffff'>
<swiper-item class="item" wx:for="{{notice}}" wx:key="{{item}}"> <swiper-item class="item" wx:for="{{notice}}" wx:key="{{item}}">
<image class="img" src="{{item}}" mode="widthFix"></image> <image class="img" src="{{baseImgUrl+item.coverImg}}" mode="widthFix"></image>
<text class="title ellipsis">{{item.title}}</text>
</swiper-item> </swiper-item>
</swiper> </swiper>
<!-- 数据统计 --> <!-- 数据统计 -->

View File

@ -1,4 +1,16 @@
/**index.wxss**/ /**index.wxss**/
.wx-swiper-dots .wx-swiper-dot {
width: 40rpx;
height: 10rpx;
border-radius: 4rpx;
}
.wx-swiper-dots.wx-swiper-dots-horizontal {
bottom: 80rpx;
width: 90%;
text-align: left;
}
.top { .top {
width: 100vw; width: 100vw;
height: 380rpx; height: 380rpx;
@ -53,8 +65,7 @@
padding: 0 32rpx; padding: 0 32rpx;
margin: 0 20rpx; margin: 0 20rpx;
margin-top: 20rpx; margin-top: 20rpx;
background: #FFFFFF; box-shadow: 0rpx 2rpx 2rpx 0rpx #E5E5E5;
box-shadow: 0rpx 2rpx 8rpx 2rpx #E5E5E5;
border-radius: 12rpx; border-radius: 12rpx;
} }
@ -88,6 +99,7 @@
width: 100%; width: 100%;
height: 100%; height: 100%;
border-radius: 12rpx; border-radius: 12rpx;
position: relative;
} }
.swiper-msg .img { .swiper-msg .img {
@ -95,6 +107,18 @@
height: 100%; height: 100%;
} }
.swiper-msg .item .title {
background-color: rgba(0, 0, 0, 0.5);
position: absolute;
bottom: 0;
z-index: 1;
left: 0;
right: 0;
color: white;
padding: 15rpx 20rpx;
font-size: 28rpx;
}
.item-bg .title { .item-bg .title {
padding-top: 20rpx; padding-top: 20rpx;
} }

View File

@ -1,3 +1,3 @@
<!--pages/web/index.wxml--> <!--pages/web/index.wxml-->
<web-view wx:if="{{url}}" src="{{url}}" /> <web-view wx:if="{{url}}" src="{{url}}" />
<text wx:else>{{title}}{{title}}{{title}}{{title}}</text> <rich-text wx:else />