From 74f9cb99022b4afc8cefda9371cd7ec9eac220fa Mon Sep 17 00:00:00 2001 From: Wkang921 Date: Tue, 1 Aug 2023 16:29:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/home/jl/index.js | 10 +- pages/home/jl/index.wxml | 4 +- pages/home/jl/index.wxss | 18 +-- pages/home/xx/hy/hx/hx.js | 20 +-- pages/home/xx/hy/index.js | 65 ++++++--- pages/home/xx/hy/index.wxml | 24 ++-- pages/home/xx/hy/index.wxss | 31 +++-- pages/home/xx/hy/yx/yx.js | 17 ++- pages/home/xx/hy/zt/zt.js | 16 ++- pages/home/xx/hy/zt/zt.wxml | 8 +- pages/home/xx/lindex/lindex.js | 98 ++++++++------ pages/home/xx/lindex/lindex.json | 4 +- pages/home/xx/lindex/lindex.wxml | 134 +++++++++---------- pages/home/xx/lindex/lindex.wxss | 82 +++++++++--- pages/home/xx/lindex/lxz/lxz.js | 213 ++++++++++++++++++++++-------- pages/home/xx/lindex/lxz/lxz.wxml | 91 ++++++++----- pages/home/xx/lindex/lxz/lxz.wxss | 207 +++++++++++++++++++++-------- pages/home/xx/xz/xz.wxml | 4 +- pages/home/xx/xz/xz.wxss | 4 +- pages/home/xy/index.js | 1 - pages/home/xyc/index.js | 19 ++- project.private.config.json | 13 +- 22 files changed, 701 insertions(+), 382 deletions(-) diff --git a/pages/home/jl/index.js b/pages/home/jl/index.js index af32cae..dc911bc 100644 --- a/pages/home/jl/index.js +++ b/pages/home/jl/index.js @@ -84,13 +84,13 @@ Page({ /**获取形象对应的图片 */ getXxObj(){ const horoscopes = wx.getStorageSync('xy-static-img') - const type = this.data.userInfo.horoscope.name - console.log(horoscopes) + const userType = this.data.userInfo.constellation + const loveType = this.data.loverInfo.constellation this.setData({ - xingxiangtu: horoscopes[type].sprite, - elfAvatar: horoscopes[type][`elf-avatar`] + xingxiangtu: horoscopes[userType].sprite, + xingxiangtuLove: horoscopes[loveType].sprite, + elfAvatar: horoscopes[userType][`elf-avatar`] }) - console.log(this.data.elfAvatar); }, ShowOrNotLogo(){ this.setData({showSexLogo:!this.data.showSexLogo}) diff --git a/pages/home/jl/index.wxml b/pages/home/jl/index.wxml index b245883..7dc2d3c 100644 --- a/pages/home/jl/index.wxml +++ b/pages/home/jl/index.wxml @@ -51,7 +51,7 @@ - + @@ -231,7 +231,7 @@ - + diff --git a/pages/home/jl/index.wxss b/pages/home/jl/index.wxss index 7ab2800..0e073f9 100644 --- a/pages/home/jl/index.wxss +++ b/pages/home/jl/index.wxss @@ -504,7 +504,7 @@ page { justify-content: space-between; align-items: flex-end; flex-direction: column; - z-index: 3; + z-index: 9999; } .xxtr-xt2 { @@ -1050,18 +1050,20 @@ picker-view-column { position: absolute; top: 646rpx; left: 10rpx; - width: 100rpx; - height: 150rpx; + width: 30rpx; + height: 90rpx; background-size: cover; - background-image: url(https://wish-assets.oss-cn-hangzhou.aliyuncs.com/xy/if-curved-left.png); + opacity: 0.5; + background-image: url(https://wish-assets.oss-cn-hangzhou.aliyuncs.com/xy/curved-left.png); } .swiper-btn-right { position: absolute; top: 646rpx; right: 10rpx; - width: 100rpx; - height: 150rpx; + width: 30rpx; + height: 90rpx; background-size: cover; - background-image: url(https://wish-assets.oss-cn-hangzhou.aliyuncs.com/xy/if-curved-right.png); -} \ No newline at end of file + opacity: 0.5; + background-image: url(https://wish-assets.oss-cn-hangzhou.aliyuncs.com/xy/curved-right.png); +} diff --git a/pages/home/xx/hy/hx/hx.js b/pages/home/xx/hy/hx/hx.js index f2df6a1..872d567 100644 --- a/pages/home/xx/hy/hx/hx.js +++ b/pages/home/xx/hy/hx/hx.js @@ -11,29 +11,29 @@ Page({ image: '' }, go2Reback(){ - wx.navigateTo({ + wx.redirectTo({ url: '/pages/home/xx/lindex/lindex' - }) + }) }, go2Xz(){ - wx.navigateTo({ + wx.redirectTo({ url: '/pages/home/xx/hy/index' - }) + }) }, go2Yx(){ - wx.navigateTo({ + wx.redirectTo({ url: '/pages/home/xx/hy/yx/yx' - }) + }) }, go2Hx(){ - wx.navigateTo({ + wx.redirectTo({ url: '/pages/home/xx/hy/hx/hx' - }) + }) }, go2Zt(){ - wx.navigateTo({ + wx.redirectTo({ url: '/pages/home/xx/hy/zt/zt' - }) + }) }, blockClick(e){ console.log(e.target.dataset.url); diff --git a/pages/home/xx/hy/index.js b/pages/home/xx/hy/index.js index 5a38155..8619168 100644 --- a/pages/home/xx/hy/index.js +++ b/pages/home/xx/hy/index.js @@ -10,32 +10,50 @@ Page({ list: [] }, go2Reback(){ - wx.navigateTo({ + wx.redirectTo({ url: '/pages/home/xx/lindex/lindex' - }) + }) }, go2Xz(){ - wx.navigateTo({ + wx.redirectTo({ url: '/pages/home/xx/hy/index' }) }, go2Yx(){ - wx.navigateTo({ + wx.redirectTo({ url: '/pages/home/xx/hy/yx/yx' }) }, go2Hx(){ - wx.navigateTo({ + wx.redirectTo({ url: '/pages/home/xx/hy/hx/hx' - }) + }) }, go2Zt(){ - wx.navigateTo({ + wx.redirectTo({ url: '/pages/home/xx/hy/zt/zt' - }) + }) }, - delLetter(){ - console.log('删除'); + delLetter(e){ + const id = e.currentTarget.dataset.item.id + const isSelf = e.currentTarget.dataset.item.isSelf + if (isSelf) { + req.deleteRequest(`/api/user/curt/message/${id}`,{}).then(res => { + console.log(res); + if (res.data.code === 200) { + wx.showToast({ + title: '删除成功', + icon: 'success' + }) + this.getList() + } + }) + }else{ + wx.showToast({ + title: '只能删除自己的信札', + icon: 'none' + }) + } }, getList(){ req.getRequest('/api/user/curt/message/lover',{ @@ -55,8 +73,12 @@ Page({ const minute = date.getMinutes(); const second = date.getSeconds(); + // 补零 + const formattedHours = hour < 10 ? `0${hour}` : hour + const formattedMinutes = minute < 10 ? `0${minute}` : minute + // 格式化时间 - const formattedDate = `${year}年${month}月${day}日 ${hour}:${minute}`; + const formattedDate = `${year}年${month}月${day}日 ${formattedHours}:${formattedMinutes}`; item.createdAt = formattedDate }) @@ -65,12 +87,21 @@ Page({ }) }, getLoveInfo(){ - req.getRequest('/api/user/curt/lover',{}).then(res => { - console.log(res); - this.setData({ - avatar: res.data.data.avatar, - nick: res.data.data.nick - }) + const userInfo = wx.getStorageSync('xinyuan-userInfo') + const loveInfo = wx.getStorageSync('xinyuan-userLoveInfo') + this.setData({ + myAvatar: userInfo.avatar, + loveAvatar: loveInfo.avatar, + myNick: userInfo.nick, + loveNick: loveInfo.nick + }) + }, + + getMsgDetail(e){ + const id = e.currentTarget.dataset.id + console.log(id); + wx.redirectTo({ + url: `/pages/home/xx/lindex/lxz/lxz?id=${id}&&hy=1` }) }, diff --git a/pages/home/xx/hy/index.wxml b/pages/home/xx/hy/index.wxml index 66eaf5a..250b58c 100644 --- a/pages/home/xx/hy/index.wxml +++ b/pages/home/xx/hy/index.wxml @@ -1,7 +1,9 @@ - -信札 + + + 纸条 + @@ -9,23 +11,25 @@ - + + + - 昵称七个字昵称 + {{item.isSelf ? myNick : loveNick}} {{item.createdAt}} - + - 删除 + 删除 -信札 -音讯 -画像 -纸条 + 信札 + 音讯 + 画像 + 纸条 \ No newline at end of file diff --git a/pages/home/xx/hy/index.wxss b/pages/home/xx/hy/index.wxss index b0a5e8a..c415894 100644 --- a/pages/home/xx/hy/index.wxss +++ b/pages/home/xx/hy/index.wxss @@ -1,31 +1,37 @@ /* pages/home/xx/hy/index.wxss */ -.reback{ +.header { position: fixed; - margin-left: 20rpx; - margin-top:108rpx; + top: 0; + width: 100%; + height: 176rpx; + padding-top: 88rpx; + box-sizing: border-box; + display: flex; + justify-content: center; + align-items: center; + background-color: #fff; + z-index: 1; +} +.reback{ + position: absolute; + left: 20rpx; width:48rpx; height:48rpx; background-repeat: no-repeat; background-size:100% 100%; - z-index: 1; background-image: url(https://wish-assets.windymuse.com.cn/xy/reback.png); } - .title{ - position: fixed; - left: 278rpx; - top: 108rpx; width: 196rpx; height: 48rpx; color: rgba(108, 108, 108, 1); font-size: 32rpx; text-align: center; - z-index: 1; - font-family: SourceHanSansSC-regular; } .xfgjl{ position: fixed; - left: 0px; + bottom: 0; + left: 0; display: flex; justify-content: space-evenly; margin-top: 1416rpx; @@ -51,12 +57,13 @@ } .main { - position: absolute; width: 100%; height: 100%; padding-top: 208rpx; + padding-bottom: 200rpx; box-sizing: border-box; background-size: contain; + overflow-y: scroll; } .main-bgc { diff --git a/pages/home/xx/hy/yx/yx.js b/pages/home/xx/hy/yx/yx.js index 959abc3..998a5e0 100644 --- a/pages/home/xx/hy/yx/yx.js +++ b/pages/home/xx/hy/yx/yx.js @@ -11,27 +11,27 @@ Page({ isPlay: true }, go2Reback(){ - wx.navigateTo({ + wx.redirectTo({ url: '/pages/home/xx/lindex/lindex' }) }, go2Xz(){ - wx.navigateTo({ + wx.redirectTo({ url: '/pages/home/xx/hy/index' }) }, go2Yx(){ - wx.navigateTo({ + wx.redirectTo({ url: '/pages/home/xx/hy/yx/yx' }) }, go2Hx(){ - wx.navigateTo({ + wx.redirectTo({ url: '/pages/home/xx/hy/hx/hx' }) }, go2Zt(){ - wx.navigateTo({ + wx.redirectTo({ url: '/pages/home/xx/hy/zt/zt' }) }, @@ -75,9 +75,12 @@ Page({ const hour = date.getHours(); const minute = date.getMinutes(); const second = date.getSeconds(); + // 补零 + const formattedHours = hour < 10 ? `0${hour}` : hour + const formattedMinutes = minute < 10 ? `0${minute}` : minute - // 格式化时间 - const formattedDate = `${year}年${month}月${day}日 ${hour}:${minute}`; + // 格式化时间 + const formattedDate = `${year}年${month}月${day}日 ${formattedHours}:${formattedMinutes}`; item.createdAt = formattedDate }) console.log(list); diff --git a/pages/home/xx/hy/zt/zt.js b/pages/home/xx/hy/zt/zt.js index 07c3c08..74c1c59 100644 --- a/pages/home/xx/hy/zt/zt.js +++ b/pages/home/xx/hy/zt/zt.js @@ -12,27 +12,27 @@ Page({ userInfo: {} }, go2Reback(){ - wx.navigateTo({ + wx.redirectTo({ url: '/pages/home/xx/lindex/lindex' }) }, go2Xz(){ - wx.navigateTo({ + wx.redirectTo({ url: '/pages/home/xx/hy/index' }) }, go2Yx(){ - wx.navigateTo({ + wx.redirectTo({ url: '/pages/home/xx/hy/yx/yx' }) }, go2Hx(){ - wx.navigateTo({ + wx.redirectTo({ url: '/pages/home/xx/hy/hx/hx' }) }, go2Zt(){ - wx.navigateTo({ + wx.redirectTo({ url: '/pages/home/xx/hy/zt/zt' }) }, @@ -72,8 +72,12 @@ Page({ const minute = date.getMinutes(); const second = date.getSeconds(); + // 补零 + const formattedHours = hour < 10 ? `0${hour}` : hour + const formattedMinutes = minute < 10 ? `0${minute}` : minute + // 格式化时间 - const formattedDate = `${year}年${month}月${day}日 ${hour}:${minute}`; + const formattedDate = `${year}年${month}月${day}日 ${formattedHours}:${formattedMinutes}`; item.createdAt = formattedDate }) diff --git a/pages/home/xx/hy/zt/zt.wxml b/pages/home/xx/hy/zt/zt.wxml index 4ccab83..5106c88 100644 --- a/pages/home/xx/hy/zt/zt.wxml +++ b/pages/home/xx/hy/zt/zt.wxml @@ -27,10 +27,10 @@ -信札 -音讯 -画像 -纸条 + 信札 + 音讯 + 画像 + 纸条 diff --git a/pages/home/xx/lindex/lindex.js b/pages/home/xx/lindex/lindex.js index 3d38905..9a2d878 100644 --- a/pages/home/xx/lindex/lindex.js +++ b/pages/home/xx/lindex/lindex.js @@ -318,13 +318,8 @@ Page({ this.setData({dsQTime:this.data.dsQTime+this.data.second+1}) console.log(this.data.dsQTime) }, - allTap(){ - this.popover.onHide(); - }, - // 响应popover组件中的子元素点击事件 doDelXiaoxi(){ req.deleteRequest('/api/user/curt/message/'+this.data.delId,{}).then((res)=>{ - this.popover.onHide(); if(res.data.code==200){ wx.showToast({ title: '删除消息成功', @@ -351,24 +346,30 @@ Page({ icon: 'none' }); // 调用自定义组件 popover 中的 onHide 方法 - this.popover.onHide(); + // this.popover.onHide(); }, + // 删除消息 changAn(e){ - if(!this.popover){ - this.popover = this.selectComponent('#popover'); + const id = e.currentTarget.dataset.id + this.setData({delId:id}) + }, + deleteMsg(){ + console.log(this.data.delId); + req.deleteRequest(`/api/user/curt/message/${this.data.delId}`,{}).then(res => { + console.log(res); + if (res.data.code === 200) { + wx.showToast({ + title: '删除成功', + icon: 'success' + }) + this.doMessageInfo() + }else { + wx.showToast({ + title: '删除失败', + icon: 'error' + }) } - console.log('执行了长按。。。')// +e.currentTarget.dataset['index'] - console.log(e.currentTarget.dataset['id']) - this.setData({delId:e.currentTarget.dataset['id']}) - - // 获取按钮元素的坐标信息 - let id = 'button'// 或者 e.target.id 获取点击元素的 ID 值 - console.log(e.currentTarget.dataset['index']) - wx.createSelectorQuery().select('#' + e.currentTarget.dataset['index']).boundingClientRect(res => { - // 调用自定义组件 popover 中的 onDisplay 方法 - this.popover.onDisplay(res); - }).exec(); - + }) }, go2BcPic(){/**保存图片 */ let that= this; @@ -442,22 +443,24 @@ Page({ duration: 1000 }) }else{ - req.postRequest('/api/user/curt/message/lover',{"type": "text","content": this.data.ztText}).then((res)=>{ - this.onLoad() - if(res.data.code==200){ - + req.postRequest('/api/user/curt/message/lover',{ + type: 'text', + content: this.data.ztText + }).then((res)=>{ + if(res.data.code === 200){ + this.setData({ztVisible:false,ztText:''}) + this.onLoad() } }).catch((err)=>{ - console.log(err); + console.log(err); }) - this.setData({ztVisible:false,ztText:''}) } }, go2Huiyi(){/**跳转到回忆页面 */ - wx.navigateTo({ - url: '/pages/home/xx/hy/index' - }) + wx.redirectTo({ + url: '/pages/home/xx/hy/index' + }) }, doMessageInfo(){/**查询聊天信息 */ req.getRequest('/api/user/curt/message/lover',{ limit:-1}).then((res)=>{ @@ -471,7 +474,12 @@ Page({ const day = date.getDate() const hours = date.getHours() const minutes = date.getMinutes() - item.createdAt = `${year}年${month}月${day}日 ${hours}:${minutes}` + + // 补零 + const formattedHours = hours < 10 ? `0${hours}` : hours + const formattedMinutes = minutes < 10 ? `0${minutes}` : minutes + + item.createdAt = `${year}年${month}月${day}日 ${formattedHours}:${formattedMinutes}` }) // 塞选出对方的消息 @@ -582,11 +590,19 @@ Page({ }, doClickXz(){ this.setData({xinzhaVisible:true}) - console.log('点击了信札') - wx.navigateTo({ + wx.redirectTo({ url: '/pages/home/xx/lindex/lxz/lxz' - }) - }, + }) + }, + + getLetter(e){ + console.log(e.currentTarget.dataset.item.id,'222'); + const id = e.currentTarget.dataset.item.id + wx.redirectTo({ + url: '/pages/home/xx/lindex/lxz/lxz?id=' + id + }) + }, + doCancelXz(){ this.setData({xinzhaVisible:false}) }, @@ -595,17 +611,12 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad(options) { - console.log('开始。。。。') const innerAudioContext = wx.createInnerAudioContext({ useWebAudioImplement: false }) this.setData({innerAudioContext:innerAudioContext}) - this.popover = this.selectComponent('#popover'); - console.log('结束。。。。') this.doQueryInit() this.doMessageInfo() - /**----------------一下为编辑器代码-----------------*/ - }, /** @@ -616,11 +627,10 @@ Page({ this.doMessageInfo() // 轮询获取信息 - // const time = setInterval(() => { - // this.doMessageInfo() - // console.log('1111'); - // }, 2000); - // this.setData({time: time}) + const time = setInterval(() => { + this.doMessageInfo() + }, 2000); + this.setData({time: time}) }, /** diff --git a/pages/home/xx/lindex/lindex.json b/pages/home/xx/lindex/lindex.json index 38710c7..09095f2 100644 --- a/pages/home/xx/lindex/lindex.json +++ b/pages/home/xx/lindex/lindex.json @@ -2,8 +2,6 @@ "usingComponents": { "t-image": "tdesign-miniprogram/image/image", "t-popup": "tdesign-miniprogram/popup/popup", - "t-textarea": "tdesign-miniprogram/textarea/textarea", - "popover": "/components/popover", - "popover-item": "/components/popover-item" + "t-textarea": "tdesign-miniprogram/textarea/textarea" } } \ No newline at end of file diff --git a/pages/home/xx/lindex/lindex.wxml b/pages/home/xx/lindex/lindex.wxml index 784a687..8e81b38 100644 --- a/pages/home/xx/lindex/lindex.wxml +++ b/pages/home/xx/lindex/lindex.wxml @@ -6,7 +6,7 @@ 星讯 - + @@ -37,8 +37,9 @@ + 删除 - + {{item.status=='unread'?'未读':'已读'}} @@ -46,60 +47,64 @@ - - - - {{item.status=='unread'?'未读':'已读'}} + + + 删除 + {{item.status=='unread'?'未读':'已读'}} + + + {{item.extra.ssec}} + + + + + + + + {{item.extra.ssec}} + - - - {{item.status=='unread'?'未读':'已读'}} - - - {{item.extra.ssec}} - - - - - + + + 删除 + {{item.status=='unread'?'未读':'已读'}} + + + {{item.content}} + + - {{item.extra.ssec}} - - - - - - {{item.status=='unread'?'未读':'已读'}} - - - {{item.content}} - + + + 删除 + {{item.status=='unread'?'未读':'已读'}} + + - - - @@ -124,7 +129,7 @@ - + {{item.content}} {{item.status=='unread'?'未读':'已读'}} @@ -142,6 +147,8 @@ data-index="{{index}}" bindtap="doLuYINBoF" data-item="{{item}}" + data-id="{{item.id}}" + bindlongpress="changAn" > {{item.extra.ssec}} @@ -166,16 +173,12 @@ - - - - - - {{item.status=='unread'?'未读':'已读'}} - {{item.status=='unread'?'未读':'已读'}} - + + + + + {{item.status=='unread'?'未读':'已读'}} - @@ -202,7 +205,7 @@ - + @@ -224,7 +227,6 @@ - 取消 @@ -258,10 +260,4 @@ - - - - - 删除 - \ No newline at end of file diff --git a/pages/home/xx/lindex/lindex.wxss b/pages/home/xx/lindex/lindex.wxss index e786289..35858cb 100644 --- a/pages/home/xx/lindex/lindex.wxss +++ b/pages/home/xx/lindex/lindex.wxss @@ -326,11 +326,13 @@ text-overflow: ellipsis; } .xjtext{ - margin-left: 36rpx; - width: 123px; - text-overflow: -o-ellipsis-lastline; + width: 100%; + padding: 0 36rpx; + box-sizing: border-box; + white-space: nowrap; overflow: hidden; text-overflow: ellipsis; + text-align: center; } .dftextwd{ display: inline-block; @@ -409,6 +411,7 @@ font-family: SourceHanSansSC-regular; } .zjtablea2{ + position: relative; width: 100%; height: 134rpx; display: flex; @@ -457,6 +460,16 @@ } .zjtable3{ + position: relative; + width: 100%; + height: 150rpx; + display: flex; + align-items: center; + justify-content: flex-end; +} + +.zjtable4 { + position: relative; width: 100%; height: 150rpx; display: flex; @@ -464,6 +477,22 @@ justify-content: flex-end; } +.zjtableatp4 { + position: relative; + width: 100%; + height: 150rpx; + display: flex; + align-items: center; + justify-content: flex-start; +} + +.xz-box { + width: 186rpx; + height: 130rpx; + background-size: cover; + background-image: url(https://wish-assets.oss-cn-hangzhou.aliyuncs.com/xy/xz-box.png); +} + .zjxxbox1{ width: 360rpx; height: 120rpx; @@ -476,6 +505,17 @@ overflow: hidden; text-overflow: ellipsis; } + +.zjtextcontent { + width: 360rpx; + padding: 0 36rpx; + box-sizing: border-box; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + text-align: center; +} + .zjtextydwd1{ height: 100%; display: flex; @@ -485,20 +525,6 @@ margin: 0 10rpx 60rpx 0; } -.zjtextcontent{ - position: absolute; - margin-left: 52rpx; - margin-top: 41rpx; - width: 126px; - height: 21px; - line-height: 42rpx; - color: rgba(51, 51, 51, 1); - font-size: 14px; - font-family: SourceHanSansSC-regular; - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; -} .ztPop{ position: absolute; width:750rpx ; @@ -593,9 +619,10 @@ background-image: url(https://wish-assets.windymuse.com.cn/xy/xtreturn.png); background-color: transparent!important; } .zjtableatp1{ + position: relative; width: 100%; height: 220rpx; - padding: 0 32rpx; + /* padding: 0 32rpx; */ box-sizing: border-box; display: flex; align-items: center; @@ -605,7 +632,7 @@ background-image: url(https://wish-assets.windymuse.com.cn/xy/xtreturn.png); .zjtableatp2{ width: 100%; height: 150rpx; - padding: 0 32rpx; + /* padding: 0 32rpx; */ box-sizing: border-box; display: flex; align-items: center; @@ -615,7 +642,7 @@ background-image: url(https://wish-assets.windymuse.com.cn/xy/xtreturn.png); .zjtableatp3{ width: 100%; height: 220rpx; - padding: 0 32rpx; + /* padding: 0 32rpx; */ box-sizing: border-box; display: flex; align-items: center; @@ -1129,4 +1156,19 @@ background-image: url(https://wish-assets.windymuse.com.cn/xy/xtreturn.png); align-items: flex-end; background-color: rgba(255, 255, 255, 0.9); z-index: 99999; +} + +.delete-btn { + position: absolute; + top: -50rpx; + right: 120rpx; + width: 148rpx; + height: 84rpx; + color: #6c6c6c; + font-size: 28rpx; + display: flex; + align-items: center; + justify-content: center; + background-size: cover; + background-image: url(https://wish-assets.oss-cn-hangzhou.aliyuncs.com/xy/del-icon.png); } \ No newline at end of file diff --git a/pages/home/xx/lindex/lxz/lxz.js b/pages/home/xx/lindex/lxz/lxz.js index a28c6c5..1408082 100644 --- a/pages/home/xx/lindex/lxz/lxz.js +++ b/pages/home/xx/lindex/lxz/lxz.js @@ -13,13 +13,13 @@ Page({ content:'', audioList:[], // 音频列表 imgList:[], // 图片列表 + messageList: [{content: '', type: 'text', index: 1}], //消息列表 sound:'', soundTime:'00:00:00', duration: '', minute:0, //分 second:0, //秒 millisecond:0, //毫秒 - showBtn:true, showImgBig:false, //图片太大弹层 showSoundMore:false, //语音太多提示 showSend:false, //寄出提示 @@ -33,30 +33,48 @@ Page({ btn3:false, btn4:false, showSoundImg:true, - isPlaying: false, // 是否正在播放语音 + isPlaying: false // 是否正在播放语音 }, already(){ console.log('确定寄出'); this.setData({showAlready:true}) - const list = [ ...this.data.audioList, ...this.data.imgList] - list.push({ - type: 'text', - content: this.data.content + const list = [] + this.data.messageList.forEach(item => { + const obj = {} + obj.type = item.type + if (item.content) { + obj.content = item.content + } + if (item.resourceId) { + obj.resourceId = item.resourceId + } + if (item.extra) { + obj.extra = item.extra + } + if (item.videoSrc) { + obj.extra.videoSrc = item.videoSrc + } + if (item.img) { + obj.extra = {} + obj.extra.img = item.img + } + list.push(obj) }) - const fromData = { - from: this.data.from, - to: this.data.to, - messageList: list, - status:'unread' + const formData = { + type: 'letter', + letter: { + from: this.data.from, + to: this.data.to, + messages: list + } } - console.log(fromData); - // 修改信札 - req.putRequest('/api/user/curt/letter',fromData).then(res => { - console.log(res,'修改信札内容成功'); - // 修改状态 - req.patchRequest('/api/user/curt/letter/send',{}).then(res => { - console.log(res,'信札状态修改成功'); - }) + req.postRequest('/api/user/curt/message/lover',formData).then(res =>{ + if (res.data.code === 200) { + wx.showToast({ + title: '信札发送成功', + icon: 'success' + }) + } }) }, closeShowImgBig(){ @@ -74,31 +92,53 @@ Page({ closeShowImgToast(){this.setData({showImgToast: false})}, openPreview(){ console.log('预览'); - this.setData({Preview:true}) + if (this.data.letterId) { + if (this.data.hy) { + return wx.redirectTo({ + url: '/pages/home/xx/hy/index', + }) + } + return wx.redirectTo({ + url: '/pages/home/xx/lindex/lindex', + }) + } + this.setData({Preview : !this.data.Preview}) }, ClearYl(e){ console.log('清除语音'); const id = e.currentTarget.dataset.id - const list = this.data.audioList.filter(item => { + const list = this.data.messageList.filter(item => { return item.resourceId !== id }) - this.setData({audioList: list}) + this.setData({messageList: list}) }, ClearImg(e){ console.log('清除图片'); const id = e.currentTarget.dataset.id - const list = this.data.imgList.filter(item => { + const list = this.data.messageList.filter(item => { return item.resourceId !== id }) - this.setData({imgList: list}) + this.setData({messageList: list}) }, goBack(){ - if (this.data.Preview) { - this.setData({Preview: false}) - }else{ - console.log('返回'); - wx.navigateBack() - } + wx.redirectTo({ + url: '/pages/home/xx/lindex/lindex', + }) + }, + // 获取文本框内容 + getTextValue(e){ + const index = e.currentTarget.dataset.index + const content = e.detail.value + const list = this.data.messageList.map(item => { + if (item.index === index) { + return { + ...item, + content : content + } + } + return item + }) + this.setData({messageList: list}) }, // 上传图片 addImg(){ @@ -114,6 +154,7 @@ Page({ } }) }, + // 文件上传 uploadFile(file,type) { wx.uploadFile({ @@ -129,35 +170,53 @@ Page({ }, success: (async(res) => { const data = JSON.parse(res.data); - console.log(data); if (data.data.type === 'audio') { console.log('添加音频'); - const list = this.data.audioList - if(list.length >= 3){ + const list = this.data.messageList + const index = list.length + 1 + const audioList = list.filter(item => { + return item.type === 'audio' + }) + if(audioList.length >= 3){ this.setData({showSoundMore:true ,showSoundImg:true}) - console.log('语音太多了'); }else { list.push({ type: 'audio', resourceId: data.data.id, duration: this.data.duration, videoSrc: this.data.videoSrc, + index:index, extra: {duration : this.data.ssec} }) - this.setData({audioList: list}) + list.push({ + type: 'text', + content: '', + index: index + 1 + }) + this.setData({messageList: list}) } } else if (data.data.type === 'poster') { console.log('添加图片'); - const list = this.data.imgList - if (list.length >= 9) { + const list = this.data.messageList + const migList = list.filter(item => { + return item.type === 'graphic' + }) + if (migList.length >= 9) { this.setData({showImgToast : true}) }else { + const index = list.length + 1 list.push({ type: 'graphic', resourceId: data.data.id, img: data.data.abUrl, + index: index + }) + list.push({ + type: 'text', + content: '', + index: index + 1 }) - this.setData({imgList: list, showImg:true}) + this.setData({messageList: list, showImg:true}) } } }), @@ -288,39 +347,27 @@ Page({ } }, logout(){ - req.deleteRequest('/api/user/logout',{}).then((res)=>{ - if(res.data.code===200){ - wx.navigateTo({ - url: '/pages/index/index' - }) - wx.showToast({ - title:'寄出成功' - }) - } + wx.redirectTo({ + url: '/pages/home/xx/lindex/lindex', }) }, modify(){ this.setData({showAlready: false, showSend: false}) }, - getLetter(){ - console.log('获取当前用户信札内容'); - req.getRequest('/api/user/curt/letter',{}).then(res => { - console.log(res); - }) - }, // 点击音频试听 listen(e){ if (this.data.isPlaying) { return; // 如果正在播放语音,则不触发事件 } const id = e.currentTarget.dataset.url.resourceId - const videoSrc = this.data.audioList.find(item => { + const videoSrc = this.data.messageList.find(item => { return item.resourceId === id }).videoSrc console.log(videoSrc); const innerAudioContext = wx.createInnerAudioContext() innerAudioContext.src = videoSrc innerAudioContext.play() // 播放 + console.log('播放'); this.setData({ isPlaying: true }); // 设置为正在播放语音 innerAudioContext.onEnded(() => { this.setData({ isPlaying: false }); // 播放完毕后设置为非播放状态 @@ -332,12 +379,68 @@ Page({ this.setData({id:id}) }) }, + + // 获取信札消息 + getLetterDetail(id){ + req.getRequest(`/api/user/curt/message/${id}`,{}).then(res => { + console.log(res); + if(res.data.code === 200){ + const letter = res.data.data.letter + const messages = letter.messages.map(item => { + if (item.extra && item.extra.videoSrc) { + return { + ...item, + videoSrc: item.extra.videoSrc + } + } + if (item.extra && item.extra.img) { + return { + ...item, + img: item.extra.img + } + } + if (item.content) { + return item + } + }) + this.setData({ + from: letter.from, + to: letter.to, + messageList: messages + }) + + // 判断是否为情侣信札 是就更改信札状态 + if (res.data.data.fromUserid !== this.data.id && res.data.data.status === 'unread') { + req.patchRequest(`/api/user/curt/message/${id}/read`) + } + }else{ + wx.showToast({ + title: '获取信札内容失败', + icon: 'error' + }) + } + }) + }, + /** * 生命周期函数--监听页面加载 */ onLoad(options) { - this.getLetter() this.getUserInfo() + + // 回忆页面点击信札 数据回显示 + if (options.id) { + this.getLetterDetail(options.id) + this.setData({ + Preview: true, + letterId: options.id + }) + } + + // 判断是回忆页面跳转还是聊天页面跳转 + if(options.hy){ + this.setData({ hy: true }) + } }, /** diff --git a/pages/home/xx/lindex/lxz/lxz.wxml b/pages/home/xx/lindex/lxz/lxz.wxml index 8df52e7..6568fb0 100644 --- a/pages/home/xx/lindex/lxz/lxz.wxml +++ b/pages/home/xx/lindex/lxz/lxz.wxml @@ -1,11 +1,8 @@ - + - - To: {{to}} - - + To: @@ -15,39 +12,38 @@ - - - - - - - - {{item.extra.duration}} - - - - - - - + + + + + + + + + + {{item.extra.duration}} + + + + + + + + - - - - From: {{from}} - - + + - 音讯 - 画像 - 预览 - 寄出 + 音讯 + 画像 + 预览 + 寄出 @@ -104,7 +100,7 @@ - + 确定要寄出吗? 信件寄出后,再次使用晶石激活 将直接提示打开信件 @@ -132,3 +128,36 @@ + + + + + + + To:{{to}} + + + + + + + + + + {{item.extra.duration}} + + + + + + + + Form:{{from}} + + + + + + + + \ No newline at end of file diff --git a/pages/home/xx/lindex/lxz/lxz.wxss b/pages/home/xx/lindex/lxz/lxz.wxss index 301a116..e39a63b 100644 --- a/pages/home/xx/lindex/lxz/lxz.wxss +++ b/pages/home/xx/lindex/lxz/lxz.wxss @@ -54,43 +54,26 @@ page { .xinfo-content { width: 100%; height: 100%; - padding-bottom: 100rpx; + padding-bottom: 300rpx; + padding-top: 60rpx; box-sizing: border-box; overflow: auto; position: relative; pointer-events: auto; -} - -.xinfo-yl { - width: 100%; - height: 200rpx; + background-size: cover; + background-image: url(https://wish-assets.oss-cn-hangzhou.aliyuncs.com/xy/zx-bkg.png); } .xinfo-title { width: 100%; height: 100rpx; - margin-top: 60rpx; + margin-bottom: 60rpx; padding-left: 64rpx; box-sizing: border-box; font-size: 28rpx; color: rgba(108, 108, 108, 1); } -.xinfo-yl-title { - margin: 60rpx 0 0 50rpx; - font-size: 32rpx; - color: rgba(108, 108, 108, 1); -} - -.xinfo-yl-form { - width: 100%; - text-align: end; - margin-top: 30rpx; - padding-right: 64rpx; - box-sizing: border-box; - font-size: 32rpx; - color: rgba(108, 108, 108, 1); -} .title-to { display: flex; @@ -129,7 +112,7 @@ page { .xinfo-main { width: 100%; - margin: 60rpx 0 32rpx 0; + margin-bottom: 40rpx; padding: 0 64rpx; box-sizing: border-box; } @@ -153,29 +136,13 @@ textarea { position: relative; width: 382rpx; height: 84rpx; - margin: 0 0 20rpx 64rpx; - display: flex; - align-items: center; - background-size: contain; - background-image: url(https://wish-assets.windymuse.com.cn/xy/ltqpp.png); -} - -.xinfo-ltqp-yl { - position: relative; - width: 382rpx; - height: 84rpx; - margin: 0 0 20rpx 64rpx; + margin: 0 0 40rpx 64rpx; display: flex; align-items: center; background-size: contain; background-image: url(https://wish-assets.windymuse.com.cn/xy/ltqpp.png); } -.xinfo-ltqp-yl image { - width: 100%; - height: 100%; -} - .xinfo-ltqp image { width: 100%; height: 100%; @@ -202,23 +169,11 @@ textarea { .xinfo-img { position: relative; width: 480rpx; - margin: 40rpx 0 0 64rpx; + margin: 0 0 40rpx 64rpx; display: flex; justify-content: center; } -.xinfo-img-yl { - position: relative; - width: 480rpx; - margin: 40rpx 0 0 64rpx; - display: flex; - justify-content: center; -} - -.xinfo-img-yl image { - width: 100%; -} - .xinfo-img image { width: 100%; } @@ -356,6 +311,17 @@ textarea { box-shadow: 1px 2px 6px 0px rgba(0, 0, 0, 0.4); } +.taost-box2 { + width: 586rpx; + height: 434rpx; + padding-top: 88rpx; + box-sizing: border-box; + border-radius: 15px; + background-color: rgba(255, 255, 255, 1); + text-align: center; + box-shadow: 1px 2px 6px 0px rgba(0, 0, 0, 0.4); +} + .sound { position: relative; width: 100%; @@ -602,4 +568,139 @@ textarea { align-items: center; color: #fff; z-index: 999; +} + +editor { + background-color: pink; +} + + +/* 预览页面样式 */ +.preview { + position: relative; + width: 100%; + height: 100%; + display: flex; + justify-content: center; +} + +.preview-content { + width: 616rpx; + height: 1280rpx; + margin-top: 132rpx; + background-size: 100% 100%; + background-image: url(https://wish-assets.oss-cn-hangzhou.aliyuncs.com/xy/zx-bkg.png); +} + +.preview-content .content{ + width: 616rpx; + height: 1280rpx; + margin-top: 18rpx; + overflow-y: scroll; +} + +.preview-bkg { + position: absolute; + bottom: -190rpx; + width: 100%; + height: 924rpx; + background-size: 100% 100%; + background-image: url(https://wish-assets.windymuse.com.cn/xy/bgt2.png); + pointer-events: none; + display: flex; + justify-content: center; +} + +.preview-btn { + position: absolute; + left: 32rpx; + bottom: 132rpx; + width: 110rpx; + height: 110rpx; + border-radius: 50%; + background: linear-gradient(222.54deg, rgba(248,99,42,1) 14.03%,rgba(249,135,89,1) 85.21%); + color: rgba(16, 16, 16, 1); + box-shadow: 0px 4rpx 12rpx 0px rgba(0, 0, 0, 0.4); + font-family: -apple-system; + border: 6rpx solid rgba(255, 255, 255, 1); + display: flex; + justify-content: center; + align-items: center; +} + +.preview-btn-img { + width: 60rpx; + height: 60rpx; + background-size: cover; + background-image: url(https://wish-assets.windymuse.com.cn/xy/iconPark-return%401x.png); +} + +.preview-content-title { + color: #6c6c6c; + font-size: 32rpx; + text-align: left; + font-weight: 700; + margin: 50rpx 0 32rpx 60rpx; +} + +.preview-content-end { + color: #6c6c6c; + font-size: 32rpx; + text-align: right; + font-weight: 700; + margin: 50rpx 60rpx 80rpx 0; +} + +.preview-content-main { + color: #6c6c6c; + font-size: 32rpx; + margin: 0 60rpx 40rpx 60rpx; +} + +.preview-content-main .t-textarea { + width: 100%; + padding: 0; + font-size: 28rpx; + background-color: rgba(0, 0, 0, 0); +} + +.preview-content-ltqp { + position: relative; + width: 382rpx; + height: 84rpx; + margin: 0 0 40rpx 64rpx; + display: flex; + align-items: center; + background-size: contain; + background-image: url(https://wish-assets.windymuse.com.cn/xy/ltqpp.png); +} + +.preview-content-ltqp image { + margin: 0 40rpx; + width: 70rpx; + height: 70rpx; +} + +.preview-content-ltqp .text { + color: rgba(79, 79, 79, 1); + font-size: 14px; +} + +.preview-content-img { + display: flex; + justify-content: center; + margin-bottom: 40rpx; +} + +.preview-content-img image { + width: 480rpx; +} + +.preview-yz { + width: 146rpx; + height: 146rpx; + margin-top: 470rpx; + background-image: url(https://wish-assets.windymuse.com.cn/xy/%E5%8D%B0%E7%AB%A0.png); + background-size: cover; + pointer-events: auto; } \ No newline at end of file diff --git a/pages/home/xx/xz/xz.wxml b/pages/home/xx/xz/xz.wxml index 41eb214..6568fb0 100644 --- a/pages/home/xx/xz/xz.wxml +++ b/pages/home/xx/xz/xz.wxml @@ -134,7 +134,7 @@ - To:可能性的艺术 + To:{{to}} @@ -152,7 +152,7 @@ - Form:可能性的艺术 + Form:{{from}} diff --git a/pages/home/xx/xz/xz.wxss b/pages/home/xx/xz/xz.wxss index daef5a6..e39a63b 100644 --- a/pages/home/xx/xz/xz.wxss +++ b/pages/home/xx/xz/xz.wxss @@ -640,7 +640,7 @@ editor { font-size: 32rpx; text-align: left; font-weight: 700; - margin: 50rpx 0 0 60rpx; + margin: 50rpx 0 32rpx 60rpx; } .preview-content-end { @@ -654,7 +654,7 @@ editor { .preview-content-main { color: #6c6c6c; font-size: 32rpx; - margin: 32rpx 60rpx 40rpx 60rpx; + margin: 0 60rpx 40rpx 60rpx; } .preview-content-main .t-textarea { diff --git a/pages/home/xy/index.js b/pages/home/xy/index.js index 1c7be0e..aef2adf 100644 --- a/pages/home/xy/index.js +++ b/pages/home/xy/index.js @@ -97,7 +97,6 @@ Page({ upImprove(){ const mac = wx.getStorageSync('mac-key') req.patchRequest('/api/user/curt/horoscope/improve',{mac: mac}).then(res => { - console.log(res); }) }, diff --git a/pages/home/xyc/index.js b/pages/home/xyc/index.js index 347306f..ecdb720 100644 --- a/pages/home/xyc/index.js +++ b/pages/home/xyc/index.js @@ -160,12 +160,13 @@ Page({ duration: 5000 }) }else{ - console.log('图片地址', this.data.imgUrl); - console.log('图片地址', this.data.xyLink); - req.postRequest('/api/user/curt/wish',{content:this.data.xyContent,deadline:this.data.note,img:this.data.imgUrl,link:this.data.xyLink}).then((res)=>{ - console.log('许愿成功11111!') - console.log(res) - if(res.data.code==200){ + req.postRequest('/api/user/curt/wish',{ + content:this.data.xyContent, + deadline:this.data.note, + img:this.data.imgUrl, + link:this.data.xyLink + }).then((res)=>{ + if(res.data.code === 200){ this.setData({ visible: false, }); @@ -182,16 +183,14 @@ Page({ }) wx.hideTabBar() },2000) + this.initXy() }else{ - console.log('额外情况') wx.showToast({ title:res.data.msg, icon: 'none', duration: 5000 }) } - - }).catch((err)=>{ wx.showToast({ title:'出错了:'+err.data.msg, @@ -199,7 +198,6 @@ Page({ duration: 5000 }) }) - console.log('许愿成功111!') } @@ -213,7 +211,6 @@ Page({ this.setData({single:false}) } } - console.log(this.userInfo); }).catch((err)=>{ console.log(err); }) diff --git a/project.private.config.json b/project.private.config.json index 6729c62..0108ebd 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -8,13 +8,6 @@ "condition": { "miniprogram": { "list": [ - { - "name": "", - "pathName": "pages/home/xx/index", - "query": "", - "launchMode": "default", - "scene": null - }, { "name": "", "pathName": "pages/home/xx/lindex/lindex", @@ -24,21 +17,21 @@ }, { "name": "", - "pathName": "pages/home/xx/xz/xz", + "pathName": "pages/home/xx/lindex/lxz/lxz", "query": "", "launchMode": "default", "scene": null }, { "name": "", - "pathName": "pages/home/xx/xz/xz", + "pathName": "pages/home/xx/hy/index", "query": "", "launchMode": "default", "scene": null }, { "name": "", - "pathName": "pages/xz/index", + "pathName": "pages/home/jl/index", "query": "", "launchMode": "default", "scene": null