chengjunhui 2 mesi fa
parent
commit
194cf7692e

+ 29 - 23
renren-admin/src/main/resources/statics/js/modules/qmgj/activity.js

@@ -316,12 +316,14 @@ var vm = new Vue({
 				}
 			});
 		},
-		city: function (event) {
-			var d = event.target.value;
-			console.log(d)
+		city: function (show) {
+			var d = vm.activity.city;
+			// console.log(vm.location.city)
+			if (!show) {
+				vm.activity.area = '';
+			}
 			vm.location.area = [];
-			vm.activity.area = '';
-			console.log(vm.location.city)
+			console.log(d)
 			// vm.location.city
 			// for (let i=0; i<=vm.location.city.length; i++) {
 			// 	if(d == vm.location.city[i].id) {
@@ -444,6 +446,9 @@ var vm = new Vue({
 				if (vm.activity.province) {
 					vm.province(2, true)
 				}
+				if (vm.activity.city) {
+					vm.city(true)
+				}
 				console.log(vm.activity.city)
 				if(r.activity.isPublish == 1) {
 					vm.isDisabled = true
@@ -479,25 +484,26 @@ var vm = new Vue({
 					$('#demo3').show();
 					$('#demo3').attr('src',vm.activity.qrCodePicture);
 				}
+				/*区域选择*/
 
-				$.ajax({
-					type: "POST",
-					url: baseURL + "/api/region/list",
-					contentType: "application/json",
-					success: function(r1){
-						if(r.code == 0){
-							vm.location.city = r1.data;
-							for (const elem of r1.data) {
-								if(vm.activity.city == elem.id) {
-									vm.location.area = elem.childRegionList
-								}
-							}
-							console.log(vm.location.area)
-						}else{
-							layer.alert("读取省失败");
-						}
-					}
-				});
+				// $.ajax({
+				// 	type: "POST",
+				// 	url: baseURL + "/api/region/list",
+				// 	contentType: "application/json",
+				// 	success: function(r1){
+				// 		if(r.code == 0){
+				// 			vm.location.city = r1.data;
+				// 			for (const elem of r1.data) {
+				// 				if(vm.activity.city == elem.id) {
+				// 					vm.location.area = elem.childRegionList
+				// 				}
+				// 			}
+				// 			console.log(vm.location.area)
+				// 		}else{
+				// 			layer.alert("读取省失败");
+				// 		}
+				// 	}
+				// });
 				/*区域选择*/
 				// $.ajax({
 				// 	type: "POST",

+ 1 - 1
renren-admin/src/main/resources/templates/modules/qmgj/activity.html

@@ -112,7 +112,7 @@
                     </select>
                 </div>
                 <div class="col-sm-3" style="width: 16.65%;">
-                    <select class="form-control" v-model="activity.city" @change="city">
+                    <select class="form-control" v-model="activity.city" @change="city()">
                         <option value="" disabled hidden>--市--</option>
                         <option v-for="item in location.city" :value="item.id">{{item.name}}</option>
                     </select>