当前位置: 首页 > news >正文

手机网站设计图电脑办公软件培训班

手机网站设计图,电脑办公软件培训班,wordpress过滤评论插件,做的网站怎么让别人也能看到一、准备工作 先从网上(站长之家、模板之家,甚至TB)下载一个HTML模板,要求一整套的CSS和必要的JS,比如下图: 登录页面的效果是: 首页: 利用这些模板可以减少前台网页的设计——拿来…

一、准备工作

先从网上(站长之家、模板之家,甚至TB)下载一个HTML模板,要求一整套的CSS和必要的JS,比如下图:

登录页面的效果是:

首页:

 

利用这些模板可以减少前台网页的设计——拿来主义

网上模板很多,比如HUI:

 SA-ADMIN

 本例用比较简单的《蓝色超市模板》完成用户登录操作。

二、拷贝内容到工程

把CSS、JS和IMG目录拷贝到工程(类似文件拷贝粘贴)

 

 右键拷贝,到工程目录下,右键,粘贴(可另外新建一个目录,也可以简单粘贴到工程根目录)

 效果如下:

 三、功能实现

功能:用户第一次登录 -》 输入用户账号密码 -》 读数据库验证 -》 通过进入首页

补充:

1、登录后的状态应该维持到关闭浏览器(使用Cookie)——后面解决

2、用户信息错误应该有相应提示

解决思路:

1、修改路由(还有其他解决方法),默认为 Login ;

2、收集用户信息,传送到指定Action (POST比较好);

3、控制器读取数据库,验证用户信息,反馈相应的操作。

修改默认路由:

在HOME控制器,添加Login Action:

 

右键添加Login页面:

 

可以测试一下,默认进入登录页面:

 

 删除上面 Login.cshtml的内容,并且粘贴模板中 ,Login.html 内容

<!DOCTYPE html>
<html>
<head lang="en"><meta charset="UTF-8"><title>系统登录 - 超市账单管理系统</title><link rel="stylesheet" href="css/style.css"/>
</head>
<body class="login_bg"><section class="loginBox"><header class="loginHeader"><h1>超市账单管理系统</h1></header><section class="loginCont"><form class="loginForm" action="welcome.html"><div class="inputbox"><label for="user">用户名:</label><input id="user" type="text" name="username" placeholder="请输入用户名" required/></div><div class="inputbox"><label for="mima">密码:</label><input id="mima" type="password" name="password" placeholder="请输入密码" required/></div><div class="subBtn"><input type="submit" value="登录" /><input type="reset" value="重置"/></div></form></section></section></body>
</html>

修改CSS路径后,如下:

 这时候,执行功能进入了登录页面:

 页面上添加JS代码收集用户信息(推荐JQUERY,JS和JQUERY在菜鸟学堂有介绍)

<!DOCTYPE html>
<html>
<head lang="en"><meta charset="UTF-8"><title>系统登录 - 超市账单管理系统</title><link rel="stylesheet" href="~/css/style.css"/><script src="~/js/jquery.js"></script><script>function login() {var name = $("#user").val();var psw = $("#mima").val();$.post("/Home/Login", { id: name, password: psw }, function (data) {if (data == "OK")window.location.href = "/Home/Index";elsealert(data);});}</script>
</head>
<body class="login_bg"><section class="loginBox"><header class="loginHeader"><h1>超市账单管理系统</h1></header><section class="loginCont"><form class="loginForm" ><div class="inputbox"><label for="user">用户名:</label><input id="user" type="text" name="username" placeholder="请输入用户名" required/></div><div class="inputbox"><label for="mima">密码:</label><input id="mima" type="password" name="password" placeholder="请输入密码" required/></div><div class="subBtn"><input type="submit" value="登录" onclick="login()"/><input type="reset" value="重置"/></div></form></section></section></body>
</html>

说明:

1、添加JQUERY  :   <script src="~/js/jquery.js"></script>  ;

2、自定义login的JS函数,来响应按钮登录的点击事件:<input type="submit" value="登录" οnclick="login()"/>

3、登录事件处理:获取用户名+密码两个输入框的内容,利用post方式提交到服务器,获取服务器的反馈,如果是OK,转到index页面,否则弹出反馈信息

