昨天修改回復(fù)樣式伦籍。效果如下圖:
=============================
修復(fù)一BUG
-- 提取經(jīng)驗(yàn)詳細(xì)信息時(shí)敢伸,會(huì)報(bào)錯(cuò)替劈。因?yàn)閺臄?shù)據(jù)庫沒獲取到對(duì)象拯杠,為null。
控制層 .cs
/// <summary>
/// 項(xiàng)目經(jīng)驗(yàn)分享詳細(xì)頁面
/// </summary>
/// <param name="tid">經(jīng)驗(yàn)GUID </param>
/// <returns></returns>
public ActionResult ProjectExperienceDetails(string tid)
{
var backurl = Request.UrlReferrer; //記錄前頁URL
var editExperienceShare = ExperienceShare.GetExperienceShareById(tid);
if (editExperienceShare == null)
{
TempData["error"] = "此數(shù)據(jù)出錯(cuò)...已通知系統(tǒng)管理員!";
return Redirect(backurl.ToString()); //如果對(duì)象為空健盒,則返回上一頁沾谜。并將錯(cuò)誤信息傳過去涛碑。
}
return View(editExperienceShare);
}
前頁 - 經(jīng)驗(yàn)分享列表 - .cshtml
@{
var message = TempData["error"];
if(message!=null)
{
Response.Write("<script>alert('"+ message.ToString() + "')</script>");
TempData["error"] = null;//銷毀此對(duì)象嗜暴,防止多次提示
}
}
說明:
1凸克,在詳細(xì)信息展示頁面,提取數(shù)據(jù)闷沥,判斷是否為null萎战。如為null則回退到上一頁。并將錯(cuò)誤信息提示傳遞給上一頁的view層舆逃。
2蚂维,B頁的控制層 給 A頁的view層傳值,貌似只能用 TempData路狮。
================================
今日任務(wù): 對(duì) 經(jīng)驗(yàn) 的 點(diǎn)贊 界面設(shè)計(jì)虫啥。
html代碼重構(gòu) 確實(shí)是一件很辛苦的事情。這需要專人來做奄妨,并需要大量的經(jīng)驗(yàn)積累涂籽。否則還真難拿下這件工作。
右下角增加一點(diǎn)贊按鈕
動(dòng)畫效果如下:
后臺(tái)沒有寫砸抛。评雌。應(yīng)該是點(diǎn)完后,按鈕數(shù)字+1.如 234變成235.
HTML :
<div id="Exper_Praise">
<span id="btn"><i class="iconfont"></i> 234贊 </span>
</div>
Css:
/*點(diǎn)贊*/
#Exper_Praise {
text-align:right;
height: 40px;
}
@font-face {
font-family: 'iconfont';
src: url('http://at.alicdn.com/t/font_1468474149_3307927.eot'); /* IE9*/
src: url('http://at.alicdn.com/t/font_1468474149_3307927.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('http://at.alicdn.com/t/font_1468474149_3307927.woff') format('woff'), /* chrome直焙、firefox */
url('http://at.alicdn.com/t/font_1468474149_3307927.ttf') format('truetype'), /* chrome景东、firefox、opera奔誓、Safari, Android, iOS 4.2+*/
url('http://at.alicdn.com/t/font_1468474149_3307927.svg#iconfont') format('svg'); /* iOS 4.1- */
}
#btn {
width: 90px;
height: 36px;
line-height: 36px;
background-color:#C0C0C0;
color: #fff;
font-size: 14px;
font-family: Microsoft YaHei;
cursor: pointer;
display: block;
text-align: center;
float:right;
}
#btn i {
display: inline-block;
}
.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-webkit-text-stroke-width: 0.2px;
-moz-osx-font-smoothing: grayscale;
}
@-webkit-keyframes niceIn {
0% {
opacity: 1;
-webkit-transform: scale(1);
transform: scale(1)
}
50% {
opacity: 1;
-webkit-transform: scale(1.5);
transform: scale(1.5)
}
70% {
-webkit-transform: scale(.8);
transform: scale(.8)
}
100% {
opacity: 1;
-webkit-transform: scale(1);
transform: scale(1)
}
}
@keyframes niceIn {
0% {
opacity: 1;
-webkit-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1)
}
50% {
opacity: 1;
-webkit-transform: scale(1.5);
-ms-transform: scale(1.5);
transform: scale(1.5)
}
70% {
-webkit-transform: scale(.8);
-ms-transform: scale(.8);
transform: scale(.8)
}
100% {
opacity: 1;
-webkit-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1)
}
}
@-o-keyframes niceIn{
0% {
opacity: 1;
-o-transform: scale(1);
transform: scale(1)
}
50% {
opacity: 1;
-o-transform: scale(1.5);
transform: scale(1.5)
}
70% {
-o-transform: scale(.8);
transform: scale(.8)
}
100% {
opacity: 1;
-o-transform: scale(1);
transform: scale(1)
}
}
@-moz-keyframes niceIn{
0% {
opacity: 1;
-moz-transform: scale(1);
transform: scale(1)
}
50% {
opacity: 1;
-moz-transform: scale(1.5);
transform:scale(1.5)
}
70% {
-o-transform: scale(.8);
transform: scale(.8)
}
100% {
opacity: 1;
-moz-transform: scale(1);
transform: scale(1)
}
}
.niceIn {
-webkit-animation:niceIn 0.8s .2s ease;
-moz-animation:niceIn 0.8s .2s ease;
-o-animation:niceIn 0.8s .2s ease;
animation:niceIn 0.8s .2s ease;
}
/*點(diǎn)贊結(jié)束*/
Javascript:
//依賴 Jquery庫斤吐,可自行添加 cdn庫。比如我用的 <script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js" type="text/javascript"></script>
// 百度靜態(tài)資源公共庫 http://cdn.code.baidu.com/
<script type="text/javascript">
(function ($) {
$.extend({
tipsBox: function (options) {
options = $.extend({
obj: null, //jq對(duì)象厨喂,要在那個(gè)html標(biāo)簽上顯示
str: "+1", //字符串和措,要顯示的內(nèi)容;也可以傳一段html,如: "<b style='font-family:Microsoft YaHei;'>+1</b>"
startSize: "12px", //動(dòng)畫開始的文字大小
endSize: "30px", //動(dòng)畫結(jié)束的文字大小
interval: 600, //動(dòng)畫時(shí)間間隔
color: "red", //文字顏色
callback: function () { } //回調(diào)函數(shù)
}, options);
$("body").append("<span class='num'>" + options.str + "</span>");
var box = $(".num");
var left = options.obj.offset().left + options.obj.width() / 2;
var top = options.obj.offset().top - options.obj.height();
box.css({
"position": "absolute",
"left": left + "px",
"top": top + "px",
"z-index": 9999,
"font-size": options.startSize,
"line-height": options.endSize,
"color": options.color
});
box.animate({
"font-size": options.endSize,
"opacity": "0",
"top": top - parseInt(options.endSize) + "px"
}, options.interval, function () {
box.remove();
options.callback();
});
}
});
})(jQuery);
function niceIn(prop){
prop.find('i').addClass('niceIn');
setTimeout(function(){
prop.find('i').removeClass('niceIn');
},1000);
}
$(function () {
$("#btn").click(function () {
$.tipsBox({
obj: $(this),
str: "+1",
callback: function () {
}
});
niceIn($(this));
});
});
</script>
下午任務(wù):增加 點(diǎn)贊 邏輯代碼