|
@@ -20,13 +20,13 @@ Page({
|
|
|
textareaHeight: 52, // 初始高度,单位为 rpx
|
|
|
// 图片
|
|
|
fileList: [],
|
|
|
- fileLists:[],
|
|
|
+ fileLists: [],
|
|
|
uptokenURL: '',
|
|
|
domain: '',
|
|
|
uploadURL: '',
|
|
|
- saveimage:false,
|
|
|
- checked:false,
|
|
|
- address:'',
|
|
|
+ saveimage: false,
|
|
|
+ checked: false,
|
|
|
+ address: '',
|
|
|
},
|
|
|
|
|
|
/**
|
|
@@ -53,13 +53,13 @@ Page({
|
|
|
});
|
|
|
const images = []
|
|
|
images.push({
|
|
|
- url:options.image
|
|
|
+ url: options.image
|
|
|
})
|
|
|
- console.log('options.image',options.image);
|
|
|
- if(options.image){
|
|
|
+ console.log('options.image', options.image);
|
|
|
+ if (options.image) {
|
|
|
this.setData({
|
|
|
- fileList:images,
|
|
|
- saveimage:true,
|
|
|
+ fileList: images,
|
|
|
+ saveimage: true,
|
|
|
})
|
|
|
}
|
|
|
this.getUptoken()
|
|
@@ -146,33 +146,44 @@ Page({
|
|
|
const currentUser = Parse.User.current();
|
|
|
let Profilequery = new Parse.Query('Profile');
|
|
|
Profilequery.equalTo('company', company);
|
|
|
+ Profilequery.equalTo('isCheck', true);
|
|
|
Profilequery.notEqualTo('isDeleted', true);
|
|
|
Profilequery.equalTo('user', currentUser.id);
|
|
|
let p = await Profilequery.first()
|
|
|
|
|
|
+ let userequery = new Parse.Query('_User');
|
|
|
+ userequery.equalTo('company', company);
|
|
|
+ userequery.notEqualTo('isDeleted', true);
|
|
|
+ userequery.equalTo('objectId', currentUser.id);
|
|
|
+ let user = await userequery.first()
|
|
|
+
|
|
|
let companyPointer = Parse.Object.extend('Company').createWithoutData(company);
|
|
|
let Comment = new Parse.Object('AIMoment');
|
|
|
- Comment.set('profile', p.toPointer())
|
|
|
+ if(p){
|
|
|
+ Comment.set('profile', p.toPointer())
|
|
|
+ Comment.set('isVisible', true);
|
|
|
+ }
|
|
|
Comment.set('company', companyPointer);
|
|
|
- Comment.set('isVisible', true);
|
|
|
- if(this.data.fileList.length>0){
|
|
|
+ Comment.set('user', user.toPointer());
|
|
|
+
|
|
|
+ if (this.data.fileList.length > 0) {
|
|
|
let url = []
|
|
|
for (let i = 0; i < this.data.fileList.length; i++) {
|
|
|
url.push(this.data.fileList[i].url)
|
|
|
}
|
|
|
this.setData({
|
|
|
- fileLists:url,
|
|
|
+ fileLists: url,
|
|
|
})
|
|
|
Comment.set('images', this.data.fileLists);
|
|
|
}
|
|
|
Comment.set('content', this.data.inputValue);
|
|
|
- if(this.data.checked){
|
|
|
+ if (this.data.checked) {
|
|
|
Comment.set('location', this.data.address);
|
|
|
}
|
|
|
try {
|
|
|
- if(this.data.fileList.length==0&& !this.data.inputValue){
|
|
|
+ if (this.data.fileList.length == 0 && !this.data.inputValue) {
|
|
|
console.log('新数据保存失败');
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
let saveDate2 = await Comment.save();
|
|
|
console.log(saveDate2);
|
|
|
console.log("新数据保存成功");
|
|
@@ -181,19 +192,20 @@ Page({
|
|
|
icon: 'success',
|
|
|
duration: 1000
|
|
|
});
|
|
|
- setTimeout(()=>{
|
|
|
+ setTimeout(() => {
|
|
|
this.goback()
|
|
|
- },1000)
|
|
|
+ }, 1000)
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
} catch (error) {
|
|
|
console.error("保存数据时出现错误:", error);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
},
|
|
|
- async goback(){
|
|
|
- if(!this.data.saveimage){
|
|
|
+ async goback() {
|
|
|
+ if (!this.data.saveimage) {
|
|
|
let pages = getCurrentPages(); //页面对象
|
|
|
console.log(pages);
|
|
|
let prevpage = pages[pages.length - 2]; //上一个页面对象
|
|
@@ -207,13 +219,13 @@ Page({
|
|
|
//选择展示当前位置
|
|
|
onChange(event) {
|
|
|
this.setData({
|
|
|
- checked: event.detail,
|
|
|
+ checked: event.detail,
|
|
|
});
|
|
|
console.log(this.data.checked);
|
|
|
this.Getlocation()
|
|
|
- },
|
|
|
- //获取当前位置
|
|
|
- Getlocation() {
|
|
|
+ },
|
|
|
+ //获取当前位置
|
|
|
+ Getlocation() {
|
|
|
// 获取当前位置信息
|
|
|
wx.getLocation({
|
|
|
type: 'wgs84',
|