|
|
@@ -186,6 +186,44 @@ include($_SERVER['DOCUMENT_ROOT'] . "/Authorization/script/php/permission/check_
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <div class="row">
|
|
|
+ <div class="col-sm-6">
|
|
|
+ <div class="form-group">
|
|
|
+ <label class="control-label">上傳API預覽圖</label>
|
|
|
+ <div class="fileupload fileupload-new" data-provides="fileupload">
|
|
|
+ <div class="input-append">
|
|
|
+ <div class="uneditable-input">
|
|
|
+ <span id="fileCount" class="fileupload-preview"></span>
|
|
|
+ </div>
|
|
|
+ <span class="btn btn-default btn-file">
|
|
|
+ <span class="fileupload-exists">更換檔案</span>
|
|
|
+ <span class="fileupload-new">選擇檔案</span>
|
|
|
+ <input type="file" id="thumbnail" accept="image/png, image/gif, image/jpeg">
|
|
|
+ </span>
|
|
|
+ <a href="#" class="btn btn-default fileupload-exists" data-dismiss="fileupload">移除檔案</a>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="col-sm-6">
|
|
|
+ <div class="form-group">
|
|
|
+ <label class="control-label">上傳API操作影片</label>
|
|
|
+ <div class="fileupload fileupload-new" data-provides="fileupload">
|
|
|
+ <div class="input-append">
|
|
|
+ <div class="uneditable-input">
|
|
|
+ <span id="fileCount" class="fileupload-preview"></span>
|
|
|
+ </div>
|
|
|
+ <span class="btn btn-default btn-file">
|
|
|
+ <span class="fileupload-exists">更換檔案</span>
|
|
|
+ <span class="fileupload-new">選擇檔案</span>
|
|
|
+ <input type="file" id="video" accept=".mp4,.avi">
|
|
|
+ </span>
|
|
|
+ <a href="#" class="btn btn-default fileupload-exists" data-dismiss="fileupload">移除檔案</a>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
<div class="row">
|
|
|
<div class="col-sm-6">
|
|
|
<div class="form-group">
|
|
|
@@ -201,9 +239,9 @@ include($_SERVER['DOCUMENT_ROOT'] . "/Authorization/script/php/permission/check_
|
|
|
<input type="file" id="files" multiple webkitdirectory mozdirectory>
|
|
|
</span>
|
|
|
<a href="#" class="btn btn-default fileupload-exists" data-dismiss="fileupload">移除檔案</a>
|
|
|
- <span class="help-block"><strong>注意事項:</strong>請選擇要上傳的資料夾,盡量不要有子資料夾,若有請壓縮後再上傳
|
|
|
- <br>預覽縮圖請存成PNG,影片格式請使用.avi或.mp4
|
|
|
- <br>預覽圖及影片名稱請與API名稱相同</span>
|
|
|
+ <span class="help-block"><strong>注意事項:</strong>
|
|
|
+ <br>請選擇要上傳的資料夾,盡量不要有子資料夾,若有請壓縮後再上傳
|
|
|
+ <br>影片格式請使用.avi或.mp4</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -427,11 +465,11 @@ include($_SERVER['DOCUMENT_ROOT'] . "/Authorization/script/php/permission/check_
|
|
|
e.preventDefault();
|
|
|
|
|
|
if (isDuplicate) {
|
|
|
- showNotification('警告','尚未提供上傳不同版本功能,請勿重複上傳!','error');
|
|
|
+ showNotification('警告', '尚未提供上傳不同版本功能,請勿重複上傳!', 'error');
|
|
|
return;
|
|
|
}
|
|
|
if ($("#files").val() === "") {
|
|
|
- showNotification('警告','請先選擇上傳檔案!','error');
|
|
|
+ showNotification('警告', '請先選擇上傳檔案!', 'error');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
@@ -443,6 +481,8 @@ include($_SERVER['DOCUMENT_ROOT'] . "/Authorization/script/php/permission/check_
|
|
|
for (i = 0; i < $("#files").prop('files').length; i++) {
|
|
|
formData.append("files[]", $("#files").prop('files')[i]);
|
|
|
}
|
|
|
+ formData.append("thumbnail", $("#thumbnail").prop('files')[0]);
|
|
|
+ formData.append("video", $("#video").prop('files')[0]);
|
|
|
$.ajax({
|
|
|
type: "POST",
|
|
|
url: "./script/php/api_upload.php",
|
|
|
@@ -453,7 +493,7 @@ include($_SERVER['DOCUMENT_ROOT'] . "/Authorization/script/php/permission/check_
|
|
|
dataType: 'text', // 回傳的資料格式
|
|
|
success: function(data) {
|
|
|
console.log(data);
|
|
|
- showNotification('成功','轉檔上傳成功!','success');
|
|
|
+ showNotification('成功', '轉檔上傳成功!', 'success');
|
|
|
},
|
|
|
xhr: function() {
|
|
|
var xhr = new window.XMLHttpRequest(); // 建立xhr(XMLHttpRequest)物件
|
|
|
@@ -463,8 +503,8 @@ include($_SERVER['DOCUMENT_ROOT'] . "/Authorization/script/php/permission/check_
|
|
|
var percentVal = Math.round(percentComplete * 100) + "%";
|
|
|
$("#bar").text(percentVal); // 進度條百分比文字
|
|
|
$("#bar").width(percentVal); // 進度條顏色
|
|
|
- if(percentVal == '100%'){
|
|
|
- showNotification('提示','上傳成功!請稍待轉檔完成','info');
|
|
|
+ if (percentVal == '100%') {
|
|
|
+ showNotification('提示', '上傳成功!請稍待轉檔完成', 'info');
|
|
|
}
|
|
|
}
|
|
|
}, false);
|
|
|
@@ -498,7 +538,7 @@ include($_SERVER['DOCUMENT_ROOT'] . "/Authorization/script/php/permission/check_
|
|
|
return isDuplicate;
|
|
|
}
|
|
|
|
|
|
- function showNotification(title,text,type) {
|
|
|
+ function showNotification(title, text, type) {
|
|
|
var notice = new PNotify({
|
|
|
title: title,
|
|
|
text: text,
|