|
|
@@ -5,6 +5,7 @@ Page({
|
|
|
data: {
|
|
|
avatar: "https://6875-huihenduo-2gx127w7f837b584-1255802371.tcb.qcloud.la/miniapp-static/avatar-icon.jpg?sign=f5c66c94d189436f82353eb48cb01f08&t=1634538864",
|
|
|
cameraIcon: "https://6875-huihenduo-2gx127w7f837b584-1255802371.tcb.qcloud.la/miniapp-static/camera-icon.png?sign=11a65871a2800cd04ecaa8991687fccd&t=1634607415",
|
|
|
+ newCameraIcon: "https://6875-huihenduo-2gx127w7f837b584-1255802371.tcb.qcloud.la/miniapp-static/camera.png?sign=ad0fe8bead6a46cb20f45f792d4bed67&t=1645502416",
|
|
|
userName: "",
|
|
|
phone: "",
|
|
|
shipName: "",
|
|
|
@@ -39,7 +40,10 @@ Page({
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- takePhoto() {
|
|
|
+ takePhoto(e) {
|
|
|
+ let {
|
|
|
+ mediatype
|
|
|
+ } = e.currentTarget.dataset
|
|
|
wx.getLocation({
|
|
|
type: 'gcj02',
|
|
|
isHighAccuracy: true,
|
|
|
@@ -84,7 +88,7 @@ Page({
|
|
|
wx.showToast({
|
|
|
title: res.msg
|
|
|
})
|
|
|
- wx.navigateTo({
|
|
|
+ wx.redirectTo({
|
|
|
url: '/pages/takePhoto/success/success',
|
|
|
})
|
|
|
} else {
|
|
|
@@ -100,7 +104,7 @@ Page({
|
|
|
console.log("新用户视频", e)
|
|
|
wx.setStorageSync('type', 2)
|
|
|
wx.setStorageSync('file', e.tempFilePath)
|
|
|
- wx.navigateTo({
|
|
|
+ wx.redirectTo({
|
|
|
url: `/pages/newCachePage/newCachePage`,
|
|
|
})
|
|
|
}
|
|
|
@@ -123,11 +127,17 @@ Page({
|
|
|
wx.showLoading({
|
|
|
title: '正在上传...',
|
|
|
})
|
|
|
- let res = await uploadFile(e.tempFilePath, {
|
|
|
- type: 3,
|
|
|
+ let postData = {
|
|
|
+ type: mediatype,
|
|
|
userId: wx.getStorageSync('userId'),
|
|
|
- location: `${this.data.longitude},${this.data.latitude}`
|
|
|
- })
|
|
|
+ }
|
|
|
+
|
|
|
+ if (mediatype == 3) {
|
|
|
+ postData.location = `${this.data.longitude},${this.data.latitude}`
|
|
|
+ } else {
|
|
|
+ postData.location = ''
|
|
|
+ }
|
|
|
+ let res = await uploadFile(e.tempFilePath, postData)
|
|
|
console.log("上传结束", res)
|
|
|
if (res.status == 0) {
|
|
|
wx.showToast({
|
|
|
@@ -140,25 +150,28 @@ Page({
|
|
|
success: e => {
|
|
|
console.log("下载调用!", e)
|
|
|
wx.setStorageSync('cacheImage', e.tempFilePath)
|
|
|
- wx.saveImageToPhotosAlbum({
|
|
|
- filePath: e.tempFilePath,
|
|
|
- success: e => {
|
|
|
- if (e.errMsg == "saveImageToPhotosAlbum:ok") {
|
|
|
- wx.showToast({
|
|
|
- title: '保存成功!',
|
|
|
+ if (mediatype == 3) {
|
|
|
+ wx.saveImageToPhotosAlbum({
|
|
|
+ filePath: e.tempFilePath,
|
|
|
+ success: e => {
|
|
|
+ if (e.errMsg == "saveImageToPhotosAlbum:ok") {
|
|
|
+ wx.showToast({
|
|
|
+ title: '保存成功!',
|
|
|
+ })
|
|
|
+ wx.removeStorageSync('cacheImage')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: e => {
|
|
|
+ console.log("失败4", e)
|
|
|
+ this.setData({
|
|
|
+ authModal: true,
|
|
|
+ modalText: "文件存储"
|
|
|
})
|
|
|
- wx.removeStorageSync('cacheImage')
|
|
|
}
|
|
|
- },
|
|
|
- fail: e => {
|
|
|
- console.log("失败4", e)
|
|
|
- this.setData({
|
|
|
- authModal: true,
|
|
|
- modalText: "文件存储"
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- wx.navigateTo({
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ wx.redirectTo({
|
|
|
url: '/pages/takePhoto/success/success',
|
|
|
})
|
|
|
},
|
|
|
@@ -178,7 +191,7 @@ Page({
|
|
|
console.log("新用户图片", e)
|
|
|
wx.setStorageSync('type', 1)
|
|
|
wx.setStorageSync('file', e.tempFilePath)
|
|
|
- wx.navigateTo({
|
|
|
+ wx.redirectTo({
|
|
|
url: `/pages/newCachePage/newCachePage`,
|
|
|
})
|
|
|
}
|
|
|
@@ -205,10 +218,14 @@ Page({
|
|
|
},
|
|
|
onLoad() {
|
|
|
let userName = wx.getStorageSync('userName')
|
|
|
+ let userId = wx.getStorageSync('userId')
|
|
|
let phone = wx.getStorageSync('phone')
|
|
|
+ let shipId = wx.getStorageSync('shipId')
|
|
|
this.setData({
|
|
|
userName,
|
|
|
- phone
|
|
|
+ phone,
|
|
|
+ userId,
|
|
|
+ shipId
|
|
|
})
|
|
|
}
|
|
|
})
|