Commit 31465e4a by xiongyuwen

no message

parent 9a3bfd85
......@@ -31,6 +31,14 @@
</el-input>
<template>
<div class="knowledge" @click="knowledge">知识库</div>
<div
class="knowledge"
v-loading="showSyncWanPanloading"
v-if="showSyncWanPan"
@click="SyncWanPan"
>
刷新知识库
</div>
</template>
</div>
<div>
......@@ -55,7 +63,7 @@
id: userInfo.id,
username: userInfo.username,
avatarUrl: userInfo.avatarUrl,
isReal: userInfo.isReal
isReal: userInfo.isReal,
}"
:size="35"
:round="true"
......@@ -98,17 +106,20 @@
import loginAbout from "@/mixin/loginAbout";
import jwt from "jsonwebtoken";
import axios from "@/plugins/axios.js";
import config from "@/config.js";
export default {
name: "Header",
mixins: [loginAbout],
props: {
headImg: {
type: String,
default: ""
}
default: "",
},
},
data() {
return {
showSyncWanPanloading: false,
showSyncWanPan: false,
inputVal: "",
code: "", // 邀请码
canReg: false,
......@@ -118,7 +129,7 @@ export default {
imgurl: require("@/assets/logo.png"),
islogin: true,
hideHeader: false, // 不需要头部右侧部分
preurl: "/"
preurl: "/",
};
},
computed: {
......@@ -143,8 +154,19 @@ export default {
// console.log(res.data.result);
// })
return this.$store.state.user.info.attributes || {};
if (!!this.$store.state.user) {
let users = this.$store.state.user.info.attributes;
if(!!users)
{
console.log(users,22)
if (users.username == "熊裕文") {
this.showSyncWanPan = true;
}
}
}
return this.$store.state.user.info.attributes || {};
},
},
watch: {
// 监听路由变化
......@@ -154,13 +176,14 @@ export default {
} else {
this.siteClose = false;
}
}
},
},
mounted() {
this.showSyncWanPan = false;
// 获取cookies拿到token
var token = this.getCookie("BailunToken");
// var token =
// "Bearer%20eyJhbGciOiJSUzI1NiIsImtpZCI6IjQ1ZmMzZDYzYjRmNGM5YjAzMWVhNjQ0MzhhNTE1NmM3IiwidHlwIjoiSldUIn0.eyJuYmYiOjE2MTAxNzMxNTAsImV4cCI6MTYxMDIwOTE1MCwiaXNzIjoiaHR0cDovL2xvY2FsaG9zdDo1MDAxIiwiYXVkIjpbImh0dHA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mt2aVjhAgZjH5MKNMrPBuFN2h1l-fDWsjDoJw7JBNQQOJ2PlXHTCXIKLN3GzLt7VTmUa1Up8UozfoXu2k5Vzl5tCrNgGIUAmgdvME_I_eE3M-Klmqa6Tb2XfSRGqkmc7fnbF79ni4YtvxgYhQHAl-v9BNJF3OtQKXnGtGSaUC8rMTxzg";
var token = token.replace("Bearer%20", "").replace("Bearer ", "");
if (token) {
......@@ -170,9 +193,9 @@ export default {
// 更加微信用户id获取对应得用户信息并返回
axios
.get(`http://discuz.bailuntec.com/api/login?useid=${wxUserid}`)
//.get(`http://discuz.bailuntec.com/api/login?useid=chenzekai`)
.then(res => {
//.get(`http://discuz.bailuntec.com/api/login?useid=${wxUserid}`)
.get(`http://discuz.bailuntec.com/api/login?useid=tangyanfen`)
.then((res) => {
if (res.data.data.relationships.users.data.id) {
localStorage.setItem(
"user_id",
......@@ -228,7 +251,7 @@ export default {
},
methods: {
// 获取cookie
getCookie: function(cname) {
getCookie: function (cname) {
const name = `${cname}=`;
const ca = document.cookie.split(";");
console.log("获取cookie,现在循环");
......@@ -242,6 +265,19 @@ export default {
}
return "";
},
SyncWanPan() {
this.showSyncWanPanloading = true;
axios
.get(`${config.WEI_PAN_URL}/weipan/ProcessWeiPanWorker`)
.then((res) => {
if (res.data.statusCode == 200) {
this.$message.success(res.data.result);
} else {
this.$message.err(res.data.result);
}
this.showSyncWanPanloading = false;
});
},
// 退出
logout() {
this.$store.dispatch("session/logout").then(() => {
......@@ -287,8 +323,8 @@ export default {
},
knowledge() {
this.$router.push(`/knowledge`);
}
}
},
},
};
</script>
<style lang="scss" scoped>
......
......@@ -8,24 +8,25 @@
item.type === 5 &&
item.question &&
item.question.is_answer === 1 &&
item.question.beUser
item.question.beUser &&
showAvatar
"
:user="{
id: item.question.beUser.id,
username: item.question.beUser.username,
avatarUrl: item.question.beUser.avatarUrl,
isReal: item.question.beUser.isReal
isReal: item.question.beUser.isReal,
}"
:prevent-jump="canDetail"
class="avatar"
/>
<avatar
v-else-if="item.user"
v-else-if="item.user && showAvatar"
:user="{
id: item.user.id,
username: item.user.username,
avatarUrl: item.user.avatarUrl,
isReal: item.user.isReal
isReal: item.user.isReal,
}"
:prevent-jump="canDetail"
class="avatar"
......@@ -42,7 +43,9 @@
:to="item.user.id > 0 ? `/user/${item.question.beUser.id}` : ''"
class="user-info"
>
<span class="user-name">{{ item.question.beUser.username }}</span>
<span v-if="showAvatar" class="user-name">{{
item.question.beUser.username
}}</span>
<span
v-if="
item.question.beUser &&
......@@ -60,7 +63,9 @@
:to="item.user.id > 0 ? `/user/${item.user.id}` : ''"
class="user-info"
>
<span class="user-name">{{ item.user.username }}</span>
<span v-if="showAvatar" class="user-name">{{
item.user.username
}}</span>
<span
v-if="
item.user &&
......@@ -82,10 +87,10 @@
>
{{ $t("topic.answered") }}
</div>
<template
v-if="item.createdAt"
<template v-if="item.createdAt"
>{{ $t("topic.publishAt") }}
{{ item.createdAt | formatDate }}</template>
{{ item.createdAt | formatDate }}</template
>
</div>
</div>
<!-- 问答贴 -->
......@@ -101,7 +106,8 @@
: ''
"
class="blue"
>@{{ item.question.beUser.username }}</nuxt-link>
>@{{ item.question.beUser.username }}</nuxt-link
>
{{ $t("topic.question") }}
</template>
<!-- 已回答 -->
......@@ -111,7 +117,8 @@
v-if="item.user"
:to="item.user.id > 0 ? `/user/${item.user.id}` : ''"
class="blue"
>@{{ item.user.username }}</nuxt-link>
>@{{ item.user.username }}</nuxt-link
>
{{ $t("topic.of") }}{{ $t("topic.question") }}
</template>
</div>
......@@ -119,7 +126,7 @@
<div class="first-post" @click.self="toDetail">
<div @click="onClickContent">
<div v-if="item.type === 1" class="title">
{{ $t("home.released") }}
<span v-if="showAvatar">{{ $t("home.released") }}</span>
<svg-icon
v-show="
parseFloat(item.price) > 0 ||
......@@ -127,9 +134,13 @@
"
type="pay-yuan"
class="blue"
style="font-size: 17px; display: inline-block; margin-right: 5px;"
style="
font-size: 17px;
display: inline-block;
margin-right: 5px;
"
/>
<span class="blue ">{{ item.title }}</span>
<span class="blue">{{ item.title }}</span>
</div>
<div v-else class="content">
<svg-icon
......@@ -156,7 +167,7 @@
item.type === 5 ||
item.type === 6 ||
parseFloat(item.price) > 0,
blue: item.type === 5
blue: item.type === 5,
}"
v-html="$xss(formatTopicHTML(item.firstPost.summary))"
/>
......@@ -258,9 +269,7 @@
<!-- 位置 -->
<nuxt-link
v-if="item.location"
:to="
`/topic/position?longitude=${item.longitude}&latitude=${item.latitude}`
"
:to="`/topic/position?longitude=${item.longitude}&latitude=${item.latitude}`"
class="location"
>
<span class="flex">
......@@ -309,61 +318,66 @@
</div>
</template>
<script>
import s9e from '@/utils/s9e';
import { time2MinuteOrHour } from '@/utils/time';
import { extensionList } from '@/constant/extensionList';
import handleError from '@/mixin/handleError';
import loginAbout from '@/mixin/loginAbout';
import s9e from "@/utils/s9e";
import { time2MinuteOrHour } from "@/utils/time";
import { extensionList } from "@/constant/extensionList";
import handleError from "@/mixin/handleError";
import loginAbout from "@/mixin/loginAbout";
import axios from "@/plugins/axios.js";
import config from "@/config.js";
export default {
name: 'PostItem',
name: "PostItem",
filters: {
formatDate(date) {
return time2MinuteOrHour(date);
}
},
},
mixins: [handleError, loginAbout],
props: {
// 主题详情
item: {
type: Object,
default: () => {}
default: () => {},
},
// 是否显示分享按钮
showShare: {
type: Boolean,
default: true
default: true,
},
// 是否图片懒加载
lazy: {
type: Boolean,
default: true
default: true,
},
infoimage: {
type: Boolean,
default: false
default: false,
},
// 付费站点是否可查看详情
canDetail: {
type: Boolean,
default: false
}
default: false,
},
},
data() {
return {
showAvatar: true,
loading: false,
showVideoPop: false, // 视频弹窗
isLiked: false, // 当前主题是否点赞
fileid: null,
qywxUserid: "",
currentAudio: {
id: '',
url: '',
currentTime: '',
duration: '',
audio: '',
id: "",
url: "",
currentTime: "",
duration: "",
audio: "",
seeking: false,
isPlay: false,
isLoading: false
}
isLoading: false,
},
};
},
computed: {
......@@ -373,7 +387,7 @@ export default {
},
forums() {
return this.$store.state.site.info.attributes || {};
}
},
},
watch: {
item: {
......@@ -382,21 +396,35 @@ export default {
this.likeCount = val.firstPost && val.firstPost.likeCount;
},
deep: true,
immediate: true
}
immediate: true,
},
},
mounted() {
// 初始化audio标签
this.currentAudio.audio = document.getElementById(
`audio-player${this.item && this.item._jv && this.item._jv.id}`
);
let userInfo = JSON.parse(this.item.user.wechat_info);
this.qywxUserid = userInfo.userid;
axios
.get(
`${config.WEI_PAN_URL}/weipan/GetWeiPanFileByThreadId?threadId=${this.item._jv.id}`
)
.then((res) => {
if (res.data.statusCode == 200) {
this.showAvatar = false;
this.fileid = res.data.result.fileId;
}
});
},
methods: {
// 点赞
handleLike() {
if (!this.$store.getters['session/get']('isLogin')) {
if (!this.$store.getters["session/get"]("isLogin")) {
if (process.client) {
this.$message.warning('请登录');
this.$message.warning("请登录");
window.setTimeout(() => {
this.headerTologin();
}, 1000);
......@@ -404,29 +432,29 @@ export default {
} else {
if (this.loading) return;
if (!this.item.firstPost.canLike) {
this.$message.error(this.$t('topic.noThreadLikePermission'));
this.$message.error(this.$t("topic.noThreadLikePermission"));
return;
}
this.loading = true;
const isLiked = !this.isLiked;
const params = {
_jv: {
type: 'posts',
type: "posts",
id:
this.item.firstPost
&& this.item.firstPost._jv
&& this.item.firstPost._jv.id
this.item.firstPost &&
this.item.firstPost._jv &&
this.item.firstPost._jv.id,
},
isLiked
isLiked,
};
return this.$store
.dispatch('jv/patch', params)
.dispatch("jv/patch", params)
.then(
() => {
this.$message.success(
isLiked
? this.$t('discuzq.msgBox.likeSuccess')
: this.$t('discuzq.msgBox.cancelLikeSuccess')
? this.$t("discuzq.msgBox.likeSuccess")
: this.$t("discuzq.msgBox.cancelLikeSuccess")
);
if (isLiked) {
this.likeCount += 1;
......@@ -434,9 +462,9 @@ export default {
this.likeCount -= 1;
}
this.isLiked = isLiked;
this.$emit('change');
this.$emit("change");
},
e => {
(e) => {
this.handleError(e);
}
)
......@@ -463,11 +491,11 @@ export default {
} else {
// 由于使用长列表的优化的插件后,transform里面不能有fixed
if (
this.$route.path === '/'
|| this.$route.path === '/site/search'
|| this.$route.name === 'category-id'
this.$route.path === "/" ||
this.$route.path === "/site/search" ||
this.$route.name === "category-id"
) {
this.$emit('showVideoFn', this.item.threadVideo);
this.$emit("showVideoFn", this.item.threadVideo);
} else {
this.showVideoPop = true;
}
......@@ -475,33 +503,40 @@ export default {
},
// 详情路由
routerLink() {
window.open(`/thread/${this.item._jv && this.item._jv.id}`, '_blank');
if (!!this.fileid) {
window.open(
`/knowledge/knowledgeDetail?id=${this.fileid}&useid=${this.qywxUserid}`,
"_blank"
);
} else {
window.open(`/thread/${this.item._jv && this.item._jv.id}`, "_blank");
}
},
// 点击正文,使用事件委托判断a标签
onClickContent(e) {
const event = e || window.event;
const target = event.target || event.srcElement;
if (target.nodeName.toLocaleLowerCase() !== 'a') {
if (target.nodeName.toLocaleLowerCase() !== "a") {
this.toDetail();
}
},
// 是否有查看详情的权限
canViewPostsFn() {
if (!this.item.canViewPosts) {
if (!this.$store.getters['session/get']('isLogin')) {
if (!this.$store.getters["session/get"]("isLogin")) {
if (process.client) {
this.$message.warning(this.$t('core.not_authenticated'));
this.$message.warning(this.$t("core.not_authenticated"));
window.setTimeout(() => {
this.headerTologin();
}, 1000);
}
} else {
this.$message.warning(this.$t('home.noPostingTopic'));
this.$message.warning(this.$t("home.noPostingTopic"));
}
return false;
}
if (this.canDetail) {
this.$message.warning(this.$t('topic.joinAfterView'));
this.$message.warning(this.$t("topic.joinAfterView"));
return false;
}
return true;
......@@ -514,7 +549,7 @@ export default {
extensionValidate(extension) {
return extensionList.indexOf(extension.toUpperCase()) > 0
? extension.toUpperCase()
: 'UNKNOWN';
: "UNKNOWN";
},
// 语音播放
play(file) {
......@@ -535,11 +570,11 @@ export default {
this.currentAudio.audio.play();
this.currentAudio.isPlay = true;
this.currentAudio.audio.addEventListener(
'timeupdate',
"timeupdate",
this.onProgressing
);
this.currentAudio.audio.addEventListener('ended', this.onEnded);
this.$emit('audioPlay', this.currentAudio.id);
this.currentAudio.audio.addEventListener("ended", this.onEnded);
this.$emit("audioPlay", this.currentAudio.id);
}, 0);
},
// 进度的展示
......@@ -555,11 +590,11 @@ export default {
},
// 初始化audio
resetAudio(audio) {
audio.removeEventListener('timeupdate', this.onProgressing);
audio.removeEventListener('ended', this.onEnded);
audio.removeEventListener("timeupdate", this.onProgressing);
audio.removeEventListener("ended", this.onEnded);
this.currentAudio.isPlay = false;
this.currentAudio.duration = '';
this.currentAudio.currentTime = '';
this.currentAudio.duration = "";
this.currentAudio.currentTime = "";
},
// 暂停
pause() {
......@@ -577,8 +612,8 @@ export default {
seeking(time) {
this.currentAudio.seeking = true;
this.currentAudio.currentTime = time;
}
}
},
},
};
</script>
<style lang="scss" scoped>
......
......@@ -291,12 +291,16 @@ export default {
// this.data = res.data.result;
this.data = this.deleteChildren(res.data.result);
this.loading = false;
if (this.data.length == 1) {
if (this.data[0].file) {
if(!!this.data)
{
let file=this.data.filter(item => item.file==true);
if(!!file)
{
// 触发点击事件
this.handleNodeClick(this.data[0]);
this.handleNodeClick(file[0]);
}
}
});
if (Object.keys(this.thread).length === 0) this.getThread();
else this.initData();
......@@ -333,7 +337,6 @@ export default {
window.open(this.fileSrc, '_blank');
},
handleNodeClick(data) {
console.log(data);
self = this;
if (data.file) {
this.showViewloading = true;
......@@ -368,7 +371,6 @@ export default {
console.log(this.threadId, 3232);
}
this.fileMd5 = data.md5;
console.log(this.threadId, '我是父组件');
});
}
},
......@@ -693,7 +695,7 @@ export default {
}
}
&-right {
width: 865px;
width: 867px;
background: #fff;
margin-left: 9px;
padding: 20px;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment