Commit 31465e4a by xiongyuwen

no message

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