import { getMsgDet, sendMsg } from "~/api/message" const app = getApp() Page({ data: { targetUid: '', value: '', isIos: app.globalData.isIOS }, onLoad(options) { console.log(options); wx.setNavigationBarTitle({ title: options.title, }) this.setData({ targetUid: options.uid }) this.getMsgDet() }, async getMsgDet() { let list = await getMsgDet({ senderUid: this.data.targetUid, pageNo: 1, pageSize: 20 }) console.log(list); }, async sendReply() { if (!this.data.value) { return } await sendMsg({ content: "1", receiverUid: "" }) }, bindKeyInput(e) { this.setData({ value: e.detail.value }) }, jumpUserInfo({ currentTarget }) { wx.navigateTo({ url: `/pages/personal/index?uid=${currentTarget.dataset.uid}&type=user`, }) }, chooseImage() { wx.chooseImage({ count: 1, // 可选择的图片数量 sizeType: ['compressed'], // 压缩图片 sourceType: ['album', 'camera'], // 来源:相册或相机 success: (res) => { // 将选择的图片上传到服务器 this.uploadImage(res.tempFilePaths[0]); } }) }, uploadImage(imagePath) { wx.uploadFile({ url: 'https://reader-api.ai160.com/file/upload', filePath: imagePath, header: { uid: wx.getStorageSync('uid') }, success: (res) => { console.log(res.data); } }) } })