Commit 3e53f13e authored by liwei's avatar liwei

修改了留言限制

parent 8f5ba615
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
<view style="background-color: #F4F5F9;min-height: 100vh;"> <view style="background-color: #F4F5F9;min-height: 100vh;">
<!-- 页头 --> <!-- 页头 -->
<u-navbar @leftClick="backbar" bgColor="#F4F5F9" title="个人留言"></u-navbar> <u-navbar @leftClick="backbar" bgColor="#F4F5F9" title="个人留言"></u-navbar>
<view class="fixed-buttons"> <view class="fixed-buttons" :style="{'top':navHeight+'px','position': 'relative'}">
<view class="button-item" @click="addBlack">拉黑</view> <view class="button-item" @click="addBlack">拉黑</view>
<view class="vertical-line" style="width: 1px; height: 50rpx; background-color: #808080;"></view> <view class="vertical-line" style="width: 1px; height: 50rpx; background-color: #808080;"></view>
<view class="button-item">关注</view> <view class="button-item">要微信</view>
</view> </view>
<view style="height: 80rpx;"></view> <view style="height: 80rpx;"></view>
<z-paging ref="paging" empty-view-text=" " <z-paging ref="paging" empty-view-text=" "
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
</template> </template>
<script> <script>
import {addBlack, addMessage, telMessage} from "../../api/user"; import {addBlack, addMessage, deleteFollow, telMessage} from "../../api/user";
import {getOssUrl} from "../../api/article"; import {getOssUrl} from "../../api/article";
export default { export default {
...@@ -68,12 +68,32 @@ export default { ...@@ -68,12 +68,32 @@ export default {
chatList: [], chatList: [],
inputTemp: '', inputTemp: '',
targetId: '', targetId: '',
menuButtonInfo:'',
navHeight:0,
} }
}, },
onLoad(options) { onLoad(options) {
this.targetId = options.targetId this.targetId = options.targetId
//导航栏高度
this.menuButtonInfo = uni.getMenuButtonBoundingClientRect()
const {
top,
width,
height,
right
} = this.menuButtonInfo
uni.getSystemInfo({
success: (res) => {
const {
statusBarHeight
} = res;
const margin = top - statusBarHeight
this.navHeight = (height + statusBarHeight + (margin * 2)) //导航栏总高
}
})
}, },
onShow(){ onShow(){
this.userInfo = uni.getStorageSync('userInfo')
// 滚动到页面底部 // 滚动到页面底部
this.$nextTick(() => { this.$nextTick(() => {
this.pageScrollToBottom() this.pageScrollToBottom()
...@@ -141,19 +161,45 @@ export default { ...@@ -141,19 +161,45 @@ export default {
return return
} }
const data = { const data = {
targetId: this.targetId, targetId: this.targetId,//目标id
content: inputValue content: inputValue,//输入的内容
isPay:'0',//1花费 0不花费,
wxOpenid: this.userInfo.wxOpenid
} }
addMessage(data).then(res => { addMessage(data).then(res => {
if (res.data.code == 200){ if (res.data.code == 200){
this.getMessageList() this.getMessageList()
this.inputTemp = '' this.inputTemp = ''
} else { } else if (res.data.code === 1001){
//留言超出限制 是否采用金币进行留言
uni.showModal({
title: '提示',
content: '已超出留言次数,是否花费1金币再进行留言',
success: (res) => {
if (res.confirm) {
const form = {
targetId: this.targetId,//目标id
content: inputValue,//输入的内容
isPay:'1',//1花费 0不花费
wxOpenid: this.userInfo.wxOpenid
}
addMessage(form).then(res=>{
if (res.data.code == 200){
this.getMessageList()
this.inputTemp = ''
}
})
} else if (res.cancel) {
}
}
});
this.inputTemp = ''
} else if(res.data.code === 1002){
uni.showToast({ uni.showToast({
title: res.data.message, title: res.data.message,
icon: 'none' icon: 'none'
}) })
this.inputTemp = ''
} }
}) })
// 滚动到页面底部 // 滚动到页面底部
...@@ -346,8 +392,6 @@ export default { ...@@ -346,8 +392,6 @@ export default {
.fixed-buttons{ .fixed-buttons{
display: flex; display: flex;
justify-content: space-evenly; justify-content: space-evenly;
position: fixed;
top: 120rpx;
width: 100%; width: 100%;
z-index: 99; z-index: 99;
} }
...@@ -359,4 +403,4 @@ export default { ...@@ -359,4 +403,4 @@ export default {
background-color: #cbcbcb; background-color: #cbcbcb;
color: black; color: black;
} }
</style> </style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment