mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-10-02 18:26:38 +08:00
Merge branch 'sit-Carl' of gitee.com:carl_Ming_1/smart-admin into sit-Leung
This commit is contained in:
commit
26ab95b656
@ -1,8 +1,6 @@
|
|||||||
@media screen and (max-width:768px){
|
@media screen and (max-width:768px){
|
||||||
.allmain{
|
.allmain{
|
||||||
.rc-top{
|
|
||||||
margin-top: 2.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
.active {
|
.active {
|
||||||
@ -29,7 +27,7 @@
|
|||||||
display: block;
|
display: block;
|
||||||
margin-left: 32px;
|
margin-left: 32px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
span:first-child {
|
span:first-child {
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
@ -156,9 +154,7 @@ margin-top: 8px;
|
|||||||
@media screen and (min-width: 769px){
|
@media screen and (min-width: 769px){
|
||||||
|
|
||||||
.allmain{
|
.allmain{
|
||||||
.rc-top{
|
|
||||||
margin-top: 1.5rem;
|
|
||||||
}
|
|
||||||
.rs-dis{
|
.rs-dis{
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-flow: wrap;
|
flex-flow: wrap;
|
||||||
@ -192,6 +188,7 @@ margin-top: 8px;
|
|||||||
margin-left: 40px;
|
margin-left: 40px;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
}
|
}
|
||||||
span:first-child {
|
span:first-child {
|
||||||
|
@ -128,13 +128,14 @@ img, picture {
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
background: #333333;
|
background: #333333;
|
||||||
opacity: 0.6;
|
opacity: 0.6;
|
||||||
position: absolute;
|
position: fixed;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
z-index: 8;
|
z-index: 8;
|
||||||
}
|
}
|
||||||
.ts-scrollable-container{
|
.ts-scrollable-container{
|
||||||
display: flex;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
h2{
|
h2{
|
||||||
margin:0;
|
margin:0;
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -281,6 +282,11 @@ img, picture {
|
|||||||
.rc-top{
|
.rc-top{
|
||||||
margin-top: 74px;
|
margin-top: 74px;
|
||||||
}
|
}
|
||||||
|
.rc-list__header {
|
||||||
|
background: none;
|
||||||
|
padding: .5rem 0;
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
.ts-right-arr {
|
.ts-right-arr {
|
||||||
border-bottom:1px solid #E1001A;
|
border-bottom:1px solid #E1001A;
|
||||||
padding-bottom:2px;
|
padding-bottom:2px;
|
||||||
|
@ -337,6 +337,8 @@ object-fit: cover;
|
|||||||
color: #fff;
|
color: #fff;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
font-size: 1.25rem;
|
||||||
|
line-height: 9.375rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -710,10 +710,11 @@
|
|||||||
import { userquery,postCourseId,biaomessage,userque,searchchanpin } from "../ajax/getData";
|
import { userquery,postCourseId,biaomessage,userque,searchchanpin } from "../ajax/getData";
|
||||||
const settings = require("@/config");
|
const settings = require("@/config");
|
||||||
export default {
|
export default {
|
||||||
middleware: 'metaTitle',
|
middleware: 'metaTitle',
|
||||||
meta: {title: '首页'},
|
// middleware: 'metaTitle',
|
||||||
data(){
|
meta: {title: '首页'},
|
||||||
return{
|
data(){
|
||||||
|
return{
|
||||||
useraindex:0,
|
useraindex:0,
|
||||||
usertitle:'明星猫粮',
|
usertitle:'明星猫粮',
|
||||||
dogtitle:'明星狗粮',
|
dogtitle:'明星狗粮',
|
||||||
@ -884,7 +885,7 @@
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
||||||
discounchufang: [
|
discounchufang: [
|
||||||
{
|
{
|
||||||
title: "消化道",
|
title: "消化道",
|
||||||
catimage: require("../assets/cat.png"),
|
catimage: require("../assets/cat.png"),
|
||||||
@ -1329,6 +1330,10 @@
|
|||||||
this.gotop = false;
|
this.gotop = false;
|
||||||
this.searchBar=true
|
this.searchBar=true
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
toTop() {
|
toTop() {
|
||||||
let top = document.documentElement.scrollTop || document.body.scrollTop;
|
let top = document.documentElement.scrollTop || document.body.scrollTop;
|
||||||
@ -1439,66 +1444,67 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
lianxi(item,index){
|
lianxi(item,index){
|
||||||
if(item.title=='在线客服'){
|
if(item.title=='在线客服'){
|
||||||
var option = {
|
var option = {
|
||||||
customer: {id: '', name: '', email: '', mobile: '', memberId: '999999'}
|
customer: {id: '', name: '', email: '', mobile: '', memberId: '999999'}
|
||||||
}
|
}
|
||||||
dis_livchat(option);
|
dis_livchat(option);
|
||||||
}
|
}
|
||||||
if(item.title=='购物车'){
|
if(item.title=='购物车'){
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
path: "/myorder/userrecord",
|
path: "/myorder/userrecord",
|
||||||
});
|
|
||||||
}
|
|
||||||
if(item.title=='营养专家'){
|
|
||||||
var option = {
|
|
||||||
customer: {id: '', name: '', email: '', mobile: '', memberId: '999999'}
|
|
||||||
}
|
|
||||||
dis_livchat(option);
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
});
|
||||||
userbuy(item){
|
}
|
||||||
let user= localStorage.getItem("userInfo");
|
if(item.title=='营养专家'){
|
||||||
this.courseId(item)
|
var option = {
|
||||||
this.$router.push({
|
customer: {id: '', name: '', email: '', mobile: '', memberId: '999999'}
|
||||||
path: "/myorder/userrecord",
|
}
|
||||||
});
|
dis_livchat(option);
|
||||||
},
|
}
|
||||||
|
|
||||||
selectGoods(item,index){
|
},
|
||||||
//console.log(item,index);
|
userbuy(item){
|
||||||
this.activeIndex=index;
|
let user= localStorage.getItem("userInfo");
|
||||||
//console.log(item.title);
|
this.courseId(item)
|
||||||
this.ifadroind(item,index,this.useraindex)
|
this.$router.push({
|
||||||
// this.ifAdoid(item,index);
|
path: "/myorder/userrecord",
|
||||||
|
|
||||||
},
|
});
|
||||||
quanshi(item,index){
|
},
|
||||||
//console.log(item,index);
|
|
||||||
this.activeIndex5=index
|
|
||||||
//console.log(this.activeIndex5);
|
|
||||||
},
|
|
||||||
userdoghot(item,index){
|
|
||||||
this.activeIndex6=index
|
|
||||||
|
|
||||||
},
|
selectGoods(item,index){
|
||||||
selectGo(item,index){
|
console.log(item,index);
|
||||||
this.activeInde2=index;
|
this.activeIndex=index;
|
||||||
},
|
console.log(item.title);
|
||||||
selectGoo(item,index){
|
this.ifadroind(item,index,this.useraindex)
|
||||||
this.activeInde3=index;
|
// this.ifAdoid(item,index);
|
||||||
}
|
|
||||||
}
|
},
|
||||||
|
quanshi(item,index){
|
||||||
|
console.log(item,index);
|
||||||
|
this.activeIndex5=index
|
||||||
|
console.log(this.activeIndex5);
|
||||||
|
|
||||||
|
},
|
||||||
|
userdoghot(item,index){
|
||||||
|
this.activeIndex6=index
|
||||||
|
|
||||||
|
},
|
||||||
|
selectGo(item,index){
|
||||||
|
this.activeInde2=index;
|
||||||
|
},
|
||||||
|
selectGoo(item,index){
|
||||||
|
|
||||||
|
this.activeInde3=index;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
@media screen and(min-width: 320px) and(max-width:768px){
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@import url("../assets/css/global.less");
|
@import url("../assets/css/global.less");
|
||||||
@import url("../assets/css/index.less");
|
@import url("../assets/css/index.less");
|
||||||
|
|
||||||
|
@ -2,11 +2,10 @@
|
|||||||
<div class="allmain">
|
<div class="allmain">
|
||||||
|
|
||||||
<Myheader></Myheader>
|
<Myheader></Myheader>
|
||||||
<div class="online bold rc-md-down" id="fixed-catbar-seperator"></div>
|
|
||||||
<!-- <tabs></tabs> -->
|
<!-- <tabs></tabs> -->
|
||||||
<div class="rc-top"></div>
|
<div class="rc-top"></div>
|
||||||
<div class="rc-usermain">
|
<div class="rc-usermain">
|
||||||
<div class="online bold"></div>
|
|
||||||
<div class="rc">
|
<div class="rc">
|
||||||
<span
|
<span
|
||||||
v-for="(item, index) in discountlist"
|
v-for="(item, index) in discountlist"
|
||||||
@ -28,14 +27,14 @@
|
|||||||
>
|
>
|
||||||
<img :src="userimage" alt="" />
|
<img :src="userimage" alt="" />
|
||||||
<div class="rc-contair">
|
<div class="rc-contair">
|
||||||
<div class="rc-left" ref="userleft" id="userleft">
|
<div class="rc-left" ref="userleft" id="userleft" :style='usercolor'>
|
||||||
<div>
|
<div>
|
||||||
<i>¥</i><span>{{ item.couponAmount }}</span>
|
<i>¥</i><span>{{item.couponTypeId=='4'?(item.discount) *10:item.couponAmount}}</span>
|
||||||
</div>
|
</div>
|
||||||
<strong>{{ item.couponName }}</strong>
|
<strong>{{ item.couponName }}</strong>
|
||||||
</div>
|
</div>
|
||||||
<div class="rc-right">
|
<div class="rc-right">
|
||||||
<i>
|
<i :style='usercolor'>
|
||||||
{{ item.couponName }}
|
{{ item.couponName }}
|
||||||
</i>
|
</i>
|
||||||
<div class="rc-userfont">
|
<div class="rc-userfont">
|
||||||
@ -71,6 +70,7 @@ export default {
|
|||||||
userload: true,
|
userload: true,
|
||||||
pastdue: false,
|
pastdue: false,
|
||||||
unused: false,
|
unused: false,
|
||||||
|
usercolor:{color:'#e1001a'},
|
||||||
usermessage:[],
|
usermessage:[],
|
||||||
userstates:0,
|
userstates:0,
|
||||||
userimage: require("../../assets/image/unused.png"),
|
userimage: require("../../assets/image/unused.png"),
|
||||||
@ -207,21 +207,26 @@ export default {
|
|||||||
this.pastdue = true;
|
this.pastdue = true;
|
||||||
this.userimage = require("../../assets/image/hasused.png");
|
this.userimage = require("../../assets/image/hasused.png");
|
||||||
this.userstates=1
|
this.userstates=1
|
||||||
this.userdraw(this.usermessage.data.mobile,0)
|
console.log(this.$refs.userleft);
|
||||||
|
this.usercolor={color:'white'}
|
||||||
|
|
||||||
|
|
||||||
|
this.userdraw(this.usermessage.data.mobile,1)
|
||||||
}
|
}
|
||||||
if (this.activeIndex == 0) {
|
if (this.activeIndex == 0) {
|
||||||
this.userload = true;
|
this.userload = true;
|
||||||
this.pastdue = false;
|
this.pastdue = false;
|
||||||
this.userdraw(this.usermessage.data.mobile,0)
|
this.userdraw(this.usermessage.data.mobile,0)
|
||||||
|
this.usercolor={color:'#e1001a'}
|
||||||
this.userstates=0
|
this.userstates=0
|
||||||
this.userimage = require("../../assets/image/unused.png");
|
this.userimage = require("../../assets/image/unused.png");
|
||||||
}
|
}
|
||||||
if (this.activeIndex == 2) {
|
if (this.activeIndex == 2) {
|
||||||
this.userload = false;
|
this.userload = false;
|
||||||
this.pastdue = true;
|
this.pastdue = true;
|
||||||
this.userdraw(this.usermessage.data.mobile,0)
|
this.userdraw(this.usermessage.data.mobile,2)
|
||||||
this.userstates=2
|
this.userstates=2
|
||||||
|
this.usercolor={color:'white'}
|
||||||
this.userimage = require("../../assets/image/expired.png");
|
this.userimage = require("../../assets/image/expired.png");
|
||||||
}
|
}
|
||||||
console.log(index);
|
console.log(index);
|
||||||
@ -242,6 +247,18 @@ export default {
|
|||||||
// }
|
// }
|
||||||
// dis_livchat(option);
|
// dis_livchat(option);
|
||||||
// }
|
// }
|
||||||
|
},
|
||||||
|
|
||||||
|
directives: {
|
||||||
|
'color': {
|
||||||
|
bind: function(el, binding){
|
||||||
|
el.style.color = binding.value
|
||||||
|
},
|
||||||
|
inserted: function(el){
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
if(this.usermessage!=='' ||this.usermessage.data!==undefined){
|
if(this.usermessage!=='' ||this.usermessage.data!==undefined){
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
<Myheader></Myheader>
|
<Myheader></Myheader>
|
||||||
<tabs></tabs>
|
<tabs></tabs>
|
||||||
<div class="online"></div>
|
<div class="online"></div>
|
||||||
|
|
||||||
<div class="rc-main" v-for="(item,index) in goldmedal" :key="index" >
|
<div class="rc-main" v-for="(item,index) in goldmedal" :key="index" >
|
||||||
<div class="rc-border"></div>
|
<div class="rc-border"></div>
|
||||||
<div
|
<div
|
||||||
@ -133,6 +134,21 @@ export default {
|
|||||||
state: "李某某",
|
state: "李某某",
|
||||||
tel: "15124117917",
|
tel: "15124117917",
|
||||||
address: "广东省 广州市 天河区 天河客运站118号",
|
address: "广东省 广州市 天河区 天河客运站118号",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
state: "李某某",
|
||||||
|
tel: "15124117917",
|
||||||
|
address: "广东省 广州市 天河区 天河客运站118号",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
state: "李某某",
|
||||||
|
tel: "15124117917",
|
||||||
|
address: "广东省 广州市 天河区 天河客运站118号",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
state: "李某某",
|
||||||
|
tel: "15124117917",
|
||||||
|
address: "广东省 广州市 天河区 天河客运站118号",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
||||||
@ -197,638 +213,6 @@ jiesuan(){
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
ul li ol li em strong i {
|
@import url("../../assets/css/global.less");
|
||||||
list-style: none;
|
@import url("../../assets/css/settlement.less");
|
||||||
font-style: normal;
|
|
||||||
}
|
|
||||||
.rc-header {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
//手机端
|
|
||||||
@media screen and (max-width: 768px) {
|
|
||||||
.rc-button{
|
|
||||||
position: fixed;
|
|
||||||
bottom: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 0.8rem;
|
|
||||||
background-color: white;
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
box-shadow: 0px -3px 6px rgba(0, 0, 0, 0.1);
|
|
||||||
.rc-left{
|
|
||||||
margin-left: 0.20rem;
|
|
||||||
}
|
|
||||||
span{
|
|
||||||
font-size: 14px;
|
|
||||||
|
|
||||||
color: #333333;
|
|
||||||
}
|
|
||||||
em{
|
|
||||||
font-style: normal;
|
|
||||||
font-size: 0.18rem;
|
|
||||||
color: #E1001A;
|
|
||||||
}
|
|
||||||
strong{
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
height: 0.48rem;
|
|
||||||
background: #E2001A;
|
|
||||||
border-radius: 0.30rem;
|
|
||||||
color: white;
|
|
||||||
width: 1rem;
|
|
||||||
margin-right: 0.2rem
|
|
||||||
;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.rc-main {
|
|
||||||
width: 92%;
|
|
||||||
margin: 0 auto;
|
|
||||||
.rc-userbottom{
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.viewdetails{
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.rc-foo{
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.rc-receiving {
|
|
||||||
width: 100%;
|
|
||||||
height: 80px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
em {
|
|
||||||
font-style: normal;
|
|
||||||
color: #e1001a;
|
|
||||||
font-size: 22px;
|
|
||||||
}
|
|
||||||
span {
|
|
||||||
color: #666666;
|
|
||||||
font-size: 12px;
|
|
||||||
display: block;
|
|
||||||
margin-left: 18px;
|
|
||||||
width: 62%;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.delivery {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
height: 80px;
|
|
||||||
.to-delivery {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
font-style: normal;
|
|
||||||
span {
|
|
||||||
display: block;
|
|
||||||
margin-left: 3px;
|
|
||||||
}
|
|
||||||
i {
|
|
||||||
font-style: normal;
|
|
||||||
margin-left: 8px;
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.bo-delivery {
|
|
||||||
span {
|
|
||||||
font-size: 14px;
|
|
||||||
|
|
||||||
color: #666666;
|
|
||||||
display: block;
|
|
||||||
margin-top: 8px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.mypersonal {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
height: 80px;
|
|
||||||
.my-delivery {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
font-style: normal;
|
|
||||||
span {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
i {
|
|
||||||
font-style: normal;
|
|
||||||
margin-left: 8px;
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.per-delivery {
|
|
||||||
span {
|
|
||||||
font-size: 14px;
|
|
||||||
|
|
||||||
color: #666666;
|
|
||||||
display: block;
|
|
||||||
margin-top: 8px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.rc-usermain {
|
|
||||||
display: flex;
|
|
||||||
.rc-image {
|
|
||||||
border: 1px solid #d8d8d8;
|
|
||||||
margin-top: 17px;
|
|
||||||
height: 96px;
|
|
||||||
img {
|
|
||||||
width: 96px;
|
|
||||||
height: 96px;
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.rc-right {
|
|
||||||
.rc-userbottomm {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
width: 100%;
|
|
||||||
margin-left: 16px;
|
|
||||||
justify-content: center;
|
|
||||||
em {
|
|
||||||
font-style: normal;
|
|
||||||
display: block;
|
|
||||||
font-size: 16px;
|
|
||||||
margin-top: 18px;
|
|
||||||
font-weight: bold;
|
|
||||||
|
|
||||||
color: #e1001a;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.rc-userright {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
color: #666666;
|
|
||||||
font-size: 14px;
|
|
||||||
span {
|
|
||||||
display: block;
|
|
||||||
margin-top: 16px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.rc-userbottom {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
margin-top: 8px;
|
|
||||||
span {
|
|
||||||
color: #666666;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
i {
|
|
||||||
font-style: normal;
|
|
||||||
color: #e1001a;
|
|
||||||
font-size: 18px;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
.rc-bottom{
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.rc-bottomm {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: flex-end;
|
|
||||||
margin-top: 24px;
|
|
||||||
span {
|
|
||||||
display: block;
|
|
||||||
width: 130px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
line-height: 40px;
|
|
||||||
text-align: center;
|
|
||||||
color: #e2001a;
|
|
||||||
height: 40px;
|
|
||||||
font-size: 12px;
|
|
||||||
border: 2px solid #e2001a;
|
|
||||||
justify-content: center;
|
|
||||||
border-radius: 30px;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
span:last-child {
|
|
||||||
margin-left: 15px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.rc-merchandise {
|
|
||||||
width: 100%;
|
|
||||||
margin-top: 32px;
|
|
||||||
|
|
||||||
ul {
|
|
||||||
width: 100%;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: space-between;
|
|
||||||
line-height: 26px;
|
|
||||||
i {
|
|
||||||
font-style: normal;
|
|
||||||
color: #666666;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
li {
|
|
||||||
list-style: none;
|
|
||||||
font-style: normal;
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
span {
|
|
||||||
font-size: 14px;
|
|
||||||
|
|
||||||
color: #333333;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
li:last-child {
|
|
||||||
i {
|
|
||||||
color: #e1001a;
|
|
||||||
font-size: 16px;
|
|
||||||
font-style: normal;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.rc-payment{
|
|
||||||
width: 100%;
|
|
||||||
margin-top: 32px;
|
|
||||||
.u-trackingnumber{
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
i {
|
|
||||||
font-size: 14px;
|
|
||||||
font-style: normal;
|
|
||||||
margin-right: 16px;
|
|
||||||
|
|
||||||
}
|
|
||||||
img{
|
|
||||||
width: 8px;
|
|
||||||
height: 16px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ul {
|
|
||||||
width: 100%;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: space-between;
|
|
||||||
line-height: 26px;
|
|
||||||
i {
|
|
||||||
font-style: normal;
|
|
||||||
color: #666666;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
li {
|
|
||||||
list-style: none;
|
|
||||||
font-style: normal;
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
span {
|
|
||||||
font-size: 14px;
|
|
||||||
|
|
||||||
color: #333333;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//pc端
|
|
||||||
@media screen and (min-width: 768px) and (max-width: 1920px) {
|
|
||||||
|
|
||||||
.rc-main {
|
|
||||||
width: 92%;
|
|
||||||
margin: 0 auto;
|
|
||||||
.rc-userbottomm{
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.rc-border{
|
|
||||||
width: 100%;
|
|
||||||
border-bottom: 1px solid #D7D7D7;
|
|
||||||
margin-top: 32px;
|
|
||||||
}
|
|
||||||
.rc-receiving {
|
|
||||||
width: 100%;
|
|
||||||
height: 80px;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
em {
|
|
||||||
font-style: normal;
|
|
||||||
color: #E1001A;
|
|
||||||
font-size: 26px;
|
|
||||||
}
|
|
||||||
span {
|
|
||||||
color: #666666;
|
|
||||||
font-size: 16px;
|
|
||||||
display: block;
|
|
||||||
margin-top: 25px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.delivery {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
height: 140px;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
.viewdetails{
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: flex-end;
|
|
||||||
span{
|
|
||||||
color:#444444;
|
|
||||||
font-size: 18px;
|
|
||||||
display: block;
|
|
||||||
margin-right: 8px;
|
|
||||||
}
|
|
||||||
img{
|
|
||||||
width: 8px;
|
|
||||||
height: 16px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.to-delivery {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
font-style: normal;
|
|
||||||
span {
|
|
||||||
display: block;
|
|
||||||
// margin-left: 16px;
|
|
||||||
font-size: 18px;
|
|
||||||
color: #333333;
|
|
||||||
}
|
|
||||||
i {
|
|
||||||
font-style: normal;
|
|
||||||
margin-left: 8px;
|
|
||||||
display: block;
|
|
||||||
font-size: 18px;
|
|
||||||
color: #999999;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.bo-delivery {
|
|
||||||
span {
|
|
||||||
font-size: 16px;
|
|
||||||
color: #666666;
|
|
||||||
display: block;
|
|
||||||
margin-top: 16px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.mypersonal {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
height: 140px;
|
|
||||||
justify-content: center;
|
|
||||||
.my-delivery {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
font-style: normal;
|
|
||||||
span {
|
|
||||||
display: block;
|
|
||||||
margin-left: 3px;
|
|
||||||
font-size: 18px;
|
|
||||||
color: #333333;
|
|
||||||
}
|
|
||||||
i {
|
|
||||||
font-style: normal;
|
|
||||||
margin-left: 8px;
|
|
||||||
display: block;
|
|
||||||
font-size: 18px;
|
|
||||||
color: #333333;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.per-delivery {
|
|
||||||
span {
|
|
||||||
font-size: 18px;
|
|
||||||
color: #666666;
|
|
||||||
display: block;
|
|
||||||
margin-top: 16px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.rc-usermain {
|
|
||||||
display: flex;
|
|
||||||
.rc-image {
|
|
||||||
border: 1px solid #d8d8d8;
|
|
||||||
margin-top: 17px;
|
|
||||||
img {
|
|
||||||
width: 96px;
|
|
||||||
height: 96px;
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.rc-right {
|
|
||||||
.rc-bottomm{
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.rc-usercenter{
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
flex-direction: column;
|
|
||||||
em {
|
|
||||||
font-style: normal;
|
|
||||||
display: block;
|
|
||||||
font-size: 18px;
|
|
||||||
font-weight: bold;
|
|
||||||
margin-top: 17px;
|
|
||||||
color: #e1001a;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
display: flex;
|
|
||||||
|
|
||||||
width: 100%;
|
|
||||||
margin-left: 16px;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
.rc-userright {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
color: #666666;
|
|
||||||
font-size: 16px;
|
|
||||||
span {
|
|
||||||
display: block;
|
|
||||||
margin-top: 16px;
|
|
||||||
font-size: 16px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.rc-userbottom {
|
|
||||||
display: flex;
|
|
||||||
|
|
||||||
width: 80%;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
margin-left: 119px;
|
|
||||||
span {
|
|
||||||
color: #E1001A;
|
|
||||||
font-size: 20px;
|
|
||||||
}
|
|
||||||
i {
|
|
||||||
font-style: normal;
|
|
||||||
color: #e1001a;
|
|
||||||
font-size: 20px;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
.rc-bottom {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: flex-end;
|
|
||||||
margin-top: 24px;
|
|
||||||
span {
|
|
||||||
display: block;
|
|
||||||
width: 164px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
line-height: 40px;
|
|
||||||
text-align: center;
|
|
||||||
color: #e2001a;
|
|
||||||
height: 40px;
|
|
||||||
border: 2px solid #e2001a;
|
|
||||||
justify-content: center;
|
|
||||||
border-radius: 30px;
|
|
||||||
font-weight: bold;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.rc-merchandise {
|
|
||||||
width: 100%;
|
|
||||||
margin-top: 32px;
|
|
||||||
|
|
||||||
ul {
|
|
||||||
width: 100%;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: space-between;
|
|
||||||
line-height: 40px;
|
|
||||||
font-size: 18px;
|
|
||||||
i {
|
|
||||||
font-style: normal;
|
|
||||||
color: #666666;
|
|
||||||
|
|
||||||
}
|
|
||||||
li {
|
|
||||||
list-style: none;
|
|
||||||
font-style: normal;
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
span {
|
|
||||||
color: #333333;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
li:last-child {
|
|
||||||
i {
|
|
||||||
color: #e1001a;
|
|
||||||
font-size: 20px;
|
|
||||||
font-style: normal;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.rc-payment{
|
|
||||||
width: 100%;
|
|
||||||
margin-top: 80px;
|
|
||||||
.u-trackingnumber{
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
i {
|
|
||||||
font-size: 18px;
|
|
||||||
font-style: normal;
|
|
||||||
margin-right: 16px;
|
|
||||||
|
|
||||||
}
|
|
||||||
img{
|
|
||||||
width: 8px;
|
|
||||||
height: 16px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ul {
|
|
||||||
width: 100%;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: space-between;
|
|
||||||
line-height: 40px;
|
|
||||||
font-size: 18px;
|
|
||||||
i {
|
|
||||||
font-style: normal;
|
|
||||||
color: #666666;
|
|
||||||
display: block;
|
|
||||||
|
|
||||||
}
|
|
||||||
li {
|
|
||||||
list-style: none;
|
|
||||||
font-style: normal;
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
span {
|
|
||||||
|
|
||||||
|
|
||||||
color: #333333;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.rc-foot{
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
.rc-foo{
|
|
||||||
display: flex;
|
|
||||||
justify-content: flex-end;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: self-end;
|
|
||||||
i{
|
|
||||||
font-style: normal;
|
|
||||||
color:#333333;
|
|
||||||
font-size: 20px;
|
|
||||||
margin-right: 20px;
|
|
||||||
|
|
||||||
}
|
|
||||||
em{
|
|
||||||
font-style: normal;
|
|
||||||
color: #E1001A;
|
|
||||||
font-size: 26px;
|
|
||||||
|
|
||||||
}
|
|
||||||
span{
|
|
||||||
display: block;
|
|
||||||
width: 164px;
|
|
||||||
margin-top: 36px;
|
|
||||||
background: #E2001A;
|
|
||||||
line-height: 48px;
|
|
||||||
text-align: center;
|
|
||||||
color: white;
|
|
||||||
font-size: 16px;
|
|
||||||
|
|
||||||
height: 48px;
|
|
||||||
|
|
||||||
border-radius: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
@ -1,7 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<Myheader></Myheader>
|
<Myheader></Myheader>
|
||||||
|
|
||||||
<div class="rc-top"></div>
|
<div class="rc-top"></div>
|
||||||
<div class="rc-max-width--xl rc-main">
|
<div class="rc-max-width--xl rc-main">
|
||||||
<div class="usersearch">
|
<div class="usersearch">
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<Myheader></Myheader>
|
<Myheader></Myheader>
|
||||||
<div class="rc-top">
|
<div class="rc-top"></div>
|
||||||
|
<div class="rc-max-width--xl rc-main">
|
||||||
<div class="rc-main">
|
|
||||||
<div class="usersearch">
|
<div class="usersearch">
|
||||||
<div class="form-search">
|
<div class="form-search">
|
||||||
<van-search
|
<van-search
|
||||||
@ -18,193 +17,204 @@
|
|||||||
</template>
|
</template>
|
||||||
</van-search>
|
</van-search>
|
||||||
</div>
|
</div>
|
||||||
<div class="rc-title">
|
<div class="rc-max-width--xl rc-title">
|
||||||
<h2>热门搜索</h2>
|
<strong>热门搜索</strong>
|
||||||
<span class="rc-change">换一批</span>
|
<span class="rc-change">换一批</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="rc-variety">
|
<div class="rc-max-width--xl rc-variety">
|
||||||
<ul>
|
<ul>
|
||||||
<li v-for="(item, index) in searchdata" :key="index" @click="selectsearch(item, index)" :class="activeIndexa == index ? 'active' : 'unactive'">
|
<li v-for="(item, index) in searchdata" :key="index" @click="selectsearch(item, index)" :class="activeIndexa == index ? 'active' : 'unactive'">
|
||||||
{{ item.title }}
|
{{ item.title }}
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="usersearch">
|
||||||
<div class="usercontentshow" ref="usercontent">
|
<div class="usercontentshow" ref="usercontent">
|
||||||
<div class="rc-product">
|
|
||||||
<h2>我想搜</h2>
|
<div class="usercontentshow rc-product">
|
||||||
|
<strong>我想搜</strong>
|
||||||
<div class="rc-productcat ts-scrollable">
|
<div class="rc-productcat ts-scrollable">
|
||||||
<div class="rc-cat" v-for="(item, index) in userproduct" :key="index" @click="selectGoods(item, index)" :class="activeIndex == index ? 'active' : 'unactive'" >
|
<ol>
|
||||||
<img :src="item.catimage" alt="" />
|
<li v-for="(item, index) in userproduct" :key="index" @click="selectGoods(item, index)" :class="activeIndex == index ? 'active' : 'unactive'" class="ts-standard-btn" ref="userstandard">
|
||||||
|
<img :src="item.catimage" alt="" />
|
||||||
<span>{{ item.title }}</span>
|
<span>{{ item.title }}</span>
|
||||||
</div>
|
</li>
|
||||||
<div class="rc-productright" @click="userselect">
|
|
||||||
|
</ol>
|
||||||
|
<div class="rc-productcat userselect" @click="userselect" >
|
||||||
<img src="../../assets/image/rc-usericon.png" alt="" />
|
<img src="../../assets/image/rc-usericon.png" alt="" />
|
||||||
<span @click="usershow()">筛选</span>
|
<span @click="usershow()">筛选</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="rc-age">
|
<div class="ts-scrollable-container">
|
||||||
<h2>专区:</h2>
|
<strong>专区:</strong>
|
||||||
<ol class="ts-scrollable">
|
<ol class="ts-scrollable">
|
||||||
<li v-for="(item, index) in prefecture" :key="index" @click="selectproduct(item, index)" :class="activeIndexb == index ? 'active' : 'unactive'" >
|
<li v-for="(item, index) in prefecture" :key="index" @click="selectproduct(item, index)" :class="activeIndexb == index ? 'active' : 'unactive'" >
|
||||||
{{ item.tagName }}
|
{{ item.tagName }}
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="rc-age">
|
<div class="ts-scrollable-container">
|
||||||
<h2>年龄:</h2>
|
<strong>年龄:</strong>
|
||||||
<ol class="ts-scrollable">
|
<ol class="ts-scrollable">
|
||||||
<li v-for="(item, index) in catage" :key="index" @click="selectage(item, index)" :class="activeIndexc == index ? 'active' : 'unactive'">
|
<li v-for="(item, index) in catage" :key="index" @click="selectage(item, index)" :class="activeIndexc == index ? 'active' : 'unactive'">
|
||||||
{{ item.tagName }}
|
{{ item.tagName }}
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="rc-contair">
|
|
||||||
<ul>
|
|
||||||
<li v-for="(item,index) in rccontair" :key="index">
|
|
||||||
<div class="rc-click" @click="selectproduce(item)">
|
|
||||||
<div class="rc-rccontair">
|
|
||||||
<img :src=item.picture alt="">
|
|
||||||
</div>
|
|
||||||
<span>{{item.name}}</span>
|
|
||||||
<i>{{item.price}}</i>
|
|
||||||
</div>
|
|
||||||
<strong @click="userbuy()">立即购买</strong>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="usershow" v-if="openshow">
|
|
||||||
<div class="rc-show">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="online"></div>
|
||||||
</div>
|
<!-- rc-main start -->
|
||||||
<div v-if="isadrond">
|
<div class="rc-max-width--xl">
|
||||||
|
<div class="usersearch">
|
||||||
|
<div class="rc-contair">
|
||||||
|
<ul class="ts-product-list">
|
||||||
|
<li v-for="(item,index) in rccontair" :key="index" class="rc-margin-top--md">
|
||||||
|
<div class="rc-click rc-margin-bottom--md" @click="selectproduce(item)">
|
||||||
|
<div class="rc-rccontair">
|
||||||
|
<img :src=item.picture alt="">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="rc-column">
|
||||||
|
<div class="rc-click" @click="selectproduce(item)">
|
||||||
|
<span>{{item.categoryName}}</span>
|
||||||
|
<i>0.001{{item.price}}</i>
|
||||||
|
</div>
|
||||||
|
<strong class="ts-standard-btn ts-standard-btn--two rc-margin-y--md center" @click="userbuy()">立即购买</strong>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="usershow" v-if="openshow">
|
||||||
|
<div class="rc-show"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-if="isadrond" class="useronshow">
|
||||||
<div class="rc-mubu" v-if="isshow" @click="usershow()">
|
<div class="rc-mubu" v-if="isshow" @click="usershow()">
|
||||||
</div>
|
</div>
|
||||||
<div class="rc-bottom rc-main" v-if="isshow">
|
<div class="rc-bottom rc-full-width" v-if="isshow">
|
||||||
<div class="rc-bottoma" >
|
<div class="usersearch">
|
||||||
|
<div class="usercontentshow rc-column" ref="usercontent">
|
||||||
|
<div class="usercontentshow rc-product">
|
||||||
<div class="rc-productcat ts-scrollable">
|
<div class="rc-productcat ts-scrollable">
|
||||||
<div class="rc-cat" v-for="(item, index) in userproduct" :key="index" @click="selectGoods(item, index)" :class="activeIndex1 == index ? 'active' : 'unactive'" >
|
<ol>
|
||||||
<img :src="item.catimage" alt="" />
|
<li v-for="(item, index) in userproduct" :key="index" @click="selectGoods(item, index)" :class="activeIndex == index ? 'active' : 'unactive'" class="ts-standard-btn" ref="userstandard">
|
||||||
|
<img :src="item.catimage" alt="" />
|
||||||
<span>{{ item.title }}</span>
|
<span>{{ item.title }}</span>
|
||||||
</div>
|
</li>
|
||||||
|
|
||||||
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
<div class="rc-age">
|
|
||||||
<h2>专区:</h2>
|
|
||||||
<ol class="ts-scrollable">
|
|
||||||
<li v-for="(item, index) in prefecture" :key="index" @click="selectproduct(item, index)" :class="activeIndexb == index ? 'active' : 'unactive'" >
|
|
||||||
{{ item.tagName }}
|
|
||||||
</li>
|
|
||||||
</ol>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="rc-age">
|
<div class="ts-scrollable-container">
|
||||||
<h2>年龄:</h2>
|
<strong>专区:</strong>
|
||||||
<ol class="ts-scrollable">
|
<ol class="ts-scrollable">
|
||||||
<li v-for="(item, index) in catage" :key="index" @click="selectage(item, index)" :class="activeIndexc == index ? 'active' : 'unactive'">
|
<li v-for="(item, index) in prefecture" :key="index" @click="selectproduct(item, index)" :class="activeIndexb == index ? 'active' : 'unactive'" >
|
||||||
{{ item.tagName }}
|
{{ item.tagName }}
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
|
||||||
<div class="rc-age">
|
|
||||||
<h2>功能:</h2>
|
|
||||||
<ol class="ts-scrollable">
|
|
||||||
<li v-for="(item, index) in catagea" :key="index" @click="selectagc(item, index)" :class="activeIndexd == index ? 'active' : 'unactive'">
|
|
||||||
{{ item.tagName }}
|
|
||||||
</li>
|
|
||||||
</ol>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="rc-age">
|
<div class="ts-scrollable-container">
|
||||||
<h2>品种:</h2>
|
<strong>年龄:</strong>
|
||||||
<ol class="ts-scrollable">
|
<ol class="ts-scrollable">
|
||||||
<li v-for="(item, index) in catageb" :key="index" @click="selectagd(item, index)" :class="activeIndexe == index ? 'active' : 'unactive'">
|
<li v-for="(item, index) in catage" :key="index" @click="selectage(item, index)" :class="activeIndexc == index ? 'active' : 'unactive'">
|
||||||
{{ item.tagName }}
|
{{ item.tagName }}
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="ts-scrollable-container">
|
||||||
<div class="rc-footer">
|
<strong>功能:</strong>
|
||||||
|
<ol class="ts-scrollable">
|
||||||
<span @click="usershow()">取消</span>
|
<li v-for="(item, index) in catagea" :key="index" @click="selectagc(item, index)" :class="activeIndexd == index ? 'active' : 'unactive'">
|
||||||
<em @click="usershow()">确定</em>
|
{{ item.tagName }}
|
||||||
</div>
|
</li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
<div class="ts-scrollable-container">
|
||||||
|
<strong>品种:</strong>
|
||||||
|
<ol class="ts-scrollable">
|
||||||
|
<li v-for="(item, index) in catageb" :key="index" @click="selectagd(item, index)" :class="activeIndexe == index ? 'active' : 'unactive'">
|
||||||
|
{{ item.tagName }}
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-dialog
|
<el-dialog
|
||||||
:visible.sync="dialogInfo1"
|
:visible.sync="dialogInfo1"
|
||||||
hegight="700px"
|
hegight="700px"
|
||||||
|
|
||||||
v-if="!isadrond"
|
v-if="!isadrond"
|
||||||
>
|
>
|
||||||
|
<div class="usersearch">
|
||||||
<div class="rc-bottom">
|
<div class="usercontentshow" ref="usercontent">
|
||||||
<div class="rc-bottoma" >
|
<div class="usercontentshow rc-product">
|
||||||
<div class="rc-productcat">
|
<div class="rc-productcat ts-scrollable">
|
||||||
<div class="rc-cat" v-for="(item, index) in userproduct" :key="index" @click="selectGoodsa(item, index)" :class="activeIndex1 == index ? 'active' : 'unactive'" >
|
<ol>
|
||||||
<img :src="item.catimage" alt="" />
|
<li v-for="(item, index) in userproduct" :key="index" @click="selectGoods(item, index)" :class="activeIndex == index ? 'active' : 'unactive'" class="ts-standard-btn" ref="userstandard">
|
||||||
<span>{{ item.name }}</span>
|
<img :src="item.catimage" alt="" />
|
||||||
</div>
|
<span>{{ item.title }}</span>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
<div class="rc-age">
|
</div>
|
||||||
<h2>专区:</h2>
|
<div class="ts-scrollable-container">
|
||||||
<ol>
|
<strong>专区:</strong>
|
||||||
<li v-for="(item, index) in prefecture" :key="index" @click="selectproduct(item, index)" :class="activeIndexb == index ? 'active' : 'unactive'" >
|
<ol class="ts-scrollable">
|
||||||
{{ item.title }}
|
<li v-for="(item, index) in prefecture" :key="index" @click="selectproduct(item, index)" :class="activeIndexb == index ? 'active' : 'unactive'" >
|
||||||
</li>
|
{{ item.tagName }}
|
||||||
</ol>
|
</li>
|
||||||
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="rc-age">
|
<div class="ts-scrollable-container">
|
||||||
<h2>年龄:</h2>
|
<strong>年龄:</strong>
|
||||||
<ol>
|
<ol class="ts-scrollable">
|
||||||
<li v-for="(item, index) in catage" :key="index" @click="selectage(item, index)" :class="activeIndexc == index ? 'active' : 'unactive'">
|
<li v-for="(item, index) in catage" :key="index" @click="selectage(item, index)" :class="activeIndexc == index ? 'active' : 'unactive'">
|
||||||
{{ item.title }}
|
{{ item.tagName }}
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
<div class="rc-age">
|
<div class="ts-scrollable-container">
|
||||||
<h2>功能:</h2>
|
<strong>功能:</strong>
|
||||||
<ol>
|
<ol class="ts-scrollable">
|
||||||
<li v-for="(item, index) in catagea" :key="index" @click="selectagc(item, index)" :class="activeIndexd == index ? 'active' : 'unactive'">
|
<li v-for="(item, index) in catagea" :key="index" @click="selectagc(item, index)" :class="activeIndexd == index ? 'active' : 'unactive'">
|
||||||
{{ item.title }}
|
{{ item.tagName }}
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="ts-scrollable-container">
|
||||||
<div class="rc-age">
|
<strong>品种:</strong>
|
||||||
<h2>品种:</h2>
|
<ol class="ts-scrollable">
|
||||||
<ol>
|
<li v-for="(item, index) in catageb" :key="index" @click="selectagd(item, index)" :class="activeIndexe == index ? 'active' : 'unactive'">
|
||||||
<li v-for="(item, index) in catageb" :key="index" @click="selectagd(item, index)" :class="activeIndexe == index ? 'active' : 'unactive'">
|
{{ item.tagName }}
|
||||||
{{ item.title }}
|
</li>
|
||||||
</li>
|
</ol>
|
||||||
</ol>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="rc-button">
|
<div class="rc-button">
|
||||||
<span @click="openclose()">取消</span>
|
<span @click="openclose()">取消</span>
|
||||||
<em>确认</em>
|
<em>确认</em>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!-- rc-main end -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -448,6 +458,10 @@ this.userst();
|
|||||||
},
|
},
|
||||||
|
|
||||||
async usetmessage() {
|
async usetmessage() {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.userstandard[0].style.margin=0 + 'px'
|
||||||
|
})
|
||||||
|
|
||||||
let data = await biaome(this.value,10);
|
let data = await biaome(this.value,10);
|
||||||
if(data){
|
if(data){
|
||||||
this.rccontair=data;
|
this.rccontair=data;
|
||||||
@ -503,7 +517,7 @@ this.dialogInfo1=false;
|
|||||||
|
|
||||||
this.isadrond=true;
|
this.isadrond=true;
|
||||||
this.isshow=true;
|
this.isshow=true;
|
||||||
this.$refs.usercontent.style.display='none ';
|
// this.$refs.usercontent.style.display='none ';
|
||||||
this.dialogInfo1=false;
|
this.dialogInfo1=false;
|
||||||
|
|
||||||
})
|
})
|
||||||
@ -645,7 +659,7 @@ this.dialogInfo1=false;
|
|||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.isshow=false;
|
this.isshow=false;
|
||||||
// dom元素更新后执行,因此这里能正确打印更改之后的值
|
// dom元素更新后执行,因此这里能正确打印更改之后的值
|
||||||
this.$refs.usercontent.style.display='block ';
|
// this.$refs.usercontent.style.display='block ';
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -683,7 +697,7 @@ this.dialogInfo1=false;
|
|||||||
console.log(this.userserachlist);
|
console.log(this.userserachlist);
|
||||||
}
|
}
|
||||||
this.usersearch(this.userserachlist)
|
this.usersearch(this.userserachlist)
|
||||||
this.activeIndexd=index;
|
this.activeIndexd=index;
|
||||||
},
|
},
|
||||||
selectagd(item, index) {
|
selectagd(item, index) {
|
||||||
console.log(item)
|
console.log(item)
|
||||||
|
@ -29,6 +29,15 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
<!--JWT-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.auth0</groupId>
|
||||||
|
<artifactId>java-jwt</artifactId>
|
||||||
|
<version>3.8.2</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-aop</artifactId>
|
<artifactId>spring-boot-starter-aop</artifactId>
|
||||||
|
@ -1,47 +1,25 @@
|
|||||||
package net.lab1024.smartadmin.module.system.royalcanin;
|
package net.lab1024.smartadmin.module.system.royalcanin;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import eu.bitwalker.useragentutils.UserAgent;
|
|
||||||
import io.jsonwebtoken.Claims;
|
|
||||||
import io.jsonwebtoken.Jwts;
|
|
||||||
import io.jsonwebtoken.SignatureAlgorithm;
|
|
||||||
import net.lab1024.smartadmin.common.constant.JudgeEnum;
|
|
||||||
import net.lab1024.smartadmin.common.heartbeat.StringUtil;
|
import net.lab1024.smartadmin.common.heartbeat.StringUtil;
|
||||||
import net.lab1024.smartadmin.module.business.log.LogService;
|
|
||||||
import net.lab1024.smartadmin.module.business.log.userloginlog.domain.UserLoginLogEntity;
|
|
||||||
import net.lab1024.smartadmin.module.system.royalcanin.member.*;
|
import net.lab1024.smartadmin.module.system.royalcanin.member.*;
|
||||||
import net.lab1024.smartadmin.util.MapRemoveNullUtil;
|
import net.lab1024.smartadmin.util.MapRemoveNullUtil;
|
||||||
|
import net.lab1024.smartadmin.util.SmartJWTUtil;
|
||||||
import net.lab1024.smartadmin.util.SmartHttpUtil;
|
import net.lab1024.smartadmin.util.SmartHttpUtil;
|
||||||
import net.lab1024.smartadmin.util.SmartIPUtil;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.ZoneId;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class MemberService {
|
public class MemberService {
|
||||||
private String url = "http://miniapp-test.royalcanin.com.cn:7080/crm/member/";
|
private String url = "http://miniapp-test.royalcanin.com.cn:7080/crm/member/";
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private LogService logService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 过期时间一天
|
|
||||||
*/
|
|
||||||
private static final int EXPIRE_SECONDS = 1 * 24 * 3600;
|
|
||||||
/**
|
|
||||||
* jwt加密字段
|
|
||||||
*/
|
|
||||||
private static final String CLAIM_ID_KEY = "id";
|
|
||||||
|
|
||||||
@Value("${jwt.key}")
|
|
||||||
private String jwtKey;
|
|
||||||
|
|
||||||
|
|
||||||
public String memberGet(MemberGetEntity memberGetEntity, HttpServletRequest request)throws Exception {
|
public String memberGet(MemberGetEntity memberGetEntity, HttpServletRequest request)throws Exception {
|
||||||
Map<String, String> paramMap = MapRemoveNullUtil.setConditionMap(memberGetEntity);
|
Map<String, String> paramMap = MapRemoveNullUtil.setConditionMap(memberGetEntity);
|
||||||
@ -52,7 +30,7 @@ public class MemberService {
|
|||||||
if(jsonObject.getString("code").equals("0")){
|
if(jsonObject.getString("code").equals("0")){
|
||||||
JSONObject json = JSONObject.parseObject(jsonObject.getString("data"));
|
JSONObject json = JSONObject.parseObject(jsonObject.getString("data"));
|
||||||
String id = json.getString("id");
|
String id = json.getString("id");
|
||||||
jsonObject.put("xaccessToken",generateToken(id));
|
jsonObject.put("xaccessToken", SmartJWTUtil.generateToken(id));
|
||||||
return jsonObject.toJSONString();
|
return jsonObject.toJSONString();
|
||||||
}else {
|
}else {
|
||||||
return sb;
|
return sb;
|
||||||
@ -83,7 +61,7 @@ public class MemberService {
|
|||||||
return SmartHttpUtil.httpPostRaw(url+"check",jsonObject.toString(),null,"utf-8");
|
return SmartHttpUtil.httpPostRaw(url+"check",jsonObject.toString(),null,"utf-8");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String memberUpdate(MemberUpdateEntity memberUpdateEntity)throws Exception{
|
public String memberUpdate(MemberUpdateEntity memberUpdateEntity){
|
||||||
Map<String, String> paramMap = MapRemoveNullUtil.setConditionMap(memberUpdateEntity);
|
Map<String, String> paramMap = MapRemoveNullUtil.setConditionMap(memberUpdateEntity);
|
||||||
paramMap.put("id",StringUtil.toString(memberUpdateEntity.getId()).equals("0")?null:StringUtil.toString(memberUpdateEntity.getId()));
|
paramMap.put("id",StringUtil.toString(memberUpdateEntity.getId()).equals("0")?null:StringUtil.toString(memberUpdateEntity.getId()));
|
||||||
paramMap.put("cityId",StringUtil.toString(memberUpdateEntity.getCityId()).equals("0")?null:StringUtil.toString(memberUpdateEntity.getCityId()));
|
paramMap.put("cityId",StringUtil.toString(memberUpdateEntity.getCityId()).equals("0")?null:StringUtil.toString(memberUpdateEntity.getCityId()));
|
||||||
@ -94,25 +72,7 @@ public class MemberService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 功能描述: 生成JWT TOKEN
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
* @auther Carl
|
|
||||||
* @date 2021/12/8 0012
|
|
||||||
*/
|
|
||||||
public String generateToken(String UserId) {
|
|
||||||
Long id = Long.parseLong(UserId);
|
|
||||||
/**将token设置为jwt格式*/
|
|
||||||
String baseToken = UUID.randomUUID().toString();
|
|
||||||
LocalDateTime localDateTimeNow = LocalDateTime.now();
|
|
||||||
LocalDateTime localDateTimeExpire = localDateTimeNow.plusSeconds(EXPIRE_SECONDS);
|
|
||||||
Date from = Date.from(localDateTimeNow.atZone(ZoneId.systemDefault()).toInstant());
|
|
||||||
Date expire = Date.from(localDateTimeExpire.atZone(ZoneId.systemDefault()).toInstant());
|
|
||||||
|
|
||||||
Claims jwtClaims = Jwts.claims().setSubject(baseToken);
|
|
||||||
jwtClaims.put(CLAIM_ID_KEY, id);
|
|
||||||
String compactJws = Jwts.builder().setClaims(jwtClaims).setNotBefore(from).setExpiration(expire).signWith(SignatureAlgorithm.HS512, jwtKey).compact();
|
|
||||||
return compactJws;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,9 @@ public class SMSController {
|
|||||||
String tamp = requestMap.get("tamp").toString();
|
String tamp = requestMap.get("tamp").toString();
|
||||||
String msgNum = requestMap.get("msgNum").toString();
|
String msgNum = requestMap.get("msgNum").toString();
|
||||||
String hash = MD5Utils.getMD5Code(KEY + "@" + tamp + "@" + msgNum);
|
String hash = MD5Utils.getMD5Code(KEY + "@" + tamp + "@" + msgNum);
|
||||||
|
if(tamp == "")
|
||||||
|
return ResponseDTO.wrap(OrderResponseCodeConst.SMS_FAIL);
|
||||||
|
|
||||||
if (tamp.compareTo(currentTime) > 0) {
|
if (tamp.compareTo(currentTime) > 0) {
|
||||||
if (hash.equalsIgnoreCase(requestHash)){
|
if (hash.equalsIgnoreCase(requestHash)){
|
||||||
//校验成功
|
//校验成功
|
||||||
|
@ -17,11 +17,13 @@ import net.lab1024.smartadmin.module.system.royalcanin.good.model.ProductMasterQ
|
|||||||
import net.lab1024.smartadmin.module.system.royalcanin.good.model.ProductQueryEntity;
|
import net.lab1024.smartadmin.module.system.royalcanin.good.model.ProductQueryEntity;
|
||||||
import net.lab1024.smartadmin.module.system.royalcanin.good.service.CartService;
|
import net.lab1024.smartadmin.module.system.royalcanin.good.service.CartService;
|
||||||
import net.lab1024.smartadmin.module.system.royalcanin.good.service.GoodService;
|
import net.lab1024.smartadmin.module.system.royalcanin.good.service.GoodService;
|
||||||
|
import net.lab1024.smartadmin.util.SmartJWTUtil;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -33,6 +35,8 @@ public class GoodController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private RoyalcaninOperateLogService royalcaninOperateLogService;
|
private RoyalcaninOperateLogService royalcaninOperateLogService;
|
||||||
|
|
||||||
|
public static final String TOKEN_NAME = "x-access-token";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private CartService cartService;
|
private CartService cartService;
|
||||||
|
|
||||||
@ -119,18 +123,19 @@ public class GoodController {
|
|||||||
|
|
||||||
@ApiOperation(value = "查询购物车信息", notes = "查询购物车信息")
|
@ApiOperation(value = "查询购物车信息", notes = "查询购物车信息")
|
||||||
@PostMapping("royalcanin/getCartProductInfo")
|
@PostMapping("royalcanin/getCartProductInfo")
|
||||||
public List<CartEntity> getCartProductInfo(String memberId){
|
public List<CartEntity> getCartProductInfo(HttpServletRequest request){
|
||||||
|
String memberId = SmartJWTUtil.decodeToken(request.getHeader(TOKEN_NAME));
|
||||||
return cartService.getAllProductbyMember(memberId);
|
return cartService.getAllProductbyMember(memberId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "删除购物车信息", notes = "删除购物车信息")
|
@ApiOperation(value = "删除购物车信息", notes = "删除购物车信息")
|
||||||
@PostMapping("royalcanin/cancelCartProductInfo")
|
@PostMapping("royalcanin/cancelCartProductInfo")
|
||||||
public ResponseDTO<String> cancelCartProductInfo(String memberId,@RequestBody List<String> productCode){
|
public ResponseDTO<String> cancelCartProductInfo(HttpServletRequest request, @RequestBody List<String> productCode){
|
||||||
|
String memberId = SmartJWTUtil.decodeToken(request.getHeader(TOKEN_NAME));
|
||||||
for (int i = 0 ;i < productCode.size();i++) {
|
for (int i = 0 ;i < productCode.size();i++) {
|
||||||
cartService.cancelProduct(memberId,productCode.get(i));
|
cartService.cancelProduct(memberId,productCode.get(i));
|
||||||
}
|
}
|
||||||
return ResponseDTO.succ();
|
return ResponseDTO.succ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ public class MemberAddressAddEntity {
|
|||||||
/**
|
/**
|
||||||
* 会员ID
|
* 会员ID
|
||||||
*/
|
*/
|
||||||
private int memberId;
|
private String memberId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 省份ID
|
* 省份ID
|
||||||
@ -24,12 +24,12 @@ public class MemberAddressAddEntity {
|
|||||||
/**
|
/**
|
||||||
* 城市ID
|
* 城市ID
|
||||||
*/
|
*/
|
||||||
private int cityId;
|
private String cityId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 区ID
|
* 区ID
|
||||||
*/
|
*/
|
||||||
private int districtId;
|
private String districtId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 地址
|
* 地址
|
||||||
|
@ -16,7 +16,7 @@ public class MemberAddressDeleteEntity {
|
|||||||
/**
|
/**
|
||||||
* 会员ID
|
* 会员ID
|
||||||
*/
|
*/
|
||||||
private int memberId;
|
private String memberId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 宠物ID
|
* 宠物ID
|
||||||
|
@ -19,5 +19,5 @@ public class MemberAddressGetAllEntity {
|
|||||||
/**
|
/**
|
||||||
* 会员ID
|
* 会员ID
|
||||||
*/
|
*/
|
||||||
private int memberId;
|
private String memberId;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ public class MemberAddressUpdateEntity {
|
|||||||
/**
|
/**
|
||||||
* 会员ID
|
* 会员ID
|
||||||
*/
|
*/
|
||||||
private int memberId;
|
private String memberId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 会员地址ID
|
* 会员地址ID
|
||||||
@ -32,12 +32,12 @@ public class MemberAddressUpdateEntity {
|
|||||||
/**
|
/**
|
||||||
* 城市ID
|
* 城市ID
|
||||||
*/
|
*/
|
||||||
private int cityId;
|
private String cityId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 区ID
|
* 区ID
|
||||||
*/
|
*/
|
||||||
private int districtId;
|
private String districtId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 地址
|
* 地址
|
||||||
|
@ -0,0 +1,85 @@
|
|||||||
|
package net.lab1024.smartadmin.util;
|
||||||
|
|
||||||
|
import com.auth0.jwt.JWT;
|
||||||
|
import com.auth0.jwt.JWTVerifier;
|
||||||
|
import com.auth0.jwt.algorithms.Algorithm;
|
||||||
|
import com.auth0.jwt.exceptions.JWTVerificationException;
|
||||||
|
import com.auth0.jwt.interfaces.DecodedJWT;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class SmartJWTUtil {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 过期时间一天
|
||||||
|
*/
|
||||||
|
private static final int EXPIRE_SECONDS = 1 * 24 * 3600;
|
||||||
|
/**
|
||||||
|
* jwt加密字段
|
||||||
|
*/
|
||||||
|
private static final String CLAIM_ID_KEY = "id";
|
||||||
|
|
||||||
|
//设置过期时间
|
||||||
|
private static final long EXPIRE_DATE = 30 * 60 * 100000;
|
||||||
|
//token秘钥
|
||||||
|
private static final String TOKEN_SECRET = "smart-admin-jwt-key";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static String generateToken(String userId) {
|
||||||
|
String token;
|
||||||
|
try {
|
||||||
|
//过期时间
|
||||||
|
Date date = new Date(System.currentTimeMillis() + EXPIRE_DATE);
|
||||||
|
//秘钥及加密算法
|
||||||
|
Algorithm algorithm = Algorithm.HMAC256(TOKEN_SECRET);
|
||||||
|
//设置头部信息
|
||||||
|
Map<String, Object> header = new HashMap<>();
|
||||||
|
header.put("typ", "JWT");
|
||||||
|
header.put("alg", "HS256");
|
||||||
|
//携带UserId信息,生成签名
|
||||||
|
token = JWT.create()
|
||||||
|
.withHeader(header)
|
||||||
|
.withClaim(CLAIM_ID_KEY, userId)
|
||||||
|
.withExpiresAt(date)
|
||||||
|
.sign(algorithm);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JWT解密
|
||||||
|
*
|
||||||
|
* @Author: RZH
|
||||||
|
* @Date: 2020/4/6 9:30
|
||||||
|
*/
|
||||||
|
public static String decodeToken(final String token) {
|
||||||
|
String userId = null;
|
||||||
|
try {
|
||||||
|
JWTVerifier verifier = JWT.require(Algorithm.HMAC256(TOKEN_SECRET))
|
||||||
|
.build();
|
||||||
|
DecodedJWT jwt = verifier.verify(token);
|
||||||
|
if (jwt != null) {
|
||||||
|
userId = jwt.getClaim(CLAIM_ID_KEY).asString();
|
||||||
|
}
|
||||||
|
} catch (JWTVerificationException exception) {
|
||||||
|
exception.printStackTrace();
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
String token = SmartJWTUtil.generateToken("844350");
|
||||||
|
System.out.println(SmartJWTUtil.decodeToken(token));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user