Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
uniapp_scan
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
android
uniapp_scan
Commits
1097ecea
Commit
1097ecea
authored
Dec 19, 2023
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
2e17614b
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
384 additions
and
766 deletions
+384
-766
App.vue
scan/App.vue
+4
-20
uni-popup.vue
scan/components/uni-popup/uni-popup.vue
+0
-263
uni-transition.vue
scan/components/uni-transition/uni-transition.vue
+0
-281
common.js
scan/mixins/common.js
+1
-1
share.js
scan/mixins/share.js
+1
-1
pages.json
scan/pages.json
+44
-35
doc.vue
scan/pages/doc/doc.vue
+2
-2
index.vue
scan/pages/index/index.vue
+38
-30
edit.vue
scan/pagesC/edit/edit.vue
+186
-0
result.vue
scan/pagesC/result/result.vue
+24
-55
scan.vue
scan/pagesC/scan/scan.vue
+58
-78
ic_copy.png
scan/static/ic_copy.png
+0
-0
ic_scan_ocr.png
scan/static/ic_scan_ocr.png
+0
-0
constant.js
scan/utils/constant.js
+26
-0
No files found.
scan/App.vue
View file @
1097ecea
...
...
@@ -65,22 +65,6 @@
}
// checkUpdate(this);
// #ifdef H5
if
(
window
.
location
.
host
===
'www.baosheji.cn'
)
{
var
icp
=
document
.
createElement
(
'div'
);
icp
.
innerText
=
'京ICP备18032652号'
;
icp
.
style
.
color
=
'white'
;
icp
.
style
.
textAlign
=
'center'
;
icp
.
style
.
position
=
'fixed'
;
icp
.
style
.
bottom
=
'0'
;
icp
.
style
.
left
=
'0'
;
icp
.
style
.
right
=
'0'
;
icp
.
style
.
zIndex
=
'100'
;
document
.
body
.
appendChild
(
icp
);
}
// #endif
},
onShow
:
function
(
options
)
{
this
.
globalData
.
resetLogin
=
true
...
...
@@ -147,7 +131,7 @@
windowWidth
:
0
,
bottomSafePadding
:
12
,
h5Url
:
'https://api.mints-id.com/index.html'
,
baseUrl
:
'https://api.mints-tech.cn/camera-api/
miniA
pi'
,
baseUrl
:
'https://api.mints-tech.cn/camera-api/
a
pi'
,
// baseUrl: 'http://test.mints-id.com/ww-new/api',
titleButtonWidth
:
38
,
token
:
''
,
...
...
@@ -160,8 +144,8 @@
realNameStatus
:
false
,
auth
:
false
,
// 三要素实名认证
userInfo
:
null
,
cardInfo
:
null
,
pkgName
:
'com.mints.
helivideo
'
cardInfo
:
null
,
pkgName
:
'com.mints.
quickscan
'
}
};
</
script
>
...
...
@@ -183,4 +167,4 @@
@import
'./scss/agreement.scss'
;
@import
"@/uni_modules/uview-ui/index.scss"
;
@import
'@/uni.scss'
;
</
style
>
</
style
>
\ No newline at end of file
scan/components/uni-popup/uni-popup.vue
deleted
100644 → 0
View file @
2e17614b
<!-- 底部弹窗(分享) -->
<
template
>
<view
v-if=
"showPopup"
class=
"uni-popup"
@
touchmove
.
stop
.
prevent=
"clear"
>
<uni-transition
:mode-class=
"['fade']"
:styles=
"maskClass"
:duration=
"duration"
:show=
"showTrans"
@
click=
"onTap"
/>
<uni-transition
:mode-class=
"ani"
:styles=
"transClass"
:duration=
"duration"
:show=
"showTrans"
@
click=
"onTap"
>
<view
class=
"uni-popup__wrapper-box"
@
click
.
stop=
"clear"
>
<slot
/>
</view>
</uni-transition>
</view>
</
template
>
<
script
>
import
uniTransition
from
'@/components/uni-transition/uni-transition.vue'
/**
* PopUp 弹出层
* @description 弹出层组件,为了解决遮罩弹层的问题
* @tutorial https://ext.dcloud.net.cn/plugin?id=329
* @property {String} type = [top|center|bottom] 弹出方式
* @value top 顶部弹出
* @value center 中间弹出
* @value bottom 底部弹出
* @property {Boolean} animation = [ture|false] 是否开启动画
* @property {Boolean} maskClick = [ture|false] 蒙版点击是否关闭弹窗
* @event {Function} change 打开关闭弹窗触发,e={show: false}
*/
export
default
{
name
:
'UniPopup'
,
components
:
{
uniTransition
},
props
:
{
// 开启动画
animation
:
{
type
:
Boolean
,
default
:
true
},
// 弹出层类型,可选值,top: 顶部弹出层;bottom:底部弹出层;center:全屏弹出层
type
:
{
type
:
String
,
default
:
'center'
},
// maskClick
maskClick
:
{
type
:
Boolean
,
default
:
true
}
},
data
()
{
return
{
duration
:
300
,
ani
:
[],
showPopup
:
false
,
showTrans
:
false
,
maskClass
:
{
'position'
:
'fixed'
,
'bottom'
:
0
,
'top'
:
0
,
'left'
:
0
,
'right'
:
0
,
'backgroundColor'
:
'rgba(0, 0, 0, 0.4)'
},
transClass
:
{
'position'
:
'fixed'
,
'left'
:
0
,
'right'
:
0
,
}
}
},
watch
:
{
type
:
{
handler
:
function
(
newVal
)
{
switch
(
this
.
type
)
{
case
'top'
:
this
.
ani
=
[
'slide-top'
]
this
.
transClass
=
{
'position'
:
'fixed'
,
'left'
:
0
,
'right'
:
0
,
}
break
case
'bottom'
:
this
.
ani
=
[
'slide-bottom'
]
this
.
transClass
=
{
'position'
:
'fixed'
,
'left'
:
0
,
'right'
:
0
,
'bottom'
:
0
}
break
case
'center'
:
this
.
ani
=
[
'zoom-out'
,
'fade'
]
this
.
transClass
=
{
'position'
:
'fixed'
,
/* #ifndef APP-NVUE */
'display'
:
'flex'
,
'flexDirection'
:
'column'
,
/* #endif */
'bottom'
:
0
,
'left'
:
0
,
'right'
:
0
,
'top'
:
0
,
'justifyContent'
:
'center'
,
'alignItems'
:
'center'
}
break
}
},
immediate
:
true
}
},
created
()
{
if
(
this
.
animation
)
{
this
.
duration
=
300
}
else
{
this
.
duration
=
0
}
},
methods
:
{
clear
(
e
)
{
// TODO nvue 取消冒泡
e
.
stopPropagation
()
},
open
()
{
this
.
showPopup
=
true
this
.
$nextTick
(()
=>
{
clearTimeout
(
this
.
timer
)
this
.
timer
=
setTimeout
(()
=>
{
this
.
showTrans
=
true
},
50
);
})
this
.
$emit
(
'change'
,
{
show
:
true
})
},
close
(
type
)
{
this
.
showTrans
=
false
this
.
$nextTick
(()
=>
{
clearTimeout
(
this
.
timer
)
this
.
timer
=
setTimeout
(()
=>
{
this
.
$emit
(
'change'
,
{
show
:
false
})
this
.
showPopup
=
false
},
300
)
})
},
onTap
()
{
if
(
!
this
.
maskClick
)
return
this
.
close
()
}
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
.uni-popup
{
position
:
fixed
;
/* #ifdef H5 */
top
:
var
(
--
window-top
);
/* #endif */
/* #ifndef H5 */
top
:
0
;
/* #endif */
bottom
:
0
;
left
:
0
;
right
:
0
;
/* #ifndef APP-NVUE */
z-index
:
99999999999
;
/* #endif */
}
.uni-popup__mask
{
position
:
absolute
;
top
:
0
;
bottom
:
0
;
left
:
0
;
right
:
0
;
background-color
:
$uni-bg-color-mask
;
opacity
:
0
;
}
.mask-ani
{
transition-property
:
opacity
;
transition-duration
:
0
.2s
;
}
.uni-top-mask
{
opacity
:
1
;
}
.uni-bottom-mask
{
opacity
:
1
;
}
.uni-center-mask
{
opacity
:
1
;
}
.uni-popup__wrapper
{
/* #ifndef APP-NVUE */
display
:
block
;
/* #endif */
position
:
absolute
;
}
.top
{
top
:
0
;
left
:
0
;
right
:
0
;
transform
:
translateY
(
-500px
);
}
.bottom
{
bottom
:
0
;
left
:
0
;
right
:
0
;
transform
:
translateY
(
500px
);
}
.center
{
/* #ifndef APP-NVUE */
display
:
flex
;
flex-direction
:
column
;
/* #endif */
bottom
:
0
;
left
:
0
;
right
:
0
;
top
:
0
;
justify-content
:
center
;
align-items
:
center
;
transform
:
scale
(
1
.2
);
opacity
:
0
;
}
.uni-popup__wrapper-box
{
/* #ifndef APP-NVUE */
display
:
block
;
/* #endif */
position
:
relative
;
}
.content-ani
{
// transition: transform 0.3s;
transition-property
:
transform
,
opacity
;
transition-duration
:
0
.2s
;
}
.uni-top-content
{
transform
:
translateY
(
0
);
}
.uni-bottom-content
{
transform
:
translateY
(
0
);
}
.uni-center-content
{
transform
:
scale
(
1
);
opacity
:
1
;
}
</
style
>
scan/components/uni-transition/uni-transition.vue
deleted
100644 → 0
View file @
2e17614b
<!-- 底部弹窗需要组件(分享) -->
<
template
>
<view
v-if=
"isShow"
ref=
"ani"
class=
"uni-transition"
:class=
"[ani.in]"
:style=
"'transform:' +transform+';'+stylesObject"
@
click=
"change"
>
<slot></slot>
</view>
</
template
>
<
script
>
// #ifdef APP-NVUE
const
animation
=
uni
.
requireNativePlugin
(
'animation'
);
// #endif
/**
* Transition 过渡动画
* @description 简单过渡动画组件
* @tutorial https://ext.dcloud.net.cn/plugin?id=985
* @property {Boolean} show = [false|true] 控制组件显示或隐藏
* @property {Array} modeClass = [fade|slide-top|slide-right|slide-bottom|slide-left|zoom-in|zoom-out] 过渡动画类型
* @value fade 渐隐渐出过渡
* @value slide-top 由上至下过渡
* @value slide-right 由右至左过渡
* @value slide-bottom 由下至上过渡
* @value slide-left 由左至右过渡
* @value zoom-in 由小到大过渡
* @value zoom-out 由大到小过渡
* @property {Number} duration 过渡动画持续时间
* @property {Object} styles 组件样式,同 css 样式,注意带’-‘连接符的属性需要使用小驼峰写法如:`backgroundColor:red`
*/
export
default
{
name
:
'uniTransition'
,
props
:
{
show
:
{
type
:
Boolean
,
default
:
false
},
modeClass
:
{
type
:
Array
,
default
()
{
return
[]
}
},
duration
:
{
type
:
Number
,
default
:
300
},
styles
:
{
type
:
Object
,
default
()
{
return
{}
}
}
},
data
()
{
return
{
isShow
:
false
,
transform
:
''
,
ani
:
{
in
:
''
,
active
:
''
}
};
},
watch
:
{
show
:
{
handler
(
newVal
)
{
if
(
newVal
)
{
this
.
open
()
}
else
{
this
.
close
()
}
},
immediate
:
true
}
},
computed
:
{
stylesObject
()
{
let
styles
=
{
...
this
.
styles
,
'transition-duration'
:
this
.
duration
/
1000
+
's'
}
let
transfrom
=
''
for
(
let
i
in
styles
)
{
let
line
=
this
.
toLine
(
i
)
transfrom
+=
line
+
':'
+
styles
[
i
]
+
';'
}
return
transfrom
}
},
created
()
{
// this.timer = null
// this.nextTick = (time = 50) => new Promise(resolve => {
// clearTimeout(this.timer)
// this.timer = setTimeout(resolve, time)
// return this.timer
// });
},
methods
:
{
change
()
{
this
.
$emit
(
'click'
,
{
detail
:
this
.
isShow
})
},
open
()
{
clearTimeout
(
this
.
timer
)
this
.
isShow
=
true
this
.
transform
=
''
this
.
ani
.
in
=
''
for
(
let
i
in
this
.
getTranfrom
(
false
))
{
if
(
i
===
'opacity'
)
{
this
.
ani
.
in
=
'fade-in'
}
else
{
this
.
transform
+=
`
${
this
.
getTranfrom
(
false
)[
i
]}
`
}
}
this
.
$nextTick
(()
=>
{
setTimeout
(()
=>
{
this
.
_animation
(
true
)
},
50
)
})
},
close
(
type
)
{
clearTimeout
(
this
.
timer
)
this
.
_animation
(
false
)
},
_animation
(
type
)
{
let
styles
=
this
.
getTranfrom
(
type
)
// #ifdef APP-NVUE
if
(
!
this
.
$refs
[
'ani'
])
return
animation
.
transition
(
this
.
$refs
[
'ani'
].
ref
,
{
styles
,
duration
:
this
.
duration
,
//ms
timingFunction
:
'ease'
,
needLayout
:
false
,
delay
:
0
//ms
},
()
=>
{
if
(
!
type
)
{
this
.
isShow
=
false
}
this
.
$emit
(
'change'
,
{
detail
:
this
.
isShow
})
})
// #endif
// #ifndef APP-NVUE
this
.
transform
=
''
for
(
let
i
in
styles
)
{
if
(
i
===
'opacity'
)
{
this
.
ani
.
in
=
`fade-
${
type
?
'out'
:
'in'
}
`
}
else
{
this
.
transform
+=
`
${
styles
[
i
]}
`
}
}
this
.
timer
=
setTimeout
(()
=>
{
if
(
!
type
)
{
this
.
isShow
=
false
}
this
.
$emit
(
'change'
,
{
detail
:
this
.
isShow
})
},
this
.
duration
)
// #endif
},
getTranfrom
(
type
)
{
let
styles
=
{
transform
:
''
}
this
.
modeClass
.
forEach
((
mode
)
=>
{
switch
(
mode
)
{
case
'fade'
:
styles
.
opacity
=
type
?
1
:
0
break
;
case
'slide-top'
:
styles
.
transform
+=
`translateY(
${
type
?
'0'
:
'-100%'
}
) `
break
;
case
'slide-right'
:
styles
.
transform
+=
`translateX(
${
type
?
'0'
:
'100%'
}
) `
break
;
case
'slide-bottom'
:
styles
.
transform
+=
`translateY(
${
type
?
'0'
:
'100%'
}
) `
break
;
case
'slide-left'
:
styles
.
transform
+=
`translateX(
${
type
?
'0'
:
'-100%'
}
) `
break
;
case
'zoom-in'
:
styles
.
transform
+=
`scale(
${
type
?
1
:
0.8
}
) `
break
;
case
'zoom-out'
:
styles
.
transform
+=
`scale(
${
type
?
1
:
1.2
}
) `
break
;
}
})
return
styles
},
_modeClassArr
(
type
)
{
let
mode
=
this
.
modeClass
if
(
typeof
(
mode
)
!==
"string"
)
{
let
modestr
=
''
mode
.
forEach
((
item
)
=>
{
modestr
+=
(
item
+
'-'
+
type
+
','
)
})
return
modestr
.
substr
(
0
,
modestr
.
length
-
1
)
}
else
{
return
mode
+
'-'
+
type
}
},
// getEl(el) {
// console.log(el || el.ref || null);
// return el || el.ref || null
// },
toLine
(
name
)
{
return
name
.
replace
(
/
([
A-Z
])
/g
,
"-$1"
).
toLowerCase
();
}
}
}
</
script
>
<
style
>
.uni-transition
{
transition-timing-function
:
ease
;
transition-duration
:
0.3s
;
transition-property
:
transform
,
opacity
;
}
.fade-in
{
opacity
:
0
;
}
.fade-active
{
opacity
:
1
;
}
.slide-top-in
{
/* transition-property: transform, opacity; */
transform
:
translateY
(
-100%
);
}
.slide-top-active
{
transform
:
translateY
(
0
);
/* opacity: 1; */
}
.slide-right-in
{
transform
:
translateX
(
100%
);
}
.slide-right-active
{
transform
:
translateX
(
0
);
}
.slide-bottom-in
{
transform
:
translateY
(
100%
);
}
.slide-bottom-active
{
transform
:
translateY
(
0
);
}
.slide-left-in
{
transform
:
translateX
(
-100%
);
}
.slide-left-active
{
transform
:
translateX
(
0
);
opacity
:
1
;
}
.zoom-in-in
{
transform
:
scale
(
0.8
);
}
.zoom-out-active
{
transform
:
scale
(
1
);
}
.zoom-out-in
{
transform
:
scale
(
1.2
);
}
</
style
>
scan/mixins/common.js
View file @
1097ecea
...
...
@@ -147,7 +147,7 @@ export default {
Object
.
assign
(
header
,
{
// token: app.globalData.token,
token
:
'
393068DF9283B935CC4C37D9ABEF88F39D63941D16243ACA30B04FE7A3F7F2EB
5F433703067DF5142735505C42F58997'
,
token
:
'
9B5E0CC7F6791821267A35C1D83709ED75AEB7A3458073702BEFA64BA9D10D0C
5F433703067DF5142735505C42F58997'
,
pkgName
:
app
.
globalData
.
pkgName
})
...
...
scan/mixins/share.js
View file @
1097ecea
...
...
@@ -16,7 +16,7 @@ export default {
share
:
{
title
:
'3D打印你的专属伴侣,点击立刻拥有她/他!'
,
imageUrl
:
'http://mints-sh.oss-cn-shanghai.aliyuncs.com/userImg/share.jpg'
,
path
:
'/pages/loading?shareId='
+
getApp
().
globalData
.
userId
,
//
path: '/pages/loading?shareId=' + getApp().globalData.userId,
}
}
},
...
...
scan/pages.json
View file @
1097ecea
...
...
@@ -21,7 +21,7 @@
{
"path"
:
"pages/index/index"
,
"style"
:
{
"navigationStyle"
:
"custom"
,
"navigationStyle"
:
"custom"
,
"navigationBarTitleText"
:
"首页"
,
"navigationBarBackgroundColor"
:
"#ffffff"
,
"navigationBarTextStyle"
:
"#black"
...
...
@@ -30,7 +30,7 @@
{
"path"
:
"pages/my/my"
,
"style"
:
{
"navigationStyle"
:
"custom"
,
"navigationStyle"
:
"custom"
,
"navigationBarTitleText"
:
"我的"
,
"navigationBarBackgroundColor"
:
"#ffffff"
,
"navigationBarTextStyle"
:
"black"
//用于配置状态栏的字体颜色
...
...
@@ -45,7 +45,7 @@
},
{
"path"
:
"pages/doc/doc"
,
"style"
:
{
"navigationStyle"
:
"custom"
,
"navigationStyle"
:
"custom"
,
"navigationBarTitleText"
:
"文档"
,
"navigationBarBackgroundColor"
:
"#ffffff"
,
"navigationBarTextStyle"
:
"black"
...
...
@@ -58,7 +58,7 @@
"pages"
:
[{
"path"
:
"vipPay/vipPay"
,
"style"
:
{
"navigationStyle"
:
"custom"
,
"navigationStyle"
:
"custom"
,
"navigationBarTitleText"
:
"会员"
,
"navigationBarBackgroundColor"
:
"#ffffff"
,
"navigationBarTextStyle"
:
"black"
...
...
@@ -69,16 +69,25 @@
"pages"
:
[{
"path"
:
"scan/scan"
,
"style"
:
{
"navigationBarTitleText"
:
"扫描"
,
"navigationStyle"
:
"custom"
,
"navigationBarBackgroundColor"
:
"#ffffff"
,
"navigationBarTextStyle"
:
"black"
}
},
{
"path"
:
"
scan/resul
t"
,
"path"
:
"
edit/edi
t"
,
"style"
:
{
"navigationStyle"
:
"custom"
,
"navigationBarTitleText"
:
"结果"
,
"navigationBarBackgroundColor"
:
"#ffffff"
,
"navigationBarTitleText"
:
"编辑"
,
"navigationStyle"
:
"custom"
,
"navigationBarBackgroundColor"
:
"#2196f3"
,
"navigationBarTextStyle"
:
"black"
}
},
{
"path"
:
"result/result"
,
"style"
:
{
"navigationBarTitleText"
:
"识别结果"
,
"navigationStyle"
:
"custom"
,
"navigationBarBackgroundColor"
:
"#2196f3"
,
"navigationBarTextStyle"
:
"black"
}
}]
...
...
@@ -87,7 +96,7 @@
"pages"
:
[{
"path"
:
"payRecord/payRecord"
,
"style"
:
{
"navigationStyle"
:
"custom"
,
"navigationStyle"
:
"custom"
,
"navigationBarTitleText"
:
"我的订单"
,
"navigationBarBackgroundColor"
:
"#ffffff"
,
"navigationBarTextStyle"
:
"black"
...
...
@@ -117,32 +126,32 @@
"bounce"
:
"none"
,
"scrollIndicator"
:
"none"
}
},
"tabBar"
:
{
"color"
:
"#999"
,
"selectedColor"
:
"#F8425A"
,
"borderStyle"
:
"black"
,
"backgroundColor"
:
"#ffffff"
,
"height"
:
"50px"
,
"fontSize"
:
"16px"
,
"iconWidth"
:
"24px"
,
"spacing"
:
"3px"
,
"list"
:
[{
"pagePath"
:
"pages/index/index"
,
"iconPath"
:
"static/tab/index_unselected.png"
,
"selectedIconPath"
:
"static/tab/index_selected.png"
,
"text"
:
"首页"
},
{
"pagePath"
:
"pages/doc/doc"
,
"iconPath"
:
"static/tab/promote_unselected.png"
,
"selectedIconPath"
:
"static/tab/promote_selected.png"
,
"text"
:
"文档"
},
{
"pagePath"
:
"pages/my/my"
,
"iconPath"
:
"static/tab/my_unselected.png"
,
"selectedIconPath"
:
"static/tab/my_selected.png"
,
"text"
:
"我的"
}]
},
"tabBar"
:
{
"color"
:
"#999"
,
"selectedColor"
:
"#F8425A"
,
"borderStyle"
:
"black"
,
"backgroundColor"
:
"#ffffff"
,
"height"
:
"50px"
,
"fontSize"
:
"16px"
,
"iconWidth"
:
"24px"
,
"spacing"
:
"3px"
,
"list"
:
[{
"pagePath"
:
"pages/index/index"
,
"iconPath"
:
"static/tab/index_unselected.png"
,
"selectedIconPath"
:
"static/tab/index_selected.png"
,
"text"
:
"首页"
},
{
"pagePath"
:
"pages/doc/doc"
,
"iconPath"
:
"static/tab/promote_unselected.png"
,
"selectedIconPath"
:
"static/tab/promote_selected.png"
,
"text"
:
"文档"
},
{
"pagePath"
:
"pages/my/my"
,
"iconPath"
:
"static/tab/my_unselected.png"
,
"selectedIconPath"
:
"static/tab/my_selected.png"
,
"text"
:
"我的"
}]
},
"condition"
:
{
//模式配置,仅开发期间生效
"current"
:
0
,
//当前激活的模式(list
的索引项)
...
...
scan/pages/doc/doc.vue
View file @
1097ecea
...
...
@@ -114,8 +114,8 @@
},
handleChange
(
e
)
{
this
.
tabIndex
=
e
.
value
;
this
.
$refs
.
paging
.
clear
();
this
.
$refs
.
paging
.
reload
();
//
this.$refs.paging.clear();
//
this.$refs.paging.reload();
},
handleDel
()
{
this
.
$refs
.
alertDialog
.
open
();
...
...
scan/pages/index/index.vue
View file @
1097ecea
...
...
@@ -2,22 +2,25 @@
<view
class=
"body"
>
<scroll-view
scroll-y
style=
"height: 100%;"
>
<view
class=
"content"
>
<image
v-if=
"userBean.expireTime
<
=
0
"
style=
"border-radius:10rpx; width: 100%;height: 420rpx;"
@
click=
"handleScan"
src=
"https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg/img/bg_main1.png"
mode=
"scaleToFill"
></image>
<image
v-if=
"userBean.expireTime
<
=
0
"
style=
"border-radius:10rpx; width: 100%;height: 420rpx;"
@
click=
"handleVip"
src=
"https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg/img/bg_main1.png"
mode=
"scaleToFill"
></image>
<view
style=
"font-size: 30rpx;font-weight: 777;margin-top: 20rpx;margin-bottom: 16rpx;margin-left: 40rpx;"
>
热门功能
</view>
<view
style=
"display: flex;flex-direction: row;width: 100%;justify-content:space-between;height: 330rpx;"
>
<image
@
click=
"handleScan
Text
"
style=
"border-radius:10rpx; width: 50%;height: 330rpx;"
<image
@
click=
"handleScan
(0)
"
style=
"border-radius:10rpx; width: 50%;height: 330rpx;"
src=
"https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg/img/bg_main2.png"
mode=
"scaleToFill"
>
</image>
<view
style=
"display: flex;flex-direction: column;width: 50%;justify-content:space-between;margin-left: 10rpx;"
>
<image
@
click=
"handleScan
Excel
"
style=
"border-radius:10rpx; width: 100%;height: 150rpx;"
<image
@
click=
"handleScan
(1)
"
style=
"border-radius:10rpx; width: 100%;height: 150rpx;"
src=
"https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg/img/bg_main3.png"
mode=
"scaleToFill"
>
</image>
<image
@
click=
"handleScanEn"
style=
"border-radius:10rpx; width: 50%;height: 155rpx;margin-top: 10rpx;"
<image
@
click=
"handleScan(3)"
style=
"border-radius:10rpx; width: 50%;height: 155rpx;margin-top: 10rpx;"
src=
"https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg/img/bg_main4.png"
mode=
"scaleToFill"
>
</image>
</view>
...
...
@@ -26,13 +29,19 @@
style=
"font-size: 30rpx;font-weight: 777;margin-top: 80rpx;margin-bottom: 16rpx;margin-left: 40rpx;"
>
其他
</view>
<image
@
click=
"handleDoc"
style=
"border-radius:10rpx; width: 100%;height: 130rpx;"
src=
"https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg/img/bg_main5.png"
mode=
"scaleToFill"
></image>
src=
"https://mints-pkg.oss-cn-beijing.aliyuncs.com/pkg/img/bg_main5.png"
mode=
"scaleToFill"
>
</image>
</view>
</scroll-view>
</view>
</
template
>
<
script
>
import
common
from
'@/mixins/common'
;
import
{
getToLocal
}
from
"@/utils/utils.js"
import
{
navigateTo
,
loading
...
...
@@ -43,36 +52,35 @@
name
:
'index'
,
mixins
:
[
common
],
data
()
{
return
{
return
{
userBean
:
{},
};
},
methods
:
{
onShow
()
{
this
.
post
({
url
:
'/user/baseMsg'
,
showLoading
:
false
,
success
:
({
data
})
=>
{
this
.
userBean
=
data
;
}
this
.
post
({
url
:
'/user/baseMsg'
,
showLoading
:
false
,
success
:
({
data
})
=>
{
this
.
userBean
=
data
;
}
});
},
handleDoc
()
{
uni
.
switchTab
({
url
:
'/pages/doc/doc'
});
},
handleScanText
()
{
navigateTo
(
`/pagesC/scan/scan`
)
},
handleScanExcel
()
{
navigateTo
(
`/pagesC/scan/scan`
)
},
handleScanEn
()
{
navigateTo
(
`/pagesC/scan/scan`
)
},
handleDoc
()
{
uni
.
switchTab
({
url
:
'/pages/doc/doc'
});
}
},
handleVip
()
{
navigateTo
(
`/pagesA/vipPay/vipPay`
)
},
handleScan
(
type
)
{
navigateTo
(
`/pagesC/scan/scan`
,
{
type
:
type
})
},
}
};
</
script
>
...
...
scan/pagesC/edit/edit.vue
0 → 100644
View file @
1097ecea
<
template
>
<view
class=
"wrapper"
>
<view
class=
"show-img"
>
<image
:src=
"imgUri"
mode=
"aspectFit"
></image>
</view>
<view
class=
"item-bottom"
>
<view
class=
"item-bottom-content"
@
click=
"crop"
>
<image
class=
"img"
src=
"../../static/ic_copy.png"
></image>
<text
class=
"text1"
>
裁剪
</text>
</view>
<view
class=
"item-bottom-content"
@
click=
"clickOcr"
>
<image
class=
"img2"
src=
"../../static/ic_scan_ocr.png"
></image>
<text
class=
"text1"
>
识别
</text>
</view>
</view>
</view>
</
template
>
<
script
>
import
common
from
'@/mixins/common'
;
import
{
ScanIndexBean
,
ScanTypeBean
}
from
'@/utils/constant.js'
const
app
=
getApp
();
import
{
navigateTo
}
from
'@/utils/fun'
;
export
default
{
name
:
'edit'
,
mixins
:
[
common
],
data
()
{
return
{
windowWidth
:
''
,
windowHeight
:
''
,
imgUri
:
''
,
type
:
''
};
},
onLoad
(
option
)
{
let
{
windowWidth
,
windowHeight
}
=
uni
.
getSystemInfoSync
()
this
.
windowWidth
=
windowWidth
this
.
windowHeight
=
windowHeight
this
.
imgUri
=
option
.
uri
this
.
type
=
option
.
type
},
methods
:
{
compress
()
{
let
that
=
this
uni
.
compressImage
({
src
:
this
.
imgUri
,
quality
:
80
,
success
:
res
=>
{
console
.
log
(
res
.
tempFilePath
)
that
.
uploadImg
(
res
.
tempFilePath
)
}
})
},
clickOcr
()
{
this
.
compress
()
},
ocr
(
imgUrl
)
{
if
(
this
.
type
==
ScanTypeBean
.
zh
)
{
this
.
fanyi
(
ScanTypeBean
.
zh
,
ScanTypeBean
.
en
,
imgUrl
)
}
else
if
(
this
.
type
==
ScanTypeBean
.
en
)
{
this
.
fanyi
(
ScanTypeBean
.
en
,
ScanTypeBean
.
zh
,
imgUrl
)
}
else
{
this
.
dealImage
(
this
.
type
,
imgUrl
)
}
},
fanyi
(
from
,
to
,
imgUrl
)
{
this
.
post
({
url
:
'/ai/fanyi'
,
data
:
{
from
:
from
,
to
:
to
,
imgUrl
:
imgUrl
},
showLoading
:
true
,
success
:
({
data
})
=>
{
console
.
log
(
data
)
}
});
},
dealImage
(
type
,
imgUrl
)
{
this
.
post
({
url
:
'/ai/dealImage'
,
data
:
{
type
:
type
,
imgUrl
:
imgUrl
},
showLoading
:
true
,
success
:
({
data
})
=>
{
console
.
log
(
data
)
}
});
},
crop
()
{},
uploadImg
(
tempFilePath
)
{
let
that
=
this
uni
.
uploadFile
({
url
:
'https://api.mints-tech.cn/camera-api/api/ai/image/upload'
,
filePath
:
tempFilePath
,
header
:
{
pkgname
:
'com.mints.helivideo'
,
token
:
app
.
globalData
.
token
},
name
:
'file'
,
formData
:
{
"type"
:
this
.
type
},
success
:
(
uploadFileRes
)
=>
{
let
myData
=
JSON
.
parse
(
uploadFileRes
.
data
)
that
.
ocr
(
myData
.
data
.
url
)
}
});
},
goResult
(
result
,
imgUrl
)
{
navigateTo
(
`/pagesC/result/result`
,
{
imgUrl
:
imgUrl
,
result
:
result
})
}
},
}
</
script
>
<
style
lang=
"scss"
>
.wrapper
{
display
:
flex
;
flex-direction
:
column
;
height
:
100%
;
}
.show-img
{
flex
:
1
;
background-color
:
#f0f8ff
;
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
}
.item-bottom
{
background-color
:
#ffffff
;
height
:
165rpx
;
padding-bottom
:
15rpx
;
display
:
flex
;
flex-direction
:
row
;
}
.item-bottom-content
{
display
:
flex
;
flex-direction
:
column
;
flex
:
1
;
align-items
:
center
;
.img
{
margin-top
:
30rpx
;
width
:
50rpx
;
height
:
50rpx
;
}
.img2
{
margin-top
:
30rpx
;
width
:
50rpx
;
height
:
50rpx
;
}
.text1
{
margin-top
:
6rpx
;
color
:
#000000
;
}
}
</
style
>
\ No newline at end of file
scan/pagesC/
scan
/result.vue
→
scan/pagesC/
result
/result.vue
View file @
1097ecea
...
...
@@ -22,25 +22,24 @@
<view
style=
"height: 10%;display: flex;flex-direction: row;background: white;"
>
<view
@
click=
"copy"
style=
"display: flex;flex-direction: column;flex: 1;align-items: center;padding-top: 20rpx;"
>
<image
style=
"width: 30rpx;height: 30rpx;"
src=
"../../static/ic_
selected
.png"
>
<image
style=
"width: 30rpx;height: 30rpx;"
src=
"../../static/ic_
copy
.png"
>
</image>
<view>
复制
</view>
</view>
<
view
@
click=
"myS
hare"
<
button
open-type=
"s
hare"
style=
"display: flex;flex-direction: column;flex: 1;align-items: center;padding-top: 20rpx;"
>
<image
style=
"width: 30rpx;height: 30rpx;"
src=
"../../static/ic_
selected
.png"
>
<image
style=
"width: 30rpx;height: 30rpx;"
src=
"../../static/ic_
copy
.png"
>
</image>
<view>
导出
</view>
</
view
>
</
button
>
</view>
</view>
</view>
</
template
>
<
script
>
import
common
from
'@/mixins/common'
;
import
common
from
'@/mixins/common'
;
const
app
=
getApp
();
export
default
{
...
...
@@ -50,6 +49,7 @@
return
{
windowWidth
:
''
,
windowHeight
:
''
,
result
:
''
,
dataList
:
[
"AAAAAAAA"
,
"AAAAAAAA"
,
...
...
@@ -66,70 +66,39 @@
]
};
},
onLoad
()
{
onLoad
(
option
)
{
let
{
windowWidth
,
windowHeight
}
=
uni
.
getSystemInfoSync
()
this
.
windowWidth
=
windowWidth
this
.
windowHeight
=
windowHeight
this
.
result
=
option
.
result
this
.
dataList
=
this
.
result
.
split
(
'
\
n'
)
},
onShareAppMessage
()
{
return
{
title
:
'全能扫描MAX'
,
summary
:
this
.
result
,
success
()
{
console
.
log
(
'分享成功'
);
},
fail
(
err
)
{
console
.
error
(
'分享失败'
,
err
);
}
};
},
methods
:
{
copy
()
{
var
text
=
''
uni
.
setClipboardData
({
data
:
t
ex
t
,
data
:
t
his
.
resul
t
,
complete
()
{
uni
.
showToast
({
title
:
"已复制到剪贴板"
})
}
})
},
myShare
()
{
// var msg = {
// content: '分享内容',
// type: 'text'
// };
// plus.share.sendWithSystem(msg, function() {
// console.log('分享成功');
// }, function(e) {
// console.log('分享失败:' + JSON.stringify(e));
// });
// uni.share({
// provider: "weixin",
// scene: "WXSceneSession",
// type: 1,
// summary: "-",
// success: function (res) {
// console.log("success:" + JSON.stringify(res));
// },
// fail: function (err) {
// console.log("fail:" + JSON.stringify(err));
// }
// });
uni
.
shareWithSystem
({
summary
:
'AAAA'
,
success
()
{
// 分享完成,请注意此时不一定是成功分享
},
fail
()
{
// 分享失败
}
})
// share.share({
// type: 'text/html',
// data: '
<
b
>
bold
<
/b>',
// success: function(data) {
// console.log('handling success')
// },
// fail: function(data, code) {
// console.log(`handling fail, code = ${code}`)
// }
// })
}
},
}
...
...
scan/pagesC/scan/scan.vue
View file @
1097ecea
<
template
>
<view
class=
"body"
:style=
'
{width:windowWidth+"px",height:windowHeight+"px"}'>
<camera
resolution=
"high"
device-position=
"back"
flash=
"off"
@
error=
"error"
@
initdone=
"initdone"
style=
"position:relative;"
:style=
'
{width:windowWidth+"px",height:(windowHeight/1.3)+"px"}' />
<view
class=
"body"
:style=
"'width:'+windowWidth+'px;height:'+windowHeight+'px;'"
>
<camera
id=
"camera"
resolution=
"high"
device-position=
"back"
flash=
"off"
@
error=
"error"
@
initdone=
"initdone"
:style=
"'position:relative;width:'+windowWidth+'px;height:'+Number(windowHeight*0.7)+'px;'"
/>
<view
:style=
"'display: flex;flex-direction: column;width:'+windowWidth+'px;height:'+Number(windowHeight*0.3)+'px;'"
>
<view
style=
"display: flex;flex-direction: column;"
:style=
'
{width:windowWidth+"px",height:(windowHeight/1.7)+"px"}'>
<view
style=
"display: flex;height: 10%;"
>
<view
:style=
"'display: flex;height:'+Number(windowHeight*0.1)+'px;'"
>
<block
v-for=
"(item, index) in tabs"
:key=
"index"
>
<view
class=
"flex"
style=
"
width: 25%
;"
@
click=
"clickItem(index)"
>
<view
class=
"flex"
style=
"
margin:0 20rpx
;"
@
click=
"clickItem(index)"
>
<view
class=
"font"
>
{{
item
.
name
}}
</view>
<view
v-if=
"current==index"
style=
"width: 10rpx;height: 10rpx;background: red;border-radius: 10rpx;margin: 0 auto;"
>
...
...
@@ -16,35 +15,40 @@
</view>
</block>
</view>
<view
style=
" display: flex;height: 20%;
"
>
<view
:style=
"'display: flex;height:'+Number(windowHeight*0.2)+'px;'
"
>
<view
class=
"icon_flex"
@
click=
"openAlbum"
>
<image
class=
"img"
mode=
"aspectFit"
src=
"../../static/ic_photo.png"
/>
<image
mode=
"aspectFit"
src=
"../../static/ic_photo.png"
/>
<view
class=
"font"
>
相册
</view>
</view>
<view
class=
"icon_flex"
@
click=
"takePhoto"
>
<image
class=
"img"
mode=
"aspectFit"
src=
"../../static/ic_take_photo.png"
/>
<image
mode=
"aspectFit"
src=
"../../static/ic_take_photo.png"
/>
<view
class=
"font"
>
拍照
</view>
</view>
<view
class=
"icon_flex"
@
click=
"openAlbum"
>
<image
class=
"img"
mode=
"aspectFit"
src=
"../../static/ic_scan_ocr.png"
/>
<
!--
<
view
class=
"icon_flex"
@
click=
"openAlbum"
>
<image
mode=
"aspectFit"
src=
"../../static/ic_scan_ocr.png"
/>
<view
class=
"font"
>
识别
</view>
</view>
</view>
-->
</view>
</view>
<image
class=
"img"
style=
"position: absolute;top: 60rpx;left: 60rpx;z-index: 999;"
<image
v-if=
"false"
class=
"img"
style=
"position: absolute;top: 60rpx;left: 60rpx;z-index: 999;"
src=
"../../static/ic_close.png"
@
click=
"close"
/>
</view>
</
template
>
<
script
>
import
common
from
'@/mixins/common'
;
import
{
ScanIndexBean
,
ScanTypeBean
}
from
'@/utils/constant.js'
import
{
imageCompress
}
from
"@/utils/utils.js"
import
{
navigateTo
,
navigateBack
,
reLaunch
}
from
'@/utils/fun'
;
...
...
@@ -70,33 +74,61 @@
}]
}
},
onLoad
()
{
onLoad
(
option
)
{
let
{
windowWidth
,
windowHeight
}
=
uni
.
getSystemInfoSync
()
this
.
windowWidth
=
windowWidth
this
.
windowHeight
=
windowHeight
this
.
current
=
option
.
type
},
methods
:
{
takePhoto
()
{
takePhoto
()
{
let
that
=
this
// #ifdef MP-ALIPAY
let
cameraContext
=
my
.
createCameraContext
(
'camera'
);
cameraContext
.
takePhoto
({
quality
:
'high'
,
success
(
res
)
{
console
.
log
(
res
);
navigateTo
(
`/pagesC/edit/edit`
,
{
uri
:
res
.
tempImagePath
,
type
:
that
.
current
})
},
fail
(
err
)
{},
});
// #endif
// #ifndef MP-ALIPAY
const
ctx
=
uni
.
createCameraContext
();
let
that
=
this
ctx
.
takePhoto
({
quality
:
'high'
,
success
:
(
res
)
=>
{
this
.
src
=
res
.
tempImagePath
console
.
log
(
res
.
tempImagePath
)
navigateTo
(
`/pagesC/edit/edit`
,
{
uri
:
res
.
tempImagePath
,
type
:
that
.
current
})
}
});
// #endif
},
openAlbum
()
{
cons
t
that
=
this
le
t
that
=
this
uni
.
chooseImage
({
count
:
1
,
sizeType
:
[
'original'
,
'compressed'
],
sourceType
:
[
"album"
],
success
:
(
res
)
=>
{
console
.
log
(
res
.
tempFilePaths
[
0
],
'-------------175'
)
navigateTo
(
`/pagesC/edit/edit`
,
{
uri
:
res
.
tempFilePaths
,
type
:
that
.
current
})
}
});
},
...
...
@@ -124,62 +156,6 @@
clickItem
(
index
)
{
this
.
current
=
index
},
async
uploadFile
(
file
,
index
)
{
const
currentIndex
=
this
.
mediaList
.
findIndex
(
v
=>
v
.
path
===
file
.
path
);
let
compressFile
=
await
imageCompress
(
file
)
let
that
=
this
that
.
mediaList
[
currentIndex
].
status
=
'upload'
return
new
Promise
((
resolve
,
reject
)
=>
{
uni
.
uploadFile
({
url
:
app
.
globalData
.
baseUrl
+
'/app/uploadImgNotCensor'
,
filePath
:
compressFile
.
tempFilePath
?
compressFile
.
tempFilePath
:
compressFile
.
path
,
fileType
:
"image"
,
name
:
'file'
,
formData
:
{
session
:
app
.
globalData
.
token
},
success
:
(
uploadFileRes
)
=>
{
let
res
=
JSON
.
parse
(
uploadFileRes
.
data
)
if
(
res
.
data
!=
null
&&
res
.
code
==
'200'
)
{
that
.
mediaList
[
currentIndex
].
url
=
file
.
path
that
.
mediaList
[
currentIndex
].
fileID
=
res
.
data
.
imgUrl
// if (currentIndex == 0) {
// that.form.media = res.data.imgUrl
// } else {
// that.form.media += (',' + res.data.imgUrl)
// }
resolve
()
}
else
{
that
.
$refs
.
fileImage
.
clearFiles
(
currentIndex
)
that
.
mediaList
.
splice
(
currentIndex
,
1
);
reject
()
loading
.
hide
();
alert
({
content
:
res
.
errorMsg
||
res
.
msg
})
}
},
fail
:
e
=>
{
that
.
mediaList
.
splice
(
currentIndex
,
1
);
that
.
$refs
.
fileImage
.
clearFiles
(
currentIndex
)
reject
()
alert
(
e
)
loading
.
hide
();
}
});
})
},
}
}
</
script
>
...
...
@@ -196,7 +172,7 @@
.font
{
text-align
:
center
;
font-size
:
26
rpx
;
font-size
:
30
rpx
;
color
:
white
;
margin-top
:
30rpx
;
}
...
...
@@ -208,5 +184,9 @@
align-items
:
center
;
margin-top
:
50rpx
;
image
{
width
:
80rpx
;
height
:
80rpx
;
}
}
</
style
>
\ No newline at end of file
scan/static/ic_copy.png
0 → 100644
View file @
1097ecea
851 Bytes
scan/static/ic_scan_ocr.png
View replaced file @
2e17614b
View file @
1097ecea
720 Bytes
|
W:
|
H:
775 Bytes
|
W:
|
H:
2-up
Swipe
Onion skin
scan/utils/constant.js
0 → 100644
View file @
1097ecea
export
const
ScanIndexBean
=
{
// 通用文字识别
SCAN_INDEX_0
:
0
,
// 表格识别
SCAN_INDEX_1
:
1
,
// 中文识别
SCAN_INDEX_2
:
2
,
// 英文识别
SCAN_INDEX_3
:
3
}
export
const
ScanTypeBean
=
{
// 全部
all
:
"all"
,
// 通用文字识别(高精度) -> 拍照取字
accurate_basic
:
"accurate_basic"
,
// 表格识别
scan_excel
:
"img_to_excel"
,
// 中文
zh
:
"zh"
,
// 英文
en
:
"en"
,
// 翻译
fanyi
:
"fanyi"
,
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment