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

修改用户账号停用验证

parent d4ed96c8
...@@ -104,6 +104,7 @@ ...@@ -104,6 +104,7 @@
<script> <script>
import imageAdaptation from '@/components/images-adaptation/imageAdaptation.vue' import imageAdaptation from '@/components/images-adaptation/imageAdaptation.vue'
import xzjReadMore from "@/components/xzj-readMore/xzj-readMore.vue" import xzjReadMore from "@/components/xzj-readMore/xzj-readMore.vue"
import {userDetail} from "../../../api/user";
export default { export default {
name:'ArticleItem', name:'ArticleItem',
options: { options: {
...@@ -180,12 +181,24 @@ ...@@ -180,12 +181,24 @@
// 点赞 // 点赞
praise(item) { praise(item) {
const token = uni.getStorageSync('token') const token = uni.getStorageSync('token')
const userInfo = uni.getStorageSync('userInfo')
//校验token 如果没有token,跳到登录页进行登录 //校验token 如果没有token,跳到登录页进行登录
if (token && token !== '' && token != null){ if (token && token !== '' && token != null){
//已登录 //已登录
//0:取消点赞/未点赞 1:点赞 userDetail(userInfo.memberId).then(res => {
item.isLike = item.isLike == '0' ? '1' : '0' //如果flag=0 被禁用了 踢出该用户
this.$emit('praise', item) if (res.data.data.flag == '0') {
uni.removeStorageSync('userInfo')
uni.removeStorageSync('token')
uni.navigateTo({
url: "/pageslogin/index"
})
} else {
//0:取消点赞/未点赞 1:点赞
item.isLike = item.isLike == '0' ? '1' : '0'
this.$emit('praise', item)
}
})
} else { } else {
//未登录 //未登录
this.isLoginPop = true this.isLoginPop = true
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
</view> </view>
<empty v-if="firstLoaded && !dataList.length"/> <empty v-if="firstLoaded && !dataList.length"/>
</z-paging> </z-paging>
<!-- 登录弹窗-->
<login @change="getToLogin" :isLoginPop="isLoginPop" class="my-select"></login>
</view> </view>
</template> </template>
...@@ -29,6 +31,7 @@ ...@@ -29,6 +31,7 @@
import {articleList, getOssUrl, like} from "../../../api/article"; import {articleList, getOssUrl, like} from "../../../api/article";
import {getCity, getValue} from "../../../common/options"; import {getCity, getValue} from "../../../common/options";
import {calculateAge, parseDate} from "../../../common"; import {calculateAge, parseDate} from "../../../common";
import {userDetail} from "../../../api/user";
export default { export default {
name:'ArticleList', name:'ArticleList',
components: { components: {
...@@ -80,8 +83,24 @@ ...@@ -80,8 +83,24 @@
console.log('this.tabIndex:',this.tabIndex) console.log('this.tabIndex:',this.tabIndex)
if (newVal === this.tabIndex) { if (newVal === this.tabIndex) {
if (newVal === 0){ if (newVal === 0){
//关注 const token = uni.getStorageSync('token')
this.articleType = '0' const userInfo = uni.getStorageSync('userInfo')
if (token != '') {
userDetail(userInfo.memberId).then(res => {
//如果flag=0 被禁用了 踢出该用户
if (res.data.data.flag == '0') {
uni.removeStorageSync('userInfo')
uni.removeStorageSync('token')
this.isLoginPop = true
}else {
//关注
this.articleType = '0'
}
})
} else {
//未登录
this.isLoginPop = true
}
} }
if (newVal === 1){ if (newVal === 1){
//最近 //最近
...@@ -279,6 +298,19 @@ ...@@ -279,6 +298,19 @@
let idx = this.dataList.findIndex(obj => obj.businessId == item.businessId) let idx = this.dataList.findIndex(obj => obj.businessId == item.businessId)
this.dataList.splice(idx, 1, item) this.dataList.splice(idx, 1, item)
}) })
},
//登录弹窗
getToLogin(e) {
if (e == 0) {
//取消登录
this.isLoginPop = false;
} else {
this.isLoginPop = false;
//立即登录
uni.navigateTo({
url: '/pageslogin/index'
})
}
}, },
} }
} }
......
...@@ -129,29 +129,40 @@ ...@@ -129,29 +129,40 @@
const token = uni.getStorageSync('token') const token = uni.getStorageSync('token')
const userInfo = uni.getStorageSync('userInfo') const userInfo = uni.getStorageSync('userInfo')
if (token != '') { if (token != '') {
//已登录 判断授权 userDetail(userInfo.memberId).then(res => {
if (userInfo && userInfo.wxNickName !== '' && userInfo.wxNickName != null) { //如果flag=0 被禁用了 踢出该用户
//已授权过 if (res.data.data.flag == '0') {
//判断是否完善个人资料 完善之后才可发布动态 uni.removeStorageSync('userInfo')
userDetail(userInfo.memberId).then(res=>{ uni.removeStorageSync('token')
const memInfo = res.data.data uni.navigateTo({
if (memInfo.memNickName != null && memInfo.memNickName != '' && memInfo.memBirthday != null && memInfo.memMaxEducation != null url: "/pageslogin/index"
&& memInfo.memCareer != '' && memInfo.memCareer != null && memInfo.memResidenceProvince != null && memInfo.memResidenceCity != null){ })
//已完善个人资料 可以发布动态 }else {
uni.navigateTo({ //已登录 判断授权
url: '/pagesArticle/publishArticle?topicId='+this.topicId if (userInfo && userInfo.wxNickName !== '' && userInfo.wxNickName != null) {
//已授权过
//判断是否完善个人资料 完善之后才可发布动态
userDetail(userInfo.memberId).then(res=>{
const memInfo = res.data.data
if (memInfo.memNickName != null && memInfo.memNickName != '' && memInfo.memBirthday != null && memInfo.memMaxEducation != null
&& memInfo.memCareer != '' && memInfo.memCareer != null && memInfo.memResidenceProvince != null && memInfo.memResidenceCity != null){
//已完善个人资料 可以发布动态
uni.navigateTo({
url: '/pagesArticle/publishArticle?topicId='+this.topicId
})
}else {
//没完善个人资料 需要去完善
this.tipsShow = true
}
}) })
}else { } else {
//没完善个人资料 需要去完善 //没授权过,需要授权
this.tipsShow = true uni.switchTab({
url: '/pages/tab/index'
});
} }
}) }
} else { })
//没授权过,需要授权
uni.switchTab({
url: '/pages/tab/index'
});
}
} else { } else {
//未登录 //未登录
this.isLoginPop = true this.isLoginPop = true
......
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
import LsSwiper from '../../components/ls-swiper/index.vue'; import LsSwiper from '../../components/ls-swiper/index.vue';
import {noticeList} from '../../api/notice/index' import {noticeList} from '../../api/notice/index'
import {bannerList} from '../../api/banner/index' import {bannerList} from '../../api/banner/index'
import {userList} from '../../api/user/index' import {userDetail, userList} from '../../api/user/index'
import {getCity} from "../../common/options"; import {getCity} from "../../common/options";
import {getOssUrl} from "../../api/article"; import {getOssUrl} from "../../api/article";
export default { export default {
...@@ -105,6 +105,7 @@ ...@@ -105,6 +105,7 @@
this.getNoticeList() this.getNoticeList()
this.getBannerList() this.getBannerList()
this.getUserList() this.getUserList()
this.userInfo = uni.getStorageSync('userInfo')
}, },
methods: { methods: {
//获取用户列表 //获取用户列表
...@@ -194,8 +195,19 @@ ...@@ -194,8 +195,19 @@
duration: 1000 duration: 1000
}) })
} else { } else {
uni.navigateTo({ userDetail(this.userInfo.memberId).then(res => {
url: '/pagesUser/userInfo?memberId='+item.businessId //如果flag=0 被禁用了 踢出该用户
if (res.data.data.flag == '0') {
uni.removeStorageSync('userInfo')
uni.removeStorageSync('token')
uni.navigateTo({
url: "/pageslogin/index"
})
}else {
uni.navigateTo({
url: '/pagesUser/userInfo?memberId='+item.businessId
})
}
}) })
} }
}, },
......
...@@ -107,6 +107,8 @@ ...@@ -107,6 +107,8 @@
<!-- </view>--> <!-- </view>-->
<!-- </view>--> <!-- </view>-->
</view> </view>
<!-- 登录弹窗-->
<login @change="getToLogin" :isLoginPop="isLoginPop" class="my-select"></login>
</view> </view>
</template> </template>
...@@ -115,6 +117,7 @@ import ArticleItem from './components/articleItem.vue' ...@@ -115,6 +117,7 @@ import ArticleItem from './components/articleItem.vue'
import {articleDetail, comment, getOssUrl, likeComment} from '../api/article/index' import {articleDetail, comment, getOssUrl, likeComment} from '../api/article/index'
import {getCity, getValue} from "../common/options"; import {getCity, getValue} from "../common/options";
import {calculateAge, parseDate} from "../common"; import {calculateAge, parseDate} from "../common";
import {userDetail} from "../api/user";
export default{ export default{
components: { components: {
ArticleItem, ArticleItem,
...@@ -131,6 +134,7 @@ export default{ ...@@ -131,6 +134,7 @@ export default{
articleId:'', articleId:'',
//动态详情 //动态详情
articleInfo:{}, articleInfo:{},
isLoginPop:false,
//被评论人 //被评论人
commentedUserId:null, commentedUserId:null,
//上级评论ID //上级评论ID
...@@ -157,31 +161,49 @@ export default{ ...@@ -157,31 +161,49 @@ export default{
}, },
// 点赞 // 点赞
praise(item) { praise(item) {
console.log('item', item) const token = uni.getStorageSync('token')
var type = '' const userInfo = uni.getStorageSync('userInfo')
if (item.isLike == '1') { //校验token 如果没有token,跳到登录页进行登录
//取消点赞 if (token && token !== '' && token != null){
type = 'cancel' //已登录
userDetail(userInfo.memberId).then(res => {
//如果flag=0 被禁用了 踢出该用户
if (res.data.data.flag == '0') {
uni.removeStorageSync('userInfo')
uni.removeStorageSync('token')
uni.navigateTo({
url: "/pageslogin/index"
})
} else {
var type = ''
if (item.isLike == '1') {
//取消点赞
type = 'cancel'
} else {
//点赞
type = 'praise'
}
const params = {
commentId: item.businessId,
praiseType: type
}
likeComment(params).then(res=>{
this.getArticleDetail()
})
}
})
} else { } else {
//点赞 //未登录
type = 'praise' this.isLoginPop = true
}
const params = {
commentId: item.businessId,
praiseType: type
} }
likeComment(params).then(res=>{
this.getArticleDetail()
})
}, },
//评论回车事件 //评论回车事件
handleEnter(value){ handleEnter(value){
const token = uni.getStorageSync("token") const token = uni.getStorageSync("token")
const userInfo = uni.getStorageSync('userInfo')
if (token == null || token == ''){ if (token == null || token == ''){
uni.showToast({ //未登录
title: '请先登录', this.isLoginPop = true
icon: 'none'
})
return; return;
} }
if (this.commentValue === ''){ if (this.commentValue === ''){
...@@ -191,34 +213,49 @@ export default{ ...@@ -191,34 +213,49 @@ export default{
}) })
return; return;
} }
this.commentValue = '' //校验token 如果没有token,跳到登录页进行登录
const params = { if (token && token !== '' && token != null){
articleId: this.articleInfo.businessId,//动态id //已登录
commentContent:value,//评论内容 userDetail(userInfo.memberId).then(res => {
commentedUserId:this.commentedUserId ,//被评论人ID //如果flag=0 被禁用了 踢出该用户
parentId:this.parentId,//上级评论ID if (res.data.data.flag == '0') {
createDate:this.articleInfo.createDate//动态发布时间 uni.removeStorageSync('userInfo')
} uni.removeStorageSync('token')
comment(params).then(res=>{ uni.navigateTo({
if (res.data.code == 200){ url: "/pageslogin/index"
//方便回到动态页的时候刷新数据 })
uni.setStorageSync("isRefresh", true) } else {
this.getArticleDetail() this.commentValue = ''
} else { const params = {
uni.showToast({ articleId: this.articleInfo.businessId,//动态id
title: res.data.message, commentContent:value,//评论内容
icon: 'none' commentedUserId:this.commentedUserId ,//被评论人ID
}) parentId:this.parentId,//上级评论ID
} createDate:this.articleInfo.createDate//动态发布时间
}).catch(err=>{ }
uni.showToast({ comment(params).then(res=>{
title: '评论失败,请稍后再试', if (res.data.code == 200){
icon: 'none' //方便回到动态页的时候刷新数据
uni.setStorageSync("isRefresh", true)
this.getArticleDetail()
} else {
uni.showToast({
title: res.data.message,
icon: 'none'
})
}
}).catch(err=>{
uni.showToast({
title: '评论失败,请稍后再试',
icon: 'none'
})
})
this.commentPlaceholder = '走心,说点好听的.....'
this.commentedUserId = null
this.parentId = null
}
}) })
}) }
this.commentPlaceholder = '走心,说点好听的.....'
this.commentedUserId = null
this.parentId = null
}, },
getArticleDetail(){ getArticleDetail(){
articleDetail(this.articleId).then(res=>{ articleDetail(this.articleId).then(res=>{
...@@ -287,7 +324,20 @@ export default{ ...@@ -287,7 +324,20 @@ export default{
} }
}) })
}, },
}, //登录弹窗
getToLogin(e) {
if (e == 0) {
//取消登录
this.isLoginPop = false;
} else {
this.isLoginPop = false;
//立即登录
uni.navigateTo({
url: '/pageslogin/index'
})
}
},
}
} }
</script> </script>
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
</template> </template>
<script> <script>
import {userList} from "../api/user"; import {userDetail, userList} from "../api/user";
import {getCity, getValue} from "../common/options"; import {getCity, getValue} from "../common/options";
import {calculateAge, parseDate} from "../common"; import {calculateAge, parseDate} from "../common";
import {getOssUrl} from "../api/article"; import {getOssUrl} from "../api/article";
......
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