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,13 @@
<?php
// 菜谱大全
header("Access-Control-Allow-Origin: *");
$menu = $_GET["menu"];
$page = $_GET["page"];
$limit = $_GET["limit"];
$url = "http://apis.juhe.cn/cook/query?key=c3954f8fddc58db4aabdbf05918afcff&menu=".$menu."&rn=".$limit."&pn=".$page;
$data = file_get_contents($url);
echo $data;
?>

View File

@@ -0,0 +1,85 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>分类</title>
<meta name="viewport" content="initial-scale=1, maximum-scale=1">
<link rel="shortcut icon" href="">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="stylesheet" href="./css/clear.css">
<link rel="stylesheet" href="./css/sm.css">
<link rel="stylesheet" href="https://unpkg.com/swiper/css/swiper.css">
<link rel="stylesheet" href="./css/class.css">
</head>
<body>
<div class="left">
<ul>
</ul>
</div>
<div class="right">
<ul>
</ul>
</div>
<script src='//cdn.bootcss.com/jquery/3.1.1/jquery.min.js'></script>
<script src="./js/type.js"></script>
<script>
const id = location.search.split("=")[1];
function renderUrl() {
type.result.forEach((val,index)=> {
if (val.parentId === id) {
bindClick( $(".left ul li").eq(index), index)
}
})
}
function RenderLeft() {
type.result.forEach(function (val,index) {
$(".left ul").append(`<li class="${index === 0 ? 'active' : '' }">${val.name}</li>`)
});
$(".left ul li").on('click', function () {
bindClick(this, $(this).index())
})
}
function bindClick(el, index) {
$(".right ul").empty()
el == null ? '' : $(el).addClass("active").siblings().removeClass("active")
const ri = type.result[index].list;
ri.forEach((val,index)=>{
$(".right ul").append(`
<li>
<a href="./list.html?menu_name=${val.name}">
<p>${val.name}</p>
</a>
</li>
`)
})
}
RenderLeft()
bindClick(null, 0)
renderUrl()
</script>
</body>
</html>

View File

@@ -0,0 +1,52 @@
.left{
overflow: hidden;
padding-left: 5px;
box-sizing: border-box;
position: fixed;
height: 100%;
overflow-y: scroll;
}
.left ul{
display: flex;
justify-content: space-around;
flex-direction: column;
height: -2%;
}
.left ul li{
margin: 18px 0;
font-size: 13px;
}
.active {
color: red;
}
.right{
margin-left: 31%;
}
.right ul{
width: 100%;
display: flex;
flex-wrap: wrap;
}
.right ul li{
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
width: 33.333%;
margin-top: 8px;
}
.right ul li a{
font-size: 13px;
color: #1a1a1a;
}
.right ul li p{
margin-top: 8px;
width: 55px;
height: 28px;
font-size: 11px;
color: #666666;
overflow: hidden;
text-align: center;
}

View File

@@ -0,0 +1,6 @@
body,ul,li,h1,h2,h3,h4,h5,h6,p,a{
margin: 0;
padding: 0;
text-decoration: none;
list-style: none;
}

View File

@@ -0,0 +1,28 @@
.content {
margin-top: 72px;
}
.search {
width: 100%;
position: fixed;
height: 72px;
left: 0;
top: 0;
background: #fff;
z-index: 999;
}
.search_f {
display: flex;
height: 45px;
background: #f5f5f5;
color: #999;
margin: 16px;
border-radius: 4px;
align-items: center;
padding-left: 16px;
}
.search .icon-search {
}
.search span {
}

View File

@@ -0,0 +1,7 @@
ul{
width:100%;
text-align: center;
}
ul li{
font-size: 40px;
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@@ -0,0 +1,133 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>我的生活</title>
<meta name="viewport" content="initial-scale=1, maximum-scale=1">
<link rel="shortcut icon" href="">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="stylesheet" href="./css/sm.css">
<link rel="stylesheet" href="https://unpkg.com/swiper/css/swiper.css">
<link rel="stylesheet" href="./css/index.css">
<style>
.swiper-slide img {
width: 100%;
}
</style>
</head>
<body>
<div class="page">
<!-- 这里是页面内容区 -->
<div class="content">
<div class="search">
<div class="search_f">
<label class="icon icon-search" for="search"></label>
<span>搜索百万免费菜谱</span>
</div>
</div>
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide">
<img src="https://gw.alicdn.com/imgextra/i1/181/O1CN0139HF6f1DCwHIUUtzZ_!!181-0-lubanu.jpg" alt="">
</div>
<div class="swiper-slide">
<img src="https://gw.alicdn.com/imgextra/i1/51/O1CN01Yq12fx1CFOmySPPy2_!!51-0-lubanu.jpg" alt="">
</div>
<div class="swiper-slide">
<img src="https://gw.alicdn.com/imgextra/i1/17/O1CN018TnpfG1BzpJyTq1Kq_!!17-0-lubanu.jpg" alt="">
</div>
</div>
<!-- 如果需要分页器 -->
<div class="swiper-pagination"></div>
</div>
<ul class="list">
<li>
<a href="./class.html?id=10007">菜系</a>
</li>
<li>
<a href="./class.html?id=10009">西点</a>
</li>
</ul>
</div>
<!-- 工具栏 -->
<nav class="bar bar-tab">
<a class="tab-item external active" href="#">
<span class="icon icon-home"></span>
<span class="tab-label">首页</span>
</a>
<a class="tab-item external" href="#">
<span class="icon icon-star"></span>
<span class="tab-label">收藏</span>
</a>
<a class="tab-item external" href="#">
<span class="icon icon-settings"></span>
<span class="tab-label">设置</span>
</a>
</nav>
</div>
<!-- popup, panel 等放在这里 -->
<div class="panel-overlay"></div>
<!-- Left Panel with Reveal effect -->
<div class="panel panel-left panel-reveal">
<div class="content-block">
<p>这是一个侧栏</p>
<p></p>
<!-- Click on link with "close-panel" class will close panel -->
<p><a href="#" class="close-panel">关闭</a></p>
</div>
</div>
<script src='//cdn.bootcss.com/jquery/3.1.1/jquery.min.js'></script>
<script src="https://unpkg.com/swiper/js/swiper.min.js"> </script>
<script src='https://sui.ctolog.com/dist/js/sm.js'></script>
<script>
var list = [
{ name: 'lb' },
{ name: 'zhangsan' },
{ name: 'lis' }
];
var a = { name: 'zhangsan' }
function test() {
for (var i = 0; i < list.length; i++) {
if (list[i].name === a.name) {
return true
}
}
return false
}
if (test()) {
console.log("重复了,已经存在")
} else {
console.log("不存在")
}
// var mySwiper = new Swiper ('.swiper-container', {
// direction: 'horizontal',
// loop: true, // 循环模式选项
//
// // 如果需要分页器
// pagination: {
// el: '.swiper-pagination',
// }
// })
</script>
</body>
</html>

View File

@@ -0,0 +1,55 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<button>收藏</button>
<script src='//cdn.bootcss.com/jquery/3.1.1/jquery.min.js'></script>
<script>
// 当前要收藏的数据
const data = JSON.parse(localStorage.getItem("info"));
var likeData = [];
document.write(JSON.stringify(data))
$("button").on('click', function () {
console.log("status")
if (localStorage.getItem("like") !== null) {
console.log("status2")
// 收藏的数据
const like = JSON.parse(localStorage.getItem("like"));
var status = false // true 重复false 不重复
for (var i = 0;i<like.length;i++) {
if (like[i].id === data.id) {
status = true
break;
}
}
if (status) {
console.log("重复")
} else {
like.push(data)
localStorage.setItem("like", JSON.stringify(like))
}
} else {
likeData.push(data)
localStorage.setItem("like", JSON.stringify(likeData))
}
});
</script>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,52 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="./css/sm.css">
<title>Title</title>
<style>
.product{
width: 300px;
height: 300px;
background: red;
position: fixed;
left: 0;
top: 0;
}
</style>
</head>
<body>
<div class="product">
</div>
</body>
<script src='//cdn.bootcss.com/jquery/3.1.1/jquery.min.js'></script>
<script src='https://sui.ctolog.com/dist/js/sm.js'></script>
<script>
var timeOutEvent;
$("body").on({
touchstart: function(e){
e.preventDefault();
},
touchmove: function(e){
var pianyi = e.targetTouches[0]
$(".product").css({
"left": `${pianyi.pageX}px`,
"top": `${pianyi.pageY}px`
})
console.log("x :", pianyi.pageX)
e.preventDefault();
},
touchend: function(e){
$(".product").css({
"left": `0px`,
"top": `0px`
})
}
});
</script>
</html>

View File

@@ -0,0 +1,57 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>菜谱列表页面</title>
<link rel="stylesheet" href="./css/clear.css">
<link rel="stylesheet" href="./css/list.css">
</head>
<body>
<ul>
</ul>
<script src='//cdn.bootcss.com/jquery/3.1.1/jquery.min.js'></script>
<script>
const MenuName = location.search.split("=")[1];
$.ajax({
type: "GET",
url: "http://127.0.0.1/cp/index.php",
data: {
menu: MenuName,
page: 1,
limit: 10
},
success: function (res) {
const data = JSON.parse(res);
if (data.result.data.length === 0) {
document.write("没有数据")
} else {
renderPage(JSON.parse(res))
console.log(JSON.parse(res))
}
},
error: function (err) {
console.log(err)
}
});
function renderPage(res) {
res.result.data.forEach((val,index)=>{
$("ul").append(`<li>${val.title}</li>`)
});
$("ul li").on('click', function () {
localStorage.setItem("info", JSON.stringify(res.result.data[$(this).index()]))
location.href = "./info.html"
})
}
</script>
</body>
</html>

View File

@@ -0,0 +1,56 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<input type="text" placeholder="输入关键词">
<button>搜索</button>
<div class="result">
</div>
</body>
<script src='//cdn.bootcss.com/jquery/3.1.1/jquery.min.js'></script>
<script>
$("button").on('click', function () {
console.log( $("input").val() )
$.ajax({
type: "GET",
url: "http://127.0.0.1/cp/index.php",
data: {
menu: $("input").val(),
page: 1,
limit: 10
},
success: function (res) {
const data = JSON.parse(res);
if (data.result == null) {
$(".result").empty();
$(".result").append(`<h2>没有数据</h2>`)
} else {
renderPage(data)
}
},
error: function (err) {
console.log(err)
}
});
});
function renderPage(data) {
console.log(data)
$(".result").empty();
data.result.data.forEach((val)=>{
$(".result").append(`<p>${val.title}</p>`)
})
}
</script>
</html>