Commit db6d5cd4 authored by Facius's avatar Facius

Merge branch 'dev-photo-v2' of https://git.banshouhui.com/heyinchen/take_order into dev-photo-v2

parents 61257b89 195ef400
......@@ -134,6 +134,7 @@
// this.globalData.screenHeight = a.screenHeight;
this.globalData.navHeight = a.statusBarHeight / a.screenWidth * 750 + 90
this.globalData.rpxScreenHeight = a.screenHeight / a.screenWidth * 750
this.globalData.screenHeight = a.screenHeight
} catch (a) {}
},
//检查更新
......
......@@ -4,23 +4,48 @@ const db = uniCloud.database({
let cloudRulesApiFun = function(vm){
/* 查询所有产品*/
/* 查询所有产品 废弃*/
let getAllProduct = async () => await db.collection("product").get();
/* 查询产品下的品牌 {product_code:"P0001"}*/
/* 查询产品下的品牌 {product_code:"P0001"} 废弃*/
let getBrand = async (params = {}) => await db.collection("brand").where(params).get();
/* 查询规范项目 {product_code:"P0001"}*/
/* 查询规范项目 {product_code:"P0001"} 废弃*/
let getstandard = async (params = {}) => await db.collection("standard").where(params).get();
/* 查询分组规范项目 */
/* 查询分组规范项目 废弃*/
let getGroupStandard = async (params = {}) => await uniCloud.callFunction({name: 'getGroupStandard', data: params});
/* 查询类别数据 */
let getClassifyDictionary = async () => await db.collection("dictionary").where({"type":"classify"}).get()
/* 查询有数据的系统 或者 品牌 数据 {"classify_id":"","system_id":"","field":"system_id|brand_id"}*/
let getRelationDictionary = async (params = {}) => await uniCloud.callFunction({name: 'getRelationDictionary', data: params});
/* 查询规范 根据 分类、系统、品牌 {"token":"", "classify_id":"","system_id":"","brand_id":""} */
let getGroupStandardV2 = async (params = {}) => await uniCloud.callFunction({name: 'getGroupStandardV2', data: params});
/* 保存图片 {"token":"", "standardId":"", "url":""} */
let saveImage = async (params = {}) => await uniCloud.callFunction({name: 'saveImage', data: params});
/* 获取用户水印,首次返回默认水印 {"token":"", "systemId":""} */
let getUserWatermark = async (params = {}) => await uniCloud.callFunction({name: 'getUserWatermark', data: params});
/* 保存用户水印配置 {"token":"", "watermark": getUserWatemark返回的数据} */
let saveUserWatermark = async (params = {}) => await uniCloud.callFunction({name: 'saveUserWatermark', data: params});
const rulesApi = {
getAllProduct,
getBrand,
getstandard,
getGroupStandard,
// 新接口
getClassifyDictionary,
getRelationDictionary,
getGroupStandardV2,
saveImage,
getUserWatermark,
saveUserWatermark
}
return rulesApi
}
......
This diff is collapsed.
......@@ -140,6 +140,14 @@
"navigationBarTextStyle": "#FFFFFF",
"disableScroll": true
}
},{
"path": "pages/photo/standard",
"style": {
"navigationBarTitleText": "拍照规范",
"navigationBarBackgroundColor": "#333333",
"navigationBarTextStyle": "#FFFFFF",
"disableScroll": true
}
},
{
......@@ -280,7 +288,7 @@
"query": "" //启动参数,在页面的onLoad函数里面得到
},{
"name": "拍照小工具", //模式名称
"path": "pages/photo/take", //启动页面,必选
"path": "pages/photo/standard", //启动页面,必选
"query": "" //启动参数,在页面的onLoad函数里面得到
},{
"name": "基本信息", //模式名称
......
<template>
<view class="backView">
<view class="firstItemView">
<view class="itemTitleView ">
<text class="itemTitle">保存原图</text>
<text class="itemNotice">拍照后另保存一张无水印的图片</text>
</view>
<switch class="itemSwitch" :checked="isSaveOrigine" @change="saveOrigineChange" color="#007AFF" style="transform:scale(0.8)"/>
</view>
<view class="itemView" v-for="(item,ikey) in itemList":key="ikey">
<view class="itemTitleView" @click="itemClick(item,ikey)">
<text class="itemTitle">{{item.title}}</text>
<text class="itemNotice">{{item.notice}}</text>
</view>
<switch class="itemSwitch" :checked="item.isSelect" @change="itemChange" color="#007AFF" style="transform:scale(0.8)"/>
</view>
<view class="shadowBackView" v-if="isPopShow">
<view class="popCenterView">
<text class="popTitle">设置自定义项</text>
<view class="inputBackView">
<view class="leftInputView">
<input class="leftInput" type="text" value="" placeholder="请输入" @input="leftInput"/>
</view>
:
<view class="rightInputView">
<input class="rightInput" type="text" value="" placeholder="请输入内容" @input="rightInput"/>
</view>
</view>
<text class="popNoticeText u-m-t-40">示例:</text>
<text class="popNoticeText">工程队名称:蓝天工程队</text>
<view class="popBtnView">
<view class="popCancelBtn" @click="popCancelClick()">
<text class="popBtnText">取消</text>
</view>
<view class="popSaveBtn" @click="popSaveClick()">
<text class="popBtnText">保存</text>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
isSaveOrigine:true,
itemList:[],
isPopShow:false,
icon_close_new:''
}
},
onLoad(e) {
getApp().trackPage('水印设置页')
this.icon_close_new = getApp().globalData.icon_close_new
if(e && e.product_code){
this.product_code = e.product_code
}
this.getItemList()
},
methods: {
getItemList: function () {
this.itemList = [
{
title:'自定义1',
notice:'点击可编辑更改',
isSelect:false
},
{
title:'自定义2',
notice:'点击可编辑更改',
isSelect:true
},
{
title:'自定义3',
notice:'点击可编辑更改',
isSelect:false
},
{
title:'自定义4',
notice:'点击可编辑更改',
isSelect:false
},
{
title:'自定义5',
notice:'点击可编辑更改',
isSelect:false
}
]
},
//保存原图 开关
saveOrigineChange: function(e) {
console.log('保存原图 开关 发生 change 事件,携带值为', e.target.value)
},
//自定义 开关
itemChange: function(e) {
console.log('自定义 开关 发生 change 事件,携带值为', e.target.value)
},
//自定义 点击
itemClick: function (item,ikey) {
console.log('自定义 开关 发生 click 事件,携带值为', item,ikey)
this.isPopShow = true
},
//左侧输入框
leftInput: function (e){
console.log('左侧输入框 发生 input 事件,携带值为', e.detail.value)
},
//右侧输入框
rightInput: function (e){
console.log('右侧输入框 发生 input 事件,携带值为', e.detail.value)
},
//自定义弹窗 关闭
popCancelClick: function () {
this.isPopShow = false
},
//自定义弹窗 保存
popSaveClick: function () {
this.isPopShow = false
}
}
}
</script>
<style>
.backView{
background-color: #FAFAFA;
position: absolute;
top: 0;
left: 0;
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
}
.firstItemView{
background-color: #FFFFFF;
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
padding-top: 80rpx;
padding-bottom: 80rpx;
border-bottom: 2rpx solid #F4F5F7;
}
.itemView{
background-color: #FFFFFF;
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
padding-top: 54rpx;
padding-bottom: 54rpx;
}
.itemTitleView{
background-color: #FFFFFF;
width: 80%;
display: flex;
flex-direction: column;
padding-left: 30rpx;
}
.itemTitle{
font-size: 32rpx;
font-weight: bold;
color: #333333;
}
.itemNotice{
font-size: 26rpx;
font-weight: bold;
color: #666666;
margin-top: 4rpx;
}
.itemSwitch{
margin-right: 30rpx;
}
.shadowBackView{
background-color: rgba(0,0,0,0.5);
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
}
.popCenterView{
background-color: #FFFFFF;
width: 690rpx;
height: 600rpx;
margin-top: 300rpx;
border-radius: 12rpx;
display: flex;
flex-direction: column;
}
.popTitle{
font-size: 36rpx;
font-weight: bold;
margin-top: 50rpx;
padding-left: 30rpx;
}
.inputBackView{
margin-top: 52rpx;
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
}
.leftInputView{
width: 220rpx;
height: 72rpx;
border: 2rpx solid #666666;
margin-left: 30rpx;
display: flex;
align-items: center;
justify-content: center;
}
.leftInput{
width: 180rpx;
height: 32rpx;
}
.rightInputView{
width: 360rpx;
height: 72rpx;
border: 2rpx solid #666666;
margin-right: 30rpx;
display: flex;
align-items: center;
justify-content: center;
}
.rightInput{
width: 320rpx;
height: 32rpx;
}
.popNoticeText{
font-size: 26rpx;
color: #666666;
padding-left: 30rpx;
}
.popBtnView{
margin-top: 110rpx;
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
}
.popCancelBtn{
background-color: #D1D4D4;
width: 280rpx;
height: 96rpx;
border-radius: 48rpx;
margin-left: 40rpx;
display: flex;
align-items: center;
justify-content: center;
}
.popSaveBtn{
background-color: #2272FF;
width: 280rpx;
height: 96rpx;
border-radius: 48rpx;
margin-right: 40rpx;
display: flex;
align-items: center;
justify-content: center;
}
.popBtnText{
font-size: 32rpx;
color: #FFFFFF;
font-weight: 600;
}
</style>
<template>
<scroll-view class="scroll-view_H" scroll-x="true" @scroll="scroll" scroll-left="120">
<view id="demo1" class="scroll-view-item_H uni-bg-red">A</view>
<view id="demo2" class="scroll-view-item_H uni-bg-green">B</view>
<view id="demo3" class="scroll-view-item_H uni-bg-blue">C</view>
</scroll-view>
</template>
<script>
export default {
data() {
return {
protocolContent:'',
images:[]
}
},
onLoad(e) {
getApp().trackPage('照片预览页')
console.log(e,'e')
if(e.img){
this.images = [e.img]
}
console.log(this.images,'this.images')
},
methods: {
showPreviewFn(img) {
uni.previewImage({
current: 0,
urls: this.images
});
},
//拨打客服 点击
phoneCallClick: function (phone) {
uni.makePhoneCall({
phoneNumber: phone
});
},
}
}
</script>
<style>
.pic{
display: block;
width:100%;
height:auto;
}
</style>
This diff is collapsed.
take-order/static/photo/icon-light.png

