first commit

This commit is contained in:
编码猿
2024-09-27 02:06:13 +08:00
commit 852d94fbb9
36760 changed files with 3274413 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
body {
background: #fff;
}
.top-title {
width: 100%;
height: 4rem;
display: flex;
justify-content: space-around;
align-items: center;
padding: 0 .5rem;
}
.top-title h2{
font-size: .54rem;
padding-left: .4rem;
}

View File

@@ -0,0 +1,67 @@
body {
background: #fff !important;
}
.class-title{
margin-bottom: .42rem;
}
.class-title h2{
font-size: .64rem;
margin-bottom: .2rem;
}
.class-title p{
color: #8d8d8d;
}
.g-view {
padding: 0 .3rem;
}
.cell-item {
box-shadow: 0 0 .12rem #e8e8e8;
}
.class-caipu ul {
display: flex;
flex-wrap: wrap;
}
.class-caipu ul li{
width: 30%;
margin-right: .3rem;
position: relative;
margin-bottom: .3rem;
}
.class-caipu ul li:nth-child(3n){
margin-right: 0;
}
.class-caipu ul li img{
width: 100%;
}
.class-caipu ul li div{
position: absolute;
width: 100%;
height: 2.07rem;
left: 0;
top: 0;
background: rgba(0, 0, 0, 0.28);
}
.class-caipu ul li p{
position: absolute;
z-index: 3;
color: #fff;
left: 50%;
top: 50%;
margin-left: -0.24rem;
margin-top: -0.18rem;
}
.caipu-title {
display: flex;
justify-content: space-between;
height: .68rem;
align-items: center;
}
.caipu-title h3{
font-size: .3rem;
}
.caipu-title span{
font-size: .24rem;
color: #8d8d8d
}

View File

@@ -0,0 +1,3 @@
.m-tabbar.tabbar-fixed {
bottom: -1px;
}

View File

@@ -0,0 +1,52 @@
.m-slider {
width: 95% !important;
margin: .1rem auto;
}
.slider-item {
width: 100% !important;
}
.m-grids-4 .grids-item:not(:nth-child(4n)):before,
.m-grids-2:before, .m-grids-3:before, .m-grids-4:before, .m-grids-5:before {
border: none !important;
}
.grids-icon {
height: auto;
}
.grids-icon img{
width: .9rem;
height: .9rem;
}
.grids-txt {
margin-top: .2rem;
}
.list-theme3 .list-item:nth-child(odd):after,
.list-theme3 .list-item:before {
border: none;
}
.list-cp {
margin-top: .4rem;
}
.list-title {
display: flex;
width: 100%;
justify-content: center;
height: 1rem;
align-items: center;
}
.list-title img{
width: .6rem;
height: .6rem;
}
.list-info {
margin-left: .2rem;
}
.list-info span{
font-size: .36rem;
color: #333;
}
.list-info p{
font-size: .2rem;
color: #999;
line-height: .24rem;
}

View File

@@ -0,0 +1,95 @@
body {
background: #fff;
}
.m-navbar {
background: rgba(255, 255, 255, 0);
position: fixed;
width: 100%;
top: 0;
z-index: 99;
transition: all 1s;
}
.active {
background: rgba(0, 0, 0, 0.41);
}
.g-view:before {
height: 0 !important;
}
.m-navbar:after{
border: none !important;
}
.navbar-center .navbar-title {
color: #fff;
}
.cell-icon:before {
color: #fff !important;
}
.info-top {
width: 100%;
height: 4.5rem;
background: url("../img/info_1.jpg") center /cover no-repeat;
background-size: cover;
}
.top-zhezhao {
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.42);
}
.info-title,
.info-list-item{
padding: .24rem;
}
.info-title{
margin-bottom: .4rem;
}
.info-title h2{
font-size: .48rem;
color: #000;
margin-bottom: .2rem;
}
.info-title p{
font-weight: 300;
color: #666;
text-align: justify;
font-size: .34rem;
color: #333;
line-height: .5rem;
}
.info-list-item {
margin-bottom: .2rem;
}
.info-list-item h2{
height: .72rem;
line-height: .72rem;
font-size: .32rem;
color: #333;
font-weight: 900;
}
.info-list-item p{
color: #333;
font-size: .32rem;
font-weight: 300;
line-height: .48rem;
padding-bottom: .2rem;
}
.step-item h2{
height: .88rem;
line-height: .88rem;
color: #333;
font-size: .38rem;
margin: .6rem 0 .2rem;
text-align: center;
display: block;
font-weight: 500;
}
.step-item p {
font-size: .34rem;
line-height: .5rem;
color: #333;
font-weight: 300;
text-align: justify;
padding: .32rem .4rem;
}
.step-item img {
width: 100%;
}

View File

@@ -0,0 +1,3 @@
.g-view:before {
height: 0;
}

View File

@@ -0,0 +1,44 @@
body {
background: #fff;
}
.view-main,.g-view {
height: 100%;
}
.view-main .view-left {
width: 25%;
height: 100%;
float: left;
border-right: .02rem solid #e8e8e8;
position: fixed;
top: .9rem;
left: 0;
overflow-y: scroll;
}
.view-main .view-right {
width: 75%;
height: 100%;
float: left;
position: fixed;
left: 1.875rem;
top: .9rem;
overflow-y: scroll;
}
.view-main .view-right li{
float: left;
padding: .2rem;
}
.view-right ul{
padding-left: .2rem;
}
.view-main .view-left ul li{
height: .8rem;
line-height: .8rem;
text-align: center;
}
.view-main .view-left ul li:last-child{
margin-bottom: 42px;
}
.active {
color: red;
}

View File

@@ -0,0 +1,14 @@
.g-view:before {
height: 0 !important;
}
.m-navbar:after,
.m-cell:after {
border-bottom: none !important;
}
body {
background: #fff;
}
.cell-input {
background: #f7f7f7;
padding-left: 10px;
}

View File

@@ -0,0 +1,268 @@
@font-face {
font-family:"socialshare";src:url("https://cdnjs.cloudflare.com/ajax/libs/social-share.js/1.0.16/fonts/iconfont.eot");src:url("https://cdnjs.cloudflare.com/ajax/libs/social-share.js/1.0.16/fonts/iconfont.eot?#iefix") format("embedded-opentype"),url("https://cdnjs.cloudflare.com/ajax/libs/social-share.js/1.0.16/fonts/iconfont.woff") format("woff"),url("https://cdnjs.cloudflare.com/ajax/libs/social-share.js/1.0.16/fonts/iconfont.ttf") format("truetype"),url("https://cdnjs.cloudflare.com/ajax/libs/social-share.js/1.0.16/fonts/iconfont.svg#iconfont") format("svg")
}
.social-share {
font-family: "socialshare" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-webkit-text-stroke-width: 0.2px;
-moz-osx-font-smoothing: grayscale
}
.social-share * {
font-family: "socialshare" !important
}
.social-share .icons-tencent:before {
content: "\f07a"
}
.social-share .icons-qq:before {
content: "\f11a"
}
.social-share .icons-weibo:before {
content: "\f12a"
}
.social-share .icons-wechat:before {
content: "\f09a"
}
.social-share .icons-douban:before {
content: "\f10a"
}
.social-share .icons-heart:before {
content: "\f20a"
}
.social-share .icons-like:before {
content: "\f00a"
}
.social-share .icons-qzone:before {
content: "\f08a"
}
.social-share .icons-linkedin:before {
content: "\f01a"
}
.social-share .icons-diandian:before {
content: "\f05a"
}
.social-share .icons-facebook:before {
content: "\f03a"
}
.social-share .icons-google:before {
content: "\f04a"
}
.social-share .icons-twitter:before {
content: "\f06a"
}
.social-share a {
position: relative;
text-decoration: none;
margin: 4px;
display: inline-block;
outline: none
}
.social-share .social-share-icon {
position: relative;
display: inline-block;
width: 32px;
height: 32px;
font-size: 20px;
border-radius: 50%;
line-height: 32px;
border: 1px solid #666;
color: #666;
text-align: center;
vertical-align: middle;
transition: background 0.6s ease-out 0s
}
.social-share .social-share-icon:hover {
background: #666;
color: #fff
}
.social-share .icons-weibo {
color: #ff763b;
border-color: #ff763b
}
.social-share .icons-weibo:hover {
background: #ff763b
}
.social-share .icons-tencent {
color: #56b6e7;
border-color: #56b6e7
}
.social-share .icons-tencent:hover {
background: #56b6e7
}
.social-share .icons-qq {
color: #56b6e7;
border-color: #56b6e7
}
.social-share .icons-qq:hover {
background: #56b6e7
}
.social-share .icons-qzone {
color: #FDBE3D;
border-color: #FDBE3D
}
.social-share .icons-qzone:hover {
background: #FDBE3D
}
.social-share .icons-douban {
color: #33b045;
border-color: #33b045
}
.social-share .icons-douban:hover {
background: #33b045
}
.social-share .icons-linkedin {
color: #0077B5;
border-color: #0077B5
}
.social-share .icons-linkedin:hover {
background: #0077B5
}
.social-share .icons-facebook {
color: #44619D;
border-color: #44619D
}
.social-share .icons-facebook:hover {
background: #44619D
}
.social-share .icons-google {
color: #db4437;
border-color: #db4437
}
.social-share .icons-google:hover {
background: #db4437
}
.social-share .icons-twitter {
color: #55acee;
border-color: #55acee
}
.social-share .icons-twitter:hover {
background: #55acee
}
.social-share .icons-diandian {
color: #307DCA;
border-color: #307DCA
}
.social-share .icons-diandian:hover {
background: #307DCA
}
.social-share .icons-wechat {
position: relative;
color: #7bc549;
border-color: #7bc549
}
.social-share .icons-wechat:hover {
background: #7bc549
}
.social-share .icons-wechat .wechat-qrcode {
display: none;
border: 1px solid #eee;
position: absolute;
z-index: 9;
top: -205px;
left: -84px;
width: 200px;
height: 192px;
color: #666;
font-size: 12px;
text-align: center;
background-color: #fff;
box-shadow: 0 2px 10px #aaa;
transition: all 200ms;
-webkit-tansition: all 350ms;
-moz-transition: all 350ms
}
.social-share .icons-wechat .wechat-qrcode.bottom {
top: 40px;
left: -84px
}
.social-share .icons-wechat .wechat-qrcode.bottom:after {
display: none
}
.social-share .icons-wechat .wechat-qrcode h4 {
font-weight: normal;
height: 26px;
line-height: 26px;
font-size: 12px;
background-color: #f3f3f3;
margin: 0;
padding: 0;
color: #777
}
.social-share .icons-wechat .wechat-qrcode .qrcode {
width: 105px;
margin: 10px auto
}
.social-share .icons-wechat .wechat-qrcode .qrcode table {
margin: 0 !important
}
.social-share .icons-wechat .wechat-qrcode .help p {
font-weight: normal;
line-height: 16px;
padding: 0;
margin: 0
}
.social-share .icons-wechat .wechat-qrcode:after {
content: '';
position: absolute;
left: 50%;
margin-left: -6px;
bottom: -13px;
width: 0;
height: 0;
border-width: 8px 6px 6px 6px;
border-style: solid;
border-color: #fff transparent transparent transparent
}
.social-share .icons-wechat:hover .wechat-qrcode {
display: block
}

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

