Bläddra i källkod

添加公告提示

soobin 2 år sedan
förälder
incheckning
04e5d22c9f
1 ändrade filer med 29 tillägg och 20 borttagningar
  1. 29 20
      packageA/pages/user/editor/editor.vue

+ 29 - 20
packageA/pages/user/editor/editor.vue

@@ -113,26 +113,35 @@
 						var that = this;
 						// var id = uni.getStorageSync("globalUser").id;
 						var token = uni.getStorageSync("token");
-						uni.request({
-							url: this.serverurl + '/TNotice/addNotice',
-							data: {
-								"title": title,
-								"note":note
-							},
-							header: {
-								'token': token
-							},
-							method: "POST",
-							success: (res) => {
-								uni.showModal({
-									title: "提示",
-									content: res.data.message,
-									success: (res) => {
-								
-									}
-								})
-							},
-						});
+						if(note == "<p><br></p>") {
+							uni.showToast({
+							    title: '公告内容不为空',
+							    duration: 3000,
+								icon: 'error'
+							});
+							return;
+						} else {							
+							uni.request({
+								url: this.serverurl + '/TNotice/addNotice',
+								data: {
+									"title": title,
+									"note":note
+								},
+								header: {
+									'token': token
+								},
+								method: "POST",
+								success: (res) => {
+									uni.showModal({
+										title: "提示",
+										content: res.data.message,
+										success: (res) => {
+									
+										}
+									})
+								},
+							});
+						}
 					},
 					fail: function(error) {
 						console.log(error)