瀏覽代碼

fix:冲突修改

jiayubo 2 周之前
父節點
當前提交
81f1959c4a

+ 175 - 0
components/CustomTabBar/index.vue

@@ -0,0 +1,175 @@
+<template>
+    <view class="tab_bar">
+        <view class="tabbarBox">
+            <view class="handleBox" v-for="(item, index) in tabBarList" :key="index">
+                <view class="menuBox" @click="goPages(item,index)">
+                    <view class="menuIcon">
+                        <image v-if="index != selectIndex" class="img" :src="item.iconPath"></image>
+                        <image v-else class="img" :src="item.selectedIconPath"></image>
+                    </view>
+                    <view class="menuName">
+                        <text :class="index == selectIndex ? 'TextColor' : 'Text'">{{ item.text }}</text>
+                    </view>
+                </view>
+            </view>
+        </view>
+
+    </view>
+</template>
+
+<script>
+export default {
+    props: {
+        page: {
+            type: String,
+            default: "homeIndex"
+        }
+    },
+    watch: {
+        page: {
+            handler(value) {
+                console.log('value',value);
+                
+                this.selectIndex = value;
+            },
+            immediate: true,
+            deep: true
+        }
+    },
+    data() {
+        return {
+            selectIndex: null,
+            userType: uni.getStorageSync('userType') //读取本地存储
+        }
+    },
+    computed: {
+        //获取当前页面
+        tabBarList() {
+            if(this.userType === 1){
+                return [
+                {
+                    "pagePath": "/pages/index",
+                    "iconPath": "/static/images/tabbar/home.png",
+                    "selectedIconPath": "/static/images/tabbar/home_.png",
+                    "text": "首页",
+                },
+                {
+                    "pagePath": "/pages/mallMenu",
+                    "iconPath": "/static/images/tabbar/class.png",
+                    "selectedIconPath": "/static/images/tabbar/class_.png",
+                    "text": "分类",
+                },
+                {
+                    "pagePath": "/pages/classify",
+                    "iconPath": "/static/images/tabbar/work.png",
+                    "selectedIconPath": "/static/images/tabbar/work_.png",
+                    "text": "订单",
+                },
+                {
+                    "pagePath": "/pages/mine",
+                    "iconPath": "/static/images/tabbar/mine.png",
+                    "selectedIconPath": "/static/images/tabbar/mine_.png",
+                    "text": "我的",
+                }
+            ]
+            }
+            return [
+                {
+                    "pagePath": "/pages/index",
+                    "iconPath": "/static/images/tabbar/home.png",
+                    "selectedIconPath": "/static/images/tabbar/home_.png",
+                    "text": "首页",
+                },
+                // {
+                //     "pagePath": "/pages/scheduling",
+                //     "iconPath": "/static/images/tabbar/class.png",
+                //     "selectedIconPath": "/static/images/tabbar/class_.png",
+                //     "text": "排班",
+                // },
+                {
+                    "pagePath": "/pages/mallMenu",
+                    "iconPath": "/static/images/tabbar/class.png",
+                    "selectedIconPath": "/static/images/tabbar/class_.png",
+                    "text": "分类",
+                },
+                {
+                    "pagePath": "/pages/classify",
+                    "iconPath": "/static/images/tabbar/work.png",
+                    "selectedIconPath": "/static/images/tabbar/work_.png",
+                    "text": "订单",
+                },
+                {
+                    "pagePath": "/pages/mine",
+                    "iconPath": "/static/images/tabbar/mine.png",
+                    "selectedIconPath": "/static/images/tabbar/mine_.png",
+                    "text": "我的",
+                }
+            ]
+        }
+    },
+    //uniapp子组件不支持应用生命周期,所以只能用vue生命周期
+    created() {
+
+
+
+    }, 
+    methods: {
+        //进入tabble页
+        goPages(page,index) {
+            console.log('page,index',page,index,this.userType);
+            uni.switchTab({
+                url: page.pagePath
+            })
+        },
+
+    },
+}
+</script>
+<style lang="scss">
+.tab_bar {
+    width: 100vw;
+    height: 150rpx;
+    position: fixed;
+    bottom: 0rpx;
+    /* 模糊大小就是靠的blur这个函数中的数值大小 */
+    // backdrop-filter: blur(10px);
+    // border-radius: 60rpx;
+    background-color: #fff;
+
+    .tabbarBox {
+        display: flex;
+        margin-top: 10rpx;
+        justify-content: space-evenly;
+
+
+        .handleBox {
+            width: 20vw;
+            height: 110rpx;
+
+
+            .menuBox {
+                padding: 0rpx 20rpx;
+                width: 120rpx;
+                height: 98%;
+                text-align: center;
+
+                .img {
+                    width: 50rpx;
+                    height: 50rpx;
+                }
+            }
+        }
+    }
+}
+
+.Text {
+    font-size: 24rpx;
+    font-family: Cochin, serif;
+    font-weight: 900;
+}
+
+.TextColor {
+    @extend .Text;
+    color: #d81e06;
+}
+</style>

+ 0 - 2
components/a.js

@@ -1,2 +0,0 @@
-import addressData from '@/pages_mine/components/pickerAddress/address.js';
-export default addressData;

+ 2 - 2
manifest.json

@@ -52,7 +52,7 @@
     "mp-weixin" : {
         "appid" : "wxe8a05852410396cf",
         "setting" : {
-            "urlCheck" : true,
+            "urlCheck" : false,
             "postcss" : true,
             "minified" : true
         },
@@ -64,7 +64,7 @@
         "requiredPrivateInfos" : [ "getLocation", "chooseLocation" ],
         "permission" : {
             "scope.userLocation" : {
-                "desc" : "你的位置信息将用于警情上报"
+                "desc" : "你的位置信息将用于小程序定位"
             }
         },
         "mergeVirtualHostAttributes" : true

+ 17 - 0
pages.json

@@ -53,6 +53,12 @@
 			"style": {
 				"navigationBarTitleText": "分类"
 			}
+		},
+		{
+			"path": "pages/scheduling",
+			"style": {
+				"navigationBarTitleText": "排班管理"
+			}
 		}
 	],
 	"subPackages": [
@@ -197,7 +203,11 @@
 					"style": {
 						"navigationBarTitleText": "服务地址修改"
 					}
+				},
+				{
+					"path": "components/pickerAddress/pickerAddress"
 				}
+				
 			]
 		},
 		{
@@ -299,6 +309,7 @@
 		}
 	],
 	"tabBar": {
+		"custom": true,
 		"color": "#000000",
 		"selectedColor": "#000000",
 		"borderStyle": "white",
@@ -317,6 +328,12 @@
 				"text": "分类",
 				"visible": false
 			},
+			{
+				"pagePath": "pages/scheduling",
+				"iconPath": "static/images/tabbar/class.png",
+				"selectedIconPath": "static/images/tabbar/class_.png",
+				"text": "排班"
+			},
 			{
 				"pagePath": "pages/classify",
 				"iconPath": "static/images/tabbar/work.png",

+ 4 - 2
pages/classify.vue

@@ -17,6 +17,8 @@
 		</view>
 		<!-- 用户 -->
 		<OrderList :dataList="dataList" :dictSort="dictData" @fetchData="getListData" v-else />
+
+		<custom-tab-bar :page="2"/>
 	</view>
 </template>
 
@@ -47,7 +49,7 @@
 		userMainOrderList,
 		systemDictdaTalist
 	} from "@/api/userList.js"
-
+	import CustomTabBar from '@/components/CustomTabBar/index.vue'
 	const {
 		order_status,
 		// lrr_service_status
@@ -209,7 +211,7 @@
 		.list {
 			position: fixed;
 			top: 50px;
-			bottom: 0px;
+			bottom: 150rpx;
 			left: 0px;
 			right: 0px;
 		}

+ 16 - 13
pages/index.vue

@@ -46,8 +46,9 @@
 				:loadmoreText="loadmoreInfo.loadingText" :loadingText="loadmoreInfo.loadmoreText"
 				:nomoreText="loadmoreInfo.nomoreText" @loadmore="handleLoadmore" v-if="userType == 1" />
 
-
 		</view>
+
+		<custom-tab-bar  :page="0"/>
 	</view>
 </template>
 
@@ -80,9 +81,8 @@
 	import {
 		useDict
 	} from '@/utils/dict.js';
-	import {
-		citySelectorNavigateTo
-	} from '@/utils/adress'
+	import { citySelectorNavigateTo } from '@/utils/adress'
+	import CustomTabBar from '@/components/CustomTabBar/index.vue'
 
 	const total = ref(0)
 	const listData = ref([])
@@ -216,15 +216,14 @@
 	onShow(() => {
 		getBanners();
 
-		// 在 App.vue  中初始化 
-		uni.getSystemInfo({
-			success: (res) => {
-				const statusBarHeight = res.statusBarHeight;
-				const navBarHeight = res.platform === 'android' ? 48 : 44 + res.statusBarHeight;
-				globalData.value = {
-					statusBarHeight,
-					navBarHeight
-				};
+	// 在 App.vue  中初始化 
+	uni.getSystemInfo({
+		success: (res) => {
+			const statusBarHeight = res.statusBarHeight;
+			console.log('res',res);
+			
+			const navBarHeight = res.platform === 'android' ? 48 : 44 + res.statusBarHeight;
+			globalData.value = { statusBarHeight, navBarHeight };
 
 			}
 		});
@@ -268,6 +267,10 @@
 			left: 0px;
 			right: 0;
 			z-index: 99;
+			bottom: 150rpx;
+		}
+		.home-box {
+			padding-bottom: 150rpx;
 		}
 
 		.home-banner-left {

+ 11 - 4
pages/mallMenu.vue

@@ -27,13 +27,17 @@
                 </view>
             </scroll-view>
         </view>
+        <CustomTabBar :page="1"/>
     </view>
 </template>
 <script>
 import { getTreeList } from '@/api/volunteer'
 import { volunteerSeachgetTreeList } from "@/api/volunteerDetailsApi/details.js"
 import { getVolunteerInfo } from '@/api/volunteer.js'
+import CustomTabBar from '@/components/CustomTabBar/index.vue'
+
 export default {
+    components:{CustomTabBar},
     data() {
         return {
             scrollTop: 0, //tab标题的滚动条位置
@@ -222,12 +226,15 @@ export default {
 
 <style lang="scss" scoped>
 .u-wrap {
-    height: calc(100vh);
-    /* #ifdef H5 */
-    height: calc(100vh - var(--window-top));
-    /* #endif */
     display: flex;
     flex-direction: column;
+
+    position: fixed;
+    top: 0px;
+    left: 0px;
+    right: 0px;
+    bottom: 150rpx;
+
 }
 
 .u-search-box {

+ 6 - 4
pages/mine.vue

@@ -66,7 +66,7 @@
 			</view>
 		</view>
 
-
+		<custom-tab-bar  :page="3"/>
 	</view>
 </template>
 
@@ -78,7 +78,7 @@ import {
 } from '@dcloudio/uni-app';
 import store from "@/store"
 import { getVolunteerAccountInfo,volunteerOrderStatistics } from "@/api/mine";
-
+import CustomTabBar from '@/components/CustomTabBar/index.vue'
 const userInfo = ref({
 	avatar: '/static/serverImg/mine/user.png'
 })
@@ -102,7 +102,9 @@ const priceList = [{
 {
 	name: '订单总数',
 	key: 'orderCount',
-	decimals: 0
+	decimals: 0,
+	switchPage: '/pages/classify',
+	value: 0
 }
 ]
 const orderList = ref([{
@@ -308,7 +310,7 @@ const init = async() => {
 	left: 0;
 	top: 0;
 	right: 0;
-	bottom: 0;
+	bottom: 150rpx;
 	background: rgba(245, 245, 245, 1);
 	overflow-y: auto;
 

+ 123 - 0
pages/scheduling.vue

@@ -0,0 +1,123 @@
+<template>
+    <view class="uni-calendar">
+
+        <Calendar ref="calendar" class="uni-calendar--hook" :clear-date="false" :date="info.date" :insert="info.insert"
+            :lunar="info.lunar" :range="info.range" @change="change" :clearDate="true" @confirm="confirm"
+            :selected="selected" @delete="onDelete" />
+
+        <CustomTabBar :page="1" />
+    </view>
+</template>
+<script setup>
+import {
+		ref,
+		onMounted,
+		watch,
+		computed,
+		provide
+	} from 'vue';
+	import {
+		workDate,
+		getDataTime,
+		getVolunteerInfo
+	} from '@/api/volunteer.js'
+    import {
+		volunteerSeachgetTreeList,
+		volunteerDataList
+	} from "@/api/volunteerDetailsApi/details.js"
+    import {
+	onLoad,
+	onShow
+} from '@dcloudio/uni-app';
+import CustomTabBar from '@/components/CustomTabBar/index.vue'
+import Calendar from '@/components/uni-calendar/components/uni-calendar/uni-calendar.vue'
+
+const selected = ref([])
+const info = ref({
+    lunar: true,
+    range: true,
+    insert: true,
+})
+const calendar = ref(null)
+const change = (e) => {
+    console.log('change', e);
+    let dates = [{
+        date: e.fulldate,
+        info: `${e.time.startTime}~${e.time.endTime}`,
+        time: e.time
+    }]
+    if (e.range.before && e.range.after) {
+        dates = e.range.data.map(item => {
+            return {
+                date: item,
+                info: `${e.time.startTime}~${e.time.endTime}`,
+                time: e.time
+            }
+        })
+    }
+    selected.value = [...selected.value, ...dates]
+}
+
+const onDelete = (e) => {
+    selected.value = selected.value.filter(item => {
+        console.log('item.fulldate !== e.date', item.date, e.fulldate);
+
+        return item.date !== e.fulldate
+    })
+    console.log(e, selected.value);
+}
+
+const confirm = (e) => {
+    const parmas = handleDates.value;
+    console.log('确定', parmas);
+    workDate(parmas).then(res => {
+        if (res.code == 200) {
+            uni.showToast({
+                title: '修改成功',
+                icon: 'success',
+                success: () => {
+                    setTimeout(() => {
+                        close();
+                    }, 1000)
+                }
+            })
+
+            return;
+        }
+        uni.showToast({
+            title: res.msg,
+            icon: 'none'
+        })
+    })
+};
+const close = () => {
+    calendar.value.close();
+}
+
+const init = () => {
+		getDataTime().then(res => {
+			console.log('res', res);
+			if (res.code === 200) {
+				selected.value = res.data.map(item => {
+					return {
+						date: item.workDate,
+						info: `${item.workStartTime}~${item.workEndTime}`,
+						time: {
+							startTime: item.workStartTime,
+							endTime: item.workEndTime
+						}
+					}
+				})
+				calendar.value.open();
+			}
+		})
+	}
+
+
+    onShow(() => {
+        init();
+    })
+
+	onMounted(() => {
+	});
+</script>

+ 2 - 2
pages_home/components/cust-form/index.vue

@@ -123,9 +123,9 @@ import {
     onShow,
     onUnload
 } from "@dcloudio/uni-app";
-// import { splitAddress,getCityCode } from '@/utils/adress'
+import { splitAddress,getCityCode } from '@/utils/adress'
 
-// import pickerAddress from '@/components/pickerAddress/pickerAddress.vue'
+import pickerAddress from '../pickerAddress/pickerAddress.vue'
 
 const props = defineProps({
     column: {

文件差異過大導致無法顯示
+ 30050 - 0
pages_home/components/pickerAddress/address.js


文件差異過大導致無法顯示
+ 4915 - 0
pages_home/components/pickerAddress/areadata.js


+ 135 - 0
pages_home/components/pickerAddress/pickerAddress.vue

@@ -0,0 +1,135 @@
+<template>
+	<!-- 地址选择器组件 -->
+	<picker @change="bindPickerChange" @columnchange="columnchange" :range="array" range-key="name" :value="value" mode="multiSelector">
+			<slot></slot>
+	</picker>
+</template>
+
+<script>
+// import AllAddress from './areadata.js'
+import AllAddress from './address.js'
+let selectVal = ['','','']
+let selectCode = ['','','']
+export default {
+		data() {
+			return{
+				value: [0,0,0],
+				array: [],
+				index: 0
+			}
+		},
+		props:{
+			selectValue: {
+				type: Array,
+				default: [0,0,0]
+			}
+		},
+		created() {
+			this.value = this.selectValue
+			this.initSelect()
+		},
+		methods:{
+			// 初始化地址选项
+			initSelect() {
+				this.updateSourceDate() // 更新源数据
+				.updateAddressDate() // 更新结果数据
+				.$forceUpdate()  // 触发双向绑定
+			},
+			// 地址控件改变控件
+			columnchange(d) {
+				this.updateSelectIndex(d.detail.column, d.detail.value) // 更新选择索引
+				.updateSourceDate() // 更新源数据
+				.updateAddressDate() // 更新结果数据
+				.$forceUpdate()  // 触发双向绑定
+			},
+			
+			/**
+			 * 更新源数据
+			 * */
+			updateSourceDate() {
+				// console.log(AllAddress, '>>>>>>>AllAddress');
+				this.array = []
+				// this.array[0] = AllAddress.map(obj => {
+				// 	return { name: obj.name }
+				// })
+				// this.array[1] = AllAddress[this.value[0]].city.map(obj => {
+				// 	return { name: obj.name }
+				// })
+				// this.array[2] = AllAddress[this.value[0]].city[this.value[1]].area.map(obj => { 
+				// 	return { name: obj }
+				// })
+				
+				
+				this.array[0] = AllAddress.map(obj => {
+					return {
+						name: obj.name,
+						code: obj.code
+					}
+				})
+				this.array[1] = AllAddress[this.value[0]].children.map(obj => {
+					return {
+						name: obj.name,
+						code: obj.code
+					}
+				})
+				this.array[2] = AllAddress[this.value[0]].children[this.value[1]].children.map(obj => { 
+					return {
+						name: obj.name,
+						code: obj.code
+					}
+				})
+				return this
+			},
+			
+			/**
+			 * 更新索引
+			 * */
+			updateSelectIndex(column, value){
+				let arr = JSON.parse(JSON.stringify(this.value)) 
+				arr[column] = value
+				if(column === 0 ) {
+						arr[1] = 0
+						arr[2] = 0
+				}
+				if(column === 1 ) {
+						arr[2] = 0
+				}
+				this.value = arr
+				return this
+			},
+			
+			/**
+			 * 更新结果数据 
+			 * */
+			updateAddressDate() {
+				selectVal[0] = this.array[0][this.value[0]].name
+				selectVal[1] = this.array[1][this.value[1]].name 
+				selectVal[2] = this.array[2][this.value[2]].name 
+				
+				selectCode[0] = this.array[0][this.value[0]].code
+				selectCode[1] = this.array[1][this.value[1]].code 
+				selectCode[2] = this.array[2][this.value[2]].code 
+				
+				
+				return this
+			},
+			
+			/**
+			 * 点击确定
+			 * */
+			bindPickerChange(e) {
+				this.$emit('change', {
+					index: this.value,
+					data: selectVal,
+					code: selectCode
+				})
+				console.log(selectCode)
+				return this
+			}
+		}
+}
+</script>
+
+<style>
+</style>
+

+ 145 - 0
pages_mine/components/pickerAddress/adress.js

@@ -0,0 +1,145 @@
+import config from '@/config'
+const mapKey = config.mapKey;
+const appName = config.appName;
+
+import addressData from './address'
+
+
+/**
+ * 腾讯位置服务地图选点
+ */
+const chooseLocationInit = () => {
+  const key = mapKey; //使用在腾讯位置服务申请的key
+  const referer = appName; //调用插件的app的名称
+  wx.navigateTo({
+    url: `plugin://chooseLocation/index?key=${key}&referer=${referer}`,
+  });
+
+}
+
+/**
+ * 腾讯位置服务城市选择器
+ * @param {*} city 城市名称
+ */
+const citySelectorNavigateTo = (city) => {
+  const key = mapKey; // 使用在腾讯位置服务申请的key
+  const referer = appName; // 调用插件的app的名称
+  const hotCitys = '重庆'; // 用户自定义的的热门城市
+
+  wx.navigateTo({
+    url: `plugin://citySelector/index?key=${key}&referer=${referer}&hotCitys=${hotCitys}`,
+  })
+}
+
+function splitAddress(address) {
+  // 处理直辖市(如北京市朝阳区)
+  const directCityRegex = /^(北京|天津|上海|重庆)(市)?(.+?区)/;
+  const directMatch = address.match(directCityRegex);
+  if (directMatch) {
+    return {
+      province: directMatch[1],
+      city: directMatch[1] + '市',
+      district: directMatch[3],
+      detail: address.replace(directCityRegex, '')
+    }
+  }
+
+  // 常规拆分逻辑 
+  const provinceRegex = /(.+?(省|自治区|行政区|特别行政区))/;
+  const cityRegex = /(.+?(市|自治州|州|盟))/;
+
+  const province = address.match(provinceRegex)?.[1] || '';
+  const city = address.replace(province, '').match(cityRegex)?.[1] || '';
+  const remaining = address.replace(province + city, '');
+  const district = remaining.match(/(.+?( 区|县|市|旗))/)?.[1] || '';
+  const detail = remaining.replace(district, '').trim();
+
+  return { province, city, district, detail };
+}
+
+
+function normalizeAddress(str) {
+  return str.replace(/(市|区|省)/g, '').trim();
+}
+/**
+ * 根据地址字符串返回 name 数组、code 数组、index 路径
+ * @param {string} address 例如:"重庆 重庆市 永川区"
+ * @returns {Object|null} 包含 data/name、code、index 的对象
+ */
+const getCityCode = (address) => {
+  // //address:重庆市永川区人民大道191号
+  // const names = normalizeAddress(address).split(/\s+/);
+  // let result = [];
+
+  // // 查找省份
+  // let province = addressData.find(p => p.name.includes(names[0]));
+  // if (!province) return [];
+
+  // result.push(province.code);
+
+  // if (names.length < 2) return result;
+
+  // // 查找城市
+  // let city = province.children?.find(c => c.name.includes(names[1]));
+  // if (!city) return result;
+
+  // result.push(city.code);
+
+  // if (names.length < 3) return result;
+
+  // // 查找区县
+  // let district = city.children?.find(d => d.name.includes(names[2]));
+  // if (!district) return result;
+
+  // result.push(district.code);
+
+  // return result;
+
+  const names = address.split(/\s+/)
+  const result = {
+    data: [],
+    code: [],
+    index: []
+  }
+
+  // 查找省份
+  const provinceIndex = addressData.findIndex(p => p.name.includes(names[0]))
+  if (provinceIndex === -1) return null
+
+  const province = addressData[provinceIndex]
+  result.data.push(province.name)
+  result.code.push(province.code)
+  result.index.push(provinceIndex)
+
+  if (names.length < 2) return result
+
+  // 查找城市
+  const cityIndex = province.children.findIndex(c => c.name.includes(names[1]))
+  if (cityIndex === -1) return result
+
+  const city = province.children[cityIndex]
+  result.data.push(city.name)
+  result.code.push(city.code)
+  result.index.push(cityIndex)
+
+  if (names.length < 3) return result
+
+  // 查找区县
+  const districtIndex = city.children.findIndex(d => d.name.includes(names[2]))
+  if (districtIndex === -1) return result
+
+  const district = city.children[districtIndex]
+  result.data.push(district.name)
+  result.code.push(district.code)
+  result.index.push(districtIndex)
+
+  return result
+
+
+}
+export {
+  chooseLocationInit,
+  citySelectorNavigateTo,
+  splitAddress,
+  getCityCode
+}

二進制
static/images/tabbar/class.png


二進制
static/images/tabbar/class_.png


二進制
static/images/tabbar/home.png


二進制
static/images/tabbar/home_.png


二進制
static/images/tabbar/mine.png


二進制
static/images/tabbar/mine_.png


二進制
static/images/tabbar/work.png


二進制
static/images/tabbar/work_.png


+ 2 - 1
static/sdk/qqmap-wx-jssdk.js

@@ -1119,4 +1119,5 @@ class QQMapWX {
   }
 };
 
-module.exports = QQMapWX;
+module.exports = QQMapWX;
+// export default QQMapWX;

文件差異過大導致無法顯示
+ 30050 - 0
utils/address.js


+ 2 - 1
utils/adress.js

@@ -2,7 +2,8 @@ import config from '@/config'
 const mapKey = config.mapKey;
 const appName = config.appName;
 
-import addressData from '@/components/a.js'
+import addressData from './address.js';
+
 
 /**
  * 腾讯位置服务地图选点