From 63c9a970c11603df2a67da674c26933063042f58 Mon Sep 17 00:00:00 2001 From: lcc Date: Sat, 2 Nov 2024 17:51:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=94=E8=BE=B9=E5=BD=A2?= =?UTF-8?q?=E8=AF=84=E5=88=86=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- commons/js/config.js | 1 + commons/js/utils/apiQuery.js | 6 ++ pages/score/index.js | 109 ++++++++++++++++++++++------------- pages/score/index.wxml | 10 ++-- 4 files changed, 81 insertions(+), 45 deletions(-) diff --git a/commons/js/config.js b/commons/js/config.js index 8ae72c4..e4a7872 100644 --- a/commons/js/config.js +++ b/commons/js/config.js @@ -188,6 +188,7 @@ api = { appScoreLists: "app/score/lists", //运营分排行 appScoreDetail: "app/score/detail", //运营分详情 + appRadar: "app/score/radar", //雷达图数据 } //远程图片存储地址 diff --git a/commons/js/utils/apiQuery.js b/commons/js/utils/apiQuery.js index de58b52..d1829ed 100644 --- a/commons/js/utils/apiQuery.js +++ b/commons/js/utils/apiQuery.js @@ -1080,5 +1080,11 @@ apiQuery.appScoreDetail = function(params){ HttpRequest(false, Config.api.appScoreDetail, 2, params, "GET", resolve, reject) }) } +//雷达图 +apiQuery.appRadar = function(params){ + return new Promise(function (resolve, reject) { + HttpRequest(false, Config.api.appRadar, 2, params, "GET", resolve, reject) + }) +} export default apiQuery; \ No newline at end of file diff --git a/pages/score/index.js b/pages/score/index.js index dcfc288..74672ec 100644 --- a/pages/score/index.js +++ b/pages/score/index.js @@ -3,13 +3,14 @@ import _ from '../../commons/js/commons' import * as echarts from '../../ecCanvas/components/ec-canvas/echarts'; const app = getApp() let lineChartData = {}; + function lineChart(canvas, width, height, dpr) { const chart = echarts.init(canvas, null, { width: width, height: height, devicePixelRatio: dpr // new }); - console.log('chart,',chart) + console.log('chart,', chart) canvas.setChart(chart); let option = lineChartData chart.setOption(option); @@ -61,7 +62,7 @@ Page({ setid: '', is_biz: 0, //是否选择门店跳转过来 scoreData: [], - showLineChart: false,//是否显示Line图表 + showLineChart: false, //是否显示Line图表 ecLine: { onInit: lineChart }, @@ -93,7 +94,8 @@ Page({ }, itemStyle: { color: 'rgba(49,203,173,1)' - } + }, + score_role_cur: 0 } }, @@ -101,29 +103,34 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad(options) { - wx.setNavigationBarTitle({ - 'title': '个人运营分' - }) for (let key in options) { this.setData({ [key]: options[key] }) } + let _title = '个人运营分' + if (options['is_biz'] === '1') { + _title = '门店运营分' + } + wx.setNavigationBarTitle({ + 'title': _title + }) }, /** * 生命周期函数--监听页面初次渲染完成 */ - onReady() { - this.getChartsData() - }, + onReady() {}, /** * 生命周期函数--监听页面显示 */ onShow() { + this.getUserInfo() this.getScore() - this.getScoreLists() + if (this.data.is_biz === '1') { + this.getChartsData() + } }, /** @@ -161,7 +168,7 @@ Page({ }, - getChartsData(){ + getChartsData() { lineChartData = { backgroundColor: "#ffffff", xAxis: { @@ -178,45 +185,46 @@ Page({ } }, indicator: [{ - name: '食品', - max: 500 - }, - { - name: '玩具', - max: 500 - }, - { - name: '服饰', - max: 500 - }, - { - name: '绘本', - max: 500 - }, - { - name: '医疗', - max: 500 - } + name: '拓客能力', + max: 100 + }, + { + name: '跟进能力', + max: 100 + }, + { + name: '邀约能力', + max: 100 + }, + { + name: '成交能力', + max: 100 + }, + { + name: '交付能力', + max: 100 + } ] }, series: [{ name: '标题', type: 'radar', data: [{ - value: [430, 340, 500, 300, 490], + value: [0, 0, 0, 0, 0], name: '预算', ...this.data.chartOrangeStyle //...this.data.chartGreenStyle }] }] }; - setTimeout(() => { - // lineChart - this.setData({ - showLineChart:true, - ['ecLine.onInit']:lineChart, + let params = {} + _.apiQuery.appRadar(params).then(res => { + lineChartData.radar.indicator = res.data.indicator + lineChartData.series[0].data[0].value = res.data.series_value + this.setData({ + showLineChart: true, + ['ecLine.onInit']: lineChart, }) - }, 1000); - + }) }, scrollToRule() { @@ -233,9 +241,13 @@ Page({ //时间切换 changeDateTab(e) { this.setData({ - tab_date_cur: parseInt(e.currentTarget.dataset.index), - tab_rank_cur: 0 + tab_date_cur: parseInt(e.currentTarget.dataset.index) }) + if (this.data.userInfo.group_id === 1 || this.data.userInfo.group_id === 2) { + this.setData({ + tab_rank_cur: 1 + }) + } this.getScore() this.getScoreLists() }, @@ -270,5 +282,20 @@ Page({ rank_data: res.data.lists, }) }) - } + }, + //获取用户信息 + getUserInfo() { + _.apiQuery.getUserInfo().then(res => { + this.setData({ + userInfo: res + }) + if (res.group_id > 2) { + this.setData({ + score_role_cur: 1, + tab_rank_cur: 1 + }) + } + this.getScoreLists() + }); + }, }) \ No newline at end of file diff --git a/pages/score/index.wxml b/pages/score/index.wxml index 838bc4c..4d55af0 100644 --- a/pages/score/index.wxml +++ b/pages/score/index.wxml @@ -9,7 +9,7 @@ {{item.name}} - + 规则说明 @@ -53,9 +53,11 @@ - + + 店内排名 + 门店排名 @@ -76,7 +78,7 @@ - +