Browse Source

修改localStorage存储

lsh 4 months ago
parent
commit
b5a1f5cbad

+ 1 - 0
App.vue

@@ -32,6 +32,7 @@ export default {
 					formData.value.authCode = result.auth_code
 				 }
 				 globalParameter.value.authCode = formData.value.authCode
+				localStorage.setItem('authCode', formData.value.authCode);
 			}).catch(err => {
 				link.goLogin()
 			})

+ 4 - 4
lib/config/index.ts

@@ -3,13 +3,13 @@
 // const  SERVER= 'http://127.0.0.1:48080'
 
 // //--- 本地服务器
-// export const  SERVER= ''
-export const  SERVER= 'http://192.168.31.36:48088'
+export const  SERVER= ''
+// export const  SERVER= 'http://192.168.31.36:48088'
 
 // //--- 正式服务器
 // export const SERVER = '/'
-export const BASE_URL = SERVER + '/admin-api'
-// export const BASE_URL = SERVER + '/zyyyyjs/admin-api'
+// export const BASE_URL = SERVER + '/admin-api'
+export const BASE_URL = SERVER + '/zyyyyjs/admin-api'
 
 export const VITE_UPLOAD_URL = 'http://192.168.31.36:48080'
 

+ 1 - 0
lib/store.ts

@@ -7,6 +7,7 @@ export const useUserStore = defineStore('user', {
         authCode: '',
 		userName: '',
 		zjhm: '',
+		isLeader: false,
       }
     }
   }

+ 5 - 0
pages/accredit/index.vue

@@ -30,6 +30,7 @@
 					 formData.value.authCode = result.auth_code
 				 }
 				globalParameter.value.authCode = formData.value.authCode
+				localStorage.setItem('authCode', formData.value.authCode);
 				setTimeout(() => { 
 					getUserInfo(formData.value.authCode); 
 				}, 0);
@@ -43,6 +44,10 @@
 	const getUserInfo = async (authCode) => {
 	  try {
 		let res = await rest.post('/zyyp/ykz/getUserInfo?authCode='+ authCode,'')
+		localStorage.setItem('zjhm', res.openid);
+		localStorage.setItem('userName', res.lastName);
+		localStorage.setItem('isLeader', res.leader);
+		// alert("查看内容(2):" + JSON.stringify(res))
 		link.goBJList(aesEncrypt(res.openid),aesEncrypt(res.lastName))
 	  } catch (error) {
 	    console.error(error);

+ 28 - 2
pages/feedback/FeedbackList.vue

@@ -1,7 +1,7 @@
 <template>
 	<view class="feedback-list-view">
 		<pub-list-scroll ref="pubListScrollRef" @next="onScrollTolower" :loaded="loaded" :text="loadText" :status="status">
-			<view class="no-data" v-if="!listArray || listArray.length == 0">
+			<view class="no-data feedback-no" v-if="!listArray || listArray.length == 0">
 				<image mode="heightFix" src="/static/image/no-data.png" />
 				暂无数据
 			</view>
@@ -22,6 +22,10 @@
 					</view>
 				</view>
 			</view>
+			<view class="footnote_content">
+				<view>本服务由重庆两江新区社会发展局提供</view>
+				<view class="footnote_phone">服务咨询热线:<view class="phone_text" @click="makeCall">023-67685085</view></view>
+			</view>
 		</pub-list-scroll>
 	</view>
 </template>
@@ -57,6 +61,9 @@
 	const onClick = (item:any)=> {
 		emit("click",item)
 	}
+	const makeCall = ()=> {
+		window.location.href = 'tel:023-67685085';
+	}
 </script>
 
 
@@ -134,7 +141,10 @@
 			}
 			
 		}
-		
+		.feedback-no {
+			height: 300px;
+			height: calc(100vh - 200px);
+		}
 		::v-deep .scroll-view {
 			height: calc(100%);
 			background-color: transparent !important;
@@ -146,4 +156,20 @@
 		}
 		
 	}
+	.footnote_content {
+		  background-color: #F6F7F8;
+		  @include flex-center;
+		  height: 136rpx;
+		  flex-direction: column;
+		  font-weight: 400;
+		  font-size: 24rpx;
+		  color: #B3B5B9;
+		  line-height: 40rpx;
+		  .footnote_phone {
+			display: flex;
+			.phone_text {
+				color: #1E92F0;
+			}
+		  }
+	}
 </style>

