代码拉取完成,页面将自动刷新
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>商品详情</title>
</head>
<link rel="stylesheet" href="css/index.css">
<link rel="stylesheet" href="css/iconfont.css">
<link rel="icon" href="public/imgs/favicon.ico">
<style>
*{
margin: 0 ;
padding: 0;
}
.photo{
width: 360px;
height: 360px;
position: absolute;
left: 0;
top: 25%;
}
.main{
height: 560px;
width: 1226px;
margin: 0 auto;
position: relative;
}
.main-right{
width: 800px;
height: 560px;
float: right;
}
.goods{
margin: 0 auto;
font-size: 40px;
border-bottom: 1px solid black;
background: #8D8D8D;
}
.header{
border-bottom: 1px solid black;
}
.footer{
margin-top: 40px;
}
.title{
color: #b0b0b0;
font-size: 14px;
height: 29px;
}
.price{
height: 40px;
}
.goodsprice{
font-size: 18px;
color: #ff6700;
padding-top: 12px;
padding-bottom: 12px;
}
.address{
width: 700px;
height: 42px;
padding: 30px 50px;
background: #fafafa;
line-height: 42px;
color: #333;
font-size: 14px;
margin-top: 20px;
}
.selected{
width: 740px;
height: 86px;
background: #f9f9fa;
padding: 30px;
}
.total-price{
width: 600px;
height: 80px;
line-height: 80px;
}
button{
width: 300px;
height: 53px;
border:none;
background-color: #ff6700;
text-align: center;
line-height: 53px;
margin-top: 20px;
color: #fff;
font-size: 16px;
cursor: pointer;
}
</style>
<body>
<div class="top-bar">
<div class="wrap">
<ul class="top-bar-left">
<li><a href="#">小米商城</a><span>|</span></li>
<li><a href="#">MIUI</a><span>|</span></li>
<li><a href="#">loT</a><span>|</span></li>
<li><a href="#">云服务</a><span>|</span></li>
<li><a href="#">天星数科</a><span>|</span></li>
<li><a href="#">有品</a><span>|</span></li>
<li><a href="#">小爱开放平台</a><span>|</span></li>
<li><a href="#">企业团购</a><span>|</span></li>
<li><a href="#">资质证照</a><span>|</span></li>
<li><a href="#">协议规则</a><span>|</span></li>
<li>
<a href="#">下载app</a><span>|</span>
<div class="download">
<a href="#">
<img src="public/imgs/download.png" alt="">
<p>小米商城APP</p>
</a>
</div>
</li>
<li><a href="#">智能生活</a><span>|</span></li>
<li><a href="#">Select Location</a></li>
</ul>
<ul class="top-bar-right">
<div class="user-name"></div>
<li><a href="login.html">登录</a><span>|</span></li>
<li><a href="register.html">注册</a><span>|</span></li>
<li><a href="#">消息通知</a></li>
<li class="cart">
<a href="shoppingcar.html">
<i class="iconfont"></i>
购物车(0)
</a>
<div class="cart-list">
购物车中还没有商品,赶紧选购吧!
</div>
</li>
</ul>
</div>
</div>
<div class="header">
<div class="container wrap">
<div class="header-logo">
<a href="index.html"> <img src="public/imgs/logo-mi2.png"></a>
</div>
<div class="nav-bar">
<ul>
<li>
<a href="#">小米手机</a>
<div class="nav-list">
<div class="wrap">
<ul>
<li>
<a href="#">
<div class="img-box">
<img src="public/imgs/12pro.webp" alt="">
</div>
<p class="title1">小米11 Pro</p>
<p class="price">4499元起</p>
</a>
</li>
<li>
<a href="#">
<div class="img-box">
<img src="public/imgs/12pro.webp" alt="">
</div>
<p class="title1">小米11 Pro</p>
<p class="price">4499元起</p>
</a>
</li>
<li>
<a href="#">
<div class="img-box">
<img src="public/imgs/12pro.webp" alt="">
</div>
<p class="title1">小米11 Pro</p>
<p class="price">4499元起</p>
</a>
</li>
<li>
<a href="#">
<div class="img-box">
<img src="public/imgs/12pro.webp" alt="">
</div>
<p class="title1">小米11 Pro</p>
<p class="price">4499元起</p>
</a>
</li>
<li>
<a href="#">
<div class="img-box">
<img src="public/imgs/12pro.webp" alt="">
</div>
<p class="title1">小米11 Pro</p>
<p class="price">4499元起</p>
</a>
</li>
<li>
<a href="#">
<div class="img-box">
<img src="public/imgs/12pro.webp" alt="">
</div>
<p class="title1">小米11 Pro</p>
<p class="price">4499元起</p>
</a>
</li>
</ul>
</div>
</div>
</li>
<li>
<a href="#">Redmi红米</a>
<div class="nav-list">
<div class="wrap">
<ul>
<li>
<a href="#">
<div class="img-box">
<img src="public/imgs/12pro.webp" alt="">
</div>
<p class="name1">小米11 Pro</p>
<p class="price1">4499元起</p>
</a>
</li>
<li>
<a href="#">
<div class="img-box">
<img src="public/imgs/12pro.webp" alt="">
</div>
<p class="name1">小米11 Pro</p>
<p class="price1">4499元起</p>
</a>
</li>
<li>
<a href="#">
<div class="img-box">
<img src="public/imgs/12pro.webp" alt="">
</div>
<p class="name1">小米11 Pro</p>
<p class="price1">4499元起</p>
</a>
</li>
<li>
<a href="#">
<div class="img-box">
<img src="public/imgs/12pro.webp" alt="">
</div>
<p class="name1">小米11 Pro</p>
<p class="price1">4499元起</p>
</a>
</li>
<li>
<a href="#">
<div class="img-box">
<img src="public/imgs/12pro.webp" alt="">
</div>
<p class="name1">小米11 Pro</p>
<p class="price1">4499元起</p>
</a>
</li>
<li>
<a href="#">
<div class="img-box">
<img src="public/imgs/12pro.webp" alt="">
</div>
<p class="name1">小米11 Pro</p>
<p class="price1">4499元起</p>
</a>
</li>
</ul>
</div>
</div>
</li>
<li><a href="#">电视</a></li>
<li><a href="#">笔记本</a></li>
<li><a href="#">家电</a></li>
<li><a href="#">路由器</a></li>
<li><a href="#">智能硬件</a></li>
<li><a href="#">服务</a></li>
<li><a href="#">社区</a></li>
</ul>
</div>
</div>
</div>
<div class="main">
<img src="" alt="" class="photo">
<div class="main-right">
<h1 class="name"></h1>
<p class="title"></p>
<p style="color: #ff6700;margin-top: 10px" >小米自营</p>
<p class="goodsprice"></p>
<hr>
<div class="address">四川省 南充市 营山县</div>
<h3 style="margin-top: 10px">选择颜色</h3>
<div style="width:292px;height: 42px;border: #ff6700 solid 1px;margin-top: 10px;color: #ff6700;cursor: pointer;text-align: center;line-height: 42px">黑</div>
<div class="selected">
<span class="name" style="color: #616161;margin-top: 40px"></span>
<span class="goodsprice" style="float: right;padding: 0"></span>
<div class="total-price">
<span style="color: #ff6700;font-size: 24px;">总计:</span>
<span class="goodsprice" style="margin-left: 20px"></span>
</div>
</div>
<button>加入购物车</button>
</div>
</div>
<div class="footer">
<div class="site-footer">
<div class="wrap">
<div class="footer-service">
<ul>
<li>
<a href="#">
<i class="iconfont"></i>
<span>预约维修</span>
</a>
</li>
<li>
<a href="#">
<i class="iconfont"></i>
<span>7天无理由退换货</span>
</a>
</li>
<li>
<a href="#">
<i class="iconfont"></i>
<span>15天免费换货</span>
</a>
</li>
<li>
<a href="#">
<i class="iconfont"></i>
<span>满69元包邮</span>
</a>
</li>
<li>
<a href="#">
<i class="iconfont"></i>
<span>520余家售后网点</span>
</a>
</li>
</ul>
</div>
<div class="footer-links">
<ul>
<li>
帮助中心
</li>
<li>
<a href="#">账户管理</a>
</li>
<li>
<a href="#">账户管理</a>
</li>
<li>
<a href="#">账户管理</a>
</li>
</ul>
<ul>
<li>
帮助中心
</li>
<li>
<a href="#">账户管理</a>
</li>
<li>
<a href="#">账户管理</a>
</li>
<li>
<a href="#">账户管理</a>
</li>
</ul>
<ul>
<li>
帮助中心
</li>
<li>
<a href="#">账户管理</a>
</li>
<li>
<a href="#">账户管理</a>
</li>
<li>
<a href="#">账户管理</a>
</li>
</ul>
<ul>
<li>
帮助中心
</li>
<li>
<a href="#">账户管理</a>
</li>
<li>
<a href="#">账户管理</a>
</li>
<li>
<a href="#">账户管理</a>
</li>
</ul>
<ul>
<li>
帮助中心
</li>
<li>
<a href="#">账户管理</a>
</li>
<li>
<a href="#">账户管理</a>
</li>
<li>
<a href="#">账户管理</a>
</li>
</ul>
<ul>
<li>
帮助中心
</li>
<li>
<a href="#">账户管理</a>
</li>
<li>
<a href="#">账户管理</a>
</li>
<li>
<a href="#">账户管理</a>
</li>
</ul>
<div class="contact">
<p class="tel">400-100-5678</p>
<p class="time">8:00-18:00(仅收市话费)</p>
<a href="#" class="kefu">
<i class="iconfont"></i>
人工客服
</a>
<p class="follow">
<img src="public/imgs/logo-mi2.png">
下载小米商城app
</p>
</div>
</div>
</div>
</div>
<div class="site-info">
<div class="wrap">
<div class="footer-logo">
<img src="public/imgs/logo-mi2.png" alt="">
</div>
<div class="sites">
<p>
<a rel="nofollow" href="//www.mi.com/index.html" target="_blank">小米商城</a>
<span class="sep">|</span>
<a rel="nofollow" href="//www.miui.com/" target="_blank">MIUI</a>
<span class="sep">|</span>
<a rel="nofollow" href="//home.mi.com/index.html" target="_blank">米家</a>
<span class="sep">|</span>
<a rel="nofollow" href="http://www.miliao.com/" target="_blank">米聊</a>
<span class="sep">|</span>
<a rel="nofollow" href="//www.duokan.com/" target="_blank">多看</a>
<span class="sep">|</span>
<a rel="nofollow" href="//game.xiaomi.com/" target="_blank">游戏</a>
<span class="sep">|</span>
<a rel="nofollow" href="//b.mi.com/?client_id=180100031058&masid=17409.0358" target="_blank">政企服务</a>
<span class="sep">|</span>
<a rel="nofollow" href="//xiaomi.tmall.com/" target="_blank">小米天猫店</a>
<span class="sep">|</span>
<a rel="nofollow" href="//privacy.mi.com/all/zh_CN/" target="_blank">小米集团隐私政策</a>
<span class="sep">|</span>
<a rel="nofollow" href="//cdn.cnbj1.fds.api.mi-img.com/mi-mall/f516fe9e2c01.html" target="_blank">小米公司儿童信息保护规则</a>
<span class="sep">|</span>
<a rel="nofollow" href="//cdn.cnbj1.fds.api.mi-img.com/mi-mall/ded8d0e4a77d.html" target="_blank">小米商城隐私政策</a>
<span class="sep">|</span>
<a rel="nofollow" href="//www.mi.com/about/user-agreement/" target="_blank">小米商城用户协议</a>
<span class="sep">|</span>
<a rel="nofollow" href="//static.mi.com/feedback/" target="_blank">问题反馈</a>
<span class="sep">|</span>
<a rel="nofollow" href="javascript:void(0);" class="J_siteGlobalRegion">Select Location</a>
<br>
<a rel="nofollow" href="http://www.mi.com/beihu" target="_blank">北京互联网法院法律服务工作站</a>
<span class="sep">|</span>
<a rel="nofollow" href="http://www.cca.org.cn/" target="_blank">中国消费者协会</a>
<span class="sep">|</span>
<a rel="nofollow" href="http://www.bj315.org/" target="_blank">北京市消费者协会</a>
</p>
<p>
©
<a href="javascript:;" target="_blank" title="mi.com">mi.com</a> 京ICP证110507号
<a href="http://beian.miit.gov.cn/" target="_blank" rel="nofollow">京ICP备10046444号</a>
<a rel="nofollow" href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=11010802020134" target="_blank">京公网安备11010802020134号</a>
<a href="//www.mi.com/culture-license/" target="_blank">京网文[2020]0276-042号</a>
<br>
<a href="//www.mi.com/medical/record/" target="_blank">(京)网械平台备字(2018)第00005号</a>
<a href="//www.mi.com/medical/qualification/" target="_blank">互联网药品信息服务资格证 (京)-非经营性-2014-0090</a>
<a href="//www.mi.com/business-license/" target="_blank">营业执照</a>
<a href="//www.mi.com/medical/list/" target="_blank">医疗器械质量公告</a>
<br>
<a href="https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/e0c7d4cf3b7cd88de10196e30c92e020.png" target="_blank">增值电信业务许可证</a> 网络食品经营备案 京食药网食备202010048
<a href="https://cdn.cnbj1.fds.api.mi-img.com/mi-mall/c6859168166651511897f54fa1047fe3.png" target="_blank">食品经营许可证</a>
<br>
违法和不良信息举报电话:171-5104-4404 <a href='https://www.mi.com/intellectual' target="_blank">知识产权侵权投诉</a> 本网站所列数据,除特殊说明,所有数据均出自我司实验室测试
</p>
<p>
<img src="public/imgs/15.png" alt="">
<img src="public/imgs/16.png" alt="">
<img src="public/imgs/17.png" alt="">
<img src="public/imgs/18.png" alt="">
<img src="public/imgs/19.png" alt="">
</p>
</div>
<img src="public/imgs/slogan2020.png" alt="" class="slogan">
</div>
</div>
</div>
<script type="text/javascript">
const xhr=new XMLHttpRequest()
const photo = document. querySelector ('.photo')
const name=document.querySelectorAll('.name')
const title=document.querySelector('.title')
const btn=document.querySelector('button')
const page=document.querySelector('.page-main-s')
const goodsprice=document.querySelectorAll('.goodsprice')
xhr.onreadystatechange = function() {
HTMLAllCollection
if (xhr.readyState === 4 && xhr.status === 200) {
const {data:res} =JSON.parse(xhr.responseText)
console.log(res)
photo.src=res.product_picture
name[0].innerHTML=res.product_name
name[1].innerHTML=res.product_name
title.innerHTML=res.product_intro
goodsprice[0].innerHTML=res.product_price+"元"
goodsprice[1].innerHTML=res.product_price+"元"
goodsprice[2].innerHTML=res.product_price+"元"
btn.onclick=function (){
const xhr8=new XMLHttpRequest()
const userid=localStorage.getItem('userid')
xhr8.open('POST', 'http://43.138.138.11:1110/api/order/'+userid+'/'+id, true)
xhr8.send();
xhr8.onreadystatechange = function () {
if (xhr8.readyState === 4 && xhr8.status === 200) {
console.log(xhr8.responseText)
location.href='shoppingcar.html'
}
}
}
}
}
const id = localStorage.getItem('product_id')
xhr.open('Get','http://43.138.138.11:1110/api/product/'+id,true)
xhr.send(null)
</script>
</body>
</html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。