Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mallapp
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
viitto
mallapp
Commits
3418cea1
Commit
3418cea1
authored
Jan 07, 2021
by
Mac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
7187387a
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
569 additions
and
380 deletions
+569
-380
sound-recording.vue
...iendcircle/components/sound-recording/sound-recording.vue
+0
-263
enlargevideo.vue
pages/friendcircle/enlargevideo.vue
+58
-0
my-news.vue
pages/friendcircle/my-news.vue
+288
-55
recording.vue
pages/friendcircle/recording.vue
+0
-0
release.vue
pages/friendcircle/release.vue
+223
-62
No files found.
pages/friendcircle/components/sound-recording/sound-recording.vue
deleted
100644 → 0
View file @
7187387a
<
template
>
<view
class=
"recorder"
>
<view
class=
"re-top"
v-if=
"showTop"
>
<view
class=
"re-cancel"
@
click=
"cancel"
>
取消
</view>
<view
class=
"re-confirm"
:style=
"
{color: theme}" @click="confirm">
{{
confirmText
}}
</view>
</view>
<text
class=
"title"
>
{{
finish
?
'点击播放'
:
'长按录制语音'
}}
</text>
<view
class=
"recorder-box"
v-if=
"!finish"
@
click=
"handle"
@
longpress=
"onStartRecoder"
@
touchend=
"onEndRecoder"
>
<!--
<u-circle-progress
:active-color=
"theme"
:duration=
"0"
:percent=
"calcProgress"
>
-->
<view
class=
"u-progress-content"
>
<image
src=
"https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/huodongweikaishi.png"
mode=
"aspectFit"
:style=
"
{
width: width,
height: height
}">
</image>
</view>
<!--
</u-circle-progress>
-->
</view>
<view
class=
"recorder-box"
v-else
@
click=
"playVoice"
>
<!--
<u-circle-progress
:active-color=
"theme"
:duration=
"0"
:percent=
"playProgress"
>
-->
<view
class=
"u-progress-content"
>
<image
src=
"https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/huodongweikaishi.png"
mode=
"aspectFit"
:style=
"
{
width: width,
height: height
}" v-if="!playStatus">
</image>
<image
src=
"https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/huodongweikaishi.png"
mode=
"aspectFit"
:style=
"
{
width: width,
height: height
}" v-else>
</image>
</view>
<!--
</u-circle-progress>
-->
</view>
<text
class=
"now-date"
>
{{
reDate
}}
</text>
<view
@
click=
"reset"
>
重新录制
</view>
</view>
</
template
>
<
script
>
// import uCircleProgress from '../u-circle-progress/u-circle-progress.vue'
const
recorderManager
=
uni
.
getRecorderManager
();
const
innerAudioContext
=
uni
.
createInnerAudioContext
();
export
default
{
components
:
{
// uCircleProgress
},
props
:
{
width
:
{
type
:
String
,
default
:
'60rpx'
},
height
:
{
type
:
String
,
default
:
'60rpx'
},
showTop
:
{
type
:
Boolean
,
default
:
true
},
maximum
:
{
type
:
[
Number
,
String
],
default
:
15
},
duration
:
{
type
:
Number
,
default
:
20
},
theme
:
{
type
:
String
,
default
:
'#32b99d'
},
confirmText
:
{
type
:
String
,
default
:
'完成'
}
},
data
()
{
return
{
reDate
:
'00:00'
,
sec
:
0
,
min
:
0
,
finish
:
false
,
voicePath
:
''
,
playProgress
:
100
,
playTimer
:
null
,
timer
:
null
,
playStatus
:
false
};
},
created
()
{
// 监听
this
.
onMonitorEvents
()
},
computed
:
{
// 录制时间计算
calcProgress
()
{
return
(
this
.
sec
+
(
this
.
min
*
60
))
/
this
.
maximum
*
100
}
},
methods
:
{
// 完成事件
confirm
()
{
if
(
!
innerAudioContext
.
paused
)
{
innerAudioContext
.
stop
()
}
this
.
$emit
(
'confirm'
,
this
.
voicePath
)
},
// 取消事件
cancel
()
{
if
(
!
innerAudioContext
.
paused
)
{
innerAudioContext
.
stop
()
}
this
.
$emit
(
'cancel'
)
},
// 点击事件
handle
()
{
this
.
$emit
(
'click'
)
},
// 重新录制
reset
()
{
this
.
voicePath
=
''
this
.
min
=
0
this
.
sec
=
0
this
.
reDate
=
'00:00'
this
.
playProgress
=
100
this
.
finish
=
false
this
.
$emit
(
'reset'
)
},
// 播放暂停录音
playVoice
()
{
innerAudioContext
.
src
=
this
.
voicePath
;
if
(
innerAudioContext
.
paused
)
{
innerAudioContext
.
play
()
this
.
playStatus
=
true
}
else
{
innerAudioContext
.
stop
();
}
this
.
$emit
(
'playVoice'
,
innerAudioContext
.
paused
)
},
// 录制结束
onEndRecoder
()
{
recorderManager
.
stop
()
},
// 开始录制
onStartRecoder
()
{
console
.
log
(
2323
)
recorderManager
.
start
({
duration
:
this
.
maximum
*
1000
})
},
// 监听
onMonitorEvents
()
{
// 录制开始
recorderManager
.
onStart
(()
=>
{
uni
.
showLoading
({
title
:
'录制中...'
})
this
.
startDate
()
this
.
$emit
(
'start'
)
})
recorderManager
.
onError
((
err
)
=>
{
console
.
log
(
err
)
})
// 录制结束
recorderManager
.
onStop
(({
tempFilePath
})
=>
{
this
.
voicePath
=
tempFilePath
clearInterval
(
this
.
timer
)
uni
.
hideLoading
()
this
.
finish
=
true
this
.
$emit
(
'end'
)
})
// 播放进度
innerAudioContext
.
onTimeUpdate
(()
=>
{
let
totalDate
=
innerAudioContext
.
duration
let
nowTime
=
innerAudioContext
.
currentTime
let
surplus
=
totalDate
-
nowTime
this
.
playProgress
=
surplus
/
totalDate
*
100
let
_min
=
Math
.
floor
(
surplus
/
60
)
if
(
_min
<
10
)
_min
=
'0'
+
_min
;
let
_sec
=
Math
.
floor
(
surplus
%
60
)
if
(
_sec
<
10
)
_sec
=
'0'
+
_sec
;
this
.
reDate
=
_min
+
':'
+
_sec
})
// 播放暂停
innerAudioContext
.
onPause
(()
=>
{
this
.
resetDate
()
this
.
playProgress
=
100
this
.
playStatus
=
false
console
.
log
(
'播放暂停'
)
this
.
$emit
(
'stop'
)
})
// 播放停止
innerAudioContext
.
onStop
(()
=>
{
this
.
resetDate
()
this
.
playProgress
=
100
this
.
playStatus
=
false
console
.
log
(
'播放停止'
)
this
.
$emit
(
'stop'
)
})
},
// 录音计时
startDate
()
{
console
.
log
(
2333
)
clearInterval
(
this
.
timer
)
this
.
sec
=
0
this
.
min
=
0
this
.
timer
=
setInterval
(()
=>
{
this
.
sec
+=
this
.
duration
/
1000
if
(
this
.
sec
>=
60
)
{
this
.
min
++
this
.
sec
=
0
}
this
.
resetDate
()
},
this
.
duration
)
},
// 播放时间
resetDate
()
{
let
_s
=
this
.
sec
<
10
?
'0'
+
parseInt
(
this
.
sec
)
:
parseInt
(
this
.
sec
)
let
_m
=
this
.
min
<
10
?
'0'
+
this
.
min
:
this
.
min
this
.
reDate
=
_m
+
':'
+
_s
}
}
}
</
script
>
<
style
lang=
"scss"
>
.recorder
{
position
:
relative
;
display
:
flex
;
align-items
:
center
;
flex-direction
:
column
;
background-color
:
#fff
;
font-size
:
24rpx
;
width
:
100%
;
.re-top
{
display
:
flex
;
justify-content
:
space-between
;
padding
:
10rpx
20rpx
;
width
:
100%
;
font-size
:
28rpx
;
box-sizing
:
border-box
;
}
.title
{
font-size
:
36rpx
;
color
:
#333
;
padding
:
20rpx
0
30rpx
;
}
.recorder-box
{
position
:
relative
;
}
.now-date
{
font-size
:
28rpx
;
color
:
#666
;
padding
:
20rpx
0
;
}
}
</
style
>
pages/friendcircle/enlargevideo.vue
0 → 100644
View file @
3418cea1
<
template
>
<view
class=
"enlargevideo"
>
<video
id=
"myVideo"
:src=
"file"
@
error=
"videoErrorCallback"
autoplay
controls
:show-fullscreen-btn=
'false'
@
fullscreenchange=
'videoControl'
></video>
</view>
</
template
>
<
script
>
export
default
{
data
()
{
return
{
file
:
''
,
}
},
onLoad
(
options
)
{
if
(
options
&&
options
.
file
){
this
.
file
=
options
.
file
}
this
.
videoContext
=
uni
.
createVideoContext
(
'myVideo'
);
this
.
videoContext
.
requestFullScreen
({
direction
:
0
})
},
methods
:
{
videoErrorCallback
(){
//视频出错返回
wx
.
showToast
({
title
:
'播放失败!'
,
icon
:
'none'
,
duration
:
1000
})
uni
.
navigateBack
({})
},
videoControl
(
e
){
console
.
log
(
e
.
detail
)
if
(
e
.
detail
.
fullScreen
==
false
){
uni
.
navigateBack
({})
}
}
},
}
</
script
>
<
style
>
.enlargevideo
{
width
:
100%
;
height
:
100vh
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
background
:
#000000
;
}
#myVideo
{
width
:
100%
;
}
</
style
>
pages/friendcircle/my-news.vue
View file @
3418cea1
...
@@ -3,7 +3,9 @@
...
@@ -3,7 +3,9 @@
width
:
100%
;
width
:
100%
;
height
:
100vh
;
height
:
100vh
;
background
:
#FFF
;
background
:
#FFF
;
}
}
.mynews
.mynews-top
{
.mynews
.mynews-top
{
width
:
100%
;
width
:
100%
;
height
:
60px
;
height
:
60px
;
...
@@ -11,6 +13,7 @@
...
@@ -11,6 +13,7 @@
align-items
:
center
;
align-items
:
center
;
justify-content
:
center
;
justify-content
:
center
;
}
}
.mynews
.top-box
{
.mynews
.top-box
{
padding
:
0
12px
;
padding
:
0
12px
;
display
:
flex
;
display
:
flex
;
...
@@ -20,10 +23,99 @@
...
@@ -20,10 +23,99 @@
height
:
30px
;
height
:
30px
;
border-radius
:
15px
;
border-radius
:
15px
;
background
:
#40766E
;
background
:
#40766E
;
font-size
:
14px
;
font-size
:
14px
;
color
:
#FFFFFF
;
color
:
#FFFFFF
;
}
}
.mynews
.ftBox
{
width
:
100%
;
padding
:
0
15px
;
margin-top
:
25px
;
}
.mynews
.interDList
{
width
:
100%
;
display
:
flex
;
flex-direction
:
row
;
align-items
:
flex-start
;
}
.mynews
.interDList-left
{
width
:
80px
;
display
:
flex
;
flex-direction
:
row
;
align-items
:
flex-end
;
}
.mynews
.interDList-right
{
width
:
1
;
flex
:
1
;
font-size
:
14px
;
color
:
#333333
;
}
.mynews
.jiazu
{
font-size
:
25px
;
color
:
#333333
;
}
.mynews
.inter-r-o
{
width
:
100%
;
padding
:
10px
;
background
:
#F5F5F5
;
border-radius
:
4px
;
}
.mynews
.inter-r-t
{
width
:
100%
;
display
:
flex
;
flex-direction
:
row
;
align-items
:
center
;
flex-wrap
:
wrap
;
}
.mynews
.inter-r-t-l
{
width
:
70px
;
height
:
70px
;
border-radius
:
4px
;
margin-right
:
15px
;
overflow
:
hidden
;
display
:
flex
;
flex-direction
:
row
;
flex-wrap
:
wrap
;
}
.mynews
.inter-r-t-r
{
width
:
1
;
flex
:
1
;
height
:
70px
;
display
:
flex
;
flex-direction
:
column
;
justify-content
:
space-between
;
}
.mynews
.inter-r-t-text
{
width
:
100%
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
display
:
-webkit-box
;
-webkit-line-clamp
:
2
;
-webkit-box-orient
:
vertical
;
}
.mynews
.andiostyle
{
width
:
100%
;
height
:
30px
;
border-radius
:
4px
;
padding
:
0
15px
;
display
:
flex
;
background
:
#FFF
;
flex-direction
:
row
;
align-items
:
center
;
margin-top
:
10px
;
justify-content
:
space-between
;
}
</
style
>
</
style
>
<
template
>
<
template
>
<div
class=
'mynews'
>
<div
class=
'mynews'
>
...
@@ -34,14 +126,8 @@
...
@@ -34,14 +126,8 @@
</view>
</view>
</view>
</view>
<!-- 发布动态按钮 -->
<!-- 发布动态按钮 -->
<floatbutton
<floatbutton
:list=
'list'
openIcon=
'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/fabupyq.png'
:list=
'list'
background=
'#40766E'
openText=
'发布'
bottom=
'80'
@
click=
'btnclick'
></floatbutton>
openIcon=
'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/fabupyq.png'
background=
'#40766E'
openText=
'发布'
bottom=
'80'
@
click=
'btnclick'
></floatbutton>
<u-empty
v-if=
"g.length == 0"
text=
"暂无动态"
mode=
"list"
></u-empty>
<u-empty
v-if=
"g.length == 0"
text=
"暂无动态"
mode=
"list"
></u-empty>
<view
v-if=
"g.length > 0"
style=
"
<view
v-if=
"g.length > 0"
style=
"
height: calc(100vh-60px);
height: calc(100vh-60px);
...
@@ -50,11 +136,62 @@
...
@@ -50,11 +136,62 @@
"
>
"
>
<scroll-view
:scroll-y=
"true"
:enable-back-to-top=
"true"
:enable-flex=
"true"
@
scrolltolower=
"lower"
:style=
"
{ height: '100%' }">
<scroll-view
:scroll-y=
"true"
:enable-back-to-top=
"true"
:enable-flex=
"true"
@
scrolltolower=
"lower"
:style=
"
{ height: '100%' }">
<view
class=
"ftBox"
>
<view
class=
"ftBox"
v-for=
"(x, i) in g"
:key=
"i"
@
click=
"goteacher(x)"
>
<view
class=
"interDList"
v-for=
"(x, i) in g"
:key=
"i"
@
click=
"goteacher(x)"
>
<view
class=
"jiazu"
v-if=
"x.YearTime!=''"
>
{{
x
.
YearTime
}}
年
</view>
<view
class=
"interDList"
>
<view
class=
"interDList-left"
>
<text
class=
"jiazu"
>
{{
x
.
DayTime
}}
</text>
<text
style=
"font-size: 14px;color: #333333;margin-left: 5px;"
>
{{
x
.
MonthTime
}}
月
</text>
</view>
<view
class=
"interDList-right"
>
<view
class=
"inter-r-o"
v-if=
"x.fileType==0"
>
{{
x
.
content
}}
</view>
<view
class=
"inter-r-t wrap"
v-if=
"x.fileType==1"
>
<view
class=
"inter-r-t-l"
>
<image
:src=
"x.files[0]"
v-if=
"x.files.length==1"
mode=
'aspectFill'
style=
"width: 100%;height: 100%;"
></image>
<view
v-if=
"x.files.length==2"
v-for=
"(item, iq) in x.files"
:key=
"iq"
:style=
"
{'margin-right':(iq%2 ==0)?'2px':'0',width:'34px','height':'100%'}">
<image
:src=
"item"
mode=
'aspectFill'
style=
"width: 100%;height: 100%;"
></image>
</view>
<view
v-if=
"x.files.length==4"
v-for=
"(item, iq) in x.files"
:key=
"iq"
:style=
"
{'margin-right':(iq%2 ==0)?'2px':'0',width:'34px','height':'34px','margin-bottom':(iq==0||iq==1)?'2px':'0'}">
<image
:src=
"item"
mode=
'aspectFill'
style=
"width: 100%;height: 100%;"
></image>
</view>
</view>
<view
class=
"inter-r-t-r"
>
<view
class=
"inter-r-t-text"
>
{{
x
.
content
}}
</view>
<text
style=
"font-size: 11px;color: #BEBEBE;"
>
共
{{
x
.
files
.
length
}}
张
</text>
</view>
</view>
<view
class=
"inter-r-t"
v-if=
"x.fileType==2"
>
<view
class=
"inter-r-t-l"
style=
"position: relative;"
>
<video
id=
"myVideo"
:src=
"x.files[0]"
style=
"width: 70px;height: 70px;"
:controls=
'false'
:show-center-play-btn=
'false'
></video>
<view
style=
"width: 100%;height: 100%;position: absolute;left: 0;top: 0;display: flex;align-items: center;justify-content: center;"
@
click=
"enlarge(x)"
>
<u-icon
name=
"play-circle-o"
:size=
"50"
color=
"#FFF"
></u-icon>
</view>
</view>
<view
class=
"inter-r-t-r"
>
<view
class=
"inter-r-t-text"
>
{{
x
.
content
}}
</view>
</view>
</view>
<view
class=
"inter-r-o"
v-if=
"x.fileType==3"
>
<view>
{{
x
.
content
}}
</view>
<view
class=
"andiostyle"
@
click
.
stop=
"playVoice(x)"
>
<image
src=
"https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/Sound.png"
mode=
"widthFix"
style=
"width: 19px;height: auto;"
></image>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<u-loadmore
:status=
"status"
:load-text=
"loadText"
:font-size=
"24"
:margin-top=
"20"
:margin-bottom=
"20"
bg-color=
"#FFF"
/>
<u-loadmore
:status=
"status"
:load-text=
"loadText"
:font-size=
"24"
:margin-top=
"20"
:margin-bottom=
"20"
bg-color=
"#FFF"
/>
</scroll-view>
</scroll-view>
...
@@ -67,6 +204,7 @@
...
@@ -67,6 +204,7 @@
</
template
>
</
template
>
<
script
>
<
script
>
const
innerAudioContext
=
uni
.
createInnerAudioContext
();
import
auth
from
"../../components/auth/index.vue"
;
import
auth
from
"../../components/auth/index.vue"
;
import
floatbutton
from
"./components/com-float-button/com-float-button.vue"
;
import
floatbutton
from
"./components/com-float-button/com-float-button.vue"
;
export
default
{
export
default
{
...
@@ -96,12 +234,28 @@
...
@@ -96,12 +234,28 @@
nomore
:
"没有更多了"
,
nomore
:
"没有更多了"
,
},
},
windowWidth
:
0
,
windowWidth
:
0
,
list
:[
list
:
[{
{
name
:
'文本'
,
type
:
0
,
url
:
'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/Sound.png'
},
name
:
'文本'
,
{
name
:
'图文'
,
type
:
1
,
url
:
'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/Sound.png'
},
type
:
0
,
{
name
:
'视频'
,
type
:
2
,
url
:
'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/Sound.png'
},
url
:
'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/Sound.png'
{
name
:
'语音'
,
type
:
3
,
url
:
'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/Sound.png'
},
},
]
{
name
:
'图文'
,
type
:
1
,
url
:
'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/Sound.png'
},
{
name
:
'视频'
,
type
:
2
,
url
:
'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/Sound.png'
},
{
name
:
'语音'
,
type
:
3
,
url
:
'https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/Sound.png'
},
],
nowbofo
:
false
,
}
}
},
},
created
()
{
created
()
{
...
@@ -114,9 +268,8 @@
...
@@ -114,9 +268,8 @@
mounted
()
{
mounted
()
{
let
currentPages
=
getCurrentPages
();
let
currentPages
=
getCurrentPages
();
let
u
=
"/"
+
currentPages
[
currentPages
.
length
-
1
].
route
;
let
u
=
"/"
+
currentPages
[
currentPages
.
length
-
1
].
route
;
let
pages
=
wx
.
getStorageSync
(
"basedata"
)
let
pages
=
wx
.
getStorageSync
(
"basedata"
)
?
?
wx
.
getStorageSync
(
"basedata"
).
bar_title
wx
.
getStorageSync
(
"basedata"
).
bar_title
:
[];
:
[];
pages
.
forEach
((
x
)
=>
{
pages
.
forEach
((
x
)
=>
{
if
(
x
.
value
==
u
)
{
if
(
x
.
value
==
u
)
{
this
.
pageTitle
=
x
.
new_name
?
x
.
new_name
:
x
.
name
;
this
.
pageTitle
=
x
.
new_name
?
x
.
new_name
:
x
.
name
;
...
@@ -150,6 +303,9 @@
...
@@ -150,6 +303,9 @@
if
(
res
.
resultCode
==
1
)
{
if
(
res
.
resultCode
==
1
)
{
this
.
loading
=
false
;
this
.
loading
=
false
;
this
.
count
=
res
.
data
.
count
;
this
.
count
=
res
.
data
.
count
;
res
.
data
.
pageData
.
forEach
(
x
=>
{
x
.
nowbofo
=
false
;
})
this
.
g
=
this
.
g
.
concat
(
res
.
data
.
pageData
);
this
.
g
=
this
.
g
.
concat
(
res
.
data
.
pageData
);
this
.
page_count
=
res
.
data
.
pageCount
;
this
.
page_count
=
res
.
data
.
pageCount
;
if
(
this
.
page_count
==
1
)
{
if
(
this
.
page_count
==
1
)
{
...
@@ -159,11 +315,88 @@
...
@@ -159,11 +315,88 @@
}
}
);
);
},
},
btnclick
(
item
){
btnclick
(
item
)
{
if
(
item
.
type
==
2
)
{
this
.
upvideo
()
}
else
{
uni
.
navigateTo
({
url
:
'/pages/friendcircle/release?type='
+
item
.
type
})
}
},
upvideo
()
{
let
that
=
this
uni
.
chooseVideo
({
count
:
1
,
sourceType
:
[
'camera'
,
'album'
],
success
:
function
(
res
)
{
console
.
log
(
res
)
that
.
upFile
(
res
.
tempFilePath
,
1
)
uni
.
showLoading
({
title
:
'上传中...'
})
},
fail
(
err
)
{
console
.
log
(
err
,
)
}
});
},
upFile
(
filePath
,
type
)
{
let
MallBaseId
=
uni
.
getStorageSync
(
"mall_UserInfo"
).
MallBaseId
?
uni
.
getStorageSync
(
"mall_UserInfo"
).
MallBaseId
:
1
;
let
action
=
this
.
host2
+
'/api/File/UploadTencent?MallBaseId='
+
MallBaseId
let
that
=
this
uni
.
uploadFile
({
url
:
action
,
filePath
:
filePath
,
name
:
'file'
,
formData
:
{
user
:
'tesdt'
},
success
:
(
uploadFileRes
)
=>
{
uni
.
hideLoading
()
if
(
uploadFileRes
.
statusCode
==
200
)
{
let
data
=
JSON
.
parse
(
uploadFileRes
.
data
)
uni
.
navigateTo
({
url
:
'/pages/friendcircle/release?type=2&file='
+
data
.
data
})
}
},
fail
:
function
(
res
)
{
console
.
log
(
res
)
wx
.
showToast
({
title
:
'上传失败!'
,
icon
:
'none'
,
duration
:
1000
})
}
});
},
enlarge
(
file
)
{
// 全屏
uni
.
navigateTo
({
uni
.
navigateTo
({
url
:
'/pages/friendcircle/
release?type='
+
item
.
type
url
:
'/pages/friendcircle/
enlargevideo?file='
+
file
})
})
},
},
//语音播放
playVoice
(
x
)
{
let
that
=
this
if
(
innerAudioContext
.
src
!=
x
.
files
[
0
]){
//如果切换听其他的语音
innerAudioContext
.
stop
();
this
.
nowbofo
=
false
}
innerAudioContext
.
src
=
x
.
files
[
0
];
if
(
this
.
nowbofo
==
false
)
{
innerAudioContext
.
play
()
this
.
nowbofo
=
true
}
else
{
innerAudioContext
.
pause
();
this
.
nowbofo
=
false
}
},
reloadUserinfo
()
{
reloadUserinfo
()
{
this
.
u
=
uni
.
getStorageSync
(
"mall_UserInfo"
);
this
.
u
=
uni
.
getStorageSync
(
"mall_UserInfo"
);
// this.showAuth=false;
// this.showAuth=false;
...
...
pages/friendcircle/
components/
recording.vue
→
pages/friendcircle/recording.vue
View file @
3418cea1
File moved
pages/friendcircle/release.vue
View file @
3418cea1
...
@@ -71,7 +71,7 @@
...
@@ -71,7 +71,7 @@
.release
.audio
{
.release
.audio
{
width
:
100%
;
width
:
100%
;
margin
:
10px
0
;
margin
:
10px
0
;
height
:
35
px
;
height
:
40
px
;
background
:
#F9F9F9
;
background
:
#F9F9F9
;
border-radius
:
4px
;
border-radius
:
4px
;
display
:
flex
;
display
:
flex
;
...
@@ -134,11 +134,23 @@
...
@@ -134,11 +134,23 @@
}
}
.release
.audio-ot
{
.release
.audio-ot
{
width
:
1
;
flex
:
1
;
margin-right
:
20px
;
display
:
flex
;
flex-direction
:
row
;
align-items
:
center
;
padding
:
0
10px
;
justify-content
:
space-between
;
width
:
1
;
flex
:
1
;
margin-right
:
20px
;
display
:
flex
;
flex-direction
:
row
;
align-items
:
center
;
padding
:
0
10px
;
justify-content
:
space-between
;
height
:
2
0
px
;
height
:
2
5
px
;
background
:
#EBEBEB
;
background
:
#EBEBEB
;
border-radius
:
4px
;
border-radius
:
4px
;
}
}
.release
.videostyle
{
width
:
100px
;
height
:
100px
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
border-radius
:
4px
;
background
:
#F9F9F9
;
border
:
1px
dashed
#D2D2D2
;
}
#myVideo
{
width
:
150px
;
height
:
200px
;
}
</
style
>
</
style
>
<
template
>
<
template
>
<view
class=
"release"
>
<view
class=
"release"
>
...
@@ -146,7 +158,8 @@
...
@@ -146,7 +158,8 @@
<textarea
placeholder=
"今天又什么可以给大家分享呢?"
style=
"width: 100%;height: 100px;"
maxlength=
'-1'
confirm-type=
'done'
v-model=
"addMsg.Content"
>
<textarea
placeholder=
"今天又什么可以给大家分享呢?"
style=
"width: 100%;height: 100px;"
maxlength=
'-1'
confirm-type=
'done'
v-model=
"addMsg.Content"
>
</textarea>
</textarea>
<text
v-if=
'addMsg.FileType==1 || addMsg.FileType==2'
style=
"font-size: 12px;color: #333333;margin-bottom: 15px;"
>
上传图片或者视频
<span
style=
'color: ;#A9A9A9'
>
(图片无上限)
</span>
</text>
<text
v-if=
'addMsg.FileType==1 || addMsg.FileType==2'
style=
"font-size: 12px;color: #333333"
>
上传图片或者视频
<span
style=
'color: ;#A9A9A9'
>
(图片无上限)
</span>
</text>
<view
style=
"width: 100%;margin-top: 15px;"
>
<u-upload
:action=
"action"
:file-list=
"fileList"
@
on-remove=
"onRemove1"
:custom-btn=
"true"
<u-upload
:action=
"action"
:file-list=
"fileList"
@
on-remove=
"onRemove1"
:custom-btn=
"true"
v-if=
'addMsg.FileType==1'
v-if=
'addMsg.FileType==1'
@
on-success=
"uploadSuccessHandler"
>
@
on-success=
"uploadSuccessHandler"
>
...
@@ -155,6 +168,21 @@
...
@@ -155,6 +168,21 @@
<view
class=
"mian-title"
>
上传图片
</view>
<view
class=
"mian-title"
>
上传图片
</view>
</view>
</view>
</u-upload>
</u-upload>
</view>
<!-- 视频 -->
<view
style=
"width: 100%;margin-top: 15px;display: flex;flex-direction: row;"
v-if=
"addMsg.FileType==2"
>
<view
style=
"width: 150px; height: 200px;position: relative;margin-right: 20px;"
>
<video
id=
"myVideo"
:src=
"addMsg.FileList[0]"
@
error=
"videoErrorCallback"
:controls=
'false'
:show-center-play-btn=
'false'
></video>
<view
style=
"width: 100%;height: 100%;position: absolute;left: 0;top: 0;display: flex;align-items: center;justify-content: center;"
@
click=
"enlarge()"
>
<u-icon
name=
"play-circle-o"
:size=
"70"
color=
"#FFF"
></u-icon>
</view>
</view>
</view>
<!-- 音频 -->
<!-- 音频 -->
<view
class=
"audio"
v-if=
'addMsg.FileType==3'
>
<view
class=
"audio"
v-if=
'addMsg.FileType==3'
>
<view
class=
"audio-o"
@
click=
"statraudio()"
v-if=
"addMsg.FileList.length==0"
>
<view
class=
"audio-o"
@
click=
"statraudio()"
v-if=
"addMsg.FileList.length==0"
>
...
@@ -165,9 +193,9 @@
...
@@ -165,9 +193,9 @@
<view
v-if=
"addMsg.FileList.length>0"
class=
"audio-o"
style=
"justify-content: space-around;width: 100%;"
>
<view
v-if=
"addMsg.FileList.length>0"
class=
"audio-o"
style=
"justify-content: space-around;width: 100%;"
>
<view
class=
"audio-ot"
@
click=
"playVoice"
>
<view
class=
"audio-ot"
@
click=
"playVoice"
>
<image
src=
"https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/Sound2.png"
mode=
"widthFix"
style=
"width: 20px;height: auto;"
></image>
<image
src=
"https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/Sound2.png"
mode=
"widthFix"
style=
"width: 20px;height: auto;"
></image>
<text>
{{
reDate
}}
</text>
<text>
{{
reDate
2
!=
reDate
?(
reDate2
+
'/'
):
''
}}{{
reDate
}}
</text>
</view>
</view>
<view
style=
"font-size: 14px;color: #40766E;"
>
<view
style=
"font-size: 14px;color: #40766E;"
@
click=
"reset"
>
重新录制
重新录制
</view>
</view>
...
@@ -212,7 +240,7 @@
...
@@ -212,7 +240,7 @@
<u-popup
v-model=
"audioshow"
mode=
"bottom"
>
<u-popup
v-model=
"audioshow"
mode=
"bottom"
>
<view
class=
"as-box"
>
<view
class=
"as-box"
>
<view
class=
"as-yuyin"
<view
class=
"as-yuyin"
@
click=
"aa"
@
longpress=
"onStartRecoder"
@
longpress=
"onStartRecoder"
@
touchend=
"onEndRecoder"
@
touchend=
"onEndRecoder"
>
>
...
@@ -233,13 +261,10 @@
...
@@ -233,13 +261,10 @@
</
template
>
</
template
>
<
script
>
<
script
>
import
soundRecording
from
'./components/sound-recording/sound-recording.vue'
const
recorderManager
=
uni
.
getRecorderManager
();
const
recorderManager
=
uni
.
getRecorderManager
();
const
innerAudioContext
=
uni
.
createInnerAudioContext
();
const
innerAudioContext
=
uni
.
createInnerAudioContext
();
export
default
{
export
default
{
components
:
{
soundRecording
},
data
()
{
data
()
{
return
{
return
{
whoshow
:
false
,
whoshow
:
false
,
...
@@ -268,16 +293,26 @@
...
@@ -268,16 +293,26 @@
],
],
action
:
this
.
host2
+
"/api/File/UploadTencent"
,
action
:
this
.
host2
+
"/api/File/UploadTencent"
,
reDate
:
'00:00'
,
reDate
:
'00:00'
,
reDate2
:
'00:00'
,
timer
:
null
,
timer
:
null
,
sec
:
0
,
sec
:
0
,
min
:
0
,
min
:
0
,
voicePath
:
''
voicePath
:
''
,
nowbofo
:
false
,
//播放状态
videoContext
:
null
}
}
},
},
onLoad
(
options
)
{
onLoad
(
options
)
{
if
(
options
&&
options
.
type
)
{
if
(
options
&&
options
.
type
)
{
this
.
addMsg
.
FileType
=
options
.
type
this
.
addMsg
.
FileType
=
options
.
type
if
(
options
.
file
){
this
.
addMsg
.
FileList
=
[]
this
.
addMsg
.
FileList
.
push
(
options
.
file
)
}
}
}
this
.
mainColor
=
this
.
$uiConfig
.
mainColor
;
this
.
mainColor
=
this
.
$uiConfig
.
mainColor
;
this
.
secondary
=
this
.
$uiConfig
.
secondary
;
this
.
secondary
=
this
.
$uiConfig
.
secondary
;
this
.
pricecolor
=
this
.
$uiConfig
.
pricecolor
;
this
.
pricecolor
=
this
.
$uiConfig
.
pricecolor
;
...
@@ -301,36 +336,51 @@
...
@@ -301,36 +336,51 @@
});
});
return
return
}
}
if
(
this
.
addMsg
.
FileList
.
length
==
0
&&
(
this
.
addMsg
.
FileType
==
1
||
this
.
addMsg
.
FileType
==
2
||
this
.
addMsg
.
FileType
==
3
)){
let
title
=
'请选择相应的图片或者视频'
if
(
this
.
addMsg
.
FileType
==
3
){
title
=
'请录入音频'
}
uni
.
showToast
({
title
:
title
,
icon
:
'none'
,
duration
:
2000
});
return
}
uni
.
showLoading
({
uni
.
showLoading
({
title
:
'发布中...'
title
:
'发布中...'
})
})
console
.
log
(
this
.
addMsg
)
console
.
log
(
this
.
addMsg
)
//
this.request2({
this
.
request2
({
//
url: '/api/AppletEducation/PublishDynamic',
url
:
'/api/AppletEducation/PublishDynamic'
,
//
data: this.addMsg
data
:
this
.
addMsg
//
},
},
//
res => {
res
=>
{
//
uni.hideLoading()
uni
.
hideLoading
()
//
if (res.resultCode == 1) {
if
(
res
.
resultCode
==
1
)
{
//
uni.showToast({
uni
.
showToast
({
//
title: res.message,
title
:
res
.
message
,
//
position: 'bottom',
position
:
'bottom'
,
//
icon: 'none',
icon
:
'none'
,
//
duration: 2000
duration
:
2000
//
});
});
//
let pages = getCurrentPages(); // 当前页面
let
pages
=
getCurrentPages
();
// 当前页面
//
let beforePage = pages[pages.length - 2]; // 前一个页面
let
beforePage
=
pages
[
pages
.
length
-
2
];
// 前一个页面
//
setTimeout(() => {
setTimeout
(()
=>
{
//
uni.navigateBack({
uni
.
navigateBack
({
//
success: function() {
success
:
function
()
{
//
beforePage.$vm.init(); // 执行前一个页面的created方法
beforePage
.
$vm
.
init
();
// 执行前一个页面的created方法
//
}
}
//
});
});
//
}, 1000)
},
1000
)
//
}
}
//
}
}
//
);
);
},
},
//打开地图
getAddress
()
{
getAddress
()
{
let
that
=
this
;
let
that
=
this
;
uni
.
chooseLocation
({
uni
.
chooseLocation
({
...
@@ -354,9 +404,60 @@
...
@@ -354,9 +404,60 @@
onRemove1
(
index
)
{
onRemove1
(
index
)
{
this
.
addMsg
.
FileList
.
splice
(
index
,
1
);
this
.
addMsg
.
FileList
.
splice
(
index
,
1
);
},
},
//提前对音频授权
statraudio
(){
statraudio
(){
this
.
audioshow
=
true
let
that
=
this
uni
.
getSetting
({
success
(
res
)
{
console
.
log
(
res
.
authSetting
)
if
(
!
res
.
authSetting
[
'scope.record'
]){
//没有获取音频的时候
uni
.
authorize
({
scope
:
'scope.record'
,
success
(
r
)
{
console
.
log
(
r
)
that
.
audioshow
=
true
;
},
fail
(){
wx
.
showModal
({
title
:
'录音管理器'
,
content
:
'尚未进行授权,部分功能将无法使用'
,
success
(
res
)
{
if
(
res
.
confirm
)
{
wx
.
openSetting
({
success
:
(
res
)
=>
{
if
(
data
.
authSetting
[
"scope.record"
]
===
true
)
{
wx
.
showToast
({
title
:
'授权成功'
,
icon
:
'success'
,
duration
:
1000
})
that
.
audioshow
=
true
;
}
else
{
wx
.
showToast
({
title
:
'授权失败'
,
duration
:
1000
})
}
},
fail
:
function
(
err
)
{
console
.
log
(
err
);
}
})
}
else
if
(
res
.
cancel
)
{
console
.
log
(
'用户点击取消'
)
}
},
fail
(
err
){
console
.
log
(
err
)
}
})
}
})
}
else
{
that
.
audioshow
=
true
;
}
}
})
},
},
//重新提示用户打开设置对地图授权
fetchAgainLocation
()
{
fetchAgainLocation
()
{
let
that
=
this
let
that
=
this
wx
.
getSetting
({
wx
.
getSetting
({
...
@@ -405,8 +506,15 @@
...
@@ -405,8 +506,15 @@
complete
:
()
=>
{}
complete
:
()
=>
{}
})
})
},
},
reset
(){
//重新录制
this
.
voicePath
=
''
this
.
min
=
0
this
.
sec
=
0
this
.
reDate
=
'00:00'
this
.
addMsg
.
FileList
=
[];
this
.
audioshow
=
true
;
},
// 开始录制
// 开始录制
onStartRecoder
()
{
onStartRecoder
()
{
console
.
log
(
'长按'
)
console
.
log
(
'长按'
)
recorderManager
.
start
({
recorderManager
.
start
({
...
@@ -420,13 +528,46 @@
...
@@ -420,13 +528,46 @@
},
},
// 播放暂停录音
// 播放暂停录音
playVoice
()
{
playVoice
()
{
let
that
=
this
console
.
log
(
innerAudioContext
.
src
)
innerAudioContext
.
src
=
this
.
voicePath
;
innerAudioContext
.
src
=
this
.
voicePath
;
if
(
innerAudioContext
.
paused
)
{
innerAudioContext
.
play
()
if
(
this
.
nowbofo
==
false
)
{
this
.
playstartDate
()
this
.
nowbofo
=
true
}
else
{
}
else
{
innerAudioContext
.
stop
();
console
.
log
(
'暂停'
)
innerAudioContext
.
pause
();
clearInterval
(
that
.
timer
)
this
.
nowbofo
=
false
}
},
playstartDate
(){
clearInterval
(
this
.
timer
)
if
(
this
.
reDate2
==
this
.
reDate
){
//如果等于音频总时间就初始化,没有的话就继续
this
.
sec
=
0
this
.
min
=
0
}
innerAudioContext
.
play
()
this
.
timer
=
setInterval
(()
=>
{
this
.
sec
++
if
(
this
.
sec
>=
60
)
{
this
.
min
++
this
.
sec
=
0
}
this
.
playresetDate
()
},
1000
)
},
playresetDate
(){
let
_s
=
this
.
sec
<
10
?
'0'
+
parseInt
(
this
.
sec
)
:
parseInt
(
this
.
sec
)
let
_m
=
this
.
min
<
10
?
'0'
+
this
.
min
:
this
.
min
this
.
reDate2
=
_m
+
':'
+
_s
if
(
this
.
reDate2
==
this
.
reDate
){
innerAudioContext
.
stop
();
//视频播放完停止
this
.
nowbofo
=
false
;
//控制播放的字段
clearInterval
(
this
.
timer
)
}
}
},
},
// 监听
// 监听
onMonitorEvents
(){
onMonitorEvents
(){
...
@@ -463,7 +604,10 @@
...
@@ -463,7 +604,10 @@
let
_s
=
this
.
sec
<
10
?
'0'
+
parseInt
(
this
.
sec
)
:
parseInt
(
this
.
sec
)
let
_s
=
this
.
sec
<
10
?
'0'
+
parseInt
(
this
.
sec
)
:
parseInt
(
this
.
sec
)
let
_m
=
this
.
min
<
10
?
'0'
+
this
.
min
:
this
.
min
let
_m
=
this
.
min
<
10
?
'0'
+
this
.
min
:
this
.
min
this
.
reDate
=
_m
+
':'
+
_s
this
.
reDate
=
_m
+
':'
+
_s
this
.
reDate2
=
_m
+
':'
+
_s
},
},
// 音频的上传
asupload
(){
asupload
(){
let
that
=
this
let
that
=
this
...
@@ -475,16 +619,33 @@
...
@@ -475,16 +619,33 @@
user
:
'tesdt'
user
:
'tesdt'
},
},
success
:
(
uploadFileRes
)
=>
{
success
:
(
uploadFileRes
)
=>
{
if
(
uploadFileRes
.
statusCode
==
200
)
if
(
uploadFileRes
.
statusCode
==
200
)
{
console
.
log
(
JSON
.
parse
(
uploadFileRes
.
data
));
console
.
log
(
JSON
.
parse
(
uploadFileRes
.
data
));
that
.
addMsg
.
FileList
=
[]
that
.
addMsg
.
FileList
=
[]
that
.
addMsg
.
FileList
.
push
(
JSON
.
parse
(
uploadFileRes
.
data
).
data
)
that
.
addMsg
.
FileList
.
push
(
JSON
.
parse
(
uploadFileRes
.
data
).
data
)
that
.
audioshow
=
false
;
}
},
},
fail
:
function
(
res
)
{
fail
:
function
(
res
)
{
console
.
log
(
res
)
console
.
log
(
res
)
wx
.
showToast
({
title
:
'上传失败!'
,
icon
:
'none'
,
duration
:
1000
})
}
}
});
});
}
},
enlarge
(){
// 全屏
uni
.
navigateTo
({
url
:
'/pages/friendcircle/enlargevideo?file='
+
this
.
addMsg
.
FileList
[
0
]
})
},
}
}
}
}
</
script
>
</
script
>
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