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

修改用户账号停用验证

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