admin
2020-12-22 28a4cfadc0a78d1bfec093e0694f420aaf3a725c
pages/advice/advice.js
@@ -1,12 +1,54 @@
var help = require("../../util/help.js");
var help = require('/util/help.js');
const api = require("/util/api.js");
Page({
  data: {},
  onLoad() {
    help.setPageNavBar("意见反馈");
  },
  onClick(){
  bindFormSubmit(e) {
    const content = e.detail.value.content;
    if (help.isNullOrEmpty(content)) {
      my.showToast({
        content: '请填写意见'
      });
      return;
    }
    my.getStorage({
      key: 'advice_time',
      success: (result) => {
        if (result.data == null || result.data < new Date().getTime()) {
          api.advice({
            showErrorToast: true,
            showLoading: true,
            content: content,
            success: function (res) {
              if (res.code == 0) {
                my.showToast({
                  content: '提交成功'
                });
                my.setStorage({
                  key: 'advice_time',
                  data: new Date().getTime()+1000*60*5
                });
              }
            }
          });
        } else {
          my.showToast({
            content: '请稍后再试'
          });
        }
      },
      fail: () => {
      },
      complete: () => {
      }
    });
  }
});