Commit 5c4be0b7 authored by 李超鹏's avatar 李超鹏

Merge branch 'dev-photo-v2'

# Conflicts:
#	take-order/pages/photo/list.vue
#	take-order/pages/photo/preview.vue
#	take-order/pages/photo/setting.vue
parents 2ebfe4e1 7766596c
This diff is collapsed.
......@@ -39,7 +39,7 @@
// 获取规格Id
this.standardId = app.globalData.photo.currentItem._id
}
getApp().trackPage('照片预览页')
const globalTempPath = getApp().globalData.photo.tempPath
if(globalTempPath && globalTempPath.mixWater){
......@@ -48,7 +48,7 @@
if(e.standardId) {
this.standardId = e.standardId
}
this.token = getApp().globalData.token
},
methods: {
......@@ -135,11 +135,12 @@
uni.showLoading({
title:'图片保存中…'
})
self.saveTempToLocal()
self.confirmUpload(true)
},
submitFile() {
let self = this
if(self.keys.length) {
for (let s of self.keys) {
self.$u.cloudApi.saveImage({
......@@ -148,9 +149,8 @@
"url": s,
}).then(async res =>{
console.log(res, "云服务保存图片");
if(res.result) {
if(res.result.code) {
// TODO 参数是否要来回传递
await self.saveTempToLocal()
const photo = getApp().globalData.photo
photo.currentItemLength = photo.currentItemLength + 1
uni.hideLoading()
......@@ -178,7 +178,7 @@
// },2000)
} else {
uni.showToast({
title:'图片上传失败'
title:'图片上传失败 '+ res.result.msg
})
}
})
......@@ -228,7 +228,7 @@
.pic {
flex:1;
width: 100%;
/* height:auto */
/* height: 760rpx; */
}
......
This diff is collapsed.
// 本文件中的json内容将在云函数【运行】时作为参数传给云函数。
// 配置教程参考:https://uniapp.dcloud.net.cn/uniCloud/quickstart?id=runparam
{"token":""
}
\ No newline at end of file
'use strict';
const {
getUserId
} = require('user-common')
exports.main = async (event, context) => {
let userId = getUserId(event.token)
let result = {code: false, msg: "用户没有权限"}
if (userId) {
let res = await uniCloud.database().collection("user_upload_file").where({
'user_id': userId
}).remove()
result = {code: true, msg: ""}
}
//返回数据给客户端
return result
};
async function getUserId(token) {
const res = await uniCloud.httpclient.request("https://system.dev.banshouhui.com/wxh-worker-rest/rest/" +
const res = await uniCloud.httpclient.request("https://system.banshouhui.com/wxh-worker-rest/rest/" +
token +
"/myinfo/id", {
method: 'GET',
dataType: 'text'
})
return res && res.status === 200 ? res.data : token
return res && res.status === 200 ? res.data : ""
}
module.exports = {
......
......@@ -7,6 +7,10 @@ exports.main = async (event, context) => {
const _ = db.command
const $ = db.command.aggregate
const user_id = await getUserId(event.token)
if(!user_id){
return {error_code:'user_auth',error_msg:"用户没有权限"}
}
let res = await db.collection("standardV2").aggregate().lookup({
from: 'user_upload_file',
let: {
......
......@@ -5,6 +5,9 @@ const {
exports.main = async (event, context) => {
//event为客户端上传的参数
const user_id = await getUserId(event.token)
if(!user_id){
return {error_code:'user_auth',error_msg:"用户没有权限"}
}
const collection = uniCloud.database().collection("user_watermark").field({
'_id': false
})
......
......@@ -12,8 +12,8 @@ exports.main = async (event, context) => {
url: "https://img2.banshouhui.com/" + event.url,
create_date: new Date()
})
return true
return {code:true}
}else{
return {code:false,msg:"用户没有权限"}
}
return false
};
......@@ -5,7 +5,6 @@ const {
exports.main = async (event, context) => {
let user_id = await getUserId(event.token)
console.log(user_id);
const watermark = event.watermark
if (user_id) {
watermark.user_id = user_id
......@@ -19,7 +18,8 @@ exports.main = async (event, context) => {
} else {
await collection.add(watermark)
}
return {code:true}
}else{
return {code:false,msg:"用户没有权限"}
}
//返回数据给客户端
return true
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment