From 3c3f9bdcea851cb4e4e0a8c14c169dc98f8f30e7 Mon Sep 17 00:00:00 2001
From: whycq <10027870+whycq@user.noreply.gitee.com>
Date: 星期二, 24 十月 2023 10:53:50 +0800
Subject: [PATCH] #
---
pages/index/index.vue | 283 ++++++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 261 insertions(+), 22 deletions(-)
diff --git a/pages/index/index.vue b/pages/index/index.vue
index ec0ec26..914c427 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -1,52 +1,291 @@
<template>
- <view class="content">
- <image class="logo" src="/static/logo.png"></image>
- <view class="text-area">
- <text class="title">{{title}}</text>
+ <view>
+ <view class="box" :class="it.bg" v-for="it in mainItem">
+ <view class="box-title">{{it.title}}</view>
+ <view class="box-item">
+ <view class="item-title">{{it.subTitle}}</view>
+ <view class="item-content">
+ <view style="width: 50%;" v-for="item in it.items">
+
+ <view class="content-data">
+ <text class="c-data">{{item.content}}</text>
+ <text class="c-val">{{item.unit}}</text>
+ </view>
+ <view style="font-size: 16rpx;">{{item.name}}</view>
+ </view>
+ </view>
+ </view>
+ </view>
+ <view class="top-box">
+ <view class="box-title">閿�鍞笟缁╂帓琛屾</view>
+ <view class="box-item">
+ <view class="single-line" v-for="(item,i) in topList" :key="i">
+ <view style="flex: 1;"><text class="top-border">{{i+1}}</text></view>
+ <view style="flex: 3;"><text>{{item.username}}</text></view>
+ <view style="flex: 3;text-align: end;"><text>{{item.money}}涓囧厓</text></view>
+ </view>
+ </view>
+ </view>
+
+ <view class="top-box">
+ <view class="box-title">鍏徃鍏憡</view>
+ <view class="box-item">
+ <view style="display: flex;align-items: stretch;margin: 4px 0 ;" v-for="(item,i) in notices" :key="i">
+ <text style="flex: 1;align-self: center;padding: 8px 4px;">{{item.content}}</text>
+ <text style="width: 150rpx;align-self: center;padding: 0 2px;">{{item.updateTime$}}</text>
+ </view>
+
+ </view>
+ <view>鏌ョ湅鏇村 >></view>
+ </view>
+
+ <view class="charts-box">
+ <qiun-data-charts type="column" canvasId="scrollcolumnid" :opts="{enableScroll:true,xAxis:{scrollShow:true,itemCount:4,disableGrid:true}}" :ontouch="true" :canvas2d="true" :chartData="chartsDataColumn4" :background="red"/>
</view>
</view>
</template>
<script>
+ import demodata from '@/mockdata/demodata.json';
+ import getCompanyData from '@/pages/api/index.js'
export default {
data() {
return {
- title: 'Hello'
+ chartsDataColumn4:{},
+ title: 'Hello',
+ mainItem: [
+ {
+ title: '鍥㈤槦娲诲姩瀹炴椂浜ゆ槗鎯呭喌',
+ subTitle: '鍥㈤槦鏁版嵁',
+ items: [
+ {name: '骞村害閿�鍞洰鏍�',content: 60000,unit: '涓囧厓'},
+ {name: '宸插畬鎴愰攢鍞换鍔�',content: 1112,unit: '涓囧厓'},
+ {name: '鏈畬鎴愰攢鍞换鍔�',content: 58888,unit: '涓囧厓'},
+ {name: '瀹屾垚鐜�',content: 1.85,unit: '%'}
+ ]
+ },
+ {
+ title: '瀹炴椂閿�鍞儏鍐�',
+ subTitle: '涓汉鏁版嵁',
+ items: [
+ {name: '骞村害閿�鍞洰鏍�',content: 0,unit: '涓囧厓'},
+ {name: '宸插畬鎴愰攢鍞换鍔�',content: 0,unit: '涓囧厓'},
+ {name: '鏈畬鎴愰攢鍞换鍔�',content: 0,unit: '涓囧厓'},
+ {name: '瀹屾垚鐜�',content: '0.00',unit: '%'},
+ {name: '璺熻釜椤圭洰鏁伴噺',content: 0,unit: '椤�'},
+ {name: '璺熻釜椤圭洰閲戦',content: 0,unit: '涓囧厓'},
+ {name: '鎴愪氦椤圭洰鏁伴噺',content: 0,unit: '椤�'},
+ {name: '鎴愪氦椤圭洰閲戦',content: '0.00',unit: '涓囧厓'}
+ ]
+ }
+ ],
+ topList: [
+ {username: '寮犲弻榫�',money:'800涓囧厓'},
+ {username: '鏉庝笘璞�3绾�',money:'200涓囧厓'},
+ {username: '鏉庝笘璞�1绾�',money:'112涓囧厓'}
+ ],
+ bgs: ['bg-blue','bg-red'],
+ red: '#4286db',
+ notices: [
+ {notice: '杩欐潯娴嬭瘯鍏憡琚慨鏀逛簡asdas杩欐潯娴嬭瘯鍏憡琚慨鏀逛簡杩欐潯娴嬭瘯鍏憡琚慨鏀逛簡',crtate_time: '2023-09-09 13:49:46',update_time: '2023-10-09 13:49:46'},
+ {notice: '杩欐槸涓�鏉℃祴璇曞叕鍛�',crtate_time: '2023-09-09 13:49:46',update_time: '2023-10-09 13:49:46'},
+ {notice: '杩欐槸涓�鏉℃祴璇曞叕鍛�',crtate_time: '2023-09-09 13:49:46',update_time: '2023-10-09 13:49:46'},
+ {notice: '杩欐槸涓�鏉℃祴璇曞叕鍛�',crtate_time: '2023-09-09 13:49:46',update_time: '2023-10-09 13:49:46'},
+ {notice: '杩欐槸涓�鏉℃祴璇曞叕鍛�',crtate_time: '2023-09-09 13:49:46',update_time: '2023-10-09 13:49:46'},
+ {notice: '杩欐槸涓�鏉℃祴璇曞叕鍛�',crtate_time: '2023-09-09 13:49:46',update_time: '2023-10-09 13:49:46'},
+ {notice: '杩欐槸涓�鏉℃祴璇曞叕鍛�',crtate_time: '2023-09-09 13:49:46',update_time: '2023-10-09 13:49:46'},
+ {notice: '杩欐槸涓�鏉℃祴璇曞叕鍛�',crtate_time: '2023-09-09 13:49:46',update_time: '2023-10-09 13:49:46'},
+ {notice: '杩欐槸涓�鏉℃祴璇曞叕鍛�',crtate_time: '2023-09-09 13:49:46',update_time: '2023-10-09 13:49:46'},
+ {notice: '杩欐槸涓�鏉℃祴璇曞叕鍛�',crtate_time: '2023-09-09 13:49:46',update_time: '2023-10-09 13:49:46'},
+ {notice: '杩欐槸涓�鏉℃祴璇曞叕鍛�',crtate_time: '2023-09-09 13:49:46',update_time: '2023-10-09 13:49:46'},
+ {notice: '娴欐睙涓壃绔嬪簱鎶�鏈湁闄愬叕鍙告槸涓壃闆嗗洟鏃椾笅涓撲笟鐨勬櫤鑳戒粨鍌ㄧ墿娴佽澶囨簮澶存湇鍔″晢锛岃嚧鍔涗簬璁╁埗閫犱笌鐗╂祦鏇撮珮鏁堛�傞泦鍥㈠勾閿�鍞瓒�5浜夸汉姘戝竵锛屾槸涓浗绔嬩綋浠撳簱澶у瀷鍘傚涔嬩竴锛岄泦绉戠爺銆佺敓浜с�侀攢鍞�佸敭鍚庝负涓�浣撶殑鍥藉楂樻柊鎶�鏈紒涓氾紝娴欐睙鐪佲�滀笓绮剧壒鏂扳�濅紒涓氾紝娴欐睙鐪佲�滃皷鍏点�侀闆佲�濅紒涓氾紝娴欐睙鐪侀噸鐐瑰煿鑲蹭紒涓氾紝缁煎悎瀹炲姏浣嶅眳琛屼笟鍓嶅垪',crtate_time: '2023-09-09 13:49:46',update_time: '2023-10-09 13:49:46'}
+ ],
+ Column: {
+ categories: ["1鏈�", "2鏈�", "3鏈�", "4鏈�", "5鏈�", "6鏈�","7鏈�", "8鏈�", "9鏈�", "10鏈�", "11鏈�", "12鏈�"],
+ series: [{
+ name: "閿�鍞",
+ data: [35, 36, 31, 33, 13, 34,18, 27, 21, 24, 6, 28]
+ }]
+ }
+
+
}
},
onLoad() {
-
+ this.backGroundRepeat()
+ },
+ onReady() {
+ //妯℃嫙浠庢湇鍔″櫒鑾峰彇鏁版嵁
+ this.getServerData()
+ this.getCompanyData()
+ this.getPersonData()
+ this.getStaffRank()
+ this.getCompanyPostList()
+ this.getMonthData()
+ },
+ mounted() {
+
},
methods: {
-
+ getServerData() {
+ setTimeout(() => {
+ //鍥犻儴鍒嗘暟鎹牸寮忎竴鏍凤紝杩欓噷涓嶅悓鍥捐〃寮曠敤鍚屼竴鏁版嵁婧愮殑璇濓紝闇�瑕佹繁鎷疯礉涓�涓嬫瀯閫犱笉鍚岀殑瀵硅薄
+ //寮�鍙戣�呴渶瑕佽嚜琛屽鐞嗘湇鍔″櫒杩斿洖鐨勬暟鎹紝搴斾笌鏍囧噯鏁版嵁鏍煎紡涓�鑷达紝娉ㄦ剰series鐨刣ata鏁板�煎簲涓烘暟瀛楁牸寮�
+ this.chartsDataColumn4=JSON.parse(JSON.stringify(this.Column))
+ }, 1500);
+ },
+ backGroundRepeat() {
+ let len = this.bgs.length
+ let i = 0
+ for (let k in this.mainItem) {
+ if (i == len) {
+ i = 0
+ }
+ this.mainItem[k]['bg'] = this.bgs[i]
+ i++
+ }
+ // console.log(this.mainItem);
+ },
+ async getCompanyData() {
+ let res = await getCompanyData.getCompanyData()
+ if (res.code === 200) {
+ this.mainItem[0].title = '鍥㈤槦娲诲姩瀹炴椂浜ゆ槗鎯呭喌'
+ this.mainItem[0].subTitle = '鍥㈤槦鏁版嵁'
+ this.mainItem[0].items = res.data
+ } else if (res.code === 403) {
+ this.backLogin(res)
+ }
+ },
+ async getPersonData() {
+ let res = await getCompanyData.getPersonData()
+ if (res.code === 200) {
+ this.mainItem[1].title = '瀹炴椂閿�鍞儏鍐�'
+ this.mainItem[1].subTitle = '涓汉鏁版嵁'
+ this.mainItem[1].items = res.data
+ } else if (res.code === 403) {
+ this.backLogin(res)
+ }
+ },
+ async getStaffRank() {
+ let res = await getCompanyData.getStaffRank()
+ if (res.code === 200) {
+ this.topList = res.data
+ } else if (res.code === 403) {
+ this.backLogin(res)
+ }
+ },
+ async getCompanyPostList() {
+ let res = await getCompanyData.getCompanyPostList()
+ if (res.code === 200) {
+ this.notices = res.data.records.splice(0,5)
+ } else if (res.code === 403) {
+ this.backLogin(res)
+ }
+ },
+
+ async getMonthData() {
+ let res = await getCompanyData.getMonthData()
+ if (res.code === 200) {
+ this.Column.series[0].data = res.data
+ } else if (res.code === 403) {
+ this.backLogin(res)
+ }
+ },
+ backLogin(res) {
+ uni.showToast({title: res.msg, icon: "none", position: 'top'})
+ setTimeout(() => {
+ uni.reLaunch({
+ url: '../login/login'
+ });
+ }, 1000);
+ }
+
}
}
</script>
-<style>
+<style scoped>
+ .charts-box {
+ height: 300px;
+ margin: 8px;
+ }
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
-
- .logo {
- height: 200rpx;
- width: 200rpx;
- margin-top: 200rpx;
- margin-left: auto;
- margin-right: auto;
- margin-bottom: 50rpx;
+ .box {
+ margin: 8px;
+ border-radius: 10rpx;
}
-
- .text-area {
+ .box-title {
+ margin: 8px;
+ height: 60rpx;
+ line-height: 80rpx;
+ font-size: 28rpx;
+ font-weight: 700;
+ }
+ .box-item {
+ margin: 8px;
+ font-size: 26rpx;
+ font-weight: 700;
+ min-height: 80rpx;
+ background-color: rgba(255,255,255,.3);
+ border-radius: 10rpx;
+ }
+ .item-title {
+ height: 50rpx;
+ line-height: 50rpx;
+ }
+ .item-content {
display: flex;
- justify-content: center;
+ flex-wrap: wrap;
+ text-align: center;
+ margin-top: 10rpx;
}
+ .c-data {
+ font-size: 48rpx;
+ }
+ .c-val {
+ font-size: 24rpx;
+ font-weight: normal;
+ vertical-align: text-bottom;
+ }
+ .top-box {
+ margin: 8px;
+ border-radius: 10rpx;
+ color: #FFF;
+ background: #D38312; /* fallback for old browsers */
+ background: -webkit-linear-gradient(to right, #A83279, #D38312); /* Chrome 10-25, Safari 5.1-6 */
+ background: linear-gradient(to right, #A83279, #D38312); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
- .title {
- font-size: 36rpx;
- color: #8f8f94;
}
+ .single-line {
+ display: flex;
+ /* text-align: center; */
+ align-items: center;
+ padding: 10px;
+ font-size: 30rpx;
+ }
+ .top-border {
+ background-color: #3f624d;
+ font-weight: 900;
+ padding: 0 5px;
+ border-radius: 2px;
+ }
+
+ .bg-red {
+ background: #7b4397;
+ background: -webkit-linear-gradient(to left, #dc2430, #7b4397);
+ background: linear-gradient(to left, #dc2430, #7b4397);
+ color: #FFF;
+ }
+ .bg-blue {
+ color: #FFF;
+ background: #4284DB;
+ background: -webkit-linear-gradient(to left, #29EAC4, #4284DB);
+ background: linear-gradient(to left, #29EAC4, #4284DB);
+ }
+
</style>
--
Gitblit v1.9.1