Commit 01a31e3e823ca7b224cf34dffd1bdb21b8387778
1 parent
a63fe967
临港公交电子站牌项目
1、修正新组件eBusStop-line-chart,添加线路名信息,到站信息界面逻辑和属性编辑界面
Showing
1 changed file
with
167 additions
and
50 deletions
front-end/h5/src/components/core/plugins/bsth/lggj/eBusStop-line-chart.js
| @@ -13,8 +13,8 @@ export default { | @@ -13,8 +13,8 @@ export default { | ||
| 13 | defaultStyle: { // 默认属性 | 13 | defaultStyle: { // 默认属性 |
| 14 | top: 0, | 14 | top: 0, |
| 15 | left: 0, | 15 | left: 0, |
| 16 | - width: 550, | ||
| 17 | - height: 300 | 16 | + width: 700, |
| 17 | + height: 230 | ||
| 18 | } | 18 | } |
| 19 | }, | 19 | }, |
| 20 | name: 'eBusStop-line-chart', | 20 | name: 'eBusStop-line-chart', |
| @@ -38,6 +38,13 @@ export default { | @@ -38,6 +38,13 @@ export default { | ||
| 38 | count: 0, | 38 | count: 0, |
| 39 | millisecond: 1000 | 39 | millisecond: 1000 |
| 40 | }, | 40 | }, |
| 41 | + | ||
| 42 | + // 注意:css里设定了box-sizing: border-box;,所以组件本身的宽高包括了margin,padding,border | ||
| 43 | + // 所以计算内部其他组件宽高需要减去margin,padding,border | ||
| 44 | + component_width: 350, // 组件宽度 | ||
| 45 | + component_height: 400, // 组件高度 | ||
| 46 | + text_info_width: 350, // 文字信息宽度 | ||
| 47 | + text_info_height: 100, // 文字信息高度 | ||
| 41 | line_width: 350, // 图宽度 | 48 | line_width: 350, // 图宽度 |
| 42 | line_height: 300, // 图高度 | 49 | line_height: 300, // 图高度 |
| 43 | 50 | ||
| @@ -60,9 +67,6 @@ export default { | @@ -60,9 +67,6 @@ export default { | ||
| 60 | 67 | ||
| 61 | eBusStopData: null // 电子站牌数据(EBusStopData类型) | 68 | eBusStopData: null // 电子站牌数据(EBusStopData类型) |
| 62 | } | 69 | } |
| 63 | - | ||
| 64 | - | ||
| 65 | - | ||
| 66 | }, | 70 | }, |
| 67 | props: { | 71 | props: { |
| 68 | useMode: PropTypes.string({ // 自定义使用模式,alone:(单独使用),child:(子组件) | 72 | useMode: PropTypes.string({ // 自定义使用模式,alone:(单独使用),child:(子组件) |
| @@ -97,8 +101,6 @@ export default { | @@ -97,8 +101,6 @@ export default { | ||
| 97 | 101 | ||
| 98 | // 图外层css | 102 | // 图外层css |
| 99 | _flag_2_: PropTypes.string({ label: '', component: null, extra: function (h) { return (<hr data-label="图外层css属性" class="bsth-line-item-divider"></hr>) } }), | 103 | _flag_2_: PropTypes.string({ label: '', component: null, extra: function (h) { return (<hr data-label="图外层css属性" class="bsth-line-item-divider"></hr>) } }), |
| 100 | - line_name_font_size: PropTypes.number({ label: '线路名称字体大小', defaultValue: 30, layout: { prefixCls: 'bsth-line' } }), | ||
| 101 | - line_name_font_color: PropTypes.color({ label: '线路名称字体颜色', defaultValue: '#babdbd', layout: { prefixCls: 'bsth-line' } }), | ||
| 102 | margin_left: PropTypes.number({ label: '图左边margin', defaultValue: 0, layout: { prefixCls: 'bsth-line' } }), | 104 | margin_left: PropTypes.number({ label: '图左边margin', defaultValue: 0, layout: { prefixCls: 'bsth-line' } }), |
| 103 | margin_right: PropTypes.number({ label: '图右边margin', defaultValue: 0, layout: { prefixCls: 'bsth-line' } }), | 105 | margin_right: PropTypes.number({ label: '图右边margin', defaultValue: 0, layout: { prefixCls: 'bsth-line' } }), |
| 104 | margin_top: PropTypes.number({ label: '图上边margin', defaultValue: 0, layout: { prefixCls: 'bsth-line' } }), | 106 | margin_top: PropTypes.number({ label: '图上边margin', defaultValue: 0, layout: { prefixCls: 'bsth-line' } }), |
| @@ -106,31 +108,46 @@ export default { | @@ -106,31 +108,46 @@ export default { | ||
| 106 | border_size: PropTypes.number({ label: '图边框宽度', defaultValue: 0, layout: { prefixCls: 'bsth-line' } }), | 108 | border_size: PropTypes.number({ label: '图边框宽度', defaultValue: 0, layout: { prefixCls: 'bsth-line' } }), |
| 107 | background_color: PropTypes.color({ label: '背景颜色', defaultValue: '#FFFFFF', layout: { prefixCls: 'bsth-line' } }), | 109 | background_color: PropTypes.color({ label: '背景颜色', defaultValue: '#FFFFFF', layout: { prefixCls: 'bsth-line' } }), |
| 108 | // 图内层css | 110 | // 图内层css |
| 109 | - _flag_3_: PropTypes.string({ label: '', component: null, extra: function (h) { return (<hr data-label="图内层css属性" class="bsth-line-item-divider"></hr>) } }), | ||
| 110 | - svg_background: PropTypes.color({ label: '线路图背景颜色', defaultValue: '#9EE0DF', layout: { prefixCls: 'bsth-line' } }), | 111 | + _flag_3_: PropTypes.string({ label: '', component: null, extra: function (h) { return (<hr data-label="图内层线路到达信息css属性" class="bsth-line-item-divider"></hr>) } }), |
| 112 | + text_info_background: PropTypes.color({ label: '信息背景颜色', defaultValue: '#238A94', layout: { prefixCls: 'bsth-line' } }), | ||
| 113 | + line_info_height: PropTypes.number({ label: '线路信息高度', defaultValue: 30, layout: { prefixCls: 'bsth-line' } }), | ||
| 114 | + line_info_name_font_size: PropTypes.number({ label: '线路名称字体大小', defaultValue: 22, layout: { prefixCls: 'bsth-line' } }), | ||
| 115 | + line_info_name_font_color: PropTypes.color({ label: '线路名称字体颜色', defaultValue: '#FFFFFF', layout: { prefixCls: 'bsth-line' } }), | ||
| 116 | + line_info_name_left_padding: PropTypes.number({ label: '线路名称距离左边', defaultValue: 20, layout: { prefixCls: 'bsth-line' } }), | ||
| 117 | + line_info_name_top_padding: PropTypes.number({ label: '线路名称距离上边', defaultValue: 2, layout: { prefixCls: 'bsth-line' } }), | ||
| 118 | + arrive_info_height: PropTypes.number({ label: '到达信息高度', defaultValue: 35, layout: { prefixCls: 'bsth-line' } }), | ||
| 119 | + arrive_info_fix_text_font_size: PropTypes.number({ label: '固定文字字体大小', defaultValue: 18, layout: { prefixCls: 'bsth-line' } }), | ||
| 120 | + arrive_info_fix_text_font_color: PropTypes.color({ label: '固定文字字体颜色', defaultValue: '#FFFFFF', layout: { prefixCls: 'bsth-line' } }), | ||
| 121 | + arrive_info_fix_text_left_padding: PropTypes.number({ label: '固定文字距离左边', defaultValue: 20, layout: { prefixCls: 'bsth-line' } }), | ||
| 122 | + arrive_info_fix_text_top_padding: PropTypes.number({ label: '固定文字距离上边', defaultValue: 2, layout: { prefixCls: 'bsth-line' } }), | ||
| 123 | + arrive_info_stop_text_font_size: PropTypes.number({ label: '开往站点名字体大小', defaultValue: 20, layout: { prefixCls: 'bsth-line' } }), | ||
| 124 | + arrive_info_stop_text_font_color: PropTypes.color({ label: '开往站点名字体颜色', defaultValue: '#FFFFFF', layout: { prefixCls: 'bsth-line' } }), | ||
| 125 | + arrive_info_text_font_size: PropTypes.number({ label: '到达信息字体大小', defaultValue: 20, layout: { prefixCls: 'bsth-line' } }), | ||
| 126 | + arrive_info_text_font_color: PropTypes.color({ label: '到达信息字体颜色', defaultValue: '#FFFFFF', layout: { prefixCls: 'bsth-line' } }), | ||
| 111 | _flag_4_: PropTypes.string({ label: '', component: null, extra: function (h) { return (<hr data-label="图内层上部分矩形css属性" class="bsth-line-item-divider"></hr>) } }), | 127 | _flag_4_: PropTypes.string({ label: '', component: null, extra: function (h) { return (<hr data-label="图内层上部分矩形css属性" class="bsth-line-item-divider"></hr>) } }), |
| 128 | + svg_background: PropTypes.color({ label: '线路图背景颜色', defaultValue: '#9EE0DF', layout: { prefixCls: 'bsth-line' } }), | ||
| 112 | up_rect_left_padding: PropTypes.number({ label: '矩形距离左边', defaultValue: 20, layout: { prefixCls: 'bsth-line' } }), | 129 | up_rect_left_padding: PropTypes.number({ label: '矩形距离左边', defaultValue: 20, layout: { prefixCls: 'bsth-line' } }), |
| 113 | up_rect_right_padding: PropTypes.number({ label: '矩形距离右边', defaultValue: 20, layout: { prefixCls: 'bsth-line' } }), | 130 | up_rect_right_padding: PropTypes.number({ label: '矩形距离右边', defaultValue: 20, layout: { prefixCls: 'bsth-line' } }), |
| 114 | - up_rect_top_padding: PropTypes.number({ label: '矩形距离上边', defaultValue: 20, layout: { prefixCls: 'bsth-line' } }), | 131 | + up_rect_top_padding: PropTypes.number({ label: '矩形距离上边', defaultValue: 3, layout: { prefixCls: 'bsth-line' } }), |
| 115 | up_rect_height: PropTypes.number({ label: '矩形高度', defaultValue: 20, layout: { prefixCls: 'bsth-line' } }), | 132 | up_rect_height: PropTypes.number({ label: '矩形高度', defaultValue: 20, layout: { prefixCls: 'bsth-line' } }), |
| 116 | up_rect_r: PropTypes.number({ label: '矩形圆边大小', defaultValue: 10, layout: { prefixCls: 'bsth-line' } }), | 133 | up_rect_r: PropTypes.number({ label: '矩形圆边大小', defaultValue: 10, layout: { prefixCls: 'bsth-line' } }), |
| 117 | up_rect_b_color: PropTypes.color({ label: '矩形背景颜色', defaultValue: '#9FA067', layout: { prefixCls: 'bsth-line' } }), | 134 | up_rect_b_color: PropTypes.color({ label: '矩形背景颜色', defaultValue: '#9FA067', layout: { prefixCls: 'bsth-line' } }), |
| 118 | _flag_5_: PropTypes.string({ label: '', component: null, extra: function (h) { return (<hr data-label="图内层线路图css属性" class="bsth-line-item-divider"></hr>) } }), | 135 | _flag_5_: PropTypes.string({ label: '', component: null, extra: function (h) { return (<hr data-label="图内层线路图css属性" class="bsth-line-item-divider"></hr>) } }), |
| 119 | chart_left_padding: PropTypes.number({ label: '内部线路图距离左边', defaultValue: 50, layout: { prefixCls: 'bsth-line' } }), | 136 | chart_left_padding: PropTypes.number({ label: '内部线路图距离左边', defaultValue: 50, layout: { prefixCls: 'bsth-line' } }), |
| 120 | chart_right_padding: PropTypes.number({ label: '内部线路图距离右边', defaultValue: 50, layout: { prefixCls: 'bsth-line' } }), | 137 | chart_right_padding: PropTypes.number({ label: '内部线路图距离右边', defaultValue: 50, layout: { prefixCls: 'bsth-line' } }), |
| 121 | - chart_top_padding: PropTypes.number({ label: '内部线路图距离上边', defaultValue: 30, layout: { prefixCls: 'bsth-line' } }), | 138 | + chart_top_padding: PropTypes.number({ label: '内部线路图距离上边', defaultValue: 13, layout: { prefixCls: 'bsth-line' } }), |
| 122 | chart_up_line_path_s_width: PropTypes.number({ label: '上部分线宽度', defaultValue: 5, layout: { prefixCls: 'bsth-line' } }), | 139 | chart_up_line_path_s_width: PropTypes.number({ label: '上部分线宽度', defaultValue: 5, layout: { prefixCls: 'bsth-line' } }), |
| 123 | chart_up_line_path_s_color: PropTypes.color({ label: '上部分线颜色', defaultValue: '#008000', layout: { prefixCls: 'bsth-line' } }), | 140 | chart_up_line_path_s_color: PropTypes.color({ label: '上部分线颜色', defaultValue: '#008000', layout: { prefixCls: 'bsth-line' } }), |
| 124 | chart_up_line_circle_f_color: PropTypes.color({ label: '线圆圈填充色', defaultValue: '#FFFFFF', layout: { prefixCls: 'bsth-line' } }), | 141 | chart_up_line_circle_f_color: PropTypes.color({ label: '线圆圈填充色', defaultValue: '#FFFFFF', layout: { prefixCls: 'bsth-line' } }), |
| 125 | chart_up_line_circle_r: PropTypes.number({ label: '线圆圈大小', defaultValue: 8, layout: { prefixCls: 'bsth-line' } }), | 142 | chart_up_line_circle_r: PropTypes.number({ label: '线圆圈大小', defaultValue: 8, layout: { prefixCls: 'bsth-line' } }), |
| 126 | - chart_station_text_top_padding: PropTypes.number({ label: '站点文字距离上边', defaultValue: 50, layout: { prefixCls: 'bsth-line' } }), | 143 | + chart_station_text_top_padding: PropTypes.number({ label: '站点文字距离上边', defaultValue: 30, layout: { prefixCls: 'bsth-line' } }), |
| 127 | chart_station_text_font_size: PropTypes.number({ label: '站名字体大小', defaultValue: 20, layout: { prefixCls: 'bsth-line' } }), | 144 | chart_station_text_font_size: PropTypes.number({ label: '站名字体大小', defaultValue: 20, layout: { prefixCls: 'bsth-line' } }), |
| 128 | chart_station_text_length: PropTypes.number({ label: '站名长度', defaultValue: 100, layout: { prefixCls: 'bsth-line' } }), | 145 | chart_station_text_length: PropTypes.number({ label: '站名长度', defaultValue: 100, layout: { prefixCls: 'bsth-line' } }), |
| 129 | - chart_up_station_text_font_f_color: PropTypes.color({ label: '上行站名颜色', defaultValue: '#4556b6', layout: { prefixCls: 'bsth-line' } }), | 146 | + chart_up_station_text_font_f_color: PropTypes.color({ label: '站名颜色', defaultValue: '#4556b6', layout: { prefixCls: 'bsth-line' } }), |
| 130 | _flag_6_: PropTypes.string({ label: '', component: null, extra: function (h) { return (<hr data-label="图内层下部分线css属性" class="bsth-line-item-divider"></hr>) } }), | 147 | _flag_6_: PropTypes.string({ label: '', component: null, extra: function (h) { return (<hr data-label="图内层下部分线css属性" class="bsth-line-item-divider"></hr>) } }), |
| 131 | down_line_left_padding: PropTypes.number({ label: '线距离左边', defaultValue: 20, layout: { prefixCls: 'bsth-line' } }), | 148 | down_line_left_padding: PropTypes.number({ label: '线距离左边', defaultValue: 20, layout: { prefixCls: 'bsth-line' } }), |
| 132 | down_line_right_padding: PropTypes.number({ label: '线距离右边', defaultValue: 20, layout: { prefixCls: 'bsth-line' } }), | 149 | down_line_right_padding: PropTypes.number({ label: '线距离右边', defaultValue: 20, layout: { prefixCls: 'bsth-line' } }), |
| 133 | - down_line_bottom_padding: PropTypes.number({ label: '线距离下边', defaultValue: 20, layout: { prefixCls: 'bsth-line' } }), | 150 | + down_line_bottom_padding: PropTypes.number({ label: '线距离下边', defaultValue: 6, layout: { prefixCls: 'bsth-line' } }), |
| 134 | down_line_s_width: PropTypes.number({ label: '线宽度', defaultValue: 5, layout: { prefixCls: 'bsth-line' } }), | 151 | down_line_s_width: PropTypes.number({ label: '线宽度', defaultValue: 5, layout: { prefixCls: 'bsth-line' } }), |
| 135 | down_line_s_color: PropTypes.color({ label: '线颜色', defaultValue: '#277461', layout: { prefixCls: 'bsth-line' } }), | 152 | down_line_s_color: PropTypes.color({ label: '线颜色', defaultValue: '#277461', layout: { prefixCls: 'bsth-line' } }), |
| 136 | down_line_arrow_width: PropTypes.number({ label: '箭头宽度', defaultValue: 55, layout: { prefixCls: 'bsth-line' } }), | 153 | down_line_arrow_width: PropTypes.number({ label: '箭头宽度', defaultValue: 55, layout: { prefixCls: 'bsth-line' } }), |
| @@ -139,8 +156,8 @@ export default { | @@ -139,8 +156,8 @@ export default { | ||
| 139 | 156 | ||
| 140 | render () { | 157 | render () { |
| 141 | const innerDivStyle = { | 158 | const innerDivStyle = { |
| 142 | - 'width': this.line_width + 'px', | ||
| 143 | - 'height': this.line_height + 'px', | 159 | + 'width': this.component_width + 'px', |
| 160 | + 'height': this.component_height + 'px', | ||
| 144 | 'border': this.border_size + 'px solid black', | 161 | 'border': this.border_size + 'px solid black', |
| 145 | 'margin-left': this.margin_left + 'px', | 162 | 'margin-left': this.margin_left + 'px', |
| 146 | 'margin-right': this.margin_right + 'px', | 163 | 'margin-right': this.margin_right + 'px', |
| @@ -150,19 +167,6 @@ export default { | @@ -150,19 +167,6 @@ export default { | ||
| 150 | 'position': 'relative' | 167 | 'position': 'relative' |
| 151 | } | 168 | } |
| 152 | 169 | ||
| 153 | - const lineNameStyle = { | ||
| 154 | - 'height': '44px', | ||
| 155 | - 'position': 'absolute', | ||
| 156 | - 'left': '50%', | ||
| 157 | - 'transform': 'translate(-50%, 0)', | ||
| 158 | - '-webkit-transform': 'translate(-50%, 0)', | ||
| 159 | - 'color': this.line_name_font_color, | ||
| 160 | - 'font-size': this.line_name_font_size + 'px', | ||
| 161 | - 'padding': '20px 0px', | ||
| 162 | - 'font-weight': 'bold', | ||
| 163 | - 'font-family': 'Open Sans, sans-serif' | ||
| 164 | - } | ||
| 165 | - | ||
| 166 | const downLinePathD = | 170 | const downLinePathD = |
| 167 | 'M' + this.down_line_x1 + ' ' + this.down_line_y1 + ' ' + | 171 | 'M' + this.down_line_x1 + ' ' + this.down_line_y1 + ' ' + |
| 168 | 'L' + this.down_line_x2 + ' ' + this.down_line_y2 + ' ' + | 172 | 'L' + this.down_line_x2 + ' ' + this.down_line_y2 + ' ' + |
| @@ -171,14 +175,105 @@ export default { | @@ -171,14 +175,105 @@ export default { | ||
| 171 | 'L' + this.down_line_x5 + ' ' + this.down_line_y5 + ' ' + | 175 | 'L' + this.down_line_x5 + ' ' + this.down_line_y5 + ' ' + |
| 172 | 'Z' | 176 | 'Z' |
| 173 | 177 | ||
| 178 | + const textInfoStyle = { | ||
| 179 | + 'border': '0px', | ||
| 180 | + 'margin': '0px', | ||
| 181 | + 'width': this.text_info_width + 'px', | ||
| 182 | + 'height': this.text_info_height + 'px', | ||
| 183 | + 'background': this.text_info_background | ||
| 184 | + } | ||
| 185 | + | ||
| 186 | + const lineInfoStyle = { | ||
| 187 | + 'border': '0px', | ||
| 188 | + 'margin': '0px', | ||
| 189 | + 'width': this.text_info_width + 'px', | ||
| 190 | + 'height': this.line_info_height + 'px', | ||
| 191 | + 'background': this.text_info_background | ||
| 192 | + } | ||
| 193 | + const lineInfoStyleForLineName = { | ||
| 194 | + 'border': '0px', | ||
| 195 | + 'margin': '0px', | ||
| 196 | + 'width': this.text_info_width / 2 + 'px', | ||
| 197 | + 'height': this.line_info_height + 'px', | ||
| 198 | + 'background': this.text_info_background, | ||
| 199 | + 'color': this.line_info_name_font_color, | ||
| 200 | + 'font-size': this.line_info_name_font_size + 'px', | ||
| 201 | + 'font-weight': 'bold', | ||
| 202 | + 'text-align': 'left', | ||
| 203 | + 'padding-left': this.line_info_name_left_padding + 'px', | ||
| 204 | + 'padding-top': this.line_info_name_top_padding + 'px' | ||
| 205 | + } | ||
| 206 | + | ||
| 207 | + const arriveInfoContainerStyle = { | ||
| 208 | + 'border': '0px', | ||
| 209 | + 'margin': '0px', | ||
| 210 | + 'width': this.text_info_width + 'px', | ||
| 211 | + 'height': this.arrive_info_height + 'px', | ||
| 212 | + 'background': this.text_info_background | ||
| 213 | + } | ||
| 214 | + | ||
| 215 | + const arriveInfoStyle = { | ||
| 216 | + 'border': '0px', | ||
| 217 | + 'margin': '0px', | ||
| 218 | + 'width': this.text_info_width / 3 + 'px', | ||
| 219 | + 'height': this.arrive_info_height + 'px', | ||
| 220 | + 'background': this.text_info_background, | ||
| 221 | + 'text-align': 'left', | ||
| 222 | + 'float': 'left', | ||
| 223 | + 'padding-left': this.arrive_info_fix_text_left_padding + 'px', | ||
| 224 | + 'padding-top': this.arrive_info_fix_text_top_padding + 'px' | ||
| 225 | + } | ||
| 226 | + | ||
| 227 | + const arriveInfoFixTextStyle = { | ||
| 228 | + 'color': this.arrive_info_fix_text_font_color, | ||
| 229 | + 'font-size': this.arrive_info_fix_text_font_size + 'px' | ||
| 230 | + } | ||
| 231 | + | ||
| 232 | + const arriveInfoStopTextStyle = { | ||
| 233 | + 'font-size': this.arrive_info_stop_text_font_size + 'px', | ||
| 234 | + 'color': this.arrive_info_stop_text_font_color, | ||
| 235 | + 'font-weight': 'bold' | ||
| 236 | + } | ||
| 237 | + | ||
| 238 | + const arriveInfoTextStyle = { | ||
| 239 | + 'font-size': this.arrive_info_text_font_size + 'px', | ||
| 240 | + 'color': this.arrive_info_text_font_color, | ||
| 241 | + 'font-weight': 'bold' | ||
| 242 | + } | ||
| 243 | + | ||
| 244 | + const svgStyle = { | ||
| 245 | + // 'width': this.line_width + 'px', | ||
| 246 | + 'height': this.line_height + 'px', | ||
| 247 | + 'background-color': this.svg_background | ||
| 248 | + } | ||
| 249 | + | ||
| 174 | /* 最外层div对应编辑器的通用样式 */ | 250 | /* 最外层div对应编辑器的通用样式 */ |
| 175 | return ( | 251 | return ( |
| 176 | <div class="eBusStop-line-chart-outer-div"> | 252 | <div class="eBusStop-line-chart-outer-div"> |
| 177 | <div style={innerDivStyle}> | 253 | <div style={innerDivStyle}> |
| 178 | - <div style={lineNameStyle}>{this.eBusStopData.lineName}</div> | 254 | + <div style={textInfoStyle}> |
| 255 | + <div style={lineInfoStyle}> | ||
| 256 | + <div style={lineInfoStyleForLineName}>{this.eBusStopData.lineName}</div> | ||
| 257 | + <div></div> | ||
| 258 | + </div> | ||
| 259 | + <div style={arriveInfoContainerStyle}> | ||
| 260 | + <div style={arriveInfoStyle}> | ||
| 261 | + <span style={arriveInfoFixTextStyle}>开往:</span> | ||
| 262 | + <span style={arriveInfoStopTextStyle}>{this.eBusStopData.endStationName}</span> | ||
| 263 | + </div> | ||
| 264 | + <div style={arriveInfoStyle}> | ||
| 265 | + <span style={arriveInfoFixTextStyle}>预计本次班车:</span> | ||
| 266 | + <span style={arriveInfoTextStyle}>{this.eBusStopData.arriveTime1}</span> | ||
| 267 | + </div> | ||
| 268 | + <div style={arriveInfoStyle}> | ||
| 269 | + <span style={arriveInfoFixTextStyle}>预计下次班车:</span> | ||
| 270 | + <span style={arriveInfoTextStyle}>{this.eBusStopData.arriveTime2}</span> | ||
| 271 | + </div> | ||
| 272 | + </div> | ||
| 273 | + </div> | ||
| 179 | <svg class="eBusStop-line-chart" | 274 | <svg class="eBusStop-line-chart" |
| 180 | data-code={this.eBusStopData.lineCode} | 275 | data-code={this.eBusStopData.lineCode} |
| 181 | - style={{ 'background-color': this.svg_background }}> | 276 | + style={svgStyle}> |
| 182 | <g class="up-rect-wrap"> | 277 | <g class="up-rect-wrap"> |
| 183 | <rect x={this.up_rect_x} | 278 | <rect x={this.up_rect_x} |
| 184 | y={this.up_rect_y} | 279 | y={this.up_rect_y} |
| @@ -210,11 +305,12 @@ export default { | @@ -210,11 +305,12 @@ export default { | ||
| 210 | 305 | ||
| 211 | // 使用外部元素的框架定义图的长宽 | 306 | // 使用外部元素的框架定义图的长宽 |
| 212 | let $jQuery = this.private_jQuery | 307 | let $jQuery = this.private_jQuery |
| 213 | - this.line_width = $jQuery(this.$el).width() - this.margin_left - this.margin_right | ||
| 214 | - this.line_height = $jQuery(this.$el).height() - this.margin_top - this.margin_bottom | 308 | + this.component_width = $jQuery(this.$el).width() - this.margin_left - this.margin_right |
| 309 | + this.component_height = $jQuery(this.$el).height() - this.margin_top - this.margin_bottom | ||
| 310 | + | ||
| 215 | if (this.useMode === 'child') { | 311 | if (this.useMode === 'child') { |
| 216 | - this.line_width = this.line_chart_outer_div_width - this.margin_left - this.margin_right | ||
| 217 | - this.line_height = this.line_chart_outer_div_height - this.margin_top - this.margin_bottom | 312 | + this.component_width = this.line_chart_outer_div_width - this.margin_left - this.margin_right |
| 313 | + this.component_height = this.line_chart_outer_div_height - this.margin_top - this.margin_bottom | ||
| 218 | } | 314 | } |
| 219 | 315 | ||
| 220 | // 开启外部元素长宽监控计数 | 316 | // 开启外部元素长宽监控计数 |
| @@ -257,11 +353,11 @@ export default { | @@ -257,11 +353,11 @@ export default { | ||
| 257 | let width = $jQuery(self.$el).width() | 353 | let width = $jQuery(self.$el).width() |
| 258 | let height = $jQuery(self.$el).height() | 354 | let height = $jQuery(self.$el).height() |
| 259 | 355 | ||
| 260 | - if (width !== self.line_width) { | ||
| 261 | - self.line_width = width - self.margin_left - self.margin_right | 356 | + if (width !== self.component_width) { |
| 357 | + self.component_width = width - self.margin_left - self.margin_right | ||
| 262 | } | 358 | } |
| 263 | - if (height !== self.line_height) { | ||
| 264 | - self.line_height = height - self.margin_top - self.margin_bottom | 359 | + if (height !== self.component_height) { |
| 360 | + self.component_height = height - self.margin_top - self.margin_bottom | ||
| 265 | } | 361 | } |
| 266 | self.watchWidthHeightTimer.count++ | 362 | self.watchWidthHeightTimer.count++ |
| 267 | }, self.watchWidthHeightTimer.millisecond) | 363 | }, self.watchWidthHeightTimer.millisecond) |
| @@ -296,6 +392,15 @@ export default { | @@ -296,6 +392,15 @@ export default { | ||
| 296 | } | 392 | } |
| 297 | }, | 393 | }, |
| 298 | // ------------ 本身宽高 ----------- // | 394 | // ------------ 本身宽高 ----------- // |
| 395 | + component_width () { | ||
| 396 | + this.text_info_width = this.component_width - this.border_size * 2 | ||
| 397 | + this.line_width = this.component_width - this.border_size * 2 | ||
| 398 | + }, | ||
| 399 | + component_height () { | ||
| 400 | + this.text_info_height = this.line_info_height + this.arrive_info_height | ||
| 401 | + this.line_height = this.component_height - this.text_info_height - this.border_size * 2 | ||
| 402 | + }, | ||
| 403 | + | ||
| 299 | line_width () { | 404 | line_width () { |
| 300 | this.refreshLineSvg() | 405 | this.refreshLineSvg() |
| 301 | this.refreshUpRectSvg() | 406 | this.refreshUpRectSvg() |
| @@ -306,6 +411,14 @@ export default { | @@ -306,6 +411,14 @@ export default { | ||
| 306 | this.refreshUpRectSvg() | 411 | this.refreshUpRectSvg() |
| 307 | this.refreshDownLineSvg() | 412 | this.refreshDownLineSvg() |
| 308 | }, | 413 | }, |
| 414 | + line_info_height () { | ||
| 415 | + this.text_info_height = this.line_info_height + this.arrive_info_height | ||
| 416 | + this.line_height = this.component_height - this.text_info_height - this.border_size * 2 | ||
| 417 | + }, | ||
| 418 | + arrive_info_height () { | ||
| 419 | + this.text_info_height = this.line_info_height + this.arrive_info_height | ||
| 420 | + this.line_height = this.component_height - this.text_info_height - this.border_size * 2 | ||
| 421 | + }, | ||
| 309 | // ----------- 图外层css 监控 ----------- // | 422 | // ----------- 图外层css 监控 ----------- // |
| 310 | margin_left () { | 423 | margin_left () { |
| 311 | let self = this | 424 | let self = this |
| @@ -324,9 +437,11 @@ export default { | @@ -324,9 +437,11 @@ export default { | ||
| 324 | self.line_height = self.line_height - self.margin_top - self.margin_bottom | 437 | self.line_height = self.line_height - self.margin_top - self.margin_bottom |
| 325 | }, | 438 | }, |
| 326 | border_size () { | 439 | border_size () { |
| 327 | - this.refreshLineSvg() | ||
| 328 | - this.refreshUpRectSvg() | ||
| 329 | - this.refreshDownLineSvg() | 440 | + this.text_info_width = this.component_width - this.border_size * 2 |
| 441 | + this.line_width = this.component_width - this.border_size * 2 | ||
| 442 | + this.text_info_height = this.line_info_height + this.arrive_info_height | ||
| 443 | + this.line_height = this.component_height - this.text_info_height - this.border_size * 2 | ||
| 444 | + | ||
| 330 | }, | 445 | }, |
| 331 | // ----------- 图内层css 监控 ----------- // | 446 | // ----------- 图内层css 监控 ----------- // |
| 332 | // ----------- _flag_4_属性 | 447 | // ----------- _flag_4_属性 |
| @@ -460,25 +575,27 @@ export default { | @@ -460,25 +575,27 @@ export default { | ||
| 460 | // }) | 575 | // }) |
| 461 | let self = this | 576 | let self = this |
| 462 | 577 | ||
| 578 | + let width = self.line_width // 内部整个svg的宽度 | ||
| 579 | + | ||
| 463 | // 计算svg内部上部分矩形的属性 | 580 | // 计算svg内部上部分矩形的属性 |
| 464 | this.up_rect_x = self.up_rect_left_padding | 581 | this.up_rect_x = self.up_rect_left_padding |
| 465 | this.up_rect_y = self.up_rect_top_padding | 582 | this.up_rect_y = self.up_rect_top_padding |
| 466 | - this.up_rect_width = self.line_width - self.border_size * 2 - | ||
| 467 | - self.up_rect_left_padding - self.up_rect_right_padding | 583 | + this.up_rect_width = width - self.up_rect_left_padding - self.up_rect_right_padding |
| 468 | 584 | ||
| 469 | }, | 585 | }, |
| 470 | refreshDownLineSvg () { | 586 | refreshDownLineSvg () { |
| 471 | let self = this | 587 | let self = this |
| 472 | 588 | ||
| 589 | + let width = self.line_width // 内部整个svg的宽度 | ||
| 590 | + let height = self.line_height // 内部整个svg的高度 | ||
| 591 | + | ||
| 473 | // 计算svg内部下部分线的属性 | 592 | // 计算svg内部下部分线的属性 |
| 474 | // 5个点,左边两个点作为起点(两个起点用来模拟宽度,如果使用stroke-width,右边箭头无法是夹的),右边3个点组成半个箭头 | 593 | // 5个点,左边两个点作为起点(两个起点用来模拟宽度,如果使用stroke-width,右边箭头无法是夹的),右边3个点组成半个箭头 |
| 475 | // 最左边起点(左下) | 594 | // 最左边起点(左下) |
| 476 | this.down_line_x1 = self.down_line_left_padding | 595 | this.down_line_x1 = self.down_line_left_padding |
| 477 | - this.down_line_y1 = self.line_height - self.border_size * 2 - | ||
| 478 | - self.down_line_bottom_padding | 596 | + this.down_line_y1 = height - self.down_line_bottom_padding |
| 479 | // 最右边箭头起点 | 597 | // 最右边箭头起点 |
| 480 | - this.down_line_x2 = self.line_width - self.border_size * 2 - | ||
| 481 | - self.down_line_right_padding | 598 | + this.down_line_x2 = width - self.down_line_right_padding |
| 482 | this.down_line_y2 = this.down_line_y1 | 599 | this.down_line_y2 = this.down_line_y1 |
| 483 | // 箭头左上角 | 600 | // 箭头左上角 |
| 484 | this.down_line_x3 = this.down_line_x2 - self.down_line_arrow_width | 601 | this.down_line_x3 = this.down_line_x2 - self.down_line_arrow_width |
| @@ -497,8 +614,8 @@ export default { | @@ -497,8 +614,8 @@ export default { | ||
| 497 | let d3 = self.private_d3 | 614 | let d3 = self.private_d3 |
| 498 | 615 | ||
| 499 | let routeData = self.eBusStopData.routeStationDataList | 616 | let routeData = self.eBusStopData.routeStationDataList |
| 500 | - let width = self.line_width - self.border_size * 2 // 内部整个svg的宽度 | ||
| 501 | - let height = self.line_height - self.border_size * 2 // 内部整个svg的高度 | 617 | + let width = self.line_width // 内部整个svg的宽度 |
| 618 | + let height = self.line_height // 内部整个svg的高度 | ||
| 502 | let svgNameSpace = self.private_svgns | 619 | let svgNameSpace = self.private_svgns |
| 503 | let svg = self.private_svg | 620 | let svg = self.private_svg |
| 504 | let chartLeftPadding = self.chart_left_padding | 621 | let chartLeftPadding = self.chart_left_padding |