Commit c3f16e8b authored by 罗林杰's avatar 罗林杰

修改留言

parent 1087e21a
...@@ -97,4 +97,25 @@ export function addMessage(data){ ...@@ -97,4 +97,25 @@ export function addMessage(data){
data: data, data: data,
method: 'POST', method: 'POST',
}); });
}
/**
* 获取消息列表
*/
export function messageList(data){
return request({
method: "get",
url: '/app/memInfo/leaveMessageList',
data
});
}
/**
* 获取对话消息
*/
export function telMessage(data){
return request({
method: "get",
url: '/app/memInfo/leaveMessageDetailList',
data,
});
} }
\ No newline at end of file
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
count></u-textarea> count></u-textarea>
</view> </view>
<view class="adding" @click="saveAbout"> <view class="adding" @click="saveAbout">
保存 发送
</view> </view>
<ELM ref="elm" :msg="tipMsg" :isConfirm="isConfirm" @confirm="confirm"></ELM> <ELM ref="elm" :msg="tipMsg" :isConfirm="isConfirm" @confirm="confirm"></ELM>
</view> </view>
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
addMessage(data).then(res => { addMessage(data).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.isConfirm = true; this.isConfirm = true;
this.tipMsg = "保存成功"; this.tipMsg = "发送成功";
this.$refs.elm.showDialog(); this.$refs.elm.showDialog();
} else { } else {
this.tipMsg = res.data.msg; this.tipMsg = res.data.msg;
......
...@@ -74,6 +74,18 @@ ...@@ -74,6 +74,18 @@
></u-icon> ></u-icon>
</u-form-item> </u-form-item>
</u--form> </u--form>
<view class="u-page__tag-item">
<u-tag
v-for="(item, index) in checkboxs"
:key="index"
:text="`选项${index + 1}`"
:plain="!item.checked"
type="warning"
:name="index"
@click="checkboxClick"
>
</u-tag>
</view>
<u-button <u-button
type="primary" type="primary"
text="提交" text="提交"
...@@ -126,9 +138,10 @@ ...@@ -126,9 +138,10 @@
<script> <script>
import UFormItem from "../uni_modules/uview-ui/components/u-form-item/u-form-item"; import UFormItem from "../uni_modules/uview-ui/components/u-form-item/u-form-item";
import {getOptions} from "../common/options"; import {getOptions} from "../common/options";
import UCol from "../uni_modules/uview-ui/components/u-col/u-col.vue";
export default { export default {
components: {UFormItem}, components: {UCol, UFormItem},
data() { data() {
return { return {
//数据选项 //数据选项
...@@ -148,6 +161,44 @@ export default { ...@@ -148,6 +161,44 @@ export default {
value: '0101' value: '0101'
}] }]
], ],
checkboxs: [
{
checked: true,
},
{
checked: false,
},
{
checked: false,
},
{
checked: false,
},
{
checked: false,
},
{
checked: false,
},
{
checked: false,
},
{
checked: false,
},
{
checked: false,
},
{
checked: false,
},
{
checked: false,
},
{
checked: false,
},
],
//选择器显示 //选择器显示
showSex: false, showSex: false,
showResidence: false, showResidence: false,
...@@ -216,6 +267,9 @@ export default { ...@@ -216,6 +267,9 @@ export default {
memResidenceCity:'',//居住城市 memResidenceCity:'',//居住城市
} }
}, },
checkboxClick(name) {
this.checkboxs[name].checked = !this.checkboxs[name].checked;
},
//阻止键盘 //阻止键盘
hideKeyboard() { hideKeyboard() {
uni.hideKeyboard() uni.hideKeyboard()
...@@ -230,4 +284,8 @@ export default { ...@@ -230,4 +284,8 @@ export default {
padding-left: 20rpx; padding-left: 20rpx;
padding-right: 20rpx; padding-right: 20rpx;
} }
.u-page__tag-item {
display: flex;
flex-wrap: wrap;
}
</style> </style>
...@@ -6,22 +6,22 @@ ...@@ -6,22 +6,22 @@
<view class="page-body" id="x_chat"> <view class="page-body" id="x_chat">
<view v-for="(item, index) in chatList" :key="index"> <view v-for="(item, index) in chatList" :key="index">
<view class="chat-item-body"> <view class="chat-item-body">
<view class="chat-item-time">{{item.time}}</view> <view class="chat-item-time">{{item.createDate}}</view>
<view v-if="item.type == '0'" class="chat-item-layout chat-left"> <view v-if="item.userId == targetId" class="chat-item-layout chat-left">
<view class="chat-inner-layout"> <view class="chat-inner-layout">
<view class="chat-item-name">{{item.name}}</view> <view class="chat-item-name">{{item.memNickName}}</view>
<view class="chat-item-msg-layout"> <view class="chat-item-msg-layout">
<image class="chat-item-photo" @tap="scanClick" :src="item.photoUrl" mode="aspectFit"></image> <image class="chat-item-photo" :src="item.avatarUrl" mode="aspectFit"></image>
<view class="chat-inner-msg-left">{{item.msg}}</view> <view class="chat-inner-msg-left">{{item.leaveMessageContent}}</view>
</view> </view>
</view> </view>
</view> </view>
<view v-if="item.type == '1'" class="chat-item-layout chat-right"> <view v-else class="chat-item-layout chat-right">
<view class="chat-inner-layout"> <view class="chat-inner-layout">
<view class="chat-item-name-right">{{item.name}}</view> <view class="chat-item-name-right">{{item.memNickName}}</view>
<view class="chat-item-msg-layout"> <view class="chat-item-msg-layout">
<view class="chat-inner-msg-right">{{item.msg}} </view> <view class="chat-inner-msg-right">{{item.leaveMessageContent}} </view>
<image class="chat-item-photo" @tap="scanClick" :src="item.photoUrl" mode="aspectFit"></image> <image class="chat-item-photo" :src="item.avatarUrl" mode="aspectFit"></image>
</view> </view>
</view> </view>
</view> </view>
...@@ -37,155 +37,26 @@ ...@@ -37,155 +37,26 @@
</template> </template>
<script> <script>
import {addMessage, telMessage} from "../../api/user";
import {getOssUrl} from "../../api/article";
export default { export default {
name: "info", name: "info",
data() { data() {
return { return {
chatList: [ chatList: [],
{
type: '0',
name: '群主',
msg: '大家好,欢迎进入微社区群,如有问题可在群里聊天询问',
time: '2024-01-26 13:43:12',
photoUrl: 'https://zhsq.zhnbxc.top:58080/weChatFile/szfwPeople/icon_chat_photo_two.jpg',
},
{
type: '0',
name: '小助手',
msg: '2024微报事、微呼应活动正在进行中,希望大家踊跃参加。',
time: '2024-01-26 13:43:15',
photoUrl: 'https://zhsq.zhnbxc.top:58080/weChatFile/szfwPeople/icon_service.png',
},
{
type: '1',
name: '',
msg: '已参加微呼应活动',
time: '2024-01-26 13:56:10',
photoUrl: 'https://zhsq.zhnbxc.top:58080/weChatFile/szfwPeople/icon_chat_photo_three.jpg',
},
{
type: '0',
name: '第五网格员',
msg: '已参加微报事活动',
time: '2024-01-26 13:59:12',
photoUrl: 'https://zhsq.zhnbxc.top:58080/weChatFile/szfwPeople/icon_chat_photo_one.jpg',
},
{
type: '0',
name: '群主',
msg: '大家好,欢迎进入微社区群,如有问题可在群里聊天询问',
time: '2024-01-26 13:43:12',
photoUrl: 'https://zhsq.zhnbxc.top:58080/weChatFile/szfwPeople/icon_chat_photo_two.jpg',
},
{
type: '0',
name: '小助手',
msg: '2024微报事、微呼应活动正在进行中,希望大家踊跃参加。',
time: '2024-01-26 13:43:15',
photoUrl: 'https://zhsq.zhnbxc.top:58080/weChatFile/szfwPeople/icon_service.png',
},
{
type: '1',
name: '',
msg: '已参加微呼应活动',
time: '2024-01-26 13:56:10',
photoUrl: 'https://zhsq.zhnbxc.top:58080/weChatFile/szfwPeople/icon_chat_photo_three.jpg',
},
{
type: '0',
name: '第五网格员',
msg: '已参加微报事活动',
time: '2024-01-26 13:59:12',
photoUrl: 'https://zhsq.zhnbxc.top:58080/weChatFile/szfwPeople/icon_chat_photo_one.jpg',
},
{
type: '0',
name: '群主',
msg: '大家好,欢迎进入微社区群,如有问题可在群里聊天询问',
time: '2024-01-26 13:43:12',
photoUrl: 'https://zhsq.zhnbxc.top:58080/weChatFile/szfwPeople/icon_chat_photo_two.jpg',
},
{
type: '0',
name: '小助手',
msg: '2024微报事、微呼应活动正在进行中,希望大家踊跃参加。',
time: '2024-01-26 13:43:15',
photoUrl: 'https://zhsq.zhnbxc.top:58080/weChatFile/szfwPeople/icon_service.png',
},
{
type: '1',
name: '',
msg: '已参加微呼应活动',
time: '2024-01-26 13:56:10',
photoUrl: 'https://zhsq.zhnbxc.top:58080/weChatFile/szfwPeople/icon_chat_photo_three.jpg',
},
{
type: '0',
name: '第五网格员',
msg: '已参加微报事活动',
time: '2024-01-26 13:59:12',
photoUrl: 'https://zhsq.zhnbxc.top:58080/weChatFile/szfwPeople/icon_chat_photo_one.jpg',
}, {
type: '0',
name: '群主',
msg: '大家好,欢迎进入微社区群,如有问题可在群里聊天询问',
time: '2024-01-26 13:43:12',
photoUrl: 'https://zhsq.zhnbxc.top:58080/weChatFile/szfwPeople/icon_chat_photo_two.jpg',
},
{
type: '0',
name: '小助手',
msg: '2024微报事、微呼应活动正在进行中,希望大家踊跃参加。',
time: '2024-01-26 13:43:15',
photoUrl: 'https://zhsq.zhnbxc.top:58080/weChatFile/szfwPeople/icon_service.png',
},
{
type: '1',
name: '',
msg: '已参加微呼应活动',
time: '2024-01-26 13:56:10',
photoUrl: 'https://zhsq.zhnbxc.top:58080/weChatFile/szfwPeople/icon_chat_photo_three.jpg',
},
{
type: '0',
name: '第五网格员',
msg: '已参加微报事活动',
time: '2024-01-26 13:59:12',
photoUrl: 'https://zhsq.zhnbxc.top:58080/weChatFile/szfwPeople/icon_chat_photo_one.jpg',
},
{
type: '0',
name: '群主',
msg: '大家好,欢迎进入微社区群,如有问题可在群里聊天询问',
time: '2024-01-26 13:43:12',
photoUrl: 'https://zhsq.zhnbxc.top:58080/weChatFile/szfwPeople/icon_chat_photo_two.jpg',
},
{
type: '0',
name: '小助手',
msg: '2024微报事、微呼应活动正在进行中,希望大家踊跃参加。',
time: '2024-01-26 13:43:15',
photoUrl: 'https://zhsq.zhnbxc.top:58080/weChatFile/szfwPeople/icon_service.png',
},
{
type: '1',
name: '',
msg: '已参加微呼应活动',
time: '2024-01-26 13:56:10',
photoUrl: 'https://zhsq.zhnbxc.top:58080/weChatFile/szfwPeople/icon_chat_photo_three.jpg',
},
{
type: '0',
name: '第五网格员',
msg: '已参加微报事活动',
time: '2024-01-26 13:59:12',
photoUrl: 'https://zhsq.zhnbxc.top:58080/weChatFile/szfwPeople/icon_chat_photo_one.jpg',
},
],
inputTemp: '', inputTemp: '',
targetId: '',
} }
}, },
onLoad() { onLoad(options) {
this.targetId = options.targetId
this.getMessageList()
// 滚动到页面底部
this.pageScrollToBottom()
},
onShow(){
this.getMessageList()
// 滚动到页面底部 // 滚动到页面底部
this.pageScrollToBottom() this.pageScrollToBottom()
}, },
...@@ -196,6 +67,28 @@ export default { ...@@ -196,6 +67,28 @@ export default {
bindKeyInput(e) { bindKeyInput(e) {
this.inputTemp = e.detail.value this.inputTemp = e.detail.value
}, },
getMessageList() {
const form ={
page: 1,
rows: 10,
targetId: this.targetId
}
telMessage(form).then(res => {
console.log('11111111',res.data.data)
this.chatList = res.data.data
this.chatList.forEach(item => {
//处理头像
if (item.avatar != null && item.avatar != ''){
getOssUrl(item.avatar).then(imgRes => {
if (imgRes.data.data != null) {
imgRes.data.data = imgRes.data.data.replace(/\\/g, "/");
item.avatarUrl = imgRes.data.data
}
})
}
})
})
},
/** /**
* 发送 * 发送
*/ */
...@@ -208,14 +101,14 @@ export default { ...@@ -208,14 +101,14 @@ export default {
}) })
return return
} }
this.inputTemp = "" const data = {
const chatObj = {} targetId: this.targetId,
chatObj.type = '1' content: inputValue
chatObj.name = '' }
chatObj.msg = inputValue addMessage(data).then(res => {
chatObj.time = this.getCurTime() this.getMessageList()
chatObj.photoUrl = 'https://zhsq.zhnbxc.top:58080/weChatFile/szfwPeople/icon_chat_photo_three.jpg' this.inputTemp = ''
this.chatList.push(chatObj) })
// 滚动到页面底部 // 滚动到页面底部
this.pageScrollToBottom() this.pageScrollToBottom()
}, },
......
...@@ -9,16 +9,16 @@ ...@@ -9,16 +9,16 @@
<view class="card"> <view class="card">
<view class="recommendation-card" v-for="item in userList" @click="gotoBusinessDetail(item)"> <view class="recommendation-card" v-for="item in userList" @click="gotoBusinessDetail(item)">
<view class="card-image"style="justify-content: left;display: flex"> <view class="card-image"style="justify-content: left;display: flex">
<image class="img" src="https://cdn.uviewui.com/uview/album/1.jpg"/> <image class="img" :src="item.avatarUrl"/>
<view style="margin-left: 20rpx;margin-top: 20rpx;font-weight: 400;font-size: 32rpx"> <view style="margin-left: 20rpx;margin-top: 20rpx;font-weight: 400;font-size: 32rpx">
{{ item.nickName }} {{ item.memNickName }}
<view class="message"> <view class="message">
{{item.message}} {{item.leaveMessageContent}}
</view> </view>
</view> </view>
</view> </view>
<view style="margin: 20rpx 20rpx 0 0;font-size: 24rpx;color: #8a8888;"> <view style="margin: 20rpx 20rpx 0 0;font-size: 24rpx;color: #8a8888;">
{{ item.createTime }} {{ item.createDate }}
</view> </view>
</view> </view>
</view> </view>
...@@ -27,6 +27,9 @@ ...@@ -27,6 +27,9 @@
</template> </template>
<script> <script>
import {messageList} from "../../api/user";
import {getOssUrl} from "../../api/article";
export default { export default {
data() { data() {
return { return {
...@@ -46,7 +49,7 @@ export default { ...@@ -46,7 +49,7 @@ export default {
menuButtonInfo: '', menuButtonInfo: '',
}; };
}, },
onLoad() { onShow() {
//获取当前页面的页头高度 //获取当前页面的页头高度
this.menuButtonInfo = uni.getMenuButtonBoundingClientRect() this.menuButtonInfo = uni.getMenuButtonBoundingClientRect()
const { const {
...@@ -68,44 +71,28 @@ export default { ...@@ -68,44 +71,28 @@ export default {
}, },
methods: { methods: {
getUserList(){ getUserList(){
//我喜欢的 const query = {
const list = [ page: 1,
{ rows: 10
nickName:'暖洋洋', }
message:'你好', messageList(query).then(res => {
createTime:'2021-08-08 12:12:12' this.userList = res.data.data
}, this.userList.forEach(item => {
{ //处理头像
nickName:'暖洋洋', if (item.avatar != null && item.avatar != ''){
message:'最近的一条信息', getOssUrl(item.avatar).then(imgRes => {
createTime:'2021-08-08 12:12:12' if (imgRes.data.data != null) {
}, imgRes.data.data = imgRes.data.data.replace(/\\/g, "/");
{ item.avatarUrl = imgRes.data.data
nickName:'暖洋洋', }
message:'最近的一条信息', })
createTime:'2021-08-08 12:12:12' }
}, })
{ })
nickName:'暖洋洋',
message:'最近的一条信息',
createTime:'2021-08-08 12:12:12'
},
{
nickName:'暖洋洋',
message:'最近的一条信息',
createTime:'2021-08-08 12:12:12'
},
{
nickName:'暖洋洋',
message:'最近的一条信息测试长度滴滴滴滴滴滴滴滴滴滴滴滴滴滴滴滴滴滴滴滴滴滴滴滴滴滴的',
createTime:'2021-08-08 12:12:12'
},
]
this.userList = list
}, },
gotoBusinessDetail(){ gotoBusinessDetail(item){
uni.navigateTo({ uni.navigateTo({
url: "/pagesme/message/info" url: "/pagesme/message/info?targetId="+item.targetId
}) })
}, },
backbar() { backbar() {
......
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