- 引入最重要的一个js文件:
app-info-parser.js
- 使用layui+tp6解析ipa的代码示例(apk同理)
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>upload模块快速使用</title>
<link rel="stylesheet" href="/static/zsign/layui/css/layui.css" media="all">
</head>
<body>
<div class="layui-upload-drag" id="test10">
<i class="layui-icon"></i>
<p>点击上传,或将文件拖拽到此处</p>
<br>
<div class="layui-progress layui-progress-big" lay-showpercent="true" lay-filter="demo">
<div class="layui-progress-bar" lay-percent="0%"></div>
</div>
</div>
<script src="/static/zsign/layui/layui.js"></script>
<script src="/static/admin/js/zsign/app-info-parser.js"></script>
<script>
layui.use(['upload', 'element'], function () {
let upload = layui.upload;
let element = layui.element;
//拖拽上传
upload.render({
elem: '#test10'
, accept: 'file'
, auto: false
, url: '{:url("admin/zsign.Upload/uploadIpa")}'
, choose: function (obj) {
obj.preview(function (index, file, result) {
new AppInfoParser(file).parse().then(appInfo => {
console.log(appInfo);
});
});
layer.load();
}
, progress: function (n, elem) {
let percent = n + '%'
element.progress('demo', percent);
}
, done: function (res) {
if (res.code == 1) {
layer.msg(res.msg);
} else {
layer.alert(res.msg);
}
}
});
});
</script>
</body>
</html>
-
没问题的话会看到一下画面