Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx
/
gl_tape
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
3
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit b9e93296
authored
Jun 27, 2024
by
前端
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
oss
1 parent
53e6417f
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
358 additions
and
227 deletions
App.vue
components/HomeFrame/index.vue
hybrid/html/index.html
hybrid/html/js/OSSUpLoader.js
main.js
mixin/click.js
mixin/storge.js
pages/equity/index.vue
utils/ossUploadFile/uploadFile.js
App.vue
View file @
b9e9329
...
@@ -7,12 +7,14 @@
...
@@ -7,12 +7,14 @@
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
-->
<
script
>
<
script
>
var
wv
;
import
checkUpdate
from
"@/uni_modules/uni-upgrade-center-app/utils/check-update-nvue.js"
;
import
checkUpdate
from
"@/uni_modules/uni-upgrade-center-app/utils/check-update-nvue.js"
;
import
{
mapState
}
from
"vuex"
;
import
{
mapState
}
from
"vuex"
;
export
default
{
export
default
{
computed
:
{
computed
:
{
...
mapState
(
"audio"
,
[
"isEnd"
,
"isStart"
]),
...
mapState
(
"audio"
,
[
"isEnd"
,
"isStart"
]),
},
},
onLoad
()
{},
onLaunch
:
async
function
()
{
onLaunch
:
async
function
()
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
plus
.
screen
.
unlockOrientation
();
//解除锁定屏幕方向
plus
.
screen
.
unlockOrientation
();
//解除锁定屏幕方向
...
@@ -41,6 +43,9 @@ export default {
...
@@ -41,6 +43,9 @@ export default {
</
script
>
</
script
>
<
style
lang=
"scss"
>
<
style
lang=
"scss"
>
body
{
overflow
:
hidden
;
}
page
{
page
{
font-size
:
28
rpx
;
font-size
:
28
rpx
;
height
:
100%
;
height
:
100%
;
...
@@ -102,4 +107,11 @@ button::after {
...
@@ -102,4 +107,11 @@ button::after {
.button-hover
{
.button-hover
{
transform
:
translate
(
1
rpx
,
1
rpx
);
transform
:
translate
(
1
rpx
,
1
rpx
);
}
}
.webview-container
{
position
:
absolute
;
width
:
100
rpx
;
height
:
100
rpx
;
top
:
0
rpx
;
left
:
0
rpx
;
}
</
style
>
</
style
>
components/HomeFrame/index.vue
View file @
b9e9329
<
template
>
<
template
>
<view
<view
class=
"container"
@
click=
"handleTouchStart"
>
class=
"container"
@
click=
"handleTouchStart"
>
<view
:class=
"['home',
{ show: !id }]">
<view
:class=
"['home',
{ show: !id }]">
<view
class=
"bg"
>
<view
class=
"bg"
>
<view
class=
"top"
>
<view
class=
"top"
>
<view
<view
class=
"top-one"
:style=
"randomize"
></view>
class=
"top-one"
:style=
"randomize"
></view>
</view>
</view>
<view
class=
"bottom"
>
<view
class=
"bottom"
>
<view
<view
class=
"bottom-one"
:style=
"randomize"
></view>
class=
"bottom-one"
<view
class=
"bottom-two"
:style=
"randomize"
></view>
:style=
"randomize"
<view
class=
"bottom-three"
:style=
"randomize"
></view>
></view>
<view
class=
"bottom-two"
:style=
"randomize"
></view>
<view
class=
"bottom-three"
:style=
"randomize"
></view>
</view>
</view>
</view>
</view>
<view
class=
"left-side"
>
<view
class=
"left-side"
>
...
@@ -39,26 +24,22 @@
...
@@ -39,26 +24,22 @@
@click="changeIndex(index)"
@click="changeIndex(index)"
>
>
<view
class=
"icon-box"
>
<view
class=
"icon-box"
>
<view
:class=
"[
<view
:class=
"[
'sprite-icon',
'sprite-icon',
`icon-$
{i.icon}${tabIndex == index ? '-active' : ''}`,
`icon-$
{i.icon}${tabIndex == index ? '-active' : ''}`,
]">
</view>
]"
>
</view>
</view>
</view>
{{
i
.
label
}}
{{
i
.
label
}}
</view>
</view>
</
template
>
</
template
>
</view>
</view>
<view
class=
"left-footer"
>
<view
class=
"left-footer"
>
<view
<view
class=
"btn"
@
click=
"$refs.kfRef.open()"
>
class=
"btn"
@
click=
"$refs.kfRef.open()"
>
<view
class=
"sprite-icon icon-feedback"
></view>
<view
class=
"sprite-icon icon-feedback"
></view>
</view>
</view>
<view
<view
class=
"btn"
@
click=
"$refs.settingRef.open()"
>
class=
"btn"
@
click=
"$refs.settingRef.open()"
>
<view
class=
"sprite-icon icon-setting"
></view>
<view
class=
"sprite-icon icon-setting"
></view>
</view>
</view>
</view>
</view>
...
@@ -66,10 +47,7 @@
...
@@ -66,10 +47,7 @@
<view
class=
"right-side"
>
<view
class=
"right-side"
>
<
template
v-if=
"tabIndex == 0"
>
<
template
v-if=
"tabIndex == 0"
>
<view
class=
"right-content"
>
<view
class=
"right-content"
>
<view
<view
class=
"start"
@
click=
"$emit('start')"
>
class=
"start"
@
click=
"$emit('start')"
>
<image
<image
class=
"start-btn"
class=
"start-btn"
src=
"../../assets/images/home/start.gif"
src=
"../../assets/images/home/start.gif"
...
@@ -121,21 +99,13 @@
...
@@ -121,21 +99,13 @@
:isFooter=
"false"
:isFooter=
"false"
>
>
<view
class=
"footer"
>
<view
class=
"footer"
>
<view
<view
class=
"footer-btn confirm flex"
@
click=
"$emit('openStep')"
>
class=
"footer-btn confirm flex"
@
click=
"$emit('openStep')"
>
<
template
v-if=
"finishDoneText"
>
<
template
v-if=
"finishDoneText"
>
{{
finishDoneText
}}
{{
finishDoneText
}}
</
template
>
<
template
v-else
>
完成接待
<text>
(推荐)
</text>
</
template
>
</
template
>
<
template
v-else
>
完成接待
<text>
(推荐)
</text>
</
template
>
</view>
</view>
<view
<view
class=
"footer-btn cancel flex"
@
click=
"$emit('backHome')"
>
class=
"footer-btn cancel flex"
@
click=
"$emit('backHome')"
>
仍要退出
<text>
(不推荐)
</text>
仍要退出
<text>
(不推荐)
</text>
</view>
</view>
</view>
</view>
...
@@ -145,10 +115,7 @@
...
@@ -145,10 +115,7 @@
<!-- 客服弹框 -->
<!-- 客服弹框 -->
<kf-box
ref=
"kfRef"
/>
<kf-box
ref=
"kfRef"
/>
<!-- 设置弹框 -->
<!-- 设置弹框 -->
<setting-box
<setting-box
ref=
"settingRef"
@
stopAudio=
"stopAudio"
/>
ref=
"settingRef"
@
stopAudio=
"stopAudio"
/>
<slot
name=
"content"
/>
<slot
name=
"content"
/>
</view>
</view>
</template>
</template>
...
@@ -165,10 +132,10 @@ export default {
...
@@ -165,10 +132,10 @@ export default {
finishDoneText
:
String
,
finishDoneText
:
String
,
finishContene
:
{
finishContene
:
{
type
:
String
,
type
:
String
,
default
:
'当前操作视为强制退出接待,若需正常流程完成接待请点击“完成接待”'
default
:
"当前操作视为强制退出接待,若需正常流程完成接待请点击“完成接待”"
,
}
},
},
data
()
{
},
data
()
{
return
{
return
{
userInfo
:
{},
userInfo
:
{},
tabs
:
[
tabs
:
[
...
@@ -182,18 +149,18 @@ export default {
...
@@ -182,18 +149,18 @@ export default {
},
},
],
],
tabIndex
:
0
,
tabIndex
:
0
,
dateKey
:
null
dateKey
:
null
,
};
};
},
},
mounted
()
{
mounted
()
{
const
userInfo
=
uni
.
$storage
.
get
(
"userInfo"
)
||
{};
const
userInfo
=
uni
.
$storage
.
get
(
"userInfo"
)
||
{};
this
.
userInfo
=
userInfo
this
.
userInfo
=
userInfo
;
setInterval
(()
=>
{
setInterval
(()
=>
{
this
.
dateKey
=
Date
.
now
();
this
.
dateKey
=
Date
.
now
();
},
5
e3
);
},
5
e3
);
},
},
computed
:
{
computed
:
{
randomize
()
{
randomize
()
{
let
{
dateKey
}
=
this
;
let
{
dateKey
}
=
this
;
const
maxX
=
uni
.
getSystemInfoSync
().
windowWidth
-
300
,
const
maxX
=
uni
.
getSystemInfoSync
().
windowWidth
-
300
,
maxY
=
uni
.
getSystemInfoSync
().
windowHeight
-
100
,
maxY
=
uni
.
getSystemInfoSync
().
windowHeight
-
100
,
...
@@ -201,18 +168,18 @@ export default {
...
@@ -201,18 +168,18 @@ export default {
y
=
Math
.
floor
(
Math
.
random
()
*
maxY
);
y
=
Math
.
floor
(
Math
.
random
()
*
maxY
);
return
`transform:translate(
${
x
}
px,
${
y
}
px);
${
dateKey
}
;`
;
return
`transform:translate(
${
x
}
px,
${
y
}
px);
${
dateKey
}
;`
;
},
},
previewRef
()
{
previewRef
()
{
return
this
.
$refs
.
previewRef
return
this
.
$refs
.
previewRef
;
},
finishRef
()
{
return
this
.
$refs
.
finish
;
},
},
finishRef
()
{
return
this
.
$refs
.
finish
}
},
},
methods
:
{
methods
:
{
changeIndex
(
index
)
{
changeIndex
(
index
)
{
if
(
this
.
tabIndex
==
index
)
return
if
(
this
.
tabIndex
==
index
)
return
;
this
.
tabIndex
=
index
;
this
.
tabIndex
=
index
;
this
.
$emit
(
"changeTab"
,
index
)
this
.
$emit
(
"changeTab"
,
index
)
;
},
},
},
},
};
};
...
...
hybrid/html/index.html
View file @
b9e9329
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
<html>
<html>
<head>
<head>
<meta
charset=
"utf-8"
/>
<meta
charset=
"utf-8"
/>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
/
>
<title>
file upload oss
</title>
<title>
file upload oss
</title>
</head>
</head>
<body>
<body>
...
@@ -11,23 +11,37 @@
...
@@ -11,23 +11,37 @@
<script
src=
"js/OSSUpLoader.js"
></script>
<script
src=
"js/OSSUpLoader.js"
></script>
<script>
<script>
// document.addEventListener('UniAppJSBridgeReady', function(){
// document.addEventListener('UniAppJSBridgeReady', function(){
window
.
msgFromUniapp
=
function
(
accessKeyId
,
accessKeySecret
,
stsToken
,
fileName
,
options
=
{})
{
window
.
msgFromUniapp
=
function
(
accessKeyId
,
accessKeySecret
,
stsToken
,
fileName
,
filePath
,
options
=
{}
)
{
console
.
log
(
options
);
if
(
!
accessKeyId
||
!
accessKeySecret
||
!
stsToken
||
!
fileName
)
{
if
(
!
accessKeyId
||
!
accessKeySecret
||
!
stsToken
||
!
fileName
)
{
throw
new
Error
(
'accessKeyId,accessKeySecret,stsToken,fileName is required'
)
throw
new
Error
(
"accessKeyId,accessKeySecret,stsToken,fileName is required"
);
}
}
const
opt
=
Object
.
assign
({
accessKeyId
,
accessKeySecret
,
stsToken
},
options
)
console
.
log
(
fileName
);
let
uploader
=
new
OSSUpLoader
(
opt
)
const
opt
=
Object
.
assign
(
uploader
.
upload
(
fileName
,
function
(
result
)
{
{
accessKeyId
,
accessKeySecret
,
stsToken
,
filePath
},
options
);
let
uploader
=
new
OSSUpLoader
(
opt
);
uploader
.
upload
(
fileName
,
function
(
result
)
{
uni
.
postMessage
({
uni
.
postMessage
({
data
:
{
data
:
{
...
result
,
...
result
,
fileName
fileName
,
}
},
});
});
uploader
.
destroy
()
uploader
.
destroy
();
uploader
=
null
uploader
=
null
;
})
});
}
};
// }, false);
// }, false);
</script>
</script>
</body>
</body>
...
...
hybrid/html/js/OSSUpLoader.js
View file @
b9e9329
...
@@ -6,7 +6,7 @@ class OSSUpLoader {
...
@@ -6,7 +6,7 @@ class OSSUpLoader {
/**
/**
* 填写Bucket名称。
* 填写Bucket名称。
*/
*/
bucket
=
'glsk-oss'
;
bucket
=
"glsk-oss"
;
/**
/**
* 文件类型
* 文件类型
*/
*/
...
@@ -14,7 +14,10 @@ class OSSUpLoader {
...
@@ -14,7 +14,10 @@ class OSSUpLoader {
/**
/**
* 本地保存文件路径(待上传文件路径)
* 本地保存文件路径(待上传文件路径)
*/
*/
filePath
=
'file:///storage/emulated/0/Android/data/io.dcloud.HBuilder/apps/HBuilder/doc/'
// filePath =
// "file:///storage/emulated/0/Android/data/uni.gltap/apps/__UNI__D3BD3DF/doc/uniapp_save/";
filePath
=
"file:///storage/emulated/0/Android/data/io.dcloud.HBuilder/apps/HBuilder/doc/uniapp_save/"
;
/**
/**
* 从STS服务获取的临时访问密钥(AccessKey ID和AccessKey Secret)。
* 从STS服务获取的临时访问密钥(AccessKey ID和AccessKey Secret)。
*/
*/
...
@@ -63,12 +66,12 @@ class OSSUpLoader {
...
@@ -63,12 +66,12 @@ class OSSUpLoader {
/**
/**
* 失败重传间隔
* 失败重传间隔
*/
*/
retryInterval
=
3
*
1000
retryInterval
=
3
*
1000
;
currentCheckpoint
;
currentCheckpoint
;
/**
/**
* OSS文件夹
* OSS文件夹
*/
*/
ossFolder
=
'quality/'
;
ossFolder
=
"quality/"
;
/**
/**
* 构造函数
* 构造函数
*/
*/
...
@@ -85,18 +88,18 @@ class OSSUpLoader {
...
@@ -85,18 +88,18 @@ class OSSUpLoader {
filePath
=
this
.
filePath
,
filePath
=
this
.
filePath
,
retryCountMax
=
this
.
retryCountMax
,
retryCountMax
=
this
.
retryCountMax
,
retryInterval
=
this
.
retryInterval
,
retryInterval
=
this
.
retryInterval
,
ossFolder
=
this
.
ossFolder
ossFolder
=
this
.
ossFolder
,
})
{
})
{
if
(
partSize
&&
partSize
<
this
.
minPartSize
)
{
if
(
partSize
&&
partSize
<
this
.
minPartSize
)
{
throw
new
Error
(
common
.
constants
.
CODE
.
FILE_PART_SIZE_TOO_SMALL
)
throw
new
Error
(
common
.
constants
.
CODE
.
FILE_PART_SIZE_TOO_SMALL
);
}
}
this
.
mime
=
mime
this
.
mime
=
mime
;
this
.
partSize
=
partSize
this
.
partSize
=
partSize
;
this
.
parallel
=
parallel
this
.
parallel
=
parallel
;
this
.
filePath
=
filePath
this
.
filePath
=
filePath
;
this
.
retryCountMax
=
retryCountMax
this
.
retryCountMax
=
retryCountMax
;
this
.
retryInterval
=
retryInterval
this
.
retryInterval
=
retryInterval
;
this
.
ossFolder
=
ossFolder
this
.
ossFolder
=
ossFolder
;
//实例化OSS
//实例化OSS
this
.
client
=
new
OSS
({
this
.
client
=
new
OSS
({
region
,
region
,
...
@@ -111,13 +114,17 @@ class OSSUpLoader {
...
@@ -111,13 +114,17 @@ class OSSUpLoader {
* @param {Object} callback 回调函数
* @param {Object} callback 回调函数
*/
*/
upload
(
fileName
,
callback
)
{
upload
(
fileName
,
callback
)
{
this
.
_pathToFile
(
this
.
filePath
+
fileName
,
function
(
result
)
{
console
.
log
(
this
.
filePath
+
fileName
);
this
.
_pathToFile
(
this
.
filePath
+
fileName
,
function
(
result
)
{
if
(
result
.
code
===
common
.
constants
.
CODE
.
FILE_PATH_TRANSFORM_SUCCESS
)
{
if
(
result
.
code
===
common
.
constants
.
CODE
.
FILE_PATH_TRANSFORM_SUCCESS
)
{
this
.
_upload
(
fileName
,
result
.
data
.
file
,
callback
)
this
.
_upload
(
fileName
,
result
.
data
.
file
,
callback
);
}
else
{
}
else
{
callback
(
result
)
callback
(
result
);
}
}
}.
bind
(
this
))
}.
bind
(
this
)
);
}
}
/**文件上传(内部方法)
/**文件上传(内部方法)
* @param {Object} fileName 文件名
* @param {Object} fileName 文件名
...
@@ -125,7 +132,9 @@ class OSSUpLoader {
...
@@ -125,7 +132,9 @@ class OSSUpLoader {
* @param {Object} callback 回调函数
* @param {Object} callback 回调函数
*/
*/
_upload
(
fileName
,
file
,
callback
)
{
_upload
(
fileName
,
file
,
callback
)
{
this
.
client
.
multipartUpload
(
this
.
ossFolder
+
fileName
,
file
,
{
console
.
log
(
fileName
,
file
);
this
.
client
.
multipartUpload
(
this
.
ossFolder
+
fileName
,
file
,
{
// 获取分片上传进度、断点和返回值。
// 获取分片上传进度、断点和返回值。
progress
:
(
p
,
checkpoint
,
res
)
=>
{
progress
:
(
p
,
checkpoint
,
res
)
=>
{
this
.
currentCheckpoint
=
checkpoint
;
this
.
currentCheckpoint
=
checkpoint
;
...
@@ -137,23 +146,28 @@ class OSSUpLoader {
...
@@ -137,23 +146,28 @@ class OSSUpLoader {
partSize
:
1024
*
this
.
partSize
,
partSize
:
1024
*
this
.
partSize
,
timeout
:
this
.
timeout
,
timeout
:
this
.
timeout
,
mime
:
this
.
mime
,
mime
:
this
.
mime
,
}).
then
((
res
)
=>
{
})
.
then
((
res
)
=>
{
// console.log(JSON.stringify(res),res.status,res.status==200)
// console.log(JSON.stringify(res),res.status,res.status==200)
if
(
res
.
res
.
statusCode
==
200
)
{
if
(
res
.
res
.
statusCode
==
200
)
{
// console.log('upload success: %j', JSON.stringify(res));
// console.log('upload success: %j', JSON.stringify(res));
this
.
currentCheckpoint
=
null
;
this
.
currentCheckpoint
=
null
;
this
.
retryCount
=
0
this
.
retryCount
=
0
;
callback
(
common
.
genCallBacks
(
'FILE_UPLOAD_OSS_SUCCESS'
,
{
callback
(
errFromOSS
:
res
common
.
genCallBacks
(
"FILE_UPLOAD_OSS_SUCCESS"
,
{
}))
errFromOSS
:
res
,
})
);
}
else
{
}
else
{
callback
(
common
.
genCallBacks
(
'FILE_UPLOAD_OSS_FAIL'
,
{
callback
(
common
.
genCallBacks
(
"FILE_UPLOAD_OSS_FAIL"
,
{
errMsg
:
`OSS返回错误 状态码:
${
res
.
status
}
`
,
errMsg
:
`OSS返回错误 状态码:
${
res
.
status
}
`
,
errFromOSS
:
res
errFromOSS
:
res
,
}))
})
);
}
}
})
}).
catch
(
err
=>
{
.
catch
((
err
)
=>
{
console
.
error
(
err
);
console
.
error
(
err
);
console
.
log
(
`err.name :
${
err
.
name
}
`
);
console
.
log
(
`err.name :
${
err
.
name
}
`
);
console
.
log
(
`err.message :
${
err
.
message
}
`
);
console
.
log
(
`err.message :
${
err
.
message
}
`
);
...
@@ -164,15 +178,17 @@ class OSSUpLoader {
...
@@ -164,15 +178,17 @@ class OSSUpLoader {
console
.
error
(
`retryCount :
${
this
.
retryCount
}
`
);
console
.
error
(
`retryCount :
${
this
.
retryCount
}
`
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
_upload
(
fileName
,
file
,
callback
);
this
.
_upload
(
fileName
,
file
,
callback
);
},
this
.
retryInterval
)
},
this
.
retryInterval
);
}
else
{
}
else
{
callback
(
common
.
genCallBacks
(
'FILE_UPLOAD_OSS_TIMEOUT_OR_OTHER'
,
{
callback
(
common
.
genCallBacks
(
"FILE_UPLOAD_OSS_TIMEOUT_OR_OTHER"
,
{
errMsg
:
err
.
message
,
errMsg
:
err
.
message
,
err
err
,
}))
})
);
}
}
// }
// }
})
});
}
}
/**将文件路径转成文件对象
/**将文件路径转成文件对象
...
@@ -184,29 +200,33 @@ class OSSUpLoader {
...
@@ -184,29 +200,33 @@ class OSSUpLoader {
var
xhr
=
new
XMLHttpRequest
();
var
xhr
=
new
XMLHttpRequest
();
xhr
.
open
(
"GET"
,
filePath
,
true
);
xhr
.
open
(
"GET"
,
filePath
,
true
);
xhr
.
responseType
=
"blob"
;
xhr
.
responseType
=
"blob"
;
xhr
.
onload
=
function
()
{
xhr
.
onload
=
function
()
{
if
(
this
.
status
==
200
)
{
if
(
this
.
status
==
200
)
{
var
file
=
this
.
response
var
file
=
this
.
response
;
callback
(
common
.
genCallBacks
(
'FILE_PATH_TRANSFORM_SUCCESS'
,
{
callback
(
file
common
.
genCallBacks
(
"FILE_PATH_TRANSFORM_SUCCESS"
,
{
}))
file
,
})
);
}
else
{
}
else
{
callback
(
common
.
genCallBacks
(
'FILE_PATH_TRANSFORM_FAIL'
))
callback
(
common
.
genCallBacks
(
"FILE_PATH_TRANSFORM_FAIL"
));
}
}
};
};
xhr
.
onerror
=
function
(
errType
,
errMsg
)
{
xhr
.
onerror
=
function
(
errType
,
errMsg
)
{
callback
(
common
.
genCallBacks
(
'FILE_PATH_REQUEST_FAIL'
,
{
callback
(
common
.
genCallBacks
(
"FILE_PATH_REQUEST_FAIL"
,
{
errType
,
errType
,
errMsg
errMsg
,
}))
})
);
};
};
xhr
.
send
();
xhr
.
send
();
}
}
destroy
()
{
destroy
()
{
this
.
retryCount
=
0
this
.
retryCount
=
0
;
this
.
client
=
null
this
.
client
=
null
;
}
}
}
;
}
const
common
=
{
const
common
=
{
constants
:
{
constants
:
{
...
@@ -216,28 +236,24 @@ const common = {
...
@@ -216,28 +236,24 @@ const common = {
FILE_PATH_TRANSFORM_FAIL
:
2
,
FILE_PATH_TRANSFORM_FAIL
:
2
,
FILE_UPLOAD_OSS_SUCCESS
:
0
,
FILE_UPLOAD_OSS_SUCCESS
:
0
,
FILE_UPLOAD_OSS_FAIL
:
3
,
FILE_UPLOAD_OSS_FAIL
:
3
,
FILE_UPLOAD_OSS_TIMEOUT_OR_OTHER
:
4
FILE_UPLOAD_OSS_TIMEOUT_OR_OTHER
:
4
,
},
},
MESSAGE
:
{
MESSAGE
:
{
FILE_PATH_TRANSFORM_SUCCESS
:
'文件转换成功'
,
FILE_PATH_TRANSFORM_SUCCESS
:
"文件转换成功"
,
FILE_PATH_REQUEST_FAIL
:
'文件转换请求失败'
,
FILE_PATH_REQUEST_FAIL
:
"文件转换请求失败"
,
FILE_PATH_TRANSFORM_FAIL
:
'文件转换失败'
,
FILE_PATH_TRANSFORM_FAIL
:
"文件转换失败"
,
FILE_UPLOAD_OSS_SUCCESS
:
'文件上传至OSS成功'
,
FILE_UPLOAD_OSS_SUCCESS
:
"文件上传至OSS成功"
,
FILE_UPLOAD_OSS_FAIL
:
'文件上传至OSS失败'
,
FILE_UPLOAD_OSS_FAIL
:
"文件上传至OSS失败"
,
FILE_UPLOAD_OSS_TIMEOUT_OR_OTHER
:
'文件上传至OSS超时或其他错误'
,
FILE_UPLOAD_OSS_TIMEOUT_OR_OTHER
:
"文件上传至OSS超时或其他错误"
,
FILE_PART_SIZE_TOO_SMALL
:
'分片大小不能小于100kb'
FILE_PART_SIZE_TOO_SMALL
:
"分片大小不能小于100kb"
,
}
},
},
},
genCallBacks
(
key
,
data
=
{})
{
genCallBacks
(
key
,
data
=
{})
{
const
{
const
{
CODE
,
MESSAGE
}
=
common
.
constants
;
CODE
,
MESSAGE
}
=
common
.
constants
return
{
return
{
code
:
CODE
[
key
],
code
:
CODE
[
key
],
message
:
MESSAGE
[
key
],
message
:
MESSAGE
[
key
],
data
}
}
}
\ No newline at end of file
\ No newline at end of file
data
,
};
},
};
main.js
View file @
b9e9329
...
@@ -44,7 +44,7 @@ import { index } from "./env";
...
@@ -44,7 +44,7 @@ import { index } from "./env";
// }
// }
Vue
.
prototype
.
$permision
=
permision
;
Vue
.
prototype
.
$permision
=
permision
;
import
sentryInit
from
"@/utils/sentryConfig/sentryInit"
;
import
sentryInit
from
"@/utils/sentryConfig/sentryInit"
;
if
(
index
==
3
)
{
if
(
index
==
5
)
{
const
sentry
=
sentryInit
();
const
sentry
=
sentryInit
();
Vue
.
prototype
.
$sendSentry
=
function
(
e
)
{
Vue
.
prototype
.
$sendSentry
=
function
(
e
)
{
sentry
.
captureException
(
e
);
sentry
.
captureException
(
e
);
...
...
mixin/click.js
View file @
b9e9329
...
@@ -33,7 +33,6 @@ export default {
...
@@ -33,7 +33,6 @@ export default {
const
url
=
[
"pages/equity/index"
,
"pages/boutique/index"
];
const
url
=
[
"pages/equity/index"
,
"pages/boutique/index"
];
if
(
url
.
includes
(
route
))
return
;
if
(
url
.
includes
(
route
))
return
;
this
.
initTime
();
this
.
initTime
();
// this.checkVoice();
},
},
computed
:
{
computed
:
{
...
mapState
(
"audio"
,
[
"receptionStatus"
,
"booksList"
,
"audioInfo"
]),
...
mapState
(
"audio"
,
[
"receptionStatus"
,
"booksList"
,
"audioInfo"
]),
...
@@ -58,7 +57,7 @@ export default {
...
@@ -58,7 +57,7 @@ export default {
"setBooks"
,
"setBooks"
,
"setAudioInfo"
,
"setAudioInfo"
,
]),
]),
//关闭提示
//
//
关闭提示
tipCancel
()
{
tipCancel
()
{
this
.
stopAudio
();
this
.
stopAudio
();
this
.
setReceptionStatus
(
0
);
this
.
setReceptionStatus
(
0
);
...
@@ -76,6 +75,14 @@ export default {
...
@@ -76,6 +75,14 @@ export default {
this
.
times
=
0
;
this
.
times
=
0
;
this
.
$refs
.
tipBox
?.
close
();
this
.
$refs
.
tipBox
?.
close
();
},
},
closeAudio
()
{
this
.
times
=
0
;
clearInterval
(
this
.
timer
);
this
.
timer
=
null
;
this
.
stopAudio
(
"abnormal"
);
this
.
setReceptionStatus
(
0
);
this
.
setAudioInfo
({
endReasonType
:
1
});
},
getParams
()
{
getParams
()
{
const
{
shopMerchantId
,
phone
,
sceneType
}
=
uni
.
$storage
.
get
(
"userInfo"
),
const
{
shopMerchantId
,
phone
,
sceneType
}
=
uni
.
$storage
.
get
(
"userInfo"
),
{
customerName
,
phoneNumber
,
salesUuid
,
carModel
,
staffName
}
=
{
customerName
,
phoneNumber
,
salesUuid
,
carModel
,
staffName
}
=
...
@@ -144,20 +151,22 @@ export default {
...
@@ -144,20 +151,22 @@ export default {
console
.
log
(
res
);
console
.
log
(
res
);
},
},
});
});
this
.
handleSave
(
saveResult
);
this
.
handleSave
(
saveResult
[
1
].
savedFilePath
);
});
});
},
},
handleSave
(
file
)
{
handleSave
(
file
)
{
if
(
this
.
audioInfo
.
audioStatus
==
"end"
)
{
const
audioList
=
[...
this
.
audioInfo
.
audioList
,
file
];
if
(
file
)
{
this
.
setAudioInfo
({
audioList
});
}
if
(
this
.
audioInfo
.
audioStatus
!=
"end"
)
{
return
;
}
this
.
saveRecord
();
this
.
saveRecord
();
this
.
setBooks
([]);
this
.
setBooks
([]);
this
.
$store
.
dispatch
(
"clearCustomerInfo"
);
this
.
$store
.
dispatch
(
"clearCustomerInfo"
);
this
.
setReceptionStatus
(
1
);
this
.
setReceptionStatus
(
1
);
this
.
setAudioInfo
({
endReasonType
:
0
,
audioStatus
:
"finish"
});
this
.
setAudioInfo
({
endReasonType
:
0
,
audioStatus
:
"finish"
});
}
else
{
const
audioList
=
[...
this
.
audioInfo
.
audioList
,
file
];
this
.
setAudioInfo
({
audioList
});
}
},
},
/**保存记录*/
/**保存记录*/
saveRecord
()
{
saveRecord
()
{
...
@@ -175,6 +184,7 @@ export default {
...
@@ -175,6 +184,7 @@ export default {
},
},
...
recordList
,
...
recordList
,
];
];
console
.
log
(
recordList
,
"recordList"
);
uni
.
$storage
.
set
(
"recordList"
,
JSON
.
stringify
(
recordList
));
uni
.
$storage
.
set
(
"recordList"
,
JSON
.
stringify
(
recordList
));
},
},
//结束接待
//结束接待
...
@@ -189,6 +199,15 @@ export default {
...
@@ -189,6 +199,15 @@ export default {
// });
// });
// return;
// return;
// }
// }
if
(
status
==
"abnormal"
)
{
this
.
setAudioInfo
({
audioStatus
:
"abnormal"
});
recorderManager
.
stop
();
return
;
}
if
(
this
.
audioInfo
.
audioStatus
==
"abnormal"
)
{
this
.
handleSave
();
return
;
}
if
(
this
.
audioInfo
.
audioStatus
!=
"start"
)
{
if
(
this
.
audioInfo
.
audioStatus
!=
"start"
)
{
return
;
return
;
}
}
...
@@ -226,8 +245,8 @@ export default {
...
@@ -226,8 +245,8 @@ export default {
this
.
$refs
.
tipBox
?.
open
();
this
.
$refs
.
tipBox
?.
open
();
}
}
if
(
this
.
times
>=
this
.
timeout
)
{
if
(
this
.
times
>=
this
.
timeout
)
{
//
结束接待
//
关闭录音
this
.
tipCancel
();
this
.
closeAudio
();
clearInterval
(
this
.
timer
);
clearInterval
(
this
.
timer
);
}
}
},
1000
*
10
);
},
1000
*
10
);
...
...
mixin/storge.js
View file @
b9e9329
...
@@ -3,18 +3,44 @@ const UPLOAD_STATUS = {
...
@@ -3,18 +3,44 @@ const UPLOAD_STATUS = {
success
:
1
,
success
:
1
,
fail
:
2
,
fail
:
2
,
};
};
import
upload
from
"@/utils/ossUploadFile/uploadFile.js"
;
let
wv
,
getResult
;
import
utils
from
"@/utils/utils.js"
;
import
{
uploadFile
,
getOssToken
}
from
"@/utils/ossUploadFile/uploadFile.js"
;
import
config
from
"@/config.js"
;
export
default
{
export
default
{
onLoad
()
{
// #ifdef APP-PLUS
// wv = plus.webview.create("", "custom-webview", {
// plusrequire: "none", //禁止远程网页使用plus的API,有些使用mui制作的网页可能会监听plus.key,造成关闭页面混乱,可以通过这种方式禁止
// "uni-app": "none", //不加载uni-app渲染层框架,避免样式冲突
// top: uni.getSystemInfoSync().statusBarHeight + 44, //放置在titleNView下方。如果还想在webview上方加个地址栏的什么的,可以继续降低TOP值
// });
// wv.loadURL("/hybrid/html/index.html");
// var currentWebview = this.$scope.$getAppWebview(); //此对象相当于html5plus里的plus.webview.currentWebview()。在uni-app里vue页面直接使用plus.webview.currentWebview()无效
// currentWebview.append(wv); //一定要append到当前的页面里!!!才能跟随当前页面一起做动画,一起关闭
// setTimeout(function () {
// wv.setStyle({ top: "100%", height: 300 });
// }, 1000); //如果是首页的onload调用时需要延时一下,二级页面无需延时,可直接获取
// // #endif
},
mounted
()
{
mounted
()
{
var
currentWebview
=
this
.
$scope
.
$getAppWebview
();
//此对象相当于html5plus里的plus.webview.currentWebview()。在uni-app里vue页面直接使用plus.webview.currentWebview()无效
setTimeout
(
function
()
{
wv
=
currentWebview
.
children
()[
0
];
wv
.
setStyle
({
top
:
"100%"
,
height
:
300
});
},
1000
);
//如果是页面初始化调用时,需要延时一下
// console.log(88);
// // this.checkRecord();
// setTimeout(() => {
// this.checkRecord();
// this.checkRecord();
// setInterval(() => {
// }, 1000 * 6);
// this.checkRecord();
// }, 1000 * 60 * 10);
},
},
methods
:
{
methods
:
{
handlerMessage
(
result
)
{
console
.
log
(
result
);
getResult
=
result
;
},
checkRecord
()
{
checkRecord
()
{
u
tils
.
isNetWork
().
then
(
async
(
res
)
=>
{
u
ni
.
$
isNetWork
().
then
(
async
(
res
)
=>
{
let
recordList
=
JSON
.
parse
(
uni
.
$storage
.
get
(
"recordList"
)
||
"[]"
);
let
recordList
=
JSON
.
parse
(
uni
.
$storage
.
get
(
"recordList"
)
||
"[]"
);
console
.
log
(
recordList
,
"recordList"
);
console
.
log
(
recordList
,
"recordList"
);
for
(
let
i
=
0
;
i
<
recordList
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
recordList
.
length
;
i
++
)
{
...
@@ -22,6 +48,20 @@ export default {
...
@@ -22,6 +48,20 @@ export default {
}
}
});
});
},
},
getFilePath
()
{
return
new
Promise
((
resolve
)
=>
{
plus
.
io
.
requestFileSystem
(
plus
.
io
.
PRIVATE_DOC
,
function
(
fs
)
{
resolve
(
fs
.
root
.
fullPath
);
});
});
},
setTimeoutResult
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
setTimeout
(()
=>
{
resolve
(
getResult
);
},
1000
);
});
},
/**上传记录*/
/**上传记录*/
async
handleRerord
(
val
)
{
async
handleRerord
(
val
)
{
let
recordList
=
JSON
.
parse
(
uni
.
$storage
.
get
(
"recordList"
)
||
"[]"
);
let
recordList
=
JSON
.
parse
(
uni
.
$storage
.
get
(
"recordList"
)
||
"[]"
);
...
@@ -31,14 +71,38 @@ export default {
...
@@ -31,14 +71,38 @@ export default {
let
recordUrlList
=
val
.
recordUrlList
;
let
recordUrlList
=
val
.
recordUrlList
;
// 上传失败的记录
// 上传失败的记录
for
(
let
i
of
recordUrlList
)
{
for
(
let
i
of
recordUrlList
)
{
console
.
log
(
i
.
status
==
UPLOAD_STATUS
.
fail
);
if
(
i
.
status
==
UPLOAD_STATUS
.
fail
)
{
if
(
i
.
status
==
UPLOAD_STATUS
.
fail
)
{
const
filePath
=
i
.
file
;
const
filePath
=
i
.
file
.
split
(
"/"
).
pop
();
console
.
log
(
filePath
,
"filePath"
);
const
{
lsaccessKeySecret
,
securityToken
,
lsaccessKeyId
}
=
const
result
=
await
this
.
checkFileUpload
(
filePath
);
await
getOssToken
();
if
(
!
(
result
instanceof
Error
))
{
console
.
log
(
lsaccessKeySecret
,
securityToken
,
lsaccessKeyId
);
const
rootPath
=
await
this
.
getFilePath
();
wv
.
evalJS
(
`msgFromUniapp('
${
lsaccessKeyId
}
','
${
lsaccessKeySecret
}
','
${
securityToken
}
','
${
filePath
}
','file://
${
rootPath
}
uniapp_save/')`
);
for
(
let
k
=
0
;
k
<
100
;
k
++
)
{
const
result
=
await
this
.
setTimeoutResult
();
if
(
result
)
{
if
(
result
.
detail
.
data
[
0
].
code
==
0
)
{
uni
.
removeSavedFile
({
filePath
:
i
.
file
,
complete
:
function
(
res
)
{
console
.
log
(
res
);
},
});
i
.
status
=
UPLOAD_STATUS
.
success
;
i
.
status
=
UPLOAD_STATUS
.
success
;
i
.
file
=
result
;
i
.
file
=
config
.
OSS_DOMAIN
+
"/"
+
config
.
FOLDER
+
filePath
;
}
getResult
=
""
;
break
;
}
}
}
// const result = await this.checkFileUpload(filePath);
// if (!(result instanceof Error)) {
// i.status = UPLOAD_STATUS.success;
// i.file = result;
// }
}
}
}
}
// 判断是否全部上传成功
// 判断是否全部上传成功
...
@@ -60,7 +124,7 @@ export default {
...
@@ -60,7 +124,7 @@ export default {
let
errorMsg
=
""
;
let
errorMsg
=
""
;
while
(
attempt
<
2
)
{
while
(
attempt
<
2
)
{
try
{
try
{
const
result
=
await
upload
(
tempFilePath
);
const
result
=
await
upload
File
(
tempFilePath
);
// 上传成功
// 上传成功
return
result
;
return
result
;
}
catch
(
error
)
{
}
catch
(
error
)
{
...
...
pages/equity/index.vue
View file @
b9e9329
<
template
>
<
template
>
<view>
<home-frame
<home-frame
@
preview=
"preview"
@
preview=
"preview"
@
start=
"start"
@
start=
"start"
...
@@ -8,10 +9,7 @@
...
@@ -8,10 +9,7 @@
@
backHome=
"backHome"
@
backHome=
"backHome"
@
changeTab=
"changeTab"
@
changeTab=
"changeTab"
>
>
<view
<view
class=
"module-box"
slot=
"module"
>
class=
"module-box"
slot=
"module"
>
<template
v-for=
"(i, index) in moduleList"
>
<template
v-for=
"(i, index) in moduleList"
>
<view
<view
:key=
"index"
:key=
"index"
...
@@ -21,7 +19,7 @@
...
@@ -21,7 +19,7 @@
v-if=
"!i.hide"
v-if=
"!i.hide"
>
>
<template
v-if=
"i.showAlt"
>
<template
v-if=
"i.showAlt"
>
<view
class=
"item-text flex"
>
{{
i
.
title
}}
</view>
<view
class=
"item-text flex"
>
{{
i
.
title
}}
</view>
</
template
>
</
template
>
<
template
v-else
>
<
template
v-else
>
<image
<image
...
@@ -46,21 +44,29 @@
...
@@ -46,21 +44,29 @@
/>
/>
</
template
>
</
template
>
<
template
slot=
"content"
>
<
template
slot=
"content"
>
<novice-guide
<novice-guide
@
nextStep=
"nextStep"
@
back=
"back"
/>
@
nextStep=
"nextStep"
@
back=
"back"
/>
</
template
>
</
template
>
</home-frame>
</home-frame>
<cover-view
class=
"webview-container"
>
<web-view
@
message=
"handlerMessage"
ref=
"webview"
src=
"/hybrid/html/index.html"
></web-view>
</cover-view>
</view>
</template>
</template>
<
script
>
<
script
>
import
detail
from
"./detail/detail"
;
import
detail
from
"./detail/detail"
;
import
{
mapMutations
}
from
"vuex"
;
import
{
mapMutations
}
from
"vuex"
;
import
NoviceGuide
from
"@/components/NoviceGuide.vue"
;
import
NoviceGuide
from
"@/components/NoviceGuide.vue"
;
import
HomeFrame
from
'@/components/HomeFrame/index.vue'
import
HomeFrame
from
"@/components/HomeFrame/index.vue"
;
import
storge
from
"@/mixin/storge"
;
export
default
{
export
default
{
mixins
:
[
storge
],
components
:
{
HomeFrame
,
detail
,
NoviceGuide
},
components
:
{
HomeFrame
,
detail
,
NoviceGuide
},
data
()
{
data
()
{
return
{
return
{
moduleList
:
[],
moduleList
:
[],
toolList
:
[],
toolList
:
[],
...
@@ -71,7 +77,7 @@ export default {
...
@@ -71,7 +77,7 @@ export default {
recording
:
false
,
recording
:
false
,
};
};
},
},
onBackPress
(
options
)
{
onBackPress
(
options
)
{
if
(
options
.
from
===
"backbutton"
)
{
if
(
options
.
from
===
"backbutton"
)
{
// 物理返回按钮触发
// 物理返回按钮触发
// 阻止默认行为,即不执行页面返回
// 阻止默认行为,即不执行页面返回
...
@@ -81,13 +87,13 @@ export default {
...
@@ -81,13 +87,13 @@ export default {
// 其他情况允许正常返回
// 其他情况允许正常返回
return
false
;
return
false
;
},
},
onLoad
()
{
onLoad
()
{
const
mock_data
=
uni
.
$storage
.
get
(
'mock_data'
)
||
{}
const
mock_data
=
uni
.
$storage
.
get
(
"mock_data"
)
||
{};
this
.
moduleList
=
mock_data
.
moduleList
||
[]
this
.
moduleList
=
mock_data
.
moduleList
||
[]
;
this
.
toolList
=
mock_data
.
toolList
||
[]
this
.
toolList
=
mock_data
.
toolList
||
[]
;
},
},
onShow
()
{
onShow
()
{
const
userInfo
=
uni
.
$storage
.
get
(
"userInfo"
)
const
userInfo
=
uni
.
$storage
.
get
(
"userInfo"
)
;
if
(
!
userInfo
.
shopMerchantId
||
!
userInfo
.
shopMerchantName
)
{
if
(
!
userInfo
.
shopMerchantId
||
!
userInfo
.
shopMerchantName
)
{
uni
.
$storage
.
rm
(
"userInfo"
);
uni
.
$storage
.
rm
(
"userInfo"
);
uni
.
$storage
.
rm
(
"sessionId"
);
uni
.
$storage
.
rm
(
"sessionId"
);
...
@@ -98,21 +104,23 @@ export default {
...
@@ -98,21 +104,23 @@ export default {
}
}
this
.
init
();
this
.
init
();
},
},
async
onReachBottom
()
{
async
onReachBottom
()
{
const
{
tabIndex
}
=
this
;
const
{
tabIndex
}
=
this
;
if
(
tabIndex
==
0
)
this
.
$refs
.
detail
?.
pageonReachBottom
();
if
(
tabIndex
==
0
)
this
.
$refs
.
detail
?.
pageonReachBottom
();
},
},
methods
:
{
methods
:
{
...
mapMutations
(
"audio"
,
[
"setReceptionStatus"
]),
...
mapMutations
(
"audio"
,
[
"setReceptionStatus"
]),
init
()
{
init
()
{
this
.
getSoure
();
this
.
getSoure
();
this
.
findPayInfo
();
this
.
findPayInfo
();
const
userInfo
=
uni
.
$storage
.
get
(
"userInfo"
),
const
userInfo
=
uni
.
$storage
.
get
(
"userInfo"
),
storageCarBrandList
=
uni
.
$storage
.
get
(
'carBrandList'
),
storageCarBrandList
=
uni
.
$storage
.
get
(
"carBrandList"
),
storageEmployeeList
=
uni
.
$storage
.
get
(
'employeeList'
),
storageEmployeeList
=
uni
.
$storage
.
get
(
"employeeList"
),
{
shopMerchantId
}
=
userInfo
{
shopMerchantId
}
=
userInfo
;
if
(
storageCarBrandList
)
this
.
$store
.
dispatch
(
"setCarBrandsList"
,
storageCarBrandList
);
if
(
storageCarBrandList
)
if
(
storageEmployeeList
)
this
.
$store
.
dispatch
(
"setEmployeeList"
,
storageEmployeeList
);
this
.
$store
.
dispatch
(
"setCarBrandsList"
,
storageCarBrandList
);
if
(
storageEmployeeList
)
this
.
$store
.
dispatch
(
"setEmployeeList"
,
storageEmployeeList
);
/**获取品牌车型 */
/**获取品牌车型 */
uni
.
$api
.
commonApi
uni
.
$api
.
commonApi
.
getMerchantCarBrandList
([
shopMerchantId
])
.
getMerchantCarBrandList
([
shopMerchantId
])
...
@@ -126,21 +134,26 @@ export default {
...
@@ -126,21 +134,26 @@ export default {
});
});
});
});
this
.
$store
.
dispatch
(
"setCarBrandsList"
,
carBrandList
);
this
.
$store
.
dispatch
(
"setCarBrandsList"
,
carBrandList
);
uni
.
$storage
.
set
(
'carBrandList'
,
carBrandList
)
uni
.
$storage
.
set
(
"carBrandList"
,
carBrandList
);
if
(
carBrandList
.
length
)
{
if
(
carBrandList
.
length
)
{
carBrandList
.
map
(
async
item
=>
{
carBrandList
.
map
(
async
(
item
)
=>
{
const
carList
=
uni
.
getStorageSync
(
`
${
item
.
id
}
_
${
item
.
brandId
}
_carlist`
)
const
carList
=
uni
.
getStorageSync
(
`
${
item
.
id
}
_
${
item
.
brandId
}
_carlist`
);
if
(
!
carList
)
{
if
(
!
carList
)
{
const
_res
=
await
uni
.
$api
.
commonApi
.
getCarBrandsList
({
const
_res
=
await
uni
.
$api
.
commonApi
.
getCarBrandsList
({
brandId
:
item
.
brandId
,
brandId
:
item
.
brandId
,
childBrandId
:
item
.
id
childBrandId
:
item
.
id
,
})
});
if
(
_res
)
uni
.
setStorageSync
(
`
${
item
.
id
}
_
${
item
.
brandId
}
_carlist`
,
_res
)
if
(
_res
)
uni
.
setStorageSync
(
`
${
item
.
id
}
_
${
item
.
brandId
}
_carlist`
,
_res
);
}
}
})
})
;
}
}
});
})
/**获取销售人员 */
/**获取销售人员 */
uni
.
$api
.
commonApi
uni
.
$api
.
commonApi
.
getEmployeeList
({
.
getEmployeeList
({
...
@@ -148,24 +161,31 @@ export default {
...
@@ -148,24 +161,31 @@ export default {
})
})
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
this
.
$store
.
dispatch
(
"setEmployeeList"
,
res
||
[]);
this
.
$store
.
dispatch
(
"setEmployeeList"
,
res
||
[]);
uni
.
$storage
.
set
(
'employeeList'
,
res
||
[])
uni
.
$storage
.
set
(
"employeeList"
,
res
||
[]);
});
});
},
},
// 查询素材
// 查询素材
async
getSoure
()
{
async
getSoure
()
{
const
{
moduleList
,
toolList
}
=
await
uni
.
$api
.
systemApi
.
getMockData
(
true
);
const
{
moduleList
,
toolList
}
=
await
uni
.
$api
.
systemApi
.
getMockData
(
await
moduleList
.
map
(
async
e
=>
{
true
if
(
e
.
receptionSourceDetailList
)
e
.
receptionSourceDetailList
=
await
uni
.
$api
.
systemApi
.
imgToBase64
(
e
.
receptionSourceDetailList
,
'detailUrl'
)
);
if
(
e
.
carTypeList
)
e
.
carTypeList
=
await
uni
.
$api
.
systemApi
.
imgToBase64
(
e
.
carTypeList
)
await
moduleList
.
map
(
async
(
e
)
=>
{
})
if
(
e
.
receptionSourceDetailList
)
this
.
moduleList
=
moduleList
e
.
receptionSourceDetailList
=
await
uni
.
$api
.
systemApi
.
imgToBase64
(
this
.
toolList
=
toolList
e
.
receptionSourceDetailList
,
uni
.
$api
.
systemApi
.
updateMockData
(
moduleList
,
'moduleList'
)
"detailUrl"
);
if
(
e
.
carTypeList
)
e
.
carTypeList
=
await
uni
.
$api
.
systemApi
.
imgToBase64
(
e
.
carTypeList
);
});
this
.
moduleList
=
moduleList
;
this
.
toolList
=
toolList
;
uni
.
$api
.
systemApi
.
updateMockData
(
moduleList
,
"moduleList"
);
},
},
errorImg
(
index
)
{
errorImg
(
index
)
{
this
.
moduleList
[
index
].
showAlt
=
true
this
.
moduleList
[
index
].
showAlt
=
true
;
},
},
async
start
()
{
async
start
()
{
const
result
=
await
this
.
$permision
.
requestAndroidPermission
(
const
result
=
await
this
.
$permision
.
requestAndroidPermission
(
"android.permission.RECORD_AUDIO"
"android.permission.RECORD_AUDIO"
);
);
...
@@ -183,21 +203,21 @@ export default {
...
@@ -183,21 +203,21 @@ export default {
this
.
recording
=
true
;
this
.
recording
=
true
;
},
},
toDetail
(
item
)
{
toDetail
(
item
)
{
this
.
chooseItem
=
item
;
this
.
chooseItem
=
item
;
this
.
$refs
.
home
.
previewRef
.
open
();
this
.
$refs
.
home
.
previewRef
.
open
();
},
},
cancel
()
{
cancel
()
{
this
.
$refs
.
home
.
previewRef
.
close
();
this
.
$refs
.
home
.
previewRef
.
close
();
},
},
preview
()
{
preview
()
{
let
{
id
}
=
this
.
chooseItem
;
let
{
id
}
=
this
.
chooseItem
;
this
.
type
=
"preview"
;
this
.
type
=
"preview"
;
this
.
id
=
id
;
this
.
id
=
id
;
this
.
cancel
()
this
.
cancel
()
;
},
},
// 完成接待
// 完成接待
done
(
e
)
{
done
(
e
)
{
this
.
$refs
.
home
.
finishRef
.
close
();
this
.
$refs
.
home
.
finishRef
.
close
();
if
(
this
.
recording
)
this
.
$refs
.
home
.
stopAudio
();
if
(
this
.
recording
)
this
.
$refs
.
home
.
stopAudio
();
this
.
recording
=
false
;
this
.
recording
=
false
;
...
@@ -207,12 +227,12 @@ export default {
...
@@ -207,12 +227,12 @@ export default {
this
.
setReceptionStatus
(
e
);
this
.
setReceptionStatus
(
e
);
},
1500
);
},
1500
);
},
},
back
()
{
back
()
{
if
(
!
this
.
id
)
return
uni
.
navigateBack
();
if
(
!
this
.
id
)
return
uni
.
navigateBack
();
if
(
this
.
type
!=
"preview"
)
return
this
.
$refs
.
home
.
finishRef
.
open
();
if
(
this
.
type
!=
"preview"
)
return
this
.
$refs
.
home
.
finishRef
.
open
();
this
.
backHome
();
this
.
backHome
();
},
},
backHome
()
{
backHome
()
{
if
(
this
.
recording
)
this
.
$refs
.
home
.
stopAudio
(
true
);
if
(
this
.
recording
)
this
.
$refs
.
home
.
stopAudio
(
true
);
this
.
$refs
.
home
.
finishRef
.
close
();
this
.
$refs
.
home
.
finishRef
.
close
();
this
.
id
=
""
;
this
.
id
=
""
;
...
@@ -221,22 +241,22 @@ export default {
...
@@ -221,22 +241,22 @@ export default {
this
.
init
();
this
.
init
();
this
.
recording
=
false
;
this
.
recording
=
false
;
},
},
nextStep
()
{
nextStep
()
{
let
{
id
}
=
this
.
moduleList
[
0
];
let
{
id
}
=
this
.
moduleList
[
0
];
this
.
type
=
"preview"
;
this
.
type
=
"preview"
;
this
.
id
=
id
;
this
.
id
=
id
;
},
},
clearHistory
()
{
clearHistory
()
{
this
.
$store
.
dispatch
(
"clearCustomerInfo"
);
this
.
$store
.
dispatch
(
"clearCustomerInfo"
);
this
.
$store
.
dispatch
(
"clearHistory"
);
this
.
$store
.
dispatch
(
"clearHistory"
);
this
.
$refs
.
home
.
setBooks
([])
this
.
$refs
.
home
.
setBooks
([])
;
},
},
openStep
()
{
openStep
()
{
this
.
$refs
.
home
.
finishRef
.
close
();
this
.
$refs
.
home
.
finishRef
.
close
();
this
.
$refs
.
detail
.
open
();
this
.
$refs
.
detail
.
open
();
},
},
// 查询门店支付配置
// 查询门店支付配置
async
findPayInfo
()
{
async
findPayInfo
()
{
const
{
shopMerchantId
}
=
uni
.
$storage
.
get
(
"userInfo"
);
const
{
shopMerchantId
}
=
uni
.
$storage
.
get
(
"userInfo"
);
const
data
=
await
uni
.
$api
.
commonApi
.
findPayInfo
({
const
data
=
await
uni
.
$api
.
commonApi
.
findPayInfo
({
merchantId
:
shopMerchantId
,
merchantId
:
shopMerchantId
,
...
@@ -260,7 +280,7 @@ export default {
...
@@ -260,7 +280,7 @@ export default {
});
});
this
.
$store
.
dispatch
(
"setPaymentType"
,
paymentType
);
this
.
$store
.
dispatch
(
"setPaymentType"
,
paymentType
);
},
},
changeTab
(
index
)
{
changeTab
(
index
)
{
this
.
tabIndex
=
index
;
this
.
tabIndex
=
index
;
if
(
index
==
0
)
this
.
init
();
if
(
index
==
0
)
this
.
init
();
},
},
...
@@ -305,4 +325,14 @@ export default {
...
@@ -305,4 +325,14 @@ export default {
height
:
624
rpx
;
height
:
624
rpx
;
}
}
}
}
.webview-container
{
width
:
100
rpx
;
height
:
100
rpx
;
position
:
absolute
;
width
:
100%
;
height
:
100%
;
top
:
0
rpx
;
left
:
0
rpx
;
transform
:
translateY
(
300%
);
}
</
style
>
</
style
>
utils/ossUploadFile/uploadFile.js
View file @
b9e9329
...
@@ -100,7 +100,16 @@ const getPolicyBase64 = function () {
...
@@ -100,7 +100,16 @@ const getPolicyBase64 = function () {
const
policyBase64
=
base64
.
encode
(
JSON
.
stringify
(
policyText
));
const
policyBase64
=
base64
.
encode
(
JSON
.
stringify
(
policyText
));
return
policyBase64
;
return
policyBase64
;
};
};
const
getOssToken
=
async
function
()
{
console
.
log
(
"getOssToken"
);
const
{
lsaccessKeySecret
,
securityToken
,
lsaccessKeyId
}
=
await
uni
.
$api
.
commonApi
.
getToken
({});
return
{
lsaccessKeySecret
,
securityToken
,
lsaccessKeyId
,
};
};
// 生成签名
// 生成签名
const
getSignature
=
function
(
policyBase64
)
{
const
getSignature
=
function
(
policyBase64
)
{
return
new
Promise
(
async
(
reslove
)
=>
{
return
new
Promise
(
async
(
reslove
)
=>
{
...
@@ -144,4 +153,4 @@ const getSignature = function (policyBase64) {
...
@@ -144,4 +153,4 @@ const getSignature = function (policyBase64) {
});
});
};
};
module
.
exports
=
uploadFile
;
module
.
exports
=
{
uploadFile
,
getOssToken
}
;
Write
Preview
Markdown
is supported
Attach a file
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 post a comment