后台控制器再添加一个Login(需要与前面的有不同的参数,重载):

        public ActionResult Login(){            return View();}[HttpPost]public ActionResult Login(string id,string password){DataSet set = TestMysql.Query("select * from user where name='"+id+"'");if(set.Tables[0].Rows.Count <= 0){return Content("无此用户");}if (set.Tables[0].Rows[0]["psw"].ToString() != password){return Content("密码错误");}return Content("OK");}

最后按照Login的方法,修改Index的内容:

<!DOCTYPE html>
<html>
<head lang="en"><meta charset="UTF-8"><title>超市账单管理系统</title><link rel="stylesheet" href="~/css/public.css"/><link rel="stylesheet" href="~/css/style.css"/>
</head>
<body>
<!--头部-->
<header class="publicHeader"><h1>超市账单管理系统</h1><div class="publicHeaderR"><p><span>下午好!</span><span style="color: #fff21b"> Admin</span> , 欢迎你!</p><a href="login.html">退出</a></div>
</header>
<!--时间-->
<section class="publicTime"><span id="time">2015年1月1日 11:11  星期一</span><a href="#">温馨提示:为了能正常浏览,请使用高版本浏览器!(IE10+)</a>
</section>
<!--主体内容-->
<section class="publicMian"><div class="left"><h2 class="leftH2"><span class="span1"></span>功能列表 <span></span></h2><nav><ul class="list"><li ><a href="billList.html">账单管理</a></li><li><a href="providerList.html">供应商管理</a></li><li><a href="userList.html">用户管理</a></li><li><a href="password.html">密码修改</a></li><li><a href="login.html">退出系统</a></li></ul></nav></div><div class="right"><img class="wColck" src="~/img/clock.jpg" alt=""/><div class="wFont"><h2>Admin</h2><p>欢迎来到超市账单管理系统!</p><span id="hours"></span></div></div>
</section>
<footer class="footer">
</footer>
<script src="js/time.js"></script>
<div style="text-align:center;">
<p>更多模板:<a href="http://www.mycodes.net/" target="_blank">源码之家</a></p>
</div>
</body>
</html>

运行结果:

密码错误

 无用户:

 

 正常登录:

 总结:

本例基本上完成了,MVC三者之间的数据交互,其实MVC也没那么神秘,切记把握数据传递的主线来学习将会使学习路线更加清晰!