+ 9 - 1
pages/feedback/details.vue

@@ -62,7 +62,7 @@
 	import rest from '@/stores/rest'
 	import dlg from '@/lib/dlg.ts'
 	import * as link from '@/lib/link'
-	import { onLoad } from "@dcloudio/uni-app";
+	import { onLoad, onShow } from "@dcloudio/uni-app";
 	import PickerType from './PickertType.vue'
 	import { feedbackVO } from '../../lib/type';
 	import { formatDate } from '@/lib/util'
@@ -205,6 +205,14 @@
 		if (data.id){
 			itemId.value = data.id
 		}
+	})
+	
+	onShow(() => {
+		if (!globalParameter.value.zjhm || !globalParameter.value.userName || !globalParameter.value.authCode) {
+		  globalParameter.value.zjhm = localStorage.getItem('zjhm');
+		  globalParameter.value.userName = localStorage.getItem('userName');
+		  globalParameter.value.authCode = localStorage.getItem('authCode');
+		}
 		getInfo()
 	})
 </script>

+ 26 - 39
pages/feedback/index.vue

@@ -9,16 +9,20 @@
 		<!-- 内容 -->
 		<swiper :current="navIndex" @change="tabChange" class="swiper_content">
 			<swiper-item class="swiper_item">
-				<FeedbackList :listArray="listArray" @click="onClick" @nextPage="onNextPage" />
+				<DetailedFeedbackList v-if="globalParameter.isLeader" :listArray="listArray" />
+				<FeedbackList v-else :listArray="listArray" @click="onClick" @nextPage="onNextPage" />
 			</swiper-item>
 			<swiper-item class="swiper_item">
-				<FeedbackList :listArray="listArray"  @click="onClick" @nextPage="onNextPage"  />
+				<DetailedFeedbackList v-if="globalParameter.isLeader" :listArray="listArray" />
+				<FeedbackList v-else :listArray="listArray"  @click="onClick" @nextPage="onNextPage"  />
 			</swiper-item>
 			<swiper-item class="swiper_item">
-				<FeedbackList :listArray="listArray"  @click="onClick" @nextPage="onNextPage"  />
+				<DetailedFeedbackList v-if="globalParameter.isLeader" :listArray="listArray" />
+				<FeedbackList v-else :listArray="listArray"  @click="onClick" @nextPage="onNextPage"  />
 			</swiper-item>
 			<swiper-item class="swiper_item">
-				<FeedbackList :listArray="listArray"  @click="onClick" @nextPage="onNextPage"  />
+				<DetailedFeedbackList v-if="globalParameter.isLeader" :listArray="listArray" />
+				<FeedbackList v-else :listArray="listArray"  @click="onClick" @nextPage="onNextPage"  />
 			</swiper-item>
 		</swiper>
 		<!-- 新增 -->
@@ -26,22 +30,18 @@
 			<image class="add-icon" src="/static/image/add-icon.svg" mode="aspectFit"></image>
 			<view class="add-title">登记</view>
 		</view>
-		<!-- 脚注 -->
-		<view class="footnote_content">
-			<view>本服务由重庆两江新区社会发展局提供</view>
-			<view class="footnote_phone">服务咨询热线:<view class="phone_text" @click="makeCall">023-67685085</view></view>
-		</view>
 	</view>
 </template>
 
 <script setup lang="ts">
-	import { ref, onMounted } from "vue"
+	import { ref } from "vue"
 	import * as link from '@/lib/link'
 	import rest from '@/stores/rest'
 	import { onLoad, onShow } from "@dcloudio/uni-app";
 	import { aesEncrypt, aesDecrypt } from "@/lib/encryption";
 	import { formatDate } from '@/lib/util'
 	import FeedbackList from './FeedbackList.vue'
+	import DetailedFeedbackList from './DetailedFeedbackList.vue'
 	
 	import { useUserStore } from '@/lib/store';
 	import { storeToRefs } from 'pinia';
@@ -139,10 +139,15 @@
 	  { title: '办件编号', key: 'id' },
 	  { title: '登记时间', key: 'createTime' },
 	];
