|
|
@@ -6,45 +6,6 @@ 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) {
|
|
|
@@ -53,17 +14,18 @@ Page({
|
|
|
confirmColor: "#009195",
|
|
|
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)
|
|
|
- })
|
|
|
+
|
|
|
+ // 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)
|
|
|
})
|
|
|
@@ -93,33 +55,6 @@ Page({
|
|
|
questions: res.result.list
|
|
|
})
|
|
|
})
|
|
|
-
|
|
|
- // this.setData({
|
|
|
- // publisherId: options.id,
|
|
|
- // questions: [{
|
|
|
- // title: "我是标题",
|
|
|
- // question: "我是问题?",
|
|
|
- // answer: "我是回答"
|
|
|
- // }]
|
|
|
- // })
|
|
|
- // 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)
|
|
|
- // })
|
|
|
},
|
|
|
|
|
|
/**
|