1.67 KB | W: | H:

take-order/static/photo/icon-light.png

1.58 KB | W: | H:

take-order/static/photo/icon-light.png
take-order/static/photo/icon-light.png
take-order/static/photo/icon-light.png
take-order/static/photo/icon-light.png
  • 2-up
  • Swipe
  • Onion skin
take-order/static/photo/icon-switch.png

1.77 KB | W: | H:

take-order/static/photo/icon-switch.png

1.46 KB | W: | H:

take-order/static/photo/icon-switch.png
take-order/static/photo/icon-switch.png
take-order/static/photo/icon-switch.png
take-order/static/photo/icon-switch.png
  • 2-up
  • Swipe
  • Onion skin
take-order/static/photo/icon-take.png

8.88 KB | W: | H:

take-order/static/photo/icon-take.png

6.18 KB | W: | H:

take-order/static/photo/icon-take.png
take-order/static/photo/icon-take.png
take-order/static/photo/icon-take.png
take-order/static/photo/icon-take.png
  • 2-up
  • Swipe
  • Onion skin
{
"passwordSecret": "passwordSecret-demo",
"tokenSecret": "tokenSecret-demo",
"tokenExpiresIn": 7200,
"tokenExpiresThreshold": 600,
"passwordErrorLimit": 6,
"bindTokenToDevice": true,
"passwordErrorRetryTime": 3600,
"autoSetInviteCode": false,
"forceInviteCode": false,
"app-plus": {
"tokenExpiresIn": 2592000,
"oauth" : {
"weixin" : {
"appid" : "weixin appid",
"appsecret" : "weixin appsecret"
}
}
},
"mp-weixin": {
"oauth" : {
"weixin" : {
"appid" : "weixin appid",
"appsecret" : "weixin appsecret"
}
}
},
"mp-alipay": {
"oauth" : {
"alipay" : {
"appid" : "alipay appid",
"privateKey" : "alipay privateKey"
}
}
},
"service": {
"sms": {
"name": "DCloud",
"codeExpiresIn": 300,
"smsKey": "your sms key",
"smsSecret": "your sms secret"
}
}
}
This diff is collapsed.
{
"name": "uni-id",
"version": "2.0.3",
"description": "uni-id for uniCloud",
"main": "index.js",
"homepage": "https://uniapp.dcloud.io/uniCloud/uni-id",
"repository": {
"type": "git",
"url": "git+https://gitee.com/dcloud/uni-id.git"
},
"author": "",
"license": "Apache-2.0"
}
\ No newline at end of file
async function getUserId(token) {
const res = await uniCloud.httpclient.request("https://system.banshouhui.com/wxh-worker-rest/rest/" + token +
"/myinfo/id", {
method: 'GET'
})
return res ? res.data : ""
}
module.exports = {
getUserId
}
{
"name": "user-common",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}
'use strict';
const {
getUserId
} = require('user-common')
exports.main = async (event, context) => {
const db = uniCloud.database();
const _ = db.command
const $ = db.command.aggregate
const user_id = getUserId(event.token)
let res = await db.collection("standardV2").aggregate().lookup({
from: 'user_upload_file',
let: {
standard_id: '$_id'
},
pipeline: $.pipeline()
.match(_.expr($.and([
$.eq(['$standard_id', '$$standard_id']),
$.eq(['$user_id', user_id])
]))).sort({
create_date: -1
}).limit(5)
.project({
"_id": 0,
"url": 1,
})
.done(),
as: 'imageList'
}).end()
let data = res.data
const map = new Map()
for (let i = 0; i < data.length; i++) {
data[i].imageList = data[i].imageList.map(a => a.url)
let key = data[i].type
if (map.has(key)) {
data[i].images = data[i].images.split(",")
map.get(key).list.push(data[i])
} else {
data[i].images = data[i].images.split(",")
map.set(key, {
type: key,
list: [data[i]]
})
}
}
return [...map.values()]
};
{
"name": "getGroupStandardV2",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"user-common": "file:../common/user-common"
}
}
// 本文件中的json内容将在云函数【运行】时作为参数传给云函数。
// 配置教程参考:https://uniapp.dcloud.net.cn/uniCloud/quickstart?id=runparam
{
"classify_id": "79550af260555cc20afb34146966a2c4",
"system_id": "79550af260555cc20afb34156c94b32c",
"field": "brand_id"
}
'use strict';
exports.main = async (event, context) => {
const field_name = event.field
const param = {
"classify_id": event.classify_id,
"system_id": event.system_id,
"brand_id": event.brand_id
}
const db = uniCloud.database()
let res = await db.collection("standardV2").aggregate().match(param).group({
_id: "$" + event.field
}).end();
res = await db.collection('dictionary').field({
"_id": true,
"name": true
}).where({
_id: db.command.in(Array.from(res.data, item => item._id))
}).get()
return res.data
};
// 本文件中的json内容将在云函数【运行】时作为参数传给云函数。
// 配置教程参考:https://uniapp.dcloud.net.cn/uniCloud/quickstart?id=runparam
{
"token": ""
"system_id": "79550af260555cc20afb34156c94b32c"
}
'use strict';
const {
getUserId
} = require('user-common')
exports.main = async (event, context) => {
//event为客户端上传的参数
const user_id = getUserId(event.token)
const collection = uniCloud.database().collection("user_watermark").field({
'_id': false
})
let res = await collection.where({
user_id: user_id,
system_id: event.system_id
}).get()
if (!res.data || res.data.length <= 0) { // 用户没有 获取模板
res = await collection.where({
system_id: event.system_id
}).get()
}
return res.data[0]
};
{
"name": "getUserWatermark",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"user-common": {
"version": "file:../common/user-common"
}
}
}
{
"name": "getUserWatermark",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"user-common": "file:../common/user-common"
}
}
'use strict';
const {
getUserId
} = require('user-common')
exports.main = async (event, context) => {
//event为客户端上传的参数
let workerId = getUserId(event.token)
if (workerId) {
await uniCloud.database().collection("user_upload_file").add({
"user_id": workerId,
"standard_id": event.standardId,
url: event.url,
create_date: new Date()
})
return true
}
return false
};
{
"name": "saveImage",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"user-common": "file:../common/user-common"
}
}
'use strict';
const {
getUserId
} = require('user-common')
exports.main = async (event, context) => {
let user_id = getUserId(event.token)
const watermark = event.watermark
user_id = '12312313'
if (user_id) {
watermark.user_id = user_id
const collection = uniCloud.database().collection("user_watermark");
const res = await collection.where({
user_id: user_id,
system_id: watermark.system_id
}).get()
if (res.data && res.data.length > 0) {
collection.doc(res.data[0]._id).update(watermark)
} else {
collection.add(watermark)
}
}
//返回数据给客户端
return true
};
{
"name": "saveUserWatermark",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"user-common": {
"version": "file:../common/user-common"
}
}
}
{
"name": "saveUserWatermark",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"user-common": "file:../common/user-common"
}
}
// 本文件中的json内容将在云函数【运行】时作为参数传给云函数。
// 配置教程参考:https://uniapp.dcloud.net.cn/uniCloud/quickstart?id=runparam
{
"token": "12312313",
"watermark": {
"has_origin": true,
"lower_right": {
"body": [{
"watemark_text": "时间",
"watemark_type": "时间",
"watemark_value": ""
}, {
"watemark_text": "地址",
"watemark_type": "地址",
"watemark_value": ""
}, {
"watemark_text": "经度",
"watemark_type": "经度",
"watemark_value": ""
}, {
"watemark_text": "纬度",
"watemark_type": "纬度",
"watemark_value": ""
}],
"title_text": "OR000000001111"
},
"mid_text": "现场拍照",
"system_id": "79550af260555cc20afb34156c94b32c",
"user_id": ""
}
}
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