Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小帅丶
小帅一点资讯
提交
8c561906
小
小帅一点资讯
项目概览
小帅丶
/
小帅一点资讯
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
小
小帅一点资讯
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
8c561906
编写于
11月 09, 2020
作者:
小帅丶
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
:sparkles:增加从聊天页面选择图片的功能
上级
c92adc98
变更
54
隐藏空白更改
内联
并排
Showing
54 changed file
with
2251 addition
and
1331 deletion
+2251
-1331
pages/bizz/acnespotmole/acnespotmole.js
pages/bizz/acnespotmole/acnespotmole.js
+72
-43
pages/bizz/acnespotmole/acnespotmole.wxml
pages/bizz/acnespotmole/acnespotmole.wxml
+33
-24
pages/bizz/animal/animal.js
pages/bizz/animal/animal.js
+72
-45
pages/bizz/animal/animal.wxml
pages/bizz/animal/animal.wxml
+49
-40
pages/bizz/ascii/ascii.js
pages/bizz/ascii/ascii.js
+67
-38
pages/bizz/ascii/ascii.wxml
pages/bizz/ascii/ascii.wxml
+18
-14
pages/bizz/car/car.js
pages/bizz/car/car.js
+69
-39
pages/bizz/car/car.wxml
pages/bizz/car/car.wxml
+49
-40
pages/bizz/clothing/clothing.js
pages/bizz/clothing/clothing.js
+81
-52
pages/bizz/clothing/clothing.wxml
pages/bizz/clothing/clothing.wxml
+32
-27
pages/bizz/color/color.js
pages/bizz/color/color.js
+65
-36
pages/bizz/color/color.wxml
pages/bizz/color/color.wxml
+31
-26
pages/bizz/colourize/colourize.js
pages/bizz/colourize/colourize.js
+66
-36
pages/bizz/colourize/colourize.wxml
pages/bizz/colourize/colourize.wxml
+17
-13
pages/bizz/currency/currency.js
pages/bizz/currency/currency.js
+67
-36
pages/bizz/currency/currency.wxml
pages/bizz/currency/currency.wxml
+68
-53
pages/bizz/dish/dish.js
pages/bizz/dish/dish.js
+65
-36
pages/bizz/dish/dish.wxml
pages/bizz/dish/dish.wxml
+50
-40
pages/bizz/eyesattr/eyesattr.js
pages/bizz/eyesattr/eyesattr.js
+65
-36
pages/bizz/eyesattr/eyesattr.wxml
pages/bizz/eyesattr/eyesattr.wxml
+18
-14
pages/bizz/facebeauty/facebeauty.js
pages/bizz/facebeauty/facebeauty.js
+67
-38
pages/bizz/facebeauty/facebeauty.wxml
pages/bizz/facebeauty/facebeauty.wxml
+10
-6
pages/bizz/facemerge/facemerge.js
pages/bizz/facemerge/facemerge.js
+30
-1
pages/bizz/facemerge/facemerge.wxml
pages/bizz/facemerge/facemerge.wxml
+6
-2
pages/bizz/faceorgans/faceorgans.js
pages/bizz/faceorgans/faceorgans.js
+74
-45
pages/bizz/faceorgans/faceorgans.wxml
pages/bizz/faceorgans/faceorgans.wxml
+14
-10
pages/bizz/facetransfer/facetransfer.js
pages/bizz/facetransfer/facetransfer.js
+33
-4
pages/bizz/facetransfer/facetransfer.wxml
pages/bizz/facetransfer/facetransfer.wxml
+7
-3
pages/bizz/facewrinkle/facewrinkle.js
pages/bizz/facewrinkle/facewrinkle.js
+67
-37
pages/bizz/facewrinkle/facewrinkle.wxml
pages/bizz/facewrinkle/facewrinkle.wxml
+13
-9
pages/bizz/flower/flower.js
pages/bizz/flower/flower.js
+65
-36
pages/bizz/flower/flower.wxml
pages/bizz/flower/flower.wxml
+12
-8
pages/bizz/garbage/garbage.js
pages/bizz/garbage/garbage.js
+65
-36
pages/bizz/garbage/garbage.wxml
pages/bizz/garbage/garbage.wxml
+8
-4
pages/bizz/idphoto/idphoto.js
pages/bizz/idphoto/idphoto.js
+30
-1
pages/bizz/idphoto/idphoto.wxml
pages/bizz/idphoto/idphoto.wxml
+6
-2
pages/bizz/ingredient/ingredient.js
pages/bizz/ingredient/ingredient.js
+66
-36
pages/bizz/ingredient/ingredient.wxml
pages/bizz/ingredient/ingredient.wxml
+12
-8
pages/bizz/landmark/landmark.js
pages/bizz/landmark/landmark.js
+66
-36
pages/bizz/landmark/landmark.wxml
pages/bizz/landmark/landmark.wxml
+12
-8
pages/bizz/logo/logo.js
pages/bizz/logo/logo.js
+65
-36
pages/bizz/logo/logo.wxml
pages/bizz/logo/logo.wxml
+12
-8
pages/bizz/palm/palm.js
pages/bizz/palm/palm.js
+71
-42
pages/bizz/palm/palm.wxml
pages/bizz/palm/palm.wxml
+7
-3
pages/bizz/plant/plant.js
pages/bizz/plant/plant.js
+66
-36
pages/bizz/plant/plant.wxml
pages/bizz/plant/plant.wxml
+12
-8
pages/bizz/redwine/redwine.js
pages/bizz/redwine/redwine.js
+65
-36
pages/bizz/redwine/redwine.wxml
pages/bizz/redwine/redwine.wxml
+6
-2
pages/bizz/skincolor/skincolor.js
pages/bizz/skincolor/skincolor.js
+66
-37
pages/bizz/skincolor/skincolor.wxml
pages/bizz/skincolor/skincolor.wxml
+13
-9
pages/bizz/skinsmooth/skinsmooth.js
pages/bizz/skinsmooth/skinsmooth.js
+66
-43
pages/bizz/skinsmooth/skinsmooth.wxml
pages/bizz/skinsmooth/skinsmooth.wxml
+12
-8
pages/bizz/watch/watch.js
pages/bizz/watch/watch.js
+66
-42
pages/bizz/watch/watch.wxml
pages/bizz/watch/watch.wxml
+7
-3
未找到文件。
pages/bizz/acnespotmole/acnespotmole.js
浏览文件 @
8c561906
...
...
@@ -33,6 +33,30 @@ Page({
wx
.
navigateTo
({
url
:
'
../logs/logs
'
})
},
//从聊天页面选择图片
chooseMessage
:
function
(){
var
that
=
this
;
wx
.
chooseMessageFile
({
count
:
1
,
sizeType
:
[
'
compressed
'
],
type
:
'
image
'
,
success
(
res
){
if
(
res
.
tempFiles
[
0
].
size
>
(
4096
*
1024
))
{
wx
.
showToast
({
title
:
'
图片文件过大哦
'
,
icon
:
'
none
'
,
mask
:
true
,
duration
:
1500
})
}
else
{
that
.
setData
({
img
:
res
.
tempFiles
[
0
].
path
})
that
.
generalDetect
(
res
.
tempFiles
[
0
].
path
);
}
}
})
},
//请求方法
uploads
:
function
()
{
...
...
@@ -60,55 +84,60 @@ Page({
duration
:
1500
})
}
else
{
wx
.
showLoading
({
title
:
"
识别中...
"
,
mask
:
true
}),
that
.
setData
({
img
:
res
.
tempFilePaths
[
0
]
})
that
.
generalDetect
(
res
.
tempFilePaths
[
0
]);
}
api
.
generalRequest
(
res
.
tempFilePaths
[
0
],
app
.
globalData
.
userId
,
api
.
faceAcnespotmole_url
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
img
:
'
data:image/jpg;base64,
'
+
resultJ
.
data
.
image_base64
,
acne_count
:
resultJ
.
data
.
acne_count
,
speckle_count
:
resultJ
.
data
.
speckle_count
,
mole_count
:
resultJ
.
data
.
mole_count
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
null
})
}
else
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
}
})
},
})
},
onLoad
:
function
()
{
},
//通用识别
generalDetect
(
file
){
var
that
=
this
;
wx
.
showLoading
({
title
:
"
斑痘痣检测中...
"
,
mask
:
true
}),
that
.
setData
({
img
:
file
})
api
.
generalRequest
(
file
,
app
.
globalData
.
userId
,
api
.
faceAcnespotmole_url
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
img
:
'
data:image/jpg;base64,
'
+
resultJ
.
data
.
image_base64
,
acne_count
:
resultJ
.
data
.
acne_count
,
speckle_count
:
resultJ
.
data
.
speckle_count
,
mole_count
:
resultJ
.
data
.
mole_count
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
null
})
}
else
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
}
})
},
/**
* 点击查看图片,可以进行保存
*/
* 点击查看图片,可以进行保存
*/
preview
(
e
)
{
var
that
=
this
;
if
(
null
==
that
.
data
.
img
||
that
.
data
.
img
==
''
)
{
...
...
@@ -125,4 +154,4 @@ Page({
})
}
}
});
\ No newline at end of file
});
pages/bizz/acnespotmole/acnespotmole.wxml
浏览文件 @
8c561906
<cu-custom bgColor="bg-gradual-blue" isBack="{{true}}">
<view slot="backText">返回</view>
<view slot="content">斑痘痣检测</view>
<view slot="backText">返回</view>
<view slot="content">斑痘痣检测</view>
</cu-custom>
<view class="page-body">
<view class="page-body-wrapper">
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片</button>
<view class="page-body-wrapper">
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片</button>
<!--从聊天中选择-->
<view class="text-center text-grey text-lg" style="text-decoration:underline;" bindtap="chooseMessage">
<view>从聊天中选择</view>
</view>
</view>
<!--检测结果-->
<view class="cu-bar bg-white margin-top">
<view class="action">
<text class="cuIcon-title text-blue"></text>
斑痘痣个数
</view>
</view>
<view class="padding-xs">
<view class="cu-tag" style="background-color:#0081ff;color:#fff" wx:if="{{acne_count!=-99}}">{{acne_count}} 个痘
</view>
<view class="cu-tag" style="background-color:#39b54a;color:#fff" wx:if="{{speckle_count!=-99}}">
{{speckle_count}} 个斑
</view>
<view class="cu-tag" style="background-color:#e54d42;color:#fff" wx:if="{{mole_count!=-99}}">{{mole_count}} 个痣
</view>
</view>
</view>
<!--检测结果-->
<view class="cu-bar bg-white margin-top">
<view class="action">
<text class="cuIcon-title text-blue"></text>斑痘痣个数
</view>
</view>
<view class="padding-xs">
<view class="cu-tag" style="background-color:#0081ff;color:#fff" wx:if="{{acne_count!=-99}}">{{acne_count}} 个痘</view>
<view class="cu-tag" style="background-color:#39b54a;color:#fff" wx:if="{{speckle_count!=-99}}">{{speckle_count}} 个斑</view>
<view class="cu-tag" style="background-color:#e54d42;color:#fff" wx:if="{{mole_count!=-99}}">{{mole_count}} 个痣</view>
</view>
</view>
<!--温馨提示-->
<view>
<!--温馨提示-->
<view>
<text class='reason_txt'>温馨提示</text>
<view class='reminder-content'>1.效果仅供参考 不提供真实性依据</view>
<view class='reminder-content'>2.蓝色痘、绿色斑、红色痣</view>
...
...
@@ -30,9 +39,9 @@
</view>
<!--浮动按钮跳转主页-->
<view class="round-click">
<navigator url='/pages/index/index' open-type="switchTab">
<image src="../../../images/tabbar/index_cur.png"></image>
</navigator
>
<navigator url='/pages/index/index' open-type="switchTab">
<image src="../../../images/tabbar/index_cur.png"></image>
</navigator
>
</view>
<!--给一个高度让内显示完整-->
<view class="cu-tabbar-height"></view>
pages/bizz/animal/animal.js
浏览文件 @
8c561906
...
...
@@ -8,13 +8,12 @@ Page({
resultData
:
null
,
cityId
:
'
110000
'
,
img
:
''
,
modalName
:
''
,
modalTitle
:
null
,
modalContent
:
null
modalName
:
''
,
modalTitle
:
null
,
modalContent
:
null
},
//用户点击右上角分享朋友圈
onShareTimeline
:
function
()
{
},
onShareTimeline
:
function
()
{},
//用户点击右上角分享朋友|朋友圈
onShareAppMessage
:
function
()
{
wx
.
showShareMenu
({
...
...
@@ -66,6 +65,30 @@ Page({
url
:
'
../logs/logs
'
})
},
//从聊天页面选择图片
chooseMessage
:
function
(){
var
that
=
this
;
wx
.
chooseMessageFile
({
count
:
1
,
sizeType
:
[
'
compressed
'
],
type
:
'
image
'
,
success
(
res
){
if
(
res
.
tempFiles
[
0
].
size
>
(
4096
*
1024
))
{
wx
.
showToast
({
title
:
'
图片文件过大哦
'
,
icon
:
'
none
'
,
mask
:
true
,
duration
:
1500
})
}
else
{
that
.
setData
({
img
:
res
.
tempFiles
[
0
].
path
})
that
.
animal
(
res
.
tempFiles
[
0
].
path
);
}
}
})
},
//请求方法
uploads
:
function
()
{
var
that
=
this
...
...
@@ -80,7 +103,7 @@ Page({
src
:
res
.
tempFilePaths
[
0
],
success
(
res
)
{
takephonewidth
=
res
.
width
,
takephoneheight
=
res
.
height
takephoneheight
=
res
.
height
}
})
// 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
...
...
@@ -92,52 +115,56 @@ Page({
duration
:
1500
})
}
else
{
wx
.
showLoading
({
title
:
"
识别中...
"
,
mask
:
true
}),
that
.
animal
(
res
.
tempFilePaths
[
0
]);
}
},
})
},
onLoad
:
function
()
{},
//动物识别
animal
(
file
)
{
var
that
=
this
wx
.
showLoading
({
title
:
"
动物识别中...
"
,
mask
:
true
}),
that
.
setData
({
img
:
file
})
api
.
icrRequest
(
file
,
app
.
globalData
.
userId
,
'
animal
'
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
resultData
:
resultJ
.
result
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
res
.
tempFilePaths
[
0
]
img
:
null
})
}
api
.
icrRequest
(
res
.
tempFilePaths
[
0
],
app
.
globalData
.
userId
,
'
animal
'
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
}
else
{
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
resultData
:
resultJ
.
result
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
null
})
}
else
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
)
}
,
}
}
})
},
onLoad
:
function
()
{
},
/**
* 点击查看图片,可以进行保存
*/
* 点击查看图片,可以进行保存
*/
preview
(
e
)
{
var
that
=
this
;
wx
.
previewImage
({
...
...
pages/bizz/animal/animal.wxml
浏览文件 @
8c561906
<cu-custom bgColor="bg-gradual-blue" isBack="{{true}}">
<view slot="backText">返回</view>
<view slot="content">动物识别</view>
<view slot="backText">返回</view>
<view slot="content">动物识别</view>
</cu-custom>
<view class="page-body">
<view class="page-body-wrapper">
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片识别</button>
</view>
<view class="page-body-wrapper">
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片</button>
<!--从聊天中选择-->
<view class="text-center text-grey text-lg" style="text-decoration:underline;" bindtap="chooseMessage">
<view>从聊天中选择</view>
</view>
</view>
</view>
<!--查询详情-->
<block wx:if="{{resultData}}">
<view class="cu-bar bg-white solid-bottom margin-top">
<view class="action">
<text class="cuIcon-title text-xsblue "></text> 动物识别结果
</view>
</view>
<!--动物识别列表-->
<view class="cu-list menu-avatar">
<block wx:for="{{resultData}}">
<view class="cu-item">
<block wx:if="{{item.baike_info.image_url}}">
<view class="cu-avatar lg" style="background-image:url({{item.baike_info.image_url}});"></view>
</block>
<block wx:else>
<view class="cu-avatar lg" style="background-image:url(https://wximage-1251091977.cos.ap-beijing.myqcloud.com/xai/error.png);"></view>
</block>
<view class="content">
<view class="text-black">{{item.name}}</view>
<view class="text-gray text-sm flex">
<text>
<text class="margin-right-xs"></text>可信度{{item.score}}%
</text>
<view class="cu-bar bg-white solid-bottom margin-top">
<view class="action">
<text class="cuIcon-title text-xsblue "></text>
动物识别结果
</view>
</view>
<view class="action">
<view class="cu-tag round bg-xsblue lg" bindtap="showDetail" data-name="{{item.name}}" data-description="{{item.baike_info.description}}">介绍</view>
</view>
</view>
</block>
</view>
<!--动物识别列表-->
<view class="cu-list menu-avatar">
<block wx:for="{{resultData}}">
<view class="cu-item">
<block wx:if="{{item.baike_info.image_url}}">
<view class="cu-avatar lg" style="background-image:url({{item.baike_info.image_url}});"></view>
</block>
<block wx:else>
<view class="cu-avatar lg"
style="background-image:url(https://wximage-1251091977.cos.ap-beijing.myqcloud.com/xai/error.png);"></view>
</block>
<view class="content">
<view class="text-black">{{item.name}}</view>
<view class="text-gray text-sm flex">
<text>
<text class="margin-right-xs"></text>
可信度{{item.score}}%
</text>
</view>
</view>
<view class="action">
<view class="cu-tag round bg-xsblue lg" bindtap="showDetail" data-name="{{item.name}}"
data-description="{{item.baike_info.description}}">介绍
</view>
</view>
</view>
</block>
</view>
</block>
<!--温馨提示-->
<view>
<!--温馨提示-->
<view>
<text class='reason_txt'>温馨提示</text>
<view class='reminder-content'>1.上传图片最好包含动物正面</view>
<view class='reminder-content'>2.点击介绍可查看百科信息</view>
...
...
@@ -51,9 +60,9 @@
</view>
<!--浮动按钮跳转主页-->
<view class="round-click">
<navigator url='/pages/index/index' open-type="switchTab">
<image src="../../../images/tabbar/index_cur.png"></image>
</navigator
>
<navigator url='/pages/index/index' open-type="switchTab">
<image src="../../../images/tabbar/index_cur.png"></image>
</navigator
>
</view>
<!--给一个高度让内显示完整-->
<view class="cu-tabbar-height"></view>
pages/bizz/ascii/ascii.js
浏览文件 @
8c561906
...
...
@@ -33,6 +33,30 @@ Page({
wx
.
navigateTo
({
url
:
'
../logs/logs
'
})
},
//从聊天页面选择图片
chooseMessage
:
function
(){
var
that
=
this
;
wx
.
chooseMessageFile
({
count
:
1
,
sizeType
:
[
'
compressed
'
],
type
:
'
image
'
,
success
(
res
){
if
(
res
.
tempFiles
[
0
].
size
>
(
4096
*
1024
))
{
wx
.
showToast
({
title
:
'
图片文件过大哦
'
,
icon
:
'
none
'
,
mask
:
true
,
duration
:
1500
})
}
else
{
that
.
setData
({
img
:
res
.
tempFiles
[
0
].
path
})
that
.
generalDetect
(
res
.
tempFiles
[
0
].
path
);
}
}
})
},
//请求方法
uploads
:
function
()
{
...
...
@@ -60,49 +84,54 @@ Page({
duration
:
1500
})
}
else
{
wx
.
showLoading
({
title
:
"
转换中...
"
,
mask
:
true
}),
that
.
setData
({
img
:
res
.
tempFilePaths
[
0
]
})
that
.
generalDetect
(
res
.
tempFilePaths
[
0
]);
}
api
.
generalRequest
(
res
.
tempFilePaths
[
0
],
app
.
globalData
.
userId
,
api
.
ascii_url
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
img
:
'
data:image/jpg;base64,
'
+
resultJ
.
image
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
null
})
}
else
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
}
})
},
})
},
onLoad
:
function
()
{
},
//通用识别
generalDetect
(
file
){
var
that
=
this
;
that
.
setData
({
img
:
file
})
wx
.
showLoading
({
title
:
"
转换中...
"
,
mask
:
true
}),
api
.
generalRequest
(
file
,
app
.
globalData
.
userId
,
api
.
ascii_url
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
img
:
'
data:image/jpg;base64,
'
+
resultJ
.
image
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
null
})
}
else
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
}
})
},
/**
* 点击查看图片,可以进行保存
*/
...
...
@@ -122,4 +151,4 @@ Page({
})
}
}
});
\ No newline at end of file
});
pages/bizz/ascii/ascii.wxml
浏览文件 @
8c561906
<cu-custom bgColor="bg-gradual-blue" isBack="{{true}}">
<view slot="backText">返回</view>
<view slot="content">图片转字符画</view>
<view slot="backText">返回</view>
<view slot="content">图片转字符画</view>
</cu-custom>
<view class="page-body">
<view class="page-body-wrapper">
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片</button>
<view class="page-body-wrapper">
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片</button>
<!--从聊天中选择-->
<view class="text-center text-grey text-lg" style="text-decoration:underline;" bindtap="chooseMessage">
<view>从聊天中选择</view>
</view>
</view>
</view>
</view>
<!--温馨提示-->
<view>
<!--温馨提示-->
<view>
<text class='reason_txt'>温馨提示</text>
<view class='reminder-content'>效果仅供娱乐</view>
</view>
<!--浮动按钮跳转主页-->
<view class="round-click">
<navigator url='/pages/index/index' open-type="switchTab">
<image src="../../../images/tabbar/index_cur.png"></image>
</navigator
>
<navigator url='/pages/index/index' open-type="switchTab">
<image src="../../../images/tabbar/index_cur.png"></image>
</navigator
>
</view>
<!--给一个高度让内显示完整-->
<view class="cu-tabbar-height"></view>
\ No newline at end of file
<view class="cu-tabbar-height"></view>
pages/bizz/car/car.js
浏览文件 @
8c561906
...
...
@@ -56,6 +56,30 @@ Page({
wx
.
navigateTo
({
url
:
'
../logs/logs
'
})
},
//从聊天页面选择图片
chooseMessage
:
function
(){
var
that
=
this
;
wx
.
chooseMessageFile
({
count
:
1
,
sizeType
:
[
'
compressed
'
],
type
:
'
image
'
,
success
(
res
){
if
(
res
.
tempFiles
[
0
].
size
>
(
4096
*
1024
))
{
wx
.
showToast
({
title
:
'
图片文件过大哦
'
,
icon
:
'
none
'
,
mask
:
true
,
duration
:
1500
})
}
else
{
that
.
setData
({
img
:
res
.
tempFiles
[
0
].
path
})
that
.
icrDetect
(
res
.
tempFiles
[
0
].
path
);
}
}
})
},
//请求方法
uploads
:
function
()
{
...
...
@@ -83,50 +107,56 @@ Page({
duration
:
1500
})
}
else
{
wx
.
showLoading
({
title
:
"
识别中...
"
,
mask
:
true
}),
that
.
setData
({
img
:
res
.
tempFilePaths
[
0
]
})
that
.
icrDetect
(
res
.
tempFilePaths
[
0
]);
}
api
.
icrRequest
(
res
.
tempFilePaths
[
0
],
app
.
globalData
.
userId
,
'
car
'
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
resultData
:
resultJ
,
img
:
'
data:image/jpg;base64,
'
+
resultJ
.
deal_base64
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
null
})
}
else
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
}
})
},
})
},
onLoad
:
function
()
{
},
//车型识别
icrDetect
(
file
){
var
that
=
this
;
that
.
setData
({
img
:
file
})
wx
.
showLoading
({
title
:
"
车型识别中...
"
,
mask
:
true
}),
api
.
icrRequest
(
file
,
app
.
globalData
.
userId
,
'
car
'
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
resultData
:
resultJ
,
img
:
'
data:image/jpg;base64,
'
+
resultJ
.
deal_base64
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
null
})
}
else
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
}
})
},
/**
* 点击查看图片,可以进行保存
*/
...
...
@@ -137,4 +167,4 @@ Page({
current
:
that
.
data
.
img
})
}
});
\ No newline at end of file
});
pages/bizz/car/car.wxml
浏览文件 @
8c561906
<cu-custom bgColor="bg-gradual-blue" isBack="{{true}}">
<view slot="backText">返回</view>
<view slot="content">车型识别</view>
<view slot="backText">返回</view>
<view slot="content">车型识别</view>
</cu-custom>
<view class="page-body">
<view class="page-body-wrapper">
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片识别</button>
</view>
<view class="page-body-wrapper">
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片</button>
<!--从聊天中选择-->
<view class="text-center text-grey text-lg" style="text-decoration:underline;" bindtap="chooseMessage">
<view>从聊天中选择</view>
</view>
</view>
</view>
<!--查询详情-->
<block wx:if="{{resultData}}">
<view class="cu-bar bg-white solid-bottom margin-top">
<view class="action">
<text class="cuIcon-title text-xsblue "></text> 车型识别结果 颜色:{{resultData.color_result}}
</view>
</view>
<!--车型识别列表-->
<view class="cu-list menu-avatar">
<block wx:for="{{resultData.result}}">
<view class="cu-item">
<block wx:if="{{item.baike_info.image_url}}">
<view class="cu-avatar lg" style="background-image:url({{item.baike_info.image_url}});"></view>
</block>
<block wx:else>
<view class="cu-avatar lg" style="background-image:url(https://wximage-1251091977.cos.ap-beijing.myqcloud.com/xai/error.png);"></view>
</block>
<view class="content">
<view class="text-black">{{item.name}} 年份:{{item.year}}</view>
<view class="text-gray text-sm flex">
<text>
<text class="margin-right-xs"></text>可信度{{item.score}}%
</text>
<view class="cu-bar bg-white solid-bottom margin-top">
<view class="action">
<text class="cuIcon-title text-xsblue "></text>
车型识别结果 颜色:{{resultData.color_result}}
</view>
</view>
<view class="action">
<view class="cu-tag round bg-xsblue lg" bindtap="showDetail" data-name="{{item.name}}" data-description="{{item.baike_info.description}}">介绍</view>
</view>
</view>
</block>
</view>
<!--车型识别列表-->
<view class="cu-list menu-avatar">
<block wx:for="{{resultData.result}}">
<view class="cu-item">
<block wx:if="{{item.baike_info.image_url}}">
<view class="cu-avatar lg" style="background-image:url({{item.baike_info.image_url}});"></view>
</block>
<block wx:else>
<view class="cu-avatar lg"
style="background-image:url(https://wximage-1251091977.cos.ap-beijing.myqcloud.com/xai/error.png);"></view>
</block>
<view class="content">
<view class="text-black">{{item.name}} 年份:{{item.year}}</view>
<view class="text-gray text-sm flex">
<text>
<text class="margin-right-xs"></text>
可信度{{item.score}}%
</text>
</view>
</view>
<view class="action">
<view class="cu-tag round bg-xsblue lg" bindtap="showDetail" data-name="{{item.name}}"
data-description="{{item.baike_info.description}}">介绍
</view>
</view>
</view>
</block>
</view>
</block>
<!--温馨提示-->
<view>
<!--温馨提示-->
<view>
<text class='reason_txt'>温馨提示</text>
<view class='reminder-content'>1.上传图片最好包含车辆</view>
<view class='reminder-content'>2.点击介绍可查看百科信息</view>
...
...
@@ -51,9 +60,9 @@
</view>
<!--浮动按钮跳转主页-->
<view class="round-click">
<navigator url='/pages/index/index' open-type="switchTab">
<image src="../../../images/tabbar/index_cur.png"></image>
</navigator
>
<navigator url='/pages/index/index' open-type="switchTab">
<image src="../../../images/tabbar/index_cur.png"></image>
</navigator
>
</view>
<!--给一个高度让内显示完整-->
<view class="cu-tabbar-height"></view>
pages/bizz/clothing/clothing.js
浏览文件 @
8c561906
...
...
@@ -23,6 +23,30 @@ Page({
path
:
'
/pages/bizz/clothing/clothing
'
}
},
//从聊天页面选择图片
chooseMessage
:
function
(){
var
that
=
this
;
wx
.
chooseMessageFile
({
count
:
1
,
sizeType
:
[
'
compressed
'
],
type
:
'
image
'
,
success
(
res
){
if
(
res
.
tempFiles
[
0
].
size
>
(
4096
*
1024
))
{
wx
.
showToast
({
title
:
'
图片文件过大哦
'
,
icon
:
'
none
'
,
mask
:
true
,
duration
:
1500
})
}
else
{
that
.
setData
({
img
:
res
.
tempFiles
[
0
].
path
})
that
.
generalDetect
(
res
.
tempFiles
[
0
].
path
);
}
}
})
},
//请求方法
uploads
:
function
()
{
var
that
=
this
...
...
@@ -49,58 +73,8 @@ Page({
duration
:
150088888
})
}
else
{
wx
.
showLoading
({
title
:
"
分析中...
"
,
mask
:
true
}),
that
.
setData
({
img
:
res
.
tempFilePaths
[
0
]
})
that
.
generalDetect
(
res
.
tempFilePaths
[
0
]);
}
api
.
generalRequest
(
res
.
tempFilePaths
[
0
],
app
.
globalData
.
userId
,
api
.
clothing_url
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
clothing
:
resultJ
.
data
.
outfits
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
null
})
}
else
if
(
resultJ
.
code
==
10006
){
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
找不到合适的搭配
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
else
if
(
resultJ
.
code
==
10007
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
找不到合适的搭配
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
else
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
}
})
},
})
},
...
...
@@ -110,6 +84,61 @@ Page({
onLoad
:
function
(
options
)
{
},
//通用识别
generalDetect
(
file
){
var
that
=
this
;
that
.
setData
({
img
:
file
})
wx
.
showLoading
({
title
:
"
搭配分析中...
"
,
mask
:
true
}),
api
.
generalRequest
(
file
,
app
.
globalData
.
userId
,
api
.
clothing_url
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
clothing
:
resultJ
.
data
.
outfits
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
null
})
}
else
if
(
resultJ
.
code
==
10006
){
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
找不到合适的搭配
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
else
if
(
resultJ
.
code
==
10007
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
找不到合适的搭配
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
else
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
...
...
@@ -201,4 +230,4 @@ Page({
})
}
}
})
\ No newline at end of file
})
pages/bizz/clothing/clothing.wxml
浏览文件 @
8c561906
<cu-custom bgColor="bg-gradual-blue" isBack="{{true}}">
<view slot="backText">返回</view>
<view slot="content">穿衣搭配</view>
<view slot="backText">返回</view>
<view slot="content">穿衣搭配</view>
</cu-custom>
<view class="page-body">
<view class="page-body-wrapper">
<image src="{{ img }}" style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片</button>
</view>
<view class="page-body-wrapper">
<image src="{{ img }}" style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片</button>
<!--从聊天中选择-->
<view class="text-center text-grey text-lg" style="text-decoration:underline;" bindtap="chooseMessage">
<view>从聊天中选择</view>
</view>
</view>
</view>
<!--穿衣搭配-->
<!--穿衣搭配-->
<block wx:if="{{clothing}}" wx:for="{{clothing}}" wx:key="{{index}}" wx:for-item="item">
<view class="cu-bar bg-white margin-top solid-bottom">
<view class="action">
<text class="cuIcon-title text-xsblue"></text> 第{{index+1}}套--搭配分数:{{item.score}}
</view>
</view>
<view class="cu-list grid col-2 no-border">
<block wx:for="{{item.items}}" wx:key='index' wx:for-item="itemData">
<view class="cu-item">
<image src="{{itemData.image_url}}" class="productImg" mode="aspectFill"></image>
<text class="text-sm">{{itemData.item_name}}</text>
<view class="cu-bar bg-white margin-top solid-bottom">
<view class="action">
<text class="cuIcon-title text-xsblue"></text>
第{{index+1}}套--搭配分数:{{item.score}}
</view>
</view>
<view class="cu-list grid col-2 no-border">
<block wx:for="{{item.items}}" wx:key='index' wx:for-item="itemData">
<view class="cu-item">
<image src="{{itemData.image_url}}" class="productImg" mode="aspectFill"></image>
<text class="text-sm">{{itemData.item_name}}</text>
</view>
</block>
</view>
</block>
</view>
</block>
<!--温馨提示-->
<view>
</block>
<!--温馨提示-->
<view>
<text class='reason_txt'>温馨提示</text>
<view class='reminder-content'>1.上传图片中最好包含服装</view>
<view class='reminder-content'>2.结果仅供参考,默认最大10套搭配推荐</view>
</view>
<!--浮动按钮跳转主页-->
<view class="round-click">
<navigator url='/pages/index/index' open-type="switchTab">
<image src="../../../images/tabbar/index_cur.png"></image>
</navigator
>
<navigator url='/pages/index/index' open-type="switchTab">
<image src="../../../images/tabbar/index_cur.png"></image>
</navigator
>
</view>
<!--给一个高度让内显示完整-->
<view class="cu-tabbar-height"></view>
pages/bizz/color/color.js
浏览文件 @
8c561906
...
...
@@ -28,6 +28,30 @@ Page({
*/
onLoad
:
function
(
options
)
{
},
//从聊天页面选择图片
chooseMessage
:
function
(){
var
that
=
this
;
wx
.
chooseMessageFile
({
count
:
1
,
sizeType
:
[
'
compressed
'
],
type
:
'
image
'
,
success
(
res
){
if
(
res
.
tempFiles
[
0
].
size
>
(
4096
*
1024
))
{
wx
.
showToast
({
title
:
'
图片文件过大哦
'
,
icon
:
'
none
'
,
mask
:
true
,
duration
:
1500
})
}
else
{
that
.
setData
({
img
:
res
.
tempFiles
[
0
].
path
})
that
.
generalDetect
(
res
.
tempFiles
[
0
].
path
);
}
}
})
},
//请求方法
uploads
:
function
()
{
...
...
@@ -55,45 +79,50 @@ Page({
duration
:
1500
})
}
else
{
wx
.
showLoading
({
title
:
"
分析中...
"
,
mask
:
true
}),
that
.
generalDetect
(
res
.
tempFilePaths
[
0
]);
}
},
})
},
//通用识别
generalDetect
(
file
){
var
that
=
this
;
that
.
setData
({
img
:
file
})
wx
.
showLoading
({
title
:
"
颜色识别中...
"
,
mask
:
true
}),
api
.
generalRequest
(
file
,
app
.
globalData
.
userId
,
api
.
color_url
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
colors
:
resultJ
.
data
.
color_list
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
res
.
tempFilePaths
[
0
]
img
:
null
})
}
api
.
generalRequest
(
res
.
tempFilePaths
[
0
],
app
.
globalData
.
userId
,
api
.
color_url
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
}
else
{
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
colors
:
resultJ
.
data
.
color_list
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
null
})
}
else
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
)
}
,
}
}
})
},
/**
...
...
@@ -164,4 +193,4 @@ Page({
}
})
}
})
\ No newline at end of file
})
pages/bizz/color/color.wxml
浏览文件 @
8c561906
<cu-custom bgColor="bg-gradual-blue" isBack="{{true}}">
<view slot="backText">返回</view>
<view slot="content">颜色识别</view>
<view slot="backText">返回</view>
<view slot="content">颜色识别</view>
</cu-custom>
<view class="page-body">
<view class="page-body-wrapper">
<image src="{{ img }}" style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片</button>
</view>
<view class="page-body-wrapper">
<image src="{{ img }}" style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片</button>
<!--从聊天中选择-->
<view class="text-center text-grey text-lg" style="text-decoration:underline;" bindtap="chooseMessage">
<view>从聊天中选择</view>
</view>
</view>
</view>
<block wx:if="{{colors}}">
<view class="cu-bar bg-white solid-bottom">
<view class="action">
<text class="cuIcon-title text-blue"></text>颜色识别结果
</view>
</view>
<view class="grid col-3 padding-sm">
<view class="padding-sm" wx:for="{{colors}}" wx:key>
<view class="padding radius text-center shadow-blur" bindtap="copyText" style="background-color:{{item.hex}}" data-rgb="{{item.rgb}}" data-hex="{{item.hex}}"></view>
<view class="text-sm padding-top-sm">HEX:{{item.hex}}</view>
<view class="text-sm">RGB:{{item.rgb}}</view>
<view class="text-sm">颜色占比:{{item.percentage}}</view>
</view>
</view>
<view class="cu-bar bg-white solid-bottom">
<view class="action">
<text class="cuIcon-title text-blue"></text>颜色识别结果
</view>
</view>
<view class="grid col-3 padding-sm">
<view class="padding-sm" wx:for="{{colors}}" wx:key>
<view class="padding radius text-center shadow-blur" bindtap="copyText"
style="background-color:{{item.hex}}" data-rgb="{{item.rgb}}" data-hex="{{item.hex}}"></view>
<view class="text-sm padding-top-sm">HEX:{{item.hex}}</view>
<view class="text-sm">RGB:{{item.rgb}}</view>
<view class="text-sm">颜色占比:{{item.percentage}}</view>
</view>
</view>
</block>
<!--温馨提示-->
<view>
<!--温馨提示-->
<view>
<text class='reason_txt'>温馨提示</text>
<view class='reminder-content'>1.颜色结果仅供参考</view>
<view class='reminder-content'>2.点击颜色块可复制RGB、HEX</view>
</view>
<!--浮动按钮跳转主页-->
<view class="round-click">
<navigator url='/pages/index/index' open-type="switchTab">
<image src="../../../images/tabbar/index_cur.png"></image>
</navigator
>
<navigator url='/pages/index/index' open-type="switchTab">
<image src="../../../images/tabbar/index_cur.png"></image>
</navigator
>
</view>
<!--给一个高度让内显示完整-->
<view class="cu-tabbar-height"></view>
pages/bizz/colourize/colourize.js
浏览文件 @
8c561906
...
...
@@ -33,6 +33,30 @@ Page({
wx
.
navigateTo
({
url
:
'
../logs/logs
'
})
},
//从聊天页面选择图片
chooseMessage
:
function
(){
var
that
=
this
;
wx
.
chooseMessageFile
({
count
:
1
,
sizeType
:
[
'
compressed
'
],
type
:
'
image
'
,
success
(
res
){
if
(
res
.
tempFiles
[
0
].
size
>
(
4096
*
1024
))
{
wx
.
showToast
({
title
:
'
图片文件过大哦
'
,
icon
:
'
none
'
,
mask
:
true
,
duration
:
1500
})
}
else
{
that
.
setData
({
img
:
res
.
tempFiles
[
0
].
path
})
that
.
icrDetect
(
res
.
tempFiles
[
0
].
path
);
}
}
})
},
//请求方法
uploads
:
function
()
{
...
...
@@ -60,45 +84,51 @@ Page({
duration
:
1500
})
}
else
{
wx
.
showLoading
({
title
:
"
上色中...
"
,
mask
:
true
}),
that
.
icrDetect
(
res
.
tempFilePaths
[
0
]);
}
},
})
},
//黑白图上色
icrDetect
(
file
){
var
that
=
this
;
that
.
setData
({
img
:
file
}),
wx
.
showLoading
({
title
:
"
上色中...
"
,
mask
:
true
}),
api
.
icrHandleRequest
(
file
,
app
.
globalData
.
userId
,
'
colourize
'
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
img
:
'
data:image/jpg;base64,
'
+
resultJ
.
deal_base64
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
res
.
tempFilePaths
[
0
]
img
:
null
})
}
api
.
icrHandleRequest
(
res
.
tempFilePaths
[
0
],
app
.
globalData
.
userId
,
'
colourize
'
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
}
else
{
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
img
:
'
data:image/jpg;base64,
'
+
resultJ
.
deal_base64
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
null
})
}
else
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
)
}
,
}
}
})
},
onLoad
:
function
()
{
...
...
@@ -122,4 +152,4 @@ Page({
})
}
}
});
\ No newline at end of file
});
pages/bizz/colourize/colourize.wxml
浏览文件 @
8c561906
<cu-custom bgColor="bg-gradual-blue" isBack="{{true}}">
<view slot="backText">返回</view>
<view slot="content">黑白图上色</view>
<view slot="backText">返回</view>
<view slot="content">黑白图上色</view>
</cu-custom>
<view class="page-body">
<view class="page-body-wrapper">
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片</button>
<view class="page-body-wrapper">
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片</button>
<!--从聊天中选择-->
<view class="text-center text-grey text-lg" style="text-decoration:underline;" bindtap="chooseMessage">
<view>从聊天中选择</view>
</view>
</view>
</view>
</view>
<!--温馨提示-->
<view>
<!--温馨提示-->
<view>
<text class='reason_txt'>温馨提示</text>
<view class='reminder-content'>1.上传图片最好为黑白色调,长宽比3:1以内</view>
<view class='reminder-content'>2.上色效果仅供参考</view>
</view>
<!--浮动按钮跳转主页-->
<view class="round-click">
<navigator url='/pages/index/index' open-type="switchTab">
<image src="../../../images/tabbar/index_cur.png"></image>
</navigator
>
<navigator url='/pages/index/index' open-type="switchTab">
<image src="../../../images/tabbar/index_cur.png"></image>
</navigator
>
</view>
<!--给一个高度让内显示完整-->
<view class="cu-tabbar-height"></view>
pages/bizz/currency/currency.js
浏览文件 @
8c561906
...
...
@@ -33,6 +33,30 @@ Page({
wx
.
navigateTo
({
url
:
'
../logs/logs
'
})
},
//从聊天页面选择图片
chooseMessage
:
function
(){
var
that
=
this
;
wx
.
chooseMessageFile
({
count
:
1
,
sizeType
:
[
'
compressed
'
],
type
:
'
image
'
,
success
(
res
){
if
(
res
.
tempFiles
[
0
].
size
>
(
4096
*
1024
))
{
wx
.
showToast
({
title
:
'
图片文件过大哦
'
,
icon
:
'
none
'
,
mask
:
true
,
duration
:
1500
})
}
else
{
that
.
setData
({
img
:
res
.
tempFiles
[
0
].
path
})
that
.
icrDetect
(
res
.
tempFiles
[
0
].
path
);
}
}
})
},
//请求方法
uploads
:
function
()
{
...
...
@@ -60,46 +84,53 @@ Page({
duration
:
1500
})
}
else
{
wx
.
showLoading
({
title
:
"
识别中...
"
,
mask
:
true
}),
that
.
icrDetect
(
res
.
tempFilePaths
[
0
]);
}
},
})
},
//货币识别
icrDetect
(
file
){
var
that
=
this
;
that
.
setData
({
img
:
file
}),
wx
.
showLoading
({
title
:
"
货币识别中...
"
,
mask
:
true
}),
api
.
icrRequest
(
file
,
app
.
globalData
.
userId
,
'
currency
'
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
resultData
:
resultJ
.
data
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
res
.
tempFilePaths
[
0
]
img
:
null
})
}
api
.
icrRequest
(
res
.
tempFilePaths
[
0
],
app
.
globalData
.
userId
,
'
currency
'
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
}
else
{
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
resultData
:
resultJ
.
data
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
null
})
}
else
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
)
}
,
}
}
})
},
onLoad
:
function
()
{
},
...
...
@@ -122,4 +153,4 @@ Page({
})
}
}
});
\ No newline at end of file
});
pages/bizz/currency/currency.wxml
浏览文件 @
8c561906
<cu-custom bgColor="bg-gradual-blue" isBack="{{true}}">
<view slot="backText">返回</view>
<view slot="content">货币识别</view>
<view slot="backText">返回</view>
<view slot="content">货币识别</view>
</cu-custom>
<view class="page-body">
<view class="page-body-wrapper">
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片识别</button>
</view>
<view class="page-body-wrapper">
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片</button>
<!--从聊天中选择-->
<view class="text-center text-grey text-lg" style="text-decoration:underline;" bindtap="chooseMessage">
<view>从聊天中选择</view>
</view>
</view>
</view>
<!--货币名称-->
<block wx:if="{{resultData.currencyName}}">
<view class="cu-bar bg-white margin-top">
<view class="action">
<text class="cuIcon-title text-blue"></text>货币名称
</view>
</view>
<view class="padding-sm flex flex-wrap">
<view class="padding-xs">
<view class="text-lg" style="word-break:break-all;display:block;white-space:pre-wrap;">{{resultData.currencyName}}</view>
</view>
</view>
<view class="cu-bar bg-white margin-top">
<view class="action">
<text class="cuIcon-title text-blue"></text>
货币名称
</view>
</view>
<view class="padding-sm flex flex-wrap">
<view class="padding-xs">
<view class="text-lg" style="word-break:break-all;display:block;white-space:pre-wrap;">
{{resultData.currencyName}}
</view>
</view>
</view>
</block>
<!--货币代码-->
<block wx:if="{{resultData.currencyCode}}">
<view class="cu-bar bg-white margin-top">
<view class="action">
<text class="cuIcon-title text-blue"></text>货币代码
</view>
</view>
<view class="padding-sm flex flex-wrap">
<view class="padding-xs">
<view class="text-lg" style="word-break:break-all;display:block;white-space:pre-wrap;">{{resultData.currencyCode}}</view>
</view>
</view>
<view class="cu-bar bg-white margin-top">
<view class="action">
<text class="cuIcon-title text-blue"></text>
货币代码
</view>
</view>
<view class="padding-sm flex flex-wrap">
<view class="padding-xs">
<view class="text-lg" style="word-break:break-all;display:block;white-space:pre-wrap;">
{{resultData.currencyCode}}
</view>
</view>
</view>
</block>
<!--货币面值-->
<block wx:if="{{resultData.currencyDenomination}}">
<view class="cu-bar bg-white margin-top">
<view class="action">
<text class="cuIcon-title text-blue"></text>货币面值
</view>
</view>
<view class="padding-sm flex flex-wrap">
<view class="padding-xs">
<view class="text-lg" style="word-break:break-all;display:block;white-space:pre-wrap;">{{resultData.currencyDenomination}}</view>
</view>
</view>
<view class="cu-bar bg-white margin-top">
<view class="action">
<text class="cuIcon-title text-blue"></text>
货币面值
</view>
</view>
<view class="padding-sm flex flex-wrap">
<view class="padding-xs">
<view class="text-lg" style="word-break:break-all;display:block;white-space:pre-wrap;">
{{resultData.currencyDenomination}}
</view>
</view>
</view>
</block>
<!--货币年份-->
<block wx:if="{{resultData.year}}">
<view class="cu-bar bg-white margin-top">
<view class="action">
<text class="cuIcon-title text-blue"></text>货币年份
</view>
</view>
<view class="padding-sm flex flex-wrap">
<view class="padding-xs">
<view class="text-lg" style="word-break:break-all;display:block;white-space:pre-wrap;">{{resultData.year}}</view>
</view>
</view>
<view class="cu-bar bg-white margin-top">
<view class="action">
<text class="cuIcon-title text-blue"></text>
货币年份
</view>
</view>
<view class="padding-sm flex flex-wrap">
<view class="padding-xs">
<view class="text-lg" style="word-break:break-all;display:block;white-space:pre-wrap;">{{resultData.year}}
</view>
</view>
</view>
</block>
<!--温馨提示-->
<view>
<!--温馨提示-->
<view>
<text class='reason_txt'>温馨提示</text>
<view class='reminder-content'>1.上传图片最好包含钱币</view>
<view class='reminder-content'>2.可识别百余种国内外常见货币</view>
</view>
<!--浮动按钮跳转主页-->
<view class="round-click">
<navigator url='/pages/index/index' open-type="switchTab">
<image src="../../../images/tabbar/index_cur.png"></image>
</navigator
>
<navigator url='/pages/index/index' open-type="switchTab">
<image src="../../../images/tabbar/index_cur.png"></image>
</navigator
>
</view>
<!--给一个高度让内显示完整-->
<view class="cu-tabbar-height"></view>
pages/bizz/dish/dish.js
浏览文件 @
8c561906
...
...
@@ -64,6 +64,30 @@ Page({
wx
.
navigateTo
({
url
:
'
../logs/logs
'
})
},
//从聊天页面选择图片
chooseMessage
:
function
(){
var
that
=
this
;
wx
.
chooseMessageFile
({
count
:
1
,
sizeType
:
[
'
compressed
'
],
type
:
'
image
'
,
success
(
res
){
if
(
res
.
tempFiles
[
0
].
size
>
(
4096
*
1024
))
{
wx
.
showToast
({
title
:
'
图片文件过大哦
'
,
icon
:
'
none
'
,
mask
:
true
,
duration
:
1500
})
}
else
{
that
.
setData
({
img
:
res
.
tempFiles
[
0
].
path
})
that
.
icrDetect
(
res
.
tempFiles
[
0
].
path
);
}
}
})
},
//请求方法
uploads
:
function
()
{
...
...
@@ -91,45 +115,50 @@ Page({
duration
:
1500
})
}
else
{
wx
.
showLoading
({
title
:
"
识别中...
"
,
mask
:
true
}),
that
.
icrDetect
(
res
.
tempFilePaths
[
0
]);
}
},
})
},
//菜品识别
icrDetect
(
file
){
var
that
=
this
;
that
.
setData
({
img
:
file
}),
wx
.
showLoading
({
title
:
"
菜品识别中...
"
,
mask
:
true
}),
api
.
icrRequest
(
file
,
app
.
globalData
.
userId
,
'
dish
'
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
resultData
:
resultJ
.
result
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
res
.
tempFilePaths
[
0
]
img
:
null
})
}
api
.
icrRequest
(
res
.
tempFilePaths
[
0
],
app
.
globalData
.
userId
,
'
dish
'
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
}
else
{
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
resultData
:
resultJ
.
result
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
null
})
}
else
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
)
}
,
}
}
})
},
onLoad
:
function
()
{
...
...
@@ -144,4 +173,4 @@ Page({
current
:
that
.
data
.
img
})
}
});
\ No newline at end of file
});
pages/bizz/dish/dish.wxml
浏览文件 @
8c561906
<cu-custom bgColor="bg-gradual-blue" isBack="{{true}}">
<view slot="backText">返回</view>
<view slot="content">菜品识别</view>
<view slot="backText">返回</view>
<view slot="content">菜品识别</view>
</cu-custom>
<view class="page-body">
<view class="page-body-wrapper">
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片识别</button>
</view>
<view class="page-body-wrapper">
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片</button>
<!--从聊天中选择-->
<view class="text-center text-grey text-lg" style="text-decoration:underline;" bindtap="chooseMessage">
<view>从聊天中选择</view>
</view>
</view>
</view>
<!--查询详情-->
<block wx:if="{{resultData}}">
<view class="cu-bar bg-white solid-bottom margin-top">
<view class="action">
<text class="cuIcon-title text-xsblue "></text>菜品识别结果
</view>
</view>
<!--菜品识别列表-->
<view class="cu-list menu-avatar">
<block wx:for="{{resultData}}">
<view class="cu-item">
<block wx:if="{{item.baike_info.image_url}}">
<view class="cu-avatar lg" style="background-image:url({{item.baike_info.image_url}});"></view>
</block>
<block wx:else>
<view class="cu-avatar lg" style="background-image:url(https://wximage-1251091977.cos.ap-beijing.myqcloud.com/xai/error.png);"></view>
</block>
<view class="content">
<view class="text-black">{{item.name}}<block wx:if="{{item.has_calorie==true}}">--卡路里:{{item.calorie}}KJ/100g</block></view>
<view class="text-gray text-sm flex">
<text>
<text class="margin-right-xs blod">可信度{{item.probability}}%</text>
</text>
<view class="cu-bar bg-white solid-bottom margin-top">
<view class="action">
<text class="cuIcon-title text-xsblue "></text>
菜品识别结果
</view>
</view>
<view class="action">
<view class="cu-tag round bg-xsblue lg" bindtap="showDetail" data-name="{{item.name}}" data-description="{{item.baike_info.description}}">介绍</view>
</view>
</view>
</block>
</view>
<!--菜品识别列表-->
<view class="cu-list menu-avatar">
<block wx:for="{{resultData}}">
<view class="cu-item">
<block wx:if="{{item.baike_info.image_url}}">
<view class="cu-avatar lg" style="background-image:url({{item.baike_info.image_url}});"></view>
</block>
<block wx:else>
<view class="cu-avatar lg"
style="background-image:url(https://wximage-1251091977.cos.ap-beijing.myqcloud.com/xai/error.png);"></view>
</block>
<view class="content">
<view class="text-black">{{item.name}}
<block wx:if="{{item.has_calorie==true}}">--卡路里:{{item.calorie}}KJ/100g</block>
</view>
<view class="text-gray text-sm flex">
<text>
<text class="margin-right-xs blod">可信度{{item.probability}}%</text>
</text>
</view>
</view>
<view class="action">
<view class="cu-tag round bg-xsblue lg" bindtap="showDetail" data-name="{{item.name}}"
data-description="{{item.baike_info.description}}">介绍
</view>
</view>
</view>
</block>
</view>
</block>
<!--温馨提示-->
<view>
<!--温馨提示-->
<view>
<text class='reason_txt'>温馨提示</text>
<view class='reminder-content'>1.上传图片最好包含菜品</view>
<view class='reminder-content'>2.点击介绍可查看百科信息</view>
...
...
@@ -51,9 +61,9 @@
</view>
<!--浮动按钮跳转主页-->
<view class="round-click">
<navigator url='/pages/index/index' open-type="switchTab">
<image src="../../../images/tabbar/index_cur.png"></image>
</navigator
>
<navigator url='/pages/index/index' open-type="switchTab">
<image src="../../../images/tabbar/index_cur.png"></image>
</navigator
>
</view>
<!--给一个高度让内显示完整-->
<view class="cu-tabbar-height"></view>
pages/bizz/eyesattr/eyesattr.js
浏览文件 @
8c561906
...
...
@@ -30,6 +30,30 @@ Page({
wx
.
navigateTo
({
url
:
'
../logs/logs
'
})
},
//从聊天页面选择图片
chooseMessage
:
function
(){
var
that
=
this
;
wx
.
chooseMessageFile
({
count
:
1
,
sizeType
:
[
'
compressed
'
],
type
:
'
image
'
,
success
(
res
){
if
(
res
.
tempFiles
[
0
].
size
>
(
4096
*
1024
))
{
wx
.
showToast
({
title
:
'
图片文件过大哦
'
,
icon
:
'
none
'
,
mask
:
true
,
duration
:
1500
})
}
else
{
that
.
setData
({
img
:
res
.
tempFiles
[
0
].
path
})
that
.
generalDetect
(
res
.
tempFiles
[
0
].
path
);
}
}
})
},
//请求方法
uploads
:
function
()
{
...
...
@@ -57,45 +81,50 @@ Page({
duration
:
1500
})
}
else
{
wx
.
showLoading
({
title
:
"
识别中...
"
,
mask
:
true
}),
that
.
generalDetect
(
res
.
tempFilePaths
[
0
]);
}
},
})
},
//通用识别
generalDetect
(
file
){
var
that
=
this
;
that
.
setData
({
img
:
file
}),
wx
.
showLoading
({
title
:
"
黑眼圈眼袋检测中...
"
,
mask
:
true
}),
api
.
generalRequest
(
file
,
app
.
globalData
.
userId
,
api
.
eyesattr_url
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
img
:
'
data:image/jpg;base64,
'
+
resultJ
.
data
.
image_base64
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
res
.
tempFilePaths
[
0
]
img
:
null
})
}
api
.
generalRequest
(
res
.
tempFilePaths
[
0
],
app
.
globalData
.
userId
,
api
.
eyesattr_url
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
}
else
{
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
img
:
'
data:image/jpg;base64,
'
+
resultJ
.
data
.
image_base64
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
null
})
}
else
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
)
}
,
}
}
})
},
onLoad
:
function
()
{
...
...
@@ -119,4 +148,4 @@ Page({
})
}
}
});
\ No newline at end of file
});
pages/bizz/eyesattr/eyesattr.wxml
浏览文件 @
8c561906
<cu-custom bgColor="bg-gradual-blue" isBack="{{true}}">
<view slot="backText">返回</view>
<view slot="content">黑眼圈眼袋检测</view>
<view slot="backText">返回</view>
<view slot="content">黑眼圈眼袋检测</view>
</cu-custom>
<view class="page-body">
<view class="page-body-wrapper">
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片</button>
<view class="page-body-wrapper">
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片</button>
<!--从聊天中选择-->
<view class="text-center text-grey text-lg" style="text-decoration:underline;" bindtap="chooseMessage">
<view>从聊天中选择</view>
</view>
</view>
</view>
</view>
<!--温馨提示-->
<view>
<!--温馨提示-->
<view>
<text class='reason_txt'>温馨提示</text>
<view class='reminder-content'>1.效果仅供参考 不提供真实性依据</view>
<view class='reminder-content'>2.红色为标注,点击图片可放大查看</view>
</view>
<!--浮动按钮跳转主页-->
<view class="round-click">
<navigator url='/pages/index/index' open-type="switchTab">
<image src="../../../images/tabbar/index_cur.png"></image>
</navigator
>
<navigator url='/pages/index/index' open-type="switchTab">
<image src="../../../images/tabbar/index_cur.png"></image>
</navigator
>
</view>
<!--给一个高度让内显示完整-->
<view class="cu-tabbar-height"></view>
\ No newline at end of file
<view class="cu-tabbar-height"></view>
pages/bizz/facebeauty/facebeauty.js
浏览文件 @
8c561906
...
...
@@ -35,6 +35,30 @@ Page({
url
:
'
../logs/logs
'
})
},
//从聊天页面选择图片
chooseMessage
:
function
(){
var
that
=
this
;
wx
.
chooseMessageFile
({
count
:
1
,
sizeType
:
[
'
compressed
'
],
type
:
'
image
'
,
success
(
res
){
if
(
res
.
tempFiles
[
0
].
size
>
(
4096
*
1024
))
{
wx
.
showToast
({
title
:
'
图片文件过大哦
'
,
icon
:
'
none
'
,
mask
:
true
,
duration
:
1500
})
}
else
{
that
.
setData
({
img
:
res
.
tempFiles
[
0
].
path
})
that
.
generalDetect
(
res
.
tempFiles
[
0
].
path
);
}
}
})
},
//请求方法
uploads
:
function
()
{
var
that
=
this
...
...
@@ -61,47 +85,52 @@ Page({
duration
:
1500
})
}
else
{
wx
.
showLoading
({
title
:
"
识别中...
"
,
mask
:
true
}),
that
.
generalDetect
(
res
.
tempFilePaths
[
0
]);
}
},
})
},
//通用识别
generalDetect
(
file
){
var
that
=
this
;
that
.
setData
({
img
:
file
}),
wx
.
showLoading
({
title
:
"
面部分析中...
"
,
mask
:
true
}),
api
.
generalRequest
(
file
,
app
.
globalData
.
userId
,
api
.
facedetect_url
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
resultData
:
resultJ
.
data
.
face_list
,
faceNum
:
resultJ
.
data
.
face_num
,
img
:
'
data:image/jpg;base64,
'
+
resultJ
.
data
.
deal_image
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
res
.
tempFilePaths
[
0
]
img
:
null
})
}
api
.
generalRequest
(
res
.
tempFilePaths
[
0
],
app
.
globalData
.
userId
,
api
.
facedetect_url
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
}
else
{
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
resultData
:
resultJ
.
data
.
face_list
,
faceNum
:
resultJ
.
data
.
face_num
,
img
:
'
data:image/jpg;base64,
'
+
resultJ
.
data
.
deal_image
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
null
})
}
else
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
)
}
,
}
}
})
},
onLoad
:
function
()
{
...
...
@@ -116,4 +145,4 @@ Page({
current
:
that
.
data
.
img
})
}
});
\ No newline at end of file
});
pages/bizz/facebeauty/facebeauty.wxml
浏览文件 @
8c561906
...
...
@@ -3,12 +3,16 @@
<view slot="content">颜值估测</view>
</cu-custom>
<view class="page-body">
<view class="page-body-wrapper">
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片识别</button>
</view>
<view class="page-body-wrapper">
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片</button>
<!--从聊天中选择-->
<view class="text-center text-grey text-lg" style="text-decoration:underline;" bindtap="chooseMessage">
<view>从聊天中选择</view>
</view>
</view>
</view>
<!--查询详情-->
<block wx:if="{{resultData}}">
...
...
pages/bizz/facemerge/facemerge.js
浏览文件 @
8c561906
...
...
@@ -36,6 +36,35 @@ Page({
path
:
'
/pages/bizz/facemerge/facemerge
'
}
},
//从聊天页面选择图片
chooseMessage
:
function
(){
var
that
=
this
;
wx
.
chooseMessageFile
({
count
:
1
,
sizeType
:
[
'
compressed
'
],
type
:
'
image
'
,
success
(
res
){
if
(
res
.
tempFiles
[
0
].
size
>
(
4096
*
1024
))
{
wx
.
showToast
({
title
:
'
图片文件过大哦
'
,
icon
:
'
none
'
,
mask
:
true
,
duration
:
1500
})
}
else
{
that
.
setData
({
img
:
res
.
tempFiles
[
0
].
path
,
tempFilePath
:
res
.
tempFiles
[
0
].
path
})
wx
.
showLoading
({
title
:
"
效果生成中...
"
,
mask
:
true
}),
that
.
faceMerge
();
}
}
})
},
uploads
:
function
()
{
var
that
=
this
var
takephonewidth
...
...
@@ -198,4 +227,4 @@ Page({
})
}
}
})
\ No newline at end of file
})
pages/bizz/facemerge/facemerge.wxml
浏览文件 @
8c561906
...
...
@@ -4,10 +4,14 @@
</cu-custom>
<view class="page-body">
<view class="page-body-wrapper">
<image src="{{img}}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'
/>
<image src="{{img}}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片</button>
<!--从聊天中选择-->
<view class="text-center text-grey text-lg" style="text-decoration:underline;" bindtap="chooseMessage">
<view>从聊天中选择</view>
</view>
</view>
<!--模板图-->
<view class="cu-bar tabbar bg-white shadow foot">
...
...
@@ -36,4 +40,4 @@
</navigator >
</view>
<!--给一个高度让内显示完整-->
<view class="cu-tabbar-height"></view>
\ No newline at end of file
<view class="cu-tabbar-height"></view>
pages/bizz/faceorgans/faceorgans.js
浏览文件 @
8c561906
...
...
@@ -40,6 +40,30 @@ Page({
wx
.
navigateTo
({
url
:
'
../logs/logs
'
})
},
//从聊天页面选择图片
chooseMessage
:
function
(){
var
that
=
this
;
wx
.
chooseMessageFile
({
count
:
1
,
sizeType
:
[
'
compressed
'
],
type
:
'
image
'
,
success
(
res
){
if
(
res
.
tempFiles
[
0
].
size
>
(
4096
*
1024
))
{
wx
.
showToast
({
title
:
'
图片文件过大哦
'
,
icon
:
'
none
'
,
mask
:
true
,
duration
:
1500
})
}
else
{
that
.
setData
({
img
:
res
.
tempFiles
[
0
].
path
})
that
.
generalDetect
(
res
.
tempFiles
[
0
].
path
);
}
}
})
},
//请求方法
uploads
:
function
()
{
...
...
@@ -67,54 +91,59 @@ Page({
duration
:
1500
})
}
else
{
wx
.
showLoading
({
title
:
"
分析中...
"
,
mask
:
true
}),
that
.
generalDetect
(
res
.
tempFilePaths
[
0
]);
}
},
})
},
//面相识别
generalDetect
(
file
){
var
that
=
this
;
that
.
setData
({
img
:
file
}),
wx
.
showLoading
({
title
:
"
面相分析中...
"
,
mask
:
true
}),
api
.
faceOrgansRequest
(
file
,
app
.
globalData
.
userId
,{
success
(
result
){
var
resultJ
=
JSON
.
parse
(
result
)
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
){
that
.
setData
({
eye
:
resultJ
.
eye
,
eyebrow
:
resultJ
.
eyebrow
,
face
:
resultJ
.
face
,
faceFortune
:
resultJ
.
faceFortune
,
face_shape
:
resultJ
.
face_shape
,
lips
:
resultJ
.
lips
,
nose
:
resultJ
.
nose
,
skin_color
:
resultJ
.
skin_color
,
fortune
:
resultJ
.
fortune
,
faceMessage
:
resultJ
.
faceMessage
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
res
.
tempFilePaths
[
0
]
img
:
null
})
}
api
.
faceOrgansRequest
(
res
.
tempFilePaths
[
0
],
app
.
globalData
.
userId
,{
success
(
result
){
var
resultJ
=
JSON
.
parse
(
result
)
}
else
{
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
){
that
.
setData
({
eye
:
resultJ
.
eye
,
eyebrow
:
resultJ
.
eyebrow
,
face
:
resultJ
.
face
,
faceFortune
:
resultJ
.
faceFortune
,
face_shape
:
resultJ
.
face_shape
,
lips
:
resultJ
.
lips
,
nose
:
resultJ
.
nose
,
skin_color
:
resultJ
.
skin_color
,
fortune
:
resultJ
.
fortune
,
faceMessage
:
resultJ
.
faceMessage
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
null
})
}
else
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
)
}
,
}
}
})
},
onLoad
:
function
()
{
...
...
@@ -129,4 +158,4 @@ Page({
current
:
that
.
data
.
img
})
}
});
\ No newline at end of file
});
pages/bizz/faceorgans/faceorgans.wxml
浏览文件 @
8c561906
<cu-custom bgColor="bg-gradual-blue" isBack="{{true}}">
<view slot="backText">返回</view>
<view slot="content">面相(五官)分析</view>
<view slot="backText">返回</view>
<view slot="content">面相(五官)分析</view>
</cu-custom>
<view class="page-body">
<view class="page-body-wrapper">
<image src="{{ img }}" bindtap='preview' style="width:100%;height:500rpx;" id="imageDom" mode='aspectFit' />
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片识别</button>
</view>
<view class="page-body-wrapper">
<image src="{{ img }}" bindtap='preview' style="width:100%;height:500rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片</button>
<!--从聊天中选择-->
<view class="text-center text-grey text-lg" style="text-decoration:underline;" bindtap="chooseMessage">
<view>从聊天中选择</view>
</view>
</view>
<!--面相评分-->
<block wx:if="{{face}}">
<view class="cu-bar bg-white solid-bottom margin-top">
...
...
@@ -137,7 +141,7 @@
<view class="cu-list grid col-3 no-border">
<block wx:for="{{faceFortune.plantsList}}" wx:key='index'>
<view class="cu-item" bindtap="detail">
<navigator hover-class="other-navigator-hover" open-type="navigate">
<navigator hover-class="other-navigator-hover" open-type="navigate">
<view>
<image src="{{item.imgUrl}}" class="productImg" mode="aspectFill"></image>
</view>
...
...
@@ -162,4 +166,4 @@
</navigator >
</view>
<!--给一个高度让内显示完整-->
<view class="cu-tabbar-height"></view>
\ No newline at end of file
<view class="cu-tabbar-height"></view>
pages/bizz/facetransfer/facetransfer.js
浏览文件 @
8c561906
...
...
@@ -124,6 +124,35 @@ Page({
wx
.
navigateTo
({
url
:
'
../logs/logs
'
})
},
//从聊天页面选择图片
chooseMessage
:
function
(){
var
that
=
this
;
wx
.
chooseMessageFile
({
count
:
1
,
sizeType
:
[
'
compressed
'
],
type
:
'
image
'
,
success
(
res
){
if
(
res
.
tempFiles
[
0
].
size
>
(
4096
*
1024
))
{
wx
.
showToast
({
title
:
'
图片文件过大哦
'
,
icon
:
'
none
'
,
mask
:
true
,
duration
:
1500
})
}
else
{
that
.
setData
({
img
:
res
.
tempFiles
[
0
].
path
,
tempFilePath
:
res
.
tempFiles
[
0
].
path
}),
wx
.
showLoading
({
title
:
"
虚拟换妆中...
"
,
mask
:
true
}),
that
.
faceTransfer
();
}
}
})
},
uploads
:
function
()
{
var
that
=
this
...
...
@@ -157,9 +186,9 @@ Page({
title
:
"
虚拟换妆中...
"
,
mask
:
true
}),
that
.
setData
({
img
:
res
.
tempFilePaths
[
0
]
})
that
.
setData
({
img
:
res
.
tempFilePaths
[
0
]
})
that
.
faceTransfer
();
}
},
...
...
@@ -221,4 +250,4 @@ Page({
})
}
}
});
\ No newline at end of file
});
pages/bizz/facetransfer/facetransfer.wxml
浏览文件 @
8c561906
...
...
@@ -4,10 +4,14 @@
</cu-custom>
<view class="page-body">
<view class="page-body-wrapper">
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'
/>
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片识别</button>
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片</button>
<!--从聊天中选择-->
<view class="text-center text-grey text-lg" style="text-decoration:underline;" bindtap="chooseMessage">
<view>从聊天中选择</view>
</view>
</view>
<!--模板图类型-->
<scroll-view scroll-x class="bg-white nav padding-top-xs padding-bottom-sm text-df">
...
...
@@ -52,4 +56,4 @@
</navigator >
</view>
<!--给一个高度让内显示完整-->
<view class="cu-tabbar-height"></view>
\ No newline at end of file
<view class="cu-tabbar-height"></view>
pages/bizz/facewrinkle/facewrinkle.js
浏览文件 @
8c561906
...
...
@@ -31,6 +31,30 @@ Page({
wx
.
navigateTo
({
url
:
'
../logs/logs
'
})
},
//从聊天页面选择图片
chooseMessage
:
function
(){
var
that
=
this
;
wx
.
chooseMessageFile
({
count
:
1
,
sizeType
:
[
'
compressed
'
],
type
:
'
image
'
,
success
(
res
){
if
(
res
.
tempFiles
[
0
].
size
>
(
4096
*
1024
))
{
wx
.
showToast
({
title
:
'
图片文件过大哦
'
,
icon
:
'
none
'
,
mask
:
true
,
duration
:
1500
})
}
else
{
that
.
setData
({
img
:
res
.
tempFiles
[
0
].
path
})
that
.
generalDetect
(
res
.
tempFiles
[
0
].
path
);
}
}
})
},
//请求方法
uploads
:
function
()
{
...
...
@@ -58,46 +82,52 @@ Page({
duration
:
1500
})
}
else
{
wx
.
showLoading
({
title
:
"
识别中...
"
,
mask
:
true
}),
that
.
generalDetect
(
res
.
tempFilePaths
[
0
]);
}
},
})
},
//通用识别
generalDetect
(
file
){
var
that
=
this
;
that
.
setData
({
img
:
file
}),
wx
.
showLoading
({
title
:
"
皱纹检测中...
"
,
mask
:
true
}),
api
.
generalRequest
(
file
,
app
.
globalData
.
userId
,
api
.
facewrinkle_url
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
img
:
'
data:image/jpg;base64,
'
+
resultJ
.
data
.
image_base64
,
wrinkle_num
:
resultJ
.
data
.
wrinkle_num
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
res
.
tempFilePaths
[
0
]
img
:
null
})
}
api
.
generalRequest
(
res
.
tempFilePaths
[
0
],
app
.
globalData
.
userId
,
api
.
facewrinkle_url
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
}
else
{
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
img
:
'
data:image/jpg;base64,
'
+
resultJ
.
data
.
image_base64
,
wrinkle_num
:
resultJ
.
data
.
wrinkle_num
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
null
})
}
else
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
)
}
,
}
}
})
},
onLoad
:
function
()
{
...
...
@@ -121,4 +151,4 @@ Page({
})
}
}
});
\ No newline at end of file
});
pages/bizz/facewrinkle/facewrinkle.wxml
浏览文件 @
8c561906
<cu-custom bgColor="bg-gradual-blue" isBack="{{true}}">
<view slot="backText">返回</view>
<view slot="content">皱纹检测</view>
<view slot="backText">返回</view>
<view slot="content">皱纹检测</view>
</cu-custom>
<view class="page-body">
<view class="page-body-wrapper">
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片</button>
</view>
<view class="page-body-wrapper">
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片</button>
<!--从聊天中选择-->
<view class="text-center text-grey text-lg" style="text-decoration:underline;" bindtap="chooseMessage">
<view>从聊天中选择</view>
</view>
</view>
<!--检测结果-->
<view class="cu-bar bg-white margin-top">
<view class="action">
...
...
@@ -31,4 +35,4 @@
</navigator >
</view>
<!--给一个高度让内显示完整-->
<view class="cu-tabbar-height"></view>
\ No newline at end of file
<view class="cu-tabbar-height"></view>
pages/bizz/flower/flower.js
浏览文件 @
8c561906
...
...
@@ -64,6 +64,30 @@ Page({
wx
.
navigateTo
({
url
:
'
../logs/logs
'
})
},
//从聊天页面选择图片
chooseMessage
:
function
(){
var
that
=
this
;
wx
.
chooseMessageFile
({
count
:
1
,
sizeType
:
[
'
compressed
'
],
type
:
'
image
'
,
success
(
res
){
if
(
res
.
tempFiles
[
0
].
size
>
(
4096
*
1024
))
{
wx
.
showToast
({
title
:
'
图片文件过大哦
'
,
icon
:
'
none
'
,
mask
:
true
,
duration
:
1500
})
}
else
{
that
.
setData
({
img
:
res
.
tempFiles
[
0
].
path
})
that
.
icrDetect
(
res
.
tempFiles
[
0
].
path
);
}
}
})
},
//请求方法
uploads
:
function
()
{
...
...
@@ -91,45 +115,50 @@ Page({
duration
:
1500
})
}
else
{
wx
.
showLoading
({
title
:
"
识别中...
"
,
mask
:
true
}),
that
.
icrDetect
(
res
.
tempFilePaths
[
0
]);
}
},
})
},
//花卉识别
icrDetect
(
file
){
var
that
=
this
;
that
.
setData
({
img
:
file
}),
wx
.
showLoading
({
title
:
"
花卉识别中...
"
,
mask
:
true
}),
api
.
icrRequest
(
file
,
app
.
globalData
.
userId
,
'
flower
'
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
resultData
:
resultJ
.
result
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
res
.
tempFilePaths
[
0
]
img
:
null
})
}
api
.
icrRequest
(
res
.
tempFilePaths
[
0
],
app
.
globalData
.
userId
,
'
flower
'
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
}
else
{
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
resultData
:
resultJ
.
result
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
null
})
}
else
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
)
}
,
}
}
})
},
onLoad
:
function
()
{
...
...
@@ -144,4 +173,4 @@ Page({
current
:
that
.
data
.
img
})
}
});
\ No newline at end of file
});
pages/bizz/flower/flower.wxml
浏览文件 @
8c561906
<cu-custom bgColor="bg-gradual-blue" isBack="{{true}}">
<view slot="backText">返回</view>
<view slot="content">花卉识别</view>
<view slot="backText">返回</view>
<view slot="content">花卉识别</view>
</cu-custom>
<view class="page-body">
<view class="page-body-wrapper">
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片识别</button>
</view>
<view class="page-body-wrapper">
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片</button>
<!--从聊天中选择-->
<view class="text-center text-grey text-lg" style="text-decoration:underline;" bindtap="chooseMessage">
<view>从聊天中选择</view>
</view>
</view>
</view>
<!--查询详情-->
<block wx:if="{{resultData}}">
...
...
pages/bizz/garbage/garbage.js
浏览文件 @
8c561906
...
...
@@ -32,6 +32,30 @@ Page({
wx
.
navigateTo
({
url
:
'
../logs/logs
'
})
},
//从聊天页面选择图片
chooseMessage
:
function
(){
var
that
=
this
;
wx
.
chooseMessageFile
({
count
:
1
,
sizeType
:
[
'
compressed
'
],
type
:
'
image
'
,
success
(
res
){
if
(
res
.
tempFiles
[
0
].
size
>
(
4096
*
1024
))
{
wx
.
showToast
({
title
:
'
图片文件过大哦
'
,
icon
:
'
none
'
,
mask
:
true
,
duration
:
1500
})
}
else
{
that
.
setData
({
img
:
res
.
tempFiles
[
0
].
path
})
that
.
generalDetect
(
res
.
tempFiles
[
0
].
path
);
}
}
})
},
//请求方法
uploads
:
function
()
{
...
...
@@ -59,45 +83,50 @@ Page({
duration
:
1500
})
}
else
{
wx
.
showLoading
({
title
:
"
分析中...
"
,
mask
:
true
}),
that
.
generalDetect
(
res
.
tempFilePaths
[
0
]);
}
},
})
},
//垃圾识别
generalDetect
(
file
){
var
that
=
this
;
that
.
setData
({
img
:
file
}),
wx
.
showLoading
({
title
:
"
垃圾分析中...
"
,
mask
:
true
}),
api
.
garbageRequest
(
file
,
app
.
globalData
.
userId
,
that
.
data
.
cityId
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
garbage
:
resultJ
.
data
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
res
.
tempFilePaths
[
0
]
img
:
null
})
}
api
.
garbageRequest
(
res
.
tempFilePaths
[
0
],
app
.
globalData
.
userId
,
that
.
data
.
cityId
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
}
else
{
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
garbage
:
resultJ
.
data
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
null
})
}
else
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
)
}
,
}
}
})
},
onLoad
:
function
(
options
)
{
...
...
@@ -117,4 +146,4 @@ Page({
current
:
that
.
data
.
img
})
}
});
\ No newline at end of file
});
pages/bizz/garbage/garbage.wxml
浏览文件 @
8c561906
...
...
@@ -7,14 +7,18 @@
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片识别</button>
</view>
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片</button>
<!--从聊天中选择-->
<view class="text-center text-grey text-lg" style="text-decoration:underline;" bindtap="chooseMessage">
<view>从聊天中选择</view>
</view>
</view>
<!--查询详情-->
<block wx:if="{{garbage}}">
<!--垃圾名称-->
<view class="cu-bar bg-white margin-top solid-bottom">
<view class="action">
<text class="cuIcon-title text-blue"></text> 垃圾名称
<text class="cuIcon-title text-blue"></text> 垃圾名称
</view>
</view>
<view class="padding-sm flex flex-wrap bg-white">
...
...
@@ -38,7 +42,7 @@
<view class="action">
<text class="cuIcon-title text-blue"></text> 国家标准城市编码
</view>
</view>
</view>
<view class="padding-sm flex flex-wrap bg-white">
<view class="padding-xs">
<view class="cu-tag" style="background-color:{{color[2]}};color:#fff">{{garbage.city_id}}</view>
...
...
pages/bizz/idphoto/idphoto.js
浏览文件 @
8c561906
...
...
@@ -49,6 +49,35 @@ Page({
wx
.
navigateTo
({
url
:
'
../logs/logs
'
})
},
//从聊天页面选择图片
chooseMessage
:
function
(){
var
that
=
this
;
wx
.
chooseMessageFile
({
count
:
1
,
sizeType
:
[
'
compressed
'
],
type
:
'
image
'
,
success
(
res
){
if
(
res
.
tempFiles
[
0
].
size
>
(
4096
*
1024
))
{
wx
.
showToast
({
title
:
'
图片文件过大哦
'
,
icon
:
'
none
'
,
mask
:
true
,
duration
:
1500
})
}
else
{
that
.
setData
({
img
:
res
.
tempFiles
[
0
].
path
,
tempFilePath
:
res
.
tempFiles
[
0
].
path
})
wx
.
showLoading
({
title
:
"
修改中...
"
,
mask
:
true
}),
that
.
bgColor
();
}
}
})
},
//请求方法
uploads
:
function
()
{
...
...
@@ -147,4 +176,4 @@ Page({
})
}
}
});
\ No newline at end of file
});
pages/bizz/idphoto/idphoto.wxml
浏览文件 @
8c561906
...
...
@@ -7,8 +7,12 @@
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片</button>
</view>
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片</button>
<!--从聊天中选择-->
<view class="text-center text-grey text-lg" style="text-decoration:underline;" bindtap="chooseMessage">
<view>从聊天中选择</view>
</view>
</view>
<!--背景色-->
<view class="cu-bar margin-top bg-white">
<view class="action">
...
...
pages/bizz/ingredient/ingredient.js
浏览文件 @
8c561906
...
...
@@ -64,6 +64,30 @@ Page({
wx
.
navigateTo
({
url
:
'
../logs/logs
'
})
},
//从聊天页面选择图片
chooseMessage
:
function
(){
var
that
=
this
;
wx
.
chooseMessageFile
({
count
:
1
,
sizeType
:
[
'
compressed
'
],
type
:
'
image
'
,
success
(
res
){
if
(
res
.
tempFiles
[
0
].
size
>
(
4096
*
1024
))
{
wx
.
showToast
({
title
:
'
图片文件过大哦
'
,
icon
:
'
none
'
,
mask
:
true
,
duration
:
1500
})
}
else
{
that
.
setData
({
img
:
res
.
tempFiles
[
0
].
path
})
that
.
icrDetect
(
res
.
tempFiles
[
0
].
path
);
}
}
})
},
//请求方法
uploads
:
function
()
{
...
...
@@ -91,45 +115,51 @@ Page({
duration
:
1500
})
}
else
{
wx
.
showLoading
({
title
:
"
识别中...
"
,
mask
:
true
}),
that
.
icrDetect
(
res
.
tempFilePaths
[
0
]);
}
},
})
},
//食材识别
icrDetect
(
file
){
var
that
=
this
;
that
.
setData
({
img
:
file
}),
wx
.
showLoading
({
title
:
"
食材识别中...
"
,
mask
:
true
}),
api
.
icrRequest
(
file
,
app
.
globalData
.
userId
,
'
ingredient
'
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
resultData
:
resultJ
.
result
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
res
.
tempFilePaths
[
0
]
img
:
null
})
}
api
.
icrRequest
(
res
.
tempFilePaths
[
0
],
app
.
globalData
.
userId
,
'
ingredient
'
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
}
else
{
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
resultData
:
resultJ
.
result
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
null
})
}
else
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
)
}
,
}
}
})
},
onLoad
:
function
()
{
...
...
@@ -144,4 +174,4 @@ Page({
current
:
that
.
data
.
img
})
}
});
\ No newline at end of file
});
pages/bizz/ingredient/ingredient.wxml
浏览文件 @
8c561906
<cu-custom bgColor="bg-gradual-blue" isBack="{{true}}">
<view slot="backText">返回</view>
<view slot="content">食材识别</view>
<view slot="backText">返回</view>
<view slot="content">食材识别</view>
</cu-custom>
<view class="page-body">
<view class="page-body-wrapper">
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片识别</button>
</view>
<view class="page-body-wrapper">
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片</button>
<!--从聊天中选择-->
<view class="text-center text-grey text-lg" style="text-decoration:underline;" bindtap="chooseMessage">
<view>从聊天中选择</view>
</view>
</view>
</view>
<!--食疏识别结果-->
<block wx:if="{{resultData}}">
...
...
pages/bizz/landmark/landmark.js
浏览文件 @
8c561906
...
...
@@ -33,6 +33,30 @@ Page({
wx
.
navigateTo
({
url
:
'
../logs/logs
'
})
},
//从聊天页面选择图片
chooseMessage
:
function
(){
var
that
=
this
;
wx
.
chooseMessageFile
({
count
:
1
,
sizeType
:
[
'
compressed
'
],
type
:
'
image
'
,
success
(
res
){
if
(
res
.
tempFiles
[
0
].
size
>
(
4096
*
1024
))
{
wx
.
showToast
({
title
:
'
图片文件过大哦
'
,
icon
:
'
none
'
,
mask
:
true
,
duration
:
1500
})
}
else
{
that
.
setData
({
img
:
res
.
tempFiles
[
0
].
path
})
that
.
icrDetect
(
res
.
tempFiles
[
0
].
path
);
}
}
})
},
//请求方法
uploads
:
function
()
{
...
...
@@ -60,45 +84,51 @@ Page({
duration
:
1500
})
}
else
{
wx
.
showLoading
({
title
:
"
识别中...
"
,
mask
:
true
}),
that
.
icrDetect
(
res
.
tempFilePaths
[
0
]);
}
},
})
},
//地标识别
icrDetect
(
file
){
var
that
=
this
;
that
.
setData
({
img
:
file
}),
wx
.
showLoading
({
title
:
"
地标识别中...
"
,
mask
:
true
}),
api
.
icrRequest
(
file
,
app
.
globalData
.
userId
,
'
landmark
'
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
resultData
:
resultJ
.
data
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
res
.
tempFilePaths
[
0
]
img
:
null
})
}
api
.
icrRequest
(
res
.
tempFilePaths
[
0
],
app
.
globalData
.
userId
,
'
landmark
'
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
}
else
{
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
resultData
:
resultJ
.
data
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
null
})
}
else
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
)
}
,
}
}
})
},
onLoad
:
function
()
{
...
...
@@ -113,4 +143,4 @@ Page({
current
:
that
.
data
.
img
})
}
});
\ No newline at end of file
});
pages/bizz/landmark/landmark.wxml
浏览文件 @
8c561906
<cu-custom bgColor="bg-gradual-blue" isBack="{{true}}">
<view slot="backText">返回</view>
<view slot="content">景区识别</view>
<view slot="backText">返回</view>
<view slot="content">景区识别</view>
</cu-custom>
<view class="page-body">
<view class="page-body-wrapper">
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片识别</button>
</view>
<view class="page-body-wrapper">
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片</button>
<!--从聊天中选择-->
<view class="text-center text-grey text-lg" style="text-decoration:underline;" bindtap="chooseMessage">
<view>从聊天中选择</view>
</view>
</view>
</view>
<!--景区识别结果-->
<block wx:if="{{resultData}}">
...
...
pages/bizz/logo/logo.js
浏览文件 @
8c561906
...
...
@@ -64,6 +64,30 @@ Page({
wx
.
navigateTo
({
url
:
'
../logs/logs
'
})
},
//从聊天页面选择图片
chooseMessage
:
function
(){
var
that
=
this
;
wx
.
chooseMessageFile
({
count
:
1
,
sizeType
:
[
'
compressed
'
],
type
:
'
image
'
,
success
(
res
){
if
(
res
.
tempFiles
[
0
].
size
>
(
4096
*
1024
))
{
wx
.
showToast
({
title
:
'
图片文件过大哦
'
,
icon
:
'
none
'
,
mask
:
true
,
duration
:
1500
})
}
else
{
that
.
setData
({
img
:
res
.
tempFiles
[
0
].
path
})
that
.
icrDetect
(
res
.
tempFiles
[
0
].
path
);
}
}
})
},
//请求方法
uploads
:
function
()
{
...
...
@@ -91,45 +115,50 @@ Page({
duration
:
1500
})
}
else
{
wx
.
showLoading
({
title
:
"
识别中...
"
,
mask
:
true
}),
that
.
icrDetect
(
res
.
tempFilePaths
[
0
]);
}
},
})
},
//LOGO识别
icrDetect
(
file
){
var
that
=
this
;
that
.
setData
({
img
:
file
}),
wx
.
showLoading
({
title
:
"
LOGO检索中...
"
,
mask
:
true
}),
api
.
icrRequest
(
file
,
app
.
globalData
.
userId
,
'
logo
'
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
resultData
:
resultJ
.
result
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
res
.
tempFilePaths
[
0
]
img
:
null
})
}
api
.
icrRequest
(
res
.
tempFilePaths
[
0
],
app
.
globalData
.
userId
,
'
logo
'
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
}
else
{
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
resultData
:
resultJ
.
result
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
null
})
}
else
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
)
}
,
}
}
})
},
onLoad
:
function
()
{
...
...
@@ -144,4 +173,4 @@ Page({
current
:
that
.
data
.
img
})
}
});
\ No newline at end of file
});
pages/bizz/logo/logo.wxml
浏览文件 @
8c561906
<cu-custom bgColor="bg-gradual-blue" isBack="{{true}}">
<view slot="backText">返回</view>
<view slot="content">LOGO识别</view>
<view slot="backText">返回</view>
<view slot="content">LOGO识别</view>
</cu-custom>
<view class="page-body">
<view class="page-body-wrapper">
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片识别</button>
</view>
<view class="page-body-wrapper">
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片</button>
<!--从聊天中选择-->
<view class="text-center text-grey text-lg" style="text-decoration:underline;" bindtap="chooseMessage">
<view>从聊天中选择</view>
</view>
</view>
</view>
<!--查询详情-->
<block wx:if="{{resultData}}">
...
...
pages/bizz/palm/palm.js
浏览文件 @
8c561906
...
...
@@ -36,6 +36,30 @@ Page({
wx
.
navigateTo
({
url
:
'
../logs/logs
'
})
},
//从聊天页面选择图片
chooseMessage
:
function
(){
var
that
=
this
;
wx
.
chooseMessageFile
({
count
:
1
,
sizeType
:
[
'
compressed
'
],
type
:
'
image
'
,
success
(
res
){
if
(
res
.
tempFiles
[
0
].
size
>
(
4096
*
1024
))
{
wx
.
showToast
({
title
:
'
图片文件过大哦
'
,
icon
:
'
none
'
,
mask
:
true
,
duration
:
1500
})
}
else
{
that
.
setData
({
img
:
res
.
tempFiles
[
0
].
path
})
that
.
generalDetect
(
res
.
tempFiles
[
0
].
path
);
}
}
})
},
//请求方法
uploads
:
function
()
{
...
...
@@ -63,51 +87,56 @@ Page({
duration
:
1500
})
}
else
{
wx
.
showLoading
({
title
:
"
分析中...
"
,
mask
:
true
}),
that
.
generalDetect
(
res
.
tempFilePaths
[
0
]);
}
},
})
},
//手相识别
generalDetect
(
file
){
var
that
=
this
;
that
.
setData
({
img
:
file
}),
wx
.
showLoading
({
title
:
"
手相分析中...
"
,
mask
:
true
}),
api
.
generalRequest
(
file
,
app
.
globalData
.
userId
,
api
.
palm_url
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
score
:
resultJ
.
data
.
score
,
//手相评分
ping_fen
:
resultJ
.
data
.
ping_fen
,
//纹理评分
shou_xiang
:
resultJ
.
data
.
shou_xiang
,
//手相描述
tag
:
resultJ
.
data
.
tag
,
//手相标签
zhang_wen
:
resultJ
.
data
.
zhang_wen
,
//掌纹分析
zhi_xiang
:
resultJ
.
data
.
zhi_xiang
,
//手指分析
img
:
'
data:image/png;base64,
'
+
resultJ
.
data
.
image_base64
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
res
.
tempFilePaths
[
0
]
img
:
null
})
}
api
.
generalRequest
(
res
.
tempFilePaths
[
0
],
app
.
globalData
.
userId
,
api
.
palm_url
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
}
else
{
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
score
:
resultJ
.
data
.
score
,
//手相评分
ping_fen
:
resultJ
.
data
.
ping_fen
,
//纹理评分
shou_xiang
:
resultJ
.
data
.
shou_xiang
,
//手相描述
tag
:
resultJ
.
data
.
tag
,
//手相标签
zhang_wen
:
resultJ
.
data
.
zhang_wen
,
//掌纹分析
zhi_xiang
:
resultJ
.
data
.
zhi_xiang
,
//手指分析
img
:
'
data:image/png;base64,
'
+
resultJ
.
data
.
image_base64
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
null
})
}
else
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
)
}
,
}
}
})
},
onLoad
:
function
()
{
...
...
@@ -122,4 +151,4 @@ Page({
current
:
that
.
data
.
img
})
}
});
\ No newline at end of file
});
pages/bizz/palm/palm.wxml
浏览文件 @
8c561906
...
...
@@ -6,9 +6,13 @@
<view class="page-body-wrapper">
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片</button>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片</button>
<!--从聊天中选择-->
<view class="text-center text-grey text-lg" style="text-decoration:underline;" bindtap="chooseMessage">
<view>从聊天中选择</view>
</view>
</view>
</view>
<!--手相评分-->
<block wx:if="{{score}}">
...
...
pages/bizz/plant/plant.js
浏览文件 @
8c561906
...
...
@@ -64,6 +64,30 @@ Page({
wx
.
navigateTo
({
url
:
'
../logs/logs
'
})
},
//从聊天页面选择图片
chooseMessage
:
function
(){
var
that
=
this
;
wx
.
chooseMessageFile
({
count
:
1
,
sizeType
:
[
'
compressed
'
],
type
:
'
image
'
,
success
(
res
){
if
(
res
.
tempFiles
[
0
].
size
>
(
4096
*
1024
))
{
wx
.
showToast
({
title
:
'
图片文件过大哦
'
,
icon
:
'
none
'
,
mask
:
true
,
duration
:
1500
})
}
else
{
that
.
setData
({
img
:
res
.
tempFiles
[
0
].
path
})
that
.
icrDetect
(
res
.
tempFiles
[
0
].
path
);
}
}
})
},
//请求方法
uploads
:
function
()
{
...
...
@@ -91,45 +115,51 @@ Page({
duration
:
1500
})
}
else
{
wx
.
showLoading
({
title
:
"
识别中...
"
,
mask
:
true
}),
that
.
icrDetect
(
res
.
tempFilePaths
[
0
]);
}
},
})
},
//植物识别
icrDetect
(
file
){
var
that
=
this
;
that
.
setData
({
img
:
file
}),
wx
.
showLoading
({
title
:
"
植物识别中...
"
,
mask
:
true
}),
api
.
icrRequest
(
file
,
app
.
globalData
.
userId
,
'
plant
'
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
resultData
:
resultJ
.
result
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
res
.
tempFilePaths
[
0
]
img
:
null
})
}
api
.
icrRequest
(
res
.
tempFilePaths
[
0
],
app
.
globalData
.
userId
,
'
plant
'
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
}
else
{
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
resultData
:
resultJ
.
result
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
null
})
}
else
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
)
}
,
}
}
})
},
onLoad
:
function
()
{
...
...
@@ -144,4 +174,4 @@ Page({
current
:
that
.
data
.
img
})
}
});
\ No newline at end of file
});
pages/bizz/plant/plant.wxml
浏览文件 @
8c561906
<cu-custom bgColor="bg-gradual-blue" isBack="{{true}}">
<view slot="backText">返回</view>
<view slot="content">植物识别</view>
<view slot="backText">返回</view>
<view slot="content">植物识别</view>
</cu-custom>
<view class="page-body">
<view class="page-body-wrapper">
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片识别</button>
</view>
<view class="page-body-wrapper">
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片</button>
<!--从聊天中选择-->
<view class="text-center text-grey text-lg" style="text-decoration:underline;" bindtap="chooseMessage">
<view>从聊天中选择</view>
</view>
</view>
</view>
<!--查询详情-->
<block wx:if="{{resultData}}">
...
...
pages/bizz/redwine/redwine.js
浏览文件 @
8c561906
...
...
@@ -33,6 +33,30 @@ Page({
wx
.
navigateTo
({
url
:
'
../logs/logs
'
})
},
//从聊天页面选择图片
chooseMessage
:
function
(){
var
that
=
this
;
wx
.
chooseMessageFile
({
count
:
1
,
sizeType
:
[
'
compressed
'
],
type
:
'
image
'
,
success
(
res
){
if
(
res
.
tempFiles
[
0
].
size
>
(
4096
*
1024
))
{
wx
.
showToast
({
title
:
'
图片文件过大哦
'
,
icon
:
'
none
'
,
mask
:
true
,
duration
:
1500
})
}
else
{
that
.
setData
({
img
:
res
.
tempFiles
[
0
].
path
})
that
.
icrDetect
(
res
.
tempFiles
[
0
].
path
);
}
}
})
},
//请求方法
uploads
:
function
()
{
...
...
@@ -60,45 +84,50 @@ Page({
duration
:
1500
})
}
else
{
wx
.
showLoading
({
title
:
"
识别中...
"
,
mask
:
true
}),
that
.
icrDetect
(
res
.
tempFilePaths
[
0
]);
}
},
})
},
//红酒识别
icrDetect
(
file
){
var
that
=
this
;
that
.
setData
({
img
:
file
}),
wx
.
showLoading
({
title
:
"
红酒识别中...
"
,
mask
:
true
}),
api
.
icrRequest
(
file
,
app
.
globalData
.
userId
,
'
redwine
'
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
resultData
:
resultJ
.
data
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
res
.
tempFilePaths
[
0
]
img
:
null
})
}
api
.
icrRequest
(
res
.
tempFilePaths
[
0
],
app
.
globalData
.
userId
,
'
redwine
'
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
}
else
{
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
resultData
:
resultJ
.
data
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
null
})
}
else
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
)
}
,
}
}
})
},
onLoad
:
function
()
{
...
...
@@ -113,4 +142,4 @@ Page({
current
:
that
.
data
.
img
})
}
});
\ No newline at end of file
});
pages/bizz/redwine/redwine.wxml
浏览文件 @
8c561906
...
...
@@ -7,8 +7,12 @@
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片识别</button>
</view>
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片</button>
<!--从聊天中选择-->
<view class="text-center text-grey text-lg" style="text-decoration:underline;" bindtap="chooseMessage">
<view>从聊天中选择</view>
</view>
</view>
</view>
<!--红酒中文名-->
<block wx:if="{{resultData.wineNameCn}}">
...
...
pages/bizz/skincolor/skincolor.js
浏览文件 @
8c561906
...
...
@@ -33,6 +33,30 @@ Page({
wx
.
navigateTo
({
url
:
'
../logs/logs
'
})
},
//从聊天页面选择图片
chooseMessage
:
function
(){
var
that
=
this
;
wx
.
chooseMessageFile
({
count
:
1
,
sizeType
:
[
'
compressed
'
],
type
:
'
image
'
,
success
(
res
){
if
(
res
.
tempFiles
[
0
].
size
>
(
4096
*
1024
))
{
wx
.
showToast
({
title
:
'
图片文件过大哦
'
,
icon
:
'
none
'
,
mask
:
true
,
duration
:
1500
})
}
else
{
that
.
setData
({
img
:
res
.
tempFiles
[
0
].
path
})
that
.
generalDetect
(
res
.
tempFiles
[
0
].
path
);
}
}
})
},
//请求方法
uploads
:
function
()
{
...
...
@@ -60,46 +84,51 @@ Page({
duration
:
1500
})
}
else
{
wx
.
showLoading
({
title
:
"
识别中...
"
,
mask
:
true
}),
that
.
generalDetect
(
res
.
tempFilePaths
[
0
]);
}
},
})
},
//通用识别
generalDetect
(
file
){
var
that
=
this
;
that
.
setData
({
img
:
file
}),
wx
.
showLoading
({
title
:
"
肤色分析中...
"
,
mask
:
true
}),
api
.
generalRequest
(
file
,
app
.
globalData
.
userId
,
api
.
faceSkinColor_url
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
img
:
'
data:image/jpg;base64,
'
+
resultJ
.
data
.
image_base64
,
color
:
resultJ
.
data
.
color
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
res
.
tempFilePaths
[
0
]
img
:
null
})
}
api
.
generalRequest
(
res
.
tempFilePaths
[
0
],
app
.
globalData
.
userId
,
api
.
faceSkinColor_url
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
}
else
{
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
img
:
'
data:image/jpg;base64,
'
+
resultJ
.
data
.
image_base64
,
color
:
resultJ
.
data
.
color
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
null
})
}
else
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
)
}
,
}
}
})
},
onLoad
:
function
()
{
...
...
@@ -123,4 +152,4 @@ Page({
})
}
}
});
\ No newline at end of file
});
pages/bizz/skincolor/skincolor.wxml
浏览文件 @
8c561906
<cu-custom bgColor="bg-gradual-blue" isBack="{{true}}">
<view slot="backText">返回</view>
<view slot="content">肤色分析</view>
<view slot="backText">返回</view>
<view slot="content">肤色分析</view>
</cu-custom>
<view class="page-body">
<view class="page-body-wrapper">
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片</button>
</view>
<view class="page-body-wrapper">
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片</button>
<!--从聊天中选择-->
<view class="text-center text-grey text-lg" style="text-decoration:underline;" bindtap="chooseMessage">
<view>从聊天中选择</view>
</view>
</view>
<!--检测结果-->
<view class="cu-bar bg-white margin-top" wx:if="{{color}}">
<view class="action">
...
...
@@ -33,4 +37,4 @@
</navigator >
</view>
<!--给一个高度让内显示完整-->
<view class="cu-tabbar-height"></view>
\ No newline at end of file
<view class="cu-tabbar-height"></view>
pages/bizz/skinsmooth/skinsmooth.js
浏览文件 @
8c561906
...
...
@@ -30,6 +30,30 @@ Page({
wx
.
navigateTo
({
url
:
'
../logs/logs
'
})
},
//从聊天页面选择图片
chooseMessage
:
function
(){
var
that
=
this
;
wx
.
chooseMessageFile
({
count
:
1
,
sizeType
:
[
'
compressed
'
],
type
:
'
image
'
,
success
(
res
){
if
(
res
.
tempFiles
[
0
].
size
>
(
4096
*
1024
))
{
wx
.
showToast
({
title
:
'
图片文件过大哦
'
,
icon
:
'
none
'
,
mask
:
true
,
duration
:
1500
})
}
else
{
that
.
setData
({
img
:
res
.
tempFiles
[
0
].
path
})
that
.
generalDetect
(
res
.
tempFiles
[
0
].
path
);
}
}
})
},
//请求方法
uploads
:
function
()
{
...
...
@@ -57,52 +81,51 @@ Page({
duration
:
1500
})
}
else
{
wx
.
showLoading
({
title
:
"
识别中...
"
,
mask
:
true
}),
that
.
setData
({
img
:
res
.
tempFilePaths
[
0
]
})
that
.
generalDetect
(
res
.
tempFilePaths
[
0
]);
}
api
.
generalRequest
(
res
.
tempFilePaths
[
0
],
app
.
globalData
.
userId
,
api
.
faceSkinsmooth_url
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
img
:
'
data:image/jpg;base64,
'
+
resultJ
.
data
.
image_base64
,
smooth
:
resultJ
.
data
.
smooth
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
null
})
}
else
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
}
})
},
})
},
test
:
function
(){
console
.
info
(
11111111
);
wx
.
navigateTo
({
url
:
'
/pages/index/index
'
,
//通用识别
generalDetect
(
file
){
var
that
=
this
;
that
.
setData
({
img
:
file
}),
wx
.
showLoading
({
title
:
"
光滑度分析中...
"
,
mask
:
true
}),
api
.
generalRequest
(
file
,
app
.
globalData
.
userId
,
api
.
faceSkinsmooth_url
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
img
:
'
data:image/jpg;base64,
'
+
resultJ
.
data
.
image_base64
,
smooth
:
resultJ
.
data
.
smooth
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
null
})
}
else
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
}
})
},
onLoad
:
function
()
{
...
...
@@ -126,4 +149,4 @@ Page({
})
}
}
});
\ No newline at end of file
});
pages/bizz/skinsmooth/skinsmooth.wxml
浏览文件 @
8c561906
<cu-custom bgColor="bg-gradual-blue" isBack="{{true}}">
<view slot="backText">返回</view>
<view slot="content">皮肤光滑度分析</view>
<view slot="backText">返回</view>
<view slot="content">皮肤光滑度分析</view>
</cu-custom>
<view class="page-body">
<view class="page-body-wrapper">
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片</button>
</view>
<view class="page-body-wrapper">
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片</button>
<!--从聊天中选择-->
<view class="text-center text-grey text-lg" style="text-decoration:underline;" bindtap="chooseMessage">
<view>从聊天中选择</view>
</view>
</view>
<!--检测结果-->
<view class="cu-bar bg-white margin-top" wx:if="{{smooth}}">
<view class="action">
...
...
pages/bizz/watch/watch.js
浏览文件 @
8c561906
...
...
@@ -30,6 +30,30 @@ Page({
wx
.
navigateTo
({
url
:
'
../logs/logs
'
})
},
//从聊天页面选择图片
chooseMessage
:
function
(){
var
that
=
this
;
wx
.
chooseMessageFile
({
count
:
1
,
sizeType
:
[
'
compressed
'
],
type
:
'
image
'
,
success
(
res
){
if
(
res
.
tempFiles
[
0
].
size
>
(
4096
*
1024
))
{
wx
.
showToast
({
title
:
'
图片文件过大哦
'
,
icon
:
'
none
'
,
mask
:
true
,
duration
:
1500
})
}
else
{
that
.
setData
({
img
:
res
.
tempFiles
[
0
].
path
})
that
.
generalDetect
(
res
.
tempFiles
[
0
].
path
);
}
}
})
},
//请求方法
uploads
:
function
()
{
...
...
@@ -57,51 +81,51 @@ Page({
duration
:
1500
})
}
else
{
wx
.
showLoading
({
title
:
"
识别中...
"
,
mask
:
true
}),
that
.
setData
({
img
:
res
.
tempFilePaths
[
0
]
})
that
.
generalDetect
(
res
.
tempFilePaths
[
0
]);
}
api
.
generalRequest
(
res
.
tempFilePaths
[
0
],
app
.
globalData
.
userId
,
api
.
watch_url
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
watch
:
resultJ
.
watchData
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
null
})
}
else
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
}
})
},
})
},
test
:
function
()
{
console
.
info
(
11111111
);
wx
.
navigateTo
({
url
:
'
/pages/index/index
'
,
//通用识别
generalDetect
(
file
){
var
that
=
this
;
that
.
setData
({
img
:
file
}),
wx
.
showLoading
({
title
:
"
手表识别中...
"
,
mask
:
true
}),
api
.
generalRequest
(
file
,
app
.
globalData
.
userId
,
api
.
watch_url
,
{
success
(
result
)
{
var
resultJ
=
JSON
.
parse
(
result
)
wx
.
hideLoading
();
if
(
resultJ
.
code
==
200
)
{
that
.
setData
({
watch
:
resultJ
.
watchData
})
}
else
{
if
(
resultJ
.
code
==
87014
)
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
'
存在敏感内容,请更换图片
'
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
that
.
setData
({
img
:
null
})
}
else
{
wx
.
hideLoading
();
wx
.
showModal
({
content
:
resultJ
.
msg_zh
,
showCancel
:
false
,
confirmText
:
'
明白了
'
})
}
}
}
})
},
onLoad
:
function
()
{
...
...
@@ -125,4 +149,4 @@ Page({
})
}
}
});
\ No newline at end of file
});
pages/bizz/watch/watch.wxml
浏览文件 @
8c561906
...
...
@@ -6,9 +6,13 @@
<view class="page-body-wrapper">
<image src="{{ img }}" bindtap='preview' style="width:100%;height:400rpx;" id="imageDom" mode='aspectFit'/>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片</button>
</view>
<view class="padding flex flex-direction">
<button class="cu-btn bg-xsblue margin-tb-sm lg" bindtap="uploads">拍照/选取图片</button>
<!--从聊天中选择-->
<view class="text-center text-grey text-lg" style="text-decoration:underline;" bindtap="chooseMessage">
<view>从聊天中选择</view>
</view>
</view>
<!--检测结果-->
<view class="cu-bar bg-white margin-top" wx:if="{{watch}}">
<view class="action">
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录