Tipo Music UI 規劃原則
By Jax
原則
• 只要是 button 就要有包含 Icon
• 所有 User 操作的 Ajax 都要 Handle 等待、成功、失敗
StatusMsg
var StatusMsg = { 
clear: function () { }, 
alert: function (str) { }, 
error: function (str) { }, 
wait: function (str) { } 
}; 
ltcAjax
$.ltcAjax({
url: this.href,
waitMsg: ' 刪除中 ...',
button: this,
success: function (msg) {
StatusMsg.alert(msg);
$(this.button).closest('tr').remove();
}
});
Message to Ajax
try
{
_useListRepo.DeleteSong(useListSongSN);
return Content(" 刪除成功 !!");
}
catch (Exception ex)
{
_log.ErrorException(" 利用人 UseList  歌曲刪除失
敗 !!", ex);
Response.TrySkipIisCustomErrors = true;
Response.StatusCode = 400;
return Content(" 刪除失敗 !!");
}
Message to View
try
{
// ...
TempData["StatusSuccess"] = " 匯入成功 !!";                 
return RedirectToAction("AnalysisMusicGroupOwner", new { BatchID = batchID });
}
catch (TipoMusicException ex)
{
TempData["StatusError"] = ex.Message;
TempData["ImportListErrorMessage"] = ex.ErrorMessages;
}
catch (Exception ex)
{
_log.ErrorException(" 利用人 UseList  匯入失敗 !!", ex);
TempData["StatusError"] = " 匯入失敗 !!";
}
Message to View
try
{
// ...
TempData["StatusSuccess"] = " 匯入成功 !!";                 
return RedirectToAction("AnalysisMusicGroupOwner", new { BatchID = batchID });
}
catch (TipoMusicException ex)
{
TempData["StatusError"] = ex.Message;
TempData["ImportListErrorMessage"] = ex.ErrorMessages;
}
catch (Exception ex)
{
_log.ErrorException(" 利用人 UseList  匯入失敗 !!", ex);
TempData["StatusError"] = " 匯入失敗 !!";
}

Tipo music-ui-規劃原則