1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- // pages/comment/comment.ts
- import { httpUtil } from "../../utils/restful"
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- veryGoodStatus: true,
- veryGoodUrls: '../../image/comment/comment_verygood_true.png',
- goodStatus: false,
- goodUrls: "../../image/comment/comment_good_false.png",
- notGoodStatus: false,
- notGoodUrl: "../../image/comment/comment_notgood_false.png",
- postFaultId: '',
- describe: ''
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- this.setData({
- postFaultId: options.faultId
- })
- },
- commitComment: function (e: any) {
- let content = e.detail.value['send - input'] ? e.detail.value['send - input'] : e.detail.value
- console.log("1====", content)
- this.setData({
- describe: content
- })
- this.postComment()
- },
- clickVeryGood() {
- this.setData({
- veryGoodStatus: true,
- veryGoodUrls: '../../image/comment/comment_verygood_true.png',
- goodStatus: false,
- goodUrls: "../../image/comment/comment_good_false.png",
- notGoodStatus: false,
- notGoodUrl: "../../image/comment/comment_notgood_false.png"
- })
- },
- clickGood() {
- this.setData({
- veryGoodStatus: false,
- veryGoodUrls: '../../image/comment/comment_verygood_false.png',
- goodStatus: true,
- goodUrls: "../../image/comment/comment_good_true.png",
- notGoodStatus: false,
- notGoodUrl: "../../image/comment/comment_notgood_false.png"
- })
- },
- clickNotGood() {
- this.setData({
- veryGoodStatus: false,
- veryGoodUrls: '../../image/comment/comment_verygood_false.png',
- goodStatus: false,
- goodUrls: "../../image/comment/comment_good_false.png",
- notGoodStatus: true,
- notGoodUrl: "../../image/comment/comment_notgood_true.png"
- })
- },
- postComment: function () {
- let params = {
- faultId: this.data.postFaultId,
- describe: this.data.describe
- }
- httpUtil.wxPost(httpUtil.interfaces.postComment, params).then((res => {
- console.log("提交评论成功:", res)
- wx.showToast({
- title: '提交成功',
- duration: 1000
- })
- setTimeout(function () {
- wx.navigateBack()
- }, 1000)
- })).catch((res) => {
- console.log("提交评论失败:", res)
- wx.showToast({
- title: '提交失败',
- duration: 1000
- })
- })
- }
- })
|