|
|
@ -1,43 +1,56 @@ |
|
|
|
import { bannerList, getAllSituation, getSurvey, getToken, getIndexPanelV2 } from '../../api/index' |
|
|
|
import { checkUpdateAvatar, updateAvatar } from '../../api/clerkOnline' |
|
|
|
import { logout } from '../../api/setUp' |
|
|
|
// import * as echarts from '../../components/ec-canvas/echarts.js'
|
|
|
|
// @ts-ignore
|
|
|
|
import * as echarts from '../../components/ec-canvas/echarts.js' |
|
|
|
|
|
|
|
// function setOption(chart: any, chartData: AnyArray, color: AnyArray) {
|
|
|
|
// const option = {
|
|
|
|
// color: color,
|
|
|
|
// series: [
|
|
|
|
// {
|
|
|
|
// type: 'pie',
|
|
|
|
// radius: ['70%', '95%'],
|
|
|
|
// silent: true,
|
|
|
|
// avoidLabelOverlap: false,
|
|
|
|
// label: {
|
|
|
|
// show: false
|
|
|
|
// },
|
|
|
|
// labelLine: {
|
|
|
|
// show: false,
|
|
|
|
// normal: {
|
|
|
|
// show: false
|
|
|
|
// }
|
|
|
|
// },
|
|
|
|
// itemStyle: {
|
|
|
|
// borderColor: '#fff',
|
|
|
|
// borderWidth: '2',
|
|
|
|
// },
|
|
|
|
// data: chartData
|
|
|
|
// }
|
|
|
|
// ]
|
|
|
|
// }
|
|
|
|
// chart.setOption(option)
|
|
|
|
// }
|
|
|
|
function setOption(chart: any, chartData: AnyArray, color: AnyArray , Total:Object) { |
|
|
|
const option = { |
|
|
|
color: color, |
|
|
|
title: { |
|
|
|
// @ts-ignore
|
|
|
|
text: Total.issueTotal ? Total.issueTotal : Total.userTotal, |
|
|
|
left: "center", |
|
|
|
top: 'center', |
|
|
|
textStyle: { |
|
|
|
color: "#333333", |
|
|
|
fontSize: 15, |
|
|
|
align: "center", |
|
|
|
fontWeight: '800' |
|
|
|
} |
|
|
|
}, |
|
|
|
series: [ |
|
|
|
{ |
|
|
|
type: 'pie', |
|
|
|
radius: ['70%', '95%'], |
|
|
|
silent: true, |
|
|
|
avoidLabelOverlap: false, |
|
|
|
label: { |
|
|
|
show: false |
|
|
|
}, |
|
|
|
labelLine: { |
|
|
|
show: false, |
|
|
|
normal: { |
|
|
|
show: false |
|
|
|
} |
|
|
|
}, |
|
|
|
itemStyle: { |
|
|
|
borderColor: '#fff', |
|
|
|
borderWidth: '2', |
|
|
|
}, |
|
|
|
data: chartData |
|
|
|
} |
|
|
|
] |
|
|
|
} |
|
|
|
chart.setOption(option) |
|
|
|
} |
|
|
|
Page({ |
|
|
|
data: { |
|
|
|
indexPanel: [], |
|
|
|
banner: [], |
|
|
|
indicatorDots: false,//指示点
|
|
|
|
autoplay: false,//true,//自动播放
|
|
|
|
circular: false,//衔接滑动
|
|
|
|
autoplay: true,//true,//自动播放
|
|
|
|
circular: true,//衔接滑动
|
|
|
|
interval: 2000, //自动播放间隔时长(ms)
|
|
|
|
duration: 500,//幻灯片切换时长(ms)
|
|
|
|
currentSwiper: 0, |
|
|
@ -77,7 +90,9 @@ Page({ |
|
|
|
await this.getBannerList() |
|
|
|
await this.getAllSituation() |
|
|
|
await this.getSurvey() |
|
|
|
// @ts-ignore
|
|
|
|
this.ecComponentA = this.selectComponent('#mychart-dom-bar-a') |
|
|
|
// @ts-ignore
|
|
|
|
this.ecComponentB = this.selectComponent('#mychart-dom-bar-b') |
|
|
|
}, |
|
|
|
/** |
|
|
@ -307,11 +322,33 @@ Page({ |
|
|
|
deptId: ''//wx.getStorageSync('childrenID')
|
|
|
|
} |
|
|
|
getAllSituation(params).then((res: any) => { |
|
|
|
// (res.data.list.unpassedProject / 10000).toFixed(2)
|
|
|
|
that.setData({ |
|
|
|
allSituation: res.data |
|
|
|
allSituation: res.data, |
|
|
|
chartDataB: [ |
|
|
|
{ |
|
|
|
// @ts-ignore
|
|
|
|
value: res.data.partyNumber, |
|
|
|
// @ts-ignore
|
|
|
|
name: '党员总数' |
|
|
|
}, |
|
|
|
{ |
|
|
|
// @ts-ignore
|
|
|
|
value: res.data.userNumber, |
|
|
|
// @ts-ignore
|
|
|
|
name: '居民总数' |
|
|
|
} |
|
|
|
], |
|
|
|
// @ts-ignore
|
|
|
|
colorB: ['#E84D4B', '#FFBC29'] |
|
|
|
}) |
|
|
|
that.init_b() |
|
|
|
}) |
|
|
|
// getAllSituation(params).then((res: any) => {
|
|
|
|
// // (res.data.list.unpassedProject / 10000).toFixed(2)
|
|
|
|
// that.setData({
|
|
|
|
// allSituation: res.data
|
|
|
|
// })
|
|
|
|
// })
|
|
|
|
}, |
|
|
|
|
|
|
|
//数据分析小程序首页接口-议题接口
|
|
|
@ -320,13 +357,35 @@ Page({ |
|
|
|
let params = { |
|
|
|
deptId: ''//wx.getStorageSync('childrenID')
|
|
|
|
} |
|
|
|
// issueTotal: 0,//议题总数
|
|
|
|
// unpassedProject: 0,//未转项目
|
|
|
|
// passedProject: 0,//已转项目
|
|
|
|
getSurvey(params).then((res: any) => { |
|
|
|
that.setData({ |
|
|
|
survey: res.data.list, |
|
|
|
chartDataA: [ |
|
|
|
{ |
|
|
|
// @ts-ignore
|
|
|
|
value: res.data.list.unpassedProject, |
|
|
|
// @ts-ignore
|
|
|
|
name: '未转项目' |
|
|
|
}, |
|
|
|
{ |
|
|
|
// @ts-ignore
|
|
|
|
value: res.data.list.passedProject, |
|
|
|
// @ts-ignore
|
|
|
|
name: '已转项目' |
|
|
|
} |
|
|
|
], |
|
|
|
// @ts-ignore
|
|
|
|
colorA: ['#3B85E7', '#5EC095'] |
|
|
|
}) |
|
|
|
that.init_a() |
|
|
|
}) |
|
|
|
// issueTotal: 0,//议题总数
|
|
|
|
// unpassedProject: 0,//未转项目
|
|
|
|
// passedProject: 0,//已转项目
|
|
|
|
// getSurvey(params).then((res: any) => {
|
|
|
|
// that.setData({
|
|
|
|
// survey: res.data.list,
|
|
|
|
// })
|
|
|
|
|
|
|
|
// if (that.data.survey.issueTotal > 9999) {
|
|
|
|
// that.setData({
|
|
|
@ -351,31 +410,32 @@ Page({ |
|
|
|
// }
|
|
|
|
// })
|
|
|
|
// };
|
|
|
|
}) |
|
|
|
// })
|
|
|
|
|
|
|
|
}, |
|
|
|
// init_a() {
|
|
|
|
// // @ts-ignore
|
|
|
|
// this.ecComponentA.init((canvas: any, width: any, height: any) => {
|
|
|
|
// const chart = echarts.init(canvas, null, {
|
|
|
|
// width: width,
|
|
|
|
// height: height
|
|
|
|
// })
|
|
|
|
// setOption(chart, this.data.chartDataA, this.data.colorA)
|
|
|
|
// return chart
|
|
|
|
// })
|
|
|
|
// },
|
|
|
|
init_a() { |
|
|
|
// @ts-ignore
|
|
|
|
this.ecComponentA.init((canvas: any, width: any, height: any) => { |
|
|
|
const chart = echarts.init(canvas, null, { |
|
|
|
width: width, |
|
|
|
height: height |
|
|
|
}) |
|
|
|
setOption(chart, this.data.chartDataA, this.data.colorA, this.data.survey) |
|
|
|
return chart |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// init_b() {
|
|
|
|
// this.ecComponentB.init((canvas: any, width: any, height: any) => {
|
|
|
|
// const chart = echarts.init(canvas, null, {
|
|
|
|
// width: width,
|
|
|
|
// height: height
|
|
|
|
// })
|
|
|
|
// setOption(chart, this.data.chartDataB, this.data.colorB)
|
|
|
|
// return chart
|
|
|
|
// })
|
|
|
|
// },
|
|
|
|
init_b() { |
|
|
|
// @ts-ignore
|
|
|
|
this.ecComponentB.init((canvas: any, width: any, height: any) => { |
|
|
|
const chart = echarts.init(canvas, null, { |
|
|
|
width: width, |
|
|
|
height: height |
|
|
|
}) |
|
|
|
setOption(chart, this.data.chartDataB, this.data.colorB, this.data.allSituation) |
|
|
|
return chart |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 判断登录
|
|
|
|
refreshToken() { |
|
|
@ -384,6 +444,7 @@ Page({ |
|
|
|
success(res) { |
|
|
|
let wxCode = res.code |
|
|
|
if (wxCode) { |
|
|
|
// @ts-ignore
|
|
|
|
getToken(wxCode).then(function (res: { data: { registerState: string; token: any; userTagKey: any; deptDataScopeList: any } }) { |
|
|
|
if (res.data.registerState == '0') { |
|
|
|
wx.redirectTo({ |
|
|
@ -411,7 +472,9 @@ Page({ |
|
|
|
await this.getBannerList() |
|
|
|
await this.getAllSituation() |
|
|
|
await this.getSurvey() |
|
|
|
// @ts-ignore
|
|
|
|
this.ecComponentA = this.selectComponent('#mychart-dom-bar-a') |
|
|
|
// @ts-ignore
|
|
|
|
this.ecComponentB = this.selectComponent('#mychart-dom-bar-b') |
|
|
|
wx.stopPullDownRefresh(); |
|
|
|
}, |
|
|
|