liuzhihui лет назад: 2
Родитель
Сommit
f2e4e55858
20 измененных файлов с 1911 добавлено и 26 удалено
  1. 1 1
      CallCenterWeb.UI/RMYY/src/views/comDispatch/components/dispatchdetail.vue
  2. 2 1
      CallCenterWeb.UI/RMYY/src/views/comDispatch/scheduleList/index.vue
  3. 0 18
      CallCenterWeb.UI/RMYYAPP/components/echarts/echarts.min.js
  4. 4 3
      CallCenterWeb.UI/RMYYAPP/main.js
  5. 1 0
      CallCenterWeb.UI/RMYYAPP/package.json
  6. 2 1
      CallCenterWeb.UI/RMYYAPP/pages/myTask/Hardware/Hardware.vue
  7. 3 2
      CallCenterWeb.UI/RMYYAPP/pages/myTask/reportForm/reportForm.vue
  8. 153 0
      CallCenterWeb.UI/RMYYAPP/uni_modules/lime-echart/changelog.md
  9. 380 0
      CallCenterWeb.UI/RMYYAPP/uni_modules/lime-echart/components/l-echart/canvas.js
  10. 462 0
      CallCenterWeb.UI/RMYYAPP/uni_modules/lime-echart/components/l-echart/l-echart.vue
  11. 35 0
      CallCenterWeb.UI/RMYYAPP/uni_modules/lime-echart/components/l-echart/nvue.js
  12. 126 0
      CallCenterWeb.UI/RMYYAPP/uni_modules/lime-echart/components/l-echart/utils.js
  13. 103 0
      CallCenterWeb.UI/RMYYAPP/uni_modules/lime-echart/components/lime-echart/lime-echart.vue
  14. 88 0
      CallCenterWeb.UI/RMYYAPP/uni_modules/lime-echart/package.json
  15. 42 0
      CallCenterWeb.UI/RMYYAPP/uni_modules/lime-echart/pnpm-lock.yaml
  16. 318 0
      CallCenterWeb.UI/RMYYAPP/uni_modules/lime-echart/readme.md
  17. 1 0
      CallCenterWeb.UI/RMYYAPP/uni_modules/lime-echart/static/ecStat.min.js
  18. 60 0
      CallCenterWeb.UI/RMYYAPP/uni_modules/lime-echart/static/echarts.min.js
  19. 129 0
      CallCenterWeb.UI/RMYYAPP/uni_modules/lime-echart/static/index.html
  20. 1 0
      CallCenterWeb.UI/RMYYAPP/uni_modules/lime-echart/static/uni.webview.1.5.3.js

+ 1 - 1
CallCenterWeb.UI/RMYY/src/views/comDispatch/components/dispatchdetail.vue

@@ -12,7 +12,7 @@
12 12
                 <span v-if="orderDetailData.StateName" class="wostate">{{
13 13
                   orderDetailData.StateName
14 14
                 }}</span>
15
-                <span v-if="orderDetailData.F_UrgeCount > 0" class="wostate">催办{{ orderDetailData.F_UrgeCount }}</span>
15
+                <span v-if="orderDetailData.F_UrgeCount > 0" class="wostate" style="color: #60c136;border: 1px solid #60c136; ">催办{{ orderDetailData.F_UrgeCount }}</span>
16 16
                 <span class="wostate" v-if="orderDetailData.GapTime && orderDetailData.GapTime.indexOf('超时')>=0" style="color: #880000;border: 1px solid #880000; ">超期</span>
17 17
               </h1>
18 18
             </el-col>

+ 2 - 1
CallCenterWeb.UI/RMYY/src/views/comDispatch/scheduleList/index.vue

@@ -31,7 +31,8 @@
31 31
         <template slot-scope="scope">
32 32
           <span style="color: #409eff; cursor: pointer"
33 33
             @click="hadndleOrderCode(scope.row)">{{ scope.row.F_WorkOrderCode }}</span>
34
-          <el-tag v-if="scope.row.F_UrgeCount > 0" type="success">催{{ scope.row.F_UrgeCount }}</el-tag>
34
+          <el-tag v-if="scope.row.F_UrgeCount > 0" style="color: #60c136;border: 1px solid #60c136;background: none;">催办{{ scope.row.F_UrgeCount }}</el-tag>
35
+          <el-tag v-if="scope.row.GapTime && scope.row.GapTime.indexOf('超时')>=0"  style="color: #880000;border: 1px solid #a80000;background: none;">超期</el-tag>
35 36
         </template>
36 37
       </el-table-column>
37 38
       <el-table-column v-if="fieldListFlag.F_WorkOrderCategory" :formatter="formtOrder" prop="F_WorkOrderCategory"

Разница между файлами не показана из-за своего большого размера
+ 0 - 18
CallCenterWeb.UI/RMYYAPP/components/echarts/echarts.min.js


+ 4 - 3
CallCenterWeb.UI/RMYYAPP/main.js

@@ -16,12 +16,13 @@ import $mRouter from '@/utils/router';
16 16
 // import * as dd from 'dingtalk-jsapi'; // 此方式为整体加载,也可按需进行加载
17 17
 import { debuggerModule } from 'uni_modules/imengyu-IMDebuggerWindow/common/debuggerExtern.js'
18 18
 //引入echarts
19
-import echarts from './components/echarts/echarts.min.js'
20
-
19
+// import echarts from './components/echarts/echarts.min.js'
20
+// import echarts from 'echarts'
21
+// Vue.prototype.$echarts = echarts
21 22
 const errorHandler = (err, vm, info) => { 
22 23
   if(debuggerModule) debuggerModule.addVueError(err, vm, info);
23 24
 }
24
-
25
+window.wx = {}//解决tooltip失效问题
25 26
 Vue.config.errorHandler = errorHandler;  
26 27
 // 挂载全局自定义方法
27 28
 Vue.prototype.$mStore = store;

+ 1 - 0
CallCenterWeb.UI/RMYYAPP/package.json

@@ -14,6 +14,7 @@
14 14
   },
15 15
   "dependencies": {
16 16
     "dingtalk-jsapi": "^3.0.20",
17
+    "echarts": "^5.4.2",
17 18
     "jsencrypt": "^3.3.2",
18 19
     "sm-crypto": "^0.3.12"
19 20
   }

+ 2 - 1
CallCenterWeb.UI/RMYYAPP/pages/myTask/Hardware/Hardware.vue

@@ -8,7 +8,8 @@
8 8
 </template>
9 9
 
10 10
 <script>
11
-	import * as echarts from '@/components/echarts/echarts.min.js'; // 引入 echarts
11
+	// import * as echarts from '@/components/echarts/echarts.min.js'; // 引入 echarts
12
+	import * as echarts from 'echarts'
12 13
 	export default {
13 14
 		data() {
14 15
 			return {

+ 3 - 2
CallCenterWeb.UI/RMYYAPP/pages/myTask/reportForm/reportForm.vue

@@ -201,7 +201,8 @@
201 201
 </template>
202 202
 
203 203
 <script>
204
-	import * as echarts from '@/components/echarts/echarts.min.js'; // 引入 echarts
204
+	// import * as echarts from '@/components/echarts/echarts.min.js'; // 引入 echarts
205
+	import * as echarts from 'echarts'
205 206
 	import arprogress from '@/components/ar-circle-progress/index.vue'
206 207
 	export default {
207 208
 		components: {
@@ -496,7 +497,7 @@
496 497
 						left: "center",
497 498
 						bottom: 20,
498 499
 						start: 0,
499
-						end: 2, //初始化滚动条
500
+						end: 10, //初始化滚动条
500 501
 						xAxisIndex: [0]
501 502
 					}],
502 503
 				})

+ 153 - 0
CallCenterWeb.UI/RMYYAPP/uni_modules/lime-echart/changelog.md

@@ -0,0 +1,153 @@
1
+## 0.7.5(2023-05-25)
2
+- chore: 更新文档 和 demo, 使用`lime-echart`这个标签即可查看示例
3
+## 0.7.4(2023-05-22)
4
+- chore: 增加关于钉钉小程序上传时提示安全问题的说明及修改建议
5
+## 0.7.3(2023-05-16)
6
+- chore: 更新 vue3 非微信小程序平台可能缺少`wx`的说明
7
+## 0.7.2(2023-05-16)
8
+- chore: 更新 vue3 非微信小程序平台的可以缺少`wx`的说明
9
+## 0.7.1(2023-04-26)
10
+- chore: 更新demo,使用`lime-echart`这个标签即可查看示例
11
+- chore:微信小程序的`tooltip`文字有阴影,怀疑是微信的锅,临时解决方法是`tooltip.shadowBlur = 0`
12
+## 0.7.0(2023-04-24)
13
+- fix: 修复`setAttribute is not a function`
14
+## 0.6.9(2023-04-15)
15
+- chore: 更新文档,vue3请使用echarts esm的包
16
+## 0.6.8(2023-03-22)
17
+- feat: mac pc无法使用canvas 2d
18
+## 0.6.7(2023-03-17)
19
+- feat: 更新文档
20
+## 0.6.6(2023-03-17)
21
+- feat: 微信小程序PC已经支持canvas 2d,故去掉判断PC
22
+## 0.6.5(2022-11-03)
23
+- fix: 某些手机touches为对象,导致无法交互。
24
+## 0.6.4(2022-10-28)
25
+- fix: 优化点击事件的触发条件
26
+## 0.6.3(2022-10-26)
27
+- fix: 修复 dataZoom 拖动问题
28
+## 0.6.2(2022-10-23)
29
+- fix: 修复 飞书小程序 尺寸问题
30
+## 0.6.1(2022-10-19)
31
+- fix: 修复 PC mousewheel 事件 鼠标位置不准确的BUG,不兼容火狐!
32
+- feat: showLoading 增加传参
33
+## 0.6.0(2022-09-16)
34
+- feat: 增加PC的mousewheel事件
35
+## 0.5.4(2022-09-16)
36
+- fix: 修复 nvue 动态数据不显示问题
37
+## 0.5.3(2022-09-16)
38
+- feat: 增加enableHover属性, 在PC端时当鼠标进入显示tooltip,不必按下。
39
+- chore: 更新文档
40
+## 0.5.2(2022-09-16)
41
+- feat: 增加enableHover属性, 在PC端时当鼠标进入显示tooltip,不必按下。
42
+## 0.5.1(2022-09-16)
43
+- fix: 修复nvue报错
44
+## 0.5.0(2022-09-15)
45
+- feat: init(echarts, theme?:string, opts?:{}, callback: function(chart))
46
+## 0.4.8(2022-09-11)
47
+- feat: 增加 @finished
48
+## 0.4.7(2022-08-24)
49
+- chore: 去掉 stylus
50
+## 0.4.6(2022-08-24)
51
+- feat: 增加 beforeDelay
52
+## 0.4.5(2022-08-12)
53
+- chore: 更新文档
54
+## 0.4.4(2022-08-12)
55
+- fix: 修复 resize 无参数时报错
56
+## 0.4.3(2022-08-07)
57
+# 评论有说本插件对新手不友好,让我做不好就不要发出来。 还有的说跟官网一样,发出来做什么,给我整无语了。
58
+# 所以在此提醒一下准备要下载的你,如果你从未使用过 echarts 请不要下载 或 谨慎下载。
59
+# 如果你确认要下载,麻烦看完文档。还有请注意插件是让echarts在uniapp能运行,API 配置请自行去官网查阅!
60
+# 如果你不会echarts 但又需要图表,市场上有个很优秀的图表插件 uchart 你可以去使用这款插件,uchart的作者人很好,也热情。
61
+# 每个人都有自己的本职工作,如果你能力强可以自行兼容,如果使用了他人的插件也麻烦尊重他人的成果和劳动时间。谢谢。
62
+# 为了心情愉悦,本人已经使用插件屏蔽差评。
63
+- chore: 更新文档
64
+## 0.4.2(2022-07-20)
65
+- feat: 增加 resize
66
+## 0.4.1(2022-06-07)
67
+- fix: 修复 canvasToTempFilePath 不生效问题
68
+## 0.4.0(2022-06-04)
69
+- chore 为了词云 增加一个canvas 标签
70
+- 词云下载地址[echart-wordcloud](https://ext.dcloud.net.cn/plugin?id=8430)
71
+## 0.3.9(2022-06-02)
72
+- chore: 更新文档
73
+- tips: lines 不支持 `trailLength`
74
+## 0.3.8(2022-05-31)
75
+- fix: 修复 因mouse事件冲突tooltip跳动问题
76
+## 0.3.7(2022-05-26)
77
+- chore: 更新文档
78
+- chore: 设置默认宽高300px
79
+- fix: 修复 vue3 微信小程序 拖影BUG
80
+- chore: 支持PC
81
+## 0.3.5(2022-04-28)
82
+- chore: 更新使用方式
83
+- 🔔 必须使用hbuilderx 3.4.8-alpha以上
84
+## 0.3.4(2021-08-03)
85
+- chore: 增加 setOption的参数值
86
+## 0.3.3(2021-07-22)
87
+- fix: 修复 径向渐变报错的问题
88
+## 0.3.2(2021-07-09)
89
+- chore: 统一命名规范,无须主动引入组件
90
+## [代码示例站点1](https://limeui.qcoon.cn/#/echart-example)
91
+## [代码示例站点2](http://liangei.gitee.io/limeui/#/echart-example)
92
+## 0.3.1(2021-06-21)
93
+- fix: 修复 app-nvue ios is-enable 无效的问题
94
+## [代码示例站点1](https://limeui.qcoon.cn/#/echart-example)
95
+## [代码示例站点2](http://liangei.gitee.io/limeui/#/echart-example)
96
+## 0.3.0(2021-06-14)
97
+- fix: 修复 头条系小程序 2d 报 JSON.stringify 的问题
98
+- 目前 头条系小程序 2d 无法在开发工具上预览,划动图表页面无法滚动,axisLabel 字体颜色无法更改,建议使用非2d。
99
+## 0.2.9(2021-06-06)
100
+- fix: 修复 头条系小程序 2d 放大的BUG 
101
+- 头条系小程序 2d 无法在开发工具上预览,也存在划动图表页面无法滚动的问题。
102
+## [代码示例:http://liangei.gitee.io/limeui/#/echart-example](http://liangei.gitee.io/limeui/#/echart-example)
103
+## 0.2.8(2021-05-19)
104
+- fix: 修复 微信小程序 PC 显示过大的问题
105
+## 0.2.7(2021-05-19)
106
+- fix: 修复 微信小程序 PC 不显示问题
107
+## [代码示例:http://liangei.gitee.io/limeui/#/echart-example](http://liangei.gitee.io/limeui/#/echart-example)
108
+## 0.2.6(2021-05-14)
109
+- feat: 支持 `image`
110
+- feat: props 增加 `ec.clear`,更新时是否先删除图表样式 
111
+- feat: props 增加 `isDisableScroll` ,触摸图表时是否禁止页面滚动
112
+- feat: props 增加 `webviewStyles` ,webview 的样式, 仅nvue有效
113
+## 0.2.5(2021-05-13)
114
+- docs: 插件用到了css 预编译器 [stylus](https://ext.dcloud.net.cn/plugin?name=compile-stylus) 请安装它
115
+## 0.2.4(2021-05-12)
116
+- fix: 修复 百度平台 多个图表ctx 和 渐变色 bug
117
+- ## [代码示例:http://liangei.gitee.io/limeui/#/echart-example](http://liangei.gitee.io/limeui/#/echart-example)
118
+## 0.2.3(2021-05-10)
119
+- feat: 增加 `canvasToTempFilePath` 方法,用于生成图片
120
+```js
121
+this.$refs.chart.canvasToTempFilePath({success: (res) => {
122
+	console.log('tempFilePath:', res.tempFilePath)
123
+}})
124
+```
125
+## 0.2.2(2021-05-10)
126
+- feat: 增加 `dispose` 方法,用于销毁实例
127
+- feat: 增加 `isClickable` 是否派发点击
128
+- feat: 实验性的支持 `nvue` 使用要慎重考虑
129
+- ## [代码示例:http://liangei.gitee.io/limeui/#/echart-example](http://liangei.gitee.io/limeui/#/echart-example)
130
+## 0.2.1(2021-05-06)
131
+- fix:修复 微信小程序 json 报错
132
+- chore: `reset` 更改为 `setChart`
133
+- feat: 增加 `isEnable` 开启初始化 启用这个后 无须再使用`init`方法
134
+```html
135
+<l-echart ref="chart" is-enable />
136
+```
137
+```js
138
+// 显示加载
139
+this.$refs.chart.showLoading()
140
+// 使用实例回调
141
+this.$refs.chart.setChart(chart => ...code)
142
+// 直接设置图表配置
143
+this.$refs.chart.setOption(data)
144
+```
145
+## 0.2.0(2021-05-05)
146
+- fix:修复 头条 百度 偏移的问题
147
+- docs: 更新文档
148
+## [代码示例:http://liangei.gitee.io/limeui/#/echart-example](http://liangei.gitee.io/limeui/#/echart-example)
149
+## 0.1.0(2021-05-02)
150
+- chore:  第一次上传,基本全端兼容,使用方法与官网一致。
151
+- 已知BUG:非2d 无法使用背景色,已反馈官方
152
+- 已知BUG:头条 百度 有许些偏移
153
+- 后期计划:兼容nvue

+ 380 - 0
CallCenterWeb.UI/RMYYAPP/uni_modules/lime-echart/components/l-echart/canvas.js

@@ -0,0 +1,380 @@
1
+const cacheChart = {}
2
+const fontSizeReg = /([\d\.]+)px/;
3
+class EventEmit {
4
+	constructor() {
5
+		this.__events = {};
6
+	}
7
+	on(type, listener) {
8
+		if (!type || !listener) {
9
+			return;
10
+		}
11
+		const events = this.__events[type] || [];
12
+		events.push(listener);
13
+		this.__events[type] = events;
14
+	}
15
+	emit(type, e) {
16
+		if (type.constructor === Object) {
17
+			e = type;
18
+			type = e && e.type;
19
+		}
20
+		if (!type) {
21
+			return;
22
+		}
23
+		const events = this.__events[type];
24
+		if (!events || !events.length) {
25
+			return;
26
+		}
27
+		events.forEach((listener) => {
28
+			listener.call(this, e);
29
+		});
30
+	}
31
+	off(type, listener) {
32
+		const __events = this.__events;
33
+		const events = __events[type];
34
+		if (!events || !events.length) {
35
+			return;
36
+		}
37
+		if (!listener) {
38
+			delete __events[type];
39
+			return;
40
+		}
41
+		for (let i = 0, len = events.length; i < len; i++) {
42
+			if (events[i] === listener) {
43
+				events.splice(i, 1);
44
+				i--;
45
+			}
46
+		}
47
+	}
48
+}
49
+class Image {
50
+	constructor() {
51
+		this.currentSrc = null
52
+		this.naturalHeight = 0
53
+		this.naturalWidth = 0
54
+		this.width = 0
55
+		this.height = 0
56
+		this.tagName = 'IMG'
57
+	}
58
+	set src(src) {
59
+		this.currentSrc = src
60
+		uni.getImageInfo({
61
+			src,
62
+			success: (res) => {
63
+				this.naturalWidth = this.width = res.width
64
+				this.naturalHeight = this.height = res.height
65
+				this.onload()
66
+			},
67
+			fail: () => {
68
+				this.onerror()
69
+			}
70
+		})
71
+	}
72
+	get src() {
73
+		return this.currentSrc
74
+	}
75
+}
76
+class OffscreenCanvas {
77
+	constructor(ctx, com, canvasId) {
78
+		this.tagName = 'canvas'
79
+		this.com = com
80
+		this.canvasId = canvasId
81
+		this.ctx = ctx
82
+	}
83
+	set width(w) {
84
+		this.com.offscreenWidth = w
85
+	}
86
+	set height(h) {
87
+		this.com.offscreenHeight = h
88
+	}
89
+	get width() {
90
+		return this.com.offscreenWidth || 0
91
+	}
92
+	get height() {
93
+		return this.com.offscreenHeight || 0
94
+	}
95
+	getContext(type) {
96
+		return this.ctx
97
+	}
98
+	getImageData() {
99
+		return new Promise((resolve, reject) => {
100
+			this.com.$nextTick(() => {
101
+				uni.canvasGetImageData({
102
+					x:0,
103
+					y:0,
104
+					width: this.com.offscreenWidth,
105
+					height: this.com.offscreenHeight,
106
+					canvasId: this.canvasId,
107
+					success: (res) => {
108
+						resolve(res)
109
+					},
110
+					fail: (err) => {
111
+						reject(err)
112
+					},
113
+				}, this.com)
114
+			})
115
+		})
116
+	}
117
+}
118
+export class Canvas {
119
+	constructor(ctx, com, isNew, canvasNode={}) {
120
+		cacheChart[com.canvasId] = {ctx}
121
+		this.canvasId = com.canvasId;
122
+		this.chart = null;
123
+		this.isNew = isNew
124
+		this.tagName = 'canvas'
125
+		this.canvasNode = canvasNode;
126
+		this.com = com;
127
+		if (!isNew) {this._initStyle(ctx)}
128
+		this._initEvent();
129
+		this._ee = new EventEmit()
130
+	}
131
+	getContext(type) {
132
+		if (type === '2d') {
133
+			return this.ctx;
134
+		}
135
+	}
136
+	setAttribute(key, value) {
137
+		if(key === 'aria-label') {
138
+			this.com['ariaLabel'] = value
139
+		}
140
+	}
141
+	setChart(chart) {
142
+		this.chart = chart;
143
+	}
144
+	createOffscreenCanvas(param){
145
+		if(!this.children) {
146
+			this.com.isOffscreenCanvas = true
147
+			this.com.offscreenWidth = param.width||300
148
+			this.com.offscreenHeight = param.height||300
149
+			const com = this.com
150
+			const canvasId = this.com.offscreenCanvasId
151
+			const context = uni.createCanvasContext(canvasId, this.com)
152
+			this._initStyle(context)
153
+			this.children = new OffscreenCanvas(context, com, canvasId)
154
+		} 
155
+		return this.children
156
+	}
157
+	appendChild(child) {
158
+		console.log('child', child)
159
+	}
160
+	dispatchEvent(type, e) {
161
+		if(typeof type == 'object') {
162
+			this._ee.emit(type.type, type);
163
+		} else {
164
+			this._ee.emit(type, e);
165
+		}
166
+		return true
167
+	}
168
+	attachEvent() {
169
+	}
170
+	detachEvent() {
171
+	}
172
+	addEventListener(type, listener) {
173
+		this._ee.on(type, listener)
174
+	}
175
+	removeEventListener(type, listener) {
176
+		this._ee.off(type, listener)
177
+	}
178
+	_initCanvas(zrender, ctx) {
179
+		zrender.util.getContext = function() {
180
+			return ctx;
181
+		};
182
+		zrender.util.$override('measureText', function(text, font) {
183
+			ctx.font = font || '12px sans-serif';
184
+			return ctx.measureText(text, font);
185
+		});
186
+	}
187
+	_initStyle(ctx, child) {
188
+		const styles = [
189
+			'fillStyle',
190
+			'strokeStyle',
191
+			'fontSize',
192
+			'globalAlpha',
193
+			'opacity',
194
+			'textAlign',
195
+			'textBaseline',
196
+			'shadow',
197
+			'lineWidth',
198
+			'lineCap',
199
+			'lineJoin',
200
+			'lineDash',
201
+			'miterLimit',
202
+			'font'
203
+		];
204
+		const colorReg = /#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])\b/g;
205
+		styles.forEach(style => {
206
+			Object.defineProperty(ctx, style, {
207
+				set: value => {
208
+					if (style === 'font' && fontSizeReg.test(value)) {
209
+						const match = fontSizeReg.exec(value);
210
+						ctx.setFontSize(match[1]);
211
+						return;
212
+					}
213
+					if (style === 'opacity') {
214
+						ctx.setGlobalAlpha(value)
215
+						return;
216
+					}
217
+					if (style !== 'fillStyle' && style !== 'strokeStyle' || value !== 'none' && value !== null) {
218
+						// #ifdef H5 || APP-PLUS || MP-BAIDU
219
+						if(typeof value == 'object') {
220
+							if (value.hasOwnProperty('colorStop') || value.hasOwnProperty('colors')) {
221
+								ctx['set' + style.charAt(0).toUpperCase() + style.slice(1)](value);
222
+							}
223
+							return
224
+						} 
225
+						// #endif
226
+						// #ifdef MP-TOUTIAO
227
+						if(colorReg.test(value)) {
228
+							value = value.replace(colorReg, '#$1$1$2$2$3$3')
229
+						}
230
+						// #endif
231
+						ctx['set' + style.charAt(0).toUpperCase() + style.slice(1)](value);
232
+					}
233
+				}
234
+			});
235
+		});
236
+		if(!this.isNew && !child) {
237
+			ctx.uniDrawImage = ctx.drawImage
238
+			ctx.drawImage = (...a) => {
239
+				a[0] = a[0].src
240
+				ctx.uniDrawImage(...a)
241
+			}
242
+		}
243
+		if(!ctx.createRadialGradient) {
244
+			ctx.createRadialGradient = function() {
245
+				return ctx.createCircularGradient(...[...arguments].slice(-3))
246
+			};
247
+		}
248
+		// 字节不支持
249
+		if (!ctx.strokeText) {
250
+			ctx.strokeText = (...a) => {
251
+				ctx.fillText(...a)
252
+			}
253
+		}
254
+		// 钉钉不支持 
255
+		if (!ctx.measureText) {
256
+			const strLen = (str) => {
257
+				let len = 0;
258
+				for (let i = 0; i < str.length; i++) {
259
+					if (str.charCodeAt(i) > 0 && str.charCodeAt(i) < 128) {
260
+						len++;
261
+					} else {
262
+						len += 2;
263
+					}
264
+				}
265
+				return len;
266
+			}
267
+			ctx.measureText = (text, font) => {
268
+				let fontSize = 12;
269
+				if (font) {
270
+					fontSize = parseInt(font.match(/([\d\.]+)px/)[1])
271
+				}
272
+				fontSize /= 2;
273
+				return {
274
+					width: strLen(text) * fontSize
275
+				};
276
+			}
277
+		}
278
+	}
279
+
280
+	_initEvent(e) {
281
+		this.event = {};
282
+		const eventNames = [{
283
+			wxName: 'touchStart',
284
+			ecName: 'mousedown'
285
+		}, {
286
+			wxName: 'touchMove',
287
+			ecName: 'mousemove'
288
+		}, {
289
+			wxName: 'touchEnd',
290
+			ecName: 'mouseup'
291
+		}, {
292
+			wxName: 'touchEnd',
293
+			ecName: 'click'
294
+		}];
295
+
296
+		eventNames.forEach(name => {
297
+			this.event[name.wxName] = e => {
298
+				const touch = e.touches[0];
299
+				this.chart.getZr().handler.dispatch(name.ecName, {
300
+					zrX: name.wxName === 'tap' ? touch.clientX : touch.x,
301
+					zrY: name.wxName === 'tap' ? touch.clientY : touch.y
302
+				});
303
+			};
304
+		});
305
+	}
306
+
307
+	set width(w) {
308
+		this.canvasNode.width = w
309
+	}
310
+	set height(h) {
311
+		this.canvasNode.height = h
312
+	}
313
+
314
+	get width() {
315
+		return this.canvasNode.width || 0
316
+	}
317
+	get height() {
318
+		return this.canvasNode.height || 0
319
+	}
320
+	get ctx() {
321
+		return cacheChart[this.canvasId]['ctx'] || null
322
+	}
323
+	set chart(chart) {
324
+		cacheChart[this.canvasId]['chart'] = chart
325
+	}
326
+	get chart() {
327
+		return cacheChart[this.canvasId]['chart'] || null
328
+	}
329
+}
330
+
331
+export function dispatch(name, {x,y, wheelDelta}) {
332
+	this.dispatch(name, {
333
+		zrX: x,
334
+		zrY: y,
335
+		zrDelta: wheelDelta,
336
+		preventDefault: () => {},
337
+		stopPropagation: () =>{}
338
+	});
339
+}
340
+export function setCanvasCreator(echarts, {canvas, node}) {
341
+	// echarts.setCanvasCreator(() => canvas);
342
+	if(echarts && !echarts.registerPreprocessor) {
343
+		return console.warn('echarts 版本不对或未传入echarts,vue3请使用esm格式')
344
+	}
345
+	echarts.registerPreprocessor(option => {
346
+		if (option && option.series) {
347
+			if (option.series.length > 0) {
348
+				option.series.forEach(series => {
349
+					series.progressive = 0;
350
+				});
351
+			} else if (typeof option.series === 'object') {
352
+				option.series.progressive = 0;
353
+			}
354
+		}
355
+	});
356
+	function loadImage(src, onload, onerror) {
357
+		let img = null
358
+		if(node && node.createImage) {
359
+			img = node.createImage()
360
+			img.onload = onload.bind(img);
361
+			img.onerror = onerror.bind(img);
362
+			img.src = src;
363
+			return img
364
+		} else {
365
+			img = new Image()
366
+			img.onload = onload.bind(img)
367
+			img.onerror = onerror.bind(img);
368
+			img.src = src
369
+			return img
370
+		}
371
+	}
372
+	if(echarts.setPlatformAPI) {
373
+		echarts.setPlatformAPI({
374
+			loadImage: canvas.setChart ? loadImage : null,
375
+			createCanvas(){
376
+				return canvas
377
+			}
378
+		})
379
+	}
380
+}

+ 462 - 0
CallCenterWeb.UI/RMYYAPP/uni_modules/lime-echart/components/l-echart/l-echart.vue

@@ -0,0 +1,462 @@
1
+<template>
2
+	<view class="lime-echart" :style="customStyle" v-if="canvasId" ref="limeEchart" :aria-label="ariaLabel">
3
+		<!-- #ifndef APP-NVUE -->
4
+		<canvas
5
+			class="lime-echart__canvas"
6
+			v-if="use2dCanvas"
7
+			type="2d"
8
+			:id="canvasId"
9
+			:style="canvasStyle"
10
+			:disable-scroll="isDisableScroll"
11
+			@touchstart="touchStart"
12
+			@touchmove="touchMove"
13
+			@touchend="touchEnd"
14
+		/>
15
+		<canvas
16
+			class="lime-echart__canvas"
17
+			v-else-if="isPc"
18
+			:style="canvasStyle"
19
+			:id="canvasId"
20
+			:canvas-id="canvasId"
21
+			:disable-scroll="isDisableScroll"
22
+			@mousedown="touchStart"
23
+			@mousemove="touchMove"
24
+			@mouseup="touchEnd"
25
+		/>
26
+		<canvas
27
+			class="lime-echart__canvas"
28
+			v-else
29
+			:width="nodeWidth"
30
+			:height="nodeHeight"
31
+			:style="canvasStyle"
32
+			:canvas-id="canvasId"
33
+			:id="canvasId"
34
+			:disable-scroll="isDisableScroll"
35
+			@touchstart="touchStart"
36
+			@touchmove="touchMove"
37
+			@touchend="touchEnd"
38
+		/>
39
+		<canvas v-if="isOffscreenCanvas" :style="offscreenStyle" :canvas-id="offscreenCanvasId"></canvas>
40
+		<!-- #endif -->
41
+		<!-- #ifdef APP-NVUE -->
42
+		<web-view
43
+			class="lime-echart__canvas"
44
+			:id="canvasId"
45
+			:style="canvasStyle"
46
+			:webview-styles="webviewStyles"
47
+			ref="webview"
48
+			src="/uni_modules/lime-echart/static/index.html"
49
+			@pagefinish="finished = true"
50
+			@onPostMessage="onMessage"
51
+		></web-view>
52
+		<!-- #endif -->
53
+	</view>
54
+</template>
55
+
56
+<script>
57
+// #ifdef VUE3
58
+// #ifdef APP-PLUS
59
+global = {}
60
+// #endif
61
+// #endif
62
+// #ifndef APP-NVUE
63
+import {Canvas, setCanvasCreator, dispatch} from './canvas';
64
+import {wrapTouch, devicePixelRatio ,sleep, canIUseCanvas2d, getRect} from './utils';
65
+// #endif
66
+// #ifdef APP-NVUE
67
+import { base64ToPath, sleep } from './utils';
68
+import {Echarts} from './nvue'
69
+// #endif
70
+const charts = {}
71
+const echartsObj = {}
72
+export default {
73
+	name: 'lime-echart',
74
+	props: {
75
+		// #ifdef MP-WEIXIN || MP-TOUTIAO
76
+		type: {
77
+			type: String,
78
+			default: '2d'
79
+		},
80
+		// #endif
81
+		// #ifdef APP-NVUE
82
+		webviewStyles: Object,
83
+		// hybrid: Boolean,
84
+		// #endif
85
+		customStyle: String,
86
+		isDisableScroll: Boolean,
87
+		isClickable: {
88
+			type: Boolean,
89
+			default: true
90
+		},
91
+		enableHover: Boolean,
92
+		beforeDelay: {
93
+			type: Number,
94
+			default: 30
95
+		}
96
+	},
97
+	data() {
98
+		return {
99
+			// #ifdef MP-WEIXIN || MP-TOUTIAO || MP-ALIPAY
100
+			use2dCanvas: true,
101
+			// #endif
102
+			// #ifndef MP-WEIXIN || MP-TOUTIAO || MP-ALIPAY
103
+			use2dCanvas: false,
104
+			// #endif
105
+			ariaLabel: '图表',
106
+			width: null,
107
+			height: null,
108
+			nodeWidth: null,
109
+			nodeHeight: null,
110
+			canvasNode: null,
111
+			config: {},
112
+			inited: false,
113
+			finished: false,
114
+			file: '',
115
+			platform: '',
116
+			isPc: false,
117
+			isDown: false,
118
+			isOffscreenCanvas: false,
119
+			offscreenWidth: 0,
120
+			offscreenHeight: 0
121
+		};
122
+	},
123
+	computed: {
124
+		canvasId() {
125
+			return `lime-echart${this._ && this._.uid || this._uid}`
126
+		},
127
+		offscreenCanvasId() {
128
+			return `${this.canvasId}_offscreen`
129
+		},
130
+		offscreenStyle() {
131
+			return `width:${this.offscreenWidth}px;height: ${this.offscreenHeight}px; position: fixed; left: 99999px; background: red`
132
+		},
133
+		canvasStyle() {
134
+			return  this.width && this.height ? ('width:' + this.width + 'px;height:' + this.height + 'px') : ''
135
+		}
136
+	},
137
+	// #ifndef VUE3
138
+	beforeDestroy() {
139
+		this.clear()
140
+		this.dispose()
141
+		// #ifdef H5
142
+		if(this.isPc) {
143
+			document.removeEventListener('mousewheel', this.mousewheel)
144
+		}
145
+		// #endif
146
+	},
147
+	// #endif
148
+	// #ifdef VUE3
149
+	unmounted() {
150
+		this.clear()
151
+		this.dispose()
152
+		// #ifdef H5
153
+		if(this.isPc) {
154
+			document.removeEventListener('mousewheel', this.mousewheel)
155
+		}
156
+		// #endif
157
+	},
158
+	// #endif
159
+	created() {
160
+		// #ifdef H5
161
+		if(!('ontouchstart' in window)) {
162
+			this.isPc = true
163
+			document.addEventListener('mousewheel', this.mousewheel)
164
+		}
165
+		// #endif
166
+		// #ifdef MP-WEIXIN || MP-TOUTIAO || MP-ALIPAY
167
+		const { platform } = uni.getSystemInfoSync();
168
+		this.isPC = /windows/i.test(platform)
169
+		// #endif
170
+		this.use2dCanvas = this.type === '2d' && canIUseCanvas2d()
171
+	},
172
+	mounted() {
173
+		this.$nextTick(() => {
174
+			this.$emit('finished')
175
+		})
176
+	},
177
+	methods: {
178
+		// #ifdef APP-NVUE
179
+		onMessage(e) {
180
+			const res = e?.detail?.data[0] || null;
181
+			if (res?.event) {
182
+				if(res.event === 'inited') {
183
+					this.inited = true
184
+				}
185
+				this.$emit(res.event, JSON.parse(res.data));
186
+			} else if(res?.file){
187
+				this.file = res.data
188
+			} else if(!res[0] && JSON.stringify(res[0]) != '{}'){
189
+				console.error(res);
190
+			} else {
191
+				console.log(...res)
192
+			}
193
+		},
194
+		// #endif
195
+		setChart(callback) {
196
+			if(!this.chart) {
197
+				console.warn(`组件还未初始化,请先使用 init`)
198
+				return
199
+			}
200
+			if(typeof callback === 'function' && this.chart) {
201
+				callback(this.chart);
202
+			}
203
+			// #ifdef APP-NVUE
204
+			if(typeof callback === 'function') {
205
+				this.$refs.webview.evalJs(`setChart(${JSON.stringify(callback.toString())}, ${JSON.stringify(this.chart.options)})`);
206
+			}
207
+			// #endif
208
+		},
209
+		setOption() {
210
+			if (!this.chart || !this.chart.setOption) {
211
+				console.warn(`组件还未初始化,请先使用 init`)
212
+				return
213
+			}
214
+			this.chart.setOption(...arguments);
215
+		},
216
+		showLoading() {
217
+			if(this.chart) {
218
+				this.chart.showLoading(...arguments)
219
+			}
220
+		},
221
+		hideLoading() {
222
+			if(this.chart) {
223
+				this.chart.hideLoading()
224
+			}
225
+		},
226
+		clear() {
227
+			if(this.chart) {
228
+				this.chart.clear()
229
+			}
230
+		},
231
+		dispose() {
232
+			if(this.chart) {
233
+				this.chart.dispose()
234
+			}
235
+		},
236
+		resize(size) {
237
+			if(size && size.width && size.height) {
238
+				this.height = size.height
239
+				this.width = size.width
240
+				if(this.chart) {this.chart.resize(size)}
241
+			} else {
242
+				this.$nextTick(() => {
243
+					uni.createSelectorQuery()
244
+						.in(this)
245
+						.select(`.lime-echart`)
246
+						.boundingClientRect()
247
+						.exec(res => {
248
+							if (res) {
249
+								let { width, height } = res[0];
250
+								this.width = width = width || 300;
251
+								this.height = height = height || 300;
252
+								this.chart.resize({width, height})
253
+							}
254
+						});
255
+				})
256
+				
257
+			}
258
+			
259
+		},
260
+		canvasToTempFilePath(args = {}) {
261
+			// #ifndef APP-NVUE
262
+			const { use2dCanvas, canvasId, canvasNode } = this;
263
+			return new Promise((resolve, reject) => {
264
+				const copyArgs = Object.assign({
265
+					canvasId,
266
+					success: resolve,
267
+					fail: reject
268
+				}, args);
269
+				if (use2dCanvas) {
270
+					delete copyArgs.canvasId;
271
+					copyArgs.canvas = canvasNode;
272
+				}
273
+				uni.canvasToTempFilePath(copyArgs, this);
274
+			});
275
+			// #endif
276
+			// #ifdef APP-NVUE
277
+			this.file = ''
278
+			this.$refs.webview.evalJs(`canvasToTempFilePath()`);
279
+			return new Promise((resolve, reject) => {
280
+				this.$watch('file', async (file) => {
281
+					if(file) {
282
+						const tempFilePath = await base64ToPath(file)
283
+						resolve(args.success({tempFilePath}))
284
+					} else {
285
+						reject(args.fail({error: ``}))
286
+					}
287
+				})
288
+			})
289
+			// #endif
290
+		},
291
+		async init(echarts, ...args) {
292
+			// #ifndef APP-NVUE
293
+			if(arguments && arguments.length < 1) {
294
+				console.error('缺少参数:init(echarts, theme?:string, opts?: object, callback?: function)')
295
+				return
296
+			}
297
+			// #endif
298
+			let theme=null,opts={},callback;
299
+			
300
+			Array.from(arguments).forEach(item => {
301
+				if(typeof item === 'function') {
302
+					callback = item
303
+				}
304
+				if(['string'].includes(typeof item)) {
305
+					theme = item
306
+				}
307
+				if(typeof item === 'object') {
308
+					opts = item
309
+				}
310
+			})
311
+			
312
+			if(this.beforeDelay) {
313
+				await sleep(this.beforeDelay)
314
+			}
315
+			let config = await this.getContext();
316
+			// #ifndef APP-NVUE
317
+			setCanvasCreator(echarts, config)
318
+			this.chart = echarts.init(config.canvas, theme, Object.assign({}, config, opts))
319
+			if(typeof callback === 'function') {
320
+				callback(this.chart)
321
+			} else {
322
+				return this.chart
323
+			}
324
+			// #endif
325
+			// #ifdef APP-NVUE
326
+			this.chart = new Echarts(this.$refs.webview)
327
+			this.$refs.webview.evalJs(`init(null, null, ${JSON.stringify(opts)}, ${theme})`)
328
+			if(callback) {
329
+				callback(this.chart)
330
+			} else {
331
+				return this.chart
332
+			}
333
+			// #endif
334
+		},
335
+		getContext() {
336
+			// #ifdef APP-NVUE
337
+			if(this.finished) {
338
+				return Promise.resolve(this.finished)
339
+			}
340
+			return new Promise(resolve => {
341
+				this.$watch('finished', (val) => {
342
+					if(val) {
343
+						resolve(this.finished)
344
+					}
345
+				})
346
+			})
347
+			// #endif
348
+			// #ifndef APP-NVUE
349
+			return getRect(`#${this.canvasId}`, {context: this, type: this.use2dCanvas ? 'fields': 'boundingClientRect'}).then(res => {
350
+				if(res) {
351
+					let dpr = devicePixelRatio
352
+					let {width, height, node} = res
353
+					let canvas;
354
+					this.width = width = width || 300;
355
+					this.height = height = height || 300;
356
+					if(node) {
357
+						const ctx = node.getContext('2d');
358
+						canvas = new Canvas(ctx, this, true, node);
359
+						this.canvasNode = node
360
+					} else {
361
+						// #ifdef MP-TOUTIAO
362
+						dpr = !this.isPC ? devicePixelRatio : 1// 1.25
363
+						// #endif
364
+						// #ifndef MP-ALIPAY || MP-TOUTIAO
365
+						dpr = this.isPC ? devicePixelRatio : 1
366
+						// #endif
367
+						// #ifdef MP-ALIPAY || MP-LARK
368
+						dpr = devicePixelRatio
369
+						// #endif
370
+						this.rect = res
371
+						this.nodeWidth = width * dpr;
372
+						this.nodeHeight = height * dpr;
373
+						const ctx = uni.createCanvasContext(this.canvasId, this);
374
+						canvas =  new Canvas(ctx, this, false);
375
+					}
376
+					return { canvas, width, height, devicePixelRatio: dpr, node };
377
+				} else {
378
+					return {}
379
+				}
380
+			})
381
+			// #endif
382
+		},
383
+		// #ifndef APP-NVUE
384
+		getRelative(e) {
385
+			return {x: e.pageX - this.rect.left, y: e.pageY - this.rect.top, wheelDelta: e.wheelDelta}
386
+		},
387
+		getTouch(e) {
388
+			return e.touches && e.touches[0] && e.touches[0].x ? e.touches[0] : this.getRelative(e);
389
+		},
390
+		touchStart(e) {
391
+			this.isDown = true
392
+			if (this.chart && ((e.touches.length > 0 || e.touches['0'])  && e.type != 'mousemove' || e.type == 'mousedown')) {
393
+				const touch = this.getTouch(e)
394
+				this.startX = touch.x
395
+				this.startY = touch.y
396
+				this.startT = new Date()
397
+				const handler = this.chart.getZr().handler;
398
+				dispatch.call(handler, 'mousedown', touch)
399
+				dispatch.call(handler, 'mousemove', touch)
400
+				handler.processGesture(wrapTouch(e), 'start');
401
+				clearTimeout(this.endTimer);
402
+			}
403
+		},
404
+		touchMove(e) {
405
+			if(this.isPc && this.enableHover && !this.isDown) {this.isDown = true}
406
+			if (this.chart && ((e.touches.length > 0 || e.touches['0']) && e.type != 'mousemove' || e.type == 'mousemove' && this.isDown)) {
407
+				const handler = this.chart.getZr().handler;
408
+				dispatch.call(handler, 'mousemove', this.getTouch(e))
409
+				handler.processGesture(wrapTouch(e), 'change');
410
+			}
411
+		},
412
+		touchEnd(e) {
413
+			this.isDown = false
414
+			if (this.chart) {
415
+				const {x} = e.changedTouches && e.changedTouches[0] || {}
416
+				const touch = (x ? e.changedTouches[0] : this.getRelative(e)) || {};
417
+				const handler = this.chart.getZr().handler;
418
+				const isClick = Math.abs(touch.x - this.startX) < 10 && new Date() - this.startT < 200;
419
+				dispatch.call(handler, 'mouseup', touch)
420
+				handler.processGesture(wrapTouch(e), 'end');
421
+				if(isClick) {
422
+					dispatch.call(handler, 'click', touch)
423
+				} else {
424
+					this.endTimer = setTimeout(() => {
425
+						dispatch.call(handler, 'mousemove', {x: 999999999,y: 999999999});
426
+						dispatch.call(handler, 'mouseup', {x: 999999999,y: 999999999});
427
+					},50)
428
+				}
429
+			}
430
+		},
431
+		// #endif
432
+		// #ifdef H5
433
+		mousewheel(e){
434
+			if(this.chart) {
435
+				dispatch.call(this.chart.getZr().handler, 'mousewheel', this.getTouch(e))
436
+			}
437
+		}
438
+		// #endif
439
+	}
440
+};
441
+</script>
442
+<style scoped>
443
+.lime-echart {
444
+	position: relative;
445
+	/* #ifndef APP-NVUE */
446
+	width: 100%;
447
+	height: 100%;
448
+	/* #endif */
449
+	/* #ifdef APP-NVUE */
450
+	flex: 1;
451
+	/* #endif */
452
+}
453
+.lime-echart__canvas {
454
+	/* #ifndef APP-NVUE */
455
+	width: 100%;
456
+	height: 100%;
457
+	/* #endif */
458
+	/* #ifdef APP-NVUE */
459
+	flex: 1;
460
+	/* #endif */
461
+}
462
+</style>

+ 35 - 0
CallCenterWeb.UI/RMYYAPP/uni_modules/lime-echart/components/l-echart/nvue.js

@@ -0,0 +1,35 @@
1
+export class Echarts {
2
+	constructor(webview) {
3
+		this.webview = webview
4
+		this.options = null
5
+	}
6
+	setOption() {
7
+		this.options = arguments
8
+		this.webview.evalJs(`setOption(${JSON.stringify(arguments)})`);
9
+	}
10
+	getOption() {
11
+		return this.options
12
+	}
13
+	showLoading() {
14
+		this.webview.evalJs(`showLoading(${JSON.stringify(arguments)})`);
15
+	}
16
+	hideLoading() {
17
+		this.webview.evalJs(`hideLoading()`);
18
+	}
19
+	clear() {
20
+		this.webview.evalJs(`clear()`);
21
+	}
22
+	dispose() {
23
+		this.webview.evalJs(`dispose()`);
24
+	}
25
+	resize(size) {
26
+		if(size) {
27
+			this.webview.evalJs(`resize(${size})`);
28
+		} else {
29
+			this.webview.evalJs(`resize()`);
30
+		}
31
+	}
32
+	on(type, ...args) {
33
+		console.warn('nvue 暂不支持事件')
34
+	}
35
+}

+ 126 - 0
CallCenterWeb.UI/RMYYAPP/uni_modules/lime-echart/components/l-echart/utils.js

@@ -0,0 +1,126 @@
1
+// #ifndef APP-NVUE
2
+// 计算版本
3
+export function compareVersion(v1, v2) {
4
+	v1 = v1.split('.')
5
+	v2 = v2.split('.')
6
+	const len = Math.max(v1.length, v2.length)
7
+	while (v1.length < len) {
8
+		v1.push('0')
9
+	}
10
+	while (v2.length < len) {
11
+		v2.push('0')
12
+	}
13
+	for (let i = 0; i < len; i++) {
14
+		const num1 = parseInt(v1[i], 10)
15
+		const num2 = parseInt(v2[i], 10)
16
+
17
+		if (num1 > num2) {
18
+			return 1
19
+		} else if (num1 < num2) {
20
+			return -1
21
+		}
22
+	}
23
+	return 0
24
+}
25
+const systemInfo = uni.getSystemInfoSync();
26
+function gte(version) {
27
+	// 截止 2023-03-22 mac pc小程序不支持 canvas 2d
28
+	console.log('uni', uni)
29
+	let { SDKVersion, platform } = systemInfo;
30
+	// #ifdef MP-ALIPAY
31
+	SDKVersion = my.SDKVersion
32
+	// #endif
33
+	// #ifdef MP-WEIXIN
34
+	return platform !== 'mac' && compareVersion(SDKVersion, version) >= 0;
35
+	// #endif
36
+	return compareVersion(SDKVersion, version) >= 0;
37
+}
38
+
39
+
40
+export function canIUseCanvas2d() {
41
+	// #ifdef MP-WEIXIN
42
+	return gte('2.9.0');
43
+	// #endif
44
+	// #ifdef MP-ALIPAY
45
+	return gte('2.7.0');
46
+	// #endif
47
+	// #ifdef MP-TOUTIAO
48
+	return gte('1.78.0');
49
+	// #endif
50
+	return false
51
+}
52
+
53
+export function wrapTouch(event) {
54
+	for (let i = 0; i < event.touches.length; ++i) {
55
+		const touch = event.touches[i];
56
+		touch.offsetX = touch.x;
57
+		touch.offsetY = touch.y;
58
+	}
59
+	return event;
60
+}
61
+export const devicePixelRatio = uni.getSystemInfoSync().pixelRatio
62
+// #endif
63
+// #ifdef APP-NVUE
64
+export function base64ToPath(base64) {
65
+	return new Promise((resolve, reject) => {
66
+		const [, format, bodyData] = /data:image\/(\w+);base64,(.*)/.exec(base64) || [];
67
+		const bitmap = new plus.nativeObj.Bitmap('bitmap' + Date.now())
68
+		bitmap.loadBase64Data(base64, () => {
69
+			if (!format) {
70
+				reject(new Error('ERROR_BASE64SRC_PARSE'))
71
+			}
72
+			const time = new Date().getTime();
73
+			const filePath = `_doc/uniapp_temp/${time}.${format}`
74
+
75
+			bitmap.save(filePath, {},
76
+				() => {
77
+					bitmap.clear()
78
+					resolve(filePath)
79
+				},
80
+				(error) => {
81
+					bitmap.clear()
82
+					console.error(`${JSON.stringify(error)}`)
83
+					reject(error)
84
+				})
85
+		}, (error) => {
86
+			bitmap.clear()
87
+			console.error(`${JSON.stringify(error)}`)
88
+			reject(error)
89
+		})
90
+	})
91
+}
92
+// #endif
93
+
94
+
95
+export function sleep(time) {
96
+	return new Promise((resolve) => {
97
+		setTimeout(() => {
98
+			resolve(true)
99
+		}, time)
100
+	})
101
+}
102
+
103
+
104
+export function getRect(selector, options = {}) {
105
+	const typeDefault = 'boundingClientRect'
106
+	const { context, type = typeDefault} = options
107
+	return new Promise((resolve, reject) => {
108
+		const dom = uni.createSelectorQuery().in(context).select(selector);
109
+		const result = (rect) => {
110
+			if(rect) {
111
+				 resolve(rect)
112
+			} else {
113
+				reject()
114
+			}
115
+		}
116
+		if(type == typeDefault) {
117
+			dom[type](result).exec()
118
+		} else {
119
+			dom[type]({
120
+				node: true,
121
+				size: true,
122
+				rect: true
123
+			}, result).exec()
124
+		}
125
+	});
126
+};

+ 103 - 0
CallCenterWeb.UI/RMYYAPP/uni_modules/lime-echart/components/lime-echart/lime-echart.vue

@@ -0,0 +1,103 @@
1
+<template>
2
+	<view >
3
+		<view style="height: 750rpx; background-color: aquamarine;">
4
+			<l-echart ref="chart" @finished="init"></l-echart>
5
+		</view>
6
+	</view>		
7
+</template>
8
+
9
+<script>
10
+	// nvue 不需要引入
11
+	// #ifdef VUE2
12
+	import * as echarts from '@/uni_modules/lime-echart/static/echarts.min';
13
+	// #endif
14
+	// #ifdef VUE3
15
+	// #ifdef MP
16
+	// 由于vue3 使用vite 不支持umd格式的包,小程序依然可以使用,但需要使用require
17
+	const echarts = require('../../static/echarts.min');
18
+	// #endif
19
+	// #ifndef MP
20
+	// 由于 vue3 使用vite 不支持umd格式的包,故引入npm的包
21
+	import * as echarts from 'echarts/dist/echarts.esm';
22
+	// #endif
23
+	// #endif
24
+	export default {
25
+		data() {
26
+			return {
27
+				option:  {
28
+					tooltip: {
29
+						trigger: 'axis',
30
+						// shadowBlur: 0,
31
+						textStyle: {
32
+							textShadowBlur : 0
33
+						}
34
+					},
35
+					legend: {
36
+						data: ['邮件营销', '联盟广告', '视频广告', '直接访问', '搜索引擎']
37
+					},
38
+					grid: {
39
+						left: '3%',
40
+						right: '4%',
41
+						bottom: '3%',
42
+						containLabel: true
43
+					},
44
+					xAxis: {
45
+						type: 'category',
46
+						boundaryGap: false,
47
+						data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
48
+					},
49
+					yAxis: {
50
+						type: 'value'
51
+					},
52
+					series: [
53
+						{
54
+							name: '邮件营销',
55
+							type: 'line',
56
+							stack: '总量',
57
+							data: [120, 132, 101, 134, 90, 230, 210]
58
+						},
59
+						{
60
+							name: '联盟广告',
61
+							type: 'line',
62
+							stack: '总量',
63
+							data: [220, 182, 191, 234, 290, 330, 310]
64
+						},
65
+						{
66
+							name: '视频广告',
67
+							type: 'line',
68
+							stack: '总量',
69
+							data: [150, 232, 201, 154, 190, 330, 410]
70
+						},
71
+						{
72
+							name: '直接访问',
73
+							type: 'line',
74
+							stack: '总量',
75
+							data: [320, 332, 301, 334, 390, 330, 320]
76
+						},
77
+						{
78
+							name: '搜索引擎',
79
+							type: 'line',
80
+							stack: '总量',
81
+							data: [820, 932, 901, 934, 1290, 1330, 1320]
82
+						}
83
+					]
84
+				}
85
+			}
86
+		},
87
+		methods: {
88
+			init() {
89
+				this.$refs.chart.init(echarts, chart => {
90
+					chart.setOption(this.option);
91
+					console.log('res::::')
92
+				});
93
+			},
94
+			save() {
95
+				this.$refs.chart.canvasToTempFilePath({
96
+					success(res) {
97
+						console.log('res::::', res)
98
+					}
99
+				})
100
+			}
101
+		}
102
+	}
103
+</script>

+ 88 - 0
CallCenterWeb.UI/RMYYAPP/uni_modules/lime-echart/package.json

@@ -0,0 +1,88 @@
1
+{
2
+  "id": "lime-echart",
3
+  "displayName": "echarts",
4
+  "version": "0.7.5",
5
+  "description": "echarts 全端兼容,一款使echarts图表能跑在uniapp各端中的插件",
6
+  "keywords": [
7
+    "echarts",
8
+    "canvas",
9
+    "图表",
10
+    "可视化"
11
+],
12
+  "repository": "https://gitee.com/liangei/lime-echart",
13
+  "engines": {
14
+    "HBuilderX": "^3.6.4"
15
+  },
16
+  "dcloudext": {
17
+    "sale": {
18
+      "regular": {
19
+        "price": "0.00"
20
+      },
21
+      "sourcecode": {
22
+        "price": "0.00"
23
+      }
24
+    },
25
+    "contact": {
26
+      "qq": ""
27
+    },
28
+    "declaration": {
29
+      "ads": "无",
30
+      "data": "无",
31
+      "permissions": "无"
32
+    },
33
+    "npmurl": "",
34
+    "type": "component-vue"
35
+  },
36
+  "uni_modules": {
37
+    "dependencies": [],
38
+    "encrypt": [],
39
+    "platforms": {
40
+      "cloud": {
41
+        "tcb": "y",
42
+        "aliyun": "y"
43
+      },
44
+      "client": {
45
+        "App": {
46
+          "app-vue": "y",
47
+          "app-nvue": "y"
48
+        },
49
+        "H5-mobile": {
50
+          "Safari": "y",
51
+          "Android Browser": "y",
52
+          "微信浏览器(Android)": "y",
53
+          "QQ浏览器(Android)": "y"
54
+        },
55
+        "H5-pc": {
56
+          "Chrome": "u",
57
+          "IE": "u",
58
+          "Edge": "u",
59
+          "Firefox": "u",
60
+          "Safari": "u"
61
+        },
62
+        "小程序": {
63
+          "微信": "y",
64
+          "阿里": "y",
65
+          "百度": "y",
66
+          "字节跳动": "y",
67
+          "QQ": "y",
68
+          "钉钉": "u",
69
+          "快手": "u",
70
+          "飞书": "u",
71
+          "京东": "u"
72
+        },
73
+        "快应用": {
74
+          "华为": "u",
75
+          "联盟": "u"
76
+        },
77
+        "Vue": {
78
+          "vue2": "y",
79
+          "vue3": "y"
80
+        }
81
+      }
82
+    }
83
+  },
84
+  "dependencies": {
85
+    "echarts": "^5.4.1",
86
+    "zrender": "^5.4.3"
87
+  }
88
+}

+ 42 - 0
CallCenterWeb.UI/RMYYAPP/uni_modules/lime-echart/pnpm-lock.yaml

@@ -0,0 +1,42 @@
1
+lockfileVersion: 5.4
2
+
3
+specifiers:
4
+  echarts: ^5.4.1
5
+  zrender: ^5.4.3
6
+
7
+dependencies:
8
+  echarts: registry.npmmirror.com/echarts/5.4.1
9
+  zrender: registry.npmmirror.com/zrender/5.4.3
10
+
11
+packages:
12
+
13
+  registry.npmmirror.com/echarts/5.4.1:
14
+    resolution: {integrity: sha512-9ltS3M2JB0w2EhcYjCdmtrJ+6haZcW6acBolMGIuf01Hql1yrIV01L1aRj7jsaaIULJslEP9Z3vKlEmnJaWJVQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/echarts/-/echarts-5.4.1.tgz}
15
+    name: echarts
16
+    version: 5.4.1
17
+    dependencies:
18
+      tslib: registry.npmmirror.com/tslib/2.3.0
19
+      zrender: registry.npmmirror.com/zrender/5.4.1
20
+    dev: false
21
+
22
+  registry.npmmirror.com/tslib/2.3.0:
23
+    resolution: {integrity: sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/tslib/-/tslib-2.3.0.tgz}
24
+    name: tslib
25
+    version: 2.3.0
26
+    dev: false
27
+
28
+  registry.npmmirror.com/zrender/5.4.1:
29
+    resolution: {integrity: sha512-M4Z05BHWtajY2241EmMPHglDQAJ1UyHQcYsxDNzD9XLSkPDqMq4bB28v9Pb4mvHnVQ0GxyTklZ/69xCFP6RXBA==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/zrender/-/zrender-5.4.1.tgz}
30
+    name: zrender
31
+    version: 5.4.1
32
+    dependencies:
33
+      tslib: registry.npmmirror.com/tslib/2.3.0
34
+    dev: false
35
+
36
+  registry.npmmirror.com/zrender/5.4.3:
37
+    resolution: {integrity: sha512-DRUM4ZLnoaT0PBVvGBDO9oWIDBKFdAVieNWxWwK0niYzJCMwGchRk21/hsE+RKkIveH3XHCyvXcJDkgLVvfizQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/zrender/-/zrender-5.4.3.tgz}
38
+    name: zrender
39
+    version: 5.4.3
40
+    dependencies:
41
+      tslib: registry.npmmirror.com/tslib/2.3.0
42
+    dev: false

+ 318 - 0
CallCenterWeb.UI/RMYYAPP/uni_modules/lime-echart/readme.md

@@ -0,0 +1,318 @@
1
+# echarts 图表 <span style="font-size:16px;">👑👑👑👑👑 <span style="background:#ff9d00;padding:2px 4px;color:#fff;font-size:10px;border-radius: 3px;">全端</span></span>
2
+> 一个基于 JavaScript 的开源可视化图表库   [查看更多 站点1](https://limeui.qcoon.cn/#/echart) |  [查看更多 站点2](http://liangei.gitee.io/limeui/#/echart)  <br>
3
+> 基于 echarts 做了兼容处理,更多示例请访问  [uni示例 站点1](https://limeui.qcoon.cn/#/echart-example) | [uni示例 站点2](http://liangei.gitee.io/limeui/#/echart-example) | [官方示例](https://echarts.apache.org/examples/zh/index.html)     <br>
4
+> Q群:1046793420 <br>
5
+
6
+## 平台兼容
7
+
8
+| H5  | 微信小程序 | 支付宝小程序 | 百度小程序 | 头条小程序 | QQ 小程序 | App  |
9
+| --- | ---------- | ------------ | ---------- | ---------- | --------- | ---- |
10
+| √   | √          | √         | √      | √       | √      | √ |
11
+
12
+
13
+## 安装
14
+- 第一步、在uniapp 插件市场 找到 [百度图表](https://ext.dcloud.net.cn/plugin?id=4899) 导入
15
+- 第二步、安装 echarts 或者直接使用插件内的echarts.min文件
16
+```cmd
17
+pnpm add echarts
18
+ -or-
19
+npm install echarts
20
+```
21
+
22
+
23
+**注意** 
24
+* 🔔 必须使用hbuilderx 3.4.8-alpha及以上
25
+* 🔔 echarts 5.3.0及以上
26
+* 🔔 如果是 `cli` 项目需要主动 `import` 插件
27
+```js
28
+import LEchart from '@/uni_modules/lime-echart/components/l-echart/l-echart.vue';
29
+export default {
30
+	components: {LEchart}
31
+}
32
+```
33
+
34
+## 代码演示
35
+### 基础用法
36
+```html
37
+<view><l-echart ref="chart" @finished="init"></l-echart></view>
38
+```
39
+
40
+```js
41
+// 方式一:自定义包
42
+// 使用插件内提供的echarts.min
43
+// 或在官网自定义包:https://echarts.apache.org/zh/builder.html
44
+// 注意 插件内的包是umd格式的,如果你是vue3请使用esm格式的包 https://github.com/apache/echarts/tree/master/dist
45
+import * as echarts from '@/uni_modules/lime-echart/static/echarts.min'
46
+
47
+
48
+// 方式二:全量包
49
+// 如果你使用 npm 安装了 echarts
50
+import * as echarts from 'echarts'
51
+
52
+
53
+// 方式三:按需引入
54
+// 按需引入 开始
55
+import * as echarts from 'echarts/core';
56
+import {LineChart, BarChart} from 'echarts/charts';
57
+import {TitleComponent,TooltipComponent,GridComponent, DatasetComponent, TransformComponent, LegendComponent } from 'echarts/components';
58
+// 标签自动布局,全局过渡动画等特性
59
+import {LabelLayout,UniversalTransition} from 'echarts/features';
60
+// 引入 Canvas 渲染器,注意引入 CanvasRenderer 是必须的一步
61
+import {CanvasRenderer} from 'echarts/renderers';
62
+
63
+// 按需引入 注册必须的组件
64
+echarts.use([
65
+	LegendComponent,
66
+	TitleComponent,
67
+	TooltipComponent,
68
+	GridComponent,
69
+	DatasetComponent,
70
+	TransformComponent,
71
+	LineChart,
72
+	BarChart,
73
+	LabelLayout,
74
+	UniversalTransition,
75
+	CanvasRenderer
76
+]);
77
+//-------------按需引入结束------------------------
78
+
79
+
80
+export default {
81
+	data() {
82
+		return {
83
+			option: {
84
+				tooltip: {
85
+					trigger: 'axis',
86
+					axisPointer: {
87
+						type: 'shadow' 
88
+					},
89
+					confine: true
90
+				},
91
+				legend: {
92
+					data: ['热度', '正面', '负面']
93
+				},
94
+				grid: {
95
+					left: 20,
96
+					right: 20,
97
+					bottom: 15,
98
+					top: 40,
99
+					containLabel: true
100
+				},
101
+				xAxis: [
102
+					{
103
+						type: 'value',
104
+						axisLine: {
105
+							lineStyle: {
106
+								color: '#999999'
107
+							}
108
+						},
109
+						axisLabel: {
110
+							color: '#666666'
111
+						}
112
+					}
113
+				],
114
+				yAxis: [
115
+					{
116
+						type: 'category',
117
+						axisTick: { show: false },
118
+						data: ['汽车之家', '今日头条', '百度贴吧', '一点资讯', '微信', '微博', '知乎'],
119
+						axisLine: {
120
+							lineStyle: {
121
+								color: '#999999'
122
+							}
123
+						},
124
+						axisLabel: {
125
+							color: '#666666'
126
+						}
127
+					}
128
+				],
129
+				series: [
130
+					{
131
+						name: '热度',
132
+						type: 'bar',
133
+						label: {
134
+							normal: {
135
+								show: true,
136
+								position: 'inside'
137
+							}
138
+						},
139
+						data: [300, 270, 340, 344, 300, 320, 310],
140
+					},
141
+					{
142
+						name: '正面',
143
+						type: 'bar',
144
+						stack: '总量',
145
+						label: {
146
+							normal: {
147
+								show: true
148
+							}
149
+						},
150
+						data: [120, 102, 141, 174, 190, 250, 220]
151
+					},
152
+					{
153
+						name: '负面',
154
+						type: 'bar',
155
+						stack: '总量',
156
+						label: {
157
+							normal: {
158
+								show: true,
159
+								position: 'left'
160
+							}
161
+						},
162
+						data: [-20, -32, -21, -34, -90, -130, -110]
163
+					}
164
+				]
165
+			},
166
+		};
167
+	},
168
+	// 组件能被调用必须是组件的节点已经被渲染到页面上
169
+	// 1、在页面mounted里调用,有时候mounted 组件也未必渲染完成
170
+	mounted() {
171
+		// init(echarts, theme?:string, opts?:{}, chart => {})
172
+		// echarts 必填, 非nvue必填,nvue不用填
173
+		// theme 可选,应用的主题,目前只支持名称,如:'dark'
174
+		// opts = { // 可选
175
+		//	locale?: string  // 从 `5.0.0` 开始支持
176
+		// }
177
+		// chart => {} , callback 返回图表实例
178
+		this.$refs.chart.init(echarts, chart => {
179
+			chart.setOption(this.option);
180
+		});
181
+	},
182
+	// 2、或者使用组件的finished事件里调用
183
+	methods: {
184
+		async init() {
185
+			// chart 图表实例不能存在data里
186
+			const chart = await this.$refs.chart.init(echarts);
187
+			chart.setOption(this.option)
188
+		}
189
+	}
190
+}
191
+```
192
+
193
+## 数据更新
194
+- 使用 `ref` 可获取`setOption`设置更新
195
+
196
+```js
197
+this.$refs.chart.setOption(data)
198
+```
199
+
200
+## 图表大小
201
+- 在有些场景下,我们希望当容器大小改变时,图表的大小也相应地改变。
202
+
203
+```js
204
+// 默认获取容器尺寸
205
+this.$refs.chart.resize()
206
+// 指定尺寸
207
+this.$refs.chart.resize({width: 375, height: 375})
208
+```
209
+
210
+## 插件标签
211
+- 默认 l-echart 为 component
212
+- 默认 lime-echart 为 demo
213
+```html
214
+ // 在任意地方使用可查看domo, 代码位于/uni_modules/lime-echart/component/lime-echart
215
+<lime-echart></lime-echart>
216
+```
217
+
218
+
219
+## 常见问题
220
+- 微信小程序 `2d` 只支持 真机调试2.0
221
+- 微信开发工具会出现 `canvas` 不跟随页面的情况,真机不影响
222
+- toolbox 不支持 `saveImage`
223
+- echarts 5.3.0 的 lines 不支持 trailLength,故需设置为 `0`
224
+- dataZoom H5不要设置 `showDetail` 
225
+- 如果微信小程序的`tooltip`文字有阴影,可能是微信的锅,临时解决方法是`tooltip.shadowBlur = 0`
226
+- 如果钉钉小程序上传时报安全问题`Uint8Clamped`,可以向钉钉反馈是安全代码扫描把Uint8Clamped数组错误识别了,也可以在 echarts 文件修改`Uint8Clamped`
227
+```js
228
+// 找到这段代码把代码中`Uint8Clamped`改成`Uint8_Clamped`,再把下划线去掉,不过直接去掉`Uint8Clamped`也是可行的
229
+// ["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64"],(function(t,e){return t["[object "+e+"Array]"]
230
+// 改成如下
231
+["Int8","Uint8","Uint8_Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64"],(function(t,e){return t["[object "+e.replace('_','')+"Array]"]
232
+```
233
+
234
+- 注意 如果您是使用 **vite + vue3** 非wx平台可能会遇到`echarts`文件缺少`wx`判断导致无法使用,您可以在`echarts.min.js`文件开头增加以下内容,参考插件内的echart.min.js的做法
235
+```js
236
+var prefix = () => {
237
+	var UNDEFINED = 'undefined'
238
+	if(typeof wx !== UNDEFINED) return wx // 微信
239
+	if(typeof tt !== UNDEFINED) return tt // 字节 飞书
240
+	if(typeof swan !== UNDEFINED) return swan // 百度
241
+	if(typeof my !== UNDEFINED) return my // 支付宝
242
+	if(typeof dd !== UNDEFINED) return dd // 钉钉
243
+	if(typeof ks !== UNDEFINED) return ks // 快手
244
+	if(typeof jd !== UNDEFINED) return jd // 京东
245
+	if(typeof qa !== UNDEFINED) return qa // 快应用
246
+	if(typeof qq !== UNDEFINED) return qq // qq
247
+	if(typeof qh !== UNDEFINED) return qh // 360
248
+	if(typeof uni !== UNDEFINED) return uni
249
+	return null
250
+}
251
+//在 !function(t,e){"object"==typeof 下面加入 可能是第36行
252
+var wx = prefix();
253
+/*! *****************************************************************************
254
+    Copyright (c) Microsoft Corporation.
255
+```
256
+
257
+- 或者在`vite.config.js`的`define`设置环境
258
+
259
+```js
260
+//  或者在`vite.config.js`的`define`设置环境
261
+import { defineConfig } from 'vite';
262
+import uni from '@dcloudio/vite-plugin-uni';
263
+
264
+const UNI_PLATFORM = {
265
+	"app": "uni",
266
+	"web": "uni",
267
+	"mp-weixin": "wx",
268
+	"mp-baidu": "swan",
269
+	"mp-alipay": "my",
270
+	"mp-toutiao": "tt",
271
+	"mp-lark": "tt",
272
+	"mp-qq": "qq",
273
+	"mp-kuaishou": "ks",
274
+	"mp-jd": "jd",
275
+	"mp-360": "qh",
276
+	"quickapp-webview-union": "qa",
277
+	"quickapp-webview-huawei": "qa",
278
+	"quickapp-webview": "qa",
279
+}
280
+
281
+export default defineConfig({
282
+	plugins: [uni()],
283
+	define: { 
284
+		global: UNI_PLATFORM[process.env.UNI_PLATFORM],
285
+		wx: UNI_PLATFORM[process.env.UNI_PLATFORM]
286
+	}
287
+});
288
+```
289
+
290
+
291
+## Props
292
+
293
+| 参数             | 说明                                                            | 类型             | 默认值        | 版本 	|
294
+| ---------------  | --------                                                        | -------         | ------------ | ----- 	|
295
+| custom-style     | 自定义样式                                                      |   `string`       | -            | -     	|
296
+| type             | 指定 canvas 类型                                				 |    `string`      | `2d`         |   	    |
297
+| is-disable-scroll | 触摸图表时是否禁止页面滚动                                       |    `boolean`     | `false`     |   	    |
298
+| beforeDelay       |  延迟初始化 (毫秒)                       						|    `number`     | `30`     |   	    |
299
+| enableHover       |  PC端使用鼠标悬浮                       						|    `boolean`     | `false`     |   	    |
300
+
301
+## 事件
302
+
303
+| 参数                    | 说明                                                                                                             |
304
+| ---------------        | ---------------                                                                                                  |
305
+| init(echarts, chart => {})  | 初始化调用函数,第一个参数是传入`echarts`,第二个参数是回调函数,回调函数的参数是 `chart` 实例                                           |  
306
+| setChart(chart => {})        | 已经初始化后,请使用这个方法,是个回调函数,参数是 `chart` 实例                  |  
307
+| setOption(data)        | [图表配置项](https://echarts.apache.org/zh/option.html#title),用于更新 ,传递是数据 `option`  |  
308
+| clear()                | 清空当前实例,会移除实例中所有的组件和图表。  |  
309
+| dispose()              | 销毁实例  |  
310
+| showLoading()          | 显示加载  |  
311
+| hideLoading()          | 隐藏加载  |  
312
+| [canvasToTempFilePath](https://uniapp.dcloud.io/api/canvas/canvasToTempFilePath.html#canvastotempfilepath)(opt)  | 用于生成图片,与官方使用方法一致,但不需要传`canvasId`  |  
313
+
314
+
315
+## 打赏
316
+如果你觉得本插件,解决了你的问题,赠人玫瑰,手留余香。  
317
+![](https://testingcf.jsdelivr.net/gh/liangei/image@1.9/alipay.png)
318
+![](https://testingcf.jsdelivr.net/gh/liangei/image@1.9/wpay.png)

Разница между файлами не показана из-за своего большого размера
+ 1 - 0
CallCenterWeb.UI/RMYYAPP/uni_modules/lime-echart/static/ecStat.min.js


Разница между файлами не показана из-за своего большого размера
+ 60 - 0
CallCenterWeb.UI/RMYYAPP/uni_modules/lime-echart/static/echarts.min.js


+ 129 - 0
CallCenterWeb.UI/RMYYAPP/uni_modules/lime-echart/static/index.html

@@ -0,0 +1,129 @@
1
+<!DOCTYPE html>
2
+<html lang="zh">
3
+	<head>
4
+		<meta charset="UTF-8">
5
+		<meta name="viewport"
6
+			content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
7
+		<meta http-equiv="X-UA-Compatible" content="ie=edge">
8
+		<title></title>
9
+		<style type="text/css">
10
+			html,
11
+			body,
12
+			.canvas {
13
+				padding: 0;
14
+				margin: 0;
15
+				overflow-y: hidden;
16
+				background-color: transparent;
17
+				width: 100%;
18
+				height: 100%;
19
+			}
20
+		</style>
21
+	</head>
22
+	<body>
23
+		<div class="canvas" id="limeChart"></div>
24
+		<script type="text/javascript" src="./uni.webview.1.5.3.js"></script>
25
+		<script type="text/javascript" src="./echarts.min.js"></script>
26
+		<script type="text/javascript" src="./ecStat.min.js"></script>
27
+		<!-- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts-liquidfill@latest/dist/echarts-liquidfill.min.js"></script> -->	
28
+		<script>
29
+			let chart = null;
30
+			let cache = [];
31
+			console.log = function(...agrs) {
32
+				postMessage(agrs)
33
+			}
34
+			function emit(event, data) {
35
+				let dataStr = JSON.stringify(data, stringify)
36
+				postMessage({
37
+					event,
38
+					data: dataStr
39
+				})
40
+				cache = []
41
+			}
42
+			function postMessage(data) {
43
+				uni.postMessage({
44
+					data
45
+				});
46
+			}
47
+			function stringify(key, value) {
48
+				if (typeof value === 'object' && value !== null) {
49
+					if (cache.indexOf(value) !== -1) {
50
+						return;
51
+					}
52
+					cache.push(value);
53
+				}
54
+				return value;
55
+			}
56
+			function parse(name, callback, options) {
57
+				const optionNameReg = /[\w]+\.setOption\(([\w]+\.)?([\w]+)\)/
58
+				if (optionNameReg.test(callback)) {
59
+					const optionNames = callback.match(optionNameReg)
60
+					if(optionNames[1]) {
61
+						const _this = optionNames[1].split('.')[0]
62
+						window[_this] = {}
63
+						window[_this][optionNames[2]] = options
64
+						return optionNames[2]
65
+					} else {
66
+						return null
67
+					}
68
+				}
69
+				return null
70
+			}
71
+			function init(callback, options, opts = {}, theme = null) {
72
+				if(!chart) {
73
+					chart = echarts.init(document.getElementById('limeChart'), theme, opts)
74
+					if(options) {
75
+						chart.setOption(options)
76
+					}
77
+					// const name = parse('a', callback, options)
78
+					// console.log('options::', callback)
79
+					// if(name) this[name] = options
80
+					// eval(`a = ${callback};`)
81
+					// if(a) {a(chart)}
82
+				}
83
+			}
84
+			
85
+			function setChart(callback, options) {
86
+				if(!callback) return
87
+				if(chart && callback && options) {
88
+					var r = null
89
+					const name = parse('r', callback, options)
90
+					if(name) this[name] = options
91
+					eval(`r = ${callback};`)
92
+					if(r) {r(chart)}
93
+				}
94
+			}
95
+			function setOption(data) {
96
+				if (chart) chart.setOption(data[0], data[1])
97
+			}
98
+			function showLoading(data) {
99
+				if (chart) chart.showLoading(data[0], data[1])
100
+			}
101
+			
102
+			function hideLoading() {
103
+				if (chart) chart.hideLoading()
104
+			}
105
+			
106
+			function clear() {
107
+				if (chart) chart.clear()
108
+			
109
+			}
110
+			
111
+			function dispose() {
112
+				if (chart) chart.dispose()
113
+			}
114
+			function resize(size) {
115
+				if (chart) chart.resize(size)
116
+			}
117
+			
118
+			function canvasToTempFilePath(opt = {}) {
119
+				if (chart) {
120
+				  const src = chart.getDataURL(opt)
121
+				  postMessage({
122
+					  file: true,
123
+					  data: src
124
+				  })
125
+				}
126
+			}
127
+		</script>
128
+	</body>
129
+</html>

Разница между файлами не показана из-за своего большого размера
+ 1 - 0
CallCenterWeb.UI/RMYYAPP/uni_modules/lime-echart/static/uni.webview.1.5.3.js