1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- const app = getApp()
- Page({
- data: {
- value: '',
- isIos: app.globalData.isIOS
- },
- onLoad(options) {
- },
- sendReply() {
- if (!this.data.value) {
- return
- }
- },
- 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);
- }
- })
- }
- })
|