hqchart 1.1.12687 → 1.1.12706

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (228) hide show
  1. package/lib/umychart.vue.js +94 -50
  2. package/package.json +15 -47
  3. package/src/jscommon/umychart.resource/js/codemirror/javascript.js +1 -1
  4. package/src/jscommon/umychart.uniapp.h5/umychart.uniapp.h5.js +409 -115
  5. package/src/jscommon/umychart.vue/umychart.vue.js +409 -115
  6. package/.babelrc +0 -6
  7. package/.vscode/settings.json +0 -4
  8. package/Makefile +0 -9
  9. package/README.md +0 -452
  10. package/index.js +0 -17
  11. package/postcss.config.js +0 -5
  12. package/src/index.html +0 -18
  13. package/src/jscommon/backup/announcement.png +0 -0
  14. package/src/jscommon/backup/announcement2.png +0 -0
  15. package/src/jscommon/backup/blocktrading.png +0 -0
  16. package/src/jscommon/backup/investor.png +0 -0
  17. package/src/jscommon/backup/pforecast.png +0 -0
  18. package/src/jscommon/backup/research.png +0 -0
  19. package/src/jscommon/backup/tradedetail.png +0 -0
  20. package/src/jscommon/backup/umychart - backup.js +0 -17631
  21. package/src/jscommon/backup/umychart.macro.js +0 -4
  22. package/src/jscommon/backup/umychart.macro.vue.js +0 -3
  23. package/src/jscommon/commonindextree.json +0 -92
  24. package/src/jscommon/index.html +0 -13
  25. package/src/jscommon/jschinamapdata.js +0 -3
  26. package/src/jscommon/umychart.NetworkFilterTest.js +0 -48803
  27. package/src/jscommon/umychart.aliYunnetwork.js +0 -47
  28. package/src/jscommon/umychart.cninfo.components/readme.txt +0 -1
  29. package/src/jscommon/umychart.complier.js +0 -25291
  30. package/src/jscommon/umychart.complier.node/umychart.complier.controller.js +0 -559
  31. package/src/jscommon/umychart.complier.node/umychart.complier.node.js +0 -7043
  32. package/src/jscommon/umychart.complier.node/umychart.data.node.js +0 -816
  33. package/src/jscommon/umychart.console.js +0 -12
  34. package/src/jscommon/umychart.deal.js +0 -1452
  35. package/src/jscommon/umychart.dragdiv.js +0 -48
  36. package/src/jscommon/umychart.index.data.js +0 -4132
  37. package/src/jscommon/umychart.js +0 -90257
  38. package/src/jscommon/umychart.keyboard.js +0 -1659
  39. package/src/jscommon/umychart.listctrl.js +0 -690
  40. package/src/jscommon/umychart.mind.js +0 -2203
  41. package/src/jscommon/umychart.network.js +0 -44
  42. package/src/jscommon/umychart.news.js +0 -823
  43. package/src/jscommon/umychart.node.build/buildall.bat +0 -1
  44. package/src/jscommon/umychart.node.build/umychart.node.bat +0 -1
  45. package/src/jscommon/umychart.node.build/umychart.node.export.js +0 -40
  46. package/src/jscommon/umychart.regressiontest.js +0 -400
  47. package/src/jscommon/umychart.report.js +0 -5803
  48. package/src/jscommon/umychart.scrollbar.js +0 -1345
  49. package/src/jscommon/umychart.stock.js +0 -4218
  50. package/src/jscommon/umychart.style.js +0 -618
  51. package/src/jscommon/umychart.testdata.js +0 -150
  52. package/src/jscommon/umychart.uniapp.build/buildall.bat +0 -1
  53. package/src/jscommon/umychart.uniapp.build/umychart.bat +0 -1
  54. package/src/jscommon/umychart.uniapp.build/umychart.export.js +0 -70
  55. package/src/jscommon/umychart.user.js +0 -137
  56. package/src/jscommon/umychart.version.js +0 -30
  57. package/src/jscommon/umychart.vue/umychart.aliYunnetwork.vue.js +0 -56
  58. package/src/jscommon/umychart.vue.build/buildall.bat +0 -4
  59. package/src/jscommon/umychart.vue.build/copy_codemirror.bat +0 -2
  60. package/src/jscommon/umychart.vue.build/umychart.aliYunnetwork.vue.export.js +0 -9
  61. package/src/jscommon/umychart.vue.build/umychart.dragdiv.bat +0 -1
  62. package/src/jscommon/umychart.vue.build/umychart.dragdiv.export.js +0 -6
  63. package/src/jscommon/umychart.vue.build/umychart.index.data.bat +0 -1
  64. package/src/jscommon/umychart.vue.build/umychart.index.data.export.js +0 -4
  65. package/src/jscommon/umychart.vue.build/umychart.listctrl.vue.export.js +0 -15
  66. package/src/jscommon/umychart.vue.build/umychart.regressiontest.vue.export.js +0 -7
  67. package/src/jscommon/umychart.vue.build/umychart.regressiontest.wechat.export.js +0 -12
  68. package/src/jscommon/umychart.vue.build/umychart.stock.bat +0 -1
  69. package/src/jscommon/umychart.vue.build/umychart.stock.vue.export.js +0 -16
  70. package/src/jscommon/umychart.vue.build/umychart.testdata.bat +0 -3
  71. package/src/jscommon/umychart.vue.build/umychart.testdata.vue.export.js +0 -7
  72. package/src/jscommon/umychart.vue.build/umychart.vue.bat +0 -8
  73. package/src/jscommon/umychart.vue.build/umychart.vue.export.js +0 -112
  74. package/src/jscommon/umychart.vue.components/empyt.vue +0 -51
  75. package/src/jscommon/umychart.vue.components/historydayline.vue +0 -240
  76. package/src/jscommon/umychart.vue.components/jsloader.adddialog.vue +0 -315
  77. package/src/jscommon/umychart.vue.components/jsloader.vue +0 -93
  78. package/src/jscommon/umychart.vue.components/jsvuecontainer.vue +0 -160
  79. package/src/jscommon/umychart.vue.components/jsvuecontainer2.0.vue +0 -391
  80. package/src/jscommon/umychart.vue.components/login.vue +0 -178
  81. package/src/jscommon/umychart.vue.components/queryContent.vue +0 -750
  82. package/src/jscommon/umychart.vue.components/readme.txt +0 -8
  83. package/src/jscommon/umychart.vue.components/searchsymbol.vue +0 -299
  84. package/src/jscommon/umychart.vue.components/simulatetrade.vue +0 -1471
  85. package/src/jscommon/umychart.vue.components/stockchart.vue +0 -343
  86. package/src/jscommon/umychart.vue.components/stockchartV2.vue +0 -195
  87. package/src/jscommon/umychart.vue.components/stockdeal.vue +0 -358
  88. package/src/jscommon/umychart.vue.components/stockdealcount.vue +0 -262
  89. package/src/jscommon/umychart.vue.components/stockdeallastest.vue +0 -316
  90. package/src/jscommon/umychart.vue.components/stockdrawtool.vue +0 -343
  91. package/src/jscommon/umychart.vue.components/stockfull.vue +0 -355
  92. package/src/jscommon/umychart.vue.components/stockinfo.demo.vue +0 -153
  93. package/src/jscommon/umychart.vue.components/stockinfo.vue +0 -685
  94. package/src/jscommon/umychart.vue.components/stockkline.demo.vue +0 -1904
  95. package/src/jscommon/umychart.vue.components/stockmultiorder.vue +0 -174
  96. package/src/jscommon/umychart.vue.components/stockmultiperiod.vue +0 -222
  97. package/src/jscommon/umychart.vue.components/stockorder.vue +0 -320
  98. package/src/jscommon/umychart.vue.components/stocktradeinfo.demo.vue +0 -250
  99. package/src/jscommon/umychart.vue.components/stocktradeinfo.vue +0 -1907
  100. package/src/jscommon/umychart.vue.components/test.vue +0 -0
  101. package/src/jscommon/umychart.wechat/getDate.wechat.js +0 -91
  102. package/src/jscommon/umychart.wechat/lighter.news.wechat.js +0 -262
  103. package/src/jscommon/umychart.wechat/readme.txt +0 -3
  104. package/src/jscommon/umychart.wechat/umychart.analyze.wechat.js +0 -551
  105. package/src/jscommon/umychart.wechat/umychart.apidraw.wechat.js +0 -126
  106. package/src/jscommon/umychart.wechat/umychart.bigV.wechat.js +0 -2510
  107. package/src/jscommon/umychart.wechat/umychart.chartframe.wechat.js +0 -2931
  108. package/src/jscommon/umychart.wechat/umychart.chartpaint.wechat.js +0 -9752
  109. package/src/jscommon/umychart.wechat/umychart.charttitle.wechat.js +0 -2023
  110. package/src/jscommon/umychart.wechat/umychart.complier.wechat.js +0 -14726
  111. package/src/jscommon/umychart.wechat/umychart.console.wechat.js +0 -8
  112. package/src/jscommon/umychart.wechat/umychart.coordinatedata.wechat.js +0 -3654
  113. package/src/jscommon/umychart.wechat/umychart.data.wechat.js +0 -2243
  114. package/src/jscommon/umychart.wechat/umychart.element.wechart.js +0 -132
  115. package/src/jscommon/umychart.wechat/umychart.explainer.wechat.js +0 -1077
  116. package/src/jscommon/umychart.wechat/umychart.extendchart.wechat.js +0 -1140
  117. package/src/jscommon/umychart.wechat/umychart.framesplit.wechat.js +0 -2247
  118. package/src/jscommon/umychart.wechat/umychart.hqIndexformula.wechat.js +0 -941
  119. package/src/jscommon/umychart.wechat/umychart.index.data.wechat.js +0 -3628
  120. package/src/jscommon/umychart.wechat/umychart.index.wechat.js +0 -4074
  121. package/src/jscommon/umychart.wechat/umychart.klineinfo.wechat.js +0 -836
  122. package/src/jscommon/umychart.wechat/umychart.markethot.js +0 -50
  123. package/src/jscommon/umychart.wechat/umychart.network.wechart.js +0 -62
  124. package/src/jscommon/umychart.wechat/umychart.news.wechat.js +0 -3568
  125. package/src/jscommon/umychart.wechat/umychart.regressiontest.wechat.js +0 -412
  126. package/src/jscommon/umychart.wechat/umychart.report.wechat.js +0 -3983
  127. package/src/jscommon/umychart.wechat/umychart.resource.wechat.js +0 -919
  128. package/src/jscommon/umychart.wechat/umychart.shareimage.wechat.js +0 -681
  129. package/src/jscommon/umychart.wechat/umychart.simulatetrade.wechat.js +0 -238
  130. package/src/jscommon/umychart.wechat/umychart.stock.wechat.js +0 -4035
  131. package/src/jscommon/umychart.wechat/umychart.style.wechat.js +0 -419
  132. package/src/jscommon/umychart.wechat/umychart.uniapp.canvas.helper.js +0 -99
  133. package/src/jscommon/umychart.wechat/umychart.user.wechat.js +0 -588
  134. package/src/jscommon/umychart.wechat/umychart.userlog.wechat.js +0 -240
  135. package/src/jscommon/umychart.wechat/umychart.vedio.wechat.js +0 -112
  136. package/src/jscommon/umychart.wechat/umychart.version.wechat.js +0 -36
  137. package/src/jscommon/umychart.wechat/umychart.wechat.3.0.js +0 -12051
  138. package/src/jscommon/umychart.wechat/umychart.wechat.js +0 -15460
  139. package/src/jscommon/umychart.worker.js +0 -114
  140. package/src/jscommon/umychart.ws.stock.js +0 -110
  141. package/src/jscommon/umychart_python/.vscode/launch.json +0 -15
  142. package/src/jscommon/umychart_python/__init__.py +0 -4
  143. package/src/jscommon/umychart_python/build.cmd +0 -2
  144. package/src/jscommon/umychart_python/setup.py +0 -25
  145. package/src/jscommon/umychart_python/umychart_cache_testcase.py +0 -165
  146. package/src/jscommon/umychart_python/umychart_complier_data.py +0 -781
  147. package/src/jscommon/umychart_python/umychart_complier_help.py +0 -175
  148. package/src/jscommon/umychart_python/umychart_complier_job.py +0 -193
  149. package/src/jscommon/umychart_python/umychart_complier_jsalgorithm.py +0 -4144
  150. package/src/jscommon/umychart_python/umychart_complier_jscomplier.py +0 -177
  151. package/src/jscommon/umychart_python/umychart_complier_jsexecute.py +0 -517
  152. package/src/jscommon/umychart_python/umychart_complier_jsparser.py +0 -864
  153. package/src/jscommon/umychart_python/umychart_complier_jssymboldata.py +0 -1238
  154. package/src/jscommon/umychart_python/umychart_complier_jssymboldata_cache.py +0 -146
  155. package/src/jscommon/umychart_python/umychart_complier_jssymboldata_json.py +0 -106
  156. package/src/jscommon/umychart_python/umychart_complier_pandas_help.py +0 -80
  157. package/src/jscommon/umychart_python/umychart_complier_scanner.py +0 -554
  158. package/src/jscommon/umychart_python/umychart_complier_testcase.py +0 -362
  159. package/src/jscommon/umychart_python/umychart_complier_util.py +0 -30
  160. package/src/jscommon/umychart_python/umychart_webtemplate.py +0 -131
  161. package/src/jscommon/umychart_python/updatehqchartweb.bat +0 -5
  162. package/src/jscommon/vendor.js +0 -2
  163. package/src/pages/block.list.demo.page/App.vue +0 -117
  164. package/src/pages/block.list.demo.page/index.js +0 -12
  165. package/src/pages/brushTool.demo.page/App.vue +0 -19
  166. package/src/pages/brushTool.demo.page/index.js +0 -12
  167. package/src/pages/container.demo.page/App.vue +0 -118
  168. package/src/pages/container.demo.page/index.js +0 -18
  169. package/src/pages/dataZoom.demo.page/App.vue +0 -265
  170. package/src/pages/dataZoom.demo.page/components/dataZoom.vue +0 -303
  171. package/src/pages/dataZoom.demo.page/index.js +0 -12
  172. package/src/pages/historydayline.demo.page/App.vue +0 -57
  173. package/src/pages/historydayline.demo.page/index.js +0 -12
  174. package/src/pages/hq.demo.page/App.vue +0 -163
  175. package/src/pages/hq.demo.page/index.js +0 -12
  176. package/src/pages/hqchart.black/App.vue +0 -90
  177. package/src/pages/hqchart.black/components/searchsymbol.vue +0 -299
  178. package/src/pages/hqchart.black/components/stockdrawtool.vue +0 -300
  179. package/src/pages/hqchart.black/components/stockfull.vue +0 -313
  180. package/src/pages/hqchart.black/components/stockinfo.vue +0 -428
  181. package/src/pages/hqchart.black/components/stockkline.demo.vue +0 -1652
  182. package/src/pages/hqchart.black/components/stocktradeinfo.vue +0 -1337
  183. package/src/pages/hqchart.black/index.js +0 -30
  184. package/src/pages/hqchart.black/router/candlestickChart.vue +0 -108
  185. package/src/pages/hqchart.black/router/pricePointsTable.vue +0 -294
  186. package/src/pages/hqchart.black/router/stockDeallas.vue +0 -417
  187. package/src/pages/hqchart.black/router/timeShareChart.vue +0 -108
  188. package/src/pages/hqchart.page/App.vue +0 -101
  189. package/src/pages/hqchart.page/index.js +0 -18
  190. package/src/pages/index/App.vue +0 -1408
  191. package/src/pages/index/index.js +0 -7
  192. package/src/pages/indexHq/App.vue +0 -110
  193. package/src/pages/indexHq/index.js +0 -18
  194. package/src/pages/login.demo.page/App.vue +0 -22
  195. package/src/pages/login.demo.page/index.js +0 -12
  196. package/src/pages/queryContent.demo.page/App.vue +0 -29
  197. package/src/pages/queryContent.demo.page/index.js +0 -18
  198. package/src/pages/ranking.black/App.vue +0 -199
  199. package/src/pages/ranking.black/index.js +0 -18
  200. package/src/pages/search.demo.page/App.vue +0 -28
  201. package/src/pages/search.demo.page/index.js +0 -12
  202. package/src/pages/simulatetrade.demo.page/app.vue +0 -121
  203. package/src/pages/simulatetrade.demo.page/index.js +0 -17
  204. package/src/pages/stockdeal.demo.page/App.vue +0 -63
  205. package/src/pages/stockdeal.demo.page/index.js +0 -19
  206. package/src/pages/stockdealcount.demo.page/App.vue +0 -37
  207. package/src/pages/stockdealcount.demo.page/index.js +0 -12
  208. package/src/pages/stockdeallastest.demo.page/App.vue +0 -74
  209. package/src/pages/stockdeallastest.demo.page/index.js +0 -18
  210. package/src/pages/stockinfo.demo.page/App.vue +0 -92
  211. package/src/pages/stockinfo.demo.page/index.html +0 -13
  212. package/src/pages/stockinfo.demo.page/index.js +0 -19
  213. package/src/pages/stockkline.demo.page/App.vue +0 -55
  214. package/src/pages/stockkline.demo.page/index.js +0 -18
  215. package/src/pages/stockmultiorder.demo.page/App.vue +0 -149
  216. package/src/pages/stockmultiorder.demo.page/index.js +0 -18
  217. package/src/pages/stockmultiperiod.demo.page/App.vue +0 -87
  218. package/src/pages/stockmultiperiod.demo.page/index.js +0 -18
  219. package/src/pages/stockorder.demo.page/App.vue +0 -69
  220. package/src/pages/stockorder.demo.page/index.js +0 -18
  221. package/src/pages/test/App.vue +0 -22
  222. package/src/pages/test/index.js +0 -7
  223. package/src/pages/tradeinfopage/app.vue +0 -40
  224. package/src/pages/tradeinfopage/index.js +0 -7
  225. package/src/pages/tradeinfopage/tradeinfo.html +0 -12
  226. package/src/utils/urlObj.js +0 -81
  227. package/src/vendor.js +0 -2
  228. package/webpack.config.js +0 -104
