guyu/unpackage/dist/dev/mp-weixin/pages/me/user-info-page.js

64 lines
2.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use strict";
const common_vendor = require("../../common/vendor.js");
const common_assets = require("../../common/assets.js");
const _sfc_main = {
data() {
return {
nickName: "某某"
};
},
methods: {
toBack() {
common_vendor.index.navigateBack();
},
//修改头像
chooseImage() {
common_vendor.index.chooseImage({
count: 1,
// 默认9设置图片的最大选择数
sizeType: ["compressed"],
// 可以指定是原图还是压缩图,默认二者都有
sourceType: ["album", "camera"],
// 可以指定来源是相册还是相机,默认二者都有
success: (res) => {
this.avatarUrl = res.tempFilePaths[0];
}
});
},
//上传图片
uploadImage(filePath) {
common_vendor.index.uploadFile({
url: "你的上传接口URL",
// 仅为示例,请替换为实际接口地址
filePath,
name: "file",
// 必须填,对应服务器接收的参数名
formData: {
"user": "test"
// HTTP 请求中其他额外的 form data
},
success: (uploadFileRes) => {
common_vendor.index.__f__("log", "at pages/me/user-info-page.vue:87", "上传成功");
},
fail: (error) => {
common_vendor.index.__f__("error", "at pages/me/user-info-page.vue:91", "上传失败", error);
}
});
}
}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return {
a: common_assets._imports_0$2,
b: common_vendor.o(($event) => $options.toBack()),
c: common_vendor.o(($event) => $options.chooseImage()),
d: common_vendor.o(($event) => $options.chooseImage()),
e: $data.nickName,
f: common_vendor.o(($event) => $data.nickName = $event.detail.value),
g: common_assets._imports_1$4
};
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/me/user-info-page.js.map