javascript
复制代码
<script>
export default {
name: "Dashboard",
components: { baseInfo, toDay, myRanking, merchantRate, userData, userFrom },
data() {
return {
merTitle: "商品销量排行",
visitTitle: "商户访客量排行",
currentRole: "adminDashboard",
grid: {
xl: 8,
lg: 8,
md: 12,
sm: 12,
xs: 24
},
merchantStock: [],
merchantVisit: []
};
},
computed: {
...mapGetters(["roles"])
},
mounted() {
this.getAuth();
this.getList("lately30");
this.getVisit("lately30");
if(!Cookies.get("auth")) {
checkAuthApi()
.then(res => {
if(res.message !== "success") {
return this.$notify.warning({
title: "提醒11111",
duration: 0,
dangerouslyUseHTMLString: true,
message: res.message,
render: h => {
return h("div", [
h(
"a",
{
attrs: {
href:
"http://a.b.com",
target: "_blank"
}
},
res.message
)
]);
},
onClose() {
Cookies.set("auth", true);
}
});
}
})
.catch(res => { });
} else {
}
},
methods: {
getAuth() {
authTypeApi()
.then(res => {
const data = res.data || {};
if(data.auth_code && data.auth) {
this.authCode = data.auth_code;
this.auth = true;
}
})
},
// 商品销量
getList(val) {
merchantStockApi({ date: val })
.then(res => {
if(res.status === 200) {
this.merchantStock = res.data.list;
}
})
.catch(res => {
this.$message.error(res.message);
});
},
// 商户访客量
getVisit(val) {
merchantVisitApi({ date: val })
.then(res => {
if(res.status === 200) {
this.merchantVisit = res.data.list;
}
})
.catch(res => {
this.$message.error(res.message);
});
},
}
};
</script>