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 39f0c8c4
authored
Jun 07, 2024
by
前端
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fixed
1 parent
48c56546
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
96 additions
and
36 deletions
mixin/click.js
pages/boutique/case.vue
pages/boutique/history.vue
pages/boutique/invitation.vue
pages/boutique/preview.vue
mixin/click.js
View file @
39f0c8c
...
...
@@ -8,6 +8,11 @@
*/
const
recorderManager
=
uni
.
getRecorderManager
();
const
plug
=
uni
.
requireNativePlugin
(
"html5app-recordaudio"
);
const
UPLOAD_STATUS
=
{
// 上传状态
success
:
1
,
fail
:
2
,
};
import
upload
from
"@/utils/ossUploadFile/uploadFile.js"
;
import
{
mapMutations
,
mapState
}
from
"vuex"
;
import
utils
from
"@/utils/utils.js"
;
...
...
@@ -81,6 +86,34 @@ export default {
const
file
=
uni
.
$storage
.
get
(
"storageFile"
);
if
(
file
)
this
.
uploadVoice
(
file
);
},
getParams
()
{
const
{
shopMerchantId
,
phone
,
sceneType
}
=
uni
.
$storage
.
get
(
"userInfo"
),
{
customerName
,
phoneNumber
,
salesUuid
,
carModel
,
staffName
}
=
this
.
$store
.
state
.
user
.
customerInfo
,
receptionCustomerPaySourceList
=
this
.
booksList
.
map
((
item
)
=>
{
return
{
id
:
item
.
id
,
sourceType
:
item
.
id
,
sourceUrl
:
item
.
imgUrl
,
};
}),
params
=
{
carModel
,
endReasonType
:
this
.
endReasonType
,
//原因 1.异常 0.正常
customerName
,
phoneNumber
,
loginPhone
:
phone
,
salesName
:
staffName
,
salesUuid
,
receptionStatus
:
this
.
receptionStatus
,
//接待结果 1.成交 0.战败
receptionStartTime
:
this
.
receptionStartTime
,
receptionEndTime
:
this
.
receptionEndTime
,
receptionCustomerPaySourceList
,
//1.付款凭证文件路径 2.客户购车发票文件路径 3.客户延保合同文件路径
merchantId
:
shopMerchantId
,
bussinessType
:
sceneType
==
0
?
1
:
2
,
// sceneType 0延保 1精品。 bussinessType 1.延保 2.轻改
};
return
params
;
},
//保存录音记录及其他信息
async
uploadVoice
(
tempFilePath
)
{
try
{
...
...
@@ -166,14 +199,15 @@ export default {
console
.
error
(
"上传失败:"
,
result
);
const
{
customerName
,
phoneNumber
,
salesUuid
,
carModel
,
staffName
}
=
this
.
$store
.
state
.
user
.
customerInfo
;
const
{
name
}
=
uni
.
$storage
.
get
(
"userInfo"
);
this
.
$sendSentry
(
`上传文件失败:手机号-
${
phoneNumber
}
姓名-
${
customerName
}
销售-
${
staffName
}
车型-
${
carModel
}
销售-
${
salesUuid
}
`
`上传文件失败:手机号-
${
phoneNumber
}
姓名-
${
customerName
}
销售-
${
staffName
}
车型-
${
carModel
}
员工-
${
name
}
,失败原因-
${
result
}
`
);
// this.handleErrorFile(res.tempFilePath,
"error"
);
// this.handleErrorFile(res.tempFilePath,
UPLOAD_STATUS.fail
);
// return;
}
else
{
// this.handleErrorFile(result,
"success"
);
// this.handleErrorFile(result,
UPLOAD_STATUS.success
);
}
const
storageFile
=
[...
this
.
audioList
,
result
];
uni
.
$storage
.
set
(
"storageFile"
,
storageFile
);
...
...
@@ -185,12 +219,13 @@ export default {
},
/**保存记录*/
saveRecord
()
{
const
file
List
=
JSON
.
parse
(
uni
.
$storage
.
get
(
"errorFile"
)
||
"[]"
);
const
recordUrl
List
=
JSON
.
parse
(
uni
.
$storage
.
get
(
"errorFile"
)
||
"[]"
);
let
recordList
=
JSON
.
parse
(
uni
.
$storage
.
get
(
"recordList"
)
||
"[]"
);
recordList
=
[
...
recordList
,
{
fileList
,
...
this
.
getParams
(),
recordUrlList
,
},
];
uni
.
$storage
.
set
(
"recordList"
,
JSON
.
stringify
(
recordList
));
...
...
@@ -198,7 +233,9 @@ export default {
/**是否存在错误文件*/
hasErrorFile
()
{
const
fileList
=
JSON
.
parse
(
uni
.
$storage
.
get
(
"errorFile"
)
||
"[]"
);
const
errorFileList
=
fileList
.
filter
((
item
)
=>
item
.
status
==
"error"
);
const
errorFileList
=
fileList
.
filter
(
(
item
)
=>
item
.
status
==
UPLOAD_STATUS
.
fail
);
return
errorFileList
.
length
>
0
;
},
/**处理失败的文件*/
...
...
@@ -207,15 +244,40 @@ export default {
const
errorFile
=
[...
errorFileList
,
{
file
,
status
}];
uni
.
$storage
.
set
(
"errorFile"
,
JSON
.
stringify
(
errorFile
));
},
handleRerord
()
{},
/**上传记录*/
async
handleRerord
(
val
)
{
let
recordList
=
JSON
.
parse
(
uni
.
$storage
.
get
(
"recordList"
)
||
"[]"
);
let
idx
=
recordList
.
findIndex
(
(
item
)
=>
item
.
receptionStartTime
==
val
.
receptionStartTime
);
let
recordUrlList
=
val
.
recordUrlList
;
// 上传失败的记录
for
(
let
i
of
recordUrlList
)
{
if
(
i
.
status
==
UPLOAD_STATUS
.
fail
)
{
const
result
=
await
this
.
checkUploadFile
(
i
.
file
);
if
(
!
(
result
instanceof
Error
))
{
i
.
status
=
UPLOAD_STATUS
.
success
;
}
}
}
// 判断是否全部上传成功
if
(
recordUrlList
.
every
((
i
)
=>
i
.
status
==
UPLOAD_STATUS
.
success
))
{
recordList
.
splice
(
idx
,
1
);
val
.
recordUrlList
=
val
.
recordUrlList
.
map
((
i
)
=>
i
.
file
);
this
.
uploadVoice
(
val
);
uni
.
$storage
.
set
(
"recordList"
,
JSON
.
stringify
(
recordList
));
}
},
async
checkUploadFile
(
tempFilePath
)
{
let
attempt
=
0
;
let
errorMsg
=
""
;
while
(
attempt
<
3
)
{
try
{
const
result
=
await
upload
(
tempFilePath
);
// 上传成功
return
result
;
}
catch
(
error
)
{
errorMsg
=
error
;
attempt
++
;
// 等待一段时间后重试
await
new
Promise
((
resolve
)
=>
setTimeout
(
resolve
,
3000
));
// 3秒后重试
...
...
@@ -224,7 +286,7 @@ export default {
// 达到最大尝试次数后,如果上传仍然失败,可以进行相应的处理
console
.
error
(
"上传失败,达到最大尝试次数"
);
// 返回一个错误或者进行其他操作
return
new
Error
(
"上传失败"
);
return
new
Error
(
errorMsg
);
},
//结束录音
stopAudio
:
utils
.
throttle
(
async
function
()
{
...
...
pages/boutique/case.vue
View file @
39f0c8c
...
...
@@ -150,7 +150,7 @@ export default {
}
.box
{
padding
:
64
rpx
;
margin-top
:
12
0
rpx
;
margin-top
:
9
0
rpx
;
.input-box
{
position
:
relative
;
.input
{
...
...
@@ -192,7 +192,7 @@ export default {
}
}
.record-box
{
height
:
calc
(
100vh
-
30
0
rpx
);
height
:
calc
(
100vh
-
25
0
rpx
);
padding-top
:
48
rpx
;
}
.list
{
...
...
@@ -200,7 +200,7 @@ export default {
grid-template-columns
:
repeat
(
5
,
1
fr
);
gap
:
48
rpx
50
rpx
;
.item
{
height
:
5
44
rpx
;
height
:
5
36
rpx
;
background
:
#ffffff
;
border-radius
:
48
rpx
;
box-shadow
:
0
8
rpx
24
rpx
0
#4673ff1
a
;
...
...
@@ -223,7 +223,7 @@ export default {
}
.item-desc
{
height
:
140
rpx
;
padding
:
2
8
rpx
32
rpx
;
padding
:
2
4
rpx
28
rpx
;
font-size
:
32
rpx
;
color
:
#333333
;
border-radius
:
48
rpx
;
...
...
pages/boutique/history.vue
View file @
39f0c8c
...
...
@@ -134,6 +134,9 @@ import Record from "@/mixin/record";
export
default
{
name
:
''
,
mixins
:[
Record
],
props
:
{
show
:
Boolean
},
data
()
{
return
{
imageUrl
:
require
(
'@/assets/images/noviceGuide/step1-1.webp'
),
...
...
@@ -153,13 +156,8 @@ export default {
],
}
},
computed
:
{
watchStatus
()
{
return
this
.
$store
.
state
.
user
.
historyStatus
},
},
watch
:{
watchStatus
:
{
show
:
{
handler
()
{
this
.
changeIndex
(
1
,
true
)
},
...
...
@@ -195,7 +193,6 @@ export default {
this
.
getRecordList
()
},
getRecordList
()
{
const
{
pageNum
,
pageSize
,
groupIndex
}
=
this
,
userInfo
=
uni
.
$storage
.
get
(
"userInfo"
),
{
shopMerchantId
}
=
userInfo
;
...
...
@@ -260,7 +257,7 @@ export default {
.box
{
padding
:
64
rpx
;
margin-top
:
12
0
rpx
;
margin-top
:
9
0
rpx
;
.data-tabs-box
{
position
:
relative
;
...
...
@@ -322,7 +319,7 @@ export default {
}
}
.record-box
{
height
:
calc
(
100vh
-
30
0
rpx
);
height
:
calc
(
100vh
-
25
0
rpx
);
padding-top
:
48
rpx
;
}
.end-text
{
...
...
pages/boutique/invitation.vue
View file @
39f0c8c
...
...
@@ -90,7 +90,6 @@ import Record from "@/mixin/record";
export
default
{
mixins
:
[
Record
],
props
:
{
customerType
:
Number
,
show
:
Boolean
},
data
()
{
...
...
@@ -109,13 +108,8 @@ export default {
chooseItem
:
{}
}
},
computed
:
{
watchStatus
()
{
return
this
.
$store
.
state
.
user
.
historyStatus
},
},
watch
:{
watchStatus
:{
show
:{
handler
()
{
this
.
init
()
},
...
...
@@ -236,7 +230,7 @@ export default {
}
.box
{
padding
:
64
rpx
;
margin-top
:
12
0
rpx
;
margin-top
:
9
0
rpx
;
.input-box
{
position
:
relative
;
.input
{
...
...
@@ -277,7 +271,7 @@ export default {
}
}
.record-box
{
height
:
calc
(
100vh
-
30
0
rpx
);
height
:
calc
(
100vh
-
25
0
rpx
);
padding-top
:
48
rpx
;
}
.end-text
{
...
...
pages/boutique/preview.vue
View file @
39f0c8c
...
...
@@ -34,12 +34,19 @@ export default {
this
.
title
=
tabName
this
.
sourceType
=
sourceType
this
.
detailUrl
=
detailUrl
const
img
=
new
Image
()
img
.
onload
=
()
=>
{
this
.
width
=
document
.
querySelector
(
'.img-detail'
).
offsetHeight
*
img
.
height
/
img
.
width
console
.
log
(
this
.
width
)
}
img
.
src
=
detailUrl
const
_this
=
this
uni
.
getImageInfo
({
src
:
detailUrl
,
// 替换为你的图片路径
success
(
img
)
{
uni
.
createSelectorQuery
().
select
(
'.img-detail'
).
boundingClientRect
(
function
(
rect
)
{
_this
.
width
=
rect
.
height
*
img
.
height
/
img
.
width
}).
exec
();
},
fail
:
function
(
error
)
{
console
.
error
(
'获取图片信息失败:'
,
error
);
}
});
},
methods
:
{
back
()
{
...
...
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