diff --git a/client/pages/docker/summary/index.ts b/client/pages/docker/summary/index.ts index 0a57ec0..ddcd869 100644 --- a/client/pages/docker/summary/index.ts +++ b/client/pages/docker/summary/index.ts @@ -435,4 +435,10 @@ Page({ 'https://gitee.com/docker_practice/docker_practice/raw/master/_images/cover.jpg', }; }, + onTabItemTap(item) { + // tab 点击时执行 + console.log(item.index); + console.log(item.pagePath); + console.log(item.text); + }, }); diff --git a/client/pages/mdContent/index.ts b/client/pages/mdContent/index.ts index a4d2315..9afdc2d 100644 --- a/client/pages/mdContent/index.ts +++ b/client/pages/mdContent/index.ts @@ -1,10 +1,13 @@ // pages/mdContent/index.js import isqq from '../../src/utils/isqq'; +import Cache from '../../src/Framework/src/Support/Cache'; let key: any = null; +let title: any; let toDoActivityId: any; let expirationTime: any; +let cache = new Cache(); Page({ /** @@ -15,17 +18,55 @@ Page({ ? ['f2ba7917096dc03c7d798df304a90c49', 'a4f45b9d8d5704ab70bebfd0780854a8'] : ['adunit-3ea71b7cfce6c721', 'adunit-1246f0a5e441ea4c'], markdown: '', + openGId: null, }, /** * 生命周期函数--监听页面加载 */ onLoad: async function (options) { + console.log(JSON.stringify(options)); + key = options.key; + title = options.title; // 1585976131 const { activityId, expirationTime } = options; + toDoActivityId = null; - console.log(JSON.stringify(options)); + let { shareTicket } = wx.getLaunchOptionsSync(); + + console.log('shareTicket: ' + shareTicket); + console.log('activityId: ' + activityId); + + if (activityId && shareTicket) { + wx.showModal({ + title: '欢迎从群聊中进入', + content: '您的每次进入,都会增加所在群的排名', + showCancel: false, + }); + + wx.getShareInfo({ + shareTicket, + success: async (res) => { + let { cloudID } = res; + + let result = await wx.cloud.callFunction({ + name: 'getGroup', + data: { + // @ts-ignore + group: wx.cloud.CloudID(cloudID), // 这个 CloudID 值到云函数端会被替换 + }, + }); + + console.log(result); + + this.setData({ + // @ts-ignore + openGId: result.result, + }); + }, + }); + } wx.request({ url: @@ -39,10 +80,49 @@ Page({ }, }); + // 插屏广告 + if ((await cache.get('is-news-show-ad')) !== 'true') { + let interstitialAd = wx.createInterstitialAd({ + adUnitId: isqq + ? 'b9b0567ae11780a9f7886b61683c1ae2' + : 'adunit-6ef44789d84b9392', + }); + + setTimeout(() => { + interstitialAd.show().then( + () => { + console.log('S 插屏广告 success'); + cache.set('is-news-show-ad', 'true', 120); + }, + (e) => { + console.log('E 插屏广告 error: ' + JSON.stringify(e)); + }, + ); + }, 15000); + + interstitialAd.onError((e) => { + console.log('E 插屏广告 onerror: ' + JSON.stringify(e)); + }); + + interstitialAd.onLoad(() => { + console.log('L 插屏广告 onload'); + }); + + interstitialAd.onClose(() => { + console.log('X 插屏广告 onclose'); + }); + } else { + console.log('120s 之内不再展示广告'); + } // if end + if (!activityId) { return; } + if (activityId === 'null') { + return; + } + // @ts-ignore if (Date.parse(new Date()) / 1000 > expirationTime) { wx.showModal({ @@ -83,6 +163,10 @@ Page({ console.log(result); }, + onUnLoad() { + toDoActivityId = null; + }, + /** * 生命周期函数--监听页面初次渲染完成 */ @@ -158,8 +242,8 @@ Page({ onShareAppMessage(): any { return { - title: '今日分享', - path: `pages/mdContent/index?key=${key}&activityId=${toDoActivityId}&expirationTime=${expirationTime}`, + title: '今日分享 -- ' + title, + path: `pages/mdContent/index?key=${key}&title=${title}&activityId=${toDoActivityId}&expirationTime=${expirationTime}`, imageUrl: 'https://gitee.com/docker_practice/docker_practice/raw/master/_images/cover.jpg', }; diff --git a/client/pages/mdContent/index.wxml b/client/pages/mdContent/index.wxml index 509b42d..b3a1128 100644 --- a/client/pages/mdContent/index.wxml +++ b/client/pages/mdContent/index.wxml @@ -1,2 +1,7 @@ 群内学习 + + + diff --git a/client/pages/news/index.ts b/client/pages/news/index.ts index 99627c3..ab2f95d 100644 --- a/client/pages/news/index.ts +++ b/client/pages/news/index.ts @@ -127,9 +127,9 @@ Page({ click(res: any) { a = 1; console.log(res); - const key = res.currentTarget.dataset.key; + const { key, title } = res.currentTarget.dataset; wx.navigateTo({ - url: '../mdContent/index?key=' + key, + url: `../mdContent/index?key=${key}&title=${title}`, }); }, }); diff --git a/client/pages/news/index.wxml b/client/pages/news/index.wxml index 99662df..b3d6615 100644 --- a/client/pages/news/index.wxml +++ b/client/pages/news/index.wxml @@ -4,7 +4,7 @@ - + {{item.title}} {{item.title}} {{item.date}} diff --git a/functions/getGroup/config.json b/functions/getGroup/config.json new file mode 100644 index 0000000..16348ce --- /dev/null +++ b/functions/getGroup/config.json @@ -0,0 +1,5 @@ +{ + "permissions": { + "openapi": [] + } +} diff --git a/functions/getGroup/index.js b/functions/getGroup/index.js new file mode 100644 index 0000000..2c93b6b --- /dev/null +++ b/functions/getGroup/index.js @@ -0,0 +1,13 @@ +// 云函数入口文件 +const cloud = require('wx-server-sdk'); + +cloud.init(); + +// 云函数入口函数 +exports.main = async (event, context) => { + const wxContext = cloud.getWXContext(); + + console.log(event.group); + + return event.group.data.openGId; +}; diff --git a/functions/getGroup/package.json b/functions/getGroup/package.json new file mode 100644 index 0000000..2537a4e --- /dev/null +++ b/functions/getGroup/package.json @@ -0,0 +1,14 @@ +{ + "name": "getGroup", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "dependencies": { + "wx-server-sdk": "~1.8.3" + } +} diff --git a/news/2020/azk8s.cn.md b/news/2020/azk8s.cn.md new file mode 100644 index 0000000..79a2920 --- /dev/null +++ b/news/2020/azk8s.cn.md @@ -0,0 +1,11 @@ +# azk8s.cn 镜像服务已转为仅限 Azure 云内部使用,请立即更换 + +编辑 `/etc/docker/daemon.json`,新增网易云加速器。 + +```json +{ + "registry-mirrors": ["https://hub-mirror.c.163.com"] +} +``` + +详情请查看 [镜像加速器](../docker/content/index?key=install/mirror.md)。 diff --git a/news/news.cloud.db b/news/news.cloud.db index a7ab3e0..daac9fa 100644 --- a/news/news.cloud.db +++ b/news/news.cloud.db @@ -9,3 +9,4 @@ {"_id":9,"title":"[修订记录] 使用 docker context 操作多个 Docker 后端","date":"2019/12/01","key":"news/2019/docker-context.md"} {"_id":10,"title":"[修订记录] 使用 kubeadm 部署 Kubernetes","date":"2019/12/01","key":"news/2019/kubeadm.md"} {"_id":11,"title":"[修订记录] 在 Docker 桌面版启动 Kubernetes","date":"2019/12/01","key":"news/2019/docker-desktop-k8s.md"} +{"_id":12,"title":"azk8s.cn 镜像服务已转为仅限 Azure 云内部使用,请立即更换","date":"2020/04/05","key":"news/2020/azk8s.cn.md"}