View File

@@ -0,0 +1,48 @@
// 好处!!
// 1: 使用自执行函数,让函数自己运行
// 2: 使用局部作用域避免变量和方法的污染
(function (){
let lists = classDaras.result;
console.log(lists)
/**
* 1只为了渲染页面
*/
function RenderLeftMenu() {
lists.forEach(function(val,index) {
$(".view-left ul").append(`<li class="${ index == 0 ? 'active':'' }">${val.name}</li>`)
})
}
/**
* 绑定点击事件
*/
function BindClick() {
$(".view-left ul li").on('click',function(){
$(this).addClass('active').siblings().removeClass('active')
RenderRightMenu( $(".view-left ul li").index($(this)) )
})
}
/**
* 渲染右边对应的子分类
* @param {*} id
*/
function RenderRightMenu(id) {
$(".view-right ul").empty();
lists[id].list.forEach(val =>{
$(".view-right ul").append(`<li>
<a href="./list.html?id=${val.id}&status=true">${val.name}</a>
</li>`)
})
}
RenderLeftMenu()
BindClick()
RenderRightMenu(0)
})()

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,31 @@
(function() {
var keyWord = "西红柿"
http({
url: '/query',
type: 'GET',
data: {
keyword: keyWord
}
}, function(res) {
console.log(res)
let result = res.data;
result.forEach(val => {
$('.m-list').append(`<a class="list-item">
<div class="list-img">
<img src="${val.albums[0]}">
</div>
<div class="list-mes">
<h3 class="list-title">${val.title}</h3>
<div class="list-mes-item">
<div>
<span class="list-del-price">${val.tags.substring(0,10)}...</span>
</div>
</div>
</div>
</a>`)
});
})
})()

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,40 @@
(function() {
// getClassInfo
let id = GetQueryString("id")
let status = GetQueryString("status"), url = ""
if(status == "true") {
url = "/getClassInfo"
} else {
url = "/query"
}
http({
url: url,
type: "GET",
data: {
cid: id,
pn: 0
}
}, function(res){
let result = res.data;
result.forEach(val => {
$('.m-list').append(`<a class="list-item">
<div class="list-img">
<img src="${val.albums[0]}">
</div>
<div class="list-mes">
<h3 class="list-title">${val.title}</h3>
<div class="list-mes-item">
<div>
<p>${val.imtro.substring(0,20)}</p>
<span >${val.ingredients}</span>
</div>
</div>
</div>
</a>`)
});
})
})()

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,22 @@
function http(params,cb) {
//return new Promise(function(resolve,reject){
$.ajax({
url: "http://127.0.0.1:3300"+params.url,
type: params.type,
data: params.data,
success: function(res) {
cb(res.result)
}
})
//})
}
function GetQueryString(name) {
var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if(r!=null) return unescape(r[2]); return null;
}

View File

@@ -0,0 +1 @@
!function(t){var e=750,i=t.document,n=i.documentElement,o="orientationchange"in t?"orientationchange":"resize",a=function t(){var i=n.getBoundingClientRect().width;return n.style.fontSize=5*Math.max(Math.min(i/e*20,11.2),8.55)+"px",t}();n.setAttribute("data-dpr",t.navigator.appVersion.match(/iphone/gi)?t.devicePixelRatio:1),/iP(hone|od|ad)/.test(t.navigator.userAgent)&&(i.documentElement.classList.add("ios"),parseInt(t.navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/)[1],10)>=8&&i.documentElement.classList.add("hairline")),i.addEventListener&&(t.addEventListener(o,a,!1),i.addEventListener("DOMContentLoaded",a,!1))}(window);

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,64 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<!-- 引入YDUI样式 -->
<link rel="stylesheet" href="../css/ydui.css" />
<link rel="stylesheet" href="../css/clear.css">
<link rel="stylesheet" href="../css/about.css">
<!-- 引入YDUI自适应解决方案类库 -->
<script src="../js/ydui.flexible.js"></script>
<title>我的</title>
</head>
<body>
<div class="g-view">
<div class="top-title">
<h2>我的美食之旅</h2>
<i class="icon-ucenter-outline" style="font-size: 56px;"></i>
</div>
<div class="m-cell">
<a class="cell-item" href="./like.html">
<div class="cell-left">
我的收藏
</div>
<div class="cell-right">
<i class="cell-icon icon-like-outline"></i>
</div>
</a>
<a class="cell-item" href="javascript:; ">
<div class="cell-left">
意见反馈
</div>
<div class="cell-right">
<i class="cell-icon icon-feedback"></i>
</div>
</a>
</div>
</div>
<footer class="m-tabbar tabbar-fixed">
<a href="./index.html" class="tabbar-item">
<span class="tabbar-icon">
<i class="icon-home"></i>
</span>
<span class="tabbar-txt">首页</span>
</a>
<a href="./class.html" class="tabbar-item">
<span class="tabbar-icon">
<i class="icon-type"></i>
</span>
<span class="tabbar-txt">分类</span>
</a>
<a href="./about.html" class="tabbar-item tabbar-active">
<span class="tabbar-icon">
<i class="icon-ucenter-outline"></i>
</span>
<span class="tabbar-txt">我的</span>
</a>
</footer>
</body>

View File

@@ -0,0 +1,123 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<!-- 引入YDUI样式 -->
<link rel="stylesheet" href="../css/ydui.css" />
<link rel="stylesheet" href="../css/clear.css">
<link rel="stylesheet" href="../css/class.css">
<!-- 引入YDUI自适应解决方案类库 -->
<script src="../js/ydui.flexible.js"></script>
<title>分类</title>
</head>
<body>
<div class="g-view">
<div class="class-title">
<h2>分类</h2>
<p>要吃什么,这里都有!</p>
</div>
<div class="m-cell">
<div class="cell-item">
<div class="cell-left">
<i class="cell-icon icon-search"></i>
</div>
<div class="cell-right">
<input type="text" class="cell-input" placeholder="点这里,做不一样的菜">
</div>
</div>
</div>
<div class="class-caipu">
<div class="caipu-title">
<h3>菜谱分类</h3>
<span>
<a href="./moreclass.html">更多分类</a>
</span>
</div>
<ul>
<li>
<img src="../img/class_shop_1.jpg" alt="">
<div></div>
<p>
<a href="./moreclass.html?id=6">菜肴</a>
</p>
</li>
<li>
<img src="../img/class_shop_1.jpg" alt="">
<div></div>
<p>
<a href="./moreclass.html?id=8">西点</a>
</p>
</li>
<li>
<img src="../img/class_shop_1.jpg" alt="">
<div></div>
<p>
<a href="./moreclass.html?id=5">工艺口味</a>
</p>
</li>
<li>
<img src="../img/class_shop_1.jpg" alt="">
<div></div>
<p>
<a href="./moreclass.html?id=7">主食</a>
</p>
</li>
<li>
<img src="../img/class_shop_1.jpg" alt="">
<div></div>
<p>
<a href="./moreclass.html?id=10">其他菜品</a>
</p>
</li>
<li>
<img src="../img/class_shop_1.jpg" alt="">
<div></div>
<p>
<a href="./moreclass.html?id=11">人群</a>
</p>
</li>
</ul>
</div>
</div>
<footer class="m-tabbar tabbar-fixed">
<a href="./index.html" class="tabbar-item">
<span class="tabbar-icon">
<i class="icon-home"></i>
</span>
<span class="tabbar-txt">首页</span>
</a>
<a href="./class.html" class="tabbar-item tabbar-active">
<span class="tabbar-icon">
<i class="icon-type"></i>
</span>
<span class="tabbar-txt">分类</span>
</a>
<a href="./about.html" class="tabbar-item">
<span class="tabbar-icon">
<i class="icon-ucenter-outline"></i>
</span>
<span class="tabbar-txt">我的</span>
</a>
</footer>
<!-- 引入jQuery 2.0+ -->
<script src="../js/jquery.js"></script>
<!-- 引入YDUI脚本 -->
<script src="../js/ydui.js"></script>
<script src="../js/utils.js"></script>
<script>
Search('.cell-input')
</script>
</body>

View File

@@ -0,0 +1,135 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<!-- 引入YDUI样式 -->
<link rel="stylesheet" href="../css/ydui.css" />
<link rel="stylesheet" href="../css/clear.css">
<link rel="stylesheet" href="../css/index.css">
<!-- 引入YDUI自适应解决方案类库 -->
<script src="../js/ydui.flexible.js"></script>
<title>首页</title>
</head>
<body>
<header class="m-navbar navbar-fixed">
<a href="./about.html" class="navbar-item">
<i class="cell-icon icon-ucenter-outline"></i>
</a>
<div class="navbar-center">
<span class="navbar-title">
舌尖秘籍
</span>
</div>
<a onclick="javascript:location.href='./search.html' " class="navbar-item">
<i class="cell-icon icon-search"></i>
</a>
</header>
<div class="g-view">
<div class="m-slider" id="J_Slider">
<div class="slider-wrapper">
<div class="slider-item">
<a href="#">
<img src="../img/banner_1.jpg">
</a>
</div>
<div class="slider-item">
<a href="#">
<img src="../img/banner_2.jpg">
</a>
</div>
<div class="slider-item">
<a href="#">
<img src="../img/banner_3.png">
</a>
</div>
</div>
<div class="slider-pagination"></div><!-- 分页标识 -->
</div>
<div class="m-grids-4">
<a href="./moreclass.html?id=1" class="grids-item">
<div class="grids-icon">
<img src="../img/class_1.png">
</div>
<div class="grids-txt">
<span>菜系</span>
</div>
</a>
<a href="./moreclass.html?id=9" class="grids-item">
<div class="grids-icon">
<img src="../img/class_2.png">
</div>
<div class="grids-txt">
<span>汤羹饮品</span>
</div>
</a>
<a href="./moreclass.html?id=4" class="grids-item">
<div class="grids-icon">
<img src="../img/class_3.png">
</div>
<div class="grids-txt">
<span>场景</span>
</div>
</a>
<a href="./moreclass.html?id=7" class="grids-item">
<div class="grids-icon">
<img src="../img/class_4.png">
</div>
<div class="grids-txt">
<span>主食</span>
</div>
</a>
</div>
<div class="list-cp">
<div class="list-title">
<img src="../img/home_title_love.png" alt="">
<div class="list-info">
<span>猜你喜欢</span>
<p>21:16为您更新</p>
</div>
</div>
<article class="m-list list-theme3">
</article>
</div>
</div>
<footer class="m-tabbar tabbar-fixed">
<a href="./index.html" class="tabbar-item tabbar-active">
<span class="tabbar-icon">
<i class="icon-home"></i>
</span>
<span class="tabbar-txt">首页</span>
</a>
<a href="./class.html" class="tabbar-item">
<span class="tabbar-icon">
<i class="icon-type"></i>
</span>
<span class="tabbar-txt">分类</span>
</a>
<a href="./about.html" class="tabbar-item">
<span class="tabbar-icon">
<i class="icon-ucenter-outline"></i>
</span>
<span class="tabbar-txt">我的</span>
</a>
</footer>
<!-- 引入jQuery 2.0+ -->
<script src="../js/jquery.js"></script>
<!-- 引入YDUI脚本 -->
<script src="../js/ydui.js"></script>
<script src="../js/utils.js"></script>
<script src="../js/index.js"></script>
<script>
</script>
</body>
</html>

View File

@@ -0,0 +1,98 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<!-- 引入YDUI样式 -->
<link rel="stylesheet" href="../css/share.min.css">
<link rel="stylesheet" href="../css/ydui.css" />
<link rel="stylesheet" href="../css/clear.css">
<link rel="stylesheet" href="../css/info.css">
<!-- 引入YDUI自适应解决方案类库 -->
<script src="../js/ydui.flexible.js"></script>
<title></title>
<style>
.share {
position: fixed;
width: 100%;
height: 60px;
left: 0;
bottom: -60px;
z-index: 999;
background: #fff;
padding-top: 10px;
text-align: center;
}
</style>
</head>
<body>
<header class="m-navbar">
<a href="#" class="navbar-item">
<i class="cell-icon back-ico" onclick="javascript:history.back()"></i>
<i class="cell-icon icon-share2"></i>
</a>
<div class="navbar-center">
<span class="navbar-title">菜品详情</span>
</div>
<div class="navbar-item">
<a href="#">
<i class="like cell-icon icon-star-outline"></i>
</a>
</div>
</header>
<div class="g-view">
<div class="info-top">
<div class="top-zhezhao"></div>
</div>
<div class="info-action">
<div class="info-title">
<h2>香辣豆豉鲫鱼</h2>
<p>以前我们介绍过【午餐肉】、【清蒸猪肉】等常见的罐头口味菜品的烹饪方法,今天我们再介绍一道常见的罐头食品【豆豉鲫鱼】的做法...</p>
</div>
<div class="info-list-item zhu">
<h2>主料</h2>
<p>荷叶饼,6张;韭菜,200g;绿豆芽,200g;肉馅,200g</p>
</div>
<div class="info-list-item fu">
<h2>辅料</h2>
<p>盐,适量;水淀粉,适量</p>
</div>
<div class="info-step">
</div>
</div>
</div>
<div class="share">
<div class="social-share" data-disabled="google,twitter,facebook"></div>
</div>
<!-- 引入jQuery 2.0+ -->
<script src="../js/jquery.js"></script>
<!-- 引入YDUI脚本 -->
<script src="../js/ydui.js"></script>
<script src="../js/utils.js"></script>
<script src="../js/info.js"></script>
<script src="../js/social-share.min.js"></script>
<script>
// jq 监听页面滚动
$(window).scroll(function(){
//获取当前滑动的位置
var scrollTop = $(window).scrollTop();
// 如果大于导航条 45px 时候添加 改变背景色的类名
if(scrollTop > 45){
$(".m-navbar").addClass("active");
}else{ // 否则移除
$(".m-navbar").removeClass("active");
}
})
</script>
</body>
</html>

View File

@@ -0,0 +1,60 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<!-- 引入YDUI样式 -->
<link rel="stylesheet" href="../css/share.min.css">
<link rel="stylesheet" href="../css/ydui.css" />
<link rel="stylesheet" href="../css/clear.css">
<link rel="stylesheet" href="../css/like.css">
<!-- 引入YDUI自适应解决方案类库 -->
<script src="../js/ydui.flexible.js"></script>
<title></title>
</head>
<header class="m-navbar">
<a onclick="javascript:history.back()" class="navbar-item">
<i class="back-ico"></i>
</a>
<div class="navbar-center">
<span class="navbar-title">收藏列表</span>
</div>
</header>
<div class="g-view">
<div class="m-actionsheet" id="J_ActionSheet">
<a href="#" class="actionsheet-item delete">删除该分类</a>
<a href="javascript:;" class="actionsheet-action" id="J_Cancel">取消</a>
</div>
<article class="m-list list-theme4">
</article>
</div>
<!-- 引入jQuery 2.0+ -->
<script src="../js/jquery.js"></script>
<!-- 引入YDUI脚本 -->
<script src="../js/ydui.js"></script>
<script src="../js/utils.js"></script>
<script src="../js/like.js"></script>
<script>
// jq 监听页面滚动
$(window).scroll(function(){
//获取当前滑动的位置
var scrollTop = $(window).scrollTop();
// 如果大于导航条 45px 时候添加 改变背景色的类名
if(scrollTop > 45){
$(".m-navbar").addClass("active");
}else{ // 否则移除
$(".m-navbar").removeClass("active");
}
})
</script>
</body>
</html>

View File

@@ -0,0 +1,45 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<!-- 引入YDUI样式 -->
<link rel="stylesheet" href="../css/ydui.css" />
<link rel="stylesheet" href="../css/clear.css">
<link rel="stylesheet" href="../css/index.css">
<!-- 引入YDUI自适应解决方案类库 -->
<script src="../js/ydui.flexible.js"></script>
<title>菜单列表</title>
</head>
<body>
<header class="m-navbar navbar-fixed">
<a onclick="javascript:history.back()" class="navbar-item">
<i class="cell-icon back-ico"></i>
</a>
<div class="navbar-center">
<span class="navbar-title">菜品列表</span>
</div>
<a onclick="javascript:location.href='./search.html' " class="navbar-item">
<i class="cell-icon icon-search"></i>
</a>
</header>
<div class="g-view">
<article class="m-list list-theme4">
</article>
</div>
<!-- 引入jQuery 2.0+ -->
<script src="../js/jquery.js"></script>
<!-- 引入YDUI脚本 -->
<script src="../js/ydui.js"></script>
<script src="../js/utils.js"></script>
<script src="../js/list.js"></script>
</body>
</html>

View File