+	const leaderArray = [
+		{ title: '编号', key: 'id' },
+		{ title: '内容', key: 'fkxq' },
+	]
 	
 	const getFormattedData = (listData) => {
+	  const selectedArray = globalParameter.value.isLeader ? leaderArray : titleArray;
 	  const formattedData = listData.map(item => {
-		const formattedItem = titleArray.map(titleItem => {
+		const formattedItem = selectedArray.map(titleItem => {
 		  let value = item[titleItem.key];
 		  if (titleItem.key === 'createTime') {
 		    value = formatDate(item[titleItem.key], '{y}-{m}-{d} {h}:{i}:{s}');
@@ -175,10 +180,6 @@
 		getList();
 	}
 	
-	const makeCall = ()=> {
-		window.location.href = 'tel:023-67685085';
-	}
-	
 	const onClick = (e)=> {
 		link.goBJDetails(e.id)
 	}
@@ -187,22 +188,24 @@
 	}
 	
 	onLoad((data) => {
-		alert("onLoad:" + JSON.stringify(globalParameter.value))
+		// alert("onLoad:" + JSON.stringify(globalParameter.value))
 		queryParams.value.zjhm = aesDecrypt(data.hzsfzh)
 		let zjhm = aesDecrypt(data.hzsfzh)
 		let name = aesDecrypt(data.hzxm)
-		globalParameter.value.zjhm = zjhm
-		globalParameter.value.userName = name
 	})
 	
 	onShow(() => { 
-		alert("onShow:" + JSON.stringify(globalParameter.value))
 		queryParams.value.pageNo = 1;
+		if (!globalParameter.value.zjhm || !globalParameter.value.userName || !globalParameter.value.authCode || !globalParameter.value.isLeader) {
+			queryParams.value.zjhm = localStorage.getItem('zjhm');
+		  globalParameter.value.zjhm = localStorage.getItem('zjhm');
+		  globalParameter.value.userName = localStorage.getItem('userName');
+		  globalParameter.value.authCode = localStorage.getItem('authCode');
+		}
+		const isLeaderStr = localStorage.getItem('isLeader');
+		globalParameter.value.isLeader = isLeaderStr === 'true';
 		getList()
 	})
-	onMounted(() => {
-		alert("onMounted:" + JSON.stringify(globalParameter.value))
-	});
 </script>
 
 
@@ -211,7 +214,7 @@
   display: flex;
   background-color: #f2f2f2;
   flex-direction: column;
-  height: calc(100vh - 84rpx);
+  height: calc(100vh);
   position: relative;
 
   .scroll-view {
@@ -284,21 +287,5 @@
 		  font-weight: 600;
 	  }
   }
-  .footnote_content {
-	  background-color: #F6F7F8;
-	  @include flex-center;
-	  height: 136rpx;
-	  flex-direction: column;
-	  font-weight: 400;
-	  font-size: 24rpx;
-	  color: #B3B5B9;
-	  line-height: 40rpx;
-	  .footnote_phone {
-		display: flex;
-		.phone_text {
-			color: #1E92F0;
-		}
-	  }
-  }
 }
 </style>

+ 9 - 1
pages/login/index.vue

@@ -20,7 +20,13 @@
 	import dlg from '@/lib/dlg'
 	import { aesEncrypt, aesDecrypt } from "@/lib/encryption"
 	import * as link from '@/lib/link'
-
+	
+	import { useUserStore } from '@/lib/store';
+	import { storeToRefs } from 'pinia';
+	
+	const store = useUserStore();
+	const { globalParameter } = storeToRefs(store);
+	
 	const formData = ref({
 		hzxm: '',
 		hzsfzh: '',
@@ -56,6 +62,8 @@
 		formRef.value.validate().then(async res => {
 			// 提交请求
 			try {
+				globalParameter.value.authCode = formData.value.hzsfzh
+				localStorage.setItem('authCode', formData.value.hzsfzh);
 				link.goBJList(aesEncrypt(formData.value.hzsfzh),aesEncrypt(formData.value.hzxm))
 			} catch (e) {
 				dlg.error(e)

+ 2 - 1
static/style/base.scss

@@ -253,7 +253,8 @@ uni-toast{
 
 .no-data {
 	margin-top: 160rpx;
-	@include flex-center;
+	display: flex;
+	align-items: center;
 	flex-direction: column;
 
 	image {