liyongli 1 жил өмнө
parent
commit
f9ad897107

+ 2 - 1
app.json

@@ -9,7 +9,8 @@
     "pages/downZS/index",
     "pages/downZS/index",
     "pages/userData/index",
     "pages/userData/index",
     "pages/webview/index",
     "pages/webview/index",
-    "pages/sph/index"
+    "pages/sph/index",
+    "pages/modify/index"
   ],
   ],
   "window": {
   "window": {
     "navigationBarTextStyle": "white",
     "navigationBarTextStyle": "white",

+ 2 - 2
pages/application/index.js

@@ -180,9 +180,9 @@ Page({
           icon: "none"
           icon: "none"
         });
         });
       },
       },
-      fail() {
+      fail(err) {
         wx.showToast({
         wx.showToast({
-          title: res.message || "上传失败",
+          title: err.message || "上传失败",
           icon: "error"
           icon: "error"
         });
         });
       }
       }

+ 281 - 0
pages/modify/index.js

@@ -0,0 +1,281 @@
+// pages/application/index.js
+import {
+  ajax,
+  ele_height
+} from "../../utils/util";
+import {
+  base
+} from "../../config/index"
+const {
+  globalData: {
+    systemInfo
+  }
+} = getApp();
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    multiIndex: [0, 0, 0],
+    multiArray: [],
+    uploadheight: 0,
+    local_image_url: '',
+    group_class: '幼儿组',
+    works_class: '中国画',
+    author: "",
+    phone: "",
+    schoolClass: "",
+    teacher: "",
+    teacherPhone: "",
+    area: "",
+    article: "",
+    brief: ""
+  },
+  id: undefined,
+  area: [],
+  changeSelectArea: [0, 0, 0],
+  change(e) {
+    const key = e.target.dataset.key || '';
+    const value = e.detail.value;
+    const p = {};
+    p[key] = value;
+    this.setData(p);
+  },
+  bindMultiPickerChange: function (e) {
+    this.setData({
+      multiIndex: e.detail.value
+    })
+  },
+  uploadimg(e) {
+    this.setData({
+      uploadheight: ele_height(e, systemInfo.screenWidth * 0.8)
+    })
+  },
+  upload() {
+    wx.chooseMedia({
+      count: 1,
+      mediaType: ['image'],
+      success: e => {
+        this.setData({
+          local_image_url: e.tempFiles[0].tempFilePath
+        })
+      },
+    })
+  },
+  delimg() {
+    wx.showModal({
+      title: "确定删除该图片?",
+      content: "删除后需重新选择图片",
+      success: (res) => {
+        if (res.confirm) {
+          this.setData({
+            local_image_url: ''
+          })
+        }
+      }
+    })
+  },
+  bindMultiPickerColumnChange(e) {
+    const {
+      detail: {
+        column,
+        value
+      }
+    } = e;
+    this.changeSelectArea[column] = value;
+    const a0 = this.area[this.changeSelectArea[0]] || {
+      child: []
+    }
+    const multiArray1 = a0.child.map(v => v.name);
+    let multiArray2 = ((a0.child[this.changeSelectArea[1]] || {
+      child: []
+    }).child || []).map(v => v.name);
+    this.setData({
+      multiArray: [this.data.multiArray[0], multiArray1, multiArray2]
+    })
+  },
+  getArea(call) {
+    ajax({
+      urlType: "fileurl",
+      api: "/topic/tool/img/%E5%B0%91%E5%84%BF%E4%B9%A6%E7%94%BB%E5%A4%A7%E8%B5%9B/narea.json?data=" +
+        Date.now()
+    }).then(res => {
+      this.area = res || [];
+      call && call();
+    }).catch(() => {
+      call && call();
+    })
+  },
+  updata() {
+    const {
+      group_class,
+      works_class,
+      author,
+      phone,
+      schoolClass,
+      teacher,
+      teacherPhone,
+      area,
+      local_image_url,
+      article,
+      brief
+    } = 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(phone)) return wx.showToast({
+      title: '手机号需填入数字',
+      icon: "none"
+    })
+    if (!group_class || !works_class || !author || !schoolClass || !area || !local_image_url || !article || !brief) return wx.showToast({
+      title: '请输入完整信息',
+      icon: "none"
+    })
+    wx.showLoading({
+      title: '加载中',
+    })
+    wx.getImageInfo({
+      src: local_image_url
+    }).then((res) => {
+      wx.uploadFile({
+        filePath: res.path,
+        name: 'file',
+        header: {
+          Authorization: wx.getStorageSync('token') || undefined,
+        },
+        formData: {
+          name: author,
+          teacherPhone,
+          school: schoolClass,
+          teacher,
+          area: baseArea + area,
+          articleGroup: works_class,
+          birthday: group_class,
+          articleName: article,
+          articleDescribe: brief,
+          phone,
+          id: this.id
+        },
+        url: base.apiurl + '/article/save',
+        complete: () => {
+          wx.hideLoading()
+        },
+        success: res => {
+          if (res.statusCode !== 200) {
+            const data = JSON.parse(res.data || "{}")
+            wx.showToast({
+              title: data.message || "保存失败",
+              icon: "error"
+            })
+            return
+          }
+          wx.navigateBack()
+        },
+        fail(err) {
+          wx.showToast({
+            title: err.message || "上传失败",
+            icon: "error"
+          });
+        }
+      })
+    });
+  },
+
+  getIndex(text, indexs, arr) {
+    let add = "";
+    for (let i = 0; i < arr.length; i++) {
+      const rex = new RegExp(arr[i].name);
+      if (rex.test(text)) {
+        indexs.push({
+          index: i,
+          name: arr[i].name,
+          areaList: arr.map(item => item.name)
+        });
+        add = text.replace(arr[i].name, "")
+        if (arr[i].child) return this.getIndex(add, indexs, arr[i].child);
+      }
+    }
+    return {
+      indexs,
+      add
+    }
+  },
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad(options) {
+    this.getArea(() => {
+      const obj = JSON.parse(decodeURIComponent(options.data));
+      this.id = obj.id;
+      const index = this.getIndex(obj.area, [], this.area);
+      const multiIndex = index.indexs.map(v => v.index);
+      this.setData({
+        local_image_url: obj.articleUrl || '',
+        group_class: obj.birthday || '',
+        works_class: obj.articleGroup || '',
+        author: obj.name || "",
+        phone: obj.phone || "",
+        schoolClass: obj.school || "",
+        teacher: obj.teacher || "",
+        teacherPhone: obj.teacherPhone || "",
+        article: obj.articleName || "",
+        brief: obj.articleDescribe || "",
+        multiIndex,
+        area: index.add || "",
+        multiArray: index.indexs.map(v => v.areaList)
+      })
+    });
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload() {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh() {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom() {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage() {
+    return {
+      title: __wxConfig.accountInfo.nickname,
+      path: "/pages/index/index"
+    }
+  }
+})

+ 9 - 0
pages/modify/index.json

@@ -0,0 +1,9 @@
+{
+  "navigationBarTitleText": "报名信息",
+  "usingComponents": {
+    "Container": "../../component/container/index",
+    "van-radio": "@vant/weapp/radio/index",
+    "van-radio-group": "@vant/weapp/radio-group/index",
+    "van-button": "@vant/weapp/button/index"
+  }
+}

+ 61 - 0
pages/modify/index.wxml

@@ -0,0 +1,61 @@
+<!--pages/application/index.wxml-->
+<scroll-view class="scrollarea" scroll-y type="list">
+  <view class="index_main">
+    <Container style="margin-top: -100rpx;">
+      <view style="margin: 0 44rpx;font-size: 28rpx;">
+        <view class="top_label">作者姓名*</view>
+        <input class="top_input" value="{{author}}" bindinput="change" data-key="author" type="text" placeholder="请输入姓名" />
+        <view class="top_label">联系电话*</view>
+        <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>
+        <input class="top_input" value="{{teacher}}" bindinput="change" data-key="teacher" type="text" placeholder="请输入指导老师" />
+        <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="请输入作品名称" />
+        <view class="top_label">作品简介*</view>
+        <textarea class="top_input" style="height: 5em;" value="{{brief}}" bindinput="change" data-key="brief" placeholder="请输入作品简介" />
+        <view class="top_label" style="margin-bottom: 17rpx;">联系地址*</view>
+        <picker mode="multiSelector" bindchange="bindMultiPickerChange" bindcolumnchange="bindMultiPickerColumnChange" value="{{multiIndex}}" range="{{multiArray}}">
+          <view class="picker">
+            <view class="picker_item">{{multiArray[0][multiIndex[0]]}}</view>
+            <view class="picker_item">{{multiArray[1][multiIndex[1]]}}</view>
+            <view wx:if="{{multiArray[2][multiIndex[2]]}}" class="picker_item">{{multiArray[2][multiIndex[2]]}}</view>
+          </view>
+        </picker>
+        <textarea class="top_input" style="height: 5em;" value="{{area}}" bindinput="change" data-key="area" placeholder="请输入地址" />
+        <view class="top_label">组别*</view>
+        <view class="top_input" style="background-color: #ffffff00;height: auto;">
+          <van-radio-group value="{{ group_class }}">
+            <van-radio name="幼儿组" checked-color="#91725D">幼儿组(6岁以下)</van-radio>
+            <van-radio name="儿童组" checked-color="#91725D">儿童组(7-10岁)</van-radio>
+            <van-radio name="少儿组" checked-color="#91725D">少儿组(11-14岁)</van-radio>
+            <van-radio name="少年组" checked-color="#91725D">少年组(15-18岁)</van-radio>
+            <van-radio name="青年组" checked-color="#91725D">青年组(18岁以上)</van-radio>
+          </van-radio-group>
+        </view>
+        <view class="top_label">作品类别*</view>
+        <view class="top_input" style="background-color: #ffffff00;height: auto;">
+          <van-radio-group value="{{ works_class }}">
+            <van-radio name="中国画" checked-color="#91725D">中国画</van-radio>
+            <van-radio name="西洋画" checked-color="#91725D">西洋画</van-radio>
+            <van-radio name="书法" checked-color="#91725D">书法</van-radio>
+            <van-radio name="其他" checked-color="#91725D">其他</van-radio>
+          </van-radio-group>
+        </view>
+
+        <image wx:if="{{!local_image_url}}" bind:tap="upload" src="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/upload.png" style="{{'height:' + uploadheight + 'px;width:600rpx;margin-top: 66rpx'}}" bindload="uploadimg" />
+        <view wx:if="{{local_image_url}}" class="imgP" bind:tap="delimg">
+          <image src="{{local_image_url}}" style="width: 100px; height: 100px;" />
+          <image class="del" src="../../images/del.png" style="width: 30px;height: 30px" />
+        </view>
+
+        <view style="padding-top: 15rpx;text-align: center;">
+          <van-button round type="info" bind:tap="updata" size="large" color="#91725D">提交</van-button>
+        </view>
+      </view>
+    </Container>
+  </view>
+</scroll-view>

+ 65 - 0
pages/modify/index.wxss

@@ -0,0 +1,65 @@
+/* pages/application/index.wxss */
+.index_main {
+  background-image: url("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/banner-2.png");
+  background-repeat: no-repeat;
+  background-size: 100%;
+  padding-top: 530rpx;
+  padding-bottom: 45rpx;
+  box-sizing: border-box;
+  color: #A57044;
+}
+
+.top_input {
+  background-color: #ffffff;
+  height: 1.5em;
+  line-height: 1.5em;
+  padding: 5rpx 10rpx;
+  border-radius: 10rpx;
+  font-size: 28rpx;
+  margin-top: 16rpx;
+}
+
+.top_label{
+  margin-top: 39rpx;
+}
+.top_label:first-child{
+  margin-top: 0;
+}
+
+.picker{ 
+  display: flex;
+  justify-content: space-between;
+}
+
+.picker_item {
+  flex: 1;
+  margin-right: 10px;
+  border: 1rpx solid #a3a3a3;
+  border-radius: 12px;
+  text-align: center;
+  background-color: #fff;
+  height: 2em;
+  line-height: 2em;
+  white-space: nowrap;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  padding: 0 5rpx;
+}
+
+.imgP {
+  position: relative;
+  display: inline-block;
+  margin-top: 66rpx;
+}
+
+.imgP .del {
+  position: absolute;
+  top: 50%;
+  left: 50%;
+  transform: translate(-50%, -50%);
+  z-index: 10;
+}
+
+.van-radio {
+  margin: 15rpx 0;
+}

+ 0 - 3
pages/sph/index.js

@@ -8,9 +8,6 @@ Page({
     sph_id: "",
     sph_id: "",
     sp_id: ""
     sp_id: ""
   },
   },
-  error(e){
-    console.log(e)
-  },
   /**
   /**
    * 生命周期函数--监听页面加载
    * 生命周期函数--监听页面加载
    */
    */

+ 1 - 1
pages/sph/index.wxml

@@ -1,2 +1,2 @@
 <!--pages/sph/index.wxml-->
 <!--pages/sph/index.wxml-->
-<channel-video binderror="error" class="cvideo" autoplay="{{true}}" feed-id="{{sp_id}}" finder-user-name="{{sph_id}}"></channel-video>
+<channel-video class="cvideo" autoplay="{{true}}" feed-id="{{sp_id}}" finder-user-name="{{sph_id}}"></channel-video>

+ 52 - 10
pages/userData/index.js

@@ -14,12 +14,9 @@ Page({
   phone: wx.getStorageSync('phone') || '',
   phone: wx.getStorageSync('phone') || '',
   change(e) {
   change(e) {
     const rex = new RegExp(e.detail);
     const rex = new RegExp(e.detail);
-    const {
-      list
-    } = this.data;
     const li = [];
     const li = [];
-    for (let i = 0; i < list.length; i++) {
-      const v = list[i];
+    for (let i = 0; i < this.list.length; i++) {
+      const v = this.list[i];
       let isShow = false;
       let isShow = false;
       const keys = ["area", "articleDescribe", "articleGroup", "articleName", "birthday", "name", "phone", "school", "teacher", "teacherPhone"];
       const keys = ["area", "articleDescribe", "articleGroup", "articleName", "birthday", "name", "phone", "school", "teacher", "teacherPhone"];
       for (let o = 0; o < keys.length; o++) {
       for (let o = 0; o < keys.length; o++) {
@@ -32,10 +29,49 @@ Page({
       list: li
       list: li
     })
     })
   },
   },
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad(options) {
+
+  modify(e) {
+    const {
+      list
+    } = this.data;
+    const item = list[e.currentTarget.dataset.index];
+    wx.navigateTo({
+      url: '/pages/modify/index?data=' + JSON.stringify(item)
+    })
+  },
+
+  delet(e) {
+    const {
+      list
+    } = this.data;
+    const item = list[e.currentTarget.dataset.index];
+    wx.showModal({
+      title: '删除',
+      content: '确定删除' + item.articleName + '?',
+      complete: (res) => {
+        if (res.confirm) {
+          ajax({
+            urlType: "apiurl",
+            api: "/article/delete?articleId=" + item.id,
+          }).then(res => {
+            if (res.code !== 0) {
+              wx.showToast({
+                title: res.message || '网络波动',
+                icon: "none"
+              })
+              return
+            }
+            list.splice(e.currentTarget.dataset.index, 1)
+            this.setData({
+              list
+            })
+          })
+        }
+      }
+    })
+  },
+
+  init() {
     ajax({
     ajax({
       urlType: "apiurl",
       urlType: "apiurl",
       api: "/article/list",
       api: "/article/list",
@@ -51,6 +87,12 @@ Page({
       })
       })
     })
     })
   },
   },
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad(options) {
+    this.init();
+  },
 
 
   /**
   /**
    * 生命周期函数--监听页面初次渲染完成
    * 生命周期函数--监听页面初次渲染完成
@@ -63,7 +105,7 @@ Page({
    * 生命周期函数--监听页面显示
    * 生命周期函数--监听页面显示
    */
    */
   onShow() {
   onShow() {
-
+    this.init();
   },
   },
 
 
   /**
   /**

+ 4 - 4
pages/userData/index.wxml

@@ -9,18 +9,18 @@
           </view>
           </view>
         </view>
         </view>
         <view class="list_bot" wx:for="{{list}}" wx:key="index">
         <view class="list_bot" wx:for="{{list}}" wx:key="index">
-          <image class="list_left" src="../../images/edit.png" />
+          <image bind:tap="modify" data-index="{{index}}" class="list_left" src="../../images/edit.png" />
           <view class="list_center">
           <view class="list_center">
             <view>
             <view>
               {{item.name}}
               {{item.name}}
-              <image wx:if="{{item.lever > 0}}" class="tag" src="../../images/tg.png" />
-              <image wx:if="{{item.lever > 1}}" class="tag" style="width: 67rpx;" src="../../images/jj.png" />
+              <image wx:if="{{item.auditType == 'AdministratorReview' || item.auditType == 'ExpertReview' || item.auditType == 'ExpertReject' }}" class="tag" src="../../images/tg.png" />
+              <image wx:if="{{item.auditType == 'ExpertReview'}}" class="tag" style="width: 67rpx;" src="../../images/jj.png" />
             </view>
             </view>
             <view style="color: #555;">
             <view style="color: #555;">
               {{item.school + " " + item.articleGroup + " " + item.birthday}}
               {{item.school + " " + item.articleGroup + " " + item.birthday}}
             </view>
             </view>
           </view>
           </view>
-          <image class="list_right" src="../../images/del.png" style="width: 29rpx;height: 29rpx;" />
+          <image bind:tap="delet" data-index="{{index}}" class="list_right" src="../../images/del.png" style="width: 29rpx;height: 29rpx;" />
         </view>
         </view>
         <van-empty wx:if="{{!list.length}}" description="暂无数据" />
         <van-empty wx:if="{{!list.length}}" description="暂无数据" />
       </view>
       </view>

+ 1 - 13
project.private.config.json

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