@@ -0,0 +1,52 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<!-- 引入YDUI样式 -->
<link rel="stylesheet" href="../css/ydui.css" />
<link rel="stylesheet" href="../css/clear.css">
<link rel="stylesheet" href="../css/moreclass.css">
<!-- 引入YDUI自适应解决方案类库 -->
<script src="../js/ydui.flexible.js"></script>
<title>更多分类</title>
</head>
<body>
<header class="m-navbar navbar-fixed">
<a onclick="javascript:history.back()" class="navbar-item">
<i class="cell-icon back-ico"></i>
</a>
<div class="navbar-center">
<span class="navbar-title">分类</span>
</div>
<a onclick="javascript:location.href='./search.html' " class="navbar-item">
<i class="cell-icon icon-search"></i>
</a>
</header>
<div class="g-view">
<div class="view-main">
<div class="view-left">
<ul>
</ul>
</div>
<div class="view-right">
<ul>
</ul>
</div>
</div>
</div>
<!-- 引入jQuery 2.0+ -->
<script src="../js/jquery.js"></script>
<!-- 引入YDUI脚本 -->
<script src="../js/ydui.js"></script>
<script src="../js/classData.js"></script>
<script src="../js/class.js"></script>
<body

View File

@@ -0,0 +1,51 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<!-- 引入YDUI样式 -->
<link rel="stylesheet" href="../css/ydui.css" />
<link rel="stylesheet" href="../css/clear.css">
<link rel="stylesheet" href="../css/search.css">
<!-- 引入YDUI自适应解决方案类库 -->
<script src="../js/ydui.flexible.js"></script>
<title>搜索</title>
</head>
<body>
<header class="m-navbar">
<a onclick="javascript:history.back()" class="navbar-item">
<i class="back-ico"></i>
</a>
<div class="navbar-center">
<span class="navbar-title">搜索</span>
</div>
</header>
<div class="g-view">
<div class="m-cell">
<div class="cell-item">
<div class="cell-left">
<i class="cell-icon icon-search"></i>
</div>
<div class="cell-right">
<input type="text" class="cell-input searchKey" placeholder="点这里,做不一样的菜">
</div>
</div>
</div>
</div>
<!-- 引入jQuery 2.0+ -->
<script src="../js/jquery.js"></script>
<!-- 引入YDUI脚本 -->
<script src="../js/ydui.js"></script>
<script src="../js/utils.js"></script>
<script>
Search('.searchKey')
</script>
</body>
</html>

View File

@@ -0,0 +1,12 @@
{
"presets": [
["env", {
"modules": false,
"targets": {
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
}
}],
"stage-2"
],
"plugins": ["transform-vue-jsx", "transform-runtime"]
}

View File

@@ -0,0 +1,9 @@
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

View File

@@ -0,0 +1,14 @@
.DS_Store
node_modules/
/dist/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln

View File

@@ -0,0 +1,10 @@
// https://github.com/michael-ciniawsky/postcss-load-config
module.exports = {
"plugins": {
"postcss-import": {},
"postcss-url": {},
// to edit target browsers: use "browserslist" field in package.json
"autoprefixer": {}
}
}

View File

@@ -0,0 +1,22 @@
### 任务
1继续实现欢迎页 实现
2实现首页两种考试 实现
3集成封装vuex
4实现考试 实现
----
1实现 区别科目一和科目四的分数统计
2实现 答完题目的时候(id >= 99) 给用户答完题目的提示,记录用户错题(下标id)
3实现 选完题目答案后,不允许在勾选答案
----
4: 实现登录注册,用的错题存储到数据库,收藏也放数据库
5: 保存聚合接口资讯的新闻数据,驾考宝典买车数据

View File

@@ -0,0 +1,41 @@
'use strict'
require('./check-versions')()
process.env.NODE_ENV = 'production'
const ora = require('ora')
const rm = require('rimraf')
const path = require('path')
const chalk = require('chalk')
const webpack = require('webpack')
const config = require('../config')
const webpackConfig = require('./webpack.prod.conf')
const spinner = ora('building for production...')
spinner.start()
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
if (err) throw err
webpack(webpackConfig, (err, stats) => {
spinner.stop()
if (err) throw err
process.stdout.write(stats.toString({
colors: true,
modules: false,
children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
chunks: false,
chunkModules: false
}) + '\n\n')
if (stats.hasErrors()) {
console.log(chalk.red(' Build failed with errors.\n'))
process.exit(1)
}
console.log(chalk.cyan(' Build complete.\n'))
console.log(chalk.yellow(
' Tip: built files are meant to be served over an HTTP server.\n' +
' Opening index.html over file:// won\'t work.\n'
))
})
})

View File

@@ -0,0 +1,54 @@
'use strict'
const chalk = require('chalk')
const semver = require('semver')
const packageConfig = require('../package.json')
const shell = require('shelljs')
function exec (cmd) {
return require('child_process').execSync(cmd).toString().trim()
}
const versionRequirements = [
{
name: 'node',
currentVersion: semver.clean(process.version),
versionRequirement: packageConfig.engines.node
}
]
if (shell.which('npm')) {
versionRequirements.push({
name: 'npm',
currentVersion: exec('npm --version'),
versionRequirement: packageConfig.engines.npm
})
}
module.exports = function () {
const warnings = []
for (let i = 0; i < versionRequirements.length; i++) {
const mod = versionRequirements[i]
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
warnings.push(mod.name + ': ' +
chalk.red(mod.currentVersion) + ' should be ' +
chalk.green(mod.versionRequirement)
)
}
}
if (warnings.length) {
console.log('')
console.log(chalk.yellow('To use this template, you must update following to modules:'))
console.log()
for (let i = 0; i < warnings.length; i++) {
const warning = warnings[i]
console.log(' ' + warning)
}
console.log()
process.exit(1)
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@@ -0,0 +1,101 @@
'use strict'
const path = require('path')
const config = require('../config')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const packageConfig = require('../package.json')
exports.assetsPath = function (_path) {
const assetsSubDirectory = process.env.NODE_ENV === 'production'
? config.build.assetsSubDirectory
: config.dev.assetsSubDirectory
return path.posix.join(assetsSubDirectory, _path)
}
exports.cssLoaders = function (options) {
options = options || {}
const cssLoader = {
loader: 'css-loader',
options: {
sourceMap: options.sourceMap
}
}
const postcssLoader = {
loader: 'postcss-loader',
options: {
sourceMap: options.sourceMap
}
}
// generate loader string to be used with extract text plugin
function generateLoaders (loader, loaderOptions) {
const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]
if (loader) {
loaders.push({
loader: loader + '-loader',
options: Object.assign({}, loaderOptions, {
sourceMap: options.sourceMap
})
})
}
// Extract CSS when that option is specified
// (which is the case during production build)
if (options.extract) {
return ExtractTextPlugin.extract({
use: loaders,
fallback: 'vue-style-loader'
})
} else {
return ['vue-style-loader'].concat(loaders)
}
}
// https://vue-loader.vuejs.org/en/configurations/extract-css.html
return {
css: generateLoaders(),
postcss: generateLoaders(),
less: generateLoaders('less'),
sass: generateLoaders('sass', { indentedSyntax: true }),
scss: generateLoaders('sass'),
stylus: generateLoaders('stylus'),
styl: generateLoaders('stylus')
}
}
// Generate loaders for standalone style files (outside of .vue)
exports.styleLoaders = function (options) {
const output = []
const loaders = exports.cssLoaders(options)
for (const extension in loaders) {
const loader = loaders[extension]
output.push({
test: new RegExp('\\.' + extension + '$'),
use: loader
})
}
return output
}
exports.createNotifierCallback = () => {
const notifier = require('node-notifier')
return (severity, errors) => {
if (severity !== 'error') return
const error = errors[0]
const filename = error.file && error.file.split('!').pop()
notifier.notify({
title: packageConfig.name,
message: severity + ': ' + error.name,
subtitle: filename || '',
icon: path.join(__dirname, 'logo.png')
})
}
}

View File

@@ -0,0 +1,22 @@
'use strict'
const utils = require('./utils')
const config = require('../config')
const isProduction = process.env.NODE_ENV === 'production'
const sourceMapEnabled = isProduction
? config.build.productionSourceMap
: config.dev.cssSourceMap
module.exports = {
loaders: utils.cssLoaders({
sourceMap: sourceMapEnabled,
extract: isProduction
}),
cssSourceMap: sourceMapEnabled,
cacheBusting: config.dev.cacheBusting,
transformToRequire: {
video: ['src', 'poster'],
source: 'src',
img: 'src',
image: 'xlink:href'
}
}

View File

@@ -0,0 +1,99 @@
'use strict'
const path = require('path')
const utils = require('./utils')
const config = require('../config')
const vueLoaderConfig = require('./vue-loader.conf')
function resolve (dir) {
return path.join(__dirname, '..', dir)
}
// const createLintingRule = () => ({
// test: /\.(js)$/,
// loader: 'eslint-loader',
// enforce: 'pre',
// include: [resolve('src'), resolve('test')],
// options: {
// formatter: require('eslint-friendly-formatter'),
// emitWarning: !config.dev.showEslintErrorsInOverlay
// }
// })
module.exports = {
context: path.resolve(__dirname, '../'),
entry: {
app: './src/main.js'
},
output: {
path: config.build.assetsRoot,
filename: '[name].js',
publicPath: process.env.NODE_ENV === 'production'
? config.build.assetsPublicPath
: config.dev.assetsPublicPath
},
resolve: {
extensions: ['.js', '.vue', '.json'],
alias: {
'vue$': 'vue/dist/vue.esm.js',
'@': resolve('src'),
}
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader',
options: vueLoaderConfig
},
{
test: /\.js$/,
loader: 'babel-loader',
include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
},
{
test: /\.pug$/,
loader: 'pug'
},
{
test: /\.less$/,
loader: "style-loader!css-loader!less-loader"
},
{
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('img/[name].[hash:7].[ext]')
}
},
{
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('media/[name].[hash:7].[ext]')
}
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
}
}
]
},
node: {
// prevent webpack from injecting useless setImmediate polyfill because Vue
// source contains it (although only uses it if it's native).
setImmediate: false,
// prevent webpack from injecting mocks to Node native modules
// that does not make sense for the client
dgram: 'empty',
fs: 'empty',
net: 'empty',
tls: 'empty',
child_process: 'empty'
}
}

