first commit
This commit is contained in:
85
unpackage/dist/dev/mp-weixin/pages/hiddendanger/acceptance.js
vendored
Normal file
85
unpackage/dist/dev/mp-weixin/pages/hiddendanger/acceptance.js
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
if (!Array) {
|
||||
const _easycom_up_textarea2 = common_vendor.resolveComponent("up-textarea");
|
||||
const _easycom_up_upload2 = common_vendor.resolveComponent("up-upload");
|
||||
(_easycom_up_textarea2 + _easycom_up_upload2)();
|
||||
}
|
||||
const _easycom_up_textarea = () => "../../uni_modules/uview-plus/components/u-textarea/u-textarea.js";
|
||||
const _easycom_up_upload = () => "../../uni_modules/uview-plus/components/u-upload/u-upload.js";
|
||||
if (!Math) {
|
||||
(_easycom_up_textarea + _easycom_up_upload)();
|
||||
}
|
||||
const _sfc_main = {
|
||||
__name: "acceptance",
|
||||
setup(__props) {
|
||||
const fileList1 = common_vendor.ref([]);
|
||||
const deletePic = (event) => {
|
||||
fileList1.value.splice(event.index, 1);
|
||||
};
|
||||
const afterRead = async (event) => {
|
||||
let lists = [].concat(event.file);
|
||||
let fileListLen = fileList1.value.length;
|
||||
lists.map((item) => {
|
||||
fileList1.value.push({
|
||||
...item,
|
||||
status: "uploading",
|
||||
message: "上传中"
|
||||
});
|
||||
});
|
||||
for (let i = 0; i < lists.length; i++) {
|
||||
const result = await uploadFilePromise(lists[i].url);
|
||||
let item = fileList1.value[fileListLen];
|
||||
fileList1.value.splice(fileListLen, 1, {
|
||||
...item,
|
||||
status: "success",
|
||||
message: "",
|
||||
url: result
|
||||
});
|
||||
fileListLen++;
|
||||
}
|
||||
};
|
||||
const uploadFilePromise = (url) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
common_vendor.index.uploadFile({
|
||||
url: "http://192.168.2.21:7001/upload",
|
||||
// 仅为示例,非真实的接口地址
|
||||
filePath: url,
|
||||
name: "file",
|
||||
formData: {
|
||||
user: "test"
|
||||
},
|
||||
success: (res) => {
|
||||
setTimeout(() => {
|
||||
resolve(res.data.data);
|
||||
}, 1e3);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
return (_ctx, _cache) => {
|
||||
return {
|
||||
a: common_vendor.o(($event) => _ctx.value1 = $event),
|
||||
b: common_vendor.p({
|
||||
placeholder: "请输入内容",
|
||||
modelValue: _ctx.value1
|
||||
}),
|
||||
c: common_vendor.o(($event) => _ctx.value1 = $event),
|
||||
d: common_vendor.p({
|
||||
placeholder: "请输入内容",
|
||||
modelValue: _ctx.value1
|
||||
}),
|
||||
e: common_vendor.o(afterRead),
|
||||
f: common_vendor.o(deletePic),
|
||||
g: common_vendor.p({
|
||||
fileList: fileList1.value,
|
||||
name: "1",
|
||||
multiple: true,
|
||||
maxCount: 10
|
||||
})
|
||||
};
|
||||
};
|
||||
}
|
||||
};
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-39f9b795"]]);
|
||||
wx.createPage(MiniProgramPage);
|
||||
Reference in New Issue
Block a user