Browse Source

加上keepAlive,下拉刷新

pull/15/head^2
zhaoguoqiang 3 years ago
parent
commit
eb969def19
  1. 20
      src/App.vue
  2. 9
      src/router/index.js
  3. 21
      src/views/PerformanceData/index.vue
  4. 31
      src/views/cityDistribution/index.vue
  5. 27
      src/views/dataOverview/index.vue
  6. 2
      src/views/teamList/index.vue
  7. 41
      src/views/teamPerformance/index.vue

20
src/App.vue

@ -1,8 +1,9 @@
<template> <template>
<div id="app"> <div id="app">
<keep-alive include="beiHuo,tiHuo">
<router-view v-if="isRouterAlive"></router-view>
<keep-alive>
<router-view v-if="$route.meta.keepAlive"></router-view>
</keep-alive > </keep-alive >
<router-view v-if="!$route.meta.keepAlive"></router-view>
</div> </div>
</template> </template>
@ -10,24 +11,11 @@
export default { export default {
name:'APP', name:'APP',
provide(){ //provideinject
return{
reload:this.reload
}
},
data(){ data(){
return{ return{
isRouterAlive:true
} }
}, },
methods: {
reload () {
this.isRouterAlive = false; //
this.$nextTick(function () {
this.isRouterAlive = true; //
})
}
}
}; };
</script> </script>

9
src/router/index.js

@ -31,6 +31,9 @@ const routes = [{
path: "/home", path: "/home",
name: 'home', name: 'home',
component: () => import('../views/Home/index.vue'), component: () => import('../views/Home/index.vue'),
meta: {
keepAlive: true
}
}, },
{ {
path: "/cityDistribution", path: "/cityDistribution",
@ -51,14 +54,14 @@ const routes = [{
path: "/teamList", path: "/teamList",
name: 'teamList', name: 'teamList',
component: () => import('../views/teamList/index.vue'), component: () => import('../views/teamList/index.vue'),
meta: {
// title: '列表'
}
}, },
{ {
path: "/teamPerformance", path: "/teamPerformance",
name: 'teamPerformance', name: 'teamPerformance',
component: () => import('../views/teamPerformance/index.vue'), component: () => import('../views/teamPerformance/index.vue'),
meta: {
keepAlive: true
}
}, },
]; ];

21
src/views/PerformanceData/index.vue

@ -1,7 +1,8 @@
<template> <template>
<div class="PerformanceData"> <div class="PerformanceData">
<van-pull-refresh v-model="isLoading" @refresh="onRefresh">
<div class="dataInfo"> <div class="dataInfo">
<p class="title">2021年总业绩</p>
<p class="title">轻未来2021年总业绩</p>
<p class="money" v-if="year_count_order_money">¥{{year_count_order_money | capitalize}}</p> <p class="money" v-if="year_count_order_money">¥{{year_count_order_money | capitalize}}</p>
</div> </div>
<!-- <div class="time"> <!-- <div class="time">
@ -16,18 +17,26 @@
<div class="bar" ref="bar"></div> <div class="bar" ref="bar"></div>
</div> </div>
</van-pull-refresh>
</div> </div>
</template> </template>
<script> <script>
import * as echarts from 'echarts'; import * as echarts from 'echarts';
import data from "@/api/data.js"; import data from "@/api/data.js";
import {
PullRefresh
} from 'vant';
export default { export default {
components: {
'van-pull-refresh': PullRefresh
},
data() { data() {
return { return {
opinionData: [], opinionData: [],
year_count_order_money: '', year_count_order_money: '',
money_count_order_money: '', money_count_order_money: '',
order_goods_num: '', order_goods_num: '',
isLoading: false,
} }
}, },
@ -42,6 +51,12 @@
} }
}, },
methods: { methods: {
async onRefresh() {
await this.getData()
this.drawLine(this.opinionData)
this.barData(this.opinionData)
this.isLoading = false;
},
async getData() { async getData() {
this.opinionData = [] this.opinionData = []
let month = new Date().getMonth() + 1; let month = new Date().getMonth() + 1;
@ -179,6 +194,9 @@
box-shadow: 0px 17px 35px 0px rgba(58, 61, 80, 0.2); box-shadow: 0px 17px 35px 0px rgba(58, 61, 80, 0.2);
border-radius: 0px 0px 20px 20px; border-radius: 0px 0px 20px 20px;
margin-bottom: 52px; margin-bottom: 52px;
position: fixed;
// top: 85px;
z-index: 999;
.title { .title {
font-size: 40px; font-size: 40px;
@ -229,6 +247,7 @@
background: linear-gradient(0deg, #4D5169, #272A3B); background: linear-gradient(0deg, #4D5169, #272A3B);
border-radius: 20px; border-radius: 20px;
padding: 50px 70px; padding: 50px 70px;
padding-top: 41.67vw;
.title { .title {
font-size: 40px; font-size: 40px;

31
src/views/cityDistribution/index.vue

@ -1,5 +1,6 @@
<template> <template>
<div class="cityDistribution"> <div class="cityDistribution">
<van-pull-refresh v-model="isLoading" @refresh="onRefresh">
<div class="top"> <div class="top">
<p class="title">服务商总数量</p> <p class="title">服务商总数量</p>
<p class="num">{{poxy_sum | capitalize}}</p> <p class="num">{{poxy_sum | capitalize}}</p>
@ -10,7 +11,7 @@
<div> <div>
<p v-for="(item,index) of cityInfo" :key="index"><span>{{item.name}}</span>{{item.value}}</p> <p v-for="(item,index) of cityInfo" :key="index"><span>{{item.name}}</span>{{item.value}}</p>
</div> </div>
<div ref='chartBar' id="home"></div>
<div ref='chartBar' id="home" v-show="!isLoading"></div>
</div> </div>
<div class="ranking"> <div class="ranking">
<p class="title">代理城市排名</p> <p class="title">代理城市排名</p>
@ -26,14 +27,21 @@
</div> </div>
</div> </div>
</div> </div>
</van-pull-refresh>
</div> </div>
</template> </template>
<script> <script>
import * as echarts from 'echarts'; import * as echarts from 'echarts';
import {
PullRefresh
} from 'vant';
import '../../utils/china' import '../../utils/china'
import data from "@/api/data.js"; import data from "@/api/data.js";
export default { export default {
name: 'cityDistribution', name: 'cityDistribution',
components: {
'van-pull-refresh': PullRefresh
},
data() { data() {
return { return {
poxy_sum: '', poxy_sum: '',
@ -41,6 +49,7 @@
cityName: '广东', cityName: '广东',
cityInfo: [], cityInfo: [],
chartBar: null, chartBar: null,
isLoading: false,
} }
}, },
filters: { filters: {
@ -54,6 +63,14 @@
this.statistical(this.cityInfo) this.statistical(this.cityInfo)
}, },
methods: { methods: {
async onRefresh() {
this.cityInfo = [];
this.chartBar = null;
await this.getData()
await this.drawarea();
await this.statistical(this.cityInfo)
this.isLoading = false;
},
async getData() { async getData() {
const res = await data.dataDistribution(); const res = await data.dataDistribution();
this.poxy_sum = res.data.poxy_sum this.poxy_sum = res.data.poxy_sum
@ -214,6 +231,7 @@
min-height: 100vh; min-height: 100vh;
background: #3C3F50; background: #3C3F50;
.top { .top {
height: 258px; height: 258px;
background: linear-gradient(90deg, #729EFF, #5D48E1); background: linear-gradient(90deg, #729EFF, #5D48E1);
@ -221,6 +239,10 @@
border-radius: 0px 0px 20px 20px; border-radius: 0px 0px 20px 20px;
padding: 0 68px; padding: 0 68px;
padding-top: 50px; padding-top: 50px;
position: fixed;
// top: 85px;
z-index: 999;
width: 100%;
.title { .title {
font-size: 40px; font-size: 40px;
@ -243,7 +265,8 @@
} }
#area { #area {
height: 400px;
padding-top: 34.2vw;
height: 89.33vw;
width: 750px; width: 750px;
} }
@ -251,7 +274,7 @@
width: 690px; width: 690px;
height: 364px; height: 364px;
// margin: 0 auto; // margin: 0 auto;
// margin-top: 60px;
margin-top: 60px;
left: 50%; left: 50%;
transform: translateX(-50%); transform: translateX(-50%);
} }
@ -259,7 +282,7 @@
.info { .info {
margin: 0 auto; margin: 0 auto;
width: 690px; width: 690px;
height: 724px;
height: 105.53vw;
background: linear-gradient(0deg, #729EFF, #5D48E1); background: linear-gradient(0deg, #729EFF, #5D48E1);
border-radius: 20px; border-radius: 20px;
padding: 46px 24px; padding: 46px 24px;

27
src/views/dataOverview/index.vue

@ -1,11 +1,12 @@
<template> <template>
<div class="dataOverview"> <div class="dataOverview">
<van-pull-refresh v-model="isLoading" @refresh="onRefresh">
<div class="top"> <div class="top">
<p class="title">2021年总业绩</p>
<p class="title">轻未来2021年总业绩</p>
<p class="money">¥{{list.year_count | capitalize}}</p> <p class="money">¥{{list.year_count | capitalize}}</p>
<p class="monthMoney">本月业绩{{list.month_count | capitalize}}</p> <p class="monthMoney">本月业绩{{list.month_count | capitalize}}</p>
</div> </div>
<div class="providersSum">
<div class="providersSum aa">
<p class="title">服务商总数量</p> <p class="title">服务商总数量</p>
<p class="num">{{list.level_count | capitalize}}</p> <p class="num">{{list.level_count | capitalize}}</p>
<div class="list"> <div class="list">
@ -125,15 +126,23 @@
</div> </div>
</div> </div>
</div> </div>
</van-pull-refresh>
</div> </div>
</template> </template>
<script> <script>
import data from "@/api/data.js"; import data from "@/api/data.js";
import {
PullRefresh
} from 'vant';
export default { export default {
name: "dataOverview", name: "dataOverview",
components: {
'van-pull-refresh': PullRefresh
},
data() { data() {
return { return {
list: {}, list: {},
isLoading: false,
} }
}, },
filters: { filters: {
@ -145,6 +154,10 @@
this.getData() this.getData()
}, },
methods: { methods: {
onRefresh() {
this.getData()
this.isLoading = false;
},
async getData() { async getData() {
const res = await data.overview(); const res = await data.overview();
this.list = res.data this.list = res.data
@ -173,8 +186,10 @@
<style lang="scss" scoped> <style lang="scss" scoped>
.dataOverview { .dataOverview {
background: #3C3F50; background: #3C3F50;
// padding-top: 334px;
.top { .top {
z-index: 999;
width: 750px; width: 750px;
height: 334px; height: 334px;
background: linear-gradient(90deg, #729EFF, #5D48E1); background: linear-gradient(90deg, #729EFF, #5D48E1);
@ -183,6 +198,8 @@
padding: 0 70px; padding: 0 70px;
padding-top: 46px; padding-top: 46px;
margin-bottom: 50px; margin-bottom: 50px;
position: fixed;
// top: 85px;
.title { .title {
height: 40px; height: 40px;
@ -218,8 +235,12 @@
display: inline-block; display: inline-block;
} }
} }
.aa {
padding-top: 53.53vw !important;
}
.providersSum { .providersSum {
padding-top: 334px;
padding: 50px 70px; padding: 50px 70px;
min-height: 580px; min-height: 580px;
background: RGBA(63, 66, 88, 1); background: RGBA(63, 66, 88, 1);

2
src/views/teamList/index.vue

@ -1,6 +1,6 @@
<template> <template>
<div class="teamList"> <div class="teamList">
<van-nav-bar title="列表" left-text="返回" left-arrow @click-left="onClickLeft" />
<van-nav-bar title="列表" left-text="返回" left-arrow @click-left="onClickLeft" :fixed="true" />
<div v-if="list.data.length>0" class="moneyRanking"> <div v-if="list.data.length>0" class="moneyRanking">
<p class="title">{{this.$route.query.level_id | capitalize2}}</p> <p class="title">{{this.$route.query.level_id | capitalize2}}</p>
<div class="list"> <div class="list">

41
src/views/teamPerformance/index.vue

@ -1,12 +1,13 @@
<template> <template>
<div class="dataOverview"> <div class="dataOverview">
<van-nav-bar title="团队信息" left-text="返回" left-arrow @click-left="onClickLeft" />
<van-nav-bar title="团队信息" left-text="返回" left-arrow @click-left="onClickLeft" :fixed="true" />
<van-pull-refresh v-model="isLoading" @refresh="onRefresh">
<div class="top"> <div class="top">
<p class="title">2021年总业绩</p>
<p class="title">轻未来2021年总业绩</p>
<p class="money">¥{{list.year_count | capitalize}}</p> <p class="money">¥{{list.year_count | capitalize}}</p>
<p class="monthMoney">本月业绩{{list.month_count | capitalize}}</p> <p class="monthMoney">本月业绩{{list.month_count | capitalize}}</p>
</div> </div>
<div class="providersSum">
<div class="providersSum aa">
<p class="title">服务商总数量</p> <p class="title">服务商总数量</p>
<p class="num">{{list.level_count | capitalize}}</p> <p class="num">{{list.level_count | capitalize}}</p>
<div class="list"> <div class="list">
@ -126,22 +127,26 @@
</div> </div>
</div> </div>
</div> </div>
</van-pull-refresh>
</div> </div>
</template> </template>
<script> <script>
import data from "@/api/data.js"; import data from "@/api/data.js";
import { import {
NavBar
NavBar,
PullRefresh
} from 'vant'; } from 'vant';
export default { export default {
name: "dataOverview", name: "dataOverview",
components: { components: {
"van-nav-bar": NavBar
"van-nav-bar": NavBar,
'van-pull-refresh': PullRefresh
}, },
data() { data() {
return { return {
list: {}, list: {},
id: '', id: '',
isLoading: false,
} }
}, },
filters: { filters: {
@ -158,6 +163,10 @@
this.getData() this.getData()
}, },
methods: { methods: {
onRefresh() {
this.getData()
this.isLoading = false;
},
onClickLeft() { onClickLeft() {
this.$router.go(-1) this.$router.go(-1)
}, },
@ -185,21 +194,26 @@
.dataOverview { .dataOverview {
background: #3C3F50; background: #3C3F50;
::v-deep .van-nav-bar__content{
::v-deep .van-nav-bar__content {
background: RGBA(63, 66, 88, 1); background: RGBA(63, 66, 88, 1);
} }
::v-deep .van-nav-bar__title{
::v-deep .van-nav-bar__title {
color: #fff; color: #fff;
} }
::v-deep .van-nav-bar__text{
::v-deep .van-nav-bar__text {
color: #fff; color: #fff;
} }
::v-deep .van-icon-arrow-left::before{
::v-deep .van-icon-arrow-left::before {
color: #fff; color: #fff;
} }
::v-deep .van-hairline--bottom::after{
::v-deep .van-hairline--bottom::after {
border: none; border: none;
} }
.top { .top {
width: 750px; width: 750px;
height: 334px; height: 334px;
@ -209,6 +223,9 @@
padding: 0 70px; padding: 0 70px;
padding-top: 46px; padding-top: 46px;
margin-bottom: 50px; margin-bottom: 50px;
position: fixed;
top: 85px;
z-index: 999;
.title { .title {
height: 40px; height: 40px;
@ -245,6 +262,10 @@
} }
} }
.aa {
padding-top: 58.53vw !important;
}
.providersSum { .providersSum {
padding: 50px 70px; padding: 50px 70px;
min-height: 580px; min-height: 580px;

Loading…
Cancel
Save