进入uniapp
This commit is contained in:
113
im-uniapp/wx/friendsCircle/detail.vue
Normal file
113
im-uniapp/wx/friendsCircle/detail.vue
Normal file
@@ -0,0 +1,113 @@
|
||||
<template>
|
||||
<view>
|
||||
<watermark></watermark>
|
||||
<friends-circle-detail :detail="detail"></friends-circle-detail>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
detail: {},
|
||||
showtitleNViewBtns:false
|
||||
};
|
||||
},
|
||||
onLoad(e) {
|
||||
this.getInfo(e.topicId)
|
||||
},
|
||||
mounted() {
|
||||
this.$fc.setTitleNViewBtns(0,'')
|
||||
},
|
||||
computed:{
|
||||
userInfo(){
|
||||
return this.$store.state.userInfo
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getInfo(id){
|
||||
this.$http.request({
|
||||
url: '/topic/topicInfo/'+id,
|
||||
success: (res) => {
|
||||
if (res.data.code == 200) {
|
||||
var item=res.data.data
|
||||
var detail={
|
||||
canDeleted:this.userInfo.userId==item.topic.userId ? true : false,
|
||||
userId: item.topic.userId,
|
||||
nickName: item.topic.nickName,
|
||||
avatar: item.topic.portrait,
|
||||
topicId: item.topic.topicId,
|
||||
text: JSON.parse(item.topic.content).content,
|
||||
topicType:item.topic.topicType,
|
||||
files:JSON.parse(item.topic.content).files,
|
||||
location: item.topic.location ? JSON.parse(item.topic.location) : {},
|
||||
time:item.topic.createTime,
|
||||
like:item.like,
|
||||
likeList:item.likeList,
|
||||
replyList:item.replyList,
|
||||
}
|
||||
this.detail=detail
|
||||
if(this.detail.canDeleted){
|
||||
this.showtitleNViewBtns=true
|
||||
this.$fc.setTitleNViewBtns(0,'\ue623')
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
onNavigationBarButtonTap(e) {
|
||||
if(!this.showtitleNViewBtns){
|
||||
return
|
||||
}
|
||||
switch (e.index) {
|
||||
case 0: //更多
|
||||
uni.showActionSheet({
|
||||
itemList: ['删除'],
|
||||
success: (res) => {
|
||||
this.$http.request({
|
||||
url: '/topic/removeTopic/'+this.detail.topicId,
|
||||
success: (res) => {
|
||||
if (res.data.code == 200) {
|
||||
uni.navigateBack({
|
||||
delta:1
|
||||
}).then(res=>{
|
||||
uni.showToast({
|
||||
title:'删除成功',
|
||||
icon:'none'
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
switch (res.tapIndex) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
fail: function(res) {
|
||||
console.log(res.errMsg);
|
||||
}
|
||||
});
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.friendsCircle {
|
||||
}
|
||||
|
||||
.friendsCircle-content {
|
||||
padding-top: 160rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
</style>
|
||||
159
im-uniapp/wx/friendsCircle/index.vue
Normal file
159
im-uniapp/wx/friendsCircle/index.vue
Normal file
@@ -0,0 +1,159 @@
|
||||
<template>
|
||||
<view class="friendsCircle">
|
||||
<watermark></watermark>
|
||||
<friends-circle-top :cover="cover" :userInfo="userInfo" @userClick="userClick"></friends-circle-top>
|
||||
<view class="friendsCircle-content">
|
||||
<view class="friendsCircle-msgalert-box" v-if="topicReply.count && topicReply.count > 0" @click="gomsglist">
|
||||
<view class="friendsCircle-msgalert">
|
||||
<image class="friendsCircle-msgalert-img" :src="topicReply.portrait" mode="aspectFill"></image>
|
||||
<text class="friendsCircle-msgalert-text">{{ topicReply.count }}条新消息</text>
|
||||
</view>
|
||||
</view>
|
||||
<friends-circle-list-item ref="fcli" v-model:content="content"></friends-circle-list-item>
|
||||
</view>
|
||||
<uni-load-more v-show="content.length>9" :status="queryParams.status"></uni-load-more>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
queryParams: {
|
||||
refreshing: false,
|
||||
status: 'more',
|
||||
pageNum: 1,
|
||||
pageSize: 10
|
||||
},
|
||||
content: []
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
cover() {
|
||||
var cover = this.$store.state.userInfo.cover ? JSON.parse(this.$store.state.userInfo.cover) : { type: 'img', name: '', url: '' };
|
||||
return cover;
|
||||
},
|
||||
userInfo() {
|
||||
return this.$store.state.userInfo;
|
||||
},
|
||||
topicReply() {
|
||||
return this.$store.state.topicReply;
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.getlist();
|
||||
},
|
||||
methods: {
|
||||
getlist() {
|
||||
this.queryParams.status='loading'
|
||||
this.$fc.loadMore({
|
||||
url: '/topic/topicList?',
|
||||
queryParams: this.queryParams
|
||||
}).then(res => {
|
||||
this.$store.commit('update_topicRed',{})
|
||||
this.queryParams = res.queryParams;
|
||||
if (res.status=='3') {
|
||||
this.list=[]
|
||||
return
|
||||
}
|
||||
if (res.status=='0') {
|
||||
return
|
||||
}
|
||||
var rows = res.list;
|
||||
var list = [];
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
var item = rows[i];
|
||||
list.push({
|
||||
userId: item.topic.userId,
|
||||
nickName: item.topic.nickName,
|
||||
avatar: item.topic.portrait,
|
||||
topicId: item.topic.topicId,
|
||||
text: JSON.parse(item.topic.content).content,
|
||||
topicType: item.topic.topicType,
|
||||
files: JSON.parse(item.topic.content).files,
|
||||
location: item.topic.location ? JSON.parse(item.topic.location) : {},
|
||||
time: item.topic.createTime,
|
||||
like: item.like,
|
||||
likeList: item.likeList,
|
||||
replyList: item.replyList
|
||||
});
|
||||
}
|
||||
if (res.status=='2') {
|
||||
this.content = list;
|
||||
}
|
||||
if (res.status=='1') {
|
||||
this.content = this.content.concat(list);
|
||||
}
|
||||
});
|
||||
},
|
||||
userClick(cover, user) {
|
||||
uni.navigateTo({
|
||||
url: '../../wx/friendsCircle/person'
|
||||
});
|
||||
},
|
||||
gomsglist() {
|
||||
uni.navigateTo({
|
||||
url: './msglist'
|
||||
});
|
||||
}
|
||||
},
|
||||
onPageScroll(e) {
|
||||
this.$refs['fcli'].hidenTool();
|
||||
},
|
||||
onNavigationBarButtonTap(e) {
|
||||
switch (e.index) {
|
||||
case 0:
|
||||
uni.navigateTo({
|
||||
url: '../friendsCircle/sendMsg'
|
||||
});
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.queryParams.refreshing=true
|
||||
this.getlist();
|
||||
},
|
||||
onReachBottom() {
|
||||
this.getlist();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.friendsCircle {
|
||||
}
|
||||
|
||||
.friendsCircle-content {
|
||||
padding-top: 160rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
}
|
||||
.friendsCircle-msgalert-box {
|
||||
margin-top: -64rpx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.friendsCircle-msgalert {
|
||||
border-radius: 12rpx;
|
||||
background-color: #4c4c4c;
|
||||
padding: 14rpx 24rpx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
}
|
||||
.friendsCircle-msgalert-img {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
min-width: 60rpx;
|
||||
border-radius: 12rpx;
|
||||
margin-right: 24rpx;
|
||||
}
|
||||
.friendsCircle-msgalert-text {
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
221
im-uniapp/wx/friendsCircle/msglist.vue
Normal file
221
im-uniapp/wx/friendsCircle/msglist.vue
Normal file
@@ -0,0 +1,221 @@
|
||||
<template>
|
||||
<view class="wxnearby">
|
||||
<watermark></watermark>
|
||||
<view class="wxnearby-item" v-for="(v,i) in list" :key="i" @click="godetail(v)">
|
||||
<view class="person-wx-user">
|
||||
<image class="person-wx-avatar" :src="v.portrait" mode="aspectFill"></image>
|
||||
<view class="wxnearby-item-content">
|
||||
<view class="person-wx-user-detail">
|
||||
<view class="person-wx-nikename">
|
||||
<text class="text">{{v.nickName}}</text>
|
||||
</view>
|
||||
<view class="person-wx-textx">{{v.replyContent}}</view>
|
||||
<text class="person-wx-name">
|
||||
{{v.replyTime}}
|
||||
</text>
|
||||
</view>
|
||||
<view class="wxmsglist-right">
|
||||
<view class="ctext" v-if="v.topicType=='TEXT'">
|
||||
<text>{{returnParse(v.topicContent).content}}</text>
|
||||
</view>
|
||||
<image v-if="v.topicType=='IMAGE'" class="wxmsglist-right-cimg" :src="returnParse(v.topicContent).files[0].url" mode="aspectFill"></image>
|
||||
<view class="friendsCircle-content-video" v-if="v.topicType=='VIDEO'">
|
||||
<image class="friendsCircle-content-video-icon" src="../../static/img/bf.png" mode="aspectFill"></image>
|
||||
<image class="friendsCircle-content-video-img" :src="returnParse(v.topicContent).files[0].url" mode="aspectFill"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
list:[]
|
||||
}
|
||||
},
|
||||
onLoad () {
|
||||
},
|
||||
onShow() {
|
||||
this.getlist()
|
||||
},
|
||||
onUnload() {},
|
||||
methods:{
|
||||
returnParse(txt) {
|
||||
return JSON.parse(txt);
|
||||
},
|
||||
openVideo(e){
|
||||
this.$fc.plusDownload({onlinePath:e}).then(res=>{
|
||||
this.$fc.plusOpenFile({filePath:res})
|
||||
})
|
||||
},
|
||||
getlist(){
|
||||
this.$http.request({
|
||||
url: '/topic/noticeList',
|
||||
success: (res) => {
|
||||
if (res.data.code == 200) {
|
||||
this.list=res.data.data
|
||||
this.$store.commit('update_topicReply',{})
|
||||
uni.removeStorageSync('topicReply');
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
godetail(e){
|
||||
uni.navigateTo({
|
||||
url:'./detail?topicId='+ e.topicId
|
||||
})
|
||||
}
|
||||
},
|
||||
onNavigationBarButtonTap(e) {
|
||||
switch (e.index) {
|
||||
case 0:
|
||||
uni.showActionSheet({
|
||||
itemList: ['清除消息列表'],
|
||||
success: (res) => {
|
||||
switch (res.tapIndex) {
|
||||
case 0:
|
||||
this.$http.request({
|
||||
url: '/topic/clearNotice',
|
||||
success: (res) => {
|
||||
if (res.data.code == 200) {
|
||||
uni.navigateBack({
|
||||
delta:1
|
||||
}).then(res=>{
|
||||
uni.showToast({
|
||||
title:'清除成功',
|
||||
icon:'none'
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.person-wx-user {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
width: 100%;
|
||||
}
|
||||
.wxnearby{
|
||||
}
|
||||
.wxnearby-item{
|
||||
padding:0 24rpx;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.person-wx-avatar {
|
||||
width: 90rpx;
|
||||
min-width: 90rpx;
|
||||
height: 90rpx;
|
||||
margin-right: 42rpx;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
.wxnearby-item-content{
|
||||
flex: 1;
|
||||
display: flex;flex-direction: row;align-items: center;
|
||||
padding:24rpx 0;
|
||||
border-bottom: 1px #eee solid;
|
||||
}
|
||||
.person-wx-user-detail {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
width: 400rpx;
|
||||
}
|
||||
|
||||
.person-wx-nikename {
|
||||
font-size: 28rpx;
|
||||
color: #5F698C;
|
||||
display: flex;flex-direction: row;align-items: center;
|
||||
}
|
||||
.person-wx-nikename .text{
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
max-width: 480rpx;
|
||||
}
|
||||
.person-wx-name {
|
||||
color: #B2B2B2;
|
||||
font-size: 24rpx;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.person-wx-textx{
|
||||
padding: 4rpx;
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
word-break: break-all;
|
||||
}
|
||||
.person-wx-nikename-icon.nan{
|
||||
color: #007AFF;
|
||||
}
|
||||
.person-wx-nikename-icon.nv{
|
||||
color: #FF5A5F;
|
||||
}
|
||||
.person-wx-nikename-icon{
|
||||
margin-right: auto;
|
||||
}
|
||||
.wxmsglist-right{
|
||||
margin-left: auto;
|
||||
}
|
||||
.wxmsglist-right .ctext{
|
||||
max-width: 240rpx;
|
||||
padding: 12rpx;
|
||||
font-size: 24rpx;
|
||||
background-color: #F2F2F2;
|
||||
}
|
||||
.wxmsglist-right .ctext text{
|
||||
margin-left: auto;
|
||||
color: #666;
|
||||
border-radius: 6rpx;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
.wxmsglist-right-cimg{
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
.friendsCircle-content-video{
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
position: relative;
|
||||
}
|
||||
.friendsCircle-content-video-img{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
.friendsCircle-content-video-icon{
|
||||
z-index: 1;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
width: 80rpx !important;
|
||||
height: 80rpx !important;
|
||||
transform: translate(-50%,-50%);
|
||||
}
|
||||
</style>
|
||||
200
im-uniapp/wx/friendsCircle/person.vue
Normal file
200
im-uniapp/wx/friendsCircle/person.vue
Normal file
@@ -0,0 +1,200 @@
|
||||
<template>
|
||||
<view class="friendsCircle">
|
||||
<watermark></watermark>
|
||||
<friends-circle-top :cover="cover" :userInfo="userInfox" @userClick="userClick" :showChangePoster="showChangePoster"></friends-circle-top>
|
||||
<view class="friendsCircle-content-today">
|
||||
<view class="friends-circle-today" v-if="showMsglist">
|
||||
<view class="friends-circle-today-text">今天</view>
|
||||
<view class="friends-circle-today-icon" @click="goFriendsCircleSendMsg">
|
||||
<view class="wxfont xiangji"></view>
|
||||
</view>
|
||||
</view>
|
||||
<friends-circle-person-item v-model:content="content" @clickItem="goFriendsCircleDetail"></friends-circle-person-item>
|
||||
</view>
|
||||
<uni-load-more v-show="content.length>9" :status="queryParams.status"></uni-load-more>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
queryParams: {
|
||||
refreshing: false,
|
||||
status: 'more',
|
||||
pageNum: 1,
|
||||
pageSize: 10
|
||||
},
|
||||
content: [],
|
||||
showMsglist:false,
|
||||
showChangePoster:false,
|
||||
userInfox:{},
|
||||
cover:{type:'img',name:'',url:''},
|
||||
userId:''
|
||||
};
|
||||
},
|
||||
computed:{
|
||||
userInfo(){
|
||||
return this.$store.state.userInfo
|
||||
}
|
||||
},
|
||||
onLoad(e) {
|
||||
if(e.userId){
|
||||
this.userId=e.userId
|
||||
}else{
|
||||
this.userId=this.userInfo.userId
|
||||
}
|
||||
if(this.userId==this.userInfo.userId){
|
||||
this.showMsglist=true
|
||||
this.showChangePoster=true
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$fc.setTitleNViewBtns(0,'')
|
||||
if(this.showMsglist){
|
||||
this.$fc.setTitleNViewBtns(0,'\ue6f4')
|
||||
}
|
||||
this.getUserInfo(this.userId)
|
||||
},
|
||||
onShow(){
|
||||
this.queryParams.refreshing=true
|
||||
this.getlist(this.userId)
|
||||
},
|
||||
methods: {
|
||||
getUserInfo(e){//好友详情
|
||||
this.$http.request({
|
||||
url: '/friend/info/'+e,
|
||||
success: (res) => {
|
||||
if (res.data.code == 200) {
|
||||
this.cover=res.data.data.cover ? JSON.parse(res.data.data.cover) : {type:'img',name:'',url:''}
|
||||
this.userInfox=res.data.data
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
userClick(cover,user){
|
||||
uni.navigateTo({
|
||||
url:'../../wx/personInfo/detail?param='+user.userId
|
||||
})
|
||||
},
|
||||
getlist(userId){
|
||||
this.queryParams.status='loading'
|
||||
this.$fc.loadMore({
|
||||
url: '/topic/userTopic/'+userId+'/?',
|
||||
queryParams: this.queryParams
|
||||
}).then(res => {
|
||||
this.queryParams = res.queryParams;
|
||||
if (res.status=='3') {
|
||||
this.list=[]
|
||||
return
|
||||
}
|
||||
if (res.status=='0') {
|
||||
return
|
||||
}
|
||||
var rows = res.list;
|
||||
var list = [];
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
var item = rows[i];
|
||||
list.push({
|
||||
userId: item.topic.userId,
|
||||
nickName: item.topic.nickName,
|
||||
avatar: item.topic.portrait,
|
||||
topicId: item.topic.topicId,
|
||||
text: JSON.parse(item.topic.content).content,
|
||||
topicType:item.topic.topicType,
|
||||
files:JSON.parse(item.topic.content).files,
|
||||
location: item.topic.location ? JSON.parse(item.topic.location) : {},
|
||||
time:item.topic.createTime,
|
||||
like:item.like,
|
||||
likeList:item.likeList,
|
||||
replyList:item.replyList
|
||||
});
|
||||
}
|
||||
if (res.status=='2') {
|
||||
this.content = list;
|
||||
}
|
||||
if (res.status=='1') {
|
||||
this.content = this.content.concat(list);
|
||||
}
|
||||
});
|
||||
},
|
||||
goFriendsCircleSendMsg(){
|
||||
uni.navigateTo({
|
||||
url:'../friendsCircle/sendMsg'
|
||||
})
|
||||
},
|
||||
goFriendsCircleDetail(e){
|
||||
uni.navigateTo({
|
||||
url:'../friendsCircle/detail?topicId='+ e.topicId
|
||||
})
|
||||
}
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.queryParams.refreshing=true
|
||||
this.getlist(this.userId);
|
||||
},
|
||||
onReachBottom() {
|
||||
this.getlist(this.userId);
|
||||
},
|
||||
onNavigationBarButtonTap(e) {
|
||||
if(!this.showMsglist){
|
||||
return
|
||||
}
|
||||
switch (e.index){
|
||||
case 0://更多
|
||||
uni.navigateTo({
|
||||
url:'../friendsCircle/msglist'
|
||||
})
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.friendsCircle-content-today{
|
||||
padding: 18rpx;
|
||||
padding-top: 160rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.friends-circle-today{
|
||||
display: flex;flex-direction: row;margin-bottom: 60rpx;
|
||||
}
|
||||
.friends-circle-today-text{
|
||||
font-size: 52rpx;
|
||||
font-weight: bold;
|
||||
margin-right: 50rpx;
|
||||
}
|
||||
.friends-circle-today-icon{
|
||||
display: flex;
|
||||
width: 145rpx;
|
||||
height: 145rpx;
|
||||
border-radius: 8rpx;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: #F7F7F7;
|
||||
}
|
||||
.friends-circle-today-icon .wxfont{
|
||||
font-size: 90rpx;
|
||||
color: #fff;
|
||||
}
|
||||
.friendsCircle-msglistin{
|
||||
z-index: 999;
|
||||
position: fixed;
|
||||
right: 24rpx;
|
||||
top: 0;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.friendsCircle-msglistin .wxfont{
|
||||
color: #fff;
|
||||
font-size: 48rpx;
|
||||
}
|
||||
</style>
|
||||
188
im-uniapp/wx/friendsCircle/sendMsg.vue
Normal file
188
im-uniapp/wx/friendsCircle/sendMsg.vue
Normal file
@@ -0,0 +1,188 @@
|
||||
<template>
|
||||
<view class="friendsCircle-send">
|
||||
<watermark></watermark>
|
||||
<form @submit="subform">
|
||||
<view class="friendsCircle-send-item">
|
||||
<textarea class="friendsCircle-send-textarea" auto-height placeholder="这一刻的想法..." maxlength="200" v-model="form.content"></textarea>
|
||||
</view>
|
||||
<view class="friendsCircle-send-item">
|
||||
<zmm-upload-image chooseType="chooseMedia" @oneComplete="upLoadoneComplete" ref="upup" v-model:fileList="form.files" :limit="limit"></zmm-upload-image>
|
||||
</view>
|
||||
<view class="friendsCircle-send-item">
|
||||
<view class="friendsCircle-send-itemxlist">
|
||||
<view class="friendsCircle-send-itemx" :class="{'lcation':location}" @click="getlocation">
|
||||
<view class="friendsCircle-send-itemx-icon wxfont dingwei2"></view>
|
||||
<view class="friendsCircle-send-itemx-c">
|
||||
<text class="friendsCircle-send-itemx-text" v-if="location">{{location.name}}</text>
|
||||
<text class="friendsCircle-send-itemx-text" v-else>所在位置</text>
|
||||
<uni-icons style="margin-left: 24rpx;" type="right" size="16" color="#b5b5b5"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</form>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
type:'TEXT',
|
||||
limit:9,
|
||||
location:'',
|
||||
form:{
|
||||
files:[
|
||||
// {
|
||||
// name:'1',
|
||||
// url:'../../static/img/avatar/avatar1.jpg',
|
||||
// type:'WAITING'
|
||||
// },
|
||||
// {
|
||||
// name:'2',
|
||||
// url:'../../static/img/avatar/avatar2.jpg',
|
||||
// type:'IMAGE'
|
||||
// },
|
||||
// {
|
||||
// name:'3',
|
||||
// url:'../../static/img/avatar/avatar3.jpg',
|
||||
// videoUrl:'../../static/img/avatar/avatar3.jpg',
|
||||
// type:'VIDEO'
|
||||
// }
|
||||
],
|
||||
content:'',
|
||||
}
|
||||
};
|
||||
},
|
||||
computed:{
|
||||
userInfo(){
|
||||
return this.$store.state.userInfo
|
||||
}
|
||||
},
|
||||
onLoad(e) {
|
||||
},
|
||||
methods: {
|
||||
returnParse(txt) {
|
||||
return JSON.parse(txt);
|
||||
},
|
||||
getlocation(){
|
||||
uni.chooseLocation({
|
||||
success: res => {
|
||||
this.location=res
|
||||
}
|
||||
});
|
||||
},
|
||||
upLoadoneComplete(e,type){
|
||||
if(e.type=='VIDEO'){
|
||||
this.limit=1
|
||||
this.type='VIDEO'
|
||||
var vlist=[]
|
||||
for (var i = 0; i < this.form.files.length; i++) {
|
||||
var item=this.form.files[i]
|
||||
if(item.type=='VIDEO'){
|
||||
vlist.push(item)
|
||||
}
|
||||
}
|
||||
this.form.files=vlist
|
||||
}else{
|
||||
this.limit=9
|
||||
this.type='IMAGE'
|
||||
}
|
||||
},
|
||||
subform(e) {
|
||||
var rules = {
|
||||
content: {
|
||||
rules: [{
|
||||
checkType: "required",
|
||||
errorMsg: "请填写文字内容"
|
||||
}]
|
||||
}
|
||||
};
|
||||
var formData = JSON.parse(JSON.stringify(this.form));
|
||||
var checkRes = this.$zmmFormCheck.check(formData, rules);
|
||||
if (checkRes) {
|
||||
this.$http.request({
|
||||
url: '/topic/sendTopic',
|
||||
method: 'POST',
|
||||
data:JSON.stringify({
|
||||
topicType:this.type,
|
||||
content:JSON.stringify(formData),
|
||||
location:JSON.stringify(this.location)
|
||||
}),
|
||||
success: (res) => {
|
||||
if (res.data.code == 200) {
|
||||
uni.showToast({
|
||||
title: '发表成功',
|
||||
icon: "none",
|
||||
}).then(()=>{
|
||||
uni.redirectTo({
|
||||
url:'./person'
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: this.$zmmFormCheck.error,
|
||||
icon: "none",
|
||||
position: 'bottom'
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
onNavigationBarButtonTap(e) {
|
||||
switch (e.index) {
|
||||
case 0:
|
||||
this.subform()
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.friendsCircle-send{
|
||||
padding:24rpx 46rpx;
|
||||
}
|
||||
.friendsCircle-send-item{
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
.friendsCircle-send-textarea{
|
||||
width: 100%;
|
||||
line-height: 48rpx;
|
||||
min-height: 240rpx;
|
||||
}
|
||||
.friendsCircle-send-itemx{
|
||||
padding:0 24rpx;
|
||||
display: flex;flex-direction: row;align-items: center;
|
||||
}
|
||||
.friendsCircle-send-itemx-c{
|
||||
flex: 1;
|
||||
padding: 24rpx 0;
|
||||
display: flex;flex-direction: row;align-items: center;
|
||||
border-bottom: 1px #eee solid;
|
||||
}
|
||||
.friendsCircle-send-itemx-c:nth-last-child(1){
|
||||
border: none;
|
||||
}
|
||||
.friendsCircle-send-itemxlist{
|
||||
border-bottom: 1px #eee solid;
|
||||
border-top: 1px #eee solid;
|
||||
}
|
||||
.friendsCircle-send-itemx-icon{
|
||||
margin-right: 34rpx;
|
||||
color: #333;
|
||||
font-size: 42rpx;
|
||||
}
|
||||
.friendsCircle-send-itemx-text{
|
||||
font-size: 32rpx;
|
||||
color: #333;
|
||||
margin-right: auto;
|
||||
}
|
||||
.lcation .friendsCircle-send-itemx-icon,.lcation .friendsCircle-send-itemx-text{
|
||||
color: #05C160;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user