李天标 преди 6 години
родител
ревизия
be5bbcb853
променени са 2 файла, в които са добавени 45 реда и са изтрити 24 реда
  1. 38 24
      pages/User/user.vue
  2. 7 0
      store/modules/chart.js

+ 38 - 24
pages/User/user.vue

@@ -49,6 +49,10 @@
 				listName: [],
 				value: null,
 				id: null,
+				parm:{
+					name:null,
+					id:null
+				},
 				showOrNo: null
 			};
 		},
@@ -72,8 +76,6 @@
 		onLoad() {
 
 		},
-
-		computed: {},
 		methods: {
 			bindLogout() {
 				uni.reLaunch({
@@ -86,34 +88,46 @@
 			setStyle2() {
 				this.showOrNo = "none";
 			},
-			updata() {
-				var serverurl = this.serverurl;
-				var id = this.id;
-				var value = this.value;
-				if (value != null && value != '') {
-					uni.request({
-						url: serverurl+'/TEquipment/updateName',
-						data: {
-							id: id,
-							name: value
-						},
-						dataType: 'json',
-						method: "POST",
-						success: (res) => {
-							uni.showModal({
-								title: '提示',
-								content: '名称:' + value + res.data.message,
-							});
-						}
-					});
-				}
-			},
+			// updata() {
+			// 	//挂载方式
+			// 	var serverurl = this.serverurl;
+			// 	var id = this.id;
+			// 	var value = this.value;
+			// 	if (value != null && value != '') {
+			// 		uni.request({
+			// 			url: serverurl+'/TEquipment/updateName',
+			// 			data: {
+			// 				id: id,
+			// 				name: value
+			// 			},
+			// 			dataType: 'json',
+			// 			method: "POST",
+			// 			success: (res) => {
+			// 				uni.showModal({
+			// 					title: '提示',
+			// 					content: '名称:' + value + res.data.message,
+			// 				});
+			// 			}
+			// 		});
+			// 	}
+			// },
 			getValue: function(event) {
 				// 绕过v-model 获取input输入框的值  
 				var value = event.target.value;
 				var id = event.target.id;
 				this.value = value;
 				this.id = id;
+				this.parm.name = value;
+				this.parm.id = id;
+			},
+			...mapActions('chart', ['updata']),
+			updata(){
+				debugger;
+				this.updata(this.parm)
+				.then(data => {
+					var merchantList = data;
+				}
+				, _ => void uni.stopPullDownRefresh());
 			}
 		}
 	}

+ 7 - 0
store/modules/chart.js

@@ -26,6 +26,13 @@ export default {
 					return data;
 				});
 		},
+		updata({ commit },param) {
+			return apis.sz.post('/TEquipment/updateName',param)
+				.then(res => {
+					const { data } = res;
+					return data;
+				});
+		},
 	}
 }