From 6abe22fc75b115d2a68103a4d8b24d0815a016f8 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期三, 06 八月 2025 17:37:35 +0800
Subject: [PATCH] 登录页联调开发,首页开发

---
 src/pages/index.vue |  220 ++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 162 insertions(+), 58 deletions(-)

diff --git a/src/pages/index.vue b/src/pages/index.vue
index 2b5d2ab..3cad7a1 100644
--- a/src/pages/index.vue
+++ b/src/pages/index.vue
@@ -1,75 +1,179 @@
 <template>
   <view class="content">
-    <image class="logo" src="@/static/logo.png"></image>
-    <view class="text-area">
-      <text class="title"> RuoYi-Geek-App</text>
-    </view>
-    <view class="text-area">
-      <up-text type="primary" text="uview-plus"></up-text>
-    </view>
-    <view class="charts-box">
-      <qiun-data-charts type="column" :chartData="chartData" />
-    </view>
+		<view>
+			<view class="currentFactory">
+				<up-text type="primary" :text="userStore.currentFactoryName" @click="show = true"
+								 class="factoryName" suffixIcon="arrow-right" :iconStyle="iconStyle"></up-text>
+			</view>
+			<up-picker :show="show" :columns="factoryList" @confirm="changeFactory"></up-picker>
+			<view>
+				<view class="bg-img"></view>
+			</view>
+			<view class="bg-img">
+				<up-grid
+					:border="false"
+					col="4"
+				>
+					<up-grid-item
+						v-for="(listItem,listIndex) in list"
+						:key="listIndex"
+					>
+						<up-icon
+							:customStyle="{paddingTop:20+'rpx'}"
+							:name="listItem.name"
+							:size="22"
+						></up-icon>
+						<text class="grid-text">{{listItem.title}}</text>
+					</up-grid-item>
+				</up-grid>
+			</view>
+		</view>
+<!--		<view class="select-container">-->
+<!--			<up-picker-data-->
+<!--				class="picker"-->
+<!--				v-model="currentFatoryId"-->
+<!--				title="璇烽�夋嫨鍏徃"-->
+<!--				:options="factoryList"-->
+<!--				valueKey="id"-->
+<!--				labelKey="name">-->
+<!--			</up-picker-data>-->
+<!--		</view>-->
   </view>
 </template>
 
 <script setup>
-import { ref, onMounted } from 'vue';
+import {ref, onMounted, nextTick, reactive} from 'vue';
+import {userLoginFacotryList} from "@/api/login";
+import modal from "@/plugins/modal";
+import useUserStore from "@/store/modules/user";
 
-const chartData = ref({});
-
-onMounted(() => { getServerData() });
-
-function getServerData() {
-  // 妯℃嫙浠庢湇鍔″櫒鑾峰彇鏁版嵁鏃剁殑寤舵椂
-  setTimeout(() => {
-    let res = {
-      categories: ['2016', '2017', '2018', '2019', '2020', '2021'],
-      series: [
-        {
-          name: '鐩爣鍊�',
-          data: [35, 36, 31, 33, 13, 34],
-        },
-        {
-          name: '瀹屾垚閲�',
-          data: [18, 27, 21, 24, 6, 28],
-        },
-      ],
-    };
-    chartData.value = JSON.parse(JSON.stringify(res));
-  }, 500);
+const userStore = useUserStore()
+const factoryId = ref('');
+const show = ref(false);
+const factoryList = ref([]);
+const factoryListTem = ref([]);
+const iconStyle = {
+	fontSize: '14px',
+	color: '#165DFF'
 }
+// 鍒涘缓鍝嶅簲寮忔暟鎹�
+const list = reactive([
+	{
+		name: 'photo',
+		title: '鍥剧墖'
+	},
+	{
+		name: 'lock',
+		title: '閿佸ご'
+	},
+	{
+		name: 'star',
+		title: '鏄熸槦'
+	},
+	{
+		name: 'hourglass',
+		title: '娌欐紡'
+	},
+	{
+		name: 'home',
+		title: '棣栭〉'
+	},
+	{
+		name: 'volume', // 娉ㄦ剰锛氳繖閲屼慨鏀逛簡 name 浠� 'star' 鏀逛负 'volume'锛屼互閬垮厤鍒楄〃涓袱涓厓绱犲叿鏈夌浉鍚岀殑 name
+		title: '闊抽噺'
+	},
+]);
+// 鍒涘缓瀵瑰瓙缁勪欢鐨勫紩鐢�
+const uToastRef = ref(null);
+
+function getUserLoginFacotryList() {
+	userLoginFacotryList({userName: userStore.nickName}).then(res => {
+		// 妫�鏌es.data鏄惁涓烘暟缁�
+		factoryList.value[0] = []
+		if (res.data && Array.isArray(res.data)) {
+			factoryListTem.value = res.data
+			res.data.forEach(item => {
+				factoryList.value[0].push(item.deptName)
+			})
+			factoryId.value = userStore.currentDeptId
+		} else {
+			// 濡傛灉res.data涓嶆槸鏁扮粍锛岃缃负绌烘暟缁�
+			factoryList.value = []
+		}
+	}).catch(error => {
+		modal.msgError('鑾峰彇鍏徃鍒楄〃澶辫触:', error)
+		factoryList.value = []
+	})
+}
+const changeFactory = async (arr) => {
+	show.value = false;
+	const factoryId = factoryListTem.value[arr.indexs[0]].deptId
+	const loginForm = {
+		username: userStore.name,
+		password: uni.getStorageSync('remembered_password'),
+		factoryId: factoryId,
+	}
+	modal.loading("鍒锋柊涓紝璇疯�愬績绛夊緟...")
+	userStore.loginCheckFactory(loginForm).then(() => {
+		modal.closeLoading()
+		nextTick(() => {
+			loginSuccess()
+		});
+	}).catch(() => {
+		modal.closeLoading()
+	})
+}
+function loginSuccess(result) {
+	uni.reLaunch({
+		url: '/pages/index'
+	});
+}
+
+// 瀹氫箟鏂规硶
+const click = (name) => {
+	if (uToastRef.value) {
+		uToastRef.value.success(`鐐瑰嚮浜嗙${name + 1}涓猔); // 娉ㄦ剰锛氳繖閲屽姞1鏄洜涓洪�氬父鎴戜滑鏄粠绗�1涓紑濮嬭鏁扮殑
+	}
+};
+
+onMounted(() => {
+	// 璁剧疆鐢ㄦ埛淇℃伅
+	userStore.getInfo()
+	getUserLoginFacotryList()
+});
 </script>
 
-<style scoped>
+<style scoped lang="scss">
 .content {
-  display: flex;
-  flex-direction: column;
-  align-items: center;
-  justify-content: center;
+	background-color: transparent !important;
+	padding: 14px;
 }
-
-.logo {
-  height: 200rpx;
-  width: 200rpx;
-  margin-top: 200rpx;
-  margin-left: auto;
-  margin-right: auto;
-  margin-bottom: 50rpx;
+.currentFactory {
+	margin-top: 12px;
+	margin-left: 6px;
+	font-weight: 400;
+	font-size: 14px;
+	display: flex;
 }
-
-.text-area {
-  display: flex;
-  justify-content: center;
+.factoryName {
+	width: auto;
 }
-
-.title {
-  font-size: 36rpx;
-  color: #8f8f94;
+:deep(.u-text) {
+	align-items: flex-end;
 }
-
-.charts-box {
-  width: 100%;
-  height: 300px;
+.bg-img {
+	margin-top: 12px;
+	width: 100%;
+	height: 145px;
+	background-color: #ffffff;
+	border-radius: 10px 10px 10px 10px;
+}
+.grid-text {
+	font-size: 14px;
+	color: #909399;
+	padding: 10rpx 0 20rpx 0rpx;
+	/* #ifndef APP-PLUS */
+	box-sizing: border-box;
+	/* #endif */
 }
 </style>

--
Gitblit v1.9.3