index.js 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. "use strict";
  2. const common_vendor = require("../../../common/vendor.js");
  3. const ErpNavBar = () => "../../../components/erp-nav-bar.js";
  4. const _sfc_main = {
  5. components: { ErpNavBar },
  6. data() {
  7. return {
  8. types: [
  9. { label: "系统投诉", value: "complaint" },
  10. { label: "改进建议", value: "suggestion" },
  11. { label: "其他反馈", value: "other" }
  12. ],
  13. formData: {
  14. type: "complaint",
  15. content: "",
  16. images: []
  17. }
  18. };
  19. },
  20. computed: {
  21. isFormValid() {
  22. return this.formData.content && this.formData.content.trim().length >= 5;
  23. }
  24. },
  25. methods: {
  26. goBack() {
  27. common_vendor.index.navigateBack();
  28. },
  29. chooseImage() {
  30. const count = 6 - this.formData.images.length;
  31. common_vendor.index.chooseImage({
  32. count,
  33. sizeType: ["compressed"],
  34. success: (res) => {
  35. this.formData.images = [...this.formData.images, ...res.tempFilePaths];
  36. }
  37. });
  38. },
  39. removeImage(index) {
  40. this.formData.images.splice(index, 1);
  41. },
  42. previewImage(index) {
  43. common_vendor.index.previewImage({
  44. urls: this.formData.images,
  45. current: index
  46. });
  47. },
  48. handleSubmit() {
  49. common_vendor.index.showLoading({ title: "提交中" });
  50. setTimeout(() => {
  51. common_vendor.index.hideLoading();
  52. common_vendor.index.showToast({ title: "反馈成功" });
  53. setTimeout(() => {
  54. common_vendor.index.navigateBack();
  55. }, 1500);
  56. }, 1e3);
  57. }
  58. }
  59. };
  60. if (!Array) {
  61. const _component_erp_nav_bar = common_vendor.resolveComponent("erp-nav-bar");
  62. _component_erp_nav_bar();
  63. }
  64. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  65. return common_vendor.e({
  66. a: common_vendor.p({
  67. title: "投诉与建议"
  68. }),
  69. b: common_vendor.f($data.types, (item, k0, i0) => {
  70. return {
  71. a: common_vendor.t(item.label),
  72. b: item.value,
  73. c: $data.formData.type === item.value ? 1 : "",
  74. d: common_vendor.o(($event) => $data.formData.type = item.value, item.value)
  75. };
  76. }),
  77. c: $data.formData.content,
  78. d: common_vendor.o(($event) => $data.formData.content = $event.detail.value, "dd"),
  79. e: common_vendor.t($data.formData.content.length),
  80. f: common_vendor.f($data.formData.images, (img, index, i0) => {
  81. return {
  82. a: img,
  83. b: common_vendor.o(($event) => $options.previewImage(index), index),
  84. c: common_vendor.o(($event) => $options.removeImage(index), index),
  85. d: index
  86. };
  87. }),
  88. g: $data.formData.images.length < 6
  89. }, $data.formData.images.length < 6 ? {
  90. h: common_vendor.o((...args) => $options.chooseImage && $options.chooseImage(...args), "94")
  91. } : {}, {
  92. i: !$options.isFormValid,
  93. j: common_vendor.o((...args) => $options.handleSubmit && $options.handleSubmit(...args), "eb")
  94. });
  95. }
  96. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-6497fc4f"]]);
  97. wx.createPage(MiniProgramPage);
  98. //# sourceMappingURL=../../../../.sourcemap/mp-weixin/pages/mine/complaint/index.js.map