@zfqh/uniapp 0.1.1
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.
- package/CHANGELOG.md +16 -0
- package/LICENSE +21 -0
- package/README.md +39 -0
- package/docs/api/apis/core.md +189 -0
- package/docs/api/apis/index.md +82 -0
- package/docs/api/apis/request.md +369 -0
- package/docs/api/configs/api.md +32 -0
- package/docs/api/configs/app.md +43 -0
- package/docs/api/configs/brand.md +43 -0
- package/docs/api/configs/cdn.md +35 -0
- package/docs/api/configs/color.md +144 -0
- package/docs/api/configs/env.md +120 -0
- package/docs/api/configs/index.md +394 -0
- package/docs/api/configs/link.md +33 -0
- package/docs/api/configs/log.md +27 -0
- package/docs/api/configs/mp.md +34 -0
- package/docs/api/configs/navigate.md +27 -0
- package/docs/api/configs/page.md +32 -0
- package/docs/api/configs/path.md +27 -0
- package/docs/api/configs/storage.md +24 -0
- package/docs/api/configs/tabbar.md +29 -0
- package/docs/api/configs/toast.md +35 -0
- package/docs/api/configs/update.md +25 -0
- package/docs/api/configs/upload.md +45 -0
- package/docs/api/configs/ver.md +32 -0
- package/docs/api/configs/web.md +28 -0
- package/docs/api/hooks/index.md +182 -0
- package/docs/api/hooks/useI18n.md +27 -0
- package/docs/api/hooks/useOverlay.md +37 -0
- package/docs/api/hooks/usePopup.md +35 -0
- package/docs/api/hooks/useVersion.md +23 -0
- package/docs/api/index.md +269 -0
- package/docs/api/mixins/app.md +29 -0
- package/docs/api/mixins/badge.md +23 -0
- package/docs/api/mixins/debounce.md +32 -0
- package/docs/api/mixins/deep.md +29 -0
- package/docs/api/mixins/index.md +23 -0
- package/docs/api/mixins/login.md +22 -0
- package/docs/api/mixins/model.md +26 -0
- package/docs/api/mixins/redirect.md +26 -0
- package/docs/api/mixins/share.md +29 -0
- package/docs/api/mixins/show.md +27 -0
- package/docs/api/mixins/webview.md +27 -0
- package/docs/api/modules/app.md +30 -0
- package/docs/api/modules/dict.md +28 -0
- package/docs/api/modules/im.md +22 -0
- package/docs/api/modules/index.md +44 -0
- package/docs/api/modules/launch.md +26 -0
- package/docs/api/modules/location.md +25 -0
- package/docs/api/modules/login.md +35 -0
- package/docs/api/modules/network.md +26 -0
- package/docs/api/modules/system.md +29 -0
- package/docs/api/utils/audio.md +84 -0
- package/docs/api/utils/consts.md +201 -0
- package/docs/api/utils/cos.md +269 -0
- package/docs/api/utils/debounce.md +89 -0
- package/docs/api/utils/file.md +78 -0
- package/docs/api/utils/index.md +547 -0
- package/docs/api/utils/locale.md +32 -0
- package/docs/api/utils/message.md +81 -0
- package/docs/api/utils/navigate.md +267 -0
- package/docs/api/utils/pages.md +205 -0
- package/docs/api/utils/permission.md +28 -0
- package/docs/api/utils/permit.md +62 -0
- package/docs/api/utils/query.md +89 -0
- package/docs/api/utils/request.md +34 -0
- package/docs/api/utils/storage.md +145 -0
- package/docs/api/utils/subscribe.md +77 -0
- package/docs/api/utils/throttle.md +101 -0
- package/docs/api/utils/toast.md +164 -0
- package/docs/api/utils/uni.md +28 -0
- package/docs/api/utils/update.md +165 -0
- package/docs/components/g-back-button.md +76 -0
- package/docs/components/g-checkbox-list.md +101 -0
- package/docs/components/g-container.md +93 -0
- package/docs/components/g-data-list.md +106 -0
- package/docs/components/g-dot-text.md +79 -0
- package/docs/components/g-env.md +75 -0
- package/docs/components/g-float.md +83 -0
- package/docs/components/g-grid-image.md +91 -0
- package/docs/components/g-grid-swiper.md +99 -0
- package/docs/components/g-icon.md +106 -0
- package/docs/components/g-mask.md +82 -0
- package/docs/components/g-money.md +90 -0
- package/docs/components/g-more.md +78 -0
- package/docs/components/g-page-container.md +170 -0
- package/docs/components/g-permission-popup.md +117 -0
- package/docs/components/g-polyline-chat.md +102 -0
- package/docs/components/g-polyline-view.md +67 -0
- package/docs/components/g-popup.md +144 -0
- package/docs/components/g-refresh-view.md +118 -0
- package/docs/components/g-render-image.md +83 -0
- package/docs/components/g-search.md +120 -0
- package/docs/components/g-share-photo.md +77 -0
- package/docs/components/g-share-view.md +83 -0
- package/docs/components/g-share-weixin.md +81 -0
- package/docs/components/g-skeleton-view.md +71 -0
- package/docs/components/g-skeleton.md +64 -0
- package/docs/components/g-tag-editor.md +134 -0
- package/docs/components/g-timer.md +72 -0
- package/docs/components/g-trtc-room.md +116 -0
- package/docs/components/g-trtc-tui.md +84 -0
- package/docs/components/g-trtc.md +124 -0
- package/docs/components/g-upload.md +117 -0
- package/docs/components/g-waterfall.md +84 -0
- package/docs/components/index.md +109 -0
- package/docs/components/styles/base-styles.md +367 -0
- package/docs/components/styles/global-vars.md +150 -0
- package/docs/components/usage.md +112 -0
- package/docs/faq/index.md +78 -0
- package/docs/guide/getting-started.md +195 -0
- package/docs/guide/project-frame.md +297 -0
- package/docs/index.md +80 -0
- package/lib/apis/core.d.ts +12 -0
- package/lib/apis/core.js +13 -0
- package/lib/apis/index.d.ts +2 -0
- package/lib/apis/index.js +2 -0
- package/lib/apis/request.d.ts +4 -0
- package/lib/apis/request.js +27 -0
- package/lib/components/g-back-button/g-back-button.vue +141 -0
- package/lib/components/g-checkbox-list/g-checkbox-list.vue +156 -0
- package/lib/components/g-container/g-container.vue +159 -0
- package/lib/components/g-data-list/g-data-list.vue +192 -0
- package/lib/components/g-dot-text/g-dot-text.vue +114 -0
- package/lib/components/g-env/g-env.vue +123 -0
- package/lib/components/g-float/g-float.vue +131 -0
- package/lib/components/g-grid-image/g-grid-image.vue +84 -0
- package/lib/components/g-grid-swiper/g-grid-swiper.vue +224 -0
- package/lib/components/g-icon/g-icon.vue +72 -0
- package/lib/components/g-mask/g-mask.vue +126 -0
- package/lib/components/g-money/g-money.vue +174 -0
- package/lib/components/g-more/g-more.vue +68 -0
- package/lib/components/g-page-container/g-page-container.vue +470 -0
- package/lib/components/g-permission-popup/g-permission-popup.vue +80 -0
- package/lib/components/g-polyline-chat/g-polyline-chat.vue +255 -0
- package/lib/components/g-polyline-view/g-polyline-view.vue +104 -0
- package/lib/components/g-popup/g-popup.vue +449 -0
- package/lib/components/g-refresh-view/g-refresh-view.vue +213 -0
- package/lib/components/g-render-image/g-render-image.vue +222 -0
- package/lib/components/g-search/g-search.vue +274 -0
- package/lib/components/g-share-photo/g-share-photo.vue +75 -0
- package/lib/components/g-share-view/g-share-view.vue +157 -0
- package/lib/components/g-share-weixin/g-share-weixin.vue +106 -0
- package/lib/components/g-skeleton/g-skeleton.vue +55 -0
- package/lib/components/g-skeleton-view/g-skeleton-view.vue +78 -0
- package/lib/components/g-tag-editor/g-tag-editor.vue +482 -0
- package/lib/components/g-timer/g-timer.vue +61 -0
- package/lib/components/g-trtc/g-trtc.vue +347 -0
- package/lib/components/g-trtc-room/g-trtc-room.vue +524 -0
- package/lib/components/g-trtc-room/iconfont.scss +59 -0
- package/lib/components/g-trtc-tui/g-trtc-tui.vue +245 -0
- package/lib/components/g-upload/g-upload.vue +294 -0
- package/lib/components/g-waterfall/g-waterfall.vue +101 -0
- package/lib/configs/api.d.ts +7 -0
- package/lib/configs/api.js +6 -0
- package/lib/configs/app.d.ts +26 -0
- package/lib/configs/app.js +50 -0
- package/lib/configs/brand.d.ts +22 -0
- package/lib/configs/brand.js +26 -0
- package/lib/configs/cdn.d.ts +13 -0
- package/lib/configs/cdn.js +12 -0
- package/lib/configs/color.d.ts +62 -0
- package/lib/configs/color.js +66 -0
- package/lib/configs/env.d.ts +37 -0
- package/lib/configs/env.js +71 -0
- package/lib/configs/index.d.ts +170 -0
- package/lib/configs/index.js +82 -0
- package/lib/configs/link.d.ts +11 -0
- package/lib/configs/link.js +3 -0
- package/lib/configs/log.d.ts +9 -0
- package/lib/configs/log.js +8 -0
- package/lib/configs/mp.d.ts +15 -0
- package/lib/configs/mp.js +9 -0
- package/lib/configs/navigate.d.ts +17 -0
- package/lib/configs/navigate.js +5 -0
- package/lib/configs/page.d.ts +18 -0
- package/lib/configs/page.js +14 -0
- package/lib/configs/path.d.ts +11 -0
- package/lib/configs/path.js +10 -0
- package/lib/configs/storage.d.ts +7 -0
- package/lib/configs/storage.js +6 -0
- package/lib/configs/tabbar.d.ts +7 -0
- package/lib/configs/tabbar.js +6 -0
- package/lib/configs/toast.d.ts +18 -0
- package/lib/configs/toast.js +29 -0
- package/lib/configs/update.d.ts +45 -0
- package/lib/configs/update.js +6 -0
- package/lib/configs/upload.d.ts +30 -0
- package/lib/configs/upload.js +7 -0
- package/lib/configs/ver.d.ts +8 -0
- package/lib/configs/ver.js +28 -0
- package/lib/configs/web.d.ts +5 -0
- package/lib/configs/web.js +2 -0
- package/lib/hooks/index.d.ts +4 -0
- package/lib/hooks/index.js +4 -0
- package/lib/hooks/useI18n.d.ts +2 -0
- package/lib/hooks/useI18n.js +19 -0
- package/lib/hooks/useOverlay.d.ts +1 -0
- package/lib/hooks/useOverlay.js +17 -0
- package/lib/hooks/usePopup.d.ts +1 -0
- package/lib/hooks/usePopup.js +14 -0
- package/lib/hooks/useVersion.d.ts +6 -0
- package/lib/hooks/useVersion.js +21 -0
- package/lib/index.d.ts +26 -0
- package/lib/index.js +33 -0
- package/lib/mixins/app.d.ts +14 -0
- package/lib/mixins/app.js +105 -0
- package/lib/mixins/badge.d.ts +24 -0
- package/lib/mixins/badge.js +44 -0
- package/lib/mixins/debounce.d.ts +6 -0
- package/lib/mixins/debounce.js +11 -0
- package/lib/mixins/deep.d.ts +6 -0
- package/lib/mixins/deep.js +8 -0
- package/lib/mixins/index.d.ts +8 -0
- package/lib/mixins/index.js +8 -0
- package/lib/mixins/login.d.ts +4 -0
- package/lib/mixins/login.js +25 -0
- package/lib/mixins/model.d.ts +22 -0
- package/lib/mixins/model.js +29 -0
- package/lib/mixins/redirect.d.ts +8 -0
- package/lib/mixins/redirect.js +94 -0
- package/lib/mixins/share.d.ts +15 -0
- package/lib/mixins/share.js +55 -0
- package/lib/mixins/show.d.ts +9 -0
- package/lib/mixins/show.js +16 -0
- package/lib/mixins/webview.d.ts +26 -0
- package/lib/mixins/webview.js +225 -0
- package/lib/modules/app.d.ts +5 -0
- package/lib/modules/app.js +19 -0
- package/lib/modules/dict.d.ts +8 -0
- package/lib/modules/dict.js +43 -0
- package/lib/modules/im.d.ts +6 -0
- package/lib/modules/im.js +105 -0
- package/lib/modules/index.d.ts +8 -0
- package/lib/modules/index.js +8 -0
- package/lib/modules/launch.d.ts +5 -0
- package/lib/modules/launch.js +32 -0
- package/lib/modules/location.d.ts +5 -0
- package/lib/modules/location.js +57 -0
- package/lib/modules/login.d.ts +5 -0
- package/lib/modules/login.js +72 -0
- package/lib/modules/network.d.ts +5 -0
- package/lib/modules/network.js +39 -0
- package/lib/modules/system.d.ts +5 -0
- package/lib/modules/system.js +65 -0
- package/lib/styles/animate-vue.scss +3 -0
- package/lib/styles/animate.scss +27 -0
- package/lib/styles/bg-vue.scss +21 -0
- package/lib/styles/bg.scss +93 -0
- package/lib/styles/border.scss +218 -0
- package/lib/styles/flex-nvue.scss +64 -0
- package/lib/styles/flex-vue.scss +75 -0
- package/lib/styles/font.scss +59 -0
- package/lib/styles/index.scss +25 -0
- package/lib/styles/layout-nvue.scss +24 -0
- package/lib/styles/layout-vue.scss +30 -0
- package/lib/styles/layout.scss +76 -0
- package/lib/styles/opacity.scss +10 -0
- package/lib/styles/reset-vue.scss +46 -0
- package/lib/styles/shadow.scss +12 -0
- package/lib/styles/sizing-vue.scss +21 -0
- package/lib/styles/sizing.scss +21 -0
- package/lib/styles/spacing.scss +234 -0
- package/lib/styles/text-nvue.scss +21 -0
- package/lib/styles/text-vue.scss +70 -0
- package/lib/styles/text.scss +122 -0
- package/lib/styles/var.module.scss +29 -0
- package/lib/utils/audio.d.ts +14 -0
- package/lib/utils/audio.js +43 -0
- package/lib/utils/consts.d.ts +30 -0
- package/lib/utils/consts.js +52 -0
- package/lib/utils/cos.d.ts +15 -0
- package/lib/utils/cos.js +140 -0
- package/lib/utils/debounce.d.ts +2 -0
- package/lib/utils/debounce.js +30 -0
- package/lib/utils/file.d.ts +28 -0
- package/lib/utils/file.js +292 -0
- package/lib/utils/index.d.ts +166 -0
- package/lib/utils/index.js +485 -0
- package/lib/utils/locale.d.ts +6 -0
- package/lib/utils/locale.js +19 -0
- package/lib/utils/message.d.ts +9 -0
- package/lib/utils/message.js +63 -0
- package/lib/utils/navigate.d.ts +27 -0
- package/lib/utils/navigate.js +183 -0
- package/lib/utils/pages.d.ts +21 -0
- package/lib/utils/pages.js +79 -0
- package/lib/utils/permission.d.ts +16 -0
- package/lib/utils/permission.js +291 -0
- package/lib/utils/permit.d.ts +30 -0
- package/lib/utils/permit.js +181 -0
- package/lib/utils/query.d.ts +13 -0
- package/lib/utils/query.js +14 -0
- package/lib/utils/request.d.ts +8 -0
- package/lib/utils/request.js +126 -0
- package/lib/utils/storage.d.ts +53 -0
- package/lib/utils/storage.js +145 -0
- package/lib/utils/subscribe.d.ts +7 -0
- package/lib/utils/subscribe.js +94 -0
- package/lib/utils/throttle.d.ts +2 -0
- package/lib/utils/throttle.js +32 -0
- package/lib/utils/toast.d.ts +17 -0
- package/lib/utils/toast.js +66 -0
- package/lib/utils/uni.d.ts +1 -0
- package/lib/utils/uni.js +147 -0
- package/lib/utils/update.d.ts +9 -0
- package/lib/utils/update.js +376 -0
- package/package.json +49 -0
- package/types/index.d.ts +25 -0
- package/types/virtual.d.ts +1 -0
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="polyline-chat" :style="[style]" :id="id">
|
|
3
|
+
<view class="polyline-chat-wrap" :style="[wrapStyle]">
|
|
4
|
+
<view class="polyline-chat-inner" :style="[innerStyle]">
|
|
5
|
+
<view v-for="(ele, i) in bars" :key="i" class="polyline-chat-item">
|
|
6
|
+
<text :style="[textStyle]" class="polyline-chat-text">{{ ele[0] }}</text>
|
|
7
|
+
<view :style="[barStyle]" class="polyline-chat-bar">
|
|
8
|
+
<view v-if="space > 0" :style="[mainStyle]" class="polyline-chat-main"></view>
|
|
9
|
+
<view v-if="space > 0" :style="[lineStyle]" class="polyline-chat-line"></view>
|
|
10
|
+
</view>
|
|
11
|
+
<text :style="[textStyle]" class="polyline-chat-text"> {{ ele[1] }} </text>
|
|
12
|
+
</view>
|
|
13
|
+
</view>
|
|
14
|
+
<view v-if="space == 0" :style="[mainStyle]" class="polyline-chat-main"></view>
|
|
15
|
+
<view v-if="space == 0" :style="[lineStyle]" class="polyline-chat-line"></view>
|
|
16
|
+
<g-polyline-view
|
|
17
|
+
v-for="(item, p) in list"
|
|
18
|
+
:key="p"
|
|
19
|
+
:data="item.data"
|
|
20
|
+
:color="item.color"
|
|
21
|
+
:startLeft="barWidth / 2"
|
|
22
|
+
:endLeft="barWidth + barWidth / 2 + space"
|
|
23
|
+
/>
|
|
24
|
+
</view>
|
|
25
|
+
<view class="polyline-chat-title">
|
|
26
|
+
<view v-for="(item, j) in list" :key="j">
|
|
27
|
+
<view :style="{ backgroundColor: item.color }"></view>
|
|
28
|
+
<text :style="[textStyle]"> {{ item.title }} </text>
|
|
29
|
+
</view>
|
|
30
|
+
</view>
|
|
31
|
+
</view>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<script>
|
|
35
|
+
import { getRectById } from '../../utils';
|
|
36
|
+
|
|
37
|
+
let key = 0;
|
|
38
|
+
|
|
39
|
+
export default {
|
|
40
|
+
props: {
|
|
41
|
+
bars: {
|
|
42
|
+
type: Array,
|
|
43
|
+
default: () => [
|
|
44
|
+
['弦', '软'],
|
|
45
|
+
['滑', '细'],
|
|
46
|
+
['浮', '沉'],
|
|
47
|
+
['数', '迟'],
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
mainColor: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: '#A3E5D9',
|
|
53
|
+
},
|
|
54
|
+
bgColor: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: '#F7F3E9',
|
|
57
|
+
},
|
|
58
|
+
lineColor: {
|
|
59
|
+
type: String,
|
|
60
|
+
default: '#B8EAE2',
|
|
61
|
+
},
|
|
62
|
+
border: {
|
|
63
|
+
type: [String, Boolean],
|
|
64
|
+
default: false,
|
|
65
|
+
},
|
|
66
|
+
borderColor: {
|
|
67
|
+
type: String,
|
|
68
|
+
default: 'transparent',
|
|
69
|
+
},
|
|
70
|
+
borderWidth: {
|
|
71
|
+
type: [String, Number],
|
|
72
|
+
default: 1,
|
|
73
|
+
},
|
|
74
|
+
textColor: {
|
|
75
|
+
type: String,
|
|
76
|
+
default: '#333',
|
|
77
|
+
},
|
|
78
|
+
textSize: {
|
|
79
|
+
type: Number,
|
|
80
|
+
default: 18,
|
|
81
|
+
},
|
|
82
|
+
data: {
|
|
83
|
+
type: [Array, Object],
|
|
84
|
+
default: () => ({
|
|
85
|
+
title: '',
|
|
86
|
+
color: '',
|
|
87
|
+
data: [],
|
|
88
|
+
}),
|
|
89
|
+
},
|
|
90
|
+
height: {
|
|
91
|
+
type: Number,
|
|
92
|
+
default: 300,
|
|
93
|
+
},
|
|
94
|
+
width: {
|
|
95
|
+
type: Number,
|
|
96
|
+
default: 300,
|
|
97
|
+
},
|
|
98
|
+
space: {
|
|
99
|
+
type: Number,
|
|
100
|
+
default: 16,
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
data() {
|
|
104
|
+
return {
|
|
105
|
+
id: `polyline-chat-${++key}`,
|
|
106
|
+
realWidth: this.width,
|
|
107
|
+
value: [],
|
|
108
|
+
};
|
|
109
|
+
},
|
|
110
|
+
watch: {
|
|
111
|
+
data: {
|
|
112
|
+
immediate: true,
|
|
113
|
+
handler(e) {
|
|
114
|
+
if (Array.isArray(e)) {
|
|
115
|
+
this.value = e;
|
|
116
|
+
} else if (e) {
|
|
117
|
+
this.value = [e];
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
computed: {
|
|
123
|
+
step({ height }) {
|
|
124
|
+
return Math.floor(height / 100);
|
|
125
|
+
},
|
|
126
|
+
list({ value, step }) {
|
|
127
|
+
return value.map(({ data, ...rest }) => {
|
|
128
|
+
return {
|
|
129
|
+
...rest,
|
|
130
|
+
data: data.map((e) => Math.min(Math.abs(e || 0), 100) * step),
|
|
131
|
+
};
|
|
132
|
+
});
|
|
133
|
+
},
|
|
134
|
+
style({ realWidth }) {
|
|
135
|
+
return {
|
|
136
|
+
width: `${realWidth}px`,
|
|
137
|
+
};
|
|
138
|
+
},
|
|
139
|
+
barWidth({ realWidth, bars, space }) {
|
|
140
|
+
return (realWidth - (bars.length - 1) * space) / bars.length;
|
|
141
|
+
},
|
|
142
|
+
wrapStyle({ borderColor, borderWidth, border }) {
|
|
143
|
+
const style = {};
|
|
144
|
+
if (border === true) {
|
|
145
|
+
style.border = `${borderWidth}px solid ${borderColor}`;
|
|
146
|
+
} else if (['top', 'right', 'bottom', 'left'].includes(border)) {
|
|
147
|
+
style[`border-${border}`] = `${borderWidth}px solid ${borderColor}`;
|
|
148
|
+
}
|
|
149
|
+
return style;
|
|
150
|
+
},
|
|
151
|
+
innerStyle({ space, bars }) {
|
|
152
|
+
const style = {
|
|
153
|
+
'grid-gap': `${space}px`,
|
|
154
|
+
'grid-template-columns': new Array(Number(bars.length))
|
|
155
|
+
.fill(undefined)
|
|
156
|
+
.map(() => '1fr')
|
|
157
|
+
.join(' '),
|
|
158
|
+
};
|
|
159
|
+
return style;
|
|
160
|
+
},
|
|
161
|
+
barStyle({ height, bgColor }) {
|
|
162
|
+
return {
|
|
163
|
+
height: `${height}px`,
|
|
164
|
+
backgroundColor: bgColor,
|
|
165
|
+
};
|
|
166
|
+
},
|
|
167
|
+
mainStyle({ mainColor }) {
|
|
168
|
+
return {
|
|
169
|
+
backgroundColor: mainColor,
|
|
170
|
+
};
|
|
171
|
+
},
|
|
172
|
+
lineStyle({ lineColor }) {
|
|
173
|
+
return {
|
|
174
|
+
backgroundColor: lineColor,
|
|
175
|
+
};
|
|
176
|
+
},
|
|
177
|
+
textStyle({ textSize }) {
|
|
178
|
+
return {
|
|
179
|
+
fontSize: `${textSize}px`,
|
|
180
|
+
};
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
mounted() {
|
|
184
|
+
getRectById(this.id).then((e) => {
|
|
185
|
+
this.realWidth = e.data.width;
|
|
186
|
+
});
|
|
187
|
+
},
|
|
188
|
+
};
|
|
189
|
+
</script>
|
|
190
|
+
|
|
191
|
+
<style lang="scss" scoped>
|
|
192
|
+
.polyline-chat {
|
|
193
|
+
display: flex;
|
|
194
|
+
flex-direction: column;
|
|
195
|
+
align-items: center;
|
|
196
|
+
justify-content: center;
|
|
197
|
+
&-wrap {
|
|
198
|
+
position: relative;
|
|
199
|
+
width: 100%;
|
|
200
|
+
}
|
|
201
|
+
&-inner {
|
|
202
|
+
width: 100%;
|
|
203
|
+
display: grid;
|
|
204
|
+
}
|
|
205
|
+
&-item {
|
|
206
|
+
display: flex;
|
|
207
|
+
flex-direction: column;
|
|
208
|
+
align-items: center;
|
|
209
|
+
justify-content: center;
|
|
210
|
+
position: relative;
|
|
211
|
+
}
|
|
212
|
+
&-text {
|
|
213
|
+
position: absolute;
|
|
214
|
+
z-index: 1;
|
|
215
|
+
&:first-child {
|
|
216
|
+
top: -28px;
|
|
217
|
+
}
|
|
218
|
+
&:last-child {
|
|
219
|
+
bottom: -28px;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
&-main,
|
|
223
|
+
&-line {
|
|
224
|
+
position: absolute;
|
|
225
|
+
top: 50%;
|
|
226
|
+
left: 0;
|
|
227
|
+
right: 0;
|
|
228
|
+
transform: translateY(-50%);
|
|
229
|
+
height: 50%;
|
|
230
|
+
}
|
|
231
|
+
&-main {
|
|
232
|
+
height: 50%;
|
|
233
|
+
}
|
|
234
|
+
&-line {
|
|
235
|
+
height: 1px;
|
|
236
|
+
}
|
|
237
|
+
&-bar {
|
|
238
|
+
width: 100%;
|
|
239
|
+
position: relative;
|
|
240
|
+
}
|
|
241
|
+
&-title {
|
|
242
|
+
padding-top: 32px;
|
|
243
|
+
& > view {
|
|
244
|
+
display: flex;
|
|
245
|
+
align-items: center;
|
|
246
|
+
margin-top: 12px;
|
|
247
|
+
& > view {
|
|
248
|
+
width: 14px;
|
|
249
|
+
height: 14px;
|
|
250
|
+
margin-right: 8px;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
</style>
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
v-for="(ele, i) in list"
|
|
4
|
+
:key="i"
|
|
5
|
+
class="polyline-view"
|
|
6
|
+
:style="{ left: `${i * (endLeft - startLeft) + startLeft}px` }"
|
|
7
|
+
>
|
|
8
|
+
<view class="polyline-view-start" :style="{ bottom: `${ele[0]}px`, left: 0 }">
|
|
9
|
+
<text :style="{ backgroundColor: colors[1] }"></text>
|
|
10
|
+
<text :style="{ backgroundColor: colors[0] }"></text>
|
|
11
|
+
</view>
|
|
12
|
+
<view class="polyline-view-line" :style="[lineStyle(ele, endLeft - startLeft)]"></view>
|
|
13
|
+
<view class="polyline-view-end" :style="{ bottom: `${ele[1]}px`, left: `${endLeft - startLeft}px` }">
|
|
14
|
+
<text :style="{ backgroundColor: colors[1] }"></text>
|
|
15
|
+
<text :style="{ backgroundColor: colors[0] }"></text>
|
|
16
|
+
</view>
|
|
17
|
+
</view>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script>
|
|
21
|
+
export default {
|
|
22
|
+
props: {
|
|
23
|
+
data: {
|
|
24
|
+
type: Array,
|
|
25
|
+
default: () => [],
|
|
26
|
+
},
|
|
27
|
+
color: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: '',
|
|
30
|
+
},
|
|
31
|
+
startLeft: {
|
|
32
|
+
type: Number,
|
|
33
|
+
default: 0,
|
|
34
|
+
},
|
|
35
|
+
endLeft: {
|
|
36
|
+
type: Number,
|
|
37
|
+
default: 0,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
computed: {
|
|
41
|
+
list({ data }) {
|
|
42
|
+
const list = [];
|
|
43
|
+
data.forEach((e, i) => {
|
|
44
|
+
if (data[i + 1] != null) {
|
|
45
|
+
list.push([e, data[i + 1]]);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
return list;
|
|
49
|
+
},
|
|
50
|
+
colors({ color }) {
|
|
51
|
+
return [color, uni.$uv.colorGradient(color, '#fff', 6)[4]];
|
|
52
|
+
},
|
|
53
|
+
lineStyle({ color }) {
|
|
54
|
+
return (y, gu) => {
|
|
55
|
+
const diff = y[1] - y[0];
|
|
56
|
+
const gou = Math.abs(diff);
|
|
57
|
+
const xian = Math.sqrt(gou * gou + gu * gu);
|
|
58
|
+
const deg = gu > 0 ? Math.atan(gou / gu) * (180 / Math.PI) : 0;
|
|
59
|
+
return {
|
|
60
|
+
width: `${xian}px`,
|
|
61
|
+
transform: `rotate(${diff > 0 ? '-' : ''}${deg}deg)`,
|
|
62
|
+
backgroundColor: color,
|
|
63
|
+
left: 0,
|
|
64
|
+
bottom: `${y[0]}px`,
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
</script>
|
|
71
|
+
|
|
72
|
+
<style lang="scss" scoped>
|
|
73
|
+
.polyline-view {
|
|
74
|
+
position: absolute;
|
|
75
|
+
&-line {
|
|
76
|
+
transform-origin: left center;
|
|
77
|
+
height: 1px;
|
|
78
|
+
}
|
|
79
|
+
& > view {
|
|
80
|
+
position: absolute;
|
|
81
|
+
&:first-child,
|
|
82
|
+
&:last-child {
|
|
83
|
+
width: 1px;
|
|
84
|
+
height: 1px;
|
|
85
|
+
& > text {
|
|
86
|
+
position: absolute;
|
|
87
|
+
z-index: 1;
|
|
88
|
+
top: 50%;
|
|
89
|
+
left: 50%;
|
|
90
|
+
transform: translateX(-50%) translateY(-50%);
|
|
91
|
+
border-radius: 100px;
|
|
92
|
+
&:first-child {
|
|
93
|
+
width: 14px;
|
|
94
|
+
height: 14px;
|
|
95
|
+
}
|
|
96
|
+
&:last-child {
|
|
97
|
+
width: 10px;
|
|
98
|
+
height: 10px;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
</style>
|