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

修改留言

parent 1087e21a
......@@ -98,3 +98,24 @@ export function addMessage(data){
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 @@
count></u-textarea>
</view>
<view class="adding" @click="saveAbout">
保存
发送
</view>
<ELM ref="elm" :msg="tipMsg" :isConfirm="isConfirm" @confirm="confirm"></ELM>
</view>
......@@ -49,7 +49,7 @@
addMessage(data).then(res => {
if (res.data.code == 200) {
this.isConfirm = true;
this.tipMsg = "保存成功";
this.tipMsg = "发送成功";
this.$refs.elm.showDialog();
} else {
this.tipMsg = res.data.msg;
......
......@@ -74,6 +74,18 @@
></u-icon>
</u-form-item>
</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
type="primary"
text="提交"
......@@ -126,9 +138,10 @@
<script>
import UFormItem from "../uni_modules/uview-ui/components/u-form-item/u-form-item";
import {getOptions} from "../common/options";
import UCol from "../uni_modules/uview-ui/components/u-col/u-col.vue";
export default {
components: {UFormItem},
components: {UCol, UFormItem},
data() {
return {
//数据选项
......@@ -148,6 +161,44 @@ export default {
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,
showResidence: false,
......@@ -216,6 +267,9 @@ export default {
memResidenceCity:'',//居住城市
}
},
checkboxClick(name) {
this.checkboxs[name].checked = !this.checkboxs[name].checked;
},
//阻止键盘
hideKeyboard() {
uni.hideKeyboard()
......@@ -230,4 +284,8 @@ export default {
padding-left: 20rpx;
padding-right: 20rpx;
}
.u-page__tag-item {
display: flex;
flex-wrap: wrap;
}
</style>
......@@ -6,22 +6,22 @@
<view class="page-body" id="x_chat">
<view v-for="(item, index) in chatList" :key="index">
<view class="chat-item-body">
<view class="chat-item-time">{{item.time}}</view>
<view v-if="item.type == '0'" class="chat-item-layout chat-left">
<view class="chat-item-time">{{item.createDate}}</view>
<view v-if="item.userId == targetId" class="chat-item-layout chat-left">
<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">
<image class="chat-item-photo" @tap="scanClick" :src="item.photoUrl" mode="aspectFit"></image>
<view class="chat-inner-msg-left">{{item.msg}}</view>
<image class="chat-item-photo" :src="item.avatarUrl" mode="aspectFit"></image>
<view class="chat-inner-msg-left">{{item.leaveMessageContent}}</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-item-name-right">{{item.name}}</view>
<view class="chat-item-name-right">{{item.memNickName}}</view>
<view class="chat-item-msg-layout">
<view class="chat-inner-msg-right">{{item.msg}} </view>
<image class="chat-item-photo" @tap="scanClick" :src="item.photoUrl" mode="aspectFit"></image>
<view class="chat-inner-msg-right">{{item.leaveMessageContent}} </view>
<image class="chat-item-photo" :src="item.avatarUrl" mode="aspectFit"></image>
</view>
</view>
</view>
......@@ -37,155 +37,26 @@
</template>
<script>
import {addMessage, telMessage} from "../../api/user";
import {getOssUrl} from "../../api/article";
export default {
name: "info",
data() {
return {
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',
},
],
chatList: [],
inputTemp: '',
targetId: '',
}
},
onLoad() {
onLoad(options) {
this.targetId = options.targetId
this.getMessageList()
// 滚动到页面底部
this.pageScrollToBottom()
},
onShow(){
this.getMessageList()
// 滚动到页面底部
this.pageScrollToBottom()
},
......@@ -196,6 +67,28 @@ export default {
bindKeyInput(e) {
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 {
})
return
}
this.inputTemp = ""
const chatObj = {}
chatObj.type = '1'
chatObj.name = ''
chatObj.msg = inputValue
chatObj.time = this.getCurTime()
chatObj.photoUrl = 'https://zhsq.zhnbxc.top:58080/weChatFile/szfwPeople/icon_chat_photo_three.jpg'
this.chatList.push(chatObj)
const data = {
targetId: this.targetId,
content: inputValue
}
addMessage(data).then(res => {
this.getMessageList()
this.inputTemp = ''
})
// 滚动到页面底部
this.pageScrollToBottom()
},
......
......@@ -9,16 +9,16 @@
<view class="card">
<view class="recommendation-card" v-for="item in userList" @click="gotoBusinessDetail(item)">
<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">
{{ item.nickName }}
{{ item.memNickName }}
<view class="message">
{{item.message}}
{{item.leaveMessageContent}}
</view>
</view>
</view>
<view style="margin: 20rpx 20rpx 0 0;font-size: 24rpx;color: #8a8888;">
{{ item.createTime }}
{{ item.createDate }}
</view>
</view>
</view>
......@@ -27,6 +27,9 @@
</template>
<script>
import {messageList} from "../../api/user";
import {getOssUrl} from "../../api/article";
export default {
data() {
return {
......@@ -46,7 +49,7 @@ export default {
menuButtonInfo: '',
};
},
onLoad() {
onShow() {
//获取当前页面的页头高度
this.menuButtonInfo = uni.getMenuButtonBoundingClientRect()
const {
......@@ -68,44 +71,28 @@ export default {
},
methods: {
getUserList(){
//我喜欢的
const list = [
{
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'
},
{
nickName:'暖洋洋',
message:'最近的一条信息',
createTime:'2021-08-08 12:12:12'
},
{
nickName:'暖洋洋',
message:'最近的一条信息测试长度滴滴滴滴滴滴滴滴滴滴滴滴滴滴滴滴滴滴滴滴滴滴滴滴滴滴的',
createTime:'2021-08-08 12:12:12'
},
]
this.userList = list
const query = {
page: 1,
rows: 10
}
messageList(query).then(res => {
this.userList = res.data.data
this.userList.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
}
})
}
})
})
},
gotoBusinessDetail(){
gotoBusinessDetail(item){
uni.navigateTo({
url: "/pagesme/message/info"
url: "/pagesme/message/info?targetId="+item.targetId
})
},
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