mulioid 4 年 前
コミット
687fbfa324

+ 0 - 146
miniprogram/pages/receivedQuestion/receivedQuestion.js

@@ -1,146 +0,0 @@
-// miniprogram/pages/receivedQuestion/receivedQuestion.js
-Page({
-
-  /**
-   * 页面的初始数据
-   */
-  data: {
-    questions: [],
-    publisherId: "",
-    notAnswered: true,
-    answered: true
-  },
-
-  updateText: function (e) {
-    var arr = this.data.questions
-    arr[e.target.dataset.index].answer = e.detail.value
-    this.setData({
-      questions: arr
-    })
-  },
-
-  updateFilter: function (e) {
-    var check0 = false
-    var check1 = false
-    for (let i = 0; i < e.detail.value.length; i++) {
-      if (e.detail.value[i] == 0) check0 = true
-      if (e.detail.value[i] == 1) check1 = true
-    }
-    this.setData({
-      notAnswered: check0,
-      answered: check1
-    })
-  },
-
-  saveQuestion: function (e) {
-    const db = wx.cloud.database()
-    db.collection("qaData").doc(e.target.dataset.id).update({
-      data: {
-        answer: e.target.dataset.answer,
-        answerTime: new Date()
-      },
-      success: function () {
-        wx.showToast({
-          title: "保存成功",
-        })
-      }
-    })
-  },
-
-  removeQuestion: function (e) {
-    wx.showModal({
-      content: "确认删除?",
-      success: function (res) {
-        if (res.confirm) {
-          const db = wx.cloud.database()
-          db.collection("qaData").doc(e.target.dataset.id).remove({
-            success: function () {
-              this.onLoad({
-                id: this.data.publisherId
-              })
-              wx.showToast({
-                title: "删除成功",
-              })
-            }.bind(this)
-          })
-        }
-      }.bind(this)
-    })
-  },
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-    this.setData({
-      publisherId: options.id
-    })
-    const db = wx.cloud.database()
-    db.collection("qaData").where({
-      publisherId: this.data.publisherId,
-    }).orderBy("questionTime", "desc").get({
-      success: async function (res) {
-        let arr = []
-        for (let i = 0; i < res.data.length; i++) {
-          arr.push(db.collection("mainData").doc(res.data[i].activityId).get())
-        }
-        arr = await Promise.all(arr)
-        for (let i = 0; i < res.data.length; i++) {
-          res.data[i].title = arr[i].data.title
-        }
-        this.setData({
-          questions: res.data
-        })
-      }.bind(this)
-    })
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
-
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
-
-  }
-})

+ 0 - 15
miniprogram/pages/receivedQuestion/receivedQuestion.wxml

@@ -1,15 +0,0 @@
-<!--为发布者-我收到的问题页面-->
-<view wx:if="{{questions.length == 0}}" class="title primary-text-color" style="text-align: center;">这里空空如也</view>
-<checkbox-group wx:if="{{questions.length != 0}}" class="checkbox-group" bindchange="updateFilter">
-  <view><checkbox class="checkbox" value="0" checked color="#3F51B5">未回答</checkbox></view>
-  <view><checkbox class="checkbox" value="1" checked color="#3F51B5">已回答</checkbox></view>
-</checkbox-group>
-<view wx:for="{{questions}}" wx:for-item="item" wx:for-index="index" wx:key="_id">
-  <view wx:if="{{notAnswered && item.answer == '' || answered && item.answer != ''}}" class="card">
-    <view class="title dark-primary-color-font">{{item.title}}</view>
-    <view class="question primary-text-color">问:{{item.question}}</view>
-    <textarea class="answer block-background-color" value="{{item.answer}}" placeholder="填写回答" data-index="{{index}}" bindinput="updateText"></textarea>
-    <view class="save-btn default-primary-color white-text-color" data-id="{{item._id}}" data-answer="{{item.answer}}" bindtap="saveQuestion">保存</view>
-    <icon style="position: absolute; top: 0; right: 0;" type="cancel" size="20" data-id="{{item._id}}" catchtap="removeQuestion"></icon>
-  </view>
-</view>

+ 0 - 52
miniprogram/pages/receivedQuestion/receivedQuestion.wxss

@@ -1,52 +0,0 @@
-/* miniprogram/pages/receivedQuestion/receivedQuestion.wxss */
-.checkbox {
-  transform:scale(0.8);
-  margin-left:10rpx;
-}
-
-.checkbox-group {
-  width: 750rpx;
-  margin-top: 30rpx;
-  display: flex;
-  justify-content: center;
-}
-
-.card {
-  position: relative;
-  display: flex;
-  flex-direction: column;
-  margin: 20rpx;
-  border-bottom-style: solid;
-  border-bottom-width: 1rpx;
-  border-bottom-color: #C5CAE9;
-}
-
-.title {
-  margin: 20rpx;
-  font-size: 40rpx;
-  font-weight: 800;
-}
-
-.question {
-  margin: 20rpx;
-  font-size: 35rpx;
-  line-height: 50rpx;
-}
-
-.answer {
-  margin: 20rpx;
-  padding: 20rpx;
-  width: 600rpx;
-  border-radius: 10rpx;
-  font-size: 35rpx;
-  line-height: 50rpx;
-  align-self: center;
-}
-
-.save-btn {
-  margin: 20rpx;
-  padding: 10rpx 20rpx;
-  border-radius: 20rpx;
-  font-size: 35rpx;
-  align-self: center;
-}