From fd3acb28d3907caec733cbf270e687859902727c Mon Sep 17 00:00:00 2001
From: heyujie <516346543@qq.com>
Date: 星期一, 11 七月 2022 18:21:09 +0800
Subject: [PATCH] user order count
---
src/views/index/index.vue | 82 ++++++++++++++++++++++++++--------------
1 files changed, 53 insertions(+), 29 deletions(-)
diff --git a/src/views/index/index.vue b/src/views/index/index.vue
index 909df1d..2157312 100644
--- a/src/views/index/index.vue
+++ b/src/views/index/index.vue
@@ -12,11 +12,11 @@
<li
v-for="(item, index) in bannerList"
:key="index"
- @click="toggleBanner(index + 1)"
+ @click="toggleBanner(index)"
>
<button
class="inner"
- :class="{ active: activeBanner == index + 1 }"
+ :class="{ active: activeBanner == index }"
></button>
</li>
</ul>
@@ -26,7 +26,7 @@
<!-- 鎺ㄨ崘鍗$墖 -->
<commendCard :commendCardData="commendCardData"></commendCard>
<!-- 鐢ㄦ埛card -->
- <userCard></userCard>
+ <userCard :userCardArr="userCardArr"></userCard>
</div>
</div>
@@ -89,7 +89,7 @@
</div>
</div>
- <Connect v-if="showConnect"></Connect>
+ <Connect></Connect>
<!-- 椤靛熬 -->
<Footer></Footer>
@@ -115,6 +115,7 @@
getIndexModelRecommend,
getModelList,
} from "@/api/product";
+import { getUserOrderInfo } from "@/api/order";
export default {
name: "Index",
@@ -136,10 +137,7 @@
this.getBanner();
this.getRecommend();
this.getModule();
- window.addEventListener("scroll", this.scrollListener);
- },
- destroyed() {
- window.removeEventListener("scroll", this.scrollListener);
+ this.getUserBuyInfo();
},
data() {
return {
@@ -163,10 +161,11 @@
router: "/trialCenter",
},
], //鎺ㄨ崘鍗$墖鏁版嵁
- activeBanner: 1, //閫変腑鐨刡anner
+ activeBanner: 0, //閫変腑鐨刡anner
activeCommend: 3, //閫変腑鐨勬帹鑽恡abs
commendData: [], //鎺ㄨ崘tab鐨勬暟鎹�
productData: [],
+ userCardArr: [],
productData1: [
{
router: "/",
@@ -213,12 +212,14 @@
typeId: 2,
pic: "/images/index/杈圭紭璁$畻璁惧.png",
name: "杈圭紭璁$畻璁惧",
- desc: "涓�绉嶉儴缃插湪杩戝満渚х殑楂樺彲鐢ㄧ殑杞‖涓�浣撲骇鍝侊紝鎻愬崌搴旂敤绋嬪簭鐨勫揩閫熷搷搴旇兘鍔涖�佽妭鐪佸甫瀹芥祦閲忔垚鏈�",
+ desc:
+ "涓�绉嶉儴缃插湪杩戝満渚х殑楂樺彲鐢ㄧ殑杞‖涓�浣撲骇鍝侊紝鎻愬崌搴旂敤绋嬪簭鐨勫揩閫熷搷搴旇兘鍔涖�佽妭鐪佸甫瀹芥祦閲忔垚鏈�",
product: [
{
name: "杈圭紭璁$畻璁惧1",
title: "LE-V-S003 楂樻�ц兘杈圭紭璁$畻涓绘満",
- des: "涓撲负楂樻�ц兘瑙嗛搴旂敤鎵撻�狅紝寮烘倣鐨勫弻蹇楀己澶勭悊鍣紝杞绘澗搴斿楂樼畻鍔涘簲鐢ㄥ満鏅殑闇�姹傘��",
+ des:
+ "涓撲负楂樻�ц兘瑙嗛搴旂敤鎵撻�狅紝寮烘倣鐨勫弻蹇楀己澶勭悊鍣紝杞绘澗搴斿楂樼畻鍔涘簲鐢ㄥ満鏅殑闇�姹傘��",
content: [
{
key: "鐗圭偣",
@@ -242,7 +243,8 @@
{
name: "杈圭紭璁$畻璁惧2",
title: "LE-V-S003 楂樻�ц兘杈圭紭璁$畻涓绘満",
- des: "涓撲负楂樻�ц兘瑙嗛搴旂敤鎵撻�狅紝寮烘倣鐨勫弻蹇楀己澶勭悊鍣紝杞绘澗搴斿楂樼畻鍔涘簲鐢ㄥ満鏅殑闇�姹傘��",
+ des:
+ "涓撲负楂樻�ц兘瑙嗛搴旂敤鎵撻�狅紝寮烘倣鐨勫弻蹇楀己澶勭悊鍣紝杞绘澗搴斿楂樼畻鍔涘簲鐢ㄥ満鏅殑闇�姹傘��",
content: [
{
key: "鐗圭偣",
@@ -266,7 +268,8 @@
{
name: "杈圭紭璁$畻璁惧3",
title: "LE-V-S003 楂樻�ц兘杈圭紭璁$畻涓绘満",
- des: "涓撲负楂樻�ц兘瑙嗛搴旂敤鎵撻�狅紝寮烘倣鐨勫弻蹇楀己澶勭悊鍣紝杞绘澗搴斿楂樼畻鍔涘簲鐢ㄥ満鏅殑闇�姹傘��",
+ des:
+ "涓撲负楂樻�ц兘瑙嗛搴旂敤鎵撻�狅紝寮烘倣鐨勫弻蹇楀己澶勭悊鍣紝杞绘澗搴斿楂樼畻鍔涘簲鐢ㄥ満鏅殑闇�姹傘��",
content: [
{
key: "鐗圭偣",
@@ -290,7 +293,8 @@
{
name: "杈圭紭璁$畻璁惧4",
title: "LE-V-S003 楂樻�ц兘杈圭紭璁$畻涓绘満",
- des: "涓撲负楂樻�ц兘瑙嗛搴旂敤鎵撻�狅紝寮烘倣鐨勫弻蹇楀己澶勭悊鍣紝杞绘澗搴斿楂樼畻鍔涘簲鐢ㄥ満鏅殑闇�姹傘��",
+ des:
+ "涓撲负楂樻�ц兘瑙嗛搴旂敤鎵撻�狅紝寮烘倣鐨勫弻蹇楀己澶勭悊鍣紝杞绘澗搴斿楂樼畻鍔涘簲鐢ㄥ満鏅殑闇�姹傘��",
content: [
{
key: "鐗圭偣",
@@ -314,7 +318,8 @@
{
name: "杈圭紭璁$畻璁惧5",
title: "LE-V-S003 楂樻�ц兘杈圭紭璁$畻涓绘満",
- des: "涓撲负楂樻�ц兘瑙嗛搴旂敤鎵撻�狅紝寮烘倣鐨勫弻蹇楀己澶勭悊鍣紝杞绘澗搴斿楂樼畻鍔涘簲鐢ㄥ満鏅殑闇�姹傘��",
+ des:
+ "涓撲负楂樻�ц兘瑙嗛搴旂敤鎵撻�狅紝寮烘倣鐨勫弻蹇楀己澶勭悊鍣紝杞绘澗搴斿楂樼畻鍔涘簲鐢ㄥ満鏅殑闇�姹傘��",
content: [
{
key: "鐗圭偣",
@@ -338,7 +343,8 @@
{
name: "杈圭紭璁$畻璁惧6",
title: "LE-V-S003 楂樻�ц兘杈圭紭璁$畻涓绘満",
- des: "涓撲负楂樻�ц兘瑙嗛搴旂敤鎵撻�狅紝寮烘倣鐨勫弻蹇楀己澶勭悊鍣紝杞绘澗搴斿楂樼畻鍔涘簲鐢ㄥ満鏅殑闇�姹傘��",
+ des:
+ "涓撲负楂樻�ц兘瑙嗛搴旂敤鎵撻�狅紝寮烘倣鐨勫弻蹇楀己澶勭悊鍣紝杞绘澗搴斿楂樼畻鍔涘簲鐢ㄥ満鏅殑闇�姹傘��",
content: [
{
key: "鐗圭偣",
@@ -365,10 +371,27 @@
timer: null, //鍚戜笂鍥炴粴鍔ㄧ敾
ConnectTimer: null, // 鎺у埗寮瑰眰鐨勫畾鏃跺櫒
bannerList: [],
- showConnect: false, //鏄剧ず鑱旂郴鎴戜滑涓庡洖鍒伴《閮�
};
},
methods: {
+ getUserBuyInfo() {
+ getUserOrderInfo({}).then((res) => {
+ this.userCardArr = [
+ {
+ num: res.data.needPay,
+ label: "寰呬粯娆�",
+ },
+ {
+ num: res.data.needRenewal,
+ label: "寰呯画璐�",
+ },
+ {
+ num: "_",
+ label: "娑堟伅涓績",
+ },
+ ];
+ });
+ },
// 鍒囨崲banner
toggleBanner(i) {
this.activeBanner = i;
@@ -402,18 +425,19 @@
this.activeCommend = id;
this.getRecommend();
},
- //娣诲姞婊氬姩鐩戝惉
- scrollListener() {
- //椤甸潰婊戝姩瑙﹀彂浜嬩欢 (婊氬姩鏉$Щ鍔ㄥ垯璋冪敤鏄惁鏄剧ず杩斿洖椤堕儴鎸夐挳浜嬩欢)
-
- if (document.documentElement.scrollTop < 1100) {
- this.showConnect = false;
- } else {
- this.showConnect = true;
- }
-
- //妫�鏌ユ粴鍔ㄦ潯鏄惁鍦ㄩ《閮紝鎺у埗杩斿洖椤堕儴鎸夐挳鐨勯殣钘忓拰鏄剧ず
- },
+ },
+ beforeRouteLeave(to, from, next) {
+ let userInfo = sessionStorage.getItem("userInfo");
+ if (
+ !userInfo &&
+ to.path !== "/login" &&
+ to.path !== "/register" &&
+ to.path !== "/connectUs"
+ ) {
+ next({ path: "/login" });
+ } else {
+ next();
+ }
},
};
</script>
--
Gitblit v1.8.0