mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2025-03-07 15:16:40 +08:00
refresh uploaded image only instead of page
This commit is contained in:
parent
791195c44d
commit
d7317b98cb
@ -2,7 +2,7 @@
|
|||||||
* @Author: printempw
|
* @Author: printempw
|
||||||
* @Date: 2016-02-04 16:48:42
|
* @Date: 2016-02-04 16:48:42
|
||||||
* @Last Modified by: printempw
|
* @Last Modified by: printempw
|
||||||
* @Last Modified time: 2016-04-03 08:23:49
|
* @Last Modified time: 2016-04-03 08:35:15
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
@ -21,7 +21,7 @@ function uploadSkin(uname) {
|
|||||||
|
|
||||||
function uploadTexture(uname, type) {
|
function uploadTexture(uname, type) {
|
||||||
var ply = new Ply({
|
var ply = new Ply({
|
||||||
el: '<h2>为该用户上传新的 '+type+':</h2>'+
|
el: '<h2>为该用户上传新的 ' + type + ' 材质:</h2>'+
|
||||||
'<input type="file" id="file" accept="image/png">'+
|
'<input type="file" id="file" accept="image/png">'+
|
||||||
'<button id="upload" class="btn btn-primary fw">上传</button>',
|
'<button id="upload" class="btn btn-primary fw">上传</button>',
|
||||||
effect: "fade",
|
effect: "fade",
|
||||||
@ -39,9 +39,13 @@ function uploadTexture(uname, type) {
|
|||||||
processData: false,
|
processData: false,
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
if (json.errno == 0) {
|
if (json.errno == 0) {
|
||||||
showAlert("上传成功。", function(){
|
showAlert("上传成功。");
|
||||||
location.reload();
|
if (type == "steve") $('[src="../skin/' + uname + '-steve.png"]').prop('src',
|
||||||
});
|
$('[src="../skin/' + uname + '-steve.png"]').prop('src')+'?random');
|
||||||
|
if (type == "alex") $('[src="../skin/' + uname + '-alex.png"]').prop('src',
|
||||||
|
$('[src="../skin/' + uname + '-alex.png"]').prop('src')+'?random');
|
||||||
|
if (type == "cape") $('[src="../cape/' + uname + '.png"]').prop('src',
|
||||||
|
$('[src="../cape/' + uname + '.png"]').prop('src')+'?random');
|
||||||
} else {
|
} else {
|
||||||
showAlert("上传材质的时候出错啦:\n" + json.msg);
|
showAlert("上传材质的时候出错啦:\n" + json.msg);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user