This commit is contained in:
daihh
2022-11-11 18:38:55 +08:00
6 changed files with 91 additions and 25 deletions

View File

@@ -218,6 +218,9 @@ export default {
sendType:1, sendType:1,
conType, conType,
content, content,
source:1,
pageUrl:location.href,
sendAid:this.userInfo.aid,
} }
apiMessage.save(message).then(res=>{ apiMessage.save(message).then(res=>{
if(res.status==200){ if(res.status==200){

View File

@@ -13,7 +13,8 @@
</view> </view>
<view class="list-index-img"> <view class="list-index-img">
<u-badge :isDot="!item.isRead" type="error" :absolute="true" :offset="[0,-2]"></u-badge> <u-badge :isDot="!item.isRead" type="error" :absolute="true" :offset="[0,-2]"></u-badge>
<image style="width:80upx;height:80upx" src="../../static/images/woman.png" mode=""></image> <author-img :avatar="item.authorInfo.avatar" :sex="item.authorInfo.sex"></author-img>
<!-- <image style="width:80upx;height:80upx" src="../../static/images/woman.png" mode=""></image> -->
</view> </view>
<view class="list-index-cen"> <view class="list-index-cen">
<view class="cen-name"> <view class="cen-name">
@@ -54,6 +55,14 @@
}, },
methods: { methods: {
returnRouter(item) { returnRouter(item) {
if(!item.isRead){
apiMessage.updateIsRead([item.id]).then(res=>{
if(res.status == 200) {
item.isRead = !item.isRead;
}
})
}
if (item.refType == 2) { if (item.refType == 2) {
uni.navigateTo({ uni.navigateTo({
url: '/pages/resource/articeDetail?id=' + item.refId url: '/pages/resource/articeDetail?id=' + item.refId
@@ -144,7 +153,6 @@
this.$emit('loadMessage'); this.$emit('loadMessage');
} }
}) })
console.log(ids,'ids')
} }
} }
} }

View File

@@ -120,7 +120,7 @@ export default {
conType: 1, conType: 1,
query: { query: {
pageIndex: 1, pageIndex: 1,
pageSize: 4, pageSize: 10,
keyword: '' keyword: ''
}, },
courseList: [], courseList: [],
@@ -210,7 +210,6 @@ export default {
let userIds = []; let userIds = [];
if (this.conType == 1) { if (this.conType == 1) {
rs.result.list.forEach(item => { rs.result.list.forEach(item => {
console.log(item)
item.avatar = ''; item.avatar = '';
item.orgInfo = ''; item.orgInfo = '';
item.sex = null; item.sex = null;

View File

@@ -7,9 +7,8 @@
<text class="u-demo-block__title">基础信息</text> <text class="u-demo-block__title">基础信息</text>
<view class="u-demo-block__content"> <view class="u-demo-block__content">
<u-cell-group > <u-cell-group >
<u-cell title="头像" :isLink="true" @click="toRouter('headimg')"> <u-cell title="头像" :isLink="true">
<u-avatar v-if="userInfoObj.account.avatar!=''" slot="value" shape="circle" size="58pt" :src="userInfoObj.account.avatar"></u-avatar> <u-avatar v-if="userInfoObj.account.avatar!=''" slot="value" @click="updateHeadImg" shape="circle" size="58pt" :src="imgurl"></u-avatar>
<!-- <text>{{userInfoObj.name}}</text> -->
</u-cell> </u-cell>
<u-cell title="姓名" v-model="userInfoObj.name"></u-cell> <u-cell title="姓名" v-model="userInfoObj.name"></u-cell>
<u-cell title="性别" v-model="userInfoObj.gender==1?'男':'女'"></u-cell> <u-cell title="性别" v-model="userInfoObj.gender==1?'男':'女'"></u-cell>
@@ -65,8 +64,14 @@
</template> </template>
<script> <script>
import userApi from "@/api/system/user"; import userApi from "@/api/system/user";
import uploadUtil from '@/utils/upload.js'
import accountApi from '@/api/account';
import config from '@/config/index.js'
import cropper from "@/components/x-cropper/x-cropper.vue"
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import {getToken} from '@/utils/token.js'
export default { export default {
components: {cropper},
data() { data() {
return { return {
aid:'', aid:'',
@@ -74,6 +79,7 @@
account:{nickName:'',mobile:'',avatar:'',email:'',passValue:''}, account:{nickName:'',mobile:'',avatar:'',email:'',passValue:''},
}, },
clearShow:false, clearShow:false,
imgurl:"",
} }
}, },
computed: { computed: {
@@ -82,8 +88,10 @@
onShow(){ onShow(){
this.$store.dispatch('GetUserInfo').then(rs=>{ this.$store.dispatch('GetUserInfo').then(rs=>{
this.aid=rs.aid; this.aid=rs.aid;
this.imgurl = rs.avatar;
this.load(); this.load();
}) })
}, },
onLoad(){ onLoad(){
@@ -93,6 +101,50 @@
logout() { logout() {
this.clearShow=true; this.clearShow=true;
}, },
updateHeadImg() {
let self=this;
if (this.fSelecting) return;
this.fSelecting = true;
setTimeout(() => {
this.fSelecting = false;
}, 500);
uni.chooseImage({
count: 1,
sizeType: ['original', 'compressed'],
sourceType: ['camera', 'album'],
success: (r) => {
uni.showLoading({
mask: true
});
uploadUtil.uploadFile(r.tempFilePaths[0]).then(rs=>{
if(rs.status==200){
this.imgurl = rs.result.httpPath;
accountApi.updateAvatar({id:this.aid,avatar:rs.result.filePath}).then(rs2=>{
if(rs2.status == 200){
// 更新下页面缓存
this.$store.dispatch('InitData');
// uni.navigateBack(-1);
uni.showToast({
title:'更新成功'
})
} else {
uni.showToast({
title:'更新失败'
})
}
})
}
});
uni.hideLoading();
}
})
},
confirmClear(){ confirmClear(){
let that = this; let that = this;
that.$store.dispatch("LogOut").then(rs => { that.$store.dispatch("LogOut").then(rs => {

View File

@@ -89,7 +89,6 @@
}, },
methods: { methods: {
loadMessage() { loadMessage() {
console.log('1111')
this.queryMessage(true); this.queryMessage(true);
}, },
queryMessage(flag) { queryMessage(flag) {
@@ -105,23 +104,17 @@
this.message.total = res.result.count; this.message.total = res.result.count;
if(res.result.list.length!=0){ if(res.result.list.length!=0){
res.result.list.forEach(item => { res.result.list.forEach(item => {
// ids.push() item.authorInfo={avatar:'',name:'',code:'',sex:null};
ids.push(item.sendAid);
item.checked = false; item.checked = false;
this.message.list.push(item); this.message.list.push(item);
}); });
// this.loadAuthorInfo(res.result.list,ids); this.loadAuthorInfo(res.result.list,ids)
//设置已读 }
// let ids=[]; if(this.message.list.length<this.message.total){
// for(let i=0;i<res.result.list.length;i++){ this.loadStatus='more'
// if(!res.result.list[i].isRead){ }else{
// ids.push(res.result.list[i].id) this.loadStatus='noMore'
// }
// }
// apiMessage.updateIsRead(ids).then(res=>{
// if(res.status==200){
// }
// })
} }
} else { } else {
this.$refs.toast.show({ message: '获取数据失败', type: 'error' }) this.$refs.toast.show({ message: '获取数据失败', type: 'error' })
@@ -153,6 +146,11 @@
}) })
this.loadAuthorInfo(res.result.list,ids); this.loadAuthorInfo(res.result.list,ids);
} }
if(this.data.length<this.total){
this.loadStatus='more'
}else{
this.loadStatus='noMore'
}
}else{ }else{
this.$refs.interactToast.show({message:'加载@我的评论失败',type:'error'}); this.$refs.interactToast.show({message:'加载@我的评论失败',type:'error'});
} }
@@ -164,17 +162,20 @@
if (ids.length == 0) { if (ids.length == 0) {
return; return;
} }
let $this = this;
const noReapetIds = [...new Set(ids)]; const noReapetIds = [...new Set(ids)];
apiUser.getByIds(ids).then(res => { apiUser.getByIds(ids).then(res => {
if (res.status == 200) { if (res.status == 200) {
list.forEach((item, index) => { list.forEach((item, index) => {
res.result.some(author => { res.result.some(author => {
if (author.aid == item.sysCreateAid) { if ($this.tab == 0 && author.aid == item.sendAid) {
item.authorInfo = author; item.authorInfo = author;
return true; return true;
} else if($this.tab == 1 && author.aid == item.sysCreateAid){
item.authorInfo = author;
} else { } else {
return false; return false;
} }
}); });
}); });
} else { } else {

View File

@@ -478,6 +478,9 @@ export default {
sendType:1, sendType:1,
conType, conType,
content, content,
source:1,
pageUrl:location.href,
sendAid:this.userInfo.aid,
} }
apiMessage.save(message).then(res=>{ apiMessage.save(message).then(res=>{
if(res.status==200){ if(res.status==200){