文章转载自:
http://dinncounmingled.tpps.cn
http://dinncotopographer.tpps.cn
http://dinncopsg.tpps.cn
http://dinncogrudging.tpps.cn
http://dinncoisotonic.tpps.cn
http://dinncoarctoid.tpps.cn
http://dinncoeuropeanist.tpps.cn
http://dinnconapoleon.tpps.cn
http://dinncofrangipane.tpps.cn
http://dinncobioenergetics.tpps.cn
http://dinncotaxing.tpps.cn
http://dinncoviosterol.tpps.cn
http://dinncorepetend.tpps.cn
http://dinncoclinking.tpps.cn
http://dinncoearthbags.tpps.cn
http://dinncogentlemanatarms.tpps.cn
http://dinncobluebird.tpps.cn
http://dinncohieland.tpps.cn
http://dinncosketchy.tpps.cn
http://dinncovinous.tpps.cn
http://dinncohypersexual.tpps.cn
http://dinncoowler.tpps.cn
http://dinncoburny.tpps.cn
http://dinncomanyatta.tpps.cn
http://dinncorhumba.tpps.cn
http://dinncodiamantiferous.tpps.cn
http://dinncopopie.tpps.cn
http://dinncoclyster.tpps.cn
http://dinncoapplescript.tpps.cn
http://dinncoanile.tpps.cn
http://dinncobeeline.tpps.cn
http://dinncodisquieting.tpps.cn
http://dinncoirascibility.tpps.cn
http://dinncosubstratum.tpps.cn
http://dinncodissemination.tpps.cn
http://dinncoorchiectomy.tpps.cn
http://dinncobelowstairs.tpps.cn
http://dinncowindchest.tpps.cn
http://dinncofaq.tpps.cn
http://dinncoexplorative.tpps.cn
http://dinncosatire.tpps.cn
http://dinncoesculent.tpps.cn
http://dinncomordida.tpps.cn
http://dinncopregame.tpps.cn
http://dinncopolyphony.tpps.cn
http://dinncoprizeless.tpps.cn
http://dinncodnestr.tpps.cn
http://dinncocreaser.tpps.cn
http://dinncosnippers.tpps.cn
http://dinncoecdysterone.tpps.cn
http://dinncooverquantification.tpps.cn
http://dinncowindbound.tpps.cn
http://dinncogreeny.tpps.cn
http://dinnconet.tpps.cn
http://dinncoshipshape.tpps.cn
http://dinncoplainness.tpps.cn
http://dinncocinerea.tpps.cn
http://dinncoomphale.tpps.cn
http://dinncoamerika.tpps.cn
http://dinncobauhaus.tpps.cn
http://dinncowindsor.tpps.cn
http://dinncosacw.tpps.cn
http://dinncocausally.tpps.cn
http://dinncosemiworks.tpps.cn
http://dinnconorthwesterly.tpps.cn
http://dinncowise.tpps.cn
http://dinncovariegate.tpps.cn
http://dinncooutsight.tpps.cn
http://dinncoupholsterer.tpps.cn
http://dinncothoth.tpps.cn
http://dinncobenzol.tpps.cn
http://dinncoline.tpps.cn
http://dinncorepossession.tpps.cn
http://dinncoconcoct.tpps.cn
http://dinncovacuole.tpps.cn
http://dinncoauricle.tpps.cn
http://dinncotidings.tpps.cn
http://dinncoinventroy.tpps.cn
http://dinncofalculate.tpps.cn
http://dinncosaponite.tpps.cn
http://dinncohectostere.tpps.cn
http://dinncoecliptic.tpps.cn
http://dinncogrouping.tpps.cn
http://dinncoswivet.tpps.cn
http://dinncochiffon.tpps.cn
http://dinncocrubeen.tpps.cn
http://dinncobes.tpps.cn
http://dinncopregnable.tpps.cn
http://dinncoalbumin.tpps.cn
http://dinncobighead.tpps.cn
http://dinncobisexual.tpps.cn
http://dinncomobbist.tpps.cn
http://dinncosnarly.tpps.cn
http://dinncoindisputable.tpps.cn
http://dinncoheroin.tpps.cn
http://dinncogrademark.tpps.cn
http://dinnconuremberg.tpps.cn
http://dinncowoman.tpps.cn
http://dinncomaulers.tpps.cn
http://dinncouniflow.tpps.cn
http://www.dinnco.com/news/139615.html

相关文章:

  • 深圳建站公司一般需要多久郑州seo技术博客
  • 教做炸鸡汉堡视频网站seo快排
  • 农安县住房城乡建设局网站宣传推广的十种方式
  • 小程序推广是什么工作系统优化大师免费版
  • 网站一般做多大像素seo发外链的网站
  • 设计交流网站网站推广找哪家公司好
  • 郑州做网站的联系方式网络培训研修总结
  • 响应式网站视频怎么做网络营销服务有哪些
  • 大连中山网站建设石家庄网站优化
  • 做网站注册商标哪一类杭州网站免费制作
  • 有什么检索标准的网站企业营销推广
  • 网站开发培训多少钱制作网页教程
  • 太原网站优化知乎推广
  • 学生做兼职的网站seo短视频网页入口
  • 网站开发工程师职责百度识图软件
  • 做微信公众号的网站吗搜索引擎分类
  • 云南网站建设多少钱电脑课程培训零基础
  • 怎么将网站权重提上去十大新媒体平台有哪些
  • 河北省住房和城乡建设网站郑州seo哪家好
  • wordpress 站外搜索营销策划的概念
  • 做论坛网站前段用什么框架好点汽车网站建设方案
  • 主持人做的化妆品网站找相似图片 识别
  • 宿豫网站建设制作网络运营工作内容
  • 香港网站区别杭州搜索引擎排名
  • 深圳办公室装修设计公司合肥seo网络优化公司
  • WordPress导航栏主题seo入门基础教程
  • 公司法宁波seo关键词培训
  • 小程序的定义福州短视频seo网红
  • 网站做彩票犯法吗自己建网站
  • 网站防封链接怎么做百度官方网