From 6b6cc4a3b92a9622efe1ad1150c42770b759e127 Mon Sep 17 00:00:00 2001
From: whycq <10027870+whycq@user.noreply.gitee.com>
Date: 星期三, 11 十月 2023 17:34:48 +0800
Subject: [PATCH] #

---
 pages/api/index.js |   51 +++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 39 insertions(+), 12 deletions(-)

diff --git a/pages/api/index.js b/pages/api/index.js
index a8498ff..1c5d683 100644
--- a/pages/api/index.js
+++ b/pages/api/index.js
@@ -1,26 +1,52 @@
-function isEmpty(obj) {
-	if (JSON.stringify(obj) === '{}') {
-		return true
-	}
-	return  obj == "undefined" || obj == null || obj === "" || obj == {};
-}
-
-const baseUrl = 'http://127.0.0.1:9528'
+import common from '@/static/js/common.js'
 
 async function getCompanyData() {
 	let _this = this,item = [];
-	var ress = await uni.request({
-		url: `${baseUrl}/dashboard/companyData/auth`,
+	let ress = await uni.request({
+		url: `${common.baseUrl}/dashboard/companyData/auth`,
 		header:{'token':uni.getStorageSync('token')},
 	}).then((res)=> {
+		res = res[1].data
+		if (res.code === 200) {
+			item = {
+				code: res.code,
+				data: [
+					{name: '骞村害閿�鍞洰鏍�',content: res.data.yearTarget,unit: '涓囧厓'},
+					{name: '宸插畬鎴愰攢鍞换鍔�',content: res.data.successMoney,unit: '涓囧厓'},
+					{name: '鏈畬鎴愰攢鍞换鍔�',content: res.data.progressMoney,unit: '涓囧厓'},
+					{name: '瀹屾垚鐜�',content: res.data.yearTransactionRate,unit: '%'}
+				]
+			}
+		} else  if(res.code === 403){
+			item = {code: 403,msg: '璇烽噸鏂扮櫥褰�'}
+		}
+	},(result)=>{
+		// console.log(res);
+	})
+	return item
+}
+
+async function getPersonData() {
+	let item = [];
+	let ress = await uni.request({
+		url: `${common.baseUrl}/dashboard/personData/auth`,
+		header:{'token':uni.getStorageSync('token')},
+	}).then((res)=> {
+		console.log(res);
 		res = res[1].data
 		if (res.code === 200) {
 			item = [
 				{name: '骞村害閿�鍞洰鏍�',content: res.data.yearTarget,unit: '涓囧厓'},
 				{name: '宸插畬鎴愰攢鍞换鍔�',content: res.data.successMoney,unit: '涓囧厓'},
 				{name: '鏈畬鎴愰攢鍞换鍔�',content: res.data.progressMoney,unit: '涓囧厓'},
-				{name: '瀹屾垚鐜�',content: res.data.yearTransactionRate,unit: '%'}
+				{name: '瀹屾垚鐜�',content: res.data.yearTransactionRate,unit: '%'},
+				{name: '璺熻釜椤圭洰鏁伴噺',content: res.data.progressCount,unit: '椤�'},
+				{name: '璺熻釜椤圭洰閲戦',content: res.data.successCount,unit: '涓囧厓'},
+				{name: '鎴愪氦椤圭洰鏁伴噺',content: res.data.progressMoney2,unit: '椤�'},
+				{name: '鎴愪氦椤圭洰閲戦',content: res.data.successMoney,unit: '涓囧厓'}
 			]
+		} else  if(res.code === 403){
+			item = {code: 403,msg: '璇烽噸鏂扮櫥褰�'}
 		}
 	},(result)=>{
 		// console.log(res);
@@ -29,5 +55,6 @@
 }
 
 module.exports = {
-	getCompanyData: getCompanyData
+	 getCompanyData,
+	 getPersonData
 }
\ No newline at end of file

--
Gitblit v1.9.1