liyongli há 1 ano atrás
pai
commit
dc1f32af37

+ 89 - 22
pages/admin/index.js

@@ -1,39 +1,106 @@
 // pages/admin/index.js
+import {
+  ajax
+} from "../../utils/util";
 Page({
 
   /**
    * 页面的初始数据
    */
   data: {
-    list: [
-      {
-        works: "https://cxzx.smcic.net/topic/tool/img/%E5%B0%91%E5%84%BF%E4%B9%A6%E7%94%BB%E5%A4%A7%E8%B5%9B/R-C.jfif",
-        name: "张云翔",
-        birthday: "2015-03-03",
-        teacher: "李勇利",
-        school: "清华",
-        articleGroup: "书法",
-        articleName: "兰亭序",
-        articleDescribe: "展现了中国传统艺术的魅力。墨色浓淡相间,笔触流畅而有力,每一字之间形成和谐的整体。作品中融入了经典诗句,传递出深邃的哲理和人生感悟。每一个字都经过精心构思和书写,字体大小和间距恰到好处,整个作品看起来平衡而舒适。",
-      },
-      {
-        works: "https://cxzx.smcic.net/topic/tool/img/%E5%B0%91%E5%84%BF%E4%B9%A6%E7%94%BB%E5%A4%A7%E8%B5%9B/R-C.jfif",
-        name: "张云翔",
-        birthday: "2015-03-03",
-        teacher: "李勇利",
-        school: "清华",
-        articleGroup: "书法",
-        articleName: "兰亭序",
-        articleDescribe: "展现了中国传统艺术的魅力。墨色浓淡相间,笔触流畅而有力,每一字之间形成和谐的整体。作品中融入了经典诗句,传递出深邃的哲理和人生感悟。每一个字都经过精心构思和书写,字体大小和间距恰到好处,整个作品看起来平衡而舒适。",
+    list: []
+  },
+  page: 1,
+  size: 2,
+  total: 0,
+  T: undefined,
+  conclusion(e) {
+    if (this.T) clearTimeout(this.T);
+    setTimeout(() => {
+      if (this.T) clearTimeout(this.T);
+      if (!e.currentTarget.dataset.conclusion) {
+        wx.showModal({
+          title: '请输入评语',
+          editable: true,
+          complete: (res) => {
+            if (res.confirm) {
+              this.uploadConclusion(e.currentTarget.dataset.id, e.currentTarget.dataset.conclusion, res.content, e.currentTarget.dataset.index)
+            }
+          }
+        })
+      } else {
+        this.uploadConclusion(e.currentTarget.dataset.id, e.currentTarget.dataset.conclusion, "", e.currentTarget.dataset.index);
+      }
+    }, 200);
+
+  },
+  uploadConclusion(articleId, ok, message, index) {
+    ajax({
+      urlType: "apiurl",
+      api: "/article/audit",
+      method: "post",
+      data: {
+        articleId,
+        ok,
+        message
+      }
+    }).then(res => {
+      if (res.code !== 0) return wx.showToast({
+        title: res.message || '审核失败',
+        icon: "none"
+      })
+      const {
+        list
+      } = this.data;
+      if (ok) {
+        list.splice(index, 1);
+        this.setData({
+          list
+        })
+      } else {
+        list[index].message = message;
       }
-    ]
+      if (index >= list.length - 2) this.getData();
+      wx.showToast({
+        title: '审核成功',
+        icon: "success"
+      })
+    })
+  },
+  getData() {
+    ajax({
+      urlType: "apiurl",
+      api: "/article/list-audit",
+      method: "post",
+      data: {
+        page: this.page,
+        size: this.size
+      }
+    }).then(res => {
+      if (res.code !== 0) return wx.showToast({
+        title: '请求失败',
+        icon: "none"
+      })
+      const data = res.data || {};
+      data.data.length && (this.page += 1);
+      this.total = data.total;
+      this.setData({
+        list: [...this.data.list, ...data.data]
+      })
+    })
+  },
+  change(e) {
+    const T = setTimeout(() => {
+      clearTimeout(T);
+      if (e.detail.current >= this.data.list.length - 1) this.getData();
+    }, 500);
   },
 
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad(options) {
-
+    this.getData()
   },
 
   /**

+ 1 - 0
pages/admin/index.json

@@ -1,5 +1,6 @@
 {
   "navigationBarTitleText": "管理员审核",
   "usingComponents": {
+    "van-empty": "@vant/weapp/empty/index"
   }
 }

+ 10 - 6
pages/admin/index.wxml

@@ -1,21 +1,25 @@
 <!--pages/admin/index.wxml-->
-<swiper class="swiper" vertical cache-extent="{{1}}">
+<swiper bindchange="change" class="swiper" wx:if="{{list.length}}" vertical cache-extent="{{1}}">
   <swiper-item class="swiper-item" wx:for="{{list}}" wx:key="index">
-    <image src="{{item.works}}" class="zp" mode="aspectFit" />
+    <image src="{{item.articleUrl}}" class="zp" mode="aspectFit" />
     <view class="jj">
-      <view>{{item.articleName + '(作者:' + item.name + ';生日:'+ item.birthday +')'}}</view>
+      <view>{{item.articleName + '(' + item.name + '-'+ item.birthday +')'}}</view>
+      <view>联系方式:{{item.phone}}</view>
       <view>学校:{{item.school}}</view>
       <view>指导老师:{{item.teacher}}</view>
+      <view>指导老师电话:{{item.teacherPhone}}</view>
+      <view wx:if="{{item.message}}" class="jj_content" style="-webkit-line-clamp: 5;">上次拒绝原因:{{item.teacherPhone}}</view>
       <view class="jj_content">{{item.articleDescribe}}</view>
       <view class="zuopin_gongju_tool">
         <view class="zuopin_gongju_item">
-          <view class="zuopin_gongju_btn zuopin_gongju_btn_err">通过</view>
+          <view class="zuopin_gongju_btn zuopin_gongju_btn_err" data-index="{{index}}" data-id="{{item.id}}" bind:tap="conclusion" data-conclusion="{{true}}">通过</view>
         </view>
         <view class="zuopin_gongju_item">
-          <view class="zuopin_gongju_btn">拒绝</view>
+          <view class="zuopin_gongju_btn" bind:tap="conclusion" data-index="{{index}}" data-id="{{item.id}}" data-conclusion="{{false}}">拒绝</view>
         </view>
       </view>
     </view>
 
   </swiper-item>
-</swiper>
+</swiper>
+<van-empty description="暂无数据" wx:if="{{!list.length}}" />

+ 14 - 17
pages/application/index.js

@@ -24,7 +24,7 @@ Page({
     group_class: '幼儿组',
     works_class: '中国画',
     author: "",
-    phone: "",
+    phone: wx.getStorageSync('phone') || "",
     schoolClass: "",
     teacher: "",
     teacherPhone: "",
@@ -133,18 +133,10 @@ Page({
     } = this.data;
     let baseArea = this.data.multiArray[0][this.data.multiIndex[0]] + this.data.multiArray[1][this.data.multiIndex[1]];
     if (this.data.multiArray[2] && this.data.multiArray[2][this.data.multiIndex[2]]) baseArea += this.data.multiArray[2][this.data.multiIndex[2]]
-    if (isNaN(teacherPhone) || isNaN(phone)) return wx.showToast({
+    if (isNaN(phone)) return wx.showToast({
       title: '手机号需填入数字',
       icon: "none"
     })
-    console.log("group_class:", !group_class);
-    console.log("works_class:", !works_class);
-    console.log("author:", !author);
-    console.log("schoolClass:", !schoolClass);
-    console.log("area:", !area);
-    console.log("local_image_url:", !local_image_url);
-    console.log("article:", !article);
-    console.log("brief:", !brief);
     if (!group_class || !works_class || !author || !schoolClass || !area || !local_image_url || !article || !brief) return wx.showToast({
       title: '请输入完整信息',
       icon: "none"
@@ -167,21 +159,26 @@ Page({
         articleGroup: works_class,
         birthday: group_class,
         articleName: article,
-        articleDescribe: brief
+        articleDescribe: brief,
+        phone
       },
       url: base.apiurl + '/article/save',
       complete: () => {
         wx.hideLoading()
       },
       success: res => {
-        if (res.code === 0) return wx.showToast({
-          title: '上传成功',
+        if(res.statusCode !== 200) {
+          const data = JSON.parse(res.data || "{}")
+          wx.showToast({
+            title: data.message || "保存失败",
+            icon: "error"
+          })
+          return
+        }
+        wx.showToast({
+          title: '报名成功',
           icon: "none"
         });
-        else return wx.showToast({
-          title: res.message || "上传失败",
-          icon: "error"
-        });
       },
       fail() {
         wx.showToast({

+ 2 - 2
pages/application/index.wxml

@@ -9,9 +9,9 @@
         <input class="top_input" value="{{phone}}" bindinput="change" data-key="phone" type="number" placeholder="请输入联系电话" />
         <view class="top_label">学校班级*</view>
         <input class="top_input" value="{{schoolClass}}" bindinput="change" data-key="schoolClass" type="text" placeholder="请输入学校班级" />
-        <view class="top_label">指导老师*</view>
+        <view class="top_label">指导老师</view>
         <input class="top_input" value="{{teacher}}" bindinput="change" data-key="teacher" type="text" placeholder="请输入指导老师" />
-        <view class="top_label">指导老师电话*</view>
+        <view class="top_label">指导老师电话</view>
         <input class="top_input" value="{{teacherPhone}}" bindinput="change" data-key="teacherPhone" type="number" placeholder="请输入指导老师电话" />
         <view class="top_label">作品名称*</view>
         <input class="top_input" value="{{article}}" bindinput="change" data-key="article" type="text" placeholder="请输入作品名称" />

+ 0 - 1
pages/us/index.js

@@ -20,7 +20,6 @@ Page({
         title: res.message || '请求失败',
         icon: 'none'
       })
-      console.log(res.data.token, res.data.phoneInfo.phoneNumber)
       wx.setStorageSync('token', res.data.token);
       wx.setStorageSync('phone', res.data.phoneInfo.phoneNumber);
       this.setData({

+ 25 - 17
pages/userData/index.js

@@ -8,24 +8,30 @@ Page({
    * 页面的初始数据
    */
   data: {
-    list: [{
-        works: "https://cxzx.smcic.net/topic/tool/img/%E5%B0%91%E5%84%BF%E4%B9%A6%E7%94%BB%E5%A4%A7%E8%B5%9B/R-C.jfif",
-        name: "张云翔",
-        birthday: "2015-03-03",
-        teacher: "李勇利",
-        school: "清华",
-        group: "少儿组",
-        lever: 1,
-        groupType: "国画组",
-        articleGroup: "书法",
-        articleName: "兰亭序",
-        articleDescribe: "展现了中国传统艺术的魅力。墨色浓淡相间,笔触流畅而有力,每一字之间形成和谐的整体。作品中融入了经典诗句,传递出深邃的哲理和人生感悟。每一个字都经过精心构思和书写,字体大小和间距恰到好处,整个作品看起来平衡而舒适。",
-      }
-    ]
+    list: []
   },
-
+  list: [],
   phone: wx.getStorageSync('phone') || '',
-
+  change(e) {
+    const rex = new RegExp(e.detail);
+    const {
+      list
+    } = this.data;
+    const li = [];
+    for (let i = 0; i < list.length; i++) {
+      const v = list[i];
+      let isShow = false;
+      const keys = ["area", "articleDescribe", "articleGroup", "articleName", "birthday", "name", "phone", "school", "teacher", "teacherPhone"];
+      for (let o = 0; o < keys.length; o++) {
+        if (rex.test(v[keys[o]])) isShow = true;
+      }
+      if (!e.detail) isShow = true
+      if (isShow) li.push(v);
+    }
+    this.setData({
+      list: li
+    })
+  },
   /**
    * 生命周期函数--监听页面加载
    */
@@ -38,8 +44,10 @@ Page({
         title: res.message || '请求失败',
         icon: 'none'
       })
+      const li = res.data || [];
+      this.list = li;
       this.setData({
-        list: res.data || []
+        list: li
       })
     })
   },

+ 1 - 1
pages/userData/index.wxml

@@ -5,7 +5,7 @@
       <view class="card">
         <view style="text-align: right;">
           <view style="width: 300rpx;display: inline-block;">
-            <van-search right-icon value="{{ value }}" shape="round" placeholder="" />
+            <van-search bind:change="change" right-icon value="{{ value }}" shape="round" placeholder="" />
           </view>
         </view>
         <view class="list_bot" wx:for="{{list}}" wx:key="index">

+ 1 - 13
project.private.config.json

@@ -5,17 +5,5 @@
     "compileHotReLoad": true,
     "urlCheck": true
   },
-  "condition": {
-    "miniprogram": {
-      "list": [
-        {
-          "name": "pages/userData/index",
-          "pathName": "pages/userData/index",
-          "query": "",
-          "launchMode": "default",
-          "scene": null
-        }
-      ]
-    }
-  }
+  "condition": {}
 }