张文飞 3 éve
szülő
commit
a534bce87c
2 módosított fájl, 20 hozzáadás és 30 törlés
  1. 17 27
      components/subComponents/dmHomeChoose.vue
  2. 3 3
      pages/homePage/homePage.vue

+ 17 - 27
components/subComponents/dmHomeChoose.vue

@@ -22,16 +22,11 @@
 					<view class="content_right">
 						<view class="content_city" v-if="tab==1">
 							<scroll-view scroll-y="true" class="city_province">
-								<view class="province_item" v-for="(item1,index1) in region" :key='index1.id' @click="chooceProvince(item1)" :style="{'color':provinceId==item1.id?color1:'#999999','background':provinceId==item1.id?'#FFFFFF':'transparent'}">
-									{{item1.name}}
+								<view class="province_item" v-for="(item1,index1) in region" :key='index1' @click="chooceProvince(item1)" :style="{'color':city==item1?color1:'#999999','background':city==item1?'#FFFFFF':'transparent'}">
+									{{item1}}
 								</view>
 							</scroll-view>
 							
-							<scroll-view scroll-y="true" class="city_town">
-								<view class="city_item" v-for="(item2,index2) in cities" :key='item2.id' @click="chooseCity(item2)" :style="{'color':cityId==item2.id?color1:'#999999'}">
-									{{item2.name}}
-								</view>
-							</scroll-view>
 						</view>
 						<view class="content_type" v-if="tab==2">
 							<view class="content_type_item" v-for="(item,index) in  types" :key='item.id' @click="typeChooce(item)" :style='{color:currentType==item.id?color1:"#999999"}'>
@@ -55,7 +50,6 @@
 	</view>
 </template>
 <script>
-	let region = require('@/static/region.json');
 	export default {
 		props: {
 			title: String,
@@ -107,10 +101,7 @@
 				currentType:"",
 				region:[],
 				cities:[],
-				province:"",
-				provinceId:"",
 				city:"",
-				cityId:"",
 				typeName:"",
 			}
 		},
@@ -119,8 +110,7 @@
 			this.globalData = app.globalData;
 			this.color2 = this.globalData.color2;
 			this.color1 = this.globalData.color1;
-			this.region = region;
-			this.cities = region[0].children;
+			this.queryCities();
 		},
 		methods: {
 			async queryCategoryBox(){
@@ -135,6 +125,18 @@
 					this.types = this.types.filter(item=>item.name.indexOf('注册')==-1)
 				}
 			},
+			async queryCities(){
+				let res = await this.$myRequest({
+					url: "/project/cities",
+					data: {
+						
+					},
+					method:"GET"
+				})
+				if(res.data.success){
+					this.region = res.data.list||[]
+				}
+			},
 			setOptionType(option){
 				this.tab = option;
 			},
@@ -144,7 +146,6 @@
 					this.maskBgColor = this.maskColor
 					this.containerVisible = true
 				}, 20)
-				console.log("regin",region)
 				this.queryCategoryBox();
 			},
 			hide() {
@@ -174,19 +175,10 @@
 				this.typeName = item.name;
 			},
 			chooceProvince(item){
-				this.cities = item.children;
-				this.province = item.name;
-				this.provinceId = item.id;
-			},
-			chooseCity(item){
-				this.city = item.name;
-				this.cityId = item.id;
+				this.city = item;
 			},
 			reset(){
 				this.city = "";
-				this.cityId = "";
-				this.province = "";
-				this.provinceId = "";
 				this.currentType = "";
 				this.typeName = "";
 			},
@@ -303,13 +295,11 @@
 							height: 100%;
 							box-sizing: border-box;
 							padding-top: 50rpx;
-							background: #f8f8f8;
 							overflow: hidden;
 							overflow-y: scroll;
 							.province_item{
-								width: 280rpx;
 								line-height: 60rpx;
-								text-align: center;
+								padding-left: 60rpx;
 								font-size: 28rpx;
 								font-family: Verdana, Verdana-Regular;
 								font-weight: 400;

+ 3 - 3
pages/homePage/homePage.vue

@@ -323,9 +323,9 @@
 				this.getSingle();
 			},
 			chooiceType(e){
-				this.city = e.city==''?"城市":(e.city).split('市')[0];
+				this.city = e.city==''?"筛选城市":(e.city).split('市')[0];
 				this.type = e.type;
-				this.typeName = e.typeName==''?'类型':e.typeName;
+				this.typeName = e.typeName==''?'任务类型':e.typeName;
 				this.pageNo = 1;
 				this.getHomePage();
 			},
@@ -349,7 +349,7 @@
 				let ret = await this.$myRequest({
 					url: "/project/homePage",
 					data: {
-						"city": this.city=='城市'?'':this.city,
+						"city": this.city=='筛选城市'?'':this.city,
 						"pageNo": this.pageNo,
 						"pageSize": this.pageSize,
 						"taskCategoryId": this.type,