zs hace 2 años
padre
commit
bedfba3c42
Se han modificado 4 ficheros con 10 adiciones y 30 borrados
  1. 1 3
      pages/news/index.js
  2. 4 12
      pages/news/list.js
  3. 1 3
      pages/topic/index.js
  4. 4 12
      pages/topic/list.js

+ 1 - 3
pages/news/index.js

@@ -25,9 +25,7 @@ Page({
     //查询
     onSearch: function (e) {
         const that = this;
-        that.setData({ skip: 0 })
-        that.setData({ page: 0 })
-        that.setData({ list: [] })
+        that.setData({ skip: 0, page: 0, list: [] })
         that.setData({ 'searchInfo.title': e.detail.value });
         that.watchLogin()
     },

+ 4 - 12
pages/news/list.js

@@ -22,26 +22,20 @@ Page({
     //查询
     onSearch: function (e) {
         const that = this;
-        that.setData({ list: [] })
-        that.setData({ skip: 0 })
-        that.setData({ page: 0 })
+        that.setData({ skip: 0, page: 0, list: [] })
         that.setData({ 'searchInfo.title': e.detail.value });
         that.watchLogin()
     },
     // 添加
     toAdd() {
         const that = this;
-        that.setData({ skip: 0 })
-        that.setData({ page: 0 })
-        that.setData({ list: [] })
+        that.setData({ skip: 0, page: 0, list: [] })
         wx.navigateTo({ url: '/pages/news/add' })
     },
     // 修改
     toEdit: function (e) {
         const that = this;
-        that.setData({ list: [] })
-        that.setData({ skip: 0 })
-        that.setData({ page: 0 })
+        that.setData({ skip: 0, page: 0, list: [] })
         let { id } = e.currentTarget.dataset;
         wx.navigateTo({ url: `/pages/news/add?id=${id}` })
     },
@@ -57,9 +51,7 @@ Page({
                     const arr = await app.$delete(`/newCourt/api/news/${id}`);
                     if (arr.errcode == '0') {
                         wx.showToast({ title: `删除信息成功`, icon: 'success', duration: 2000 })
-                        that.setData({ list: [] })
-                        that.setData({ skip: 0 })
-                        that.setData({ page: 0 })
+                        that.setData({ skip: 0, page: 0, list: [] })
                         that.watchLogin()
                     } else {
                         wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })

+ 1 - 3
pages/topic/index.js

@@ -16,9 +16,7 @@ Page({
     //查询
     onSearch: function (e) {
         const that = this;
-        that.setData({ skip: 0 })
-        that.setData({ page: 0 })
-        that.setData({ list: [] })
+        that.setData({ skip: 0, page: 0, list: [] })
         that.setData({ 'searchInfo.title': e.detail.value });
         that.watchLogin()
     },

+ 4 - 12
pages/topic/list.js

@@ -20,26 +20,20 @@ Page({
     //查询
     onSearch: function (e) {
         const that = this;
-        that.setData({ list: [] })
-        that.setData({ skip: 0 })
-        that.setData({ page: 0 })
+        that.setData({ skip: 0, page: 0, list: [] })
         that.setData({ 'searchInfo.title': e.detail.value });
         that.watchLogin()
     },
     // 添加
     toAdd() {
         const that = this;
-        that.setData({ skip: 0 })
-        that.setData({ page: 0 })
-        that.setData({ list: [] })
+        that.setData({ skip: 0, page: 0, list: [] })
         wx.navigateTo({ url: '/pages/topic/add' })
     },
     // 修改
     toEdit: function (e) {
         const that = this;
-        that.setData({ list: [] })
-        that.setData({ skip: 0 })
-        that.setData({ page: 0 })
+        that.setData({ skip: 0, page: 0, list: [] })
         let { id } = e.currentTarget.dataset;
         wx.navigateTo({ url: `/pages/topic/add?id=${id}` })
     },
@@ -55,9 +49,7 @@ Page({
                     const arr = await app.$delete(`/newCourt/api/topic/${id}`);
                     if (arr.errcode == '0') {
                         wx.showToast({ title: `删除信息成功`, icon: 'success', duration: 2000 })
-                        that.setData({ list: [] })
-                        that.setData({ skip: 0 })
-                        that.setData({ page: 0 })
+                        that.setData({ skip: 0, page: 0, list: [] })
                         that.watchLogin()
                     } else {
                         wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })