2022年5月29日 从svn移到git

This commit is contained in:
daihh
2022-05-29 18:59:24 +08:00
parent 9580ff8c9b
commit faa7afb65f
897 changed files with 171836 additions and 0 deletions

83
pages/my/headimg.vue Normal file
View File

@@ -0,0 +1,83 @@
<template>
<view>
<page-title :showBack="true">更换头像</page-title>
<view style="text-align: center;padding: 20upx;color: #6b6b6b; ">点击选择图片</view>
<view style="margin-top: 50upx;text-align: center;width: 360upx;height: 360upx;margin: 0upx auto;background-color: #FFFFFF;">
<cropper selWidth="660rpx" selHeight="660rpx" @upload="uploadImg" :avatarSrc="imgurl" avatarStyle="width:50vw;height:50vw;">
</cropper>
</view>
<view v-if="isNew">
<view style="margin-top: 100upx;"><button style="width: 50%;" @click="submitUpdate" type="primary">提交修改</button> </view>
</view>
</view>
</template>
<script>
import cropper from "@/components/x-cropper/x-cropper.vue"
import accountApi from '@/api/account';
import uploadUtil from '@/utils/upload.js'
import config from '@/config/index.js'
import {mapGetters,mapMutations} from 'vuex'
export default {
components: {cropper},
computed: mapGetters(['userInfo']),
data() {
return {
isNew:false,
imgurl:"",
filePath:"",
aid:"",
}
},
onShow() {
this.$store.dispatch('GetUserInfo').then(rs=>{
//this.userInfoObj=rs;
this.imgurl = rs.avatar;
this.aid = rs.aid;
})
// this.imgurl = this.userInfo.avatar;
// this.aid = this.userInfo.aid;
},
methods: {
//上传返回图片
uploadImg(rsp) {
this.imgurl = rsp.path;
// rsp.avatar.imgSrc = rsp.path; //更新头像方式二
uploadUtil.uploadFileObject(rsp.file).then(rs=>{
if(rs.status==200){
this.imgurl = rs.result.httpPath;
this.filePath = rs.result.filePath;
this.isNew=true;
}
});
},
submitUpdate(){
//提交更新
let that=this;
if(this.filePath !== '' && this.isNew){
accountApi.updateAvatar({id:that.aid,avatar:that.filePath}).then(rs=>{
if(rs.status == 200){
// 更新下页面缓存
that.$store.dispatch('InitData');
uni.showModal({
icon:'success',
title:'更新成功',
showCancel:false,
success() {
uni.navigateBack(-1);
}
});
} else {
uni.showToast({
title:'更新失败'
})
}
})
}
},
}
}
</script>
<style lang="scss">
</style>

317
pages/my/index.vue Normal file
View File

@@ -0,0 +1,317 @@
<template>
<view>
<view class="mytop">
<view class="mytop-bell" style="height: 60upx;display: flex;justify-content:space-between;color:#ffffff;">
<view><!--此处比较空白 以后增加一内容--> &nbsp;</view>
<!-- <view @click="system()" style="padding: 20upx 30upx 5upx 0upx;">
<view style="position: absolute;top:10px;right: 10px;z-index: 999;">
<u-badge :max="99" :value="99" shape="circle"></u-badge>
</view>
<u-icon name="bell" color="#ffffff" :size="30"></u-icon>
</view> -->
</view>
<view class="top-user" style="">
<view class="top-user-left">
<view class="top-user-name" style="font-size: 1.8em;">
{{userInfoObj.name}}
</view>
<view class="" style="margin-top: 8px;">
{{userInfoObj.userNo}}
</view>
<view class="" style="margin-top: 8px;">
学习时长{{userInfoObj.studyTotalH}}小时
<!-- 没找到这个字段 -->
</view>
</view>
<view class="top-user-right" @click="navigateTo('setting')">
<view>
<u-avatar v-if="userInfoObj.avatar" :size="80" :src="userInfoObj.avatar"></u-avatar>
<u-avatar v-else class="uavatar" font-size="66" :size="80" bg-color="#d9e9ff">
<view class="peo" v-if="userInfoObj.sex === 1 "><image src="../../static/images/man.png" alt=""></view>
<view class="peo" v-else><image src="../../static/images/woman.png" alt=""></view>
</u-avatar>
</view>
<view style="padding-top: 50upx;">
<u-icon name="arrow-right" color="#ffffff" size="30"></u-icon>
</view>
</view>
</view>
</view>
<view class="uc-box" style="margin-top: -80upx;">
<!-- 学习时长模块 -->
<view class="uc-box-items">
<view class="one" @click="navigateTo('toMeShares')">
<view class="" style="font-weight: 600;font-size:22px;margin-top: 30px;">
<img style="width: 40px;height:40px;" src="../../static/images/toShare.png">
</view>
<view class="" style="font-weight: 500;font-size: 28upx;color: #585858;">
分享给我的
</view>
</view>
<view class="one" @click="navigateTo('myShares')">
<view class="" style="font-weight: 600;font-size:22px;margin-top: 30px">
<img style="width: 40px;height:40px;" src="../../static/images/meSh.png">
</view>
<view class="" style="font-weight: 500;font-size: 28upx;color: #585858;">
我分享的
</view>
</view>
<view class="one" @click="navigateTo('myFavorites')">
<view class="" style="font-weight: 600;font-size:22px;margin-top: 30px">
<img style="width: 40px;height:40px;" src="../../static/images/collect.png">
</view>
<view class="" style="font-weight: 500;font-size: 28upx;color: #585858;">
我收藏的
</view>
</view>
</view>
</view>
<!-- 学习内容模块 -->
<view class="uc-box">
<view class="uc-box-con">
<u-grid :border="false">
<u-grid-item>
<view class="one" @click="navigateTo('toMeComments')">
<view class="one-img">
<img src="../../static/images/l1.png">
</view>
<view class="one-text">
@我的
</view>
</view>
</u-grid-item>
<u-grid-item>
<view class="one" @click="navigateTo('myQuestions')">
<view class="one-img">
<img src="../../static/images/que.png">
</view>
<view class="one-text">
我提问的
</view>
</view>
</u-grid-item>
<u-grid-item>
<view class="one" @click="navigateTo('myAnswers')">
<view class="one-img">
<img src="../../static/images/answer.png">
</view>
<view class="one-text">
我回答的
</view>
</view>
</u-grid-item>
<!-- <u-grid-item>
<view class="one" @click="toStudyTask()">
<view class="one-img">
<img src="../../static/images/stuR.png">
</view>
<view class="one-text">
学习任务
</view>
<view class="one-num">
<u-badge numberType="overflow" max="99" :value="value" shape="circle"></u-badge>
</view>
</view>
</u-grid-item> -->
<!-- <u-grid-item>
<view class="one" @click="toStuding(1)">
<view class="one-img">
<img src="../../static/images/studing.png">
</view>
<view class="one-text">
自主学习
</view>
</view>
</u-grid-item> -->
<!-- <u-grid-item>
<view class="one" @click="toStudyHistory()">
<view class="one-img">
<img src="../../static/images/his.png">
</view>
<view class="one-text">
历史记录
</view>
</view>
</u-grid-item> -->
<u-grid-item>
<view class="one" @click="navigateTo('myArticles')">
<view class="one-img">
<img src="../../static/images/artical.png">
</view>
<view class="one-text">
我的文章
</view>
</view>
</u-grid-item>
<u-grid-item>
<view class="one" @click="navigateTo('myAssesses')">
<view class="one-img">
<img src="../../static/images/text.png">
</view>
<view class="one-text">
我的测评
</view>
</view>
</u-grid-item>
<u-grid-item>
<view class="one" @click="navigateTo('setting')">
<view class="one-img">
<img src="../../static/images/per.png">
</view>
<view class="one-text">个人设置</view>
</view>
</u-grid-item>
<u-grid-item>
<view class="one" @click="navigateTo('/pages/my/message')">
<view class="one-img">
<img src="../../static/images/que.png">
</view>
<view class="one-text">消息</view>
</view>
</u-grid-item>
</u-grid>
</view>
</view>
</view>
</template>
<script>
import { mapGetters } from 'vuex'
import userApi from "@/api/system/user";
import {userAvatarText} from '@/utils/tools.js';
export default {
computed: {
...mapGetters(['userInfo']),
avatarText(){
return userAvatarText(this.userInfo.name);
}
},
data() {
return {
userInfoObj:{
// sex:null,
account:{
nickName:''
}
},
msgNumber:11,
show: false,
zoom: true,
//徽标
type: "error",
value: 11
}
},
onShow() {
this.userInfoObj=this.userInfo;
//console.log(this.userInfoObj,"我拿到的数据")
},
onload(){
//this.load()
},
methods: {
navigateTo(u) {
uni.navigateTo({
url: u
})
},
},
components: {
}
}
</script>
<style lang="scss" scoped>
.peo{
width: 80px;
height: 80px;
image{
width: 100%;
height: 100%;
border-radius: 50%;
}
}
.uavatar{
// border: 2upx solid #d9e9ff;
// color: #fff;
// text-align: center;
// font-size: 50upx;
// line-height: 500upx;
// border-radius: 50%;
}
.mytop {
height: 200px;
background: url('../../static/images/bg.png')
}
.top-user{
display: flex;
justify-content: space-between;
color: #FFFFFF;
.top-user-left{
padding-left: 40upx;
}
.top-user-right{
padding-right: 20upx;
padding-top: 30upx;
display: flex;
justify-content: flex-end;
}
}
.top-right img {
width: 60px;
height: 60px;
border-radius: 50%;
margin-bottom: -40px;
}
.uc-box{
margin: 10upx;
padding: 20upx;
.uc-box-con{
box-shadow: #F1F6FE 0px 6px 5px;
background-color: #FFFFFF;
border-radius: 17px;
}
.uc-box-items{
height: 114px;
background-color: #FFFFFF;
border-radius: 17px;
display: flex;
justify-content: space-between;
box-shadow: #F1F6FE 0px 6px 5px;
padding: 0upx 50upx 40upx 50upx;
}
}
.one {
position: relative;
text-align: center;
padding-bottom: 40upx;
.one-img{
font-weight: 600;
margin-top: 24px;
img{
width: 35px;
height:35px;
}
}
.one-text{
font-weight: 500;
font-size: 26upx;
color: #585858;
}
.one-num{
position: absolute;
top:15px;
right: 0px;
text-align: center;
}
}
</style>

281
pages/my/message.vue Normal file
View File

@@ -0,0 +1,281 @@
<template>
<view>
<u-toast ref="toast"></u-toast>
<page-title :showBack="true">消息</page-title>
<view class="information_top">
<view class="information-top-le" @click="selectFn">选择</view>
<view class="information-top-re" @click="delList(true)">全部清空</view>
</view>
<view v-if="list.length==0&&emptyControl">
<u-empty icon="search" text="未找到您要搜索的内容"></u-empty>
</view>
<checkbox-group>
<view class="information_center" v-for="(item, index) in list" :key="index">
<view class="center-top">
<checkbox v-show="flag" @click="changeChecked(item)" :checked="item.checked"/>
<u--image shape="circle" src="../../static/images/meSh.png" width="50px" height="50px"></u--image>
<view class="center">
<view class="center-tit">
{{ item.title }}
<text class="center-time">{{ msgTimeChange(item.msgTime) }}</text>
</view>
<view class="center-con" @click="returnRouter(item)">{{ item.content }}</view>
</view>
</view>
</view>
</checkbox-group>
<view class="information_bottom" v-show="flag">
<view class="qux" @click="flag = false">取消</view>
<view class="del" @click="delList(false)">删除</view>
</view>
<view v-if="total > queryData.pageSize"><uni-load-more :status="loadStatus"></uni-load-more></view>
</view>
</template>
<script>
import apiMessage from '@/api/system/message.js';
export default {
data() {
return {
list: [],
queryData: {
pageIndex: 1,
pageSize: 10
},
total: 0,
flag: false, //控制勾选按钮的显示
loadStatus: 'more', //more,loading,noMore, 应该划分出三个
emptyControl:false,//控制未搜索到内容的显示
};
},
onPullDownRefresh() {
this.onReachBottom();
},
onReachBottom() {
if(this.list.length<this.total){
this.loadStatus='loading';
this.queryData.pageIndex++;
this.queryMessage(false);
this.loadStatus='more';
}else{
this.loadStatus='noMore';
}
},
methods: {
returnRouter(item) {
if (item.refType == 2) {
uni.navigateTo({
url: '/pages/resource/articeDetail?id=' + item.refId
});
} else if (item.refType == 4) {
uni.navigateTo({
url: '/pages/resource/qaDetail?id=' + item.refId
});
} else {
if (item.conType == '10') {
uni.navigateTo({
url: '/pages/resource/microDetail?id=' + item.refId
});
} else if (item.conType == '20') {
uni.navigateTo({
url: '/pages/resource/courseDetail?id=' +item.refId
});
}
}
},
//控制勾选等操作是否显示
selectFn() {
if(this.list.length!=0&&!this.flag){
this.flag = true;
}
},
//改变checked的值
changeChecked(val){
val.checked=!val.checked
},
//改变时间格式
msgTimeChange(msgTime) {
return msgTime.split(' ')[0];
},
queryMessage(flag) {
if (flag) {
this.list = [];
this.queryData.pageIndex = 1;
}
uni.showLoading({ title: '加载中...' });
apiMessage.list(this.queryData).then(res => {
if (res.status == 200) {
this.emptyControl=true
this.total = res.result.count;
if(res.result.list.length!=0){
res.result.list.forEach(item => {
item.checked = false;
this.list.push(item);
});
//设置已读
let ids=[];
for(let i=0;i<res.result.list.length;i++){
if(!res.result.list[i].isRead){
ids.push(res.result.list[i].id)
}
}
apiMessage.updateIsRead(ids).then(res=>{
if(res.status==200){
// this.$store.dispatch('refrashMsg');
}
})
}
} else {
this.$refs.toast.show({ message: '获取数据失败', type: 'error' })
}
uni.hideLoading();
});
},
delList(flag) {
if (this.list.length == 0) {
return this.$refs.toast.show({ message: '数据为空,无法删除', type: 'error' });
}
let ids=[];
if (flag) {
ids = this.list.map(v => v.id);
} else {
for (let i = 0; i < this.list.length; i++) {
if (this.list[i].checked) {
ids.push(this.list[i].id);
}
}
}
if(ids.length==0){
return this.$refs.toast.show({ message: '请先进行勾选', type: 'error' });
}
apiMessage.del(ids).then(res => {
if (res.status == 200) {
this.$refs.toast.show({ message: '删除成功', type: 'success' });
this.queryMessage(true);
} else {
this.$refs.toast.show({ message: '删除失败', type: 'error' });
}
});
}
},
onLoad: function(options) {
this.queryMessage(true);
}
};
</script>
<style lang="scss" scoped>
.information_top {
// height: 90upx;
display: flex;
justify-content: space-between;
.information-top-le {
width: 116upx;
height: 50upx;
background: #dfebf4;
border-radius: 40upx;
margin-top: 20upx;
margin-left: 37upx;
font-size: 24upx;
color: #999999;
text-align: center;
line-height: 50upx;
}
.information-top-re {
width: 156upx;
height: 48upx;
background: #e8e8e8;
font-size: 24upx;
color: #999999;
margin-top: 20upx;
margin-right: 30upx;
text-align: center;
line-height: 48upx;
}
}
.information_center {
padding: 20upx;
background: #ffffff;
margin-top: 18upx;
display: flex;
justify-content: space-between;
.center-top {
display: flex;
width: 100%;
uni-checkbox {
display: flex;
justify-content: center;
align-items: center;
/deep/ .uni-checkbox-input {
width: 24upx;
height: 24upx;
}
}
.center {
width: 100%;
margin-left: 20upx;
display: flex;
flex-direction: column;
justify-content: space-around;
.center-con {
width: 271px;
font-size: 24upx;
color: #999999;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.center-tit {
font-size: 28upx;
color: #333333;
display: flex;
justify-content: space-between;
align-items: center;
.center-time {
font-size: 24upx;
color: #cccccc;
}
}
}
}
}
.information_bottom {
width: 100%;
height: 120upx;
background: #ffffff;
position: fixed;
bottom: 0px;
display: flex;
.qux {
width: 316upx;
height: 76upx;
border: 1px solid #dcdcdc;
margin-left: 42upx;
margin-top: 25upx;
border-radius: 40upx;
font-size: 28upx;
color: #999999;
text-align: center;
line-height: 76upx;
}
.del {
width: 316upx;
height: 76upx;
background: #6194fe;
margin-left: 42upx;
margin-top: 25upx;
border-radius: 40upx;
font-size: 28upx;
color: #ffffff;
text-align: center;
line-height: 76upx;
}
}
</style>

404
pages/my/myAnswers.vue Normal file
View File

@@ -0,0 +1,404 @@
<template>
<!--我的问答 都是已回答的问题这里只是查询查看无操作-->
<view class="answer">
<u-toast ref="articleToast"></u-toast>
<page-title :showBack="true">我的回答</page-title>
<u-toast ref="messager"></u-toast>
<view class="top-filter">
<view class="top-content">
<view class="top-content-options">
<view>
<text class="textbtn" @click="statusSelectShow = !statusSelectShow">状态</text>
</view>
<view class="center">
<u-search
:clearabled="true"
placeholder="搜索关键字"
@search="findData(true)"
@clear="findData(true)"
v-model="qaList.keyWord"
:showAction="false"
shape="square"
bgColor="#ffffff"
></u-search>
</view>
</view>
</view>
</view>
<view class="sea-show" v-show="statusSelectShow">
<text @click="chooseStatus(null)" :class="[qaList.isResolve == null?'sea-active':'','sea-index' ]">全部</text>
<text @click="chooseStatus(true)" :class="[qaList.isResolve == true?'sea-active':'','sea-index' ]">已解决</text>
<text @click="chooseStatus(false)" :class="[qaList.isResolve == false?'sea-active':'','sea-index' ]">待解决</text>
</view>
<!-- 回答问题 -->
<view class="uni-list" style="margin-top: 10upx;">
<view class="article-one" v-for="(item, qidx) of qaList.list" :key="qidx" >
<view class="artical-box">
<!-- <view class="authors">
<author-info v-if="item.avatar!=''" :avatar="item.avatar" :name="item.name" :info="item.orgInfo"></author-info>
</view> -->
<view>
<view class="artical-box-top" @click="toDetail(item)">
<view style="
word-break:break-all;
overflow: hidden;
text-overflow: ellipsis;
-webkit-box-orient: vertical;
display: -webkit-box;-webkit-line-clamp: 1;
font-size: 30rpx;
font-weight: bold;
">
<text class="qa-basic qa-solve" v-if="item.isResolve">[已解决]</text>
<text class="qa-basic qa-unSolve" v-else >[待解决]</text>
<text v-html="$keywordActiveShow(item.title,qaList.keyWord)"></text>
</view>
<!-- <text>已解决</text> -->
</view>
<view class="articl-box-cont" @click="toDetail(item)">
<view>{{ item.content }}</view>
</view>
<view class="articl-box-cont" style="margin-top: 15upx;font-weight: bold;" @click="toDetail(item)">
<view><text style="">我的回答</text>{{ item.answercontent }}</view>
</view>
<view class="articl-box-time">
<!-- 这里原本只显示一个时间pc端两个时间都显示 -->
<!-- <view>问题时间{{ item.sysCreateTimeQ }}</view> -->
<view style="padding-top: 12px;">回复时间{{ item.sysCreateTimeA }}</view>
<view class="rowbtn-right">
<view class="rowbtn rowbtn-primary" @click="editItem(item)">
<u-icon name="edit-pen" color="#3E7FFF" labelColor="#3E7FFF" label="编辑" size="16" labelSize="12"></u-icon>
</view>
<view class="rowbtn rowbtn-info" @click="delItem(item)">
<u-icon name="trash" color="#767676" labelColor="#767676" label="删除" size="16" labelSize="12"></u-icon>
</view>
</view>
</view>
</view>
<!-- <interact-bar :comments="false" :answers="true" :data="item"></interact-bar> -->
</view>
</view>
</view>
<view v-if="qaList.count>qaList.pageSize"> <uni-load-more :status="loadStatus"></uni-load-more></view>
<u-popup :show="inputShow" @close="closeInput" @open="openInput">
<view>
<view style="display: flex;">
<view style="flex: 1;padding: 15upx;">
<!-- +reply.sysCreateBy -->
<u--textarea :height="150" v-model="inputValue" :plaholder="'回复'" count></u--textarea>
</view>
<view style="width:160upx;text-align: center;padding-top: 10px;line-height: 80upx;">
<view>
<u-button type="primary" @click="publishReply" text="发布" style="width: 100upx;height: 80upx;margin-top: 80upx;"></u-button>
</view>
</view>
</view>
<view>
</view>
</view>
</u-popup>
</view>
</template>
<script>
import apiQa from '@/api/modules/qa.js';
import apiUser from '@/api/system/user.js';
export default {
data() {
return {
reply: {},
inputValue: '',
inputShow:false,//控制回复弹窗
isResolve: null,
statusSelectShow: false,
statusBtn: '全部',
statusArray: [
[
{
name: '全部',
value: null
},
{
name: '待解决',
value: false
},
{
name: '已解决',
value: true
}
]
],
qaList: {
pageIndex: 1,
pageSize: 20,
count: 0,
list: [],
isResolve:null,
},
loadStatus: 'more'
};
},
methods: {
publishReply() {
const $this=this;
let {answerid,content,sysCreateAid,favorites,praises,shares}=this.reply;
apiQa
.updateAnswer({id:answerid,sysCreateAid,content:$this.inputValue})
.then(res => {
if (res.status == 200) {
$this.$refs.articleToast.show({message:'修改成功',type:'success'});
$this.closeInput();
$this.findData(true);
} else {
$this.$refs.articleToast.show({message:'修改失败',type:'error'});
}
})
},
editItem(item){
this.reply = item;
this.inputValue = item.answercontent;
this.inputShow=true
},
openInput() {
this.inputShow = true;
},
closeInput() {
this.inputShow = false;
},
delItem(item) {
const $this=this
uni.showModal({
title: '提示',
content: '您确定要删除此回答吗?',
success: function (res) {
if (res.confirm) {
apiQa
.delAnswer(item.answerid)
.then(res => {
if (res.status == 200) {
$this.$refs.articleToast.show({message:'删除成功',type:'success'});
$this.findData(true);
} else {
$this.$refs.articleToast.show({message:'删除失败,请稍后再试',type:'error'});
}
})
}
}
});
},
chooseStatus(e) {
// this.statusSelectShow = false;
// this.statusBtn = e.value[0].name;
this.qaList.isResolve = e;
this.findData(true);
},
toDetail(item) {
uni.navigateTo({
url: '/pages/resource/qaDetail?id=' + item.qid
});
},
findData(flag) {
uni.showLoading({ title: '加载中...' });
if (flag) {
this.qaList.list = [];
}
// const { pageIndex, pageSize, keyWord,isResolve } = this.qaList;
let params = {
pageIndex:this.qaList.pageIndex,
pageSize:this.qaList.pageSize,
isResolve:this.qaList.isResolve,
};
if (this.qaList.keyWord) {
params.keyWord = this.qaList.keyWord;
}
let $this=this;
apiQa.queryAnswer(params).then(async res => {
if (res.status == 200) {
this.qaList.count = res.result.count;
let userIds = [];
res.result.list.forEach(item => {
item.avatar='';
item.name='',
item.orgInfo='';
userIds.push(item.sysCreateAid);
$this.qaList.list.push(item);
});
this.loadUserInfos(res.result.list, userIds);
}else{
//加载数据列表错误
this.$refs.messager.show({message:'加载数据失败:'+res.message,type:'error'});
}
setTimeout(function(){uni.hideLoading();},100);
});
},
loadUserInfos(list, userIds) {
const noReapetIds = [...new Set(userIds)];
let $this=this;
apiUser.getByIds(noReapetIds).then(res => {
if (res.status == 200) {
list.forEach(item => {
res.result.some(author => {
if (author.aid == item.sysCreateAid) {
item.name = author.name;
item.aid = author.aid;
item.orgInfo = author.orgInfo;
item.code = author.code;
item.avatar = $this.$config.fileUrl + author.avatar;
//console.log(item,'item');
return true;
}
return false;
});
});
} else {
uni.showToast({
title: '获取数据失败',
icon: 'none'
});
}
//原本想用async await等数据请求完成后使用hideLoading,但是页面渲染需要时间关闭太早了有考虑用nexeTick()
setTimeout(function() {
uni.hideLoading();
}, 1000);
});
}
},
onLoad: function(options) {
this.findData(true);
},
onPullDownRefresh() {
this.onReachBottom();
},
async onReachBottom() {
if (this.qaList.list.length < this.qaList.count) {
this.loadStatus = 'loading'; //more,loading,noMore
this.qaList.pageIndex++;
await this.findData(false);
this.loadStatus = 'more';
} else {
this.loadStatus = 'noMore';
}
}
};
</script>
<style lang="scss" scoped>
.rowbtn-right{
margin-top: 10upx;
display: flex;
justify-content: flex-end;
}
.rowbtn{
padding: 5px 8px 0px 8px;
height: 20px;
border-radius: 10upx;
margin-left: 20upx;
}
.rowbtn-primary{
background-color: #ebf3fe;
}
.rowbtn-info{
background-color: #f7f7f7;
}
.authors {
font-size: 28rpx;
color: #444444;
.title-one {
font-size: 24rpx;
color: #666666;
}
}
.sea-show{
padding: 20rpx;
.sea-active{
border: 1rpx solid #679cfc !important;
color: #679cfc;
}
.sea-index{
font-size: 26rpx;
padding: 6rpx 16rpx;
border: 1rpx solid #ccc;
border-radius: 20rpx;
margin-right: 16rpx;
background-color: #fff;
}
}
.top-filter {
.top-content {
// background-color: #6297FD;
.top-content-options {
padding:20upx 30upx 0 30upx ;
height: 40px;
line-height: 40px;
display: flex;
align-items: center;
.center{
flex: 1;
margin: 0upx 0upx 0upx 12upx;
}
}
}
.top-filter-result {
padding: 5px 10px;
font-size: 24upx;
color: #747474;
}
}
.uni-list {
.artical-box {
margin-top: 20upx;
color: #151515;
padding: 8rpx 30rpx;
background-color: #ffffff;
.artical-box-top {
font-weight: 500;
font-size: 30rpx;
line-height: 60rpx;
margin-top: 10rpx;
}
.articl-box-cont {
font-size: 28rpx;
line-height: 50rpx;
color: #454545;
// margin: 0upx 10upx;
overflow: hidden;
text-overflow: ellipsis;
-webkit-box-orient: vertical;
display: -webkit-box;-webkit-line-clamp: 2;
word-break:break-all;
}
.articl-box-time {
font-size: 26rpx;
color: #999999;
padding: 20rpx 0;
display: flex;
justify-content: space-between;
// border-bottom: 1rpx solid #eee;
// view{
// font-size: 26rpx;
// }
}
// .articl-box-cont :nth-child(2) {
// margin: 15upx;
// }
}
}
.textbtn {
background-color: #ffffff;
padding: 9px 10px;
color: #666;
border-radius: 8upx;
font-size: 28upx;
}
</style>

511
pages/my/myArticles.vue Normal file
View File

@@ -0,0 +1,511 @@
<template>
<!--我的文章-->
<view class="article">
<u-toast ref="articleToast"></u-toast>
<page-title :showBack="true">我的文章</page-title>
<view class="top-filter">
<view class="top-content">
<view class="top-content-options">
<view style="width: 100upx;">
<!-- <u-picker :show="statusSelectShow" @cancel="statusSelectShow = false" @confirm="chooseStatus" :columns="selectData" keyName="label"></u-picker> -->
<!-- <text class="textbtn" style="color:#666" @click="statusSelectShow = true">{{ statusBtn }}</text> -->
<text class="textbtn" style="color:#666;font-size: 28upx;" @click="statusSelectShow = !statusSelectShow">状态</text>
</view>
<view class="input-search">
<u-search
@search="findData(true)"
:showAction="false"
@clear="findData(true)"
:clearabled="true"
v-model="articleList.keyword"
placeholder="搜索关键字"
shape="square"
bgColor="#ffffff"
>
<!-- <template slot="suffix">
<u-icon @click="findData(true)" name="search"></u-icon>
</template> -->
</u-search>
</view>
<view style="width: 70upx;">
<view class="textbtn" @click="toAdd()"><u-icon name="plus" color="#2979ff" size="18"></u-icon></view>
</view>
</view>
</view>
</view>
<view class="uni-list">
<view v-show="statusSelectShow" class="sea-show">
<text :class="[articleList.status == status.value? 'sea-active':'','sea-index']" v-for="(status,index) in selectData" :key="index" @click="chooseStatus(status)">{{status.label}}</text>
</view>
<view style="margin-top: 5upx;">
<!-- 文章内容 下面需要把样式提到class中-->
<view class="article_one" v-for="(item, index) of articleList.list" :key="item.id">
<view >
<view class="article-center">
<view class="article-status" @click="toDetail(item)">
<view style="" v-html="statusDisplay(item.status)"></view>
<view style="" v-html="$keywordActiveShow(item.title, articleList.keyword)" class="article-top"></view>
</view>
<view class="article-bot" @click="toDetail(item)">
<text class="article-wz" v-html="$keywordActiveShow(item.summary, articleList.keyword)"></text>
<img v-if="item.coverurl" :src="$config.fileUrl+item.coverurl" alt=""/>
<!-- <view class="article-tom">
<img class="imgs" :src="item.avatar" alt="" />
<text class="tom-wz">{{ item.name }}{{ item.orgInfo }}</text>
</view> -->
</view>
<!--自己不需要显示作者信息呀-->
<!-- <author-info :avatar="item.avatar" :name="item.name" :info="item.orgInfo"></author-info> -->
<view style="display: flex;justify-content: space-between;margin-top: 10upx;">
<view class="createTime">
{{item.sysCreateTime}}
</view>
<view style="display: flex;">
<view class="rowbtn rowbtn-primary">
<u-icon name="edit-pen" color="#3E7FFF" labelColor="#3E7FFF" @click="toEdit(item)" label="编辑" size="16" labelSize="12"></u-icon>
</view>
<view class="rowbtn rowbtn-info" style="margin-left: 20px;">
<u-icon @click="del(item)" color="#767676" labelColor="#767676" name="trash" label="删除" size="16" labelSize="12"></u-icon>
</view>
<!-- <u-icon name="more-dot-fill" @click="setEditId(item)" size="16" labelSize="16"></u-icon> -->
</view>
</view>
<!-- <view v-if="editId==item.id">
<view v-if="userInfo.aid==item.sysCreateAid" style="display: flex;justify-content: space-around;">
<view class="rowbtn rowbtn-primary">
<u-icon name="edit-pen" color="#2c7dc8" labelColor="#2c7dc8" @click="toEdit(item)" label="编辑" size="16" labelSize="12"></u-icon>
</view>
<view class="rowbtn rowbtn-info">
<u-icon @click="del(item)" color="#767676" labelColor="#767676" name="trash" label="删除" size="16" labelSize="12"></u-icon>
</view>
</view>
</view> -->
</view>
</view>
<!-- <view class="article_action"> -->
<!-- <interact-bar :views="false" :data="item"></interact-bar> -->
<!-- v-if="userInfo.aid==detail.sysCreateAid" -->
<!-- </view> -->
</view>
</view>
</view>
<uni-load-more v-show="this.articleList.count>articleList.pageSize" :status="loadStatus"></uni-load-more>
</view>
</template>
<script>
import apiArticle from '@/api/modules/article.js';
import apiUser from '@/api/system/user.js';
import { mapGetters } from 'vuex';
export default {
data() {
return {
flagLoading:false,
statusArray: [
[
{
name: '全部',
value: null
},
{
name: '待解决',
value: false
},
{
name: '已解决',
value: true
}
]
],
articleList: {
pageIndex: 1,
pageSize: 4,
keyword:'',
status: null,
count: 0,
list: []
},
editId:'',
loadStatus: 'more',
statusSelectShow: false,
statusBtn: '全部',
selectData: [
// [
{ label: '全部', value: null },
{ label: '草稿', value: 1 },
{ label: '待审核', value: 2 },
{ label: '未通过', value: 3 },
{ label: '已通过', value: 5 },
{ label: '已发布', value: 9 }
]
// ]
};
},
computed: {
...mapGetters(['userInfo'])
},
methods: {
setEditId(item){
this.editId=item.id;
},
findData(flag) {
if(this.flagLoading) {
return;
}
this.flagLoading = true;
//是否重置列表
if (flag) {
this.articleList.list = [];
}
uni.showLoading({ title: '加载中...' });
//查询条件
let params = {
pageIndex: this.articleList.pageIndex,
pageSize: this.articleList.pageSize,
status: this.articleList.status,
keyword:this.articleList.keyword,
sysCreateAid:this.userInfo.aid
};
apiArticle.myPageList(params).then(async rs => {
this.flagLoading = false;
uni.hideLoading();
if (rs.status == 200) {
if (rs.result.list.length != 0) {
this.articleList.count = rs.result.count;
let userIds = [];
rs.result.list.forEach(item => {
item.name=''
item.aid = '';
item.orgInfo = '';
item.code = '';
item.avatar = '';
this.articleList.list.push(item);
userIds.push(item.sysCreateAid);
});
await this.loadUserInfos(rs.result.list, userIds);
}else{
uni.showToast({
title: '查无数据',
icon: 'none'
});
}
}
// uni.hideLoading();
});
},
loadUserInfos(list, userIds) {
const noReapetIds = [...new Set(userIds)];
apiUser.getByIds(noReapetIds).then(res => {
if (res.status == 200) {
list.forEach(item => {
res.result.some(author => {
if (author.aid == item.sysCreateAid) {
let { aid, avatar, name, orgInfo, code } = author;
if (!avatar) {
avatar = this.$config.fileUrl + avatar;
}else{
avatar='';
}
item.name = name;
item.aid = aid;
item.orgInfo = orgInfo;
item.code = code;
item.avatar = avatar;
return true;
}
return false;
});
});
} else {
uni.showToast({
title: '获取数据失败',
icon: 'none'
});
}
// this.$nextTick(function(){
// uni.hideLoading();
// })
//原本想用async await等数据请求完成后使用hideLoading,但是页面渲染需要时间关闭太早了有考虑用nexeTick()
setTimeout(function() {
uni.hideLoading();
}, 100);
});
},
chooseStatus(e) {
if(this.flagLoading) {
return;
}
// this.statusSelectShow = false;
// this.statusBtn = e.value[0].label;
this.articleList.pageIndex = 1;
this.articleList.status = e.value;
this.findData(true);
},
toAdd() {
uni.navigateTo({
url: '/pages/plus/addArticle'
});
},
toDetail(item) {
if(item.status==1){
return uni.navigateTo({
url: '/pages/plus/addArticle?value=' + JSON.stringify(item)
});
}
uni.navigateTo({
url: '/pages/resource/articeDetail?id=' + item.id
});
},
statusDisplay(status){
let obj={
1:'<span style="color:#999">[草稿]<span>',
2:'<span style="color:#3E7FFF">[待审核]<span>',
3:'<span style="color:#FF3E3E">[未通过]<span>',
5:'<span style="color:#2AB28B">[已通过]<span>',
9:'<span style="color:#3E7FFF">[已发布]<span>'
}
return obj[status]
},
del(item){
const $this=this
uni.showModal({
title: '提示',
content: '您确定要删除此文章吗?',
success: function (res) {
if (res.confirm) {
//$this.del();
apiArticle.del(item.id).then(res=>{
if(res.status=200){
$this.$refs.articleToast.show({message:'删除成功',type:'success'});
setTimeout(()=>{
$this.findData(true)
},1000)
// $this.findData(true)
// let pages =getCurrentPages();
// const prevPage=pages[pages.length-2];
// if(!prevPage){
// uni.switchTab({
// url:'/pages/index/index'
// })
// }else{
// uni.navigateBack();
// }
}else{
$this.$refs.articleToast.show({message:'删除失败,请稍后再试',type:'error'});
}
})
} else if (res.cancel) {
}
}
});
},
toEdit(item){
uni.navigateTo({
url:'/pages/plus/editArticle?id='+item.id
})
},
},
onLoad: function(options) {
this.findData(true);
},
onPullDownRefresh() {
this.onReachBottom();
},
async onReachBottom() {
if (this.articleList.list.length < this.articleList.count) {
this.loadStatus = 'loading'; //more,loading,noMore
this.articleList.pageIndex++;
await this.findData(false);
this.loadStatus = 'more';
} else {
this.loadStatus = 'noMore';
}
}
}
</script>
<style lang="scss" scoped>
.rowbtn{
padding: 5px 8px 0px 8px;
height: 20px;
border-radius: 10upx;
}
.rowbtn-primary{
background-color: #ebf3fe;
}
.rowbtn-info{
background-color: #f7f7f7;
}
.top-filter {
.top-content {
// padding: 5px 5px;
.top-content-options {
height: 40px;
display: flex;
justify-content: space-between;
align-items: center;
line-height: 40px;
padding:20upx 30upx 10upx 30upx ;
.textbtn {
background-color: #ffffff;
color: #4f4f4f;
border-radius: 8upx;
font-size: 24upx;
}
.input-search {
flex: 1;
// padding: 28upx 20upx;
margin: 0upx 20upx 0upx 12upx;
.u-input {
background: #ffffff;
}
}
}
}
.top-filter-result {
padding: 5px 10px;
font-size: 24upx;
color: #747474;
}
}
.textbtn {
background-color: #ffffff;
padding: 9px 10px;
color: #4f4f4f;
border-radius: 8upx;
font-size: 24upx;
}
.addition {
margin-left: 20rpx;
.textbtn {
background-color: #ffffff;
color: #4f4f4f;
border-radius: 8upx;
font-size: 24upx;
}
}
.uni-list {
.sea-show{
padding: 20rpx;
.sea-active{
border: 1rpx solid #679cfc !important;
color: #679cfc;
}
.sea-index{
font-size: 26rpx;
padding: 6rpx 16rpx;
border: 1rpx solid #ccc;
border-radius: 20rpx;
margin-right: 16rpx;
background-color: #fff;
}
.sea-index:last-child{
margin-right: 0;
}
}
.article_one{
padding: 20upx 30upx;
padding-top: 10upx;
margin-bottom: 20upx;
background-color: #ffffff;
&:last-of-type{
margin-bottom: 0;
}
// .article_action{
// display: flex;
// justify-content: space-between;
// align-items: center;
// /deep/ .article_btn{
// display: flex;
// justify-content: space-between;
// align-items: center;
// .u-icon__label{
// span{
// font-size: 12px;
// }
// }
// }
// }
}
.article-center {
background: #ffffff;
//border-radius: 5px;
border-bottom: 4upx;
.article-status{
display: flex;
font-weight: bold;
justify-content: flex-start;
align-items: center;
font-size: 30rpx;
line-height: 60upx;
.article-top {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: #040404;
text-align: left;
flex-shrink: 10000;
margin-left: 4px;
}
}
.article-bot {
display: flex;
justify-content: space-between;
.article-wz {
font-size: 28rpx;
color: #454545;
line-height: 39rpx;
display: -webkit-box;
overflow: hidden;
margin: 10upx 0px 15upx;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
img{
margin-left:43upx;
width: 137upx;
height: 80upx;
}
}
.item-author{
margin: 20upx 0;
}
.art-bottom{
.createTime{
padding-bottom: 30upx;
color:#999;
font-size: 20upx;
}
.article_btn{
float: right;
font-size: 12px;
margin-top: 5rpx;
.u-icon__label{
font-size: 12rpx;
span{
font-size: 12rpx;
}
}
}
}
}
.createTime{
color:#999;
font-size: 24upx;
line-height: 48upx;
}
}
</style>

44
pages/my/myAssdetail.vue Normal file
View File

@@ -0,0 +1,44 @@
<template>
<!-- 我的测评详情 -->
<view class="loaddetail-box">
<page-title :showBack="true">我的评估</page-title>
<view class="">
<web-view v-if="url!=''" :src="url" style="width: 100%;height: 100%;"></web-view>
</view>
</view>
</template>
<script>
export default {
data() {
return{
id:'',
url:'',
text:'',
}
},
onLoad(options) {
//console.log(options.id)
this.url = options.url
},
mounted(){
// let urlPre=window.location.protocol+'//'+window.location.host;
// this.url = `${urlPre}/m/quizsummary?id=${this.id}&inner=1`
}
}
</script>
<style lang="scss" scoped>
.loaddetail-box{
width: 100%;
height: 100%;
}
body{
width: 100%;
height: 100%;
}
uni-page-body{
height: 100%;
}
</style>

160
pages/my/myAssesses.vue Normal file
View File

@@ -0,0 +1,160 @@
<template>
<!--我的测评-->
<view>
<page-title :showBack="true">我的测评</page-title>
<view class="top-content">
<view>
<u-search
:clearabled="true"
@search="findList(true)"
@clear="findList(true)"
placeholder="搜索关键字"
v-model="keyword"
:showAction="false"
shape="square"
bgColor="#ffffff">
</u-search>
</view>
</view>
<view class="listbox">
<view class="assess content" v-for="(item,idx) in testList" :key="idx" @click="myAssessdetail(item)">
<view class="assess-info">
<view class="assess-info-content">
<img :src="coverFilter(item.cover)">
<view class="assess-text">
<view style="font-size: 32rpx; font-weight: bold;">{{item.title}}</view>
<view style="font-size: 28rpx;">{{item.date}}</view>
</view>
</view>
</view>
</view>
<view>
<uni-load-more :status="loadStatus"></uni-load-more>
</view>
</view>
</view>
</view>
</template>
<script>
// import apiBoeCourse from '@/api/modules/course.js';
import apiBoeCourse from '@/api/boe/course.js';
export default {
data() {
return {
keyword: '',
testList:'',
total:0,
chaturl:'',
size:8,
page:1,
loadStatus: 'more',
list:[]
}
},
onPullDownRefresh() {
this.onReachBottom();
},
onReachBottom() {
this.loadStatus = 'loading'; //more,loading,noMore
let $this = this;
setTimeout(function() {
$this.loadStatus = 'noMore';
}, 1000);
},
onLoad(options) {
this.findList();
},
methods:{
// 测评跳转详情
myAssessdetail(item){
//console.log(item.id)
uni.navigateTo({
url: '/pages/my/myAssdetail?url='+item.url
});
},
findList(flag){
uni.showLoading({ title: '加载中...' });
let params={
keyword:this.keyword,
pagesize:this.page,
size:this.size
}
if (this.keyWord) {
params.keyWord = this.keyWord;
}
apiBoeCourse.reportList(params).then(rs=>{
//console.log(rs.result.reportList);
//this.total = rs.result.count
// rs.result.reportList.forEach(item=>{
// console.log(item.cover,'item.conver');
// // if(item.cover && item.cover.length>0){
// // item.cover=item.cover[0];
// // console.log(item.cover,'item.conver');
// // }
// })
this.testList = rs.result.reportList;
setTimeout(function() {uni.hideLoading();}, 100);
})
},
coverFilter(url){
return url[0].url||url[0]
}
}
}
</script>
<style lang="scss" scoped>
// .big-box_top{
// height: 38px;
// display: flex;
// padding-top: 15upx;
// }
.top-content {
padding: 28upx 20upx 10upx 20upx;
margin-bottom: 20upx;
}
.assess {
padding: 10px;
margin-bottom: 10px;
.assess-info {
padding-top: 8px;
display: flex;
justify-content: space-between;
.assess-info-content {
display: flex;
line-height: 40upx;
img {
width: 220upx;
height: 150upx;
}
.assess-text {
font-size: 35upx;
color: #000000;
margin-top: 5px;
margin-left: 10px;
}
.assess-text :nth-child(2) {
font-size: 28upx;
color: #909090;
margin-top: 50upx;
}
}
}
}
</style>

800
pages/my/myFavorites.vue Normal file
View File

@@ -0,0 +1,800 @@
<template>
<view>
<!-- <u-popup :show="show" mode="center" closeable @close="close">
<view>
您确定要取消收藏吗
</view>
</u-popup> -->
<page-title :showBack="true">我的收藏</page-title>
<view class="top-tab">
<view class="top-bar-center">
<view class="top-bar-tab" @click="clicktab(1)" :class="{ active: conType == 1 }">课程</view>
<view class="top-bar-tab" @click="clicktab(2)" :class="{ active: conType == 2 }">文章</view>
<view class="top-bar-tab" @click="clicktab(4)" :class="{ active: conType == 4 }">问答</view>
</view>
</view>
<view class="top-content-options">
<!-- 是否已查看 -->
<!-- <view style="margin-right: 15rpx;">
<u-picker :show="statusSelectShow" @cancel="statusSelectShow = false" @confirm="chooseStatus" :columns="selectData" keyName="label"></u-picker>
<text class="textbtn" @click="statusSelectShow = true">{{ statusBtn }}</text>
</view> -->
<!--课程-->
<view class="input-search">
<u-search
v-model="query.keyword"
:clearabled="true"
placeholder="输入关键词"
@search="findData(true)"
@clear="findData(true)"
:showAction="false"
shape="square"
bgColor="#ffffff">
</u-search>
</view>
</view>
<view v-if="conType == 1">
<view v-for="(item, idx) in courseList" :key="idx" class="course_box">
<view class="course" @click="toCourseDetail(item)">
<view class="course-info">
<view class="" style="">
<course-image :course="item" width="262upx" height="147upx"></course-image>
</view>
<view class="course-title">
<view style="height: 70upx;">
<span class="common" :class="contentTypeFilter(item.contentType).class">{{ contentTypeFilter(item.contentType).text }}</span>
<span style="font-weight: bold; font-size: 32rpx;" v-html="$keywordActiveShow(item.title, query.keyword)"></span>
</view>
<view class="course-content">
<view class="course-text">讲师{{ item.authorName }}</view>
</view>
</view>
</view>
<!-- <view class="course-content">
<view></view>
<view class="course-con_source">分享日期{{ item.time }}</view>
<view class="course-author">
{{ item.toAname }}分享给我
</view>
</view> -->
</view>
<view class="item-bottom">
<text class="item-time">收藏时间{{ item.time }}</text>
<view class="rowbtn rowbtn-primary">
<u-icon name="minus-circle" color="#3E7FFF" labelColor="#3E7FFF" @click="delCollectItem(item)" label="取消收藏" size="16" labelSize="12"></u-icon>
</view>
<!-- <u-icon @click="delCollectItem(item)" name="minus-circle" label="取消收藏" color="#666" size="18" style="float:left;margin-top:3rpx"></u-icon> -->
</view>
</view>
</view>
<view v-if="conType == 2">
<view class="article_one" v-for="(item, idx) in articleList" :key="idx">
<view class="articla_tit" @click="toArticleDetail(item)" v-html="$keywordActiveShow(item.title, query.keyword)"></view>
<text class="articla_text" v-html="$keywordActiveShow(item.summary, query.keyword)"></text>
<author-info :avatar="item.avatar" :name="item.sysCreateBy" :info="item.orgInfo" :sex="item.sex"></author-info>
<view class="artical_text_bottom">
<text class="item-time">收藏时间{{ item.time }}</text>
<!-- <u-icon @click="delCollectItem(item)" name="minus-circle" color="#666" size="18" label="取消收藏" style="float:left;margin-top:3rpx"></u-icon> -->
<view class="rowbtn rowbtn-primary">
<u-icon name="minus-circle" color="#3E7FFF" labelColor="#3E7FFF" @click="delCollectItem(item)" label="取消收藏" size="16" labelSize="12"></u-icon>
</view>
</view>
</view>
</view>
<view v-if="conType == 4">
<view v-for="(item, idx) in qaList" :key="idx" class="qa">
<view class="qa-body" @click="toQaDetail(item.question)">
<text v-if="item.question.isResolve" style="color:#08A890">[已解决]</text>
<text v-else style="color:#588afc">
[待解决]
</text>
<text v-html="$keywordActiveShow(item.question.title, query.keyword)"></text>
</view>
<view class="qa-bottom" v-html="$keywordActiveShow(item.question.summary, query.keyword)"></view>
<author-info :avatar="item.avatar" :name="item.question.sysCreateBy" :info="item.orgInfo" :sex="item.sex"></author-info>
<!-- <text style="font-size: 9px;color: #666666">{{ item.toAname }}分享给我</text> -->
<view class="qa-answers" v-if="item.question.isResolve">
<view style="
word-break:break-all;
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
-webkit-box-orient: vertical;
display: -webkit-box;-webkit-line-clamp: 2;
line-height: 35rpx;
overflow: hidden;text-overflow: ellipsis;
font-size: 28rpx;
">
<text style="color: #FFB30F; " class="answertext" >最佳回答</text> {{ item.question.bestAnswer }}
</view>
</view>
<view class="item-bottom">
<text class="item-time">收藏时间{{ item.time }}</text>
<view class="rowbtn rowbtn-primary">
<u-icon name="minus-circle" color="#3E7FFF" labelColor="#3E7FFF" @click="delCollectItem(item)" label="取消收藏" size="16" labelSize="12"></u-icon>
</view>
<!-- <u-icon @click="delCollectItem(item)" name="minus-circle" label="取消收藏" color="#666" size="18" style="float:left;margin-top:3rpx"></u-icon> -->
</view>
</view>
</view>
<view v-show="count > query.pageSize"><uni-load-more :status="loadStatus"></uni-load-more></view>
</view>
</template>
<script>
import { mapState, mapActions } from 'vuex';
import apiFavorites from '@/api/modules/favorites.js';
import apiUser from '@/api/system/user.js';
export default {
computed: mapState(['resourceTab']),
data() {
return {
isRead:null,
statusBtn: '全部',
selectData: [
[
{ label: '全部', value: null },
{ label: '已查看', value: true },
{ label: '未查看', value: false },
]
],
statusSelectShow: false,
conType: 1,
query: {
pageIndex: 1,
pageSize: 4,
keyword: ''
},
courseList: [],
articleList: [],
qaList: [],
count: 0,
loadStatus: 'more', //more,loading,noMore, 应该划分出三个
// show:false,//控制弹出层
// collectStorge:{},//用于存储点击取消收藏的数据
};
},
onLoad: function(options) {
this.findData(true);
},
onPullDownRefresh() {
this.onReachBottom();
},
async onReachBottom() {
if (this.conType == 1) {
if (this.courseList.length < this.count) {
this.loadStatus = 'loading';
this.query.pageIndex++;
await this.findData(false);
this.loadStatus = 'more';
} else {
this.loadStatus = 'noMore';
}
}
if (this.conType == 2) {
if (this.articleList.length < this.count) {
this.loadStatus = 'loading';
this.query.pageIndex++;
await this.findData(false);
this.loadStatus = 'more';
} else {
this.loadStatus = 'noMore';
}
}
if (this.conType == 4) {
if (this.qaList.length < this.count) {
this.loadStatus = 'loading';
this.query.pageIndex++;
await this.findData(false);
this.loadStatus = 'more';
} else {
this.loadStatus = 'noMore';
}
}
},
methods: {
//点击切换类别时请求数据
clicktab(val) {
this.conType = val;
this.query.pageIndex = 1;
this.query.keyword = '';
this.isRead = null;
this.query.isRead = null;
this.statusBtn = '全部'
this.findData(true);
},
//查找数据
findData(flag) {
//是否重置列表
if (flag) {
if (this.conType == 1) {
this.courseList = [];
}
if (this.conType == 2) {
this.articleList = [];
}
if (this.conType == 4) {
this.qaList = [];
}
}
this.query.isRead = this.isRead;
//生成查询条件
uni.showLoading({ title: '加载中...' });
//查询条件
const conList = {
1: 'coursePageList',
2: 'articlePageList',
4: 'qaPageList'
};
apiFavorites[conList[this.conType]](this.query).then(rs => {
if (rs.status == 200) {
this.count = rs.result.count;
let userIds = [];
if (this.conType == 1) {
rs.result.list.forEach(item => {
this.courseList.push(item);
});
}
if (this.conType == 2) {
rs.result.list.forEach(item => {
item.avatar = '';
item.orgInfo = '';
item.sex = null;
userIds.push(item.sysCreateAid);
this.articleList.push(item);
this.loadUserInfos(rs.result.list, userIds);
});
}
if (this.conType == 4) {
rs.result.list.forEach(item => {
item.avatar = '';
item.orgInfo = '';
item.sex = null;
userIds.push(item.question.sysCreateAid);
this.qaList.push(item);
this.loadUserInfos(rs.result.list, userIds);
});
}
} else {
uni.showToast({
title: '获取数据失败',
icon: 'none'
});
}
});
setTimeout(function() {
uni.hideLoading();
}, 100);
},
loadUserInfos(list, userIds) {
let $this = this;
const noReapetIds = [...new Set(userIds)];
apiUser.getByIds(noReapetIds).then(res => {
if (res.status == 200) {
if (this.conType == 2) {
list.forEach(item => {
res.result.some(author => {
if (author.aid == item.sysCreateAid) {
if (author.avatar != '') {
item.avatar = $this.$config.fileUrl + author.avatar;
} else {
item.avatar = '';
}
item.sex = author.sex;
item.orgInfo = author.orgInfo;
return true;
}
return false;
});
});
} else {
list.forEach(item => {
res.result.some(author => {
if (author.aid == item.question.sysCreateAid) {
if (author.avatar != '') {
item.avatar = $this.$config.fileUrl + author.avatar;
} else {
item.avatar = '';
}
item.sex = author.sex;
item.orgInfo = author.orgInfo;
return true;
}
return false;
});
});
}
}
});
},
chooseStatus(e) {
this.statusSelectShow = false;
this.statusBtn = e.value[0].label;
this.isRead = e.value[0].value;
//console.log(this.isRead)
this.findData(true);
},
toCourseDetail(citem) {
if (citem.contentType == 10) {
uni.navigateTo({
url: '/pages/resource/microDetail?id=' + citem.objId
});
} else if (citem.contentType == 20 || citem.contentType == 21) {
uni.navigateTo({
url: '/pages/resource/courseDetail?id=' + citem.objId
});
}
},
toArticleDetail(item) {
uni.navigateTo({
url: '/pages/resource/articeDetail?id=' + item.articleId
});
},
toQaDetail(item) {
uni.navigateTo({
url: '/pages/resource/qaDetail?id=' + item.id
});
},
contentTypeFilter(value) {
let obj = {};
switch (value) {
case '10': {
obj.class = 'uc-course-type2';
obj.text = '录播';
break;
}
case '21': {
obj.class = 'uc-course-type2';
obj.text = '直播';
break;
}
case '20': {
obj.class = 'uc-course-type2';
obj.text = '录播';
break;
}
case '30': {
obj.class = 'uc-course-type2';
obj.text = '面授';
break;
}
case '90': {
obj.class = 'uc-course-type2';
obj.text = '混合';
break;
}
}
return obj;
},
delCollectItem(item) {
apiFavorites.del(item.id).then(res => {
if (res.status == 200) {
uni.showToast({
title:"取消收藏成功" ,
duration: 1000
});
setTimeout(()=>{
this.findData(true)
},1000)
} else {
uni.showToast({
title: "操作失败",
icon:'none'
});
}
})
}
}
};
</script>
<style lang="scss" scoped>
.rowbtn{
padding: 5px 8px 0px 8px;
height: 20px;
border-radius: 10upx;
}
.rowbtn-primary{
background-color: #ebf3fe;
}
.item-box{
padding: 15px;
}
.item-time{
margin-top: 14upx;
font-size: 13px;
color: #999999;
}
.item-bottom{
margin-top: 10rpx;
display: flex;
justify-content: space-between;
}
/deep/.filter .btn-box > uni-view {
border: solid 0.5px #ffb30f;
}
/deep/.filter .btn-box .submit {
background-color: #ffb30f;
}
/deep/.filter .btn-box > uni-view {
border: solid 0.5px #ffb30f;
}
/deep/.filter .btn-box .reset {
color: #ffb30f;
}
/deep/.filter .menu-box .box .labels .on {
border-color: #ffb30f;
background-color: #ffb30f;
}
/deep/.filter .menu-box .box .labels > uni-view {
width: 125px;
padding-left: 5px;
padding-right: 5px;
}
/deep/.sub-menu-list .sub-menu > .menu-name > .iconfont {
color: #ffb30f;
}
/deep/.sub-menu-list.alone .sub-menu {
border-bottom: 0;
}
/deep/.nav .first-menu.on {
color: #ffb30f;
}
/deep/.sub-menu-list.alone .sub-menu.on {
color: #ffb30f;
}
/deep/.u-tabs__wrapper__nav {
display: flex;
justify-content: space-around;
}
.textbtn {
background-color: #ffffff;
padding: 8px 10px;
color: #4f4f4f;
border-radius: 8upx;
font-size: 24upx;
}
.top-tab {
height: 50px;
// background: linear-gradient(to bottom, #6BA0FC, #6297FD);
display: flex;
justify-content: space-between;
line-height: 60px;
color: #373737;
.top-bar-center {
display: flex;
font-size: 30upx;
// margin-left: 40upx;
.top-bar-tab {
margin: 0upx 50upx;
}
.active {
border-bottom: 2px solid #588afc;
// color: #5282eb;
font-size: 35upx;
font-weight: bold;
}
}
.top-tab-left {
display: flex;
justify-content: space-around;
width: 100%;
text-align: center;
}
.top-tab-line {
width: 50px;
height: 3px;
background: #ffffff;
margin-top: -5px;
}
}
.input-search {
padding-right: 10px;
flex: 1;
// padding: 28upx 20upx;
.u-input {
background: #ffffff;
}
/deep/ .u-search{
border-radius: 8upx;
}
// /deep/.u-icon {
// span {
// font-size: 50upx;
// color: #588afc;
// }
// }
// /deep/.uni-input-placeholder{
// color: #588afc!important;
// }
}
.top-content-options{
height: 40px;
display: flex;
align-items: center;
line-height: 40px;
padding: 28upx 0upx 0upx 28upx;
.input-search {
flex: 1;
// margin-right: 50rpx;
// padding: 28upx 20upx;
.u-search {
background: #ffffff;
}
// /deep/.u-icon {
// span {
// font-size: 50upx;
// color: #588afc;
// }
// }
}
}
.course_box {
margin-top: 20upx;
// margin-bottom: 10px;
background-color: #ffffff;
padding: 19upx 28upx;
.course {
// display: flex;
// justify-content: flex-start;
.common {
padding: 4upx 20upx;
border-radius: 2px;
font-size: 24upx;
color: #fff;
margin-right: 20upx;
}
.uc-course-type1 {
background: #588afc;
}
.uc-course-type2 {
background: #ffb30f;
}
/deep/ .course-info {
display: flex;
uni-image{
border-radius:8px;
}
.course-title{
display: flex;
flex-direction: column;
justify-content: space-between;
height: 147upx;
margin-left: 10rpx;
padding-bottom: 10upx;
}
.course-content {
display: flex;
flex-direction: column;
justify-content: space-around;
margin-top: 40rpx;
font-size: 13px;
color: #999999;
}
}
}
}
.noCollect {
padding-top: 20rpx;
padding-bottom: 50rpx;
.nocollright{
float: left;
color: #666;
font-size: 24rpx;
line-height: 40rpx;
padding-left: 5rpx;
padding-bottom: 15rpx;
}
}
.article-center {
width: 90%;
margin-left: 5%;
margin-right: 5%;
}
.article {
background: #f8fbfd;
}
.article_one {
// padding-top: 10px;
margin-top: 20rpx;
background-color: #ffffff;
padding: 19upx 28upx;
.articla_tit {
line-height: 45rpx;
padding-bottom: 10rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 30rpx;
font-weight: bold;
}
.answertext{
display: -webkit-box;
overflow: hidden;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
word-break:break-all;
text-overflow: ellipsis;
}
.articla_text {
word-break:break-all;
font-size: 28rpx;
color: #454545;
display: -webkit-box;
text-overflow: ellipsis;
overflow: hidden;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
margin-bottom: 10rpx;
}
.artical_text_bottom {
margin-top: 10rpx;
display: flex;
justify-content: space-between;
// padding-bottom: 20rpx;
}
}
.qa {
padding: 19upx 30upx;
padding-top: 0;
margin-top: 20rpx;
//padding: 10px;
box-shadow: #f7f7f7 0px 6px 5px;
border-radius: 4px;
background: #ffffff;
// margin-top: 10px;
.qa-header {
height: 26px;
line-height: 50rpx;
display: flex;
justify-content: space-between;
.qa-user {
display: flex;
img {
height: 25px;
width: 25px;
margin-right: 5px;
}
}
}
.qa-body {
line-height: 40px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 30rpx;
font-weight: bold;
}
.qa-bottom {
word-break:break-all;
font-size: 14px;
color: #7f7f7f;
display: -webkit-box;
overflow: hidden;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
.qa-answers {
font-size: 28rpx;
color: #5b5b5b;
display: flex;
overflow: hidden;
line-height: 20upx;
width: 100%;
// height: 70upx;
margin: 10upx 0upx;
padding: 10upx 0;
}
.qa-text {
font-size: 24rpx;
color: #9d9d9d;
margin-right: 10px;
}
}
.details {
height: 127px;
border-bottom: 1px solid #e3e3e3;
}
.newest {
width: 60px;
height: 31px;
background: #ffffff;
font-size: 11px;
border-radius: 4px;
color: #505050;
text-align: center;
line-height: 31px;
margin-top: 2px;
margin-left: 9px;
}
.hottest {
background: #dfebf4;
color: #5ba2fc;
}
.big_top {
height: 37px;
}
.big_box_top {
display: flex;
height: 80upx;
padding: 30upx 0;
}
.big-box_center {
height: 173px;
margin-top: 9px;
display: flex;
justify-content: space-between;
flex-wrap: wrap;
}
.llef {
width: 168px;
height: 172px;
border-radius: 4px;
background: #ffffff;
box-shadow: #f1f6fe 0px 6px 5px;
}
.llef img {
width: 168px;
height: 96px;
}
</style>

465
pages/my/myQuestions.vue Normal file
View File

@@ -0,0 +1,465 @@
<template>
<!--我的问答-->
<view class="article">
<u-toast ref="articleToast"></u-toast>
<page-title :showBack="true">我的提问</page-title>
<view class="top-filter">
<view class="top-content">
<view class="top-content-options">
<view style="width: 100upx;">
<!-- <u-picker
:defaultIndex="[0]"
:show="statusSelectShow"
@cancel="statusSelectShow = false"
@confirm="chooseStatus"
:columns="statusArray"
keyName="name"
></u-picker> -->
<text class="textbtn" style="font-size: 26upx;" @click="statusSelectShow = !statusSelectShow">状态</text>
</view>
<view class="center" >
<!-- @search这个方法根本没有执行,没有触发条件,在搜索框回车时只是调用了onload里面的请求 -->
<!-- 所以不知道在哪个位置改变copyKeyWord的值进行高亮显示-->
<u-search
:clearabled="true"
@search="copyKeyWord=qaList.keyWord;findData(true);"
placeholder="输入搜索关键词"
v-model="qaList.keyWord"
:showAction="false"
@clear="copyKeyWord='';findData(true)"
shape="square"
bgColor="#ffffff"
></u-search>
</view>
<view style="width: 70upx;">
<view class="textbtn" @click="toAddQa()"><u-icon name="plus" color="#2979ff" size="18"></u-icon></view>
</view>
</view>
</view>
<!-- <view class="top-filter-result" v-if="hasSearch">本次共搜索到X条记录</view> -->
</view>
<view class="sea-show" v-show="statusSelectShow">
<text @click="chooseStatus(null)" :class="[qaList.isResolve == null?'sea-active':'','sea-index' ]">全部</text>
<text @click="chooseStatus(true)" :class="[qaList.isResolve == true?'sea-active':'','sea-index' ]">已解决</text>
<text @click="chooseStatus(false)" :class="[qaList.isResolve == false?'sea-active':'','sea-index' ]">待解决</text>
</view>
<!-- 问题内容 -->
<view class="uni-list">
<view class="artical-box" v-for="(item, idx) of qaList.list" :key="idx">
<!--我提问的不需要显示人员信息-->
<!-- <view class="authors">
<img claass="authors-img" style="vertical-align:middle;margin-right: 30rpx;" :src="item.avatar" />
<text class="authors-title">
{{ item.name }}
<text class="title-one">{{ item.orgInfo }}</text>
</text>
</view> -->
<view @click="toDetail(item)">
<view class="artical-box-top">
<view style="" class="artical-tit">
<text class="qa-basic qa-solve" v-if="item.isResolve">[已解决]</text>
<text class="qa-basic qa-unSolve" v-else >[待解决]</text>
{{item.title}}
</view>
</view>
<view class="articl-box-cont">
<view v-html="highlightedFilter(item.content)"></view>
</view>
<view class="qa-answers" v-if="item.isResolve">
<view class="qa-tit" style="">
<text style="color: #FFB30F;" >最佳回答</text> {{ item.bestAnswer }}
</view>
</view>
</view>
<view style="display: flex;justify-content: space-between;margin-top: 10upx;">
<view class="createTime">
{{item.sysCreateTime}}
</view>
<view style="display: flex;">
<view class="rowbtn rowbtn-primary">
<u-icon name="edit-pen" color="#3E7FFF" labelColor="#3E7FFF" @click="toEdit(item)" label="编辑" size="16" labelSize="12"></u-icon>
</view>
<view class="rowbtn rowbtn-info" style="margin-left: 20px;">
<u-icon @click="del(item)" color="#767676" labelColor="#767676" name="trash" label="删除" size="16" labelSize="12"></u-icon>
</view>
<!-- <u-icon name="more-dot-fill" @click="setEditId(item)" size="16" labelSize="16"></u-icon> -->
</view>
</view>
<!-- <view class="article_action">
<interact-bar :comments="false" :answers="true" :data="item"></interact-bar>
<view class="article_btn">
<u-icon name="edit-pen" @click="toEdit(item)" label="编辑"></u-icon>
<u-icon style="margin-left: 20px;" @click="del(item)" name="trash" label="删除"></u-icon>
</view>
</view> -->
</view>
</view>
<uni-load-more :status="loadStatus"></uni-load-more>
</view>
</template>
<script>
import apiQa from '@/api/modules/qa.js';
import apiUser from '@/api/system/user.js';
import { mapGetters } from 'vuex';
// 未解决问题
// Myanswers中显示回复时间和提问时间存在问题
// Myanswers和myArticles中初始加载不显示头像和作者名但是下拉加载之后就会出现
export default {
data() {
return {
statusArray: [
[
{
name: '全部',
value: null
},
{
name: '待解决',
value: false
},
{
name: '已解决',
value: true
}
]
],
qaList: {
pageIndex: 1,
pageSize: 20,
isResolve: null,
count: 0,
list: []
},
statusSelectShow: false,
statusBtn: '全部',
loadStatus: 'more', //more,loading,noMore, 应该划分出三个
copyKeyWord: ''
};
},
computed: {
...mapGetters(['userInfo'])
},
methods: {
findData(flag) {
//是否重置列表
if (flag) {
this.qaList.list = [];
}
uni.showLoading({ title: '加载中...' });
//查询条件
let params = {
pageIndex: this.qaList.pageIndex,
pageSize: this.qaList.pageSize,
isResolve: this.qaList.isResolve
};
if (this.qaList.keyWord) {
params.keyWord = this.qaList.keyWord;
}
apiQa.queryQuestion(params).then(async rs => {
if (rs.status == 200) {
if (rs.result.list.length != 0) {
this.qaList.count = rs.result.count;
let userIds = [];
rs.result.list.forEach(item => {
this.qaList.list.push(item);
userIds.push(item.sysCreateAid);
});
//await this.loadUserInfos(rs.result.list, userIds);
}
}
uni.hideLoading();
});
},
loadUserInfos(list, userIds) {
const noReapetIds = [...new Set(userIds)];
apiUser.getByIds(noReapetIds).then(res => {
if (res.status == 200) {
list.forEach(item => {
res.result.some(author => {
if (author.aid == item.sysCreateAid) {
let { aid, avatar, name, orgInfo, code } = author;
if (!avatar) {
avatar = this.$config.fileUrl + avatar;
}
item.name = name;
item.aid = aid;
item.orgInfo = orgInfo;
item.code = code;
item.avatar = avatar;
return true;
}
return false;
});
});
} else {
uni.showToast({
title: '获取数据失败',
icon: 'none'
});
}
//原本想用async await等数据请求完成后使用hideLoading,但是页面渲染需要时间关闭太早了有考虑用nexeTick()
setTimeout(function() {
uni.hideLoading();
}, 1000);
});
},
chooseStatus(e) {
// this.statusSelectShow = false;
// this.statusBtn = e.value[0].name;
this.qaList.isResolve = e;
this.findData(true);
},
toAddQa() {
uni.navigateTo({
url: '/pages/plus/addQuestion'
});
},
toDetail(item) {
uni.navigateTo({
url: '/pages/resource/qaDetail?id=' + item.id
});
},
highlightedFilter(value) {
if (value.indexOf(this.copyKeyWord) !== -1 && this.copyKeyWord !== '') {
return value.replace(this.copyKeyWord,`<span class='highlighted'>${this.copyKeyWord}</span>`);
}else{
return value
}
},
del(item){
const $this=this
uni.showModal({
title: '提示',
content: '您确定要删除此提问吗?',
success: function (res) {
if (res.confirm) {
//$this.del();
apiQa.del(item.id).then(res=>{
if(res.status=200){
$this.$refs.articleToast.show({message:'删除成功',type:'success'});
setTimeout(()=>{
$this.findData(true)
},1000)
// $this.findData(true)
// let pages =getCurrentPages();
// const prevPage=pages[pages.length-2];
// if(!prevPage){
// uni.switchTab({
// url:'/pages/index/index'
// })
// }else{
// uni.navigateBack();
// }
}else{
$this.$refs.articleToast.show({message:'删除失败,请稍后再试',type:'error'});
}
})
} else if (res.cancel) {
}
}
});
},
toEdit(item){
uni.navigateTo({
url:'/pages/plus/editQuestion?value='+JSON.stringify(item)
})
},
},
onLoad: function(options) {
this.findData(true);
},
onPullDownRefresh() {
this.onReachBottom();
},
async onReachBottom() {
if (this.qaList.list.length < this.qaList.count) {
this.loadStatus = 'loading'; //more,loading,noMore
this.qaList.pageIndex++;
await this.findData(false);
this.loadStatus = 'more';
} else {
this.loadStatus = 'noMore';
}
}
};
</script>
<style scoped lang="scss">
.rowbtn{
padding: 5px 8px 0px 8px;
height: 20px;
border-radius: 10upx;
}
.rowbtn-primary{
background-color: #ebf3fe;
}
.rowbtn-info{
background-color: #f7f7f7;
}
.createTime{
color:#999;
font-size: 24upx;
line-height: 48upx;
}
.sea-show{
padding: 20rpx;
.sea-active{
border: 1rpx solid #679cfc !important;
color: #679cfc;
}
.sea-index{
font-size: 26rpx;
padding: 6rpx 16rpx;
border: 1rpx solid #ccc;
border-radius: 20rpx;
margin-right: 16rpx;
background-color: #fff;
}
}
.qa-tit{
word-break:break-all;
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
-webkit-box-orient: vertical;
display: -webkit-box;-webkit-line-clamp: 2;
line-height: 35rpx;
overflow: hidden;text-overflow: ellipsis;
font-size: 28upx;
}
.title-one {
font-size: 24rpx;
color: #666666;
}
.authors {
font-size: 30rpx;
color: #444444;
.authors-title {
padding-bottom: 30rpx;
}
}
.qa-answers {
font-size: 28upx;
color: #5b5b5b;
display: flex;
overflow: hidden;
line-height: 20upx;
width: 100%;
// height: 70upx;
margin: 10upx 0upx;
padding: 10upx 0;
}
.top-filter {
.top-content {
// padding: 5px 5px;
.top-content-options {
padding:20upx 30upx 10upx 30upx ;
height: 40px;
line-height: 40px;
margin-bottom: 10upx;
display: flex;
justify-content: space-between;
align-items: center;
.textbtn {
background-color: #ffffff;
color: #4f4f4f;
border-radius: 8upx;
font-size: 24upx;
}
.center{
flex:1;
margin: 0upx 20upx 0upx 12upx;
.u-input {
background: #ffffff;
}
}
}
}
.top-filter-result {
padding: 5px 10px;
font-size: 24upx;
color: #747474;
}
}
.uni-list {
// margin-top: 10upx;
.artical-box {
margin-bottom: 20upx;
background-color: #fff;
color: #151515;
padding: 20upx 30upx;
padding-top: 10upx;
&:last-of-type {
margin-bottom: 0;
}
.artical-box-top {
// font-weight: 500;
// // font-size: 30rpx;
font-weight: bold;
line-height: 55rpx;
.artical-tit{
word-break:break-all;
overflow: hidden;
text-overflow: ellipsis;
-webkit-box-orient: vertical;
display: -webkit-box;-webkit-line-clamp: 2;
font-size: 30upx;
}
}
.articl-box-cont {
font-size: 28rpx;
line-height: 44rpx;
color: #454545;
margin-top: 12rpx;
overflow: hidden;
text-overflow: ellipsis;
-webkit-box-orient: vertical;
display: -webkit-box;-webkit-line-clamp: 1;
word-break:break-all;
}
.articl-box-time {
font-size: 24rpx;
color: #999999;
padding: 20rpx 0;
border-bottom: 1rpx solid #eee;
}
.article_action{
display: flex;
justify-content: space-between;
align-items: center;
/deep/ .article_btn{
display: flex;
justify-content: space-between;
align-items: center;
.u-icon__label{
span{
font-size: 28rpx;
}
}
}
}
/* .articl-box-cont :nth-child(3) {
display: flex;
justify-content: space-between;
} */
}
}
.textbtn {
background-color: #ffffff;
padding: 9px 10px;
color: #666;
border-radius: 8upx;
font-size: 28upx;
}
.highlighted {
color: #588afc;
}
</style>

940
pages/my/myShares.vue Normal file
View File

@@ -0,0 +1,940 @@
<template>
<view>
<page-title :showBack="true">我的分享</page-title>
<view class="top-tab">
<view class="top-bar-center">
<view class="top-bar-tab" @click="clicktab(1)" :class="{ active: conType == 1 }">课程</view>
<view class="top-bar-tab" @click="clicktab(2)" :class="{ active: conType == 2 }">文章</view>
<view class="top-bar-tab" @click="clicktab(4)" :class="{ active: conType == 4 }">问答</view>
</view>
</view>
<view class="top-content-options">
<!-- 是否已查看 -->
<view style="margin-right: 15rpx;">
<!-- <u-picker :show="statusSelectShow" @cancel="statusSelectShow = false" @confirm="chooseStatus" :columns="selectData" keyName="label"></u-picker> -->
<text class="textbtn" @click="statusSelectShow = !statusSelectShow">状态</text>
</view>
<!--课程-->
<view class="input-search">
<u-search
v-model="query.keyword"
placeholder="标题搜索"
@search="findData(true)"
@clear="findData(true)"
:clearabled="true"
:showAction="false"
shape="square"
bgColor="#ffffff"
>
<!-- <template slot="suffix">
<u-icon @click="findData(true)" name="search"></u-icon>
</template> -->
</u-search>
</view>
</view>
<view class="sea-show" v-show="statusSelectShow">
<text @click="chooseStatus(null)" :class="[isRead == null?'sea-active':'','sea-index' ]">全部</text>
<text @click="chooseStatus(true)" :class="[isRead == true?'sea-active':'','sea-index' ]">已查看</text>
<text @click="chooseStatus(false)" :class="[isRead == false?'sea-active':'','sea-index' ]">未查看</text>
</view>
<view v-if="conType == 1">
<view v-for="(item, idx) in courseList" :key="idx" class="course_box">
<view class="course" @click="toCourseDetail(item)">
<view class="course-img"><course-image :course="item" width="262upx" height="147upx"></course-image></view>
<view class="course-content">
<view class="coursetit-sl"><span class="common" :class="contentTypeFilter(item.contentType).class">{{ contentTypeFilter(item.contentType).text }}</span><span style="font-weight: bold; margin-top: 10rpx;" v-html="$keywordActiveShow(item.title,query.keyword)"></span></view>
<view class="course-con_source">分享日期{{ item.time }}</view>
<view class="course-author">
我分享给{{ item.toAname }}
</view>
</view>
</view>
<view class="rowbtn-right">
<view class="rowbtn rowbtn-info" v-if="!item.isRead">
<!-- ../../static/images/icon/noread.png -->
<u-icon name="eye-off" color="#767676" labelColor="#767676" label="未查看" size="16" labelSize="12"></u-icon>
</view>
<view class="rowbtn rowbtn-info" v-else>
<!-- ../../static/images/icon/isread.png -->
<u-icon name="eye-fill" color="#767676" labelColor="#767676" label="已查看" size="16" labelSize="12"></u-icon>
</view>
<view class="rowbtn rowbtn-primary" v-if="!item.isRead" @click="withdraw(item)">
<!-- ../../static/images/icon/withdraw.png -->
<u-icon name="reload" color="#3E7FFF" labelColor="#3E7FFF" label="撤回" size="16" labelSize="12"></u-icon>
</view>
</view>
<!-- <text class="isread" v-if="!item.isRead"> -->
<!-- <image style="height: 26rpx;" src="../../static/images/icon/noread.png" mode=""></image>
未查看</text> -->
<!-- </text> -->
<!-- <text class="isread" v-else>
<image style="margin-top: -5rpx;" src="../../static/images/icon/isread.png" mode=""></image>
已查看</text> -->
<!-- <text class="with" @click="withdraw(item)" v-if="!item.isRead" >
<image style="margin-left: 15rpx;" src="../../static/images/icon/withdraw.png" mode=""></image>
撤回</text> -->
<!-- <view><interact-bar :data="item" :shares="false" :views="false"></interact-bar></view> -->
</view>
</view>
<view v-if="conType == 2">
<view class="article_one" v-for="(item, idx) in articleList" :key="idx" >
<view>
<!-- <view class="art_type">
<text v-if="item.isRead">
[已查看]
</text>
<text v-else>
[未查看]
</text>
</view> -->
<view @click="toArticleDetail(item)" class="articla_tit" >
<text v-if="item.isRead" style="color:#3e7fff">[已查看]</text>
<text v-else style="color:#FF3E3E">[未查看]</text>
<text v-html="$keywordActiveShow(item.title,query.keyword)"></text>
</view>
<text class="articla_text" @click="toArticleDetail(item)" v-html="$keywordActiveShow(item.summary,query.keyword)"></text>
<author-info :avatar="item.avatar" :name="item.sysCreateBy" :info="item.orgInfo" :sex="item.sex"></author-info>
<view class="artical_text_bottom">
<view class="" style="margin-top: 18upx;">
<text style="font-size: 26rpx;color: #9d9d9d;">{{item.time}}</text>
<text style="font-size: 26rpx;color: #666666;margin-right: 35upx;">我分享给{{item.toAname}}</text>
</view>
<view class="rowbtn-right">
<view class="rowbtn rowbtn-primary" v-if="!item.isRead" @click="withdraw(item)">
<!-- ../../static/images/icon/withdraw.png -->
<u-icon name="reload" color="#3E7FFF" labelColor="#3E7FFF" label="撤回" size="16" labelSize="12"></u-icon>
</view>
</view>
</view>
<!-- <view style="margin-top: 8px;"><interact-bar :data="item" :shares="false"></interact-bar></view> -->
<!-- <text class="isread" v-if="item.isRead">
<image style="height: 26rpx;" src="../../static/images/icon/noread.png" mode=""></image>
未查看</text>
<text class="isread" v-else>
<image style="margin-top: -5rpx;" src="../../static/images/icon/isread.png" mode=""></image>
已查看</text> -->
<!-- <text class="with" @click="withdraw(item)" v-if="!item.isRead">
<image style="margin-left: 15rpx;" src="../../static/images/icon/withdraw.png" mode=""></image>
撤回</text> -->
</view>
</view>
</view>
<view v-if="conType == 4">
<view v-for="(item, idx) in qaList" :key="idx" class="qa" >
<view class="qa-body" @click="toQaDetail(item.question)">
<text v-if="item.question.isResolve" style="color:#08A890">[已解决]</text>
<text v-else style="color:#588afc">
[待解决]
</text>
<text v-html="$keywordActiveShow(item.question.title,query.keyword)"></text>
</view>
<view class="qa-bottom" @click="toQaDetail(item.question)" v-html="$keywordActiveShow(item.question.content,query.keyword)"></view>
<author-info :avatar="item.avatar" :name="item.question.sysCreateBy" :info="item.orgInfo" :sex="item.sex"></author-info>
<view class="qa-answers" style=" " v-if="item.question.isResolve">
<!-- <text></text> -->
<!-- <view class="answer-one">
</view> -->
<view class="answer-two" @click="toQaDetail(item.question)" style="word-break:break-all;
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
-webkit-box-orient: vertical;
display: -webkit-box;-webkit-line-clamp: 2;
line-height: 35rpx;
overflow: hidden;text-overflow: ellipsis;
font-size: 32rpx;
">
<text style="color: #FFB30F;">最佳回答:</text>{{ item.question.bestAnswer }}
</view>
<!-- <text class="answers_text"></text> -->
</view>
<text @click="toQaDetail(item.question)" class="qa-text">{{item.time}}</text>
<text style="font-size: 26rpx;color: #666666" @click="toQaDetail(item.question)">我分享给{{item.toAname}}</text>
<!-- <view class="qa-bar"><interact-bar :data="item.question" :praises="false" :views="false"></interact-bar></view> -->
<!-- <view class="">
<text class="isread" v-if="item.isRead">
<image style="height: 26rpx;" src="../../static/images/icon/noread.png" mode=""></image>
已查看</text>
<text class="isread" v-else>
<image style="margin-top: -5rpx;" src="../../static/images/icon/isread.png" mode=""></image>
未查看</text>
<text class="with" @click="withdraw(item)" v-if="!item.isRead">
<image style="margin-left: 15rpx;" src="../../static/images/icon/withdraw.png" mode=""></image>
撤回</text>
</view> -->
<view class="rowbtn-right">
<view class="rowbtn rowbtn-info" v-if="item.isRead">
<u-icon name="eye-off" color="#767676" labelColor="#767676" label="已查看" size="16" labelSize="12"></u-icon>
</view>
<view class="rowbtn rowbtn-info" v-else>
<u-icon name="eye-fill" color="#767676" labelColor="#767676" label="未查看" size="16" labelSize="12"></u-icon>
</view>
<view class="rowbtn rowbtn-primary" v-if="!item.isRead" @click="withdraw(item)">
<u-icon name="reload" color="#3E7FFF" labelColor="#3E7FFF" label="撤回" size="16" labelSize="12"></u-icon>
</view>
</view>
</view>
</view>
<view v-show="count>query.pageSize"><uni-load-more :status="loadStatus"></uni-load-more></view>
</view>
</template>
<script>
import { mapState, mapActions } from 'vuex';
import apiShares from '@/api/modules/shares.js';
import apiUser from '@/api/system/user.js';
export default {
computed: mapState(['resourceTab']),
data() {
return {
isRead:null,
statusBtn: '全部',
selectData: [
[
{ label: '全部', value: null },
{ label: '已查看', value: true },
{ label: '未查看', value: false },
]
],
statusSelectShow: false,
conType: 1,
query:{
pageIndex: 1,
pageSize: 4,
keyword:'',
isRead:null
},
courseList:[],
articleList:[],
qaList:[],
count:0,
loadStatus: 'more', //more,loading,noMore, 应该划分出三个
};
},
onLoad: function(options) {
this.findData(true);
},
onPullDownRefresh() {
this.onReachBottom();
},
async onReachBottom() {
if(this.conType==1){
if(this.courseList.length<this.count){
this.loadStatus='loading';
this.query.pageIndex++;
await this.findData(false);
this.loadStatus='more';
}else{
this.loadStatus='noMore';
}
}
if(this.conType==2){
if(this.articleList.length<this.count){
this.loadStatus='loading';
this.query.pageIndex++;
await this.findData(false);
this.loadStatus='more';
}else{
this.loadStatus='noMore';
}
}
if(this.conType==4){
if(this.qaList.length<this.count){
this.loadStatus='loading';
this.query.pageIndex++;
await this.findData(false);
this.loadStatus='more';
}else{
this.loadStatus='noMore';
}
}
},
methods: {
//点击切换类别时请求数据
clicktab(val) {
this.conType=val;
this.query.pageIndex=1;
this.query.keyword='';
this.isRead = null;
this.query.isRead = null;
this.statusBtn = '全部'
this.findData(true);
},
//查找数据
findData(flag) {
let $this = this;
//是否重置列表
if (flag) {
if(this.conType==1){
this.courseList=[]
}
if(this.conType==2){
this.articleList=[]
}
if(this.conType==4){
this.qaList=[]
}
}
this.query.isRead = this.isRead;
//生成查询条件
uni.showLoading({ title: '加载中...' });
//查询条件
const conList = {
1: 'mycourselist',
2: 'myarticlelist',
4: 'myqalist'
};
// console.log(this.query,'dydyyy')
apiShares[conList[this.conType]](this.query).then(rs => {
if (rs.status == 200) {
this.count=rs.result.count
if(this.conType==1){
rs.result.list.forEach(item=>{
$this.courseList.push(item)
})
}
if(this.conType==2){
let userIds = [];
rs.result.list.forEach(item=>{
item.avatar=''
item.orgInfo='';
item.sex=null;
userIds.push(item.sysCreateAid);
$this.articleList.push(item)
})
$this.loadUserInfos(rs.result.list,userIds);
}
if(this.conType==4){
let userIds = [];
rs.result.list.forEach(item=>{
item.avatar=''
item.orgInfo='';
item.sex=null;
userIds.push(item.question.sysCreateAid);
$this.qaList.push(item)
})
$this.loadUserInfos(rs.result.list,userIds);
}
}else{
uni.showToast({
title: "获取数据失败",
icon:'none'
});
}
});
setTimeout(function() {
uni.hideLoading();
}, 100);
},
withdraw(item){
apiShares.deleteshares(item.id).then(res=>{
if(res.status == 200){
uni.showToast({
icon:'success',
title:"撤回成功"
})
setTimeout(()=>{
this.findData(true);
},1000)
// console.log('撤回成功')
// setTimeout(function() {
// uni.showToast()
// }, 1000);
// if (this.conType == 1) {
// this.findData(true);
// }
// if (this.conType == 2) {
// this.findData(true);
// }
// if (this.conType == 4) {
// this.findData(true);
// }
}else{
uni.showToast({
icon:'none',
title:"撤回失败"
})
}
})
},
loadUserInfos(list, userIds) {
let $this = this;
const noReapetIds = [...new Set(userIds)];
apiUser.getByIds(noReapetIds).then(res => {
if (res.status == 200) {
if(this.conType==2){
list.forEach(item => {
res.result.some(author => {
if (author.aid == item.sysCreateAid) {
if (author.avatar != '') {
item.avatar = $this.$config.fileUrl + author.avatar;
//实际上根本没有拿到fileUrl
}else{
item.avatar=''
}
item.sex = author.sex
item.orgInfo = author.orgInfo;
return true;
}
return false;
});
});
}else{
list.forEach(item => {
res.result.some(author => {
if (author.aid == item.question.sysCreateAid) {
if (author.avatar != '') {
item.avatar = $this.$config.fileUrl + author.avatar;
//实际上根本没有拿到fileUrl
}else{
item.avatar=''
}
item.sex = author.sex
item.orgInfo = author.orgInfo;
return true;
}
return false;
});
});
}
}
});
},
toCourseDetail(citem) {
if (citem.contentType == 10) {
uni.navigateTo({
url: '/pages/resource/microDetail?id=' + citem.objId
});
} else if (citem.contentType == 20 || citem.contentType == 21) {
uni.navigateTo({
url: '/pages/resource/courseDetail?id=' + citem.objId
});
}
},
toArticleDetail(item) {
uni.navigateTo({
url: '/pages/resource/articeDetail?id=' + item.objId
});
},
toQaDetail(item) {
uni.navigateTo({
url: '/pages/resource/qaDetail?id=' + item.id
});
},
chooseStatus(e) {
// this.statusSelectShow = false;
// this.statusBtn = e.value[0].label;
this.isRead = e;
//console.log(this.isRead)
this.findData(true);
},
contentTypeFilter(value) {
let obj = {};
switch (value) {
case '10': {
obj.class = 'uc-course-type2';
obj.text = '录播';
break;
}
case '21': {
obj.class = 'uc-course-type2';
obj.text = '直播';
break;
}
case '20': {
obj.class = 'uc-course-type2';
obj.text = '录播';
break;
}
case '30': {
obj.class = 'uc-course-type2';
obj.text = '面授';
break;
}
case '90': {
obj.class = 'uc-course-type2';
obj.text = '混合';
break;
}
}
return obj;
},
}
}
</script>
<style lang="scss" scoped>
.rowbtn-right{
margin-top: 10upx;
display: flex;
justify-content: flex-end;
}
.rowbtn{
padding: 5px 8px 0px 8px;
height: 20px;
border-radius: 10upx;
margin-left: 20upx;
}
.rowbtn-primary{
background-color: #ebf3fe;
}
.rowbtn-info{
background-color: #f7f7f7;
}
.sea-show{
padding: 20rpx;
padding-left: 28upx;
.sea-active{
border: 1rpx solid #679cfc !important;
color: #679cfc;
}
.sea-index{
font-size: 26rpx;
padding: 6rpx 16rpx;
border: 1rpx solid #ccc;
border-radius: 20rpx;
margin-right: 16rpx;
background-color: #fff;
}
}
.coursetit-sl{
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
word-break:break-all;
-webkit-line-clamp: 1;
line-height: 45rpx;
-webkit-box-orient: vertical;
}
.with{
color: #666;
font-size: 24rpx;
line-height: 35rpx;
image{
width: 26rpx;
height: 26rpx;
margin-right: 10rpx;
padding-top: 10rpx;
vertical-align: top;
}
}
.isread{
color: #666;
font-size: 24rpx;
line-height: 35rpx;
image{
width: 30rpx;
height: 30rpx;
margin-right: 10rpx;
padding-top: 10rpx;
vertical-align: top;
}
}
.textbtn {
background-color: #ffffff;
padding: 8px 10px;
color: #4f4f4f;
border-radius: 8upx;
font-size: 28upx;
}
.top-content-options{
height: 40px;
display: flex;
align-items: center;
line-height: 40px;
padding: 28upx 0upx 0upx 28upx;
.input-search {
padding-right: 10px;
flex: 1;
// padding: 28upx 20upx;
.u-input {
background: #ffffff;
}
}
}
/deep/.filter .btn-box > uni-view {
border: solid 0.5px #ffb30f;
}
/deep/.filter .btn-box .submit {
background-color: #ffb30f;
}
/deep/.filter .btn-box > uni-view {
border: solid 0.5px #ffb30f;
}
/deep/.filter .btn-box .reset {
color: #ffb30f;
}
/deep/.filter .menu-box .box .labels .on {
border-color: #ffb30f;
background-color: #ffb30f;
}
/deep/.filter .menu-box .box .labels > uni-view {
width: 125px;
padding-left: 5px;
padding-right: 5px;
}
/deep/.sub-menu-list .sub-menu > .menu-name > .iconfont {
color: #ffb30f;
}
/deep/.sub-menu-list.alone .sub-menu {
border-bottom: 0;
}
/deep/.nav .first-menu.on {
color: #ffb30f;
}
/deep/.sub-menu-list.alone .sub-menu.on {
color: #ffb30f;
}
/deep/.u-tabs__wrapper__nav {
display: flex;
justify-content: space-around;
}
.top-tab {
height: 50px;
// background: linear-gradient(to bottom, #6BA0FC, #6297FD);
display: flex;
justify-content: space-between;
line-height: 50px;
color: #373737;
.top-bar-center {
display: flex;
font-size: 30upx;
// margin-left: 40upx;
.top-bar-tab {
margin: 0upx 50upx;
}
.active {
border-bottom: 2px solid #588afc;
// color: #5282eb;
font-size: 35upx;
}
}
.top-tab-left {
display: flex;
justify-content: space-around;
width: 100%;
text-align: center;
}
.top-tab-line {
width: 50px;
height: 3px;
background: #ffffff;
margin-top: -5px;
}
}
.input-search{
.u-input{
background: #ffffff;
}
// /deep/.u-icon{
// span{
// font-size: 50upx;
// color: #588afc;
// }
// }
// /deep/.uni-input-placeholder{
// color: #588afc!important;
// }
}
.course_box {
// margin-bottom: 10px;
margin-top: 19rpx;
background-color: #ffffff;
padding: 19upx 40upx;
.course {
display: flex;
justify-content: flex-start;
/deep/ .course-img {
display: flex;
justify-content: space-around;
width: 120px;
height: 70px;
margin-right: 20upx;
margin-top: 9rpx;
margin-left: 10rpx;
margin-bottom: 20rpx;
uni-image{
border-radius:8px;
}
}
.course-content {
display: flex;
flex-direction: column;
justify-content: space-between;
margin-left: 10upx;
.course-con_source{
font-size: 28upx;
color: #444444;
margin-top: 10rpx;
padding-bottom: 10rpx;
}
.course-author {
font-size: 26upx;
color: #666;
}
.common{
padding: 4upx 15upx;
border-radius: 2px;
font-size: 24upx;
color: #fff;
margin-right: 20upx;
}
.uc-course-type1{
background: #588afc;
}
.uc-course-type2{
background: #ffb30f;
}
}
}
}
.article-center {
width: 90%;
margin-left: 5%;
margin-right: 5%;
}
.article {
background: #f8fbfd;
}
.art_type{
// float: left;
}
.articla_tit {
padding-bottom: 15rpx;
overflow: hidden;
font-weight: bold;
text-overflow:ellipsis;
white-space: nowrap;
font-size: 30rpx;
// float: left;
}
.articla_text {
word-break:break-all;
font-size: 28rpx;
color: #454545;
display: -webkit-box;
line-height: 40rpx;
overflow: hidden;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
margin-bottom: 10rpx;
}
.article_one {
// padding-top: 10px;
margin-top: 20rpx;
background-color: #fff;
padding: 19upx 38upx;
.answers_text {
// font-size: 14px;
// color: #797979;
// display: -webkit-box;
overflow: hidden;
width: 80%;
// line-height: 25upx;
// -webkit-box-orient: vertical;
// -webkit-line-clamp: 2;
}
.artical_text_bottom{
display: flex;
justify-content: space-between;
margin-top: 10rpx;
text{
margin-right: 10px;
}
}
}
.qa {
// margin-top: 19rpx;
// padding: 10px;
padding: 19upx 39upx;
box-shadow: #f7f7f7 0px 6px 5px;
border-radius: 4px;
background: #ffffff;
margin-top: 20upx;
padding-bottom: 15rpx;
padding-top: 0;
.qa-header {
height: 26px;
line-height: 25px;
display: flex;
justify-content: space-between;
.qa-user {
display: flex;
img {
height: 25px;
width: 25px;
margin-right: 5px;
}
}
}
.qa-body {
line-height: 40px;
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
font-size: 30rpx;
font-weight: bold;
}
.qa-bottom {
font-size: 30rpx;
color: #454545;
display: -webkit-box;
overflow: hidden;
line-height: 45rpx;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
margin-bottom: 4rpx;
word-break:break-all;
}
.qa-answers {
display: flex;
overflow: hidden;
line-height: 20upx;
width: 100%;
// height: 70upx;
margin: 10upx 0upx;
padding: 10upx 0;
font-size: 30rpx;
color: #5b5b5b;
answer-one{
width: 50%;
}
answer-two{
flex: 1;
word-break:break-all;
overflow: hidden;
// display: -webkit-box;
// -webkit-box-orient: vertical;
// -webkit-line-clamp: 2;
display:inline-block;/*转为行内块元素*/
white-space: pre-wrap;/*处理元素内的空白,保留空白符序列,但是正常地进行换行*/
word-wrap: break-word;
}
}
.qa-text{
font-size: 26rpx;
color: #9d9d9d;
margin-right: 10px;
}
}
.details {
height: 127px;
border-bottom: 1px solid #e3e3e3;
}
.newest {
width: 60px;
height: 31px;
background: #ffffff;
font-size: 11px;
border-radius: 4px;
color: #505050;
text-align: center;
line-height: 31px;
margin-top: 2px;
margin-left: 9px;
}
.hottest {
background: #dfebf4;
color: #5ba2fc;
}
.big_top {
height: 37px;
}
.big_box_top {
display: flex;
height: 80upx;
padding: 30upx 0;
}
.big-box_center {
height: 173px;
margin-top: 9px;
display: flex;
justify-content: space-between;
flex-wrap: wrap;
}
.llef {
width: 168px;
height: 172px;
border-radius: 4px;
background: #ffffff;
box-shadow: #f1f6fe 0px 6px 5px;
}
.llef img {
width: 168px;
height: 96px;
}
</style>

251
pages/my/setting.vue Normal file
View File

@@ -0,0 +1,251 @@
<template>
<view>
<page-title :showBack="true" backUrl="/pages/my/index">个人设置</page-title>
<view class="settingDetail">
<view class="setInfoItem">
<view class="u-demo-block">
<text class="u-demo-block__title">基础信息</text>
<view class="u-demo-block__content">
<u-cell-group >
<u-cell title="头像" :isLink="true" @click="toRouter('headimg')">
<u-avatar v-if="userInfoObj.account.avatar!=''" slot="value" shape="circle" size="58pt" :src="userInfoObj.account.avatar"></u-avatar>
<!-- <text>{{userInfoObj.name}}</text> -->
</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.account.email"></u-cell>
<!-- <u-cell title="身份证" v-model="userInfoObj.idNumber"></u-cell> -->
<u-cell title="手机号" v-model="userInfoObj.account.mobile"></u-cell>
<u-cell title="生日" v-model="userInfoObj.birthday"></u-cell>
<!-- <u-cell @click="toRouter('nickName')" title="昵称" :isLink="true" arrow-direction="left" v-model="userInfoObj.account.nickName"></u-cell> -->
<!-- <u-cell @click="toRouter('newBirt')" title="生日" :isLink="true" arrow-direction="left" v-model="userInfoObj.birthday"></u-cell> -->
<!-- <u-cell @click="toRouter('indLabels')" title="个人标签" :isLink="true" arrow-direction="left" v-model="userInfoObj.rank"></u-cell> -->
</u-cell-group>
</view>
</view>
</view>
<!-- 企业信息 -->
<view class="setInfoItem">
<view class="u-demo-block">
<text class="u-demo-block__title">企业信息</text>
<view class="u-demo-block__content">
<u-cell-group>
<!-- 内容为姓名的话代表没有对应字段 -->
<!-- 语言设置和位置设置个人觉得应该有进行选择的功能 -->
<!-- 个人标签的字段也存在问题rank是职级标签没有对应字段 -->
<!-- <u-cell title="企业名称" v-model="userInfoObj.companyName"></u-cell>
<u-cell title="所属区域" v-model="userInfoObj.name"></u-cell> -->
<u-cell title="组织部门" v-model="userInfoObj.departName"></u-cell>
<u-cell title="岗位" v-model="userInfoObj.duty"></u-cell>
</u-cell-group>
</view>
</view>
</view>
<!-- 其他设置 -->
<view class="setInfoItem">
<view class="u-demo-block">
<text class="u-demo-block__title">其他信息</text>
<view class="u-demo-block__content">
<u-cell-group>
<!-- <u-cell title="语言设置" v-model="userInfoObj.name"></u-cell>
<u-cell title="位置" v-model="userInfoObj.name"></u-cell> -->
<u-cell @click="toRouter('next')" title="修改密码" :isLink="true" arrow-direction="left" v-model="userInfoObj.account.passValue"></u-cell>
</u-cell-group>
</view>
</view>
</view>
<u-button type="error" text="退 出" @click="logout()"></u-button>
</view>
<u-modal :show="clearShow" @confirm="confirmClear" @cancel="clearShow=false"
:showCancelButton="true" ref="uModal" content="您确认要退出当前账号吗?" :asyncClose="true"></u-modal><view style="height: 50upx;"></view>
</view>
</template>
<script>
import userApi from "@/api/system/user";
import { mapGetters } from 'vuex';
export default {
data() {
return {
aid:'',
userInfoObj:{
account:{nickName:'',mobile:'',avatar:'',email:'',passValue:''},
},
clearShow:false,
}
},
computed: {
...mapGetters(['userInfo'])
},
onShow(){
this.$store.dispatch('GetUserInfo').then(rs=>{
this.aid=rs.aid;
this.load();
})
},
onLoad(){
//this.load()
},
methods: {
logout() {
this.clearShow=true;
},
confirmClear(){
let that = this;
that.$store.dispatch("LogOut").then(rs => {
that.clearShow=false;
if(rs.status==200){
let loginPath=this.$config.loginPath;
if(loginPath.startsWith('http')){
// #ifdef APP-PLUS
plus.runtime.openURL(loginPath) //这里默认使用外部浏览器打开而不是内部web-view组件打开
// #endif
// #ifdef H5
//window.open(loginPath)
location.href=loginPath;
// #endif
}else{
uni.redirectTo({
url:loginPath
})
}
}else{
that.$refs.loginToast.show({message:'退出失败',type:'error'});
}
}).catch(() => {
that.clearShow=false;
});
},
// 跳转到对应修改页面
toRouter(name) {
let router={
nickName:'nickName',
newBirt:'newBirt',
indLabels:'indLabels',
next:'next'
}
if(name==='headimg'){
uni.navigateTo({
url: '/pages/my/headimg'
})
}else{
uni.navigateTo({
url: `/pages/login/${router[name]}`
})
}
},
async load(){
uni.showLoading({ title: '加载中...' });
await userApi.detail(this.aid).then(res=>{
if(res.status==200){
if(res.result.account.avatar){
res.result.account.avatar=this.$config.fileUrl+res.result.account.avatar
}
this.userInfoObj=res.result
}else{
uni.showToast({
title: "获取数据失败",
icon:'none'
});
}
})
uni.hideLoading();
}
},
};
</script>
<style lang="scss" scoped>
.uavatar{
border:1px solid #73adfe;
color:#73adfe;
text-align: center;
font-size: 6pt;
line-height: 20px;
vertical-align: middle;
width: 40px;
height: 40px;
border-radius: 20px;
}
.settingDetail {
.u-demo-block__content{
margin-top: 10px;
}
/deep/.u-cell__body{
padding: 10px 25px;
}
/deep/.u-form-item__body__left__content__label {
width: 100px;
}
.u-input {
margin-left: 50px;
}
.setInfoItem {
// padding: 0 20px;
padding-top: 20px;
background: white;
.u-demo-block__title{
margin-left: 35upx;
font-size: 18px;
color: #000000;
}
text {
font-weight: 600;
}
>view {
margin: 10px 2px;
>text {
font-weight: 400;
}
view {
text {
color: #101010;
font-weight: 400;
align-items: center;
}
text:last-of-type {
// margin-left: 6px;
}
.hideStyle {
font-size: 12px;
display: flex;
justify-content: center;
align-items: center;
}
.arrow-right {
margin-top: 6px;
}
}
}
//虚线
// >view:not(:last-of-type) {
// border-bottom: 1px solid #eaecef;
// }
}
.u-button {
//background-color: blue;
}
.exitBtn {
padding-top: 25upx;
}
}
</style>

459
pages/my/toMeComments.vue Normal file
View File

@@ -0,0 +1,459 @@
<template>
<view>
<page-title :showBack="true">@我的</page-title>
<u-toast ref="interactToast"></u-toast>
<view class="input-search">
<view class="top-ten" style="margin-right: 20upx;">
<text class="textbtn" @click="statusSelecShow=!statusSelecShow">类型</text>
</view>
<u-search
v-model="query.send"
placeholder="搜索人员姓名"
@search="findData(true)"
@clear="findData(true)"
:clearabled="true"
:showAction="false"
shape="square"
bgColor="#ffffff">
</u-search>
</view>
<view class="sea-show" v-show="statusSelecShow">
<text v-for="(item,index) in typeArray" :key="index" :class="[item.value == query.type ?'sea-active':'','sea-index' ]" @click="Application(item.value)">{{item.name}}</text>
</view>
<view class="data" v-for="(item,index) in data" :key="index" >
<view class="data-item">
<view class="data-item-text" @click="toArticleDetail(item)">
<!-- <text> {{filterObjType(item.objType)}} </text> -->
<text> {{item.title}} </text>
</view>
<view class="firstReply" @click="toArticleDetail(item)">
<text class="firstReply-text">{{item.sysCreateBy}}@:{{ item.content }}</text>
</view>
<view style="display: flex;justify-content: space-between;">
<view class="sysCreateTime">{{item.sysCreateTime}}</view>
<view class="rowbtn rowbtn-primary">
<u-icon name="chat" color="#3E7FFF" labelColor="#3E7FFF" @click="replay(item)" label="回复" size="16" labelSize="12"></u-icon>
</view>
</view>
<!-- <view v-if="item.replys && item.replys.length>0" style="padding-left: 40upx;">
<div v-for="(re,reIdx) in item.replys" :key="re.id">
<span>回复{{ re.content }}</span> -->
<!--应该有删除的-->
<!-- <u-button type="text" icon="el-icon-delete" size="mini"">删除</u-button> -->
<!-- </div>
</view> -->
</view>
</view>
<view v-if="total>query.pageSize">
<uni-load-more :status="loadStatus"></uni-load-more>
</view>
<u-popup :show="inputShow" @close="closeInput" @open="openInput">
<view>
<view style="display: flex;">
<view style="flex: 1;padding: 15upx;">
<u--textarea :height="150" v-model="inputValue" :plaholder="'回复'+reply.sysCreateBy" count></u--textarea>
</view>
<view style="width:160upx;text-align: center;padding-top: 10px;line-height: 80upx;">
<view>
<u-button type="primary" @click="publishReply" text="发布" style="width: 100upx;height: 80upx;margin-top: 80upx;"></u-button>
</view>
</view>
</view>
<view>
</view>
</view>
</u-popup>
</view>
</view>
</template>
<script>
import apiComments from '../../api/modules/comments.js';
import apiQa from '@/api/modules/qa.js'
import { mapGetters } from 'vuex';
export default {
data() {
return {
classType:4,
statusSelecShow:false,
query:{
pageIndex:1,//当前页
type:2,//当前只限于文章
pageSize:10,//条数
},//查询条件
data:[],//拿到的数据
total:0,//总条数
inputShow:false,//控制回复弹窗
inputValue:'',//回复内容
reply:{
},//回复内容
loadStatus:'more',//more,loading,noMore
typeArray: [
// {
// name: '课程',
// value: '1'
// },
{
name: '文章',
value: '2'
},
{
name: '问答',
value: '4'
}
],
}
},
computed: {
...mapGetters(['userInfo'])
},
onLoad() {
this.findData(true);
},
onPullDownRefresh() {
this.onReachBottom();
},
onReachBottom() {
this.loadStatus='loading';//more,loading,noMore
if(this.data.length<this.total){
this.query.pageIndex++;
this.findData(false);
this.loadStatus='more'
}else{
this.loadStatus='noMore'
}
},
methods: {
Application(e){
this.query.type = e;
// this.searchData();
this.findData(true);
},
toArticleDetail(item) {
if(this.query.type == 2){
uni.navigateTo({
url: '/pages/resource/articeDetail?id=' + item.objId
});
}else if(this.query.type == 1){
uni.navigateTo({
url: '/pages/resource/courseDetail?id=' + item.objId
});
}else if(this.query.type == 4){
uni.navigateTo({
url: '/pages/resource/qaDetail?id=' + item.objId
});
}
},
filterObjType(objType){
switch(objType){
case 1:{
return '[课程]'
}
case 2:{
return '[文章]'
}
case 3:{
return '[案例]'
}
case 4:{
return '[问答]'
}
}
},
findData(flag) {
uni.showLoading({ title: '加载中...' });
if(flag){
this.data=[]
this.pageIndex=1
}
apiComments.pagelist(this.query).then(res=>{
if (res.status == 200) {
this.total=res.result.count
if (res.result.list.length != 0) {
res.result.list.forEach(item=>{
this.data.push(item)
})
}
}else{
this.$refs.interactToast.show({message:'加载@我的评论失败',type:'error'});
}
uni.hideLoading();
})
},
replay(item){
this.reply={...item}
this.reply.parentId=item.id;
this.reply.objType=this.query.type;
this.inputValue='';
this.inputShow=true
},
openInput() {
this.inputShow = true;
},
closeInput() {
this.inputShow = false;
},
deleteMyReply(item){
//当前界面中没有删除回复的操作
console.log(item,"删除回复")
},
publishReply(){
let replayInfo={
clevel:2,
commentId:this.reply.id,
parentId:this.reply.id,
content:this.inputValue,
objType:this.reply.objType,
objId:this.reply.objId,
// replyAid:this.reply.sysCreateAid,
// toAid:this.reply.sysCreateAid,
// toAname:this.reply.sysCreateBy,
replyAid:this.userInfo.aid,
replyName:this.userInfo.name,
// parentRead:true
}
if(this.query.type == 2) {
apiComments.reply(replayInfo).then(res=>{
if(res.status==200){
this.$refs.interactToast.show({message:'回复成功',type:'success'});
this.inputShow=''
this.inputShow = false;
this.findData(true)
// if(!this.reply.replys){
// this.reply.replys=[];
// }
// this.reply.replys.push(res.result);
}else{
this.$refs.interactToast.show({message:'回复失败',type:'error'});
}
}).catch(err=>{
})
} else {
apiQa.saveComment({
parentId:this.reply.parentId,
content:this.inputValue,
commentId:this.reply.id
}).then(res=>{
if(res.status==200){
this.$refs.interactToast.show({message:'回复成功',type:'success'});
this.inputShow=''
this.inputShow = false;
this.findData(true)
}else{
this.$refs.interactToast.show({message:'回复失败',type:'error'});
}
})
}
}
}
}
</script>
<style lang="scss" scoped>
.rowbtn{
padding: 5px 8px 0px 8px;
height: 20px;
border-radius: 10upx;
}
.rowbtn-primary{
background-color: #ebf3fe;
}
.rowbtn-info{
background-color: #f1f1f1;
}
.repbox{
padding-top: 10rpx;
height: 45rpx;
background: #fff;
.reptext{
color: #666;
font-size: 26rpx;
line-height: 40rpx;
padding-left: 5rpx;
}
}
.sea-show {
padding: 20upx 30upx;
.sea-active {
border: 1rpx solid #679cfc !important;
color: #679cfc;
}
.sea-index {
font-size: 26rpx;
padding: 6rpx 16rpx;
border: 1rpx solid #ccc;
border-radius: 20rpx;
margin-right: 16rpx;
background-color: #fff;
}
}
.input-search{
padding:28upx 20upx;
display: flex;
.u-input{
background: #ffffff;
}
.top-ten {
width: 120upx;
height: 62upx;
// margin-top: 26upx;
// margin-left: 24upx;
background-color: #fff;
text-align: center;
line-height: 62upx;
border-radius: 8upx;
}
// /deep/.u-icon{
// span{
// font-size: 50upx;
// color: #588afc;
// }
// }
}
.txtbtn {
background-color: #e9e9e9;
border: 1px solid #e0e0e0;
padding: 3px 10px;
border-radius: 6px;
font-size: 0.8em;
}
.top-content {
padding: 5px 5px;
// background-color: #6297FD;
.top-bar-center {
display: flex;
font-size: 35upx;
.top-bar-tab {
margin: 0upx 50upx;
}
.active {
border-bottom: 2px solid #588AFC;
color: #5282eb;
}
}
.top-content-options {
height: 40px;
display: flex;
justify-content: space-between;
line-height: 40px;
}
}
.search-input {
margin-left: 40rpx;
margin-bottom: 30upx;
margin-top: 30rpx;
border: 2px solid #5555ff;
border-radius: 20px;
}
.top_bottom {
margin-bottom: 20upx;
.authors_reverse {
display: flex;
margin-bottom: 15upx;
}
.ico {
margin-top: 15upx;
margin-left: 5upx;
margin-right: 5upx;
}
}
.top_text {
margin: 20upx 0 5upx 0;
// padding-left: 40upx;
line-height: 80rpx;
font-size: 34rpx;
color: #333333;
margin: 10upx;
font-weight: 500;
}
.reply {
font-size: 20upx;
// padding-left: 45upx;
color: #b6b6b6;
}
.reply text {
margin-right: 20upx;
font-size: 21rpx;
}
.data {
margin-bottom: 15rpx;
padding: 20upx 20upx;
background-color: #fff;
.data-item {
padding-bottom: 30rpx;
.data-item-text{
display: flex;
justify-content: flex-start;
color: #3E7FFF;
font-size: 30rpx;
font-weight: bold;
text:last-of-type{
color: black;
flex-shrink: 10000;
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
}
}
.firstReply{
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
font-size: 30rpx;
color: #666666;
line-height: 1.5;
margin: 20upx 0;
.firstReply-text{
font-size: 28rpx;
flex-shrink: 1000;
color: #454545;
display: -webkit-box;
// white-space:pre-wrap;
overflow: hidden;
// text-overflow:ellipsis;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
.u-button{
margin: 0;
width: 100upx;
height: 50upx;
}
}
.sysCreateTime{
font-size: 24upx;
color: #999;
line-height: 48upx;
}
}
}
</style>

864
pages/my/toMeShares.vue Normal file
View File

@@ -0,0 +1,864 @@
<template>
<view>
<page-title :showBack="true">分享给我的</page-title>
<view class="top-tab">
<view class="top-bar-center">
<view class="top-bar-tab" @click="clicktab(1)" :class="{ active: conType == 1 }">课程</view>
<view class="top-bar-tab" @click="clicktab(2)" :class="{ active: conType == 2 }">文章</view>
<view class="top-bar-tab" @click="clicktab(4)" :class="{ active: conType == 4 }">问答</view>
</view>
</view>
<view class="top-content-options">
<!-- 是否已查看 -->
<view style="margin-right: 20upx;">
<!-- <u-picker :show="statusSelectShow" @cancel="statusSelectShow = false" @confirm="chooseStatus" :columns="selectData" keyName="label"></u-picker> -->
<!-- <text class="textbtn" @click="statusSelectShow = true">{{ statusBtn }}</text> -->
<text class="textbtn" @click="statusSelectShow = !statusSelectShow">状态</text>
</view>
<!--课程-->
<view class="input-search">
<u-search
:clearabled="true"
v-model="query.keyword"
placeholder="输入关键词"
@search="findData(true)"
@clear="findData(true)"
:showAction="false"
shape="square"
bgColor="#ffffff"
>
<!-- <template slot="suffix">
<u-icon @click="findData(true)" name="search"></u-icon>
</template> -->
</u-search>
</view>
</view>
<view class="sea-show" v-show="statusSelectShow">
<text @click="chooseStatus(null)" :class="[isRead == null?'sea-active':'','sea-index' ]">全部</text>
<text @click="chooseStatus(true)" :class="[isRead == true?'sea-active':'','sea-index' ]">已查看</text>
<text @click="chooseStatus(false)" :class="[isRead == false?'sea-active':'','sea-index' ]">未查看</text>
</view>
<view v-if="conType == 1">
<view v-for="(item, idx) in courseList" :key="idx" class="course_box">
<view class="course" @click="toCourseDetail(item)">
<view><course-image :course="item" width="262upx" height="147upx"></course-image></view>
<view class="course-content">
<view><span class="common" :class="contentTypeFilter(item.contentType).class">{{ contentTypeFilter(item.contentType).text }}</span><span style="font-weight: bold;font-size: 32upx;" v-html="$keywordActiveShow(item.title,query.keyword)"></span></view>
<view class="course-con_source">分享日期{{ item.time }}</view>
<view class="course-author">
{{ item.authorName }}分享给我
</view>
</view>
</view>
<!-- <view><interact-bar :data="item" :shares="false" :views="false"></interact-bar></view> -->
<!-- <view class="">
<text class="isread" v-if="!item.isRead">
<image style="height: 26rpx;" src="../../static/images/icon/noread.png" mode=""></image>
未查看</text>
<text class="isread" v-else>
<image style="margin-top: -5rpx;" src="../../static/images/icon/isread.png" mode=""></image>
已查看</text>
</view> -->
<view class="rowbtn-right">
<view class="rowbtn rowbtn-info" v-if="item.isRead">
<u-icon name="eye-fill" color="#767676" labelColor="#767676" label="已查看" size="16" labelSize="12"></u-icon>
</view>
<view class="rowbtn rowbtn-info" v-else>
<u-icon name="eye-off" color="#767676" labelColor="#767676" label="未查看" size="16" labelSize="12"></u-icon>
</view>
</view>
</view>
</view>
<view v-if="conType == 2">
<view class="article_one" v-for="(item, idx) in articleList" :key="idx" @click="toArticleDetail(item)">
<view class="articla_tit">
<text v-if="item.isRead" style="color:#3e7fff;margin-right: 8upx">
[已查看]
</text>
<text v-else style="color:#FF3E3E;margin-right: 8upx">
[未查看]
</text>
{{ $keywordActiveShow(item.title,query.keyword) }}
</view>
<text class="articla_text" v-html="$keywordActiveShow(item.summary,query.keyword)"></text>
<author-info :avatar="item.avatar" :name="item.sysCreateBy" :info="item.orgInfo" :sex="item.sex"></author-info>
<view class="artical_text_bottom">
<text style="font-size: 26rpx;color: #9d9d9d;">{{item.time}}</text>
<text style="font-size: 26rpx;color: #666666;margin-right: 35upx;">{{ item.sysCreateBy }}分享给我</text>
</view>
<!-- <view style="margin-top: 8px;"><interact-bar :data="item" :shares="false"></interact-bar></view> -->
<!-- <view class=""> -->
<!-- <text class="isread" v-if="item.isRead">
<image style="height: 26rpx;" src="../../static/images/icon/noread.png" mode=""></image>
未查看</text>
<text class="isread" v-else>
<image style="margin-top: -5rpx;" src="../../static/images/icon/isread.png" mode=""></image>
已查看</text> -->
<!-- </view> -->
</view>
</view>
<view v-if="conType == 4">
<view v-for="(item, idx) in qaList" :key="idx" class="qa" @click="toQaDetail(item)">
<view class="qa-body" >
<text v-if="item.question.isResolve" style="color:#08A890;margin-right: 8upx">[已解决]</text>
<text v-else style="color:#588afc;margin-right: 8upx">
[待解决]
</text>
<text v-html="$keywordActiveShow(item.question.title,query.keyword)"></text>
</view>
<view class="qa-bottom" v-html="$keywordActiveShow(item.question.content,query.keyword)"></view>
<!-- <author-info :avatar="item.avatar" :name="item.question.sysCreateBy" :info="item.orgInfo"></author-info> -->
<view class="qa-answers" v-if="item.question.isResolve">
<view class="answer-two"
style="word-break:break-all;
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
-webkit-box-orient: vertical;
display: -webkit-box;-webkit-line-clamp: 2;
line-height: 35rpx;
overflow: hidden;text-overflow: ellipsis;
font-size: 28rpx;
">
<text style="color: #FFB30F;" >最佳回答</text>
{{ item.question.bestAnswer }}
</view>
</view>
<text class="qa-text">{{item.time}}</text>
<text style="font-size: 26rpx;color: #666666">{{ item.sysCreateBy }}分享给我</text>
<!-- <view class="qa-bar"><interact-bar :data="item.question" :praises="false" :views="false"></interact-bar></view> -->
<!-- <view class="">
<text class="isread" v-if="item.isRead">
<image style="height: 26rpx;" src="../../static/images/icon/noread.png" mode=""></image>
已查看</text>
<text class="isread" v-else>
<image style="margin-top: -5rpx;" src="../../static/images/icon/isread.png" mode=""></image>
未查看</text>
</view> -->
<view class="rowbtn-right">
<view class="rowbtn rowbtn-info" v-if="item.isRead">
<u-icon name="eye-fill" color="#767676" labelColor="#767676" label="已查看" size="16" labelSize="12"></u-icon>
</view>
<view class="rowbtn rowbtn-info" v-else>
<u-icon name="eye-off" color="#767676" labelColor="#767676" label="未查看" size="16" labelSize="12"></u-icon>
</view>
</view>
</view>
</view>
<view v-show="count>query.pageSize"><uni-load-more :status="loadStatus"></uni-load-more></view>
</view>
</template>
<script>
import { mapState, mapActions } from 'vuex';
import apiShares from '@/api/modules/shares.js';
import apiUser from '@/api/system/user.js';
// import apiShares from '@/api/modules/shares.js';
export default {
computed: mapState(['resourceTab']),
data() {
return {
isRead:null,
statusBtn: '全部',
selectData: [
[
{ label: '全部', value: null },
{ label: '已查看', value: true },
{ label: '未查看', value: false },
]
],
statusSelectShow: false,
conType: 1,
query:{
pageIndex: 1,
pageSize: 4,
keyword:'',
isRead:null
},
courseList:[],
articleList:[],
qaList:[],
count:0,
loadStatus: 'more', //more,loading,noMore, 应该划分出三个
running:false,
};
},
onLoad: function(options) {
this.findData(true);
},
onPullDownRefresh() {
this.onReachBottom();
},
async onReachBottom() {
if(this.conType==1){
if(this.courseList.length<this.count){
this.loadStatus='loading';
this.query.pageIndex++;
await this.findData(false);
this.loadStatus='more';
}else{
this.loadStatus='noMore';
}
}
if(this.conType==2){
if(this.articleList.length<this.count){
this.loadStatus='loading';
this.query.pageIndex++;
await this.findData(false);
this.loadStatus='more';
}else{
this.loadStatus='noMore';
}
}
if(this.conType==4){
if(this.qaList.length<this.count){
this.loadStatus='loading';
this.query.pageIndex++;
await this.findData(false);
this.loadStatus='more';
}else{
this.loadStatus='noMore';
}
}
},
methods: {
//点击切换类别时请求数据
clicktab(val) {
this.conType=val;
this.query.pageIndex=1;
this.query.keyword='';
this.isRead = null;
this.query.isRead = null;
this.statusBtn = '全部'
this.findData(true);
},
//查找数据
findData(flag) {
if(this.running){
return;
}
this.running=true;
let $this = this;
//是否重置列表
if (flag) {
if(this.conType==1){
this.courseList=[]
}
if(this.conType==2){
this.articleList=[]
}
if(this.conType==4){
this.qaList=[]
}
}
this.query.isRead = this.isRead;
//生成查询条件
uni.showLoading({ title: '加载中...' });
//查询条件
const conList = {
1: 'mymecourselist',
2: 'mymearticlelist',
4: 'mymeqalist'
};
apiShares[conList[this.conType]](this.query).then(rs => {
if (rs.status == 200) {
this.count=rs.result.count
if(this.conType==1){
rs.result.list.forEach(item=>{
$this.courseList.push(item)
})
}else if(this.conType==2){
let userIds = [];
rs.result.list.forEach(item=>{
item.avatar=''
item.orgInfo='';
item.sex=null;
userIds.push(item.sysCreateAid);
$this.articleList.push(item)
});
$this.loadUserInfos(rs.result.list,userIds);
}else if(this.conType==4){
let userIds = [];
rs.result.list.forEach(item=>{
item.avatar=''
item.orgInfo='';
item.sex=null;
userIds.push(item.question.sysCreateAid);
$this.qaList.push(item)
});
$this.loadQaUserInfos(rs.result.list,userIds);
}
}else{
uni.showToast({
title: "获取数据失败",
icon:'none'
});
}
this.running=false;
});
setTimeout(function() {
uni.hideLoading();
}, 100);
},
loadUserInfos(list, userIds) {
let $this = this;
const noReapetIds = [...new Set(userIds)];
if(noReapetIds.length==0){
return;
}
if(noReapetIds[0]==null){
return;
}
apiUser.getByIds(noReapetIds).then(res => {
if (res.status == 200) {
list.forEach(item => {
res.result.some(author => {
if (author.aid == item.sysCreateAid) {
if (author.avatar != '') {
item.avatar = $this.$config.fileUrl + author.avatar;
//实际上根本没有拿到fileUrl
}else{
item.avatar=''
}
item.sex = author.sex;
item.orgInfo = author.orgInfo;
return true;
}
return false;
});
});
}
});
},
loadQaUserInfos(list, userIds) {
let $this = this;
const noReapetIds = [...new Set(userIds)];
if(noReapetIds.length==0){
return;
}
if(noReapetIds[0]==null){
return;
}
apiUser.getByIds(noReapetIds).then(res => {
if (res.status == 200) {
list.forEach(item => {
res.result.some(author => {
if (author.aid == item.question.sysCreateAid) {
if (author.avatar != '') {
item.avatar = $this.$config.fileUrl + author.avatar;
//实际上根本没有拿到fileUrl
}else{
item.avatar=''
}
item.sex = author.sex;
item.orgInfo = author.orgInfo;
return true;
}
return false;
});
});
}
});
},
chooseStatus(e) {
// this.statusSelectShow = false;
// this.statusBtn = e.value[0].label;
this.isRead = e;
//console.log(this.isRead)
this.findData(true);
},
toCourseDetail(citem) {
if(!citem.isRead){
apiShares.updateIsRead(citem.id).then(res=>{
if(res.status==200){
}
})
}
if (citem.contentType == 10) {
uni.navigateTo({
url: '/pages/resource/microDetail?id=' + citem.objId
});
} else if (citem.contentType == 20 || citem.contentType == 21) {
uni.navigateTo({
url: '/pages/resource/courseDetail?id=' + citem.objId
});
}
},
toArticleDetail(item) {
if(!item.isRead){
apiShares.updateIsRead(item.id).then(res=>{
if(res.status==200){
}
})
}
uni.navigateTo({
url: '/pages/resource/articeDetail?id=' + item.objId
});
},
toQaDetail(item) {
if(!item.isRead){
apiShares.updateIsRead(item.id).then(res=>{
if(res.status==200){
}
})
}
uni.navigateTo({
url: '/pages/resource/qaDetail?id=' + item.question.id
});
},
contentTypeFilter(value) {
let obj = {};
switch (value) {
case '10': {
obj.class = 'uc-course-type2';
obj.text = '录播';
break;
}
case '21': {
obj.class = 'uc-course-type2';
obj.text = '直播';
break;
}
case '20': {
obj.class = 'uc-course-type2';
obj.text = '录播';
break;
}
case '30': {
obj.class = 'uc-course-type2';
obj.text = '面授';
break;
}
case '90': {
obj.class = 'uc-course-type2';
obj.text = '混合';
break;
}
}
return obj;
},
}
}
</script>
<style lang="scss" scoped>
.rowbtn-right{
margin-top: 10upx;
display: flex;
justify-content: flex-end;
}
.rowbtn{
padding: 5px 8px 0px 8px;
height: 20px;
border-radius: 10upx;
}
.rowbtn-primary{
background-color: #ebf3fe;
}
.rowbtn-info{
background-color: #f7f7f7;
}
/deep/.filter .btn-box > uni-view {
border: solid 0.5px #ffb30f;
}
/deep/.filter .btn-box .submit {
background-color: #ffb30f;
}
/deep/.filter .btn-box > uni-view {
border: solid 0.5px #ffb30f;
}
/deep/.filter .btn-box .reset {
color: #ffb30f;
}
/deep/.filter .menu-box .box .labels .on {
border-color: #ffb30f;
background-color: #ffb30f;
}
/deep/.filter .menu-box .box .labels > uni-view {
width: 125px;
padding-left: 5px;
padding-right: 5px;
}
/deep/.sub-menu-list .sub-menu > .menu-name > .iconfont {
color: #ffb30f;
}
/deep/.sub-menu-list.alone .sub-menu {
border-bottom: 0;
}
/deep/.nav .first-menu.on {
color: #ffb30f;
}
/deep/.sub-menu-list.alone .sub-menu.on {
color: #ffb30f;
}
/deep/.u-tabs__wrapper__nav {
display: flex;
justify-content: space-around;
}
.sea-show{
padding: 20rpx 30upx;
.sea-active{
border: 1rpx solid #679cfc !important;
color: #679cfc;
}
.sea-index{
font-size: 26rpx;
padding: 6rpx 16rpx;
border: 1rpx solid #ccc;
border-radius: 20rpx;
margin-right: 16rpx;
background-color: #fff;
}
}
.isread{
color: #666;
font-size: 24rpx;
line-height: 35rpx;
image{
width: 30rpx;
height: 30rpx;
margin-right: 10rpx;
padding-top: 10rpx;
vertical-align: top;
}
}
.top-content-options{
// height: 40px;
display: flex;
align-items: center;
// line-height: 40px;
padding: 20upx 30upx 0upx 30upx;
/deep/ .input-search {
margin-top: 4upx;
// padding-right: 10px;
flex: 1;
// margin-right: 50rpx;
// padding: 28upx 20upx;
.u-search {
background: #ffffff;
border-radius: 8upx;
}
// /deep/.u-icon {
// span {
// font-size: 50upx;
// color: #588afc;
// }
// }
}
}
.textbtn {
background-color: #ffffff;
padding: 18upx 20upx;
color: #666;
border-radius: 8upx;
font-size: 28upx;
}
.top-tab {
height: 50px;
// background: linear-gradient(to bottom, #6BA0FC, #6297FD);
display: flex;
justify-content: space-between;
line-height: 60px;
color: #373737;
.top-bar-center {
display: flex;
font-size: 30upx;
// margin-left: 40upx;
.top-bar-tab {
margin: 0upx 50upx;
}
.active {
border-bottom: 2px solid #588afc;
// color: #5282eb;
font-size: 35upx;
font-weight: bold;
}
}
.top-tab-left {
display: flex;
justify-content: space-around;
width: 100%;
text-align: center;
}
.top-tab-line {
width: 50px;
height: 3px;
background: #ffffff;
margin-top: -5px;
}
}
.input-search{
// padding:28upx 20upx;
.u-input{
background: #ffffff;
}
// /deep/.u-icon{
// span{
// font-size: 50upx;
// color: #588afc;
// }
// }
// /deep/.uni-input-placeholder{
// color: #588afc!important;
// }
}
.course_box {
// margin-bottom: 10px;
margin-top: 20upx;
background-color: #ffffff;
padding: 20upx 30upx;
/deep/ .course {
display: flex;
justify-content: flex-start;
align-items: center;
uni-image{
border-radius:8px;
}
.course-img {
display: flex;
justify-content: space-around;
width: 120px;
height: 70px;
margin-right: 5upx;
}
.course-content {
display: flex;
flex-direction: column;
justify-content: space-between;
margin-left: 20upx;
height: 74px;
margin-top:-12upx;
.course-con_source{
font-size: 26upx;
color: #787878;
}
.course-author {
font-size: 26upx;
color: #666;
}
.common{
padding: 3upx 20upx;
border-radius: 2px;
font-size: 26upx;
color: #fff;
margin-right: 20upx;
}
.uc-course-type1{
background: #588afc;
}
.uc-course-type2{
background: #ffb30f;
}
}
}
}
.article-center {
width: 90%;
margin-left: 5%;
margin-right: 5%;
}
.article {
background: #f8fbfd;
}
.article_one {
// padding-top: 10px;
margin-top: 20upx;
background-color: #fff;
padding: 20upx 30upx;
.articla_tit {
line-height: 50rpx;
font-weight: bold;
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
font-size: 30upx;
word-break:break-all;
}
.articla_text {
word-break:break-all;
font-size: 28rpx;
color: #797979;
display: -webkit-box;
overflow: hidden;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
margin-bottom: 10rpx;
}
.artical_text_bottom{
margin-top: 10rpx;
text{
margin-right: 10px;
}
}
}
.qa {
padding: 20upx 30upx;
// margin-top: 20upx;
// padding: 10px;
box-shadow: #f7f7f7 0px 6px 5px;
border-radius: 4px;
background: #ffffff;
margin-top: 10px;
// padding-bottom: 10rpx;
.qa-header {
height: 26px;
line-height: 50rpx;
display: flex;
justify-content: space-between;
.qa-user {
display: flex;
img {
height: 25px;
width: 25px;
margin-right: 5px;
}
}
}
.qa-body {
line-height: 26px;
// overflow: hidden;
// text-overflow:ellipsis;
// white-space: nowrap;
font-size: 30rpx;
font-weight: bold;
display: -webkit-box;
overflow: hidden;
-webkit-box-orient: vertical;
word-break:break-all;
-webkit-line-clamp: 2;
}
.qa-bottom {
font-size: 15px;
color: #454545;
display: -webkit-box;
overflow: hidden;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
word-break:break-all;
}
.qa-answers {
font-size: 30rpx;
color: #5b5b5b;
display: flex;
overflow: hidden;
line-height: 20upx;
width: 100%;
// height: 70upx;
margin: 10upx 0upx;
padding: 10upx 0;
}
.qa-text{
font-size: 26rpx;
color: #9d9d9d;
margin-right: 10px;
}
}
.details {
height: 127px;
border-bottom: 1px solid #e3e3e3;
}
.newest {
width: 60px;
height: 31px;
background: #ffffff;
font-size: 11px;
border-radius: 4px;
color: #505050;
text-align: center;
line-height: 31px;
margin-top: 2px;
margin-left: 9px;
}
.hottest {
background: #dfebf4;
color: #5ba2fc;
}
.big_top {
height: 37px;
}
.big_box_top {
display: flex;
height: 80upx;
padding: 30upx 0;
}
.big-box_center {
height: 173px;
margin-top: 9px;
display: flex;
justify-content: space-between;
flex-wrap: wrap;
}
.llef {
width: 168px;
height: 172px;
border-radius: 4px;
background: #ffffff;
box-shadow: #f1f6fe 0px 6px 5px;
}
.llef img {
width: 168px;
height: 96px;
}
</style>