View File

@@ -0,0 +1,96 @@
'use strict'
const utils = require('./utils')
const webpack = require('webpack')
const config = require('../config')
const merge = require('webpack-merge')
const path = require('path')
const baseWebpackConfig = require('./webpack.base.conf')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
const portfinder = require('portfinder')
const HOST = process.env.HOST
const PORT = process.env.PORT && Number(process.env.PORT)
const devWebpackConfig = merge(baseWebpackConfig, {
module: {
rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true })
},
// cheap-module-eval-source-map is faster for development
devtool: config.dev.devtool,
// these devServer options should be customized in /config/index.js
devServer: {
clientLogLevel: 'warning',
historyApiFallback: {
rewrites: [
{ from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') },
],
},
hot: true,
contentBase: false, // since we use CopyWebpackPlugin.
compress: true,
host: HOST || config.dev.host,
port: PORT || config.dev.port,
open: config.dev.autoOpenBrowser,
overlay: config.dev.errorOverlay
? { warnings: false, errors: true }
: false,
publicPath: config.dev.assetsPublicPath,
proxy: config.dev.proxyTable,
quiet: true, // necessary for FriendlyErrorsPlugin
watchOptions: {
poll: config.dev.poll,
}
},
plugins: [
new webpack.DefinePlugin({
'process.env': require('../config/dev.env')
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update.
new webpack.NoEmitOnErrorsPlugin(),
// https://github.com/ampedandwired/html-webpack-plugin
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'index.html',
inject: true
}),
// copy custom static assets
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, '../static'),
to: config.dev.assetsSubDirectory,
ignore: ['.*']
}
])
]
})
module.exports = new Promise((resolve, reject) => {
portfinder.basePort = process.env.PORT || config.dev.port
portfinder.getPort((err, port) => {
if (err) {
reject(err)
} else {
// publish the new Port, necessary for e2e tests
process.env.PORT = port
// add port to devServer config
devWebpackConfig.devServer.port = port
// Add FriendlyErrorsPlugin
devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({
compilationSuccessInfo: {
messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`],
},
onErrors: config.dev.notifyOnErrors
? utils.createNotifierCallback()
: undefined
}))
resolve(devWebpackConfig)
}
})
})

View File

@@ -0,0 +1,145 @@
'use strict'
const path = require('path')
const utils = require('./utils')
const webpack = require('webpack')
const config = require('../config')
const merge = require('webpack-merge')
const baseWebpackConfig = require('./webpack.base.conf')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
const env = require('../config/prod.env')
const webpackConfig = merge(baseWebpackConfig, {
module: {
rules: utils.styleLoaders({
sourceMap: config.build.productionSourceMap,
extract: true,
usePostCSS: true
})
},
devtool: config.build.productionSourceMap ? config.build.devtool : false,
output: {
path: config.build.assetsRoot,
filename: utils.assetsPath('js/[name].[chunkhash].js'),
chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
},
plugins: [
// http://vuejs.github.io/vue-loader/en/workflow/production.html
new webpack.DefinePlugin({
'process.env': env
}),
new UglifyJsPlugin({
uglifyOptions: {
compress: {
warnings: false
}
},
sourceMap: config.build.productionSourceMap,
parallel: true
}),
// extract css into its own file
new ExtractTextPlugin({
filename: utils.assetsPath('css/[name].[contenthash].css'),
// Setting the following option to `false` will not extract CSS from codesplit chunks.
// Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
// It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`,
// increasing file size: https://github.com/vuejs-templates/webpack/issues/1110
allChunks: true,
}),
// Compress extracted CSS. We are using this plugin so that possible
// duplicated CSS from different components can be deduped.
new OptimizeCSSPlugin({
cssProcessorOptions: config.build.productionSourceMap
? { safe: true, map: { inline: false } }
: { safe: true }
}),
// generate dist index.html with correct asset hash for caching.
// you can customize output by editing /index.html
// see https://github.com/ampedandwired/html-webpack-plugin
new HtmlWebpackPlugin({
filename: config.build.index,
template: 'index.html',
inject: true,
minify: {
removeComments: true,
collapseWhitespace: true,
removeAttributeQuotes: true
// more options:
// https://github.com/kangax/html-minifier#options-quick-reference
},
// necessary to consistently work with multiple chunks via CommonsChunkPlugin
chunksSortMode: 'dependency'
}),
// keep module.id stable when vendor modules does not change
new webpack.HashedModuleIdsPlugin(),
// enable scope hoisting
new webpack.optimize.ModuleConcatenationPlugin(),
// split vendor js into its own file
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks (module) {
// any required modules inside node_modules are extracted to vendor
return (
module.resource &&
/\.js$/.test(module.resource) &&
module.resource.indexOf(
path.join(__dirname, '../node_modules')
) === 0
)
}
}),
// extract webpack runtime and module manifest to its own file in order to
// prevent vendor hash from being updated whenever app bundle is updated
new webpack.optimize.CommonsChunkPlugin({
name: 'manifest',
minChunks: Infinity
}),
// This instance extracts shared chunks from code splitted chunks and bundles them
// in a separate chunk, similar to the vendor chunk
// see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk
new webpack.optimize.CommonsChunkPlugin({
name: 'app',
async: 'vendor-async',
children: true,
minChunks: 3
}),
// copy custom static assets
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, '../static'),
to: config.build.assetsSubDirectory,
ignore: ['.*']
}
])
]
})
if (config.build.productionGzip) {
const CompressionWebpackPlugin = require('compression-webpack-plugin')
webpackConfig.plugins.push(
new CompressionWebpackPlugin({
asset: '[path].gz[query]',
algorithm: 'gzip',
test: new RegExp(
'\\.(' +
config.build.productionGzipExtensions.join('|') +
')$'
),
threshold: 10240,
minRatio: 0.8
})
)
}
if (config.build.bundleAnalyzerReport) {
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
webpackConfig.plugins.push(new BundleAnalyzerPlugin())
}
module.exports = webpackConfig

View File

@@ -0,0 +1,7 @@
'use strict'
const merge = require('webpack-merge')
const prodEnv = require('./prod.env')
module.exports = merge(prodEnv, {
NODE_ENV: '"development"'
})

View File

@@ -0,0 +1,76 @@
'use strict'
// Template version: 1.3.1
// see http://vuejs-templates.github.io/webpack for documentation.
const path = require('path')
module.exports = {
dev: {
// Paths
assetsSubDirectory: 'static',
assetsPublicPath: '/',
proxyTable: {},
// Various Dev Server settings
host: 'localhost', // can be overwritten by process.env.HOST
port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
autoOpenBrowser: false,
errorOverlay: true,
notifyOnErrors: true,
poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
// Use Eslint Loader?
// If true, your code will be linted during bundling and
// linting errors and warnings will be shown in the console.
useEslint: true,
// If true, eslint errors and warnings will also be shown in the error overlay
// in the browser.
showEslintErrorsInOverlay: false,
/**
* Source Maps
*/
// https://webpack.js.org/configuration/devtool/#development
devtool: 'cheap-module-eval-source-map',
// If you have problems debugging vue-files in devtools,
// set this to false - it *may* help
// https://vue-loader.vuejs.org/en/options.html#cachebusting
cacheBusting: true,
cssSourceMap: true
},
build: {
// Template for index.html
index: path.resolve(__dirname, '../dist/index.html'),
// Paths
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
assetsPublicPath: '/',
/**
* Source Maps
*/
productionSourceMap: true,
// https://webpack.js.org/configuration/devtool/#production
devtool: '#source-map',
// Gzip off by default as many popular static hosts such as
// Surge or Netlify already gzip all static assets for you.
// Before setting to `true`, make sure to:
// npm install --save-dev compression-webpack-plugin
productionGzip: false,
productionGzipExtensions: ['js', 'css'],
// Run the build command with an extra argument to
// View the bundle analyzer report after build finishes:
// `npm run build --report`
// Set to `true` or `false` to always turn it on or off
bundleAnalyzerReport: process.env.npm_config_report
}
}

View File

@@ -0,0 +1,4 @@
'use strict'
module.exports = {
NODE_ENV: '"production"'
}

View File

@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>fontend</title>
<script src="//at.alicdn.com/t/font_1275451_5ffjq6sqcn5.js"></script>
</head>
<body>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>

View File

