學完了ASP.NET MVC4 IN ACTION 六波之後 企業開發演習php
標籤:AaronYang 茗洋 EasyUI1.3.4 ASP.NET MVC 3css
本篇博客地址:http://www.cnblogs.com/AaronYang/p/3324014.htmlhtml
1你須要從EasyUI官網下載最新的EasyUI,我用的是EasyUI 1.3.4 (百度雲下載)你能夠從這裏進入官網下載jquery
2既然是以爲有企業味道,公司發佈產品使用最後都是經過域名訪問咱們作的產品,爲了模擬域名的訪問模式,咱們須要修改host,這裏我使用 SwitchHost(百度雲下載)linux
3我跟你們同樣,窮屌絲。有一臺本身的馬馬虎虎的小筆記本本就夠了。因此不少編程實驗,我只能簡單模擬,但會提供嘗試的方向web
4基本部署方法express
@charset "utf-8"; /* * 將具備默認margin和padding的標記置零 * @overlay * * @desc 全部標記的margin、padding都在使用時具體定義 */ *{margin:0;padding:0;} /* * 修正IE5.x和IE6的斜體溢出bug * @bugfix * @css-for IE 5.x/Win, IE6 */ * html body{ overflow: visible; } * html iframe, * html frame{ overflow: auto; } * html frameset{ overflow: hidden; } /* @group 經常使用標籤 */ /* * 基本標籤默認樣式取消 * @overlay HTML標籤 * @desc 取消基本標籤默認樣式,防止不一樣瀏覽器顯示效果不一樣 * @Prop text-align:center; 解決不一樣瀏覽器劇中問題 */ body{color:#000;background:#fff;font:12px/22px Verdana,Arial,sans-serif,"Times New Roman",宋體;text-align:center;} body,ul,ol,li,p,h1,h2,h3,h4,h5,h6,form,fieldset,table,td,img,div,tr{margin:0;padding:0;} input,select{font-size:12px;vertical-align:middle;} /* * 設置內容左對齊 * @overlay div * @desc 恢復因BODY設置劇中產生的繼承 */ body div{text-align:left;} /* * 標籤屬性 * @overlay textarea,input * @desc 強制輸入時內容超出時換行 */ textarea,input{ word-wrap:break-word;word-break:break-all;padding:0px;} /* * 清除ul列表標記的樣式 * @overlay li * @desc ul列表更多的用在不須要列表前置符號的樣式裏 */ li{list-style-type:none;} /* * 定義圖片邊框 * @overlay img * @desc 當圖片做爲連接內容被填充時,會有默認邊框出現,重定義掉 */ img{border:0 none;} /* * 定義默認的連接樣式 * @overlay a * @desc 僅僅是做爲默認樣式提供,能夠在各自的實例中覆蓋掉 */ a:link, a:visited{ color:#000; text-decoration: none; } a:hover{ color:#F60; text-decoration: underline; } /* 去掉連接的虛線框 */ /* a {outline: none; a {star:expression(this.onFocus=this.blur()); */ /* * 定義H系列標籤 * @overlay HN * @desc 覆蓋H系列標籤默認屬性 */ h1{ font-size:24px;} h2{ font-size:20px;} h3{ font-size:18px;} h4{ font-size:16px;} h5{ font-size:14px;} h6{ font-size:12px;} /* @end */ /* @group 通用屬性定義 */ /* 鼠標樣式 */ .pointer{cursor:pointer;} /* 取消邊框 */ .NoBorder{border:0 none;} /* 文本對齊方式 */ .t-l{text-align:left;} .t-c{text-align:center;} .t-r{text-align:right;} /* * 字母和單詞換行設置 * @class Break 強制內容換行 * @class Nobreak 強制內容不換行 */ .Break{word-break:break-all;word-wrap:break-word;} .Nobreak{word-break:keep-all;word-wrap:normal;} /* 浮動定義 */ .FL{float:left;} .FR{float:right;} /* 定義文本下劃線 */ .UnLine{text-decoration:underline;} .DisunLine{text-decoration:none;} /* 定位關係 */ .absolute{position:absolute;} .relative{position:relative;} /* 下劃點虛線 */ /* .dotLine{ background:url(../image/dot01.gif) repeat-x left bottom;} */ /* ul列表 .ul-fl li{ float:left; height:23px; line-height:23px; padding-left:20px; } .ul-fl-d li{ float:left; height:23px; line-height:23px; background:url(../images/dot/dot3-3.jpg) no-repeat 8px 10px; padding-left:20px; } .ul-no-f li{ height:23px; width:100%; overflow:hidden; line-height:23px; background:url(../images/dot/dot3-3.jpg) no-repeat 8px 10px; padding-left:20px; } */ /* @end */ /* 通用容器 */ .wrapper{ clear: both; overflow: hidden; } /* @group 隱藏元素 */ /* * 隱藏元素 * @class o-hidden * @desc 當元素內容內容超出元素height 或 width 時,隱藏之 */ .o-hidden{overflow:hidden;} /* * 隱藏元素 * @class invisible * @desc visibility能夠隱藏元素,可是仍是會在佈局中佔位 */ .invisible{ visibility:hidden; } /* * 從頁面佈局上隱藏元素 * @class hidden * @desc 從佈局上隱藏元素 */ .hidden{ display: none; } .block {display:block;} /* @end */ /* * 清理元素 * @class clear * @desc 清理浮動元素,當浮動換行時後面元素不但願浮動,添加此屬性,防止IE BUG */ .clear{clear:both; height:0px; width:100%; font-size:1px; line-height:0px; visibility:hidden; overflow:hidden;} /* 經常使用樣式定義 */ /* * 邊框定義 * @Pro 由大寫B開頭,表示系統公用邊框樣式 * @desc 經常使用樣式可更具一個項目的樣式使用頻率從新定義,擴展 */ .BTW{ border-top-width:1px;} .BRW{ border-right-width:1px;} .BLW{ border-left-width:1px;} .BBW{ border:0px; border-bottom-width:1px;} .Bord1{border:1px solid #999;} .Bord2{border:2px solid #999;} /* 邊框寬度 (BW開頭) */ .BW1{ border-width:1px;} .BW2{ border-width:2px;} .BW3{ border-width:3px;} .BW4{ border-width:4px;} .BW5{ border-width:5px;} /* 邊框樣式 (Bs開頭) */ .BsS{ border-style:solid;} .BsD{ border-style:dotted;} /* 邊框顏色 (Bc開頭) */ .BcBlue{ border-color: #0000FF;} .BcBlack{ border-color: #000;} /* 下劃線 */ .BotLine{ border-bottom:1px solid #CFCFCF; overflow:hidden;} /*.BotDotLine{ background: url(../image/dot01.gif) repeat-x left bottom;}*/ .BotDotLine01{ width:95%; margin:0 auto; background: url(../image/dot01.gif) repeat-x; height:1px; line-height:1px; overflow:hidden;} /*.BotDasLine{ border-bottom:1px dashed #CFCFCF; overflow:hidden; height:1px; line-height:1px;}*/ /*.border-r-dot{ background:url(../image/dot02.gif) repeat-y right top;}*/ /* * 寬度定義 * @Pro 由小寫C開頭,表示color * @desc 經常使用樣式可更具一個項目的樣式使用頻率從新定義,擴展 */ .W1024,.W786,.W975,.W972{width:968px;margin:0 auto;} .W1024{width:1024px;} .W786{width:786px;} .W975{width:975px;} .W972{width:972px;} /* * 顏色功能定義 * @Pro 由小寫C開頭,表示color * @desc 經常使用樣式可更具一個項目的樣式使用頻率從新定義,擴展 */ .cRed{color: #F00;} .cWhite{color: #FFF;} .cGreen{color:#0F0;} .cGray{color: #666;} .cBlue{ color: #00F;} .cblack{ color:#000;} /* 定義某個項目經常使用顏色 */ .c001{color:#663;} /* * 定義字體樣式 * @Pro 由大寫字母F開頭,表示FONT * @desc 經常使用樣式可更具一個項目的樣式使用頻率從新定義,擴展 */ /* 字體樣式 */ .FB{font-weight:bold;} .FN{ font-weight:normal;} .FI{font-style:italic;} /* 字體大小 */ .F10{font-size:10px;} .F11{font-size:11px;} .F12{font-size:12px;} .F13{font-size:13px;} .F14{font-size:14px;} .F16{font-size:16px;} .F18{font-size:18px;} /* * 定義間距,上下2個DIV間距 * @Pro 使用DIVH開頭. * @desc 上下DIV有間距時使用,儘可能不使用margin/padding值,防止不一樣瀏覽器出現BUG, * 使用下面屬性可兼容大多瀏覽器. */ .DivH5,.DivH10,.DivH15,.DivH20,.DivH25,.DivH30,DivH1,.DivH40{width:100%;overflow:hidden;} .DivH1{ height:1px;} .DivH5{height:5px;} .DivH10{height:10px;} .DivH15{height:15px;} .DivH20{height:20px;} .DivH25{height:25px;} .DivH30{height:30px;} .DivH40{height:40px;} /* * 定義行高 * @class LH * @desc 使用較少,主要定義line-height屬性 */ .LH1{ line-height:1px; } .LH10{ line-height:10px; } .LH15{ line-height:15px; } .LH18{ line-height:18px; } .LH20{ line-height:20px; } .LH25{ line-height:25px;} .LH30{ line-height:30px;} .LH35{ line-height:35px;} /* * 標題樣式定義 * @Pro PTit * @desc 在定義p標籤元素或其它元素時,須要同時定義行高和高度,通常使用在標題顯示中. */ .PTit25,.PTit20,.PTit18,.PTit30,.PTit,.PTit1,.PTit22{ width:100%; overflow:hidden;} .PTit30{line-height:30px;height:30px;} .PTit25{line-height:25px;height:25px;} .PTit22{line-height:22px;height:22px;} .PTit20{line-height:20px;height:20px;} .PTit18{line-height:18px;height:18px;} .PTit15{line-height:15px;height:15px;} .PTit10{line-height:10px;height:10px;} .PTit1{line-height:1px;height:1px;} /* * MORE更多樣式設計 * @Pro MORE * @desc 顯示在右側更多/MORE樣式,可根據需求擴展 */ .More{text-align:right;position:absolute; top:0; right:3px;} .MoreR5{ position:absolute; top:0px; right:3px; font:12px normal; } .MoreR15{ position:absolute; top:0px; right:15px; font:12px normal;} /* * 普通列表樣式定義 * @desc 文章列表樣 * @use 通常列表使用,ul li列表 */ .ArtList,.ArtList25,.ArtList22,.ArtList24{ width:100%; overflow:hidden; margin:0 auto;} .ArtList li{ width:100%; height:20px; line-height:20px; overflow:hidden;} .ArtList25 li{ width:100%; height:25px; line-height:25px; overflow:hidden;} .ArtList24 li{ width:100%; height:24px; line-height:24px; overflow:hidden;} .ArtList22 li{ width:100%; height:22px; line-height:22px; overflow:hidden;} /* @end */ /* 備註 */ /*在終極頁面中調用該通用樣式時,應該注意顯示效果的不一樣,由於後臺上傳信息時編輯器裏面樣式並無調用本默認樣式表. * *因此在編輯器中標籤會有默認的屬性,用戶在添加信息時,這些信息都是附帶默認樣式的. *若是用咱們在終極頁面也調用本默認CSS文件的話,許多標籤如:p,td,li......標籤默認樣式都被取消,所以顯示效不一樣. * *解決辦法: * 在終極頁面顯示內容區域還原這些標籤的默認屬性. * */ /* ul,ol,li,p,h1,h2,h3,h4,h5,h6,form,fieldset,table,td,img,div,tr{ margin:auto; padding:inherit;} input,select{ font-size:inherit;} img{border: inherit;} ul,li{margin:auto; padding:inherit;} li{ list-style-type:disc; } */
Logo我直接使用博客園的了編程
js我直接新建一個空的js文件commom.jsjson
完成後,咱們從新發布一下windows
打開IIS管理器 (Win+R 輸入inetmgr也能夠打開)
完成後,咱們打開瀏覽器輸入
http://res.yyang.com/res/jquery-easyui-1.3.4/index-demo.html
發現運行不了,由於這個域名根本不存在,此時咱們須要switchhost的幫助
打開Switchhost.咱們先創建一個 開發的host環境,刪掉默認的方案一,方案二,添加一個開發方案
一個開發嚴格的公司,每每有好幾臺服務器,一個產品的發佈都要通過好幾個服務器環境的測試才能夠驗收
一臺開發環境服務器,通常都是本身電腦(127.0.0.1),一臺基本測試服務器(例如192.168.10.110),另外一臺測試服務器(例如192.168.10.120),最後一臺測試服務器是跟真實部署環境比較像的服務器環境,咱們叫P版環境(例如192.169.10.188),最後就是真實的最終要使用的發佈的服務器環境了。咱們在創建幾個方案,固然這裏不少開發者只有一臺電腦,我建議仍是不要用虛擬機,哎,個人電腦配置很差。。。開虛擬機會卡卡滴。有條件的多買幾個電腦,模擬公司的開發環境。(爲了實踐更多的技術,我必須努力賺錢買本身的電腦,個人目標,今年買3臺電腦,固然不是服務器級別的了,加油!!!)
雙擊某個方案,就能夠當即切換環境。咱們雙擊開發環境,添加以下host配置
127.0.0.1 www.yyang.com
127.0.0.1 res.yyang.com
此時咱們打開瀏覽器,輸入:
http://res.yyang.com:1001/res/jquery-easyui-1.3.4/index-demo.html
效果會以下:
這就是Switchhost的做用,咱們之後在代碼得到域名的時候,就不會是什麼localhost了,與真實的環境更接近。
接下來,咱們訪問默認的Default.aspx頁面
很明顯,.net framework沒有對的上,解決方法以下:
此時刷新瀏覽器,會有以下的錯誤
解決辦法:
修改爲
此時,咱們輸入res.yyang.com:1001/default.aspx或者 res.yyang.com:1001均可以訪問咱們一開始的初始頁面
此時咱們訪問圖片資源和樣式資源,還有js文件資源均可以訪問了
其實這裏我講多了,其實咱們只須要能訪問基本的資源文件就夠了,aspx頁面都不要可否訪問到均可以,這裏只是爲之後的ASP.NET MVC發佈作簡單的引入。爲了安全起見,咱們仍是不要讓訪問者能夠訪問其餘資源吧
關於發佈,還有兩個地方順便講一下:
打開默認文檔,咱們刪掉裏面的默認頁面default.aspx頁面,這樣子
當咱們輸入 res.yyang.com:1001 的時候,因爲沒有指定默認的頁面,因此服務器會禁止訪問,可是其餘靜態資源咱們均可以訪問的
此時訪問,會出現403
咱們此時若是想讓開發者查看到 easyui下的目錄結構,可是也是被禁止的
咱們能夠經過以下修改,就可讓開發者看到了,可是這樣子每每是不安全的,這裏咱們還沒用到真實環境給人家用,咱們只是本身用,因此打開,咱們有時能夠看看easyui目錄的結構,而後能夠針對性的打開demo學習
單擊啓用後,勾選長日期,不勾選也沒事。而後點擊應用,就能夠了
刷新瀏覽器:
做爲一個嚴格的資源服務器,是禁止顯示目錄結構,但這裏咱們只是本身用,固然你隨時能夠關掉目錄瀏覽的權限
做爲一個資源服務器,特殊文件格式的文件的訪問的需求,咱們仍是要知足的,例如 .json格式的文件,企業裏有的都是把json文件後綴名直接變成js格式的來避免
咱們試圖瀏覽到以下目錄
http://res.yyang.com:1001/res/jquery-easyui-1.3.4/demo/accordion/
當咱們單擊.json文件時候,發現禁止訪問
解決方法:
刷新瀏覽器:
此時,咱們已經能夠訪問 第三方格式的文件了。咱們的MVC項目就能夠經過Get請求方式得到資源服務器資源,而後解析了
關於IIS 資源服務器 發佈就到這裏結束了,之後咱們還須要一個文件服務器,之後再說吧
在下一講裏面咱們主要講搭建 第一個使用EasyUI1.3.4 的ASP.NET MVC3企業項目使用和特別事項,還有些企業的忌諱。