Commit 7f3dba8f by zhangzhongjie
parents aff28358 fc7813e9
...@@ -8,19 +8,19 @@ ...@@ -8,19 +8,19 @@
</div> </div>
</template> </template>
<script> <script>
const QRCode = process.client && require('qrcodejs2'); const QRCode = process.client && require("qrcodejs2");
export default { export default {
name: 'Advertising', name: "Advertising",
data() { data() {
return { return {
qrcode: null, qrcode: null,
siteName: '' siteName: "",
}; };
}, },
computed: { computed: {
forums() { forums() {
return this.$store.state.site.info.attributes || {}; return this.$store.state.site.info.attributes || {};
} },
}, },
watch: { watch: {
forums: { forums: {
...@@ -28,17 +28,17 @@ export default { ...@@ -28,17 +28,17 @@ export default {
if (val && val.set_site) { if (val && val.set_site) {
this.siteName = val.set_site.site_name this.siteName = val.set_site.site_name
? val.set_site.site_name ? val.set_site.site_name
: 'Discuz! Q'; : "Discuz! Q";
} }
}, },
deep: true deep: true,
} },
}, },
mounted() { mounted() {
this.siteName this.siteName =
= this.forums && this.forums.set_site && this.forums.set_site.site_name this.forums && this.forums.set_site && this.forums.set_site.site_name
? this.forums.set_site.site_name ? this.forums.set_site.site_name
: 'Discuz! Q'; : "Discuz! Q";
this.createQrcode(window.location.href); this.createQrcode(window.location.href);
}, },
destroyed() { destroyed() {
...@@ -52,18 +52,21 @@ export default { ...@@ -52,18 +52,21 @@ export default {
* createQrcode('https://xxx.com/') * createQrcode('https://xxx.com/')
*/ */
createQrcode(link) { createQrcode(link) {
if (link == "http://wiki.bailuntec.com/category") {
link = "http://wiki.bailuntec.com/";
}
if (process.client) { if (process.client) {
this.qrcode = null; this.qrcode = null;
this.$nextTick(() => { this.$nextTick(() => {
this.qrcode = new QRCode(this.$refs.qrcode, { this.qrcode = new QRCode(this.$refs.qrcode, {
width: 70, width: 70,
height: 70, // 高度 height: 70, // 高度
text: link // 二维码内容 text: link, // 二维码内容
}); });
}); });
} }
} },
} },
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -220,6 +220,7 @@ export default { ...@@ -220,6 +220,7 @@ export default {
}); });
resData.categoryData = _categoryData; resData.categoryData = _categoryData;
} }
if (Array.isArray(recommendUser)) { if (Array.isArray(recommendUser)) {
resData.recommendUserData = recommendUser; resData.recommendUserData = recommendUser;
} else if (recommendUser && recommendUser._jv && recommendUser._jv.json) { } else if (recommendUser && recommendUser._jv && recommendUser._jv.json) {
...@@ -281,6 +282,8 @@ export default { ...@@ -281,6 +282,8 @@ export default {
} }
}, },
mounted() { mounted() {
//var isMobile = window.navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i); // 是否手机端
if (this.$route.params.id) { if (this.$route.params.id) {
this.categoryId = this.$route.params.id; this.categoryId = this.$route.params.id;
this.getCategoryList(); this.getCategoryList();
...@@ -306,6 +309,10 @@ export default { ...@@ -306,6 +309,10 @@ export default {
clearInterval(this.timer); clearInterval(this.timer);
}, },
methods: { methods: {
_isMobile(){
let flag = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)
return flag;
},
// 置顶主题 // 置顶主题
getThreadsSticky() { getThreadsSticky() {
this.threadsStickyData = []; this.threadsStickyData = [];
...@@ -394,6 +401,7 @@ export default { ...@@ -394,6 +401,7 @@ export default {
}); });
}, },
// 获取分类列表 用于head title显示 // 获取分类列表 用于head title显示
getCategoryList() { getCategoryList() {
this.$store.dispatch('jv/get', ['categories', {}]).then( this.$store.dispatch('jv/get', ['categories', {}]).then(
res => { res => {
...@@ -402,6 +410,7 @@ export default { ...@@ -402,6 +410,7 @@ export default {
const currentCategory = resData.find(item => { const currentCategory = resData.find(item => {
return item._jv && +item._jv.id === +this.categoryId; return item._jv && +item._jv.id === +this.categoryId;
}); });
if (currentCategory) { if (currentCategory) {
this.title = currentCategory.name; this.title = currentCategory.name;
} }
...@@ -503,7 +512,12 @@ export default { ...@@ -503,7 +512,12 @@ export default {
this.threadVideo = video; this.threadVideo = video;
this.showVideoPop = true; this.showVideoPop = true;
} }
} },
head() {
return {
title: "百伦维基论坛",
};
},
}; };
</script> </script>
......
...@@ -39,20 +39,20 @@ export default { ...@@ -39,20 +39,20 @@ export default {
userInfo: "", userInfo: "",
qywxUserid: "", qywxUserid: "",
loading: false, loading: false,
knowledgeList: [] knowledgeList: [],
}; };
}, },
computed: {}, computed: {},
mounted() { mounted() {
const params = { const params = {
include: "groups,wechat" include: "groups,wechat",
}; };
if (!this.userId) { if (!this.userId) {
this.getCode(); this.getCode();
} }
this.$store this.$store
.dispatch("jv/get", [`users/${this.userId}`, { params }]) .dispatch("jv/get", [`users/${this.userId}`, { params }])
.then(res => { .then((res) => {
this.userInfo = JSON.parse(res.wechat_info); this.userInfo = JSON.parse(res.wechat_info);
this.qywxUserid = this.userInfo.userid; this.qywxUserid = this.userInfo.userid;
if (!this.qywxUserid) { if (!this.qywxUserid) {
...@@ -64,22 +64,29 @@ export default { ...@@ -64,22 +64,29 @@ export default {
.get( .get(
`${config.WEI_PAN_URL}/weipan/getfirstfilelist?userId=${this.qywxUserid}` `${config.WEI_PAN_URL}/weipan/getfirstfilelist?userId=${this.qywxUserid}`
) )
.then(res => { .then((res) => {
if (res.data.result.file_list != null) { if (res.data.result.file_list != null) {
const filelist = res.data.result.file_list.item; const filelist = res.data.result.file_list.item;
this.knowledgeList = []; this.knowledgeList = [];
filelist.forEach(element => { filelist.forEach((element) => {
if (element.file_status == "1") { if (element.file_status == "1") {
var date=element.ctime.split(' ')[0].split("/")[2]+'/'+element.ctime.split(' ')[0].split("/")[1]+'/'+element.ctime.split(' ')[0].split("/")[0]+' '+element.ctime.split(' ')[1]; var date =
element.ctime.split(" ")[0].split("/")[2] +
"/" +
element.ctime.split(" ")[0].split("/")[1] +
"/" +
element.ctime.split(" ")[0].split("/")[0] +
" " +
element.ctime.split(" ")[1];
const knowledge = { const knowledge = {
title: element.file_name, title: element.file_name,
name: element.create_user_name, name: element.create_user_name,
time: date, time: date,
fileid: element.fileid, fileid: element.fileid,
fatherid: element.fatherid, fatherid: element.fatherid,
filetype: element.file_type filetype: element.file_type,
}; };
this.knowledgeList.push(knowledge); this.knowledgeList.push(knowledge);
} }
...@@ -92,7 +99,7 @@ export default { ...@@ -92,7 +99,7 @@ export default {
}); });
}); });
}, },
methods: { methods: {
getCode() { getCode() {
if (!this.userInfo) { if (!this.userInfo) {
let ua = window.navigator.userAgent.toLowerCase(); let ua = window.navigator.userAgent.toLowerCase();
...@@ -102,7 +109,7 @@ export default { ...@@ -102,7 +109,7 @@ export default {
) { ) {
// 静默授权 // 静默授权
//const code = this.getUrlParam("code"); // 截取路径中的code,如果没有就去微信授权,如果已经获取到了就直接传code给后台获取openId //const code = this.getUrlParam("code"); // 截取路径中的code,如果没有就去微信授权,如果已经获取到了就直接传code给后台获取openId
const local = "http://discuz.bailuntec.com/user/login"; const local = "http://wiki.bailuntec.com/user/login";
const APPID = "ww833808f6b8dc0745"; // 企业微信 const APPID = "ww833808f6b8dc0745"; // 企业微信
window.location.href = window.location.href =
"https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" +
...@@ -110,9 +117,9 @@ export default { ...@@ -110,9 +117,9 @@ export default {
"&redirect_uri=" + "&redirect_uri=" +
encodeURIComponent(local) + encodeURIComponent(local) +
"&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"; "&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect";
}else{ } else {
this.$message.warning(`请先登录`); this.$message.warning(`请先登录`);
} }
} }
}, },
knowledgeDetail(fileid, fatherid) { knowledgeDetail(fileid, fatherid) {
...@@ -121,11 +128,16 @@ export default { ...@@ -121,11 +128,16 @@ export default {
query: { query: {
id: fileid, id: fileid,
fatherid: fatherid, fatherid: fatherid,
useid: this.qywxUserid useid: this.qywxUserid,
} },
}); });
} },
} },
head() {
return {
title: "知识库",
};
},
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
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