@@ -0,0 +1,84 @@
{
"name": "fontend",
"version": "1.0.0",
"description": "A Vue.js project",
"author": "bmy <2271608011@qq.com>",
"private": true,
"scripts": {
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
"start": "npm run dev",
"lint": "eslint --ext .js,.vue src",
"build": "node build/build.js",
"back": "node-dev service.js"
},
"dependencies": {
"axios": "^0.19.0",
"vant": "^2.0.3",
"vue": "^2.5.2",
"vue-awesome-swiper": "^3.1.3",
"vue-router": "^3.0.1"
},
"devDependencies": {
"autoprefixer": "^7.1.2",
"babel-core": "^6.22.1",
"babel-eslint": "^8.2.1",
"babel-helper-vue-jsx-merge-props": "^2.0.3",
"babel-loader": "^7.1.1",
"babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-plugin-transform-vue-jsx": "^3.5.0",
"babel-preset-env": "^1.3.2",
"babel-preset-stage-2": "^6.22.0",
"chalk": "^2.0.1",
"copy-webpack-plugin": "^4.0.1",
"css-loader": "^0.28.0",
"eslint": "^4.15.0",
"eslint-config-standard": "^10.2.1",
"eslint-friendly-formatter": "^3.0.0",
"eslint-loader": "^1.7.1",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-node": "^5.2.0",
"eslint-plugin-promise": "^3.4.0",
"eslint-plugin-standard": "^3.0.1",
"eslint-plugin-vue": "^4.0.0",
"express": "^4.17.1",
"extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^1.1.4",
"friendly-errors-webpack-plugin": "^1.6.1",
"html-webpack-plugin": "^2.30.1",
"less": "^3.9.0",
"less-loader": "^5.0.0",
"node-notifier": "^5.1.2",
"optimize-css-assets-webpack-plugin": "^3.2.0",
"ora": "^1.2.0",
"portfinder": "^1.0.13",
"postcss-import": "^11.0.0",
"postcss-loader": "^2.0.8",
"postcss-url": "^7.2.1",
"pug": "^2.0.4",
"pug-filters": "^3.1.1",
"pug-loader": "^2.4.0",
"request": "^2.88.0",
"rimraf": "^2.6.0",
"semver": "^5.3.0",
"shelljs": "^0.7.6",
"uglifyjs-webpack-plugin": "^1.1.1",
"url-loader": "^0.5.8",
"vue-loader": "^13.3.0",
"vue-style-loader": "^3.0.1",
"vue-template-compiler": "^2.5.2",
"webpack": "^3.6.0",
"webpack-bundle-analyzer": "^2.9.0",
"webpack-dev-server": "^2.9.1",
"webpack-merge": "^4.1.0"
},
"engines": {
"node": ">= 6.0.0",
"npm": ">= 3.0.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}

View File

@@ -0,0 +1,46 @@
var createError = require('http-errors');
var express = require('express');
var path = require('path');
var cookieParser = require('cookie-parser');
var logger = require('morgan');
var indexRouter = require('./routes/index');
var userRouter = require('./routes/user');
var app = express();
app.all('*', function (req, res, next) {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Headers', 'Content-Type');
res.header('Access-Control-Allow-Methods', '*');
res.header('Content-Type', 'application/json;charset=utf-8');
next();
});
// view engine setup
app.use(logger('dev'));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use('/', indexRouter);
app.use('/user',userRouter);
// catch 404 and forward to error handler
app.use(function(req, res, next) {
next(createError(404));
});
// error handler
app.use(function(err, req, res, next) {
// set locals, only providing error in development
res.locals.message = err.message;
res.locals.error = req.app.get('env') === 'development' ? err : {};
// render the error page
res.status(err.status || 500);
//res.render('error');
});
module.exports = app;

View File

@@ -0,0 +1,90 @@
#!/usr/bin/env node
/**
* Module dependencies.
*/
var app = require('../app');
var debug = require('debug')('service:server');
var http = require('http');
/**
* Get port from environment and store in Express.
*/
var port = normalizePort(process.env.PORT || '3000');
app.set('port', port);
/**
* Create HTTP server.
*/
var server = http.createServer(app);
/**
* Listen on provided port, on all network interfaces.
*/
server.listen(port);
server.on('error', onError);
server.on('listening', onListening);
/**
* Normalize a port into a number, string, or false.
*/
function normalizePort(val) {
var port = parseInt(val, 10);
if (isNaN(port)) {
// named pipe
return val;
}
if (port >= 0) {
// port number
return port;
}
return false;
}
/**
* Event listener for HTTP server "error" event.
*/
function onError(error) {
if (error.syscall !== 'listen') {
throw error;
}
var bind = typeof port === 'string'
? 'Pipe ' + port
: 'Port ' + port;
// handle specific listen errors with friendly messages
switch (error.code) {
case 'EACCES':
console.error(bind + ' requires elevated privileges');
process.exit(1);
break;
case 'EADDRINUSE':
console.error(bind + ' is already in use');
process.exit(1);
break;
default:
throw error;
}
}
/**
* Event listener for HTTP server "listening" event.
*/
function onListening() {
var addr = server.address();
var bind = typeof addr === 'string'
? 'pipe ' + addr
: 'port ' + addr.port;
debug('Listening on ' + bind);
}

View File

@@ -0,0 +1,13 @@
module.exports = {
Mysql: {
host : 'localhost',
user : 'root',
password : 'lb714500',
database : 'jiazhao'
},
sql : {
userReg: 'INSERT INTO user(name,pwd,phone) VALUES (?,?,?)',
userLogin: 'SELECT id,name,phone from user where name = ? and pwd = ?'
}
}
//配置数据库

View File

@@ -0,0 +1,17 @@
var mysql = require('mysql');
var config = require("../config");
class db {
constructor() {
this.connection = mysql.createConnection(config.Mysql);
this.connection.connect();
}
get (sql,params = [],callback) {
this.connection.query(sql, params , function (error, results, fields) {
callback(results)
});
}
}
module.exports = new db()

View File

@@ -0,0 +1,19 @@
{
"name": "service",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node-dev ./bin/www"
},
"dependencies": {
"cookie-parser": "~1.4.4",
"debug": "~2.6.9",
"express": "~4.16.1",
"http-errors": "~1.6.3",
"jade": "~1.11.0",
"md5": "^2.2.1",
"morgan": "~1.9.1",
"mysql": "^2.17.1",
"request": "^2.88.0"
}
}

View File

@@ -0,0 +1,24 @@
const express = require('express')
const request = require('request')
const db = require('../db')
var router = express.Router()
const BaseUrl = {
url: 'http://v.juhe.cn/jztk/',
appkey: '3ef9907395c9fd05055190f6dcef21aa'
}
router.get('/query', (req, res) => {
let subject = req.query.subject;
let model = req.query.model;
let testType = req.query.testType;
request(`${BaseUrl.url}query?subject=${subject}&model=${model}&key=${BaseUrl.appkey}&testType=${testType}`, function (error, response, body) {
res.json(JSON.parse(body));
});
});
module.exports = router
//service接口配置

View File

@@ -0,0 +1,48 @@
const express = require('express')
const db = require('../db')
const config = require('../config')
const md5 = require('md5');
var router = express.Router()
router.get('/login', (req, res) => {
var name = req.query.name
var pwd = md5(req.query.pwd)
console.log("result: ", name,pwd)
db.get(config.sql.userLogin, [ name, pwd ] ,function(result) {
console.log("result: ", result)
result.length == 0 ? result = {
status: 404,
message: '该用户未注册',
data: null
} : result = {
status: 200,
message: null,
data: result
}
res.json(result)
})
});
router.get('/reg', (req, res) => {
var name = req.query.name
var pwd = md5(req.query.pwd)
var phone = req.query.phone
db.get(config.sql.userReg, [ name,pwd,phone ] ,function(result) {
console.log("result: ", result)
result.length == 0 ? result = {
status: 404,
message: '注册失败',
data: null
} : result = {
status: 200,
message: null,
data: result
}
res.json(result)
})
});
module.exports = router

View File

@@ -0,0 +1,44 @@
<template lang="pug">
#app
v-navbar(v-if="isShowNavbar" :title="NavBarTitle")
div(:class=" isHaveContent ? 'content': 'welcome' ")
router-view
v-tabbar(v-if="isShowTabbar" @getTitle="SetTitle")
</template>
<script>
import NavBar from "./components/tpl/NavBar"
import TabBar from "./components/tpl/Tabbar"
export default {
data() {
return {
isHaveContent: true,
isShowNavbar: true,
isShowTabbar: true,
NavBarTitle: '驾考神器'
}
},
methods: {
SetTitle (tit) {
this.NavBarTitle = tit
}
},
components: {
'v-navbar' : NavBar,
'v-tabbar' : TabBar
}
}
</script>
<style>
@import "./assets/less/lib/normalize.less";
.content {
margin-top: 46px;
overflow: scroll;
padding-bottom: 50px;
}
.van-radio__label--disabled {
color: #4c4c4c;
}
</style>

View File

@@ -0,0 +1,24 @@
import axios from "axios";
axios.defaults.baseURL = 'http://127.0.0.1:3000';
export default {
get (options) {
return new Promise(function(resolve,reject) {
axios.get(options.url, {
params: options.data
})
.then(function (response) {
resolve(response.data);
})
.catch(function (error) {
reject(error);
});
});
},
post () {
}
}

View File

@@ -0,0 +1,8 @@
import index from "./server/index"
import user from "./server/user"
export default {
index: index,
user: user
}

View File

@@ -0,0 +1,8 @@
import http from "../index"
import config from "../../config"
export default {
async getQuery(params) {
return await http.get({ url: config.httpApi.query, data: params });
}
}

View File

@@ -0,0 +1,11 @@
import http from "../index"
import config from "../../config"
export default {
async Login(params) {
return await http.get({ url: config.httpApi.login, data: params });
},
async Reg(params) {
return await http.get({ url: config.httpApi.reg, data: params });
}
}

View File

@@ -0,0 +1,7 @@
.exam {
img {
width: 80%;
margin: 10px auto;
display: block;
}
}

View File

@@ -0,0 +1,5 @@
@import "../lib/index.less";
.index {
}

View File

@@ -0,0 +1,65 @@
@import "../lib/index.less";
.ipage {
.adv {
width: 100%;
}
.list {
display: flex;
justify-content: space-around;
height: 80px;
background: @item;
.list-item {
display: flex;
align-items: center;
justify-content: space-evenly;
width: 50%;
.item-text {
h3 {
color: #333;
font-size: 14px;
margin-bottom: 10px;
}
p {
color: #999;
font-size: 12px;
}
}
img {
width: 35px;
height: 35px;
}
}
}
.gird-list {
padding: 15px 0;
margin-top: 10px;
position: relative;
background: @item;
ul {
display: flex;
justify-content: space-around;
li {
text-align: center;
&:nth-child(3) .icon,
&:nth-child(4) .icon {
width: 0.8em !important;
height: 0.8em !important;
margin-bottom: 7px;
}
.icon {
font-size: 38px;
}
p {
font-size: 14px;
color: #333;
}
}
}
}
.news-list{
background: @item;
margin-top: 10px;
}
}

View File

@@ -0,0 +1,104 @@
@import "../lib/index.less";
.base_page (@color:#fff) {
width: 100%;
height: 80%;
background-color: @color;
display: flex;
justify-content: center;
align-items: center;
}
.base_bottom_page(@color) {
width: 100%;
height: 20%;
text-align: center;
color: @color;
}
.welcome {
.active {
background: #f6f6f6;
}
width: 100%;height: 100%;
.swiper-slide{
width: 100%;
height: 100%;
}
.swiper-slide {
.welpage {
width: 100%;
height: 100%;
.pageimg1{
.base_page(@welcomeBgcolor1)
}
.pageimg2{
.base_page(@welcomeBgcolor2)
}
.pageimg3{
.base_page(@welcomeBgcolor3)
}
.pageimg4 {
.base_page();
flex-direction: column;
h2 {
}
.infos {
}
ul {
margin-top: 20px;
display: flex;
li {
text-align: center;
padding: 0 10px;
img {
}
p {
}
.jztype {
color: #a7a5a5;
padding-top: 0;
}
}
}
}
}
img {
width: 50%;
}
.welpage {
p{
// padding-top: 1rem;
// font-size: .875rem
}
span{
font-size: .625rem
}
.title1{
.base_bottom_page(@welcomeBgcolor1)
}
.title2{
.base_bottom_page(@welcomeBgcolor2)
}
.title3{
.base_bottom_page(@welcomeBgcolor3)
}
button{
width: 3.25rem;
height: 1.5rem;
background-color: @welcomeBgcolor3;
font-size: .75rem;
color: #fff;
border: none;
display: block;
margin: 0 auto;
margin-top: 1rem;
}
}
}
}
.swiper-container{
width: 100%;
height: 100%;
}

View File

@@ -0,0 +1,5 @@
@color: red;
@welcomeBgcolor1: #5eadef;
@welcomeBgcolor2: #bfeafa;
@welcomeBgcolor3: #ffd33f;
@item: #fff;

View File

@@ -0,0 +1,3 @@
@import "normalize.less";
@import "color.less";
@import "mixins.less";

View File

@@ -0,0 +1,9 @@
.bottom-line::after {
content: " ";
position: absolute;
bottom: 0;
width: 100%;
height: 1px;
background: #ebedf0;
transform: scaleY(0.5);
}

View File

@@ -0,0 +1,21 @@
body, ul,li,h1,h2,h3,h4,h5,h6,p {
margin: 0;
padding: 0;
}
html,body,#app, .content,.welcome {
height: 100%;
}
body {
background: #f5f5f5;
}
.icon {
width: 1em;
height: 1em;
vertical-align: -0.15em;
fill: currentColor;
overflow: hidden;
}
.van-nav-bar--fixed {
z-index: 9999 !important;
}

