evaluate.js 2.9 KB
"use strict";
var common_vendor = require("../../common/vendor.js");
var api_index = require("../../api/index.js");
require("../../utils/request.js");
if (!Array) {
  const _easycom_u_navbar2 = common_vendor.resolveComponent("u-navbar");
  const _easycom_u_rate2 = common_vendor.resolveComponent("u-rate");
  (_easycom_u_navbar2 + _easycom_u_rate2)();
}
const _easycom_u_navbar = () => "../../uni_modules/uview-plus/components/u-navbar/u-navbar.js";
const _easycom_u_rate = () => "../../uni_modules/uview-plus/components/u-rate/u-rate.js";
if (!Math) {
  (_easycom_u_navbar + _easycom_u_rate)();
}
const _sfc_main = {
  setup(__props) {
    const count = common_vendor.ref(5);
    const value = common_vendor.ref(0);
    let photoList = common_vendor.reactive([]);
    let desc = common_vendor.ref("");
    const { proxy } = common_vendor.getCurrentInstance();
    const submit = () => {
      getComments();
    };
    const addPhoto = () => proxy.$methods.upload("http://health.shs.broing.cn/api/common/upload", (imgUrl) => {
      console.log("\u8FD4\u56DE\u56FE\u7247", imgUrl);
      photoList.push(imgUrl.avatar);
    });
    const delPhoto = (index) => {
      photoList.splice(index, 1);
    };
    const getComments = async () => {
      try {
        let params = {
          goods_id: 86,
          image: photoList.join(","),
          content: desc.value
        };
        const res = await api_index.getComment(params);
        common_vendor.index.showToast({ title: "\u611F\u8C22\u60A8\u7684\u8BC4\u8BBA~", icon: "none" });
        setTimeout(() => {
          common_vendor.index.navigateBack();
        }, 1e3);
        console.log("getComment", res);
      } catch (err) {
        common_vendor.index.showToast({ title: err, icon: "none" });
        console.log("getComment", err);
      }
    };
    return (_ctx, _cache) => {
      return {
        a: common_vendor.p({
          placeholder: true,
          title: "\u8BC4\u4EF7",
          bgColor: "transparent",
          autoBack: true
        }),
        b: common_vendor.f(common_vendor.unref(photoList), (item, index, i0) => {
          return {
            a: item,
            b: common_vendor.o(($event) => delPhoto(index)),
            c: index
          };
        }),
        c: common_vendor.t(5 - common_vendor.unref(photoList).length),
        d: common_vendor.o(addPhoto),
        e: common_vendor.unref(desc),
        f: common_vendor.o(($event) => common_vendor.isRef(desc) ? desc.value = $event.detail.value : desc = $event.detail.value),
        g: common_vendor.o(($event) => value.value = $event),
        h: common_vendor.p({
          activeColor: "#FEA302",
          count: count.value,
          modelValue: value.value
        }),
        i: common_vendor.o(submit)
      };
    };
  }
};
var MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "D:/vue/\u5927\u5065\u5EB7\u5546\u57CE/healthMall/pages/mine/evaluate.vue"]]);
wx.createPage(MiniProgramPage);