-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
236 lines (209 loc) · 7.1 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
<!DOCTYPE html>
<html xmlns:v-bind="http://www.w3.org/1999/xhtml" xmlns:v-clipboard="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<title>拾年之璐图床</title>
<link rel="shortcut icon " type="images/x-icon" href="favicon.ico">
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0"/>
<!-- 引用来自网络的静态资源 -->
<!-- <link rel="stylesheet" type="text/css" href="http://unpkg.com/view-design/dist/styles/iview.css">-->
<!-- <script type="text/javascript" src="http://vuejs.org/js/vue.min.js"></script>-->
<!-- <script type="text/javascript" src="http://unpkg.com/view-design/dist/iview.min.js"></script>-->
<!-- <script src="https://unpkg.com/axios/dist/axios.min.js"></script>-->
<!-- <script type="text/javascript" src="https://unpkg.com/qiniu-js@2.5.5/dist/qiniu.min.js"></script>-->
<!-- 引用本地的静态资源 -->
<link rel="stylesheet" type="text/css" href="css/iview.css">
<script type="text/javascript" src="js/vue.min.js"></script>
<script type="text/javascript" src="js/vue-clipboard.min.js"></script>
<script type="text/javascript" src="js/iview.min.js"></script>
<script type="text/javascript" src="js/axios.min.js"></script>
<script type="text/javascript" src="js/qiniu.min.js"></script>
</head>
<body>
<div id="app" i-col="24">
<p class="title">拾年之璐图床</p>
<div class="upload-borad">
<div class="demo-spin-container" v-show="loading">
<Spin fix></Spin>
</div>
<Upload
class="Upload"
multiple="true"
:show-upload-list="showUploadList"
type="drag"
:before-upload="beforeUpload"
:on-progress="onProgress"
:on-success="onSuccess"
:on-error="onError"
:data="{token: token}"
action="https://upload.qiniup.com">
<!-- TODO 注意修改上面的action URL -->
<div style="padding: 20px 0">
<Icon type="ios-cloud-upload" size="52" style="color: #3399ff"></Icon>
<p>点击选择文件或者将文件拖入此处</p>
</div>
</Upload>
<ul class="ivu-upload-list hoverbox" style="vertical-align: middle">
<li class="ivu-upload-list-file ivu-upload-list-file-finish" v-for="item in arry">
<span>
<i class="ivu-icon ivu-icon-ios-image"></i>
<a v-bind:href="item" target="_blank">
{{item}}
<img v-bind:src="item" class="preview">
</a>
</span>
<span @click="copyURL(item)"> 复制链接 </span>
<span @click="copyMdURL('!['+item+']('+item+')')"> 复制Markdown格式 </span>
</li>
</ul>
</div>
</div>
<div class="footer">
<p class="footer">
<a href="https://github.com/mqllin/QiNiuYun_UploadImage_tuchuang" target="_blank">原作者:mqllin</a>
<a href="http://beian.miit.gov.cn/" target="_blank"> 鲁ICP备18018164号-3 </a>
本图床为自用图床,资源可能随时清除。
</p>
</div>
<script>
new Vue({
el: '#app',
data: {
visible: false,
domain: '',
protocol: '',
token: '',
loading: true,
showUploadList: false,
arry: []
},
mounted() {
this.init()
},
methods: {
init: function () {
let that = this;
axios.get('/server/upload.php')
.then(function (res) {
that.token = res.data.up_token;
that.domain = res.data.domain;
that.protocol = res.data.protocol;
that.$Notice.success({
title: '初始化成功',
desc: ''
});
that.loading = false
})
.catch(function (error) {
// console.log(error);
})
},
show: function () {
this.visible = true;
},
beforeUpload: function (file) {
// console.log('file', file);
return file.name = '/tuchuang/' + file.name
},
onProgress: function (event, file, fileList) {
// console.log(event, file, fileList)
},
onSuccess: function (response, file, fileList) {
// console.log('上传成功', response, file, fileList)
this.$Notice.success({
title: '上传成功',
desc: ''
});
this.arry.push(this.protocol + "://" + this.domain + '/' + response.key)
},
onError: function (error, file, fileList) {
// console.log('上传失败', error, file, fileList)
this.$Notice.error({
title: '上传失败',
desc: error
});
},
copyURL: function (e) {
this.$copyText(e);
this.$Notice.success({
title: '链接复制成功!',
desc: e.substr(0, 30) + '...',
});
},
copyMdURL: function (e) {
this.$copyText(e);
this.$Notice.success({
title: 'Markdown链接复制成功!',
desc: e.substr(0, 30) + '...',
});
}
}
})
</script>
<style>
#app {
width: 100%;
text-align: center;
padding: 28px;
box-sizing: border-box;
margin: auto 0;
}
.title {
font-size: 24px;
margin-top: 28px;
margin-bottom: 28px;
}
.upload-borad {
width: 85%;
max-width: 960px;
margin: 0 auto;
position: relative;
}
.Upload {
width: 100%;
text-align: left;
}
.ivu-upload-list {
width: 100%;
}
.ivu-icon {
margin-right: 0px;
}
.footer {
font-size: 10pt;
color: #9ea7b4;
position: fixed;
bottom: 0;
line-height: 25px;
height: 25px;
width: 100%;
text-align: center;
padding: 0;
}
.demo-spin-container {
display: inline-block;
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
border: 1px solid #eee;
z-index: 2000;
}
.ivu-upload-list-file-finish {
border: 3px white solid;
background-color: #fafafa;
}
.hoverbox a .preview {
display: none;
}
.hoverbox a:hover .preview {
display: block;
position: fixed;
width: 450px;
height: 450px;
z-index: 1;
}
</style>
</body>
</html>