main
Wkang921 2 years ago
parent d31940579b
commit e9fa44ff0e

BIN
.DS_Store vendored

Binary file not shown.

@ -46,13 +46,25 @@ Page({
this.setData({visible: false}) this.setData({visible: false})
}, },
delBtn(e){ delBtn(e){
console.log(this.data.image); console.log('删除图片');
const regex = /\d+/; console.log(e.currentTarget.dataset.item);
const matchResult = this.data.image.match(regex); const url = e.currentTarget.dataset.item
const number = matchResult[0]; const arr = url.split("/"); // 将链接按照 / 分割成数组
console.log(number); // 输出254 const last = arr[arr.length - 1]; // 取得数组中的最后一个元素
req.deleteRequest(`/api/user/curt/message/${number}`,{}).then(res => { const num = last.split("?")[0]; // 将最后一个元素按照 ? 分割成数组,取得倒数第二个元素
console.log(res,'删除成功'); console.log(num); // 输出 128
this.setData({delKey: e.currentTarget.dataset.item, resourceId:num})
},
delBtnHx(){
const hxlist = this.data.hxlist
const id = hxlist.find(item => item.resourceId == this.data.resourceId).id
console.log(id);
req.deleteRequest(`/api/user/curt/message/${id}`,{}).then(res => {
console.log(res);
if (res.data.code === 200) {
this.getList()
this.setData({delKey: ''})
}
}) })
}, },
closeViewer(){this.setData({visible: false})}, closeViewer(){this.setData({visible: false})},
@ -75,6 +87,7 @@ Page({
item.createdAt = formattedDate item.createdAt = formattedDate
}) })
console.log(list); console.log(list);
this.setData({hxlist: list})
const treeData = list.reduce((result, item) => { const treeData = list.reduce((result, item) => {
const group = result.find(group => group.createdAt === item.createdAt); const group = result.find(group => group.createdAt === item.createdAt);
if (group) { if (group) {

@ -9,7 +9,8 @@
{{ item.createdAt }} {{ item.createdAt }}
</view> </view>
<view class="block-item"> <view class="block-item">
<view class="item" wx:for="{{item.list}}" wx:key="index"> <view class="item" wx:for="{{item.list}}" wx:key="index" bindlongpress="delBtn" data-item="{{item}}">
<view class="item-del" wx:if="{{delKey === item}}" bindtap="delBtnHx">删除</view>
<image src="{{item}}" bindtap="blockClick" data-url="{{item}}"/> <image src="{{item}}" bindtap="blockClick" data-url="{{item}}"/>
</view> </view>
</view> </view>

@ -74,6 +74,7 @@
} }
.block-item .item { .block-item .item {
position: relative;
width: 182rpx; width: 182rpx;
height: 182rpx; height: 182rpx;
margin: 4rpx 0 0 4rpx; margin: 4rpx 0 0 4rpx;
@ -85,6 +86,21 @@
height: 100%; height: 100%;
} }
.block-item .item .item-del{
position: absolute;
top: -52rpx;
left: 6rpx;
width: 148rpx;
height: 84rpx;
border-radius: 10rpx;
color: #6c6c6c;
font-size: 28rpx;
display: flex;
align-items: center;
justify-content: center;
background-image: url(https://wk921-1316969570.cos.ap-nanjing.myqcloud.com/xy/ltqp.png);
}
.viewer { .viewer {
position: absolute; position: absolute;
top: 0; top: 0;

@ -224,7 +224,6 @@ Page({
clearInterval(this.data.timer) clearInterval(this.data.timer)
console.log('结束录音') console.log('结束录音')
this.data.RM.pause() this.data.RM.pause()
}, },
doStartLuyin(){ doStartLuyin(){
this.setData({RM:wx.getRecorderManager()}) this.setData({RM:wx.getRecorderManager()})

@ -11,13 +11,17 @@ Page({
to:'', to:'',
from:'', from:'',
content:'', content:'',
img:'https://wk921-1316969570.cos.ap-nanjing.myqcloud.com/xzimg.png', img:'',
messageList:[], messageList:[],
sound:'', sound:'',
soundTime:0, soundTime:'00:00:00',
duration: '',
minute:0, //分
second:0, //秒
millisecond:0, //毫秒
showBtn:true, showBtn:true,
showImg:true, showImg:false,
showLtqp:true, showLtqp:false,
showImgBig:false, //图片太大弹层 showImgBig:false, //图片太大弹层
showSoundMore:false, //语音太多提示 showSoundMore:false, //语音太多提示
showSend:false, //寄出提示 showSend:false, //寄出提示
@ -26,13 +30,15 @@ Page({
showAlready:false, showAlready:false,
btn1:true, btn1:true,
btn2:false, btn2:false,
btn3:false btn3:false,
showSoundImg:true
}, },
writeLetters(){ writeLetters(){
console.log('写信'); console.log('写信');
this.setData({ this.setData({
showImg:false, showImg:false,
showLtqp:false, showLtqp:false,
Preview: false
}) })
}, },
already(){ already(){
@ -74,6 +80,9 @@ Page({
openPreview(){ openPreview(){
console.log('预览'); console.log('预览');
this.setData({Preview:true}) this.setData({Preview:true})
if(this.data.messageList.length){
this.setData({showLtqp: true})
}
}, },
ClearYl(){ ClearYl(){
console.log('清除语音'); console.log('清除语音');
@ -89,17 +98,15 @@ Page({
return item.type !== "graphic" return item.type !== "graphic"
}) })
this.setData({ this.setData({
img:'https://wk921-1316969570.cos.ap-nanjing.myqcloud.com/xzimg.png', img:'',
messageList: list messageList: list,
showImg: false
}) })
console.log(this.data.messageList); console.log(this.data.messageList);
}, },
// 上传图片 // 上传图片
addImg(){ addImg(){
console.log('添加图片'); console.log('添加图片');
this.setData({
showImg:true
})
wx.chooseMedia({ wx.chooseMedia({
mediaType: 'image', mediaType: 'image',
success: (res) => { success: (res) => {
@ -155,7 +162,8 @@ Page({
}) })
this.setData({ this.setData({
img:data.data.abUrl, img:data.data.abUrl,
messageList:list messageList:list,
showImg:true
}) })
console.log(this.data.messageList); console.log(this.data.messageList);
} }
@ -186,61 +194,97 @@ Page({
}, },
openSound(){ openSound(){
console.log('添加声音'); console.log('添加声音');
this.setData({showSound:true,showLtqp:true}) this.setData({showSound:true})
}, },
closeSound(){ closeSound(){
this.setData({showSound:false}) this.setData({showSound:false})
}, },
startSound(){ startSound(){
console.log('开始录音'); console.log('开始录音');
const time = setInterval(()=>{
this.setData({soundTime:this.data.soundTime + 1}) this.setData({btn1: false, btn2: true, showSoundImg: false})
},1000) let option = {
this.setData({ timeId: time }) duration:10000, //录音的时长之前最大值好像只有1分钟现在最长可以录音10分钟
wx.startRecord({ format:'mp3', //录音的格式有aac和mp3两种
success: (res) => { }
console.log(res.tempFilePath); wx.getRecorderManager().start(option)
this.setData({sound:res.tempFilePath,btn1:false,btn2:true}) // 开启定时器
} this.data.timeOut = setInterval(this.counter,50)
}) },
// 计时器
counter(){
let second = this.data.second
let minute = this.data.minute
let millisecond = this.data.millisecond
this.setData({millisecond: millisecond + 5})
if(millisecond > 99) {
this.setData({millisecond: 0, second : second + 1 })
}else if(second >= 60) {
this.setData({second: 0, minute: minute + 1})
}else if(minute === 3) {
this.second({soundTime: '03:00:00'})
clearInterval(this.data.timeOut)
}
let time = '0' + minute
if (second < 10) {
time = time + ':0' + second
}else {
time = time + ':' + second
}
if (millisecond < 10){
time = time + ':0' + millisecond
} else {
time = time + ':' + millisecond
}
this.setData({soundTime: time})
}, },
endSound(){ endSound(){
console.log('结束录音'); console.log('暂停录音');
wx.stopRecord() wx.getRecorderManager().pause()
clearInterval(this.data.timeId) clearInterval(this.data.timeOut)
this.setData({btn2:false, btn3:true, showSoundImg:true})
}, },
playVoice(){ playVoice(){
console.log('播放录音'); console.log('继续录音');
this.setData({btn2:false,btn3:true}) wx.getRecorderManager().resume()
wx.playVoice({ this.data.timeOut = setInterval(this.counter,50)
filePath: this.data.sound, this.setData({btn2:true, btn3:false, showSoundImg:false})
complete: () => {
console.log('录音播放结束');
this.setData({btn2:true,btn3:false})
}
});
}, },
addSound(){ addSound(){
console.log('添加录音'); console.log('添加录音');
this.uploadFile(this.data.sound,'audio') console.log(this.data.soundTime);
this.setData({ this.setData({duration: this.data.soundTime})
btn1:true, wx.getRecorderManager().stop()
btn2:false, clearInterval(this.data.timeOut)
btn3:false, // 监听结束录音
soundTime:0 wx.getRecorderManager().onStop((res) => {
console.log(res);
this.uploadFile(res.tempFilePath,'audio')
}) })
// console.log(this.data.messageList);
},
delSound(){
console.log('不添加该条语音');
this.setData({ this.setData({
sound:'',
btn1:true, btn1:true,
btn2:false, btn2:false,
btn3:false, btn3:false,
soundTime:0 showLtqp: true,
minute:0,
second:0,
millisecond:0,
soundTime:'00:00:00'
}) })
}, },
// delSound(){
// console.log('不添加该条语音');
// this.setData({
// sound:'',
// btn1:true,
// btn2:false,
// btn3:false,
// soundTime:'00:00:00'
// })
// },
logout(){ logout(){
req.deleteRequest('/api/user/logout',{}).then((res)=>{ req.deleteRequest('/api/user/logout',{}).then((res)=>{
if(res.data.code===200){ if(res.data.code===200){
@ -257,15 +301,15 @@ Page({
console.log('获取当前用户信札内容'); console.log('获取当前用户信札内容');
req.getRequest('/api/user/curt/letter',{}).then(res => { req.getRequest('/api/user/curt/letter',{}).then(res => {
console.log(res); console.log(res);
res.data.data.messageList.forEach(item => { // res.data.data.messageList.forEach(item => {
if(item.type === 'text'){ // if(item.type === 'text'){
this.setData({content: item.content}) // this.setData({content: item.content})
} // }
}) // })
this.setData({ // this.setData({
to: res.data.data.to, // to: res.data.data.to,
from: res.data.data.from, // from: res.data.data.from,
}) // })
}) })
}, },
/** /**

@ -23,7 +23,7 @@
<view class="{{Preview ? 'xinfo-ltqp-yl' : 'xinfo-ltqp'}}" wx:if="{{showLtqp}}"> <view class="{{Preview ? 'xinfo-ltqp-yl' : 'xinfo-ltqp'}}" wx:if="{{showLtqp}}">
<image src="https://wk921-1316969570.cos.ap-nanjing.myqcloud.com/ltqp.png"></image> <image src="https://wk921-1316969570.cos.ap-nanjing.myqcloud.com/ltqp.png"></image>
<image class="xinfo-yuying" src="https://wk921-1316969570.cos.ap-nanjing.myqcloud.com/%E8%AF%AD%E9%9F%B3.png"></image> <image class="xinfo-yuying" src="https://wk921-1316969570.cos.ap-nanjing.myqcloud.com/%E8%AF%AD%E9%9F%B3.png"></image>
<view class="xinfo-ltqp-text">224″</view> <view class="xinfo-ltqp-text">{{duration}}</view>
<t-icon class="xinfo-close" name="close-circle" size="48rpx" wx:if="{{!Preview}}" bindtap="ClearYl"/> <t-icon class="xinfo-close" name="close-circle" size="48rpx" wx:if="{{!Preview}}" bindtap="ClearYl"/>
</view> </view>
<view class="{{Preview ? 'xinfo-img-yl' : 'xinfo-img'}}" wx:if="{{showImg}}"> <view class="{{Preview ? 'xinfo-img-yl' : 'xinfo-img'}}" wx:if="{{showImg}}">
@ -51,19 +51,22 @@
</view> </view>
<view class="sound" wx:if="{{showSound}}"> <view class="sound" wx:if="{{showSound}}">
<view class="closeSound" bindtap="closeSound"></view> <view class="closeSound"></view>
<view class="sound-box"> <view class="sound-box">
<view class="sound-box-top"> <view class="sound-box-top">
<view bindtap="delSound">取消</view> <view bindtap="closeSound">取消</view>
<view bindtap="addSound">添加</view> <view bindtap="addSound">添加</view>
</view> </view>
<view class="sound-box-time">{{soundTime}}</view> <view class="sound-box-time">{{soundTime}}</view>
<view class="sound-box-img"></view> <view class="sound-box-img" wx:if="{{showSoundImg}}"></view>
<view class="sound-box-img2" wx:if="{{!showSoundImg}}">
<image wx:for="{{35}}" wx:key="index" src="https://wk921-1316969570.cos.ap-nanjing.myqcloud.com/iconPark-acoustic%20Copy%203%401x.png"/>
</view>
<view class="sound-box-btn"> <view class="sound-box-btn">
<view class="btn1"> <view class="btn1">
<view wx:if="{{btn1}}" class="btn-being" bindlongpress="startSound" bindtouchend="endSound"></view> <view wx:if="{{btn1}}" class="btn-being" bindtap="startSound"></view>
<view wx:if="{{btn2}}" class="btn-over" bindtap="playVoice"></view> <view wx:if="{{btn2}}" class="btn-over" bindtap="endSound"></view>
<view wx:if="{{btn3}}" class="btn-audition"></view> <view wx:if="{{btn3}}" class="btn-audition" bindtap="playVoice"></view>
</view> </view>
</view> </view>
</view> </view>

@ -375,6 +375,32 @@
background-image: url(https://wk921-1316969570.cos.ap-nanjing.myqcloud.com/iconPark-acoustic%20Copy%203%401x.png); background-image: url(https://wk921-1316969570.cos.ap-nanjing.myqcloud.com/iconPark-acoustic%20Copy%203%401x.png);
} }
.sound-box-img2 {
width: 1000px;
height: 50rpx;
margin-top: 40rpx;
animation: move 5s infinite linear;
}
.sound-box-img2 image {
width: 50rpx;
height: 50rpx;
}
/* 定义动画 */
/* 定义和调用动画 */
@keyframes move {
/* 动画的第一个状态和盒子的默认状态相同, 可以省略动画的开始状态代码 */
/* from {
transform: translateX(0);
} */
to {
transform: translateX(-750rpx);
/* transform: translateX(-900px); */
/* transform: translateX(-800px); */
}
}
.sound-box-btn { .sound-box-btn {
width: 100%; width: 100%;
height: 120rpx; height: 120rpx;

@ -8,7 +8,7 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
img:'https://wk921-1316969570.cos.ap-nanjing.myqcloud.com/xzimg.png', img:'',
letterMsg:{}, letterMsg:{},
showLetter: true, showLetter: true,
showMore: false, showMore: false,

@ -21,6 +21,20 @@
"query": "", "query": "",
"launchMode": "default", "launchMode": "default",
"scene": null "scene": null
},
{
"name": "",
"pathName": "pages/home/xx/xz/xz",
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "",
"pathName": "pages/home/xx/hy/hx/hx",
"query": "",
"launchMode": "default",
"scene": null
} }
] ]
} }

Loading…
Cancel
Save