From 2d19b97394113a9a097dc53ef09c5b7c3b971c30 Mon Sep 17 00:00:00 2001 From: NiZerin98 Date: Wed, 18 Sep 2019 16:52:59 +0800 Subject: [PATCH 1/2] Update project.config.json --- project.config.json | 116 ++++++++++++++++++++++---------------------- 1 file changed, 58 insertions(+), 58 deletions(-) diff --git a/project.config.json b/project.config.json index 2aba65c..fcf8b46 100644 --- a/project.config.json +++ b/project.config.json @@ -1,60 +1,60 @@ { - "description": "项目配置文件。", - "setting": { - "urlCheck": true, - "es6": true, - "postcss": true, - "minified": true, - "newFeature": true, - "nodeModules": false, - "autoAudits": false, - "uglifyFileName": true - }, - "compileType": "miniprogram", - "libVersion": "2.6.2", - "appid": "wxea3b3b52ffe574f2", - "projectname": "PHP%E5%BC%80%E6%BA%90Hub", - "simulatorType": "wechat", - "simulatorPluginLibVersion": {}, - "condition": { - "search": { - "current": -1, - "list": [ - { - "name": "test", - "pathName": "", - "title": "", - "cacheKey": "" - } - ] - }, - "conversation": { - "current": 0, - "list": [ - { - "name": "test", - "query": "", - "boxQI": "", - "service": {} - } - ] - }, - "plugin": { - "current": -1, - "list": [] - }, - "game": { - "list": [] - }, - "miniprogram": { - "current": 0, - "list": [ - { - "id": -1, - "name": "更新模式", - "pathName": "pages/index/index" - } - ] - } - } + "description": "项目配置文件。", + "setting": { + "urlCheck": true, + "es6": true, + "postcss": true, + "minified": true, + "newFeature": true, + "nodeModules": false, + "autoAudits": false, + "uglifyFileName": true + }, + "compileType": "miniprogram", + "libVersion": "2.6.2", + "appid": "wxea3b3b52ffe574f2", + "projectname": "PHP%E5%BC%80%E6%BA%90Hub", + "simulatorType": "wechat", + "simulatorPluginLibVersion": {}, + "condition": { + "search": { + "current": -1, + "list": [ + { + "name": "test", + "pathName": "", + "title": "", + "cacheKey": "" + } + ] + }, + "conversation": { + "current": 0, + "list": [ + { + "name": "test", + "query": "", + "boxQI": "", + "service": {} + } + ] + }, + "plugin": { + "current": -1, + "list": [] + }, + "game": { + "list": [] + }, + "miniprogram": { + "current": 0, + "list": [ + { + "id": -1, + "name": "更新模式", + "pathName": "pages/index/index" + } + ] + } + } } \ No newline at end of file From 4a9e677b440abe8d04a8e894226648aa64c5f193 Mon Sep 17 00:00:00 2001 From: NiZerin98 Date: Wed, 18 Sep 2019 18:34:19 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E5=B9=BF=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/about/about.js | 364 ++++++++++++++++++++------------------- pages/about/about.wxss | 3 + pages/detail/detail.wxml | 4 +- 3 files changed, 196 insertions(+), 175 deletions(-) diff --git a/pages/about/about.js b/pages/about/about.js index 1c3fc54..89cd9dd 100644 --- a/pages/about/about.js +++ b/pages/about/about.js @@ -18,29 +18,46 @@ var wxRequest = require('../../utils/wxRequest.js') var Auth = require('../../utils/auth.js'); import config from '../../utils/config.js' var app = getApp(); - +let interstitialAd = null Page({ + data: { title: '页面内容', pageData: {}, pagesList: {}, display: 'none', wxParseData: [], - praiseList:[], + praiseList: [], dialog: { - title: '', - content: '', - hidden: true + title: '', + content: '', + hidden: true }, userInfo: {}, isLoginPopup: false, - openid:"", - system:"" - - + openid: "", + system: "" + + }, onLoad: function (options) { + if (wx.createInterstitialAd) { + interstitialAd = wx.createInterstitialAd({ adUnitId: 'adunit-9fa574b054c9be1c' }) + interstitialAd.onLoad(() => { + console.log('onLoad event emit') + }) + interstitialAd.onError((err) => { + console.log('onError event emit', err) + }) + interstitialAd.onClose((res) => { + console.log('onClose event emit', res) + }) + interstitialAd.show().catch((err) => { + console.error(err) + }) + } + var self = this; wx.setNavigationBarTitle({ title: config.getWebsiteName + '-关于站长', @@ -48,59 +65,59 @@ Page({ // success } }); - Auth.setUserInfoData(self); + Auth.setUserInfoData(self); Auth.checkLogin(self); this.fetchData(config.getAboutId); wx.getSystemInfo({ - success: function (t) { - var system = t.system.indexOf('iOS') != -1 ? 'iOS' : 'Android'; - self.setData({ system: system }); + success: function (t) { + var system = t.system.indexOf('iOS') != -1 ? 'iOS' : 'Android'; + self.setData({ system: system }); - } - }) + } + }) }, - praise: function () { - - var self = this; - var minAppType = config.getMinAppType; - var system =self.data.system; - if (minAppType == "0" && system=='Android') { - if (self.data.openid) { - wx.navigateTo({ - url: '../pay/pay?flag=2&openid=' + self.data.openid + '&postid=' + config.getAboutId - }) - } - else { - Auth.checkSession(self,'isLoginNow'); - } + praise: function () { + + var self = this; + var minAppType = config.getMinAppType; + var system = self.data.system; + if (minAppType == "0" && system == 'Android') { + if (self.data.openid) { + wx.navigateTo({ + url: '../pay/pay?flag=2&openid=' + self.data.openid + '&postid=' + config.getAboutId + }) } else { + Auth.checkSession(self, 'isLoginNow'); + } + } + else { - var src = config.getZanImageUrl; - wx.previewImage({ - urls: [src], - }); + var src = config.getZanImageUrl; + wx.previewImage({ + urls: [src], + }); + + } - } - }, onPullDownRefresh: function () { - var self = this; - self.setData({ - display:'none' , - pageData:{}, - wxParseData:{}, + var self = this; + self.setData({ + display: 'none', + pageData: {}, + wxParseData: {}, - }); + }); - this.fetchData(config.getAboutId); - //消除下刷新出现空白矩形的问题。 - wx.stopPullDownRefresh() + this.fetchData(config.getAboutId); + //消除下刷新出现空白矩形的问题。 + wx.stopPullDownRefresh() - }, + }, onShareAppMessage: function () { return { - title: '关于“' + config.getWebsiteName +'”官方小程序', + title: '关于“' + config.getWebsiteName + '”官方小程序', path: 'pages/about/about', success: function (res) { // 转发成功 @@ -110,166 +127,165 @@ Page({ } } }, - gotowebpage:function() - { - var self=this; - var minAppType = config.getMinAppType; - var url = ''; - if (minAppType == "0") { - url = '../webpage/webpage?'; - wx.navigateTo({ - url: url - }) - } - else { - self.copyLink(config.getDomain); - } + gotowebpage: function () { + var self = this; + var minAppType = config.getMinAppType; + var url = ''; + if (minAppType == "0") { + url = '../webpage/webpage?'; + wx.navigateTo({ + url: url + }) + } + else { + self.copyLink(config.getDomain); + } }, - copyLink: function (url) { - //this.ShowHideMenu(); - wx.setClipboardData({ - data: url, - success: function (res) { - wx.getClipboardData({ - success: function (res) { - wx.showToast({ - title: '链接已复制', - image: '../../images/link.png', - duration: 2000 - }) - } - }) - } + copyLink: function (url) { + //this.ShowHideMenu(); + wx.setClipboardData({ + data: url, + success: function (res) { + wx.getClipboardData({ + success: function (res) { + wx.showToast({ + title: '链接已复制', + image: '../../images/link.png', + duration: 2000 + }) + } }) - }, + } + }) + }, //给a标签添加跳转和复制链接事件 wxParseTagATap: function (e) { - var self = this; - var href = e.currentTarget.dataset.src; - console.log(href); - var domain = config.getDomain; - //我们可以在这里进行一些路由处理 - if (href.indexOf(domain) == -1) { - wx.setClipboardData({ - data: href, - success: function (res) { - wx.getClipboardData({ - success: function (res) { - wx.showToast({ - title: '链接已复制', - //icon: 'success', - image: '../../images/link.png', - duration: 2000 - }) - } - }) - } + var self = this; + var href = e.currentTarget.dataset.src; + console.log(href); + var domain = config.getDomain; + //我们可以在这里进行一些路由处理 + if (href.indexOf(domain) == -1) { + wx.setClipboardData({ + data: href, + success: function (res) { + wx.getClipboardData({ + success: function (res) { + wx.showToast({ + title: '链接已复制', + //icon: 'success', + image: '../../images/link.png', + duration: 2000 + }) + } }) + } + }) + } + else { + + var slug = util.GetUrlFileName(href, domain); + if (slug == 'index') { + wx.switchTab({ + url: '../index/index' + }) } else { - - var slug = util.GetUrlFileName(href, domain); - if (slug == 'index') { - wx.switchTab({ - url: '../index/index' + var getPostSlugRequest = wxRequest.getRequest(Api.getPostBySlug(slug)); + getPostSlugRequest + .then(res => { + var postID = res.data[0].id; + var openLinkCount = wx.getStorageSync('openLinkCount') || 0; + if (openLinkCount > 4) { + wx.redirectTo({ + url: '../detail/detail?id=' + postID }) - } - else { - var getPostSlugRequest = wxRequest.getRequest(Api.getPostBySlug(slug)); - getPostSlugRequest - .then(res => { - var postID = res.data[0].id; - var openLinkCount = wx.getStorageSync('openLinkCount') || 0; - if (openLinkCount > 4) { - wx.redirectTo({ - url: '../detail/detail?id=' + postID - }) - } - else { - wx.navigateTo({ - url: '../detail/detail?id=' + postID - }) - openLinkCount++; - wx.setStorageSync('openLinkCount', openLinkCount); - } - - }) + } + else { + wx.navigateTo({ + url: '../detail/detail?id=' + postID + }) + openLinkCount++; + wx.setStorageSync('openLinkCount', openLinkCount); + } - } + }) } + } + }, agreeGetUser: function (e) { - var userInfo = e.detail.userInfo; - var self = this; - if (userInfo) { - auth.getUsreInfo(e.detail); - self.setData({ userInfo: userInfo }); - } - setTimeout(function () { - self.setData({ isLoginPopup: false }) - }, 1200); + var userInfo = e.detail.userInfo; + var self = this; + if (userInfo) { + auth.getUsreInfo(e.detail); + self.setData({ userInfo: userInfo }); + } + setTimeout(function () { + self.setData({ isLoginPopup: false }) + }, 1200); }, closeLoginPopup() { - this.setData({ isLoginPopup: false }); + this.setData({ isLoginPopup: false }); }, openLoginPopup() { - this.setData({ isLoginPopup: true }); + this.setData({ isLoginPopup: true }); } - , + , fetchData: function (id) { - var self = this; + var self = this; var getPageRequest = wxRequest.getRequest(Api.getPageByID(id)); - getPageRequest.then(response =>{ - console.log(response); - WxParse.wxParse('article', 'html', response.data.content.rendered, self, 5); + getPageRequest.then(response => { + console.log(response); + WxParse.wxParse('article', 'html', response.data.content.rendered, self, 5); - self.setData({ - pageData: response.data, - // wxParseData: WxParse('md',response.data.content.rendered) - //wxParseData: WxParse.wxParse('article', 'html', response.data.content.rendered, self, 5) - }); - self.setData({ - display: 'block' - }); - - - }).then(res =>{ - var getAllPraiseRequest = wxRequest.getRequest(Api.getAllPraiseUrl()); - getAllPraiseRequest.then(response =>{ + self.setData({ + pageData: response.data, + // wxParseData: WxParse('md',response.data.content.rendered) + //wxParseData: WxParse.wxParse('article', 'html', response.data.content.rendered, self, 5) + }); + self.setData({ + display: 'block' + }); - if (response.data.status == '200') { - var _avatarurls = response.data.avatarurls; - var avatarurls = []; - for (var i = 0; i < _avatarurls.length; i++) { - var avatarurl = "../../images/gravatar.png"; - if (_avatarurls[i].avatarurl.indexOf('wx.qlogo.cn') != -1) { - avatarurl = _avatarurls[i].avatarurl; - } - avatarurls[i] = avatarurl; - } - - self.setData({ - praiseList: avatarurls - }); + }).then(res => { + var getAllPraiseRequest = wxRequest.getRequest(Api.getAllPraiseUrl()); + getAllPraiseRequest.then(response => { + if (response.data.status == '200') { + + var _avatarurls = response.data.avatarurls; + var avatarurls = []; + for (var i = 0; i < _avatarurls.length; i++) { + var avatarurl = "../../images/gravatar.png"; + if (_avatarurls[i].avatarurl.indexOf('wx.qlogo.cn') != -1) { + avatarurl = _avatarurls[i].avatarurl; } - else { - console.log(response); - } + avatarurls[i] = avatarurl; + } + self.setData({ + praiseList: avatarurls + }); + + } + else { + console.log(response); + } - }) - }) - .then(res =>{ + }) + + }) + .then(res => { if (!app.globalData.isGetOpenid) { - // auth.getUsreInfo(); + // auth.getUsreInfo(); } - }) + }) } }) \ No newline at end of file diff --git a/pages/about/about.wxss b/pages/about/about.wxss index a027da6..a2eb9ae 100644 --- a/pages/about/about.wxss +++ b/pages/about/about.wxss @@ -15,6 +15,9 @@ padding: 5rpx; } +.adContainer { +} + .excerpt{ color:#626262; font-size:32rpx; diff --git a/pages/detail/detail.wxml b/pages/detail/detail.wxml index e9bbbb5..fd6a8f7 100644 --- a/pages/detail/detail.wxml +++ b/pages/detail/detail.wxml @@ -159,10 +159,12 @@ + + +