Explorar o código

志愿者列表增加地址code

chenjj hai 5 días
pai
achega
ce5437b453
Modificáronse 4 ficheiros con 47 adicións e 70 borrados
  1. 0 9
      api/volunteerDetailsApi/details.js
  2. 15 11
      pages/index.vue
  3. 18 49
      pages_home/pages/client/details.vue
  4. 14 1
      store/modules/user.ts

+ 0 - 9
api/volunteerDetailsApi/details.js

@@ -89,15 +89,6 @@ export function ordersCreateOrder(data) {
 }
 
 
-// 查询志愿者信息列表
-export function volunteerInfoList(params) {
-  return request({
-    url: '/core/volunteer/info/list',  
-    method: 'get',
-	params:params,
-  });
-}
-
 
 //查询所有业务列表(树形结构)
 export function volunteerSeachgetTreeList(params) {

+ 15 - 11
pages/index.vue

@@ -54,6 +54,7 @@ import { chooseLocationInit, locateTheCurrentAddress } from '@/utils/adress'
 import CustomTabBar from '@/components/CustomTabBar/index.vue'
 import { regionAddresstree } from '@/api/home.js'
 import { getToken } from '@/utils/auth'
+import store from '@/store'
 
 const rightList = ref([])
 const leftList = ref([])
@@ -68,18 +69,10 @@ const globalData = ref({
   navBarHeight: 91,
 })
 const data = reactive({
-  address: {
-    name: '重庆市',
-    latitude: 29.333000000000002,
-    longitude: 105.94909000000001,
-    cityCode: {
-      code: [500000, 500100, 500118],
-      data: ['重庆市', '重庆市', '永川区'],
-      index: [21, 0, 17],
-    },
-  },
+  address: store.state.user.addressInfo,
   queryValue: '',
 })
+console.log('--------index--------',data.address);
 
 // 分页
 const pages = ref({
@@ -126,12 +119,23 @@ const getList = async () => {
   try {
     loadmoreInfo.value.status = 'loading'
 
+
+    const { address } = data
+    const { cityCode, latitude, longitude } = address
     const params = {
       pageNum: pages.value.current,
       pageSize: pages.value.pageSize,
       serviceCategory: pages.value.serviceCategory || '',
       businessManagementId: 0,
-     
+
+      provinceName: cityCode.data[0], // 省
+      provinceCode: cityCode.code[0],
+      cityName: cityCode.data[1], // 市
+      cityCode: cityCode.code[1],
+      districtName: cityCode.data[2],
+      districtCode: cityCode.code[2],
+      latitude,
+      longitude,
     }
     const res = await volunteerinfolist(params)
 

+ 18 - 49
pages_home/pages/client/details.vue

@@ -73,58 +73,35 @@
 		ref,
 		onMounted,
 		reactive,
-		nextTick
 	} from 'vue';
 	import {
 		onLoad,
-		onShow,
 		onReachBottom
 	} from "@dcloudio/uni-app";
 
 	import {
-		typeOptionSelect,
-		volunteerInfoList,
-		getDetailsvolunteerId,
-		dictListlrRstudy,
-		dictListlrData,
-		volunteerSeachgetTreeList,
 		volunteerinfolist
 	} from "@/api/volunteerDetailsApi/details.js"
-
+	import store from '@/store'
 	import Tabs from "@/pages_home/components/tabs/index.vue"
 	import NoneView from '@/components/NoneView/index.vue'
 
-
-	const value1 = ref(1)
-	const value2 = ref(2)
 	const list1 = ref([])
 	const list2 = ref([])
 	const flowList = ref([]); //list数据
-	const listData = ref([])
 	const rightList = ref([])
 	const currentTabs2 = ref(0)
-	const total = ref(0)
 	const serviceCategory = ref('')
 	const leftList = ref([])
 	const showDropdown = ref(false)
-
 	const tabRef = ref(null)
-
 	const businessManagementId = ref(null)
-
-
-	const defaultTab = ref({
-		dictValue: 1
-	});
-
+	const data = reactive({
+		address: store.state.user.addressInfo,
+	})
 
 	const userType = uni.getStorageSync('userType') //读取本地存储
 
-	// 用户/志愿者 识别标识
-	const userOrWorker = uni.getStorageSync('storage_data').vuex_userOrWorker //读取本地存储
-
-
-
 	function handlTabs(record) {
 		clearList();
 		serviceCategory.value = record.parentId;
@@ -136,14 +113,6 @@
 		getList();
 	}
 
-	function clickList2(item, index) {
-		currentTabs2.value = index
-	}
-
-	function toggleDropdown() {
-		showDropdown.value = !showDropdown.value
-	}
-
 	const goToDetail = async (item) => {
 		const params = {
 			volunteerId: item.volunteerId, // 获取 volunteerId
@@ -155,13 +124,7 @@
 		});
 	}
 
-	const inputStyle = { //input輸入框樣式設置
-		borderRadius: '140rpx',
-		border: '1rpx solid #ccc',
-		height: '70rpx',
-		paddingLeft: '30rpx',
-		width: '600rpx',
-	}
+
 
 	onLoad((options) => {
 		const dataList = JSON.parse(decodeURIComponent(options.dataList));
@@ -205,11 +168,6 @@
 	}
 
 
-	// const getListAdderss = async () => {
-	// 	const res = await volunteerDataList()
-	// 	console.log(res, 'volunteerDataList>>>>>>>>>>')
-	// }
-
 
 	const getList = async () => {
 		try {
@@ -220,12 +178,21 @@
 				console.log('No businessManagementId selected');
 				return;
 			}
-
+			const { address } = data
+			const { cityCode, latitude, longitude } = address
 			// 请求时传递分页参数
 			const res = await volunteerinfolist({
 				pageNum: pages.value.current, // 当前页码
 				pageSize: pages.value.pageSize, // 每页大小
-				businessManagementId: businessManagementId.value
+				businessManagementId: businessManagementId.value,
+				provinceName: cityCode.data[0], // 省
+				provinceCode: cityCode.code[0],
+				cityName: cityCode.data[1], // 市
+				cityCode: cityCode.code[1],
+				districtName: cityCode.data[2],
+				districtCode: cityCode.code[2],
+				latitude,
+				longitude,
 			});
 
 			if (!res || !res.rows) {
@@ -267,6 +234,7 @@
 		if (pages.value.current < Math.ceil(pages.value.total / pages.value.pageSize)) {
 			pages.value.current += 1;
 			loadmoreInfo.value.status = 'loading';
+			
 			getList();
 		}
 	})
@@ -278,6 +246,7 @@
 		if (list1.value.length > 0) {
 			const defaultTab = list1.value[0];
 			businessManagementId.value = defaultTab.id;
+
 			getList();
 		}
 	})

+ 14 - 1
store/modules/user.ts

@@ -19,7 +19,17 @@ const user: Module<UserState, UserState> = {
     nickName: storage.get(constant.nickName),
     userId: storage.get(constant.userId),
     messageCount: 0,
-    wsManager: null
+    wsManager: null,
+    addressInfo: {
+      name: '重庆市永川区',
+      latitude: 29.333000000000002,
+      longitude: 105.94909000000001,
+      cityCode: {
+        code: [500000, 500100, 500118],
+        data: ['重庆市', '重庆市', '永川区'],
+        index: [21, 0, 17],
+      },
+    }
   },
   mutations: {
     SET_TOKEN: (state, token: string) => {
@@ -58,6 +68,9 @@ const user: Module<UserState, UserState> = {
     SET_MESSAGE: (state, ms:any) => {
       state.wsManager = ms
     },
+    SET_ADDRESSINFO: (state, data:any) => {
+      state.addressInfo = data
+    },
   },
 
   actions: {