Commit 7f3dba8f by zhangzhongjie
parents aff28358 fc7813e9
......@@ -8,19 +8,19 @@
</div>
</template>
<script>
const QRCode = process.client && require('qrcodejs2');
const QRCode = process.client && require("qrcodejs2");
export default {
name: 'Advertising',
name: "Advertising",
data() {
return {
qrcode: null,
siteName: ''
siteName: "",
};
},
computed: {
forums() {
return this.$store.state.site.info.attributes || {};
}
},
},
watch: {
forums: {
......@@ -28,17 +28,17 @@ export default {
if (val && val.set_site) {
this.siteName = val.set_site.site_name
? val.set_site.site_name
: 'Discuz! Q';
: "Discuz! Q";
}
},
deep: true
}
deep: true,
},
},
mounted() {
this.siteName
= this.forums && this.forums.set_site && this.forums.set_site.site_name
this.siteName =
this.forums && this.forums.set_site && this.forums.set_site.site_name
? this.forums.set_site.site_name
: 'Discuz! Q';
: "Discuz! Q";
this.createQrcode(window.location.href);
},
destroyed() {
......@@ -52,18 +52,21 @@ export default {
* createQrcode('https://xxx.com/')
*/
createQrcode(link) {
if (link == "http://wiki.bailuntec.com/category") {
link = "http://wiki.bailuntec.com/";
}
if (process.client) {
this.qrcode = null;
this.$nextTick(() => {
this.qrcode = new QRCode(this.$refs.qrcode, {
width: 70,
height: 70, // 高度
text: link // 二维码内容
text: link, // 二维码内容
});
});
}
}
}
},
},
};
</script>
<style lang="scss" scoped>
......
......@@ -220,6 +220,7 @@ export default {
});
resData.categoryData = _categoryData;
}
if (Array.isArray(recommendUser)) {
resData.recommendUserData = recommendUser;
} else if (recommendUser && recommendUser._jv && recommendUser._jv.json) {
......@@ -281,6 +282,8 @@ export default {
}
},
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) {
this.categoryId = this.$route.params.id;
this.getCategoryList();
......@@ -306,6 +309,10 @@ export default {
clearInterval(this.timer);
},
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() {
this.threadsStickyData = [];
......@@ -394,6 +401,7 @@ export default {
});
},
// 获取分类列表 用于head title显示
getCategoryList() {
this.$store.dispatch('jv/get', ['categories', {}]).then(
res => {
......@@ -402,6 +410,7 @@ export default {
const currentCategory = resData.find(item => {
return item._jv && +item._jv.id === +this.categoryId;
});
if (currentCategory) {
this.title = currentCategory.name;
}
......@@ -503,7 +512,12 @@ export default {
this.threadVideo = video;
this.showVideoPop = true;
}
}
},
head() {
return {
title: "百伦维基论坛",
};
},
};
</script>
......
......@@ -39,20 +39,20 @@ export default {
userInfo: "",
qywxUserid: "",
loading: false,
knowledgeList: []
knowledgeList: [],
};
},
computed: {},
mounted() {
const params = {
include: "groups,wechat"
include: "groups,wechat",
};
if (!this.userId) {
this.getCode();
}
this.$store
.dispatch("jv/get", [`users/${this.userId}`, { params }])
.then(res => {
.then((res) => {
this.userInfo = JSON.parse(res.wechat_info);
this.qywxUserid = this.userInfo.userid;
if (!this.qywxUserid) {
......@@ -64,22 +64,29 @@ export default {
.get(
`${config.WEI_PAN_URL}/weipan/getfirstfilelist?userId=${this.qywxUserid}`
)
.then(res => {
.then((res) => {
if (res.data.result.file_list != null) {
const filelist = res.data.result.file_list.item;
this.knowledgeList = [];
filelist.forEach(element => {
filelist.forEach((element) => {
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 = {
title: element.file_name,
name: element.create_user_name,
time: date,
fileid: element.fileid,
fatherid: element.fatherid,
filetype: element.file_type
filetype: element.file_type,
};
this.knowledgeList.push(knowledge);
}
......@@ -92,7 +99,7 @@ export default {
});
});
},
methods: {
methods: {
getCode() {
if (!this.userInfo) {
let ua = window.navigator.userAgent.toLowerCase();
......@@ -102,7 +109,7 @@ export default {
) {
// 静默授权
//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"; // 企业微信
window.location.href =
"https://open.weixin.qq.com/connect/oauth2/authorize?appid=" +
......@@ -110,9 +117,9 @@ export default {
"&redirect_uri=" +
encodeURIComponent(local) +
"&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect";
}else{
this.$message.warning(`请先登录`);
}
} else {
this.$message.warning(`请先登录`);
}
}
},
knowledgeDetail(fileid, fatherid) {
......@@ -121,11 +128,16 @@ export default {
query: {
id: fileid,
fatherid: fatherid,
useid: this.qywxUserid
}
useid: this.qywxUserid,
},
});
}
}
},
},
head() {
return {
title: "知识库",
};
},
};
</script>
<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