import {url} from '../request' Page({ data: { }, onLoad() {}, onChange(value, e) { console.log(value, e); }, bindTextAreaBlur(e) { this.setData({ inputtext:e.detail.value }) console.log(this.data.inputtext); }, onUpload(file) { return new Promise((resolve, reject) => { console.log('上传文件路径:', file); // 确保文件路径正确 my.uploadFile({ url: url + '/api/file/upload/server/not_login', fileType: 'image', name: 'file', filePath: file.path, formData: { biz: 'card', }, success: res => { resolve(file.path); console.log('上传成功:', res); const cunchu = JSON.parse(res.data) this.setData({ zhengshu:cunchu.data, }) console.log(this.data.zhengshu,'hhhhhhhhhhhhhhh'); }, fail: (err) => { console.log('上传失败:', err); reject(); }, }); }); }, // 星级改变 handleChange(value) { console.log(value); this.setData({ value:value, }); }, handleChangem(value) { console.log(value); this.setData({ valuemeijiashi:value, }); }, tijiao(){ my.getStorage({ key: 'userInfo', success: (res) => { const userInfo = res.data; this.setData({ id: userInfo.id, // 获取 id }); if (userInfo && userInfo.cookie) { my.request({ url: url + '/api/level/add', method: 'POST', data: { businessId: 0, manicuristId: 0, manicuristRating: this.data.valuemeijiashi, orderId: 0, rating: this.data.value, review: this.data.inputtext, userId: this.data.id }, headers: { 'content-type': 'application/json', }, dataType: 'json', success: (res) => { console.log(res); if (res.data.code === 0) { console.log(res); my.alert({content:'评价成功'}) my.navigateBack(); } }, fail: (error) => { my.alert({ content: '评价失败' }); }, }); } else { my.alert({ content: '您未登录,请先登录。', success: () => { my.navigateTo({ url: '/pages/denglu/denglu', }); }, }); } }, }); }, });