forked from openatx/atxserver2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
upload.html
74 lines (68 loc) · 1.92 KB
/
upload.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
{% extends "base.html" %}
{% block title %}设备列表{% end %}
{% block script %}
{% end %}
{% block style %}
<style>
.color-right {
background-color: yellowgreen;
color: white;
}
.color-wrong {
color: red;
}
</style>
{% end %}
{% block content %}
<div class="container">
<h3>文件上传</h3>
<el-upload ref="upload" class="upload-demo" drag action="/uploads" :on-success="onUpload" multiple>
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
<div class="el-upload__tip" slot="tip">暂时只支持apk的上传</div>
</el-upload>
<div>
<template v-for="f in files">
<el-card class="box-card">
<img :src="f.iconUrl" alt="icon" style="height: 30px;">
{{!f.packageName}}
<em>{{!f.versionName}}</em>
</el-card>
</template>
</div>
</div>
{% end %}
{% block script %}
<script>
new Vue({
el: "#app",
data: {
title: "hello world",
files: [{
iconUrl: "/static/images/android-logo-robot.png",
packageName: "TODO",
versionName: "1.1.2"
}],
},
methods: {
onUpload(resp, file, files) {
if (!resp.success) {
this.$message({
message: resp.description,
type: "error",
})
return
}
if (!resp.data.iconUrl) {
resp.data.iconUrl = "/static/images/android-logo-robot.png"
}
this.files.push(resp.data)
console.log(resp)
console.log(file)
console.log(files)
this.$refs.upload.clearFiles()
}
}
})
</script>
{% end %}