btxui 1.0.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/README.md +42 -0
- package/app.vue +162 -0
- package/assets/css/_main.js +73 -0
- package/assets/css/btx.min.css +1 -0
- package/assets/css/btx.mob.min.css +1 -0
- package/assets/css/btx.pad.min.css +1 -0
- package/assets/css/btx.webapp.min.css +1 -0
- package/assets/css/custom_fonts/iconfont.css +37 -0
- package/assets/css/custom_fonts/iconfont.eot +0 -0
- package/assets/css/custom_fonts/iconfont.svg +47 -0
- package/assets/css/custom_fonts/iconfont.ttf +0 -0
- package/assets/css/custom_fonts/iconfont.woff +0 -0
- package/assets/css/custom_fonts/iconfont.woff2 +0 -0
- package/assets/css/res-l.css +47 -0
- package/assets/css/res-m.css +47 -0
- package/assets/css/res-s.css +61 -0
- package/assets/custom_fonts/iconfont.css +37 -0
- package/assets/custom_fonts/iconfont.eot +0 -0
- package/assets/custom_fonts/iconfont.svg +47 -0
- package/assets/custom_fonts/iconfont.ttf +0 -0
- package/assets/custom_fonts/iconfont.woff +0 -0
- package/assets/custom_fonts/iconfont.woff2 +0 -0
- package/assets/js/Btx.js +196 -0
- package/assets/js/Utils.js +421 -0
- package/assets/js/fastclick.js +802 -0
- package/assets/js/lazy.min.js +2 -0
- package/assets/js/touchwipe.js +111 -0
- package/assets/server.js +8 -0
- package/assets/start_site_code_str.js +119 -0
- package/cdn/css/btx.min.css +1 -0
- package/cdn/css/btx.min.css.map +1 -0
- package/cdn/fonts/iconfont.ttf +0 -0
- package/cdn/fonts/iconfont.woff +0 -0
- package/cdn/fonts/iconfont.woff2 +0 -0
- package/components/BTXUI/app/app-wid.vue +182 -0
- package/components/BTXUI/btn/btn-wid.vue +128 -0
- package/components/BTXUI/carousel/carousel-wid.vue +138 -0
- package/components/BTXUI/checkbox/checkbox-wid.vue +72 -0
- package/components/BTXUI/confirm/confirm-wid.vue +279 -0
- package/components/BTXUI/content/content-checkbox-wid.vue +44 -0
- package/components/BTXUI/content/content-node-wid.vue +114 -0
- package/components/BTXUI/content/content-tag-wid.vue +25 -0
- package/components/BTXUI/content/content-wid.vue +254 -0
- package/components/BTXUI/core/anis/ani-fail.vue +46 -0
- package/components/BTXUI/core/anis/ani-loading.vue +32 -0
- package/components/BTXUI/core/anis/ani-notic.vue +47 -0
- package/components/BTXUI/core/anis/ani-success.vue +48 -0
- package/components/BTXUI/core/b-drag.vue +258 -0
- package/components/BTXUI/core/b-grid.vue +84 -0
- package/components/BTXUI/core/b-hot.vue +171 -0
- package/components/BTXUI/core/b-icon.vue +76 -0
- package/components/BTXUI/core/b-img.vue +84 -0
- package/components/BTXUI/core/b-input.vue +198 -0
- package/components/BTXUI/core/b-list.vue +276 -0
- package/components/BTXUI/core/b-text/doc.ts +9 -0
- package/components/BTXUI/core/b-text/index.vue +16 -0
- package/components/BTXUI/core/b-textarea.vue +58 -0
- package/components/BTXUI/core/b-video.vue +35 -0
- package/components/BTXUI/core/b-view/doc.ts +10 -0
- package/components/BTXUI/core/b-view/index.vue +20 -0
- package/components/BTXUI/core/b-webview.vue +20 -0
- package/components/BTXUI/core/lib/ChapterLink.js +49 -0
- package/components/BTXUI/core/lib/Search.vue +60 -0
- package/components/BTXUI/core/styles/doc.ts +55 -0
- package/components/BTXUI/core/styles/index.vue +98 -0
- package/components/BTXUI/core/styles/prestyles.ts +471 -0
- package/components/BTXUI/core/styles/theme.ts +29 -0
- package/components/BTXUI/drawer/drawer-wid.vue +165 -0
- package/components/BTXUI/drawer/title-tag-wid.vue +114 -0
- package/components/BTXUI/form/form-select-wid.vue +57 -0
- package/components/BTXUI/form/form-wid.vue +324 -0
- package/components/BTXUI/formPannel/form-pannel-wid.vue +133 -0
- package/components/BTXUI/imgsUpload/imgs-upload-wid.vue +149 -0
- package/components/BTXUI/index.js +83 -0
- package/components/BTXUI/pageFlip/page-flip-wid.vue +206 -0
- package/components/BTXUI/pannel/pannel-wid.vue +167 -0
- package/components/BTXUI/range/range-wid.vue +134 -0
- package/components/BTXUI/search/search-wid.vue +80 -0
- package/components/BTXUI/select/select-wid.vue +186 -0
- package/components/BTXUI/slider/slider-wid.vue +444 -0
- package/components/BTXUI/tab/tab-wid.vue +109 -0
- package/components/BTXUI/table/table-wid.vue +324 -0
- package/components/BTXUI/tag/tag-wid.vue +183 -0
- package/components/BTXUI/tags/tags-wid.vue +121 -0
- package/components/BTXUI/tooltip/tooltip-wid.vue +146 -0
- package/components/BTXUI/upload/upload-wid.vue +215 -0
- package/components/BTXUI/waterfall/waterfall-wid.vue +166 -0
- package/components/header-info.vue +167 -0
- package/composables/@types.ts +4 -0
- package/composables/api.ts +18 -0
- package/env.d.ts +5 -0
- package/main.js +6 -0
- package/nuxt.config.ts +51 -0
- package/package.json +23 -0
- package/pages/article.vue +16 -0
- package/pages/download.vue +50 -0
- package/pages/example/app_wid/app/data_demo.vue +9 -0
- package/pages/example/app_wid/app/download_demo.vue +9 -0
- package/pages/example/app_wid/app/list_demo.vue +11 -0
- package/pages/example/app_wid/app/system_demo.vue +9 -0
- package/pages/example/app_wid/app_wid_demo.vue +198 -0
- package/pages/example/app_wid/btn_wid_demo.vue +179 -0
- package/pages/example/app_wid/carousel_wid_demo.vue +152 -0
- package/pages/example/app_wid/checkbox_wid_demo.vue +65 -0
- package/pages/example/app_wid/confirm_wid_demo.vue +197 -0
- package/pages/example/app_wid/content_wid_demo.vue +369 -0
- package/pages/example/app_wid/drawer_wid_demo.vue +155 -0
- package/pages/example/app_wid/form_pannel_wid_demo.vue +338 -0
- package/pages/example/app_wid/form_wid_demo.vue +550 -0
- package/pages/example/app_wid/imgs_upload_wid_demo.vue +159 -0
- package/pages/example/app_wid/index.js +158 -0
- package/pages/example/app_wid/page_flip_wid_demo.vue +99 -0
- package/pages/example/app_wid/pannel_wid_demo.vue +177 -0
- package/pages/example/app_wid/range_wid_demo.vue +101 -0
- package/pages/example/app_wid/search_wid_demo.vue +75 -0
- package/pages/example/app_wid/select_wid_demo.vue +217 -0
- package/pages/example/app_wid/slider_wid_demo.vue +143 -0
- package/pages/example/app_wid/tab_wid_demo.vue +170 -0
- package/pages/example/app_wid/table_wid_demo.vue +377 -0
- package/pages/example/app_wid/tag_wid_demo.vue +133 -0
- package/pages/example/app_wid/tags_wid_demo.vue +143 -0
- package/pages/example/app_wid/tooltip_wid_demo.vue +117 -0
- package/pages/example/app_wid/upload_wid_demo.vue +123 -0
- package/pages/example/base_wid/b_drag_demo.vue +159 -0
- package/pages/example/base_wid/b_grid_demo.vue +225 -0
- package/pages/example/base_wid/b_hot_demo.vue +135 -0
- package/pages/example/base_wid/b_icon_demo.vue +80 -0
- package/pages/example/base_wid/b_img_demo.vue +95 -0
- package/pages/example/base_wid/b_input_demo.vue +171 -0
- package/pages/example/base_wid/b_list_demo.vue +241 -0
- package/pages/example/base_wid/b_style_demo.vue +928 -0
- package/pages/example/base_wid/b_text_demo.vue +36 -0
- package/pages/example/base_wid/b_textarea_demo.vue +64 -0
- package/pages/example/base_wid/b_video_demo.vue +42 -0
- package/pages/example/base_wid/b_view_demo.vue +36 -0
- package/pages/example/base_wid/index.js +76 -0
- package/pages/example/content.js +49 -0
- package/pages/example/global_style/animation.vue +197 -0
- package/pages/example/global_style/color.vue +134 -0
- package/pages/example/global_style/decoration.vue +546 -0
- package/pages/example/global_style/icon.vue +345 -0
- package/pages/example/global_style/index.js +52 -0
- package/pages/example/global_style/layout.vue +846 -0
- package/pages/example/global_style/special.vue +37 -0
- package/pages/example/global_style/table.vue +298 -0
- package/pages/example/global_style/text.vue +159 -0
- package/pages/index.vue +29 -0
- package/pages/level_widget.vue +11 -0
- package/pages/start.vue +200 -0
- package/plugins/index.ts +2 -0
- package/public/favicon.gif +0 -0
- package/public/fonts/iconfont.ttf +0 -0
- package/public/fonts/iconfont.woff +0 -0
- package/public/fonts/iconfont.woff2 +0 -0
- package/public/img/banner.jpg +0 -0
- package/public/img/banner2.jpg +0 -0
- package/public/img/bg_pattern.png +0 -0
- package/public/img/btx.jpg +0 -0
- package/public/img/btx_ui.jpg +0 -0
- package/public/img/dir.png +0 -0
- package/public/img/f.png +0 -0
- package/public/img/head.jpg +0 -0
- package/public/img/head2.jpg +0 -0
- package/public/img/home_ico.png +0 -0
- package/public/img/icons.svg +164 -0
- package/public/img/mechanism/b-style.png +0 -0
- package/public/img/mechanism/slider-wid.png +0 -0
- package/public/img/mechanism/upload-wid.png +0 -0
- package/public/img/transform_origin.png +0 -0
- package/sass/animation.scss +400 -0
- package/sass/btx.mob.scss +10 -0
- package/sass/btx.pad.scss +3 -0
- package/sass/btx.scss +22 -0
- package/sass/btx.webapp.scss +22 -0
- package/sass/colors.scss +65 -0
- package/sass/decoration.scss +220 -0
- package/sass/flex.scss +29 -0
- package/sass/icons.scss +100 -0
- package/sass/layout.scss +88 -0
- package/sass/reset.scss +111 -0
- package/sass/response/flex_mixin.scss +91 -0
- package/sass/response/layout_mixin.scss +227 -0
- package/sass/response/main.scss +59 -0
- package/sass/response/text_mixin.scss +65 -0
- package/sass/scroll.scss +100 -0
- package/sass/special.scss +13 -0
- package/sass/table.scss +103 -0
- package/sass/text.scss +86 -0
- package/sass/webpack.config.js +31 -0
- package/tsconfig.json +4 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<b-view ref="tooltip" styles="fixed bg-none z9" v-show="visible">
|
|
3
|
+
<!--连线-->
|
|
4
|
+
<b-view :styles="`abs h-1px alpha-.5 shadow-sm color-rgba(40,40,40,.2) origin-left|center bg-${color_styles.bg} w-${line_len} rotate-${line_rotate}`"></b-view>
|
|
5
|
+
|
|
6
|
+
<!--文字内容-->
|
|
7
|
+
<b-view :styles="`rel pad-v-.7 pad-h-1.4 round-sm shadow line thick-1 color-neutral line-${color_styles.line} bg-${color_styles.bg} ${box_offset}`">
|
|
8
|
+
<b-text :styles="`color-${color_styles.text}`" v-html="text"></b-text>
|
|
9
|
+
</b-view>
|
|
10
|
+
|
|
11
|
+
<!--光标点-->
|
|
12
|
+
<b-view :styles="`abs alpha-.4 round w-1 h-1 l-f.5 t-f.5 bg-color-${color_styles.point}`"></b-view>
|
|
13
|
+
</b-view>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script>
|
|
17
|
+
import BView from "@/components/BTXUI/core/b-view"
|
|
18
|
+
import BText from "@/components/BTXUI/core/b-text"
|
|
19
|
+
|
|
20
|
+
const desc = ["该组件用于悬浮显示 tooltip 提示框。"],
|
|
21
|
+
extend = [],
|
|
22
|
+
dependent = ["b-text", "b-view"],
|
|
23
|
+
api = {
|
|
24
|
+
methods: [
|
|
25
|
+
{
|
|
26
|
+
name: "show",
|
|
27
|
+
ef: "显示提示框",
|
|
28
|
+
params: "text",
|
|
29
|
+
return: "-"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: "hide",
|
|
33
|
+
ef: "隐藏提示框",
|
|
34
|
+
params: "-",
|
|
35
|
+
return: "-"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: "set_pos",
|
|
39
|
+
ef: "定位提示框",
|
|
40
|
+
params: "x, y",
|
|
41
|
+
return: "-"
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
init_data = `{
|
|
46
|
+
/* colors: {
|
|
47
|
+
text: "文字颜色",
|
|
48
|
+
bg: "背景颜色",
|
|
49
|
+
line: "描边颜色",
|
|
50
|
+
point: "光标点颜色"
|
|
51
|
+
} */,
|
|
52
|
+
/* offset: {
|
|
53
|
+
x: "提示框水平偏移,默认:40",
|
|
54
|
+
y: "提示框垂直偏移,默认:-40",
|
|
55
|
+
}*/
|
|
56
|
+
}`;
|
|
57
|
+
|
|
58
|
+
export default {
|
|
59
|
+
name: "tooltip-wid",
|
|
60
|
+
introduce: { desc, extend, dependent, api, init_data },
|
|
61
|
+
components: {
|
|
62
|
+
BView,
|
|
63
|
+
BText
|
|
64
|
+
},
|
|
65
|
+
props: {
|
|
66
|
+
colors: {
|
|
67
|
+
type: Object,
|
|
68
|
+
required: false
|
|
69
|
+
},
|
|
70
|
+
offset: {
|
|
71
|
+
type: Object,
|
|
72
|
+
required: false,
|
|
73
|
+
default: ()=>{
|
|
74
|
+
return {
|
|
75
|
+
x: 40,
|
|
76
|
+
y: -40
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
data(){
|
|
82
|
+
const offset_x = this.offset.x,
|
|
83
|
+
offset_y = this.offset.y;
|
|
84
|
+
|
|
85
|
+
return {
|
|
86
|
+
|
|
87
|
+
//提示框显示状态
|
|
88
|
+
visible: false,
|
|
89
|
+
|
|
90
|
+
//提示内容
|
|
91
|
+
text: "",
|
|
92
|
+
|
|
93
|
+
//提示框偏移
|
|
94
|
+
box_offset: `l-${offset_x.toString().replace('-', 'f')}px t-${offset_y.toString().replace('-', 'f')}px`,
|
|
95
|
+
|
|
96
|
+
//连线旋转角度
|
|
97
|
+
line_rotate: (Math.atan2(offset_y + 4, offset_x + 4) * 180 / Math.PI).toString().replace("-", "f"),
|
|
98
|
+
|
|
99
|
+
//连线长度
|
|
100
|
+
line_len: Math.sqrt(Math.pow(offset_x, 2) + Math.pow(offset_y, 2)) + "px"
|
|
101
|
+
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
computed: {
|
|
105
|
+
|
|
106
|
+
//组件色彩风格
|
|
107
|
+
color_styles(){
|
|
108
|
+
return {
|
|
109
|
+
line: "neutral",
|
|
110
|
+
text: "dgray",
|
|
111
|
+
bg: "light",
|
|
112
|
+
point: "yellow",
|
|
113
|
+
...this.colors
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
//组件
|
|
118
|
+
tooltip(){
|
|
119
|
+
return this.$refs.tooltip;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
},
|
|
123
|
+
methods: {
|
|
124
|
+
|
|
125
|
+
//显示提示框
|
|
126
|
+
show(text){
|
|
127
|
+
if(this.visible === false){
|
|
128
|
+
this.visible = true;
|
|
129
|
+
this.text = text;
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
|
|
133
|
+
//隐藏提示框
|
|
134
|
+
hide(){
|
|
135
|
+
if(this.visible === true) this.visible = false;
|
|
136
|
+
},
|
|
137
|
+
|
|
138
|
+
//位移提示框
|
|
139
|
+
set_pos(x, y){
|
|
140
|
+
this.tooltip.append_state(`l-${x}px t-${y}px`, "move");
|
|
141
|
+
this.tooltip.toggle_style("move");
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
</script>
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<b-view styles="flex">
|
|
3
|
+
<btn-wid @on_click="$_upload" v-bind="btn_data" />
|
|
4
|
+
<input type="file" style="display: none" ref="uploader" @change="$_exe_upload" :multiple="multiple"/>
|
|
5
|
+
</b-view>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script>
|
|
9
|
+
import BView from "@/components/BTXUI/core/b-view"
|
|
10
|
+
import BtnWid from "@/components/BTXUI/btn/btn-wid"
|
|
11
|
+
|
|
12
|
+
const desc = ["该组件用于文件上传操作,分为 “直接上传” 和 “间接(后续)上传” 2 类流程。", {
|
|
13
|
+
cover: "upload-wid.png",
|
|
14
|
+
title: "执行机制原理"
|
|
15
|
+
}],
|
|
16
|
+
extend = [],
|
|
17
|
+
dependent = ["btn-wid", "b-view"],
|
|
18
|
+
api = {
|
|
19
|
+
event: [
|
|
20
|
+
{
|
|
21
|
+
name: "on_error",
|
|
22
|
+
ef: "上传失败",
|
|
23
|
+
params: "error_code"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: "on_change",
|
|
27
|
+
ef: "上传文件改变",
|
|
28
|
+
params: "files"
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
init_data = `{
|
|
33
|
+
/* uploadApi: "直接上传接口" */,
|
|
34
|
+
/* formData: {
|
|
35
|
+
"其它数据字段": "数据值",...
|
|
36
|
+
} */,
|
|
37
|
+
/* remoteFileBaseURL: 上传文件地址根目录" */,
|
|
38
|
+
/* remoteFiles: "(model) 上传文件地址集" */,
|
|
39
|
+
/* type: "上传类型,数组格式,支持:jpg、png、text...,默认为所有类型" */,
|
|
40
|
+
/* size: "大小限制,默认:2M" */,
|
|
41
|
+
/* multiple: "是否多文件上传,默认 false" */,
|
|
42
|
+
/* btnData: "(参照:btn-wid 组件入参)" */
|
|
43
|
+
}`;
|
|
44
|
+
|
|
45
|
+
export default {
|
|
46
|
+
name: "upload-wid",
|
|
47
|
+
introduce: { desc, extend, dependent, api, init_data },
|
|
48
|
+
components: {
|
|
49
|
+
BtnWid,
|
|
50
|
+
BView
|
|
51
|
+
},
|
|
52
|
+
model: {
|
|
53
|
+
prop: "remoteFiles",
|
|
54
|
+
event: "on_success"
|
|
55
|
+
},
|
|
56
|
+
props: {
|
|
57
|
+
uploadApi: {
|
|
58
|
+
type: String,
|
|
59
|
+
required: false
|
|
60
|
+
},
|
|
61
|
+
formData: {
|
|
62
|
+
type: Object,
|
|
63
|
+
required: false
|
|
64
|
+
},
|
|
65
|
+
remoteFileBaseURL: {
|
|
66
|
+
type: String,
|
|
67
|
+
required: false,
|
|
68
|
+
default: '',
|
|
69
|
+
},
|
|
70
|
+
remoteFiles: {
|
|
71
|
+
type: [Array, String],
|
|
72
|
+
required: false,
|
|
73
|
+
default: ()=>[]
|
|
74
|
+
},
|
|
75
|
+
type: {
|
|
76
|
+
type: Array,
|
|
77
|
+
required: false
|
|
78
|
+
},
|
|
79
|
+
size: {
|
|
80
|
+
type: Number,
|
|
81
|
+
required: false,
|
|
82
|
+
default: 1024 * 1024 * 2
|
|
83
|
+
},
|
|
84
|
+
multiple: {
|
|
85
|
+
type: Boolean,
|
|
86
|
+
required: false
|
|
87
|
+
},
|
|
88
|
+
btnData: {
|
|
89
|
+
type: Object,
|
|
90
|
+
required: false
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
data(){
|
|
94
|
+
return {
|
|
95
|
+
|
|
96
|
+
//上传按钮
|
|
97
|
+
btn_data: {
|
|
98
|
+
btnText: "上传",
|
|
99
|
+
...this.btnData,
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
//上传资源集合
|
|
103
|
+
upload_file: {
|
|
104
|
+
files: null,
|
|
105
|
+
form_data: new FormData(),
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
computed: {
|
|
111
|
+
|
|
112
|
+
//上传文件
|
|
113
|
+
remote_files(){
|
|
114
|
+
const files = this.remoteFiles;
|
|
115
|
+
const remoteFileBaseURL = this.remoteFileBaseURL;
|
|
116
|
+
if(!files) return null;
|
|
117
|
+
if(typeof(files) === "string") { // 单文件
|
|
118
|
+
return [`${remoteFileBaseURL}${files}`]
|
|
119
|
+
} else { // 多文件
|
|
120
|
+
return files.map(file => `${remoteFileBaseURL}${file}`);
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
|
|
124
|
+
//上传元素
|
|
125
|
+
uploader(){
|
|
126
|
+
return this.$refs.uploader;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
},
|
|
130
|
+
methods: {
|
|
131
|
+
|
|
132
|
+
//发送上传数据
|
|
133
|
+
send_upload_data(){
|
|
134
|
+
for(let key in this.formData){
|
|
135
|
+
this.upload_file.form_data.append(key, this.formData[key]);
|
|
136
|
+
}
|
|
137
|
+
this.$axios({
|
|
138
|
+
method: 'post',
|
|
139
|
+
url: this.uploadApi,
|
|
140
|
+
data: this.upload_file.form_data,
|
|
141
|
+
headers: {
|
|
142
|
+
'Content-Type': 'multipart/form-data'
|
|
143
|
+
}
|
|
144
|
+
}).then(res => {
|
|
145
|
+
let datas = res.data.datas;
|
|
146
|
+
if(datas){
|
|
147
|
+
if(res.data.error > 0){ //上传数据有误
|
|
148
|
+
this.$confirm.toast(res.data.datas, 2000, "fail");
|
|
149
|
+
this.$emit("on_error", res.data.error);
|
|
150
|
+
}else{ //上传成功
|
|
151
|
+
this.uploader.value = "";
|
|
152
|
+
this.remoteFiles.length = 0;
|
|
153
|
+
datas.forEach(url=>{
|
|
154
|
+
this.remoteFiles.push(`${url}?tmp=${Math.round(Math.random() * 1000)}`);
|
|
155
|
+
})
|
|
156
|
+
this.$emit("on_success", this.remoteFiles);
|
|
157
|
+
}
|
|
158
|
+
}else{
|
|
159
|
+
this.$confirm.toast("上传服务有误!", 2000, "fail");
|
|
160
|
+
}
|
|
161
|
+
})
|
|
162
|
+
},
|
|
163
|
+
|
|
164
|
+
//点击上传
|
|
165
|
+
$_upload(){
|
|
166
|
+
this.uploader.click();
|
|
167
|
+
},
|
|
168
|
+
|
|
169
|
+
//执行上传
|
|
170
|
+
$_exe_upload(e){
|
|
171
|
+
this.upload_file.files = e.currentTarget.files; //表单数据
|
|
172
|
+
this.$emit("on_change", this.upload_file.files);
|
|
173
|
+
|
|
174
|
+
//上传文件验证
|
|
175
|
+
if(this.$_size_check() || (this.type && this.$_type_check())){
|
|
176
|
+
e.currentTarget.value = null;
|
|
177
|
+
return;
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
//直接上传
|
|
181
|
+
if(this.uploadApi){
|
|
182
|
+
for(let i=0; i<this.upload_file.files.length; i++){
|
|
183
|
+
this.upload_file.form_data.append(`file_${i}`, this.upload_file.files[i]);
|
|
184
|
+
}
|
|
185
|
+
this.send_upload_data();
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
|
|
189
|
+
//类型检测
|
|
190
|
+
$_type_check(){
|
|
191
|
+
let type,
|
|
192
|
+
name,
|
|
193
|
+
result = [].some.call(this.upload_file.files, (file=>{
|
|
194
|
+
name = file.name;
|
|
195
|
+
type = name.split(".").pop();
|
|
196
|
+
return !this.type.includes(type);
|
|
197
|
+
}));
|
|
198
|
+
result && this.$confirm.toast(`${name} 类型有误!`, 2000, "fail");
|
|
199
|
+
return result;
|
|
200
|
+
},
|
|
201
|
+
|
|
202
|
+
//大小检测
|
|
203
|
+
$_size_check(){
|
|
204
|
+
let name,
|
|
205
|
+
result = [].some.call(this.upload_file.files, (file=>{
|
|
206
|
+
name = file.name;
|
|
207
|
+
return file.size > this.size;
|
|
208
|
+
}));
|
|
209
|
+
result && this.$confirm.toast(`${name} 尺寸超过限制!`, 2000, "fail");
|
|
210
|
+
return result;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
</script>
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<b-view styles="rel">
|
|
3
|
+
<b-grid v-bind="grid_data">
|
|
4
|
+
<b-view v-for="img of show_imgs" :id="img.item_id" :key="img.item_id"
|
|
5
|
+
ref="item"
|
|
6
|
+
:styles="`abs mrg-b-0 pad-7px trans-fast t-${img.item_top} l-${img.item_left}`">
|
|
7
|
+
<b-img styles="flex round-sm round-t" :img="img.src" :title="img.title" />
|
|
8
|
+
<b-view styles="pad-1">
|
|
9
|
+
hello world
|
|
10
|
+
</b-view>
|
|
11
|
+
</b-view>
|
|
12
|
+
</b-grid>
|
|
13
|
+
</b-view>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script>
|
|
17
|
+
import BView from "@/components/BTXUI/core/b-view"
|
|
18
|
+
import BImg from "@/components/BTXUI/core/b-img"
|
|
19
|
+
import BGrid from "@/components/BTXUI/core/b-grid"
|
|
20
|
+
|
|
21
|
+
const desc = ["该组件用于瀑布流方式展示内容。"],
|
|
22
|
+
extend = [],
|
|
23
|
+
dependent = ["b-img", "b-view", "b-grid"],
|
|
24
|
+
api = null,
|
|
25
|
+
init_data = `{
|
|
26
|
+
/* uploadApi: "直接上传接口" */,
|
|
27
|
+
/* remoteFiles: "(model) 上传文件地址集" */,
|
|
28
|
+
}`;
|
|
29
|
+
|
|
30
|
+
export default {
|
|
31
|
+
name: "waterfall-wid",
|
|
32
|
+
introduce: { desc, extend, dependent, api, init_data },
|
|
33
|
+
components: {
|
|
34
|
+
BView,
|
|
35
|
+
BImg,
|
|
36
|
+
BGrid
|
|
37
|
+
},
|
|
38
|
+
props: ["init-data"],
|
|
39
|
+
data(){
|
|
40
|
+
return {
|
|
41
|
+
|
|
42
|
+
//网格参数
|
|
43
|
+
grid_data: {
|
|
44
|
+
colData: {
|
|
45
|
+
common_plan: "col-3 col-4-m col-6-s"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
/*图片公共根路径*/
|
|
50
|
+
common_path_root: "",
|
|
51
|
+
|
|
52
|
+
/*全部图片*/
|
|
53
|
+
imgs: [],
|
|
54
|
+
|
|
55
|
+
/*显示图片*/
|
|
56
|
+
show_imgs: [],
|
|
57
|
+
|
|
58
|
+
//细分列数(最多 4 列)
|
|
59
|
+
cols: 4,
|
|
60
|
+
|
|
61
|
+
/*瀑布流定位计算数据结构*/
|
|
62
|
+
pos_data: null,
|
|
63
|
+
|
|
64
|
+
/*重置大小定时器*/
|
|
65
|
+
resize_t: null
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
computed: {
|
|
70
|
+
|
|
71
|
+
//响应式宽度
|
|
72
|
+
cols(val){
|
|
73
|
+
return `col-${12 / this.cols}`;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
},
|
|
77
|
+
methods: {
|
|
78
|
+
|
|
79
|
+
/*加载图片*/
|
|
80
|
+
load_img(index){
|
|
81
|
+
let img = this.imgs[index];
|
|
82
|
+
if(!img) return;
|
|
83
|
+
let $img = new Image(),
|
|
84
|
+
pos;
|
|
85
|
+
$img.onload = ()=>{
|
|
86
|
+
pos = this._computed_pos_data();
|
|
87
|
+
this.show_imgs.push({
|
|
88
|
+
title: img.title,
|
|
89
|
+
src: $img.src,
|
|
90
|
+
item_left: pos.min_top_index * 1/this.cols * 100 + "%",
|
|
91
|
+
item_top: pos.min_top + "px",
|
|
92
|
+
item_id: img.id
|
|
93
|
+
});
|
|
94
|
+
this.$nextTick(()=>{
|
|
95
|
+
this.pos_data[pos.min_top_index] += this.$el.querySelector("#" + img.id).clientHeight;
|
|
96
|
+
this.load_img(++index);
|
|
97
|
+
})
|
|
98
|
+
}
|
|
99
|
+
$img.src = this.common_path_root + img.src;
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
/*追加显示图片*/
|
|
103
|
+
append_imgs(imgs){
|
|
104
|
+
let start_index = this.imgs.length;
|
|
105
|
+
this.imgs = this.imgs.concat(imgs);
|
|
106
|
+
this.load_img(start_index);
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
/*列设置*/
|
|
110
|
+
set_cols(num){
|
|
111
|
+
this.cols = Math.max(Math.min(num, 5), 2);
|
|
112
|
+
this._resize();
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
//【内部方法】---------------------------------------------------------------------
|
|
116
|
+
|
|
117
|
+
/*基于列数设置瀑布流定位计算数据结构*/
|
|
118
|
+
_reset_pos_data(){
|
|
119
|
+
this.pos_data = [];
|
|
120
|
+
for(let i=0; i<this.cols; i++){
|
|
121
|
+
this.pos_data.push(0);
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
/*resize*/
|
|
126
|
+
_resize(){
|
|
127
|
+
clearTimeout(this.resize_t);
|
|
128
|
+
let pos;
|
|
129
|
+
this.resize_t = setTimeout(()=>{
|
|
130
|
+
this._reset_pos_data();
|
|
131
|
+
this.$refs.item.forEach(($item, i) => {
|
|
132
|
+
pos = this._computed_pos_data();
|
|
133
|
+
this.show_imgs[i].item_top = pos.min_top + "px";
|
|
134
|
+
this.show_imgs[i].item_left = pos.min_top_index * 1/this.cols * 100 + "%";
|
|
135
|
+
this.pos_data[pos.min_top_index] += $item.$el.clientHeight;
|
|
136
|
+
})
|
|
137
|
+
}, 1000)
|
|
138
|
+
},
|
|
139
|
+
|
|
140
|
+
/*瀑布流定位计算*/
|
|
141
|
+
_computed_pos_data(){
|
|
142
|
+
let min_top = this.pos_data[0],
|
|
143
|
+
min_top_index = 0;
|
|
144
|
+
this.pos_data.forEach((pos, i) => {
|
|
145
|
+
if(pos < min_top){
|
|
146
|
+
min_top = pos;
|
|
147
|
+
min_top_index = i;
|
|
148
|
+
}
|
|
149
|
+
})
|
|
150
|
+
return {
|
|
151
|
+
min_top,
|
|
152
|
+
min_top_index
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
|
|
156
|
+
},
|
|
157
|
+
mounted(){
|
|
158
|
+
window.onresize = this._resize;
|
|
159
|
+
this.common_path_root = this.initData.common_path_root;
|
|
160
|
+
this.imgs = this.initData.imgs;
|
|
161
|
+
this.cols = this.initData.cols || 2;
|
|
162
|
+
this._reset_pos_data();
|
|
163
|
+
this.load_img(0);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
</script>
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<section>
|
|
3
|
+
<div>
|
|
4
|
+
<h5><code>{{ name }}</code></h5>
|
|
5
|
+
<template v-for="item of desc">
|
|
6
|
+
<!--图片-->
|
|
7
|
+
<div v-if="(item as Desc).cover">
|
|
8
|
+
<img :src="require(`@/assets/img/mechanism/${(item as Desc).cover}`)"
|
|
9
|
+
class="round-sm"/>
|
|
10
|
+
<div class="pcenter">
|
|
11
|
+
<span class="line-b thick-1 line-lgray pad-b-d5 fsize-d9">{{(item as Desc).title}}</span>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<!--文字-->
|
|
16
|
+
<p v-else v-html="item"></p>
|
|
17
|
+
</template>
|
|
18
|
+
<p v-if="extend.length">组件继承:<code v-for="ext of extend">{{ ext }}</code></p>
|
|
19
|
+
<p v-if="dependent.length">组件依赖:<code v-for="dep of dependent">{{ dep }}</code></p>
|
|
20
|
+
<p>组件初始化入参:</p>
|
|
21
|
+
<table class="table">
|
|
22
|
+
<thead>
|
|
23
|
+
<tr>
|
|
24
|
+
<th>属性</th>
|
|
25
|
+
<th>类型</th>
|
|
26
|
+
<th>说明</th>
|
|
27
|
+
</tr>
|
|
28
|
+
</thead>
|
|
29
|
+
<tbody>
|
|
30
|
+
<tr v-for="item of initData">
|
|
31
|
+
<td class="bold">
|
|
32
|
+
{{ item[0] }}
|
|
33
|
+
</td>
|
|
34
|
+
<td>
|
|
35
|
+
<code>{{ item[1] }}</code>
|
|
36
|
+
</td>
|
|
37
|
+
<td>
|
|
38
|
+
{{ item[2] }}
|
|
39
|
+
</td>
|
|
40
|
+
</tr>
|
|
41
|
+
</tbody>
|
|
42
|
+
</table>
|
|
43
|
+
<hr>
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<div v-if="api">
|
|
47
|
+
<h5>组件 API:</h5>
|
|
48
|
+
|
|
49
|
+
<!--属性-->
|
|
50
|
+
<table v-if="api.props" class="table">
|
|
51
|
+
<thead>
|
|
52
|
+
<tr>
|
|
53
|
+
<th>属性</th>
|
|
54
|
+
<th>意义</th>
|
|
55
|
+
</tr>
|
|
56
|
+
</thead>
|
|
57
|
+
<tbody>
|
|
58
|
+
<tr v-for="prop of api.props">
|
|
59
|
+
<td>
|
|
60
|
+
<code>{{prop.name}}</code>
|
|
61
|
+
</td>
|
|
62
|
+
<td>{{prop.ef}}</td>
|
|
63
|
+
</tr>
|
|
64
|
+
</tbody>
|
|
65
|
+
</table>
|
|
66
|
+
|
|
67
|
+
<!--方法-->
|
|
68
|
+
<table v-if="api.methods" class="table">
|
|
69
|
+
<thead>
|
|
70
|
+
<tr>
|
|
71
|
+
<th class="ellipsis">方法</th>
|
|
72
|
+
<th class="ellipsis">效果</th>
|
|
73
|
+
<th class="ellipsis">参数</th>
|
|
74
|
+
<th class="ellipsis">返回值</th>
|
|
75
|
+
</tr>
|
|
76
|
+
</thead>
|
|
77
|
+
<tbody>
|
|
78
|
+
<tr v-for="method of api.methods">
|
|
79
|
+
<td>
|
|
80
|
+
<code>{{ method.name }}</code>
|
|
81
|
+
</td>
|
|
82
|
+
<td>{{ method.ef }}</td>
|
|
83
|
+
<td v-html="method.params"></td>
|
|
84
|
+
<td>
|
|
85
|
+
<code v-if="method.return !== '-'">{{ method.return }}</code>
|
|
86
|
+
<span v-else>-</span>
|
|
87
|
+
</td>
|
|
88
|
+
</tr>
|
|
89
|
+
</tbody>
|
|
90
|
+
</table>
|
|
91
|
+
|
|
92
|
+
<!--事件-->
|
|
93
|
+
<table v-if="api.event" class="table">
|
|
94
|
+
<thead>
|
|
95
|
+
<tr>
|
|
96
|
+
<th>事件</th>
|
|
97
|
+
<th>触发</th>
|
|
98
|
+
<th>回调参数</th>
|
|
99
|
+
</tr>
|
|
100
|
+
</thead>
|
|
101
|
+
<tbody>
|
|
102
|
+
<tr v-for="event of api.event">
|
|
103
|
+
<td>
|
|
104
|
+
<code>{{ event.name }}</code>
|
|
105
|
+
</td>
|
|
106
|
+
<td>{{ event.ef }}</td>
|
|
107
|
+
<td>
|
|
108
|
+
<code v-if="event.name !== '-'">{{ event.params }}</code>
|
|
109
|
+
<span v-else>-</span>
|
|
110
|
+
</td>
|
|
111
|
+
</tr>
|
|
112
|
+
</tbody>
|
|
113
|
+
</table>
|
|
114
|
+
|
|
115
|
+
<!--继承文字-->
|
|
116
|
+
<div v-if="api.extend">
|
|
117
|
+
<p v-html="api.extend"></p>
|
|
118
|
+
<hr>
|
|
119
|
+
</div>
|
|
120
|
+
|
|
121
|
+
</div>
|
|
122
|
+
<p></p>
|
|
123
|
+
</section>
|
|
124
|
+
</template>
|
|
125
|
+
|
|
126
|
+
<script setup lang="ts">
|
|
127
|
+
type Desc = {
|
|
128
|
+
cover: string,
|
|
129
|
+
title: string
|
|
130
|
+
}
|
|
131
|
+
defineProps<{
|
|
132
|
+
// 组件名
|
|
133
|
+
name: string,
|
|
134
|
+
|
|
135
|
+
// 组件介绍
|
|
136
|
+
desc: Array<string | Desc>,
|
|
137
|
+
|
|
138
|
+
// 组件继承
|
|
139
|
+
extend: Array<string>,
|
|
140
|
+
|
|
141
|
+
// 组件依赖
|
|
142
|
+
dependent: Array<string>,
|
|
143
|
+
|
|
144
|
+
// API
|
|
145
|
+
api?: {
|
|
146
|
+
extend: string,
|
|
147
|
+
props: Array<{
|
|
148
|
+
name: string,
|
|
149
|
+
ef: string
|
|
150
|
+
}>,
|
|
151
|
+
event: Array<{
|
|
152
|
+
name: string,
|
|
153
|
+
ef: string,
|
|
154
|
+
params: string
|
|
155
|
+
}>,
|
|
156
|
+
methods: Array<{
|
|
157
|
+
name: string,
|
|
158
|
+
ef: string,
|
|
159
|
+
params: string,
|
|
160
|
+
return: string
|
|
161
|
+
}>
|
|
162
|
+
},
|
|
163
|
+
|
|
164
|
+
// 组件初始化入参
|
|
165
|
+
initData?: Array<Array<string>>,
|
|
166
|
+
}>()
|
|
167
|
+
</script>
|