View File

@@ -0,0 +1,24 @@
<template lang="pug">
.navbar
van-nav-bar(:title='title' :border="false" :fixed="true")
van-icon(name="friends-o" slot="left")
</template>
<script>
export default {
props: {
title: null
},
data() {
return {
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,34 @@
<template lang="pug">
.tabbar
van-tabbar(v-model='active')
van-tabbar-item(:icon='item.icon'
:to="item.path"
@click="changeTitle(item.name)"
v-for="(item,index) in items" :key="index") {{item.name}}
</template>
<script>
export default {
data() {
return {
active: 0,
items: [
{ icon: 'logistics', path: '/index', name: '驾考' },
{ icon: 'paid', path: '/car', name: '买车' },
{ icon: 'chart-trending-o', path: '/message', name: '资讯' },
{ icon: 'friends-o', path: '/my', name: '我的' }
]
}
},
methods: {
changeTitle (title) {
title == "驾考" ? title = "驾考神器" : title;
this.$emit("getTitle", title)
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,73 @@
<template lang="pug">
.ipage
a(:href="imgurl.href")
img.adv(:src="imgurl.url")
.list
.list-item(@click="startExam('rand')")
.item-text
h3 模拟考试
p 练习和模拟考试
img(src="../../../static/img/item-1.png")
.list-item(@click="startExam('order')")
.item-text
h3 驾考题库
p 按章节练习
img(src="../../../static/img/item-2.png")
.gird-list.bottom-line
ul
li
svg.icon(aria-hidden='true')
use(xlink:href='#icon-che')
p 找车
li
svg.icon(aria-hidden='true')
use(xlink:href='#icon-luntanzixun')
p 咨询
li
svg.icon(aria-hidden='true')
use(xlink:href='#icon-errorList')
p 错题
li
svg.icon(aria-hidden='true')
use(xlink:href='#icon-shoucang')
p 收藏
.news-list
van-card(num="2"
v-for="item in 10" :key="item"
price="2.00"
desc="描述信息"
title="商品标题"
thumb="https://img.yzcdn.cn/vant/t-thirt.jpg")
</template>
<script>
export default {
props: {
list: null,
imgurl: {
href: null,
url: null
},
subject: null
},
data () {
return {
}
},
created() {
console.log(this.subject)
},
methods: {
startExam (types) {
this.$router.push({ name: 'exam', params: { type: types, subject: this.subject } })
}
}
}
</script>
<style lang="less" scoped>
@import "../../assets/less/components/ipage.less";
</style>

View File

@@ -0,0 +1,19 @@
<template lang="pug">
.car
h2 买车
</template>
<script>
export default {
data () {
return {
}
}
}
</script>
<style lang="less" scoped>
</style>

View File

@@ -0,0 +1,145 @@
<template lang="pug">
.exam
van-swipe(@change='onChange' :loop="false", ref="mySwiper")
van-swipe-item(v-for="(item,index) in examListData" :key="index")
p.title {{ item.question }}
img(v-if="item.url.length != 0" :src="item.url")
van-radio-group(v-model='radio' :disabled="isAgClick ? false : true ")
van-radio(v-for="(ans,i) in item.answerList",
:name='i',:key="i",
@click="isAgClick ? verAnswer(i) : '' ") {{ ans.name }}
div.error-tips(v-if="showError")
div(v-html="item.explains")
</template>
<script>
export default {
data () {
return {
startIndex: 0,
endIndex: null,
showError: false,
radio: 'r323424',
currentIndex: 0,
newData: [],
examListData: [],
errorAnswer: [],
count: 0,
isAgClick: true,
model: this.$utils.getLocalStorage('carType').type.split("/")[0].toLowerCase()
}
},
created () {
if (this.$route.params.type == "rand") {
this.getData()
} else {
if (this.$route.params.subject == 4) {
if (this.$utils.getLocalStorage("km4") == null ) {
this.getData()
} else {
this.AsyncSetData("km4")
}
} else {
if (this.$utils.getLocalStorage("km1") == null) {
this.getData()
} else {
this.AsyncSetData("km1")
}
}
}
},
methods: {
async getData () {
let data = await this.$api.index.getQuery({
subject: this.$route.params.subject,
model: this.model,
testType: this.$route.params.type
});
let result = data.result;
let answerList = [];
result.forEach((val,index) => {
answerList = []
for(var keyName in val) {
if (keyName.indexOf('item') > -1) {
if(val[keyName].length != 0) {
answerList.push({
name: val[keyName]
})
}
delete val[keyName];
}
}
val.answerList = answerList
});
if (this.$route.params.type == "order") {
if (this.$route.params.subject == 4) {
this.$utils.setLocalStorage("km4", result)
} else {
this.$utils.setLocalStorage("km1", result)
}
}
this.examListData = result
},
AsyncSetData(type) {
this.endIndex = this.startIndex * 100 + 99;
for (var i = this.startIndex * 100;i <= this.endIndex; i++) {
this.newData.push(this.$utils.getLocalStorage(type)[i])
}
this.examListData = this.newData
},
verAnswer(ans){
this.isAgClick = false
let a = (this.examListData[this.currentIndex].answer) -1
if(a == ans) {
this.$refs.mySwiper.swipeTo(this.currentIndex + 1)
this.count += 1;
} else {
this.showError = true;
this.errorAnswer.push(this.currentIndex)
console.log("答错了")
}
},
onChange(index) {
this.isAgClick = true
if (this.$route.params.type == "order") {
if (index == this.endIndex) {
this.startIndex += 1
this.$route.params.subject == 4 ? this.AsyncSetData("km4") : this.AsyncSetData("km1")
this.$refs.mySwiper.swipeTo(this.startIndex * 100)
}
} else {
if (index >= 3) {
alert(`题目答完了,分数: ${this.count},错题${this.errorAnswer.length}, 未做题:${100-(this.count +this.errorAnswer.length)}`)
}
}
this.showError = false;
this.radio = '3243243'
this.currentIndex = index
}
},
beforeRouteEnter (to, from, next) {
next(vm => {
vm.$parent.$data.isShowTabbar = false
})
},
beforeRouteLeave (to, from, next) {
this.$parent.$data.isShowTabbar = true
next()
}
}
</script>
<style lang="less" scoped>
@import "../../assets/less/components/exam.less";
</style>

View File

@@ -0,0 +1,42 @@
<template lang="pug">
.index
van-tabs(v-model='active' @change="changeTabs" swipeable animated)
van-tab(title="科目一")
v-page(:list="PropSPage", :imgurl="AdvObj", :subject="currentSubject")
van-tab(title="科目四")
v-page(:list="PropSPage", :imgurl="AdvObj", :subject="currentSubject")
</template>
<script>
import Ipage from "../tpl/ipage"
export default {
data () {
return {
currentSubject: 1,
active: 0,
PropSPage: [],
AdvObj: {
href: 'http://m.jiakaobaodian.com/school/key.html?from=m29',
url: '../../../static/img/baner.jpeg'
}
}
},
created () {
},
methods: {
changeTabs(index) {
index == 0 ? this.currentSubject = 1 : this.currentSubject = 4;
}
},
components: {
'v-page' : Ipage
}
}
</script>
<style lang="less" scoped>
@import "../../assets/less/components/index.less";
</style>

View File

@@ -0,0 +1,19 @@
<template lang="pug">
.message
h2 资讯
</template>
<script>
export default {
data () {
return {
}
}
}
</script>
<style lang="less" scoped>
</style>

View File

@@ -0,0 +1,19 @@
<template lang="pug">
.my
h2 我的
</template>
<script>
export default {
data () {
return {
}
}
}
</script>
<style lang="less" scoped>
</style>

View File

@@ -0,0 +1,88 @@
<template lang="pug">
.user
.login(v-if="ChangePage")
van-cell-group
van-field(v-model='login.name', required='', clearable='',
label='用户名', right-icon='question-o', placeholder='请输入用户名',
@click-right-icon="$toast('question')")
van-field(v-model='login.pwd', type='password', label='密码',
placeholder='请输入密码', required='')
van-button(type="primary" size="large", @click="UserLogin")
.reg(v-else)
van-cell-group
van-field(v-model='reg.name', required='', clearable='',
label='用户名', right-icon='question-o', placeholder='请输入用户名',
@click-right-icon="$toast('question')")
van-field(v-model='reg.phone', type='password', label='密码',
placeholder='请输入密码', required='')
van-field(v-model='reg.pwd', label='手机号', placeholder='请输入手机号',
error-message='手机号格式错误')
van-button(type="primary", size="large", @click="UserReg")
span(@click="change") {{ changeText }}
</template>
<script>
export default {
data () {
return {
login: {
name: null,
pwd: null,
},
reg : {
name: null,
pwd: null,
phone: null
},
ChangePage: true,
changeText: '注 册 '
}
},
methods: {
change () {
this.ChangePage = !this.ChangePage
this.ChangePage ? this.changeText = '注 册' : this.changeText = '登 录'
},
async UserLogin () {
let result = await this.$api.user.Login(this.login)
if(result.status == 200) {
this.$utils.setLocalStorage("status",result.data[0])
this.$router.push({ path: this.$route.query.form })
} else {
this.$toast.fail(result.message);
}
},
async UserReg () {
let result = await this.$api.user.Reg(this.reg)
if(result.status == 200) {
this.ChangePage = false
} else {
this.$toast.loading({
mask: true,
message: '注册失败'
});
}
}
},
beforeRouteEnter (to, from, next) {
next(vm => {
vm.$parent.$data.isShowNavbar = false
vm.$parent.$data.isShowTabbar = false
vm.$parent.$data.isHaveContent = false
})
},
beforeRouteLeave (to, from, next) {
this.$parent.$data.isShowNavbar = true
this.$parent.$data.isShowTabbar = true
this.$parent.$data.isHaveContent = true
next()
}
}
</script>
<style lang="less" scoped>
</style>

View File

@@ -0,0 +1,97 @@
<template lang="pug">
.welcome
swiper(:options='swiperOption', ref='mySwiper')
swiper-slide
.welpage
.pageimg1
img(src="../../../static/img/welcome1.png")
.title1
p 驾考手册
swiper-slide
.welpage
.pageimg2
img(src="../../../static/img/welcome2.png")
.title2
p 专业分类
span 驾考车型全覆盖
swiper-slide
.welpage
.pageimg3
img(src="../../../static/img/welcome3.png")
.title3
p 全真练习
span 模拟考试错题汇总
swiper-slide
.welpage
.pageimg4
h2 请选择您要开始的题库
p.infos 驾驶证/资格证(当前类型{{ currentTitle }})
ul
li(v-for="(item,index) in typeList" :key="index"
@click="choiceType(item,index)"
:class="index == current ? 'active' : '' ")
img(:src="item.icon")
p {{ item.name }}
p.jztype {{ item.type }}
.title2
button(@click='EnterIndex()') 开始
.swiper-pagination(slot='pagination')
</template>
<script>
export default {
data() {
return {
current: 0,
currentTitle: '小车',
swiperOption: {
pagination: {
el: '.swiper-pagination'
}
},
typeList: [
{ name: '小车', type: 'C1/C2', icon: '../../../static/img/xiaoche.png' },
{ name: '货车', type: 'A2/B2', icon: '../../../static/img/huoche.png' },
{ name: '客车', type: 'A1/B1', icon: '../../../static/img/keche.png' }
]
}
},
methods: {
choiceType(item,index) {
this.current = index;
this.currentTitle = item.name
},
EnterIndex () {
this.$utils.setLocalStorage('carType', this.typeList[this.current])
this.$router.replace({ name: 'index' })
},
},
mounted() {
this.swiper.slideTo(0, 1000, false)
},
computed: {
swiper() {
return this.$refs.mySwiper.swiper
}
},
beforeRouteEnter (to, from, next) {
next(vm => {
vm.$parent.$data.isShowNavbar = false
vm.$parent.$data.isShowTabbar = false
vm.$parent.$data.isHaveContent = false
})
},
beforeRouteLeave (to, from, next) {
this.$parent.$data.isShowNavbar = true
this.$parent.$data.isShowTabbar = true
this.$parent.$data.isHaveContent = true
next()
}
}
</script>
<style scoped lang="less">
@import "../../assets/less/components/welcome.less";
</style>

View File

@@ -0,0 +1,8 @@
export default {
baseURL: 'http://127.0.0.1:3000/',
httpApi: {
query: '/query',
login: '/user/login',
reg: '/user/reg'
}
}

View File

@@ -0,0 +1,30 @@
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import Vant from 'vant'
import 'vant/lib/index.css'
import VueAwesomeSwiper from 'vue-awesome-swiper'
import 'swiper/dist/css/swiper.css'
import server from "./api/server"
import utils from "./utils"
Vue.use(VueAwesomeSwiper)
Vue.use(Vant)
Vue.prototype.$api = server
Vue.prototype.$utils = utils
Vue.config.productionTip = false
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
components: { App },
template: '<App/>'
})

View File

@@ -0,0 +1,96 @@
import Vue from 'vue'
import Router from 'vue-router'
import Index from '@/components/view/index'
import Car from '@/components/view/car'
import Message from '@/components/view/message'
import My from '@/components/view/my'
import User from '@/components/view/user'
import Exam from '@/components/view/exam'
import Welcome from '@/components/view/welcome'
Vue.use(Router)
const router = new Router({
routes: [
{
path: '/',
name: 'welcome',
component: Welcome,
meta: {
isLogin: false
}
},
{
path: '/index',
name: 'index',
component: Index,
meta: {
isLogin: false
}
},
{
path: '/message',
name: 'message',
component: Message,
meta: {
isLogin: false
}
},
{
path: '/car',
name: 'car',
component: Car,
meta: {
isLogin: false
}
},
{
path: '/my',
name: 'my',
component: My,
meta: {
isLogin: true
}
},
{
path: '/exam/:type/:subject',
name: 'exam',
component: Exam,
meta: {
isLogin: true
}
},
{
path: '/user',
name: 'user',
component: User,
meta: {
isLogin: false
}
}
//
]
})
router.beforeEach((to, from, next) => {
if(to.meta.isLogin) {
// 判断 status 是否存在,并且是否合法
if(localStorage.getItem('status') == null) {
next({
path: '/user',
query: {
form: from.path
}
})
} else {
next()
}
} else {
next()
}
});
export default router

View File

@@ -0,0 +1,8 @@
export default {
setLocalStorage (name,value) {
localStorage.setItem(name, JSON.stringify(value))
},
getLocalStorage(name) {
return JSON.parse(localStorage.getItem(name))
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 643 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 602 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Some files were not shown because too many files have changed in this diff Show More