Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
take_order
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
和慭琛
take_order
Commits
dc9669ef
Commit
dc9669ef
authored
Dec 31, 2020
by
李俊赕
Browse files
Options
Browse Files
Download
Plain Diff
edit-i
parents
2dec7783
052d508a
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
81 additions
and
92 deletions
+81
-92
index.js
take-order/cloudfunctions-tcb/getGroupStandard/index.js
+2
-2
pages.json
take-order/pages.json
+9
-6
brand.vue
take-order/pages/photo/brand.vue
+2
-2
detail.vue
take-order/pages/photo/detail.vue
+41
-0
list.vue
take-order/pages/photo/list.vue
+3
-1
product.vue
take-order/pages/photo/product.vue
+3
-3
try.vue
take-order/pages/photo/try.vue
+21
-78
No files found.
take-order/cloudfunctions-tcb/getGroupStandard/index.js
View file @
dc9669ef
...
...
@@ -7,10 +7,10 @@ exports.main = async (event, context) => {
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
){
let
key
=
data
[
i
].
type
if
(
map
.
has
(
key
)){
data
[
i
].
images
=
data
[
i
].
images
.
split
(
"
;
"
)
data
[
i
].
images
=
data
[
i
].
images
.
split
(
"
,
"
)
map
.
get
(
key
).
list
.
push
(
data
[
i
])
}
else
{
data
[
i
].
images
=
data
[
i
].
images
.
split
(
"
;
"
)
data
[
i
].
images
=
data
[
i
].
images
.
split
(
"
,
"
)
map
.
set
(
key
,{
type
:
key
,
list
:[
data
[
i
]]})
}
}
...
...
take-order/pages.json
View file @
dc9669ef
...
...
@@ -5,7 +5,15 @@
},
*/
"pages"
:
[
//pages数组中第一项表示应用启动页,参考:https
:
//uniapp.dcloud.io/collocation/pages
{
"path"
:
"pages/photo/product"
,
"style"
:
{
"navigationBarTitleText"
:
"选择产品"
}
},
{
"path"
:
"pages/photo/try"
,
"style"
:
{
...
...
@@ -13,12 +21,7 @@
}
},
{
"path"
:
"pages/photo/product"
,
"style"
:
{
"navigationBarTitleText"
:
"选择产品"
}
},
{
"path"
:
"pages/photo/detail"
,
...
...
take-order/pages/photo/brand.vue
View file @
dc9669ef
...
...
@@ -2,8 +2,8 @@
<view
class=
"backView"
>
<text
class=
"topTitle"
>
{{
product
}}
> 选择产品
</text>
<view
class=
"u-p-b-48"
>
<view
class=
"itemView u-m-t-48"
v-for=
"(item,ikey) in brandList"
:key=
"ikey"
>
<text
class=
"itemTitle"
@
click=
"itemClick(item)"
>
{{
item
.
name
}}
</text>
<view
class=
"itemView u-m-t-48"
@
click=
"itemClick(item)"
v-for=
"(item,ikey) in brandList"
:key=
"ikey"
>
<text
class=
"itemTitle"
>
{{
item
.
name
}}
</text>
</view>
</view>
...
...
take-order/pages/photo/detail.vue
View file @
dc9669ef
...
...
@@ -20,6 +20,8 @@
image_count
:
1
,
current_count
:
1
,
current_image
:
''
,
done_count
:
0
,
images
:[],
icon_gotake
:
'https://qn-static.banshouhui.com/gotake.png'
,
icon_arrow_down
:
'https://qn-static.banshouhui.com/arrow_down.png'
,
}
...
...
@@ -27,6 +29,11 @@
onLoad
(
e
)
{
this
.
initData
(
e
)
},
onShow
(){
this
.
checkDoneCount
()
},
methods
:
{
initData
:
function
(
e
)
{
...
...
@@ -43,6 +50,12 @@
this
.
current_count
=
e
.
current_count
}
if
(
e
&&
e
.
images
){
this
.
images
=
JSON
.
parse
(
e
.
images
)
console
.
log
(
'images:'
)
console
.
log
(
this
.
images
)
}
uni
.
setNavigationBarTitle
({
title
:
'走线照片 ('
+
this
.
current_count
+
'/'
+
this
.
image_count
+
')'
})
...
...
@@ -53,6 +66,34 @@
})
},
//检查已拍照数量
checkDoneCount
:
function
(){
let
pages
=
getCurrentPages
();
let
currPage
=
pages
[
pages
.
length
-
1
];
console
.
log
(
'是否清除:'
)
//console.log(currPage.data.isClean)
if
(
currPage
.
data
.
done_count
==
this
.
image_count
){
console
.
log
(
'已拍完 所有数量照片'
)
uni
.
showToast
({
icon
:
'none'
,
title
:
'已拍完所有照片'
})
setTimeout
(
function
()
{
uni
.
navigateBack
({
})
},
2000
);
}
else
{
console
.
log
(
'没有拍完 所有数量照片'
)
this
.
current_count
=
currPage
.
data
.
done_count
this
.
current_image
=
this
.
images
[
currPage
.
data
.
done_count
]
}
},
//照片预览
imageClick
:
function
(
image
)
{
uni
.
previewImage
({
...
...
take-order/pages/photo/list.vue
View file @
dc9669ef
...
...
@@ -99,11 +99,13 @@
//右侧点击
rightItemClick
:
function
(
item
,
ikey
)
{
var
current_image
=
item
.
images
[
ikey
]
var
current_count
=
ikey
+
1
uni
.
navigateTo
({
url
:
'/pages/photo/detail'
+
'?current_image='
+
current_image
+
'&image_count='
+
item
.
image_count
+
'¤t_count='
+
ikey
,
+
'¤t_count='
+
current_count
+
'&images='
+
JSON
.
stringify
(
item
.
images
)
,
})
},
...
...
take-order/pages/photo/product.vue
View file @
dc9669ef
...
...
@@ -2,8 +2,8 @@
<view
class=
"backView"
>
<text
class=
"topTitle"
>
选择产品
</text>
<view
class=
"u-p-b-48"
>
<view
class=
"itemView u-m-t-48"
v-for=
"(item,ikey) in productList"
:key=
"ikey"
>
<text
class=
"itemTitle"
@
click=
"itemClick(item)"
>
{{
item
.
name
}}
</text>
<view
class=
"itemView u-m-t-48"
@
click=
"itemClick(item)"
v-for=
"(item,ikey) in productList"
:key=
"ikey"
>
<text
class=
"itemTitle"
>
{{
item
.
name
}}
</text>
</view>
</view>
...
...
@@ -34,7 +34,7 @@
this
.
$u
.
cloudApi
.
getAllProduct
().
then
(
res
=>
{
console
.
log
(
'获取产品数据:'
)
console
.
log
(
res
)
if
(
res
.
result
.
data
){
if
(
res
.
result
&&
res
.
result
.
data
){
that
.
productList
=
res
.
result
.
data
}
...
...
take-order/pages/photo/try.vue
View file @
dc9669ef
...
...
@@ -13,7 +13,7 @@
<cover-view
class=
"bottomView"
>
<!--cover-image class='switchIcon' :src='icon_switch_white' @click="switchClick()">
</cover-image-->
<cover-image
class=
'takeIcon'
:src=
'icon_take'
@
click=
"takePhoto()"
>
</cover-image>
<cover-image
class=
"backIcon"
v-if=
"restultImage"
:src=
"restultImage"
mode=
""
@
click=
"goPage"
></cover-image>
<cover-image
class=
"backIcon
resultIcon
"
v-if=
"restultImage"
:src=
"restultImage"
mode=
""
@
click=
"goPage"
></cover-image>
<!--cover-image class='flashIcon' :src='icon_light_on_white' @click="flashClick()">
</cover-image-->
</cover-view>
<canvas
v-show=
'showImage'
canvas-id=
"canvas"
:style=
"
{'width':canvasWidth+'px','height': canvasHeight + 'px'}">
</canvas>
...
...
@@ -133,7 +133,7 @@
//this.imageChange(res)
this
.
getImageInfo
(
res
.
tempImagePath
)
this
.
restultImage
=
res
.
tempImagePath
//this.saveToLocal(res.tempImagePath)
}
});
...
...
@@ -159,6 +159,10 @@
//第三步: 绘制画布
drawCanvas
:
function
(
tempImagePath
,
res
)
{
uni
.
showLoading
({
title
:
'数据处理中...'
,
icon
:
'loading'
})
console
.
log
(
'绘制画布'
)
let
canvasWidth
=
this
.
canvasWidth
let
canvasHeight
=
this
.
canvasHeight
...
...
@@ -173,9 +177,6 @@
//加入 水印文字
this
.
canvas
.
setFontSize
(
28
)
this
.
canvas
.
setFillStyle
(
'#f2f2f2'
)
//this.canvas.rotate(30 * Math.PI / 180);
// let textToWidth = res.width * 0.5;
// let textToHeight = res.height * 0.3;
let
h
=
1
let
txtHeight
=
36
this
.
canvas
.
fillText
(
'经度'
+
this
.
longitude
,
20
,
canvasHeight
-
txtHeight
*
h
++
);
...
...
@@ -184,10 +185,7 @@
this
.
canvas
.
fillText
(
'时间'
+
this
.
date
,
20
,
canvasHeight
-
txtHeight
*
h
++
);
//加入 水印图片
this
.
canvas
.
drawImage
(
this
.
markPath
,
canvasWidth
/
2
-
200
,
canvasHeight
/
2
-
50
,
400
,
100
)
uni
.
showLoading
({
title
:
'数据处理中...'
,
icon
:
'loading'
})
this
.
canvasImage
()
// this.canvas.draw()
...
...
@@ -212,10 +210,11 @@
height
:
Number
(
this
.
canvasHeight
),
canvasId
:
'canvas'
,
success
:
(
res
)
=>
{
that
.
saveToLocal
(
res
.
tempFilePath
)
self
.
saveToLocal
(
res
.
tempFilePath
)
console
.
log
(
res
.
tempFilePath
,
'res.tempFilePath-canvasImage'
)
// this.$emit('canvasImage', res.tempFilePath);
// if (this.showPreview) {
this
.
restultImage
=
res
.
tempFilePath
self
.
showPreviewFn
(
res
.
tempFilePath
);
// }
},
...
...
@@ -235,74 +234,29 @@
urls
:
[
img
]
});
},
//第四步: 导出画布
exportCanvasTempFilePath
:
function
(
width
,
height
)
{
console
.
log
(
'导出画布'
)
console
.
log
(
'width:'
+
width
)
console
.
log
(
'height:'
+
height
)
let
that
=
this
//导出自己需要的图片
uni
.
canvasToTempFilePath
({
canvasId
:
"canvas"
,
success
:
function
(
ress
)
{
that
.
image
=
ress
.
tempFilePath
//处理好的图片
uni
.
hideLoading
()
console
.
log
(
'处理图片 成功:'
)
console
.
log
(
ress
.
tempFilePath
)
uni
.
showToast
({
icon
:
'none'
,
title
:
'处理成功'
})
setTimeout
(
function
()
{
that
.
saveToLocal
(
ress
.
tempFilePath
)
uni
.
previewImage
({
urls
:
[
ress
.
tempFilePath
],
current
:
0
});
},
1000
);
//TODO........
},
fail
:
function
(
e
)
{
uni
.
hideLoading
()
uni
.
showToast
({
title
:
'出错啦...'
,
icon
:
'loading'
})
console
.
log
(
'处理图片 失败:'
)
console
.
log
(
e
)
}
});
},
//第五步: 保存到本地相册
saveToLocal
(
tempImagePath
)
{
let
that
=
this
uni
.
saveImageToPhotosAlbum
({
filePath
:
tempImagePath
,
success
()
{
console
.
log
(
'保存本地相册 成功'
)
uni
.
showToast
({
icon
:
'none'
,
title
:
'已将照片保存到本地相册'
})
},
fail
()
{
console
.
log
(
'保存本地相册 失败'
)
uni
.
showToast
({
icon
:
'none'
,
title
:
'保存本地相册失败'
})
}
})
},
//第六步 返回上层界面
goBack
:
function
()
{
},
//获取当前时间
getTime
:
function
()
{
...
...
@@ -318,18 +272,6 @@
var
timer
=
year
+
'/'
+
month
+
'/'
+
day
+
' '
+
hour
+
':'
+
minute
+
':'
+
second
;
return
timer
;
},
}
}
</
script
>
...
...
@@ -406,7 +348,7 @@
z-index
:
6
;
}
.backIcon
{
.backIcon
.resultIcon
{
background-color
:
#FFFFFF
;
width
:
54
rpx
;
height
:
54
rpx
;
...
...
@@ -414,6 +356,7 @@
position
:
fixed
;
left
:
60
rpx
;
bottom
:
50
rpx
;
border
:
2
rpx
solid
#aaa
;
}
.showCanvas
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment