evaluate.js
3.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
"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([]);
const imgList = common_vendor.ref([]);
let desc = common_vendor.ref("");
const { proxy } = common_vendor.getCurrentInstance();
const submit = () => {
getComments();
};
const evaluateOrderId = common_vendor.ref(0);
common_vendor.onLoad((e) => {
evaluateOrderId.value = e.id;
});
const addPhoto = () => proxy.$methods.upload("http://health.shs.broing.cn/api/common/upload", (imgUrl) => {
console.log("\u8FD4\u56DE\u56FE\u7247", imgUrl);
imgList.value.push(imgUrl.upImg);
photoList.push(imgUrl.avatar);
});
const delPhoto = (index) => {
imgList.value.splice(index, 1);
photoList.splice(index, 1);
};
const getComments = async () => {
try {
let params = {
id: evaluateOrderId.value,
image: imgList.value.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);