@@ -1,681 +0,0 @@
1
- //小程序 分享绘图类
2
-
3
-
4
- var g_JSShareImageResource =
5
- {
6
- Domain: "https://opensource.zealink.com", //API域名
7
- CacheDomain: "https://opensourcecache.zealink.com", //缓存域名
8
- CacheDomain2:"https://opensourcecache2.zealink.com"
9
- }
10
-
11
- function JSCanvasElement()
12
- {
13
- this.Height;
14
- this.Width;
15
- this.ID;
16
-
17
- //获取画布
18
- this.GetContext = function ()
19
- {
20
- return wx.createCanvasContext(this.ID);
21
- }
22
- }
23
-
24
- function JSShareChart(element)
25
- {
26
- this.CanvasElement = element;
27
- this.SharePaint;
28
- this.Canvas = element.GetContext("2d"); //画布
29
-
30
- this.ChartBorder = new ShareChartBorder();
31
- this.ChartBorder.UIElement = element;
32
- this.Callback; //事件回调 function(事件名称, this)
33
-
34
- this.OnSize = function ()
35
- {
36
- if (this.SharePaint)
37
- {
38
- if (typeof(this.SharePaint.SetSizeChage)=='function') this.SharePaint.SetSizeChage(true);
39
- this.SharePaint.Draw();
40
- }
41
- }
42
-
43
- this.SetOption = function (option)
44
- {
45
- var chart=null;
46
- switch(option.Type)
47
- {
48
- case '大V分享':
49
- chart=new BigVShare();
50
- break;
51
- case '调研分享':
52
- chart=new ResearchShare();
53
- break;
54
- }
55
-
56
- if (option.Callback) this.Callback=option.Callback;
57
- chart.Canvas = this.Canvas;
58
- chart.ChartBorder = this.ChartBorder;
59
- chart.SetOption(option);
60
- this.SharePaint=chart;
61
- if (option.DrawSkeleton) this.DrawSkeleton();
62
- else this.Draw();
63
- }
64
-
65
- this.Draw=function()
66
- {
67
- if (!this.SharePaint) return;
68
- this.SharePaint.Draw();
69
-
70
- var self =this;
71
- this.Canvas.draw(false,
72
- function()
73
- {
74
- console.log('[JSShareChart:draw] finish.');
75
- if (self.Callback)
76
- {
77
- console.log('[JSShareChart:draw] wait 2s to invoke callback function.');
78
- setTimeout( function() { self.Callback('JSShareChart.Draw.Finish', this) }, 2000) //延迟2秒在通知 确保图已经画好了
79
- }
80
- }
81
- );
82
- }
83
-
84
- this.Save=function(callback) //保存到临时目录
85
- {
86
- var width = this.ChartBorder.GetChartWidth();
87
- var height = this.ChartBorder.GetChartHeight();
88
- wx.canvasToTempFilePath({
89
- x: 0,
90
- y: 0,
91
- width: width,
92
- height: height,
93
- canvasId: this.ChartBorder.UIElement.ID,
94
- success: function (res)
95
- {
96
- var saveFilePath = res.tempFilePath;
97
- console.log('[JSShareChart::Save]', saveFilePath);
98
- if (callback) callback(saveFilePath);
99
- }
100
- })
101
- }
102
-
103
- this.DrawSkeleton=function()
104
- {
105
- if (!this.SharePaint) return;
106
- if (!this.SharePaint.DrawSkeleton) return;
107
- this.SharePaint.DrawSkeleton();
108
- this.Canvas.draw(false,
109
- function()
110
- {
111
- console.log('[JSShareChart:DrawSkeleton] finish.');
112
- }
113
- );
114
- }
115
- }
116
-
117
- //初始化
118
- JSShareChart.Init = function (uielement)
119
- {
120
- console.log('[JSShareChart.Init] uielement', uielement);
121
- var jsChartControl = new JSShareChart(uielement);
122
- jsChartControl.OnSize();
123
-
124
- return jsChartControl;
125
- }
126
-
127
- JSShareChart.SetDomain = function (domain, cacheDomain, cacheDomain2)
128
- {
129
- if (domain) g_JSShareImageResource.Domain = domain;
130
- if (cacheDomain) g_JSShareImageResource.CacheDomain = cacheDomain;
131
- if (cacheDomain2) g_JSShareImageResource.CacheDomain2 = cacheDomain2;
132
- }
133
-
134
- //批量下载数据
135
- function JSDownloadControl()
136
- {
137
- this.Callback; //下载完成通知事件(每下完一个文件都回调用))
138
- this.FileData; //Key:url Value: { Local:本地地址, Status: 状态 0=空闲 1=下载中, 2=生成二维码, 20=下载成功 30=失败 , Message:错误信息, QRCode:二维码}
139
- //QRCode:{Product:产品id, Path:小程序路径, Url:返回的链接地址}
140
-
141
- this.QRCodeApiUrl ='/api/GetWXACode';
142
-
143
- //设置下载文件
144
- this.SetFiles=function(files)
145
- {
146
- this.FileData=new Map();
147
- for(var i in files)
148
- {
149
- var item=files[i];
150
- if (typeof(item)=='string')
151
- {
152
- if (this.FileData.has(item)) continue;
153
- this.FileData.set(files[i],{ Status:0 });
154
- }
155
- else //二维码
156
- {
157
- this.FileData.set(item.Name, { Status: 0, QRCode: item }); //后期会添加url,修改Status
158
- }
159
- }
160
- }
161
-
162
- //开始下载
163
- this.Start=function()
164
- {
165
- var self=this;
166
- for (var item of this.FileData)
167
- {
168
- console.log('[JSDownloadControl::Start] start dowloand ', item[0]);
169
- var value = item[1];
170
- if (value.QRCode) //二维码 需要先生成
171
- {
172
- this.CreateQRCode(value.QRCode,item[0]);
173
- }
174
- else
175
- {
176
- value.Status=1;
177
- this.DowloadSingleFile(item[0], item[0]);
178
- }
179
- }
180
- }
181
-
182
- this.GetLocalFile=function(url)
183
- {
184
- if (!this.FileData) return null;
185
- if (!this.FileData.has(url)) return null;
186
-
187
- var item = this.FileData.get(url);
188
- return item;
189
- }
190
-
191
- //是否下载完成
192
- this.IsDoloadFinish=function()
193
- {
194
- if (!this.FileData) return true;
195
-
196
- for(var item of this.FileData) //判断是否全部下载完成
197
- {
198
- if (item[1].Status<=10) return false;
199
- }
200
-
201
- return true;
202
- }
203
-
204
- //内部方法
205
-
206
- //单个文件下载
207
- this.DowloadSingleFile = function (file,id)
208
- {
209
- var url = file;
210
- var key = id;
211
- var self = this;
212
-
213
- if (url.indexOf('../')===0) //本地图片 不用下载
214
- {
215
- var item = self.FileData.get(key);
216
- item.Status = 20;
217
- item.Local = url;
218
- }
219
- else
220
- {
221
- wx.downloadFile({
222
- url: url,
223
- success(res) {
224
- console.log('[JSDownloadControl::DowloadSingleFile] dowload finish', url);
225
- var item = self.FileData.get(key);
226
- if (res.statusCode === 200) {
227
- item.Status = 20;
228
- item.Local = res.tempFilePath;
229
- }
230
- else {
231
- item.Status = 30;
232
- item.Message = res.errMsg;
233
- }
234
-
235
- if (self.Callback) self.Callback(self);
236
- }
237
- })
238
- }
239
- }
240
-
241
- this.CreateQRCode=function(qrParam,id)
242
- {
243
- var self=this;
244
- var key=id;
245
- console.log('[JSDownloadControl::CreateQRCode] request data', qrParam.Product, qrParam.Path);
246
- wx.request({
247
- url: g_JSShareImageResource.Domain + this.QRCodeApiUrl,
248
- data:
249
- {
250
- "Product": qrParam.Product,
251
- "Path": qrParam.Path,
252
- "Width": 280,
253
- "IsHyaline": true
254
- },
255
- method: 'POST',
256
- dataType: 'json',
257
- success: function (data)
258
- {
259
- if (data.data.code === 0){
260
- var relativeUrl = data.data.relativeurl;
261
- var qrUrl = g_JSShareImageResource.CacheDomain2 + '/' + relativeUrl;
262
- console.log('[JSDownloadControl::CreateQRCode] QR image url', qrUrl);
263
- var item = self.FileData.get(key);
264
- item.Url = qrUrl; //地址
265
- item.Status = 1; //下载中
266
- self.DowloadSingleFile(qrUrl, key);
267
- }else{
268
- var item = self.FileData.get(key);
269
- item.Url = ''; //地址
270
- item.Status = 30; //失败
271
- }
272
-
273
- },
274
- fail:function(data){
275
- var item = self.FileData.get(key);
276
- item.Url = ''; //地址
277
- item.Status = 30; //失败
278
- }
279
- });
280
- }
281
- }
282
-
283
- function ISharePainting()
284
- {
285
- this.Canvas; //画布
286
- this.ChartBorder; //边框信息
287
- this.Name; //名称
288
- this.ClassName='ISharePainting'; //类名
289
- this.Data; //数据区
290
- this.IsShow=true;
291
- this.IsDebug = false;
292
-
293
- //绘制接口
294
- this.Draw=function()
295
- {
296
-
297
- }
298
-
299
- //画骨架屏接口
300
- this.DrawSkeleton=null;
301
-
302
- //设置接口
303
- this.SetOption=function(option)
304
- {
305
-
306
- }
307
-
308
-
309
- this.SetBorder=function(option)
310
- {
311
- if (option.Border)
312
- {
313
- if (option.Border.Left >= 0) this.ChartBorder.Left = option.Border.Left;
314
- if (option.Border.Top >= 0) this.ChartBorder.Top = option.Border.Top;
315
- if (option.Border.Right >= 0) this.ChartBorder.Right = option.Border.Right;
316
- if (option.Border.Bottom >= 0) this.ChartBorder.Bottom = option.Border.Bottom;
317
- }
318
- }
319
-
320
- this.CalculateText=function(text,width)
321
- {
322
- var aryText=[];
323
- var outText='';
324
- var word=null,preWord=null;
325
- for(var i=0;i<text.length;++i)
326
- {
327
- word=text[i];
328
- if (word=='\r') //换行
329
- {
330
- aryText.push(outText);
331
- outText = '';
332
- }
333
- else if (word=='\n')
334
- {
335
- if (preWord!='\r') //\r\n 不处理
336
- {
337
- aryText.push(outText);
338
- outText = '';
339
- }
340
- }
341
- else
342
- {
343
- outText+=text[i];
344
- var textWidth = this.Canvas.measureText(outText).width;
345
- if (textWidth>=width)
346
- {
347
- aryText.push(outText);
348
- outText='';
349
- }
350
- }
351
-
352
- preWord = word;
353
- }
354
-
355
- if (outText.length > 0) aryText.push(outText);
356
- console.log('[ISharePainting::CalculateText]', aryText)
357
- return aryText;
358
- }
359
-
360
- this.FillMulitLineText=function(obj)
361
- {
362
- var left=obj.Left;
363
- var top=obj.Top;
364
- var fontHeight=obj.FontHeight;
365
- var width=obj.Width;
366
- var height=obj.Height;
367
- var lineSpace=obj.LineSpace; //行间距
368
- var bottom = top + height;
369
-
370
- for(var i in obj.Text)
371
- {
372
- var item = obj.Text[i];
373
- this.Canvas.fillText(item, left, top, width);
374
- top += fontHeight + lineSpace;
375
- if (top + fontHeight>bottom) break;
376
- }
377
- }
378
-
379
- this.LogRect = function (left, right, width, height)
380
- {
381
- if (this.IsDebug == false) return;
382
- this.Canvas.strokeStyle = 'rgb(100,100,100)';
383
- this.Canvas.strokeRect(left, right, width, height);
384
- }
385
-
386
- //默认骨架屏画法
387
- this.Default_DrawSkeleton=function(option)
388
- {
389
- var left = this.ChartBorder.GetLeft();
390
- var right = this.ChartBorder.GetRight();
391
- var top = this.ChartBorder.GetTop();
392
- var bottom = this.ChartBorder.GetBottom();
393
- var width = this.ChartBorder.GetWidth();
394
-
395
- this.Canvas.fillStyle = 'rgb(192,192,192)';
396
- this.Canvas.beginPath();
397
- //标题
398
- var textLeft = left, textTop = top, textWidth = (right - left), textHeight = 35;
399
- this.Canvas.rect(textLeft, textTop, textWidth, textHeight);
400
-
401
- //头像(圆)
402
- var imageSize = 40;
403
- var imageLeft = left, imageTop = 73;
404
- var radius = imageSize / 2;
405
- //this.Canvas.rect(imageLeft, imageTop, imageSize, imageSize);
406
- this.Canvas.arc(imageLeft + radius, imageTop + radius, radius, 0, 2 * Math.PI);
407
-
408
-
409
- //名字
410
- var textLeft = left + imageSize + 16, textRight = right-20, textHeight=20;
411
- var textTop = 73 + (imageSize - textHeight)/2;
412
- this.Canvas.rect(textLeft, textTop, (textRight - textLeft), textHeight);
413
-
414
- //内容:
415
- var textLeft = left, textTop = 142, textRight = right, textWidth = textRight - textLeft;
416
- var textHeight = 100;
417
- this.Canvas.rect(textLeft, textTop, textWidth, textHeight);
418
-
419
- //二维码(圆)
420
- var imageSize = 80;
421
- var radius = imageSize/2;
422
- var imageLeft = left, imageTop = bottom - imageSize;
423
- //this.Canvas.rect(imageLeft, imageTop, imageSize, imageSize);
424
- this.Canvas.arc(imageLeft + radius, imageTop + radius, radius, 0, 2 * Math.PI);
425
-
426
- //右边文字
427
- var textLeft = imageLeft + imageSize + 10, textRight = right, textWidth = textRight - textLeft;
428
- var textHeight = 20;
429
- var textTop = bottom - imageSize + (imageSize - (20+16+5)) / 2;
430
- this.Canvas.rect(textLeft, textTop, textWidth, textHeight);
431
-
432
- textTop+=textHeight+5;
433
- textHeight=16
434
- this.Canvas.rect(textLeft, textTop, textWidth-10, textHeight);
435
-
436
- this.Canvas.fill(); //统一最后填充颜色, 提高效率(不单独使用fillRect)
437
- }
438
- }
439
-
440
- //边框信息
441
- function ShareChartBorder()
442
- {
443
- this.UIElement;
444
-
445
- //四周间距
446
- this.Left=50;
447
- this.Right=80;
448
- this.Top=50;
449
- this.Bottom=50;
450
-
451
- this.GetChartWidth=function()
452
- {
453
- return this.UIElement.Width;
454
- }
455
-
456
- this.GetChartHeight=function()
457
- {
458
- return this.UIElement.Height;
459
- }
460
-
461
- this.GetLeft=function()
462
- {
463
- return this.Left;
464
- }
465
-
466
- this.GetRight=function()
467
- {
468
- return this.UIElement.Width-this.Right;
469
- }
470
-
471
- this.GetTop=function()
472
- {
473
- return this.Top;
474
- }
475
-
476
-
477
- this.GetBottom=function()
478
- {
479
- return this.UIElement.Height-this.Bottom;
480
- }
481
-
482
-
483
- this.GetWidth=function()
484
- {
485
- return this.UIElement.Width-this.Left-this.Right;
486
- }
487
-
488
- this.GetHeight=function()
489
- {
490
- return this.UIElement.Height-this.Top-this.Bottom;
491
- }
492
- }
493
-
494
- //大V
495
- function BigVShare()
496
- {
497
- this.newMethod=ISharePainting; //派生
498
- this.newMethod();
499
- delete this.newMethod;
500
-
501
- this.DrawSkeleton = this.Default_DrawSkeleton; //骨架屏画法用默认的(如果要定制的, 重写这个方法)
502
- this.ClassName = 'BigVShare'; //类名
503
- this.Title; //标题
504
- this.Content; //内容
505
- this.QRCode; //二维码图地址
506
- this.BGImage = 'https://opensourcecache.zealink.com/cache/wechat/shareimage/bigv/bg.png'; //背景图片地址
507
- this.Avatar; //头像图片地址
508
-
509
- this.Draw=function()
510
- {
511
- var left=this.ChartBorder.GetLeft();
512
- var right=this.ChartBorder.GetRight();
513
- var top=this.ChartBorder.GetTop();
514
- var bottom=this.ChartBorder.GetBottom();
515
-
516
- if (this.BGImage)
517
- {
518
- //console.log('[BigVShare::Draw]', this.BGImage);
519
- this.Canvas.drawImage(this.BGImage, 0, 0, this.ChartBorder.GetChartWidth(), this.ChartBorder.GetChartHeight());
520
- }
521
-
522
- if (this.Title)
523
- {
524
- var textLeft = left, textTop = top, textWidth=(right-left),textHeight=35;
525
- this.Canvas.font = 'bold 14px PingFang';
526
- this.Canvas.textAlign = "left";
527
- this.Canvas.textBaseline = "top";
528
- this.Canvas.fillStyle = 'rgb(51,51,51)';
529
- var aryText=this.CalculateText(this.Title, textWidth);
530
-
531
- var drawObject = { Left: textLeft, Top: textTop, Text: aryText, FontHeight: 14, Width: textWidth, Height: textHeight, LineSpace:3};
532
- this.FillMulitLineText(drawObject);
533
-
534
- this.LogRect(textLeft, textTop, textWidth, textHeight);
535
- }
536
-
537
- var imageSize=0;
538
- if (this.Avatar) //头像
539
- {
540
- imageSize = 39;
541
- var imageLeft = left, imageTop = 73;
542
- this.Canvas.drawImage(this.Avatar, imageLeft, imageTop, imageSize, imageSize);
543
- }
544
-
545
- if (this.Author) //作者名字
546
- {
547
- var textLeft = left + imageSize+16,textRight = right, textWidth = textRight - textLeft;
548
- var textHeight = 39;
549
- var textTop = 73 + textHeight/2;
550
- this.Canvas.font = 'bold 12px PingFang';
551
- this.Canvas.textAlign = "left";
552
- this.Canvas.textBaseline = "middle";
553
- this.Canvas.fillStyle = 'rgb(51,51,51)';
554
- this.Canvas.fillText(this.Author, textLeft, textTop, textWidth);
555
- }
556
-
557
- if (this.Content)
558
- {
559
- var textLeft = left + 12, textTop = 142, textRight = right - 12, textWidth = textRight - textLeft;
560
- var textHeight=92;
561
- this.Canvas.font = '12px PingFang';
562
- this.Canvas.textAlign = "left";
563
- this.Canvas.textBaseline = "top";
564
- this.Canvas.fillStyle = 'rgb(104,113,120)';
565
- var aryText = this.CalculateText(this.Content, textWidth);
566
- var drawObject = { Left: textLeft, Top: textTop, Text: aryText, FontHeight: 12, Width: textWidth, Height: textHeight, LineSpace: 3 };
567
- this.FillMulitLineText(drawObject);
568
-
569
- this.LogRect(textLeft, textTop, textWidth, textHeight);
570
- }
571
-
572
- if (this.QRCode)
573
- {
574
- var imageSize=80;
575
- var imageLeft = left, imageTop = bottom - imageSize;
576
- this.Canvas.drawImage(this.QRCode, imageLeft, imageTop, imageSize, imageSize);
577
- }
578
-
579
- this.LogRect(0, 0, this.ChartBorder.GetChartWidth(), this.ChartBorder.GetChartHeight());
580
- }
581
-
582
- this.SetOption=function(option)
583
- {
584
- if (!option) return;
585
- this.SetBorder(option);
586
- if (option.Title) this.Title=option.Title;
587
- if (option.Content) this.Content=option.Content;
588
- if (option.QRCode) this.QRCode = option.QRCode;
589
- if (option.BGImage) this.BGImage=option.BGImage;
590
- if (option.Avatar) this.Avatar = option.Avatar;
591
- if (option.Author) this.Author = option.Author;
592
- }
593
- }
594
-
595
- //调研
596
- function ResearchShare()
597
- {
598
- this.newMethod = ISharePainting; //派生
599
- this.newMethod();
600
- delete this.newMethod;
601
-
602
- this.DrawSkeleton = this.Default_DrawSkeleton; //骨架屏画法用默认的(如果要定制的, 重写这个方法)
603
- this.ClassName = 'ResearchShare'; //类名
604
- this.Logo; //公司图标
605
- this.Content; //内容
606
- this.QRCode; //二维码图地址
607
- this.Company; //公司名称
608
- this.BGImage ='https://opensourcecache.zealink.com/cache/wechat/shareimage/research/bg.png'; //背景图
609
-
610
- this.SetOption = function (option)
611
- {
612
- if (!option) return;
613
- this.SetBorder(option);
614
- if (option.Logo) this.Logo = option.Logo;
615
- if (option.Company) this.Company = option.Company;
616
- if (option.Content) this.Content = option.Content;
617
- if (option.QRCode) this.QRCode = option.QRCode;
618
- if (option.BGImage) this.BGImage = option.BGImage;
619
- }
620
-
621
- this.Draw = function ()
622
- {
623
- var left = this.ChartBorder.GetLeft();
624
- var right = this.ChartBorder.GetRight();
625
- var top = this.ChartBorder.GetTop();
626
- var bottom = this.ChartBorder.GetBottom();
627
-
628
- if (this.BGImage) this.Canvas.drawImage(this.BGImage, 0, 0, this.ChartBorder.GetChartWidth(), this.ChartBorder.GetChartHeight());
629
-
630
- var imageSize = 0;
631
- if (this.Logo) {
632
- imageSize = 39;
633
- var imgLeft = left,imgTop = 73;
634
- this.Canvas.drawImage(this.Logo, imgLeft, imgTop, imageSize, imageSize);
635
- }
636
-
637
- if (this.Company){
638
- var companyLeft = left + imageSize + 16, companyRight = right, companyWidth = companyRight - companyLeft;
639
- var companyHeight = 39;
640
- var companyTop = 73 + companyHeight/ 2;
641
- this.Canvas.font = 'bold 12px PingFang';
642
- this.Canvas.textAlign = "left";
643
- this.Canvas.textBaseline = "middle";
644
- this.Canvas.fillStyle = 'rgb(51,51,51)';
645
- this.Canvas.fillText(this.Company,companyLeft,companyTop,companyWidth);
646
- }
647
-
648
- if (this.Content) {
649
- var contentLeft = left + 12, contentTop = 142, contentRight = right - 12,contentWidth = contentRight - contentLeft;
650
- var contentHeight = 92;
651
- this.Canvas.font = '12px PingFang';
652
- this.Canvas.textAlign = "left";
653
- this.Canvas.textBaseline = "top";
654
- this.Canvas.fillStyle = 'rgb(104,113,120)';
655
- var textAry = this.CalculateText(this.Content,contentWidth);
656
- var drawObject = { Left: contentLeft, Top: contentTop, Text: textAry, FontHeight: 12, Width: contentWidth, Height: contentHeight, LineSpace: 3 };
657
- this.FillMulitLineText(drawObject);
658
- this.LogRect(contentLeft,contentTop,contentWidth,contentHeight);
659
- }
660
-
661
- if (this.QRCode) {
662
- var imageSize = 80;
663
- var imageLeft = left, imageTop = bottom - imageSize;
664
- this.Canvas.drawImage(this.QRCode, imageLeft, imageTop, imageSize, imageSize);
665
- }
666
-
667
- this.LogRect(0, 0, this.ChartBorder.GetChartWidth(), this.ChartBorder.GetChartHeight());
668
- }
669
- }
670
-
671
-
672
- //导出统一使用JSCommon命名空间名
673
- module.exports =
674
- {
675
- JSCommonShare:
676
- {
677
- JSCanvasElement: JSCanvasElement,
678
- JSShareChart: JSShareChart,
679
- JSDownloadControl: JSDownloadControl,
680
- },
681
- };