闫增涛
2024-03-11 f4425543db1c8db8c47a34c53ef477e72cfe318e
pages/bookServices/detail/components/suggest/suggest.js
@@ -16,13 +16,14 @@
  },
  data: {
    inputStyle: 'border: 2rpx solid rgba(220,220,220,1);border-radius: 12rpx; padding:16rpx',
    placeholderstyle: 'font-size:28rpx',
    dialogKey: '',
    showWithInput: false,
    showTextAndTitleWithInput: false,
    inputvalue: '',
    textvalue: '',
    ratevalue: 0,
    phoneError: false,
    textError: false,
  },
  methods: {
@@ -52,12 +53,6 @@
      this.setData({
        inputvalue: e.detail.value
      })
      const isPhoneNumber = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(e.detail.value);
      if (this.data.phoneError === isPhoneNumber) {
        this.setData({
          phoneError: !isPhoneNumber,
        });
      }
    },
    // 文本框改变
    textareaChange(e) {
@@ -68,10 +63,6 @@
    feedBack() {
      const token = wx.getStorageSync('jsek-token')
      if (!token) {
        // return wx.showToast({
        //   icon: 'error',
        //   title: '请先登录',
        // })
        return wx.getUserProfile({
          desc: '用户登录',
          success: (res) => {
@@ -79,6 +70,7 @@
          }
        })
      }
      this.closeDialog()
      let content = {
        source: this.data.ratevalue,
        phone: this.data.inputvalue,
@@ -100,20 +92,30 @@
          icon: 'success',
          duration: 2000
        })
        this.closeDialog()
      })
    },
    // 确定
    confirmSuggest() {
      if (!this.data.inputvalue) {
        return this.setData({
          phoneError: true
        })
      }
      if (!this.data.textvalue || this.data.ratevalue) {
      const isPhoneNumber = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(this.data.inputvalue);
      if (!this.data.ratevalue) {
        return wx.showToast({
          success: 'error',
          title: '请填写完整表单',
          icon: "error",
          title: '请选择评分',
        })
      } else if (!this.data.inputvalue) {
        return wx.showToast({
          icon: "error",
          title: '请填写联系方式',
        })
      } else if (!isPhoneNumber) {
        return wx.showToast({
          icon: "error",
          title: '请输入正确联系方式',
        })
      } else if (!this.data.textvalue) {
        return wx.showToast({
          icon: 'error',
          title: '请输入反馈反馈内容',
        })
      }
      this.feedBack()