Skip to content

Commit

Permalink
Update join wechat group
Browse files Browse the repository at this point in the history
Signed-off-by: Kang HuaiShuai <khs1994@khs1994.com>
  • Loading branch information
khs1994 committed Jan 31, 2020
1 parent 83f82b1 commit bccaef9
Show file tree
Hide file tree
Showing 16 changed files with 110 additions and 60 deletions.
31 changes: 0 additions & 31 deletions client/package-lock.json

This file was deleted.

5 changes: 4 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
},
"dependencies": {
"wemark": "github:docker-practice/wemark",
"wx-markdown": "^0.0.6"
"wx-markdown": "^0.0.6",
"wx-markdown-next": "^0.0.1",
"towxml": "docker-practice/towxml",
"@pcit/towxml": "*"
},
"devDependencies": {
"miniprogram-api-typings": "*"
Expand Down
1 change: 1 addition & 0 deletions client/pages/docker/content/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"i-button": "/src/ui/iviewui/dist/button/index",
"i-spin": "/src/ui/iviewui/dist/spin/index",
"markdown": "wx-markdown/component/index",
"markdown-next": "wx-markdown-next/component/index",
"wemark": "wemark/wemark"
},
"enablePullDownRefresh": true,
Expand Down
25 changes: 21 additions & 4 deletions client/pages/docker/content/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,23 @@ key="{{key}}"
>
</wemark>

<markdown markdown="{{data}}" theme="{{theme}}" ad="{{ad}}" wx:else
<!-- <markdown markdown="{{data}}" theme="{{theme}}" ad="{{ad}}" wx:else
fontType="{{fontType}}"
folder="{{folder}}"
cache="{{cache}}"
key="{{key}}"
richtext="{{wxMarkdownRichtext}}"
>
</markdown>
</markdown> -->

<markdown-next markdown="{{data}}" theme="{{theme}}" ad="{{ad}}"
fontType="{{fontType}}"
folder="{{folder}}"
cache="{{cache}}"
key="{{key}}"
richtext="{{wxMarkdownRichtext}}"
>
</markdown-next>

<!-- <view class="weui-footer weui-footer_fixed-bottom footer-btn">
<button bindtap="before" wx:if="{{before_key}}">上一页</button>
Expand All @@ -57,9 +66,17 @@ richtext="{{wxMarkdownRichtext}}"

<i-button shape="circle" bind:click="pushNote" size="large" type="primary">在 GitHub 反馈本节内容</i-button>

<i-button shape="circle" bind:click="favorites" size="large" type="error">收藏</i-button>
<i-button shape="circle" bind:click="favorites" size="large" type="warning">收藏</i-button>

<i-button shape="circle" bind:click="buyBook" size="large" type="error">进阶学习 (实体书) 📕</i-button>

<i-button shape="circle" bind:click="buyBook" size="large" type="success">进阶学习 (实体书) 📕</i-button>
<i-button shape="circle" size="large" type="success"
open-type="contact"
send-message-title="加群二维码"
send-message-path="/pages/docker/summary/index?wechatgroup=true"
send-message-img="https://gitee.com/docker_practice/miniprogram/raw/master/u=1294795185,3267316264&fm=26&gp=0.jpg"
show-message-card="{{true}}"
>加入微信群聊</i-button>

<!-- <view class="note-list"></view> -->

Expand Down
2 changes: 1 addition & 1 deletion client/pages/docker/index/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"usingComponents": {
"i-notice-bar": "/src/ui/iviewui/dist/notice-bar/index",
"i-spin": "/src/ui/iviewui/dist/spin/index",
"markdown": "wx-markdown/component/index"
"markdown": "wx-markdown-next/component/index"
},
"navigationStyle": "default",
"enablePullDownRefresh": false
Expand Down
2 changes: 1 addition & 1 deletion client/pages/mdContent/index.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"usingComponents": {
"markdown": "wx-markdown/component/index"
"markdown": "wx-markdown-next/component/index"
},
"navigationStyle": "default"
}
17 changes: 12 additions & 5 deletions client/pages/news/index.wxml
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
<ad unit-id="adunit-4478ecdd36509a60" ad-type="grid" grid-opacity="0.8" grid-count="5" ad-theme="white"></ad>

<view wx:for="{{news}}">
<view class="news" bindtap="click" data-key="{{item.key}}">
<view class="title">{{item.title}}</view>
<view class="date">{{item.date}}</view>
</view>
<view class="page__bd page__bd_spacing">
<view class="kind-list">
<block wx:for="{{news}}">
<view class="kind-list__item">
<view id="{{item.id}}" class="weui-flex kind-list__item-hd {{item.open ? 'kind-list__item-hd_show' : ''}}" bindtap="click" data-key="{{item.key}}">
<view wx:if="{{item.color}}" class="weui-flex__item" style="color: {{item.color}}">{{item.title}}</view>
<view wx:else class="weui-flex__item title">{{item.title}}</view>
<view class="weui-flex__item date">{{item.date}}</view>
</view>
</view>
</block>
</view>
</view>

<ad unit-id="adunit-3ea71b7cfce6c721"></ad>
Expand Down
16 changes: 7 additions & 9 deletions client/pages/news/index.wxss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import 'weui.wxss';

page{
background-color: #F8F8F8;
font-size: 16px;
Expand All @@ -13,17 +15,13 @@ page{
height: 30%;
}

.title {
font-family: "STHeitiTC-Light", "Microsoft YaHei Light", "Hiragino Sans GB", -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
font-weight: bold;
margin-left: 10rpx;
padding-top: 15rpx;
padding-bottom: 10rpx;
font-size: 35rpx;
.weui-flex__item.title {
font-family: Arial,Helvetica,sans-serif;
color: #333333;
}

.date {
margin-left: 10rpx;
.weui-flex__item.date {
margin-top: 30rpx;
font-size: small;
color: #888;
}
Expand Down
1 change: 1 addition & 0 deletions client/pages/news/weui.wxss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.weui-flex{display: block;}.weui-cells{margin-top:0;opacity:0;-webkit-transform:translateY(-50%);transform:translateY(-50%);-webkit-transition:.3s;transition:.3s}.weui-cells:after,.weui-cells:before{display:none}.weui-cells_show{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}.weui-cell:before{right:15px}.kind-list__item{margin:10px 0;background-color:#fff;border-radius:2px;overflow:hidden}.kind-list__item:first-child{margin-top:0}.kind-list__img{width:30px;height:30px}.kind-list__item-hd{padding:20px;-webkit-transition:opacity .3s;transition:opacity .3s}.kind-list__item-hd_show{opacity:.4}.kind-list__item-bd{height:0;overflow:hidden}.kind-list__item-bd_show{height:auto}
3 changes: 2 additions & 1 deletion functions/serviceMessage/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"permissions": {
"openapi": [
"customerServiceMessage.send",
"customerServiceMessage.setTyping"
"customerServiceMessage.setTyping",
"customerServiceMessage.uploadTempMedia"
]
}
}
45 changes: 45 additions & 0 deletions functions/serviceMessage/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
// 云函数入口文件
const cloud = require('wx-server-sdk');
const { NLP, TencentAIError } = require('@khs1994/tencent-ai');
const fs = require('fs');

cloud.init();

function toBuffer(ab) {
var buf = new Buffer(ab.byteLength);
var view = new Uint8Array(ab);
for (var i = 0; i < buf.length; ++i) {
buf[i] = view[i];
}
return buf;
}

// 云函数入口函数
exports.main = async (event, context) => {
const msgType = event.MsgType;

console.log(event);
const wxContext = cloud.getWXContext();

let openid = wxContext.OPENID;
Expand All @@ -15,6 +28,38 @@ exports.main = async (event, context) => {
command: 'Typing',
});

if (msgType === 'miniprogrampage') {
if (event.PagePath === 'pages/docker/summary/index?wechatgroup=true') {
await cloud.openapi.customerServiceMessage.send({
touser: openid,
msgtype: 'text',
text: {
content: '长按识别二维码,加入微信群聊',
},
});

const buffer = fs.readFileSync('qr.jpg');

let res = await cloud.openapi.customerServiceMessage.uploadTempMedia({
type: 'image',
media: {
contentType: 'image/jpg',
value: buffer,
},
});

await cloud.openapi.customerServiceMessage.send({
touser: openid,
msgtype: 'image',
image: {
mediaId: res.mediaId,
},
});

return event;
}
}

const AIApp = {
// 设置请求数据(应用密钥、接口请求参数)
appkey: process.env.TENCENTAIAPPKEY,
Expand Down
Binary file added functions/serviceMessage/qr.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion project.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"ignore": []
},
"compileType": "miniprogram",
"libVersion": "2.9.4",
"libVersion": "2.10.1",
"projectname": "docker",
"miniprogramRoot": "client/",
"cloudfunctionRoot": "functions/",
Expand Down
Binary file added resources/clickme.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 6 additions & 2 deletions summary/list.summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ module.exports = [
{ id: 'compose/django.md', name: '实战 Django' },
{ id: 'compose/rails.md', name: '实战 Rails' },
{ id: 'compose/wordpress.md', name: '实战 WordPress' },
{ id: 'compose/lnmp.md', name: '实战 LNMP'},
],
},
{
Expand Down Expand Up @@ -298,7 +299,10 @@ module.exports = [
open: false,
pages: [
{id: "kubernetes/setup/README.md", name: "部署 Kubernetes"},
{id: "kubernetes/setup/docker.md", name: "使用 Docker 容器部署"}
{id: "kubernetes/setup/kubeadm.md", name: "使用 kubeadm 部署 kubernetes"},
{id: "kubernetes/setup/docker-desktop.md", name: "在 Docker Desktop 使用"},
{id: "kubernetes/setup/systemd.md", name: "一步步部署 kubernetes 集群"},
{id: "kubernetes/setup/dashboard.md", name: "部署 Dashboard"},
]
},
{
Expand All @@ -316,9 +320,9 @@ module.exports = [
pages: [
{ id: 'cloud/README.md', name: '容器与云计算' },
{ id: 'cloud/intro.md', name: '简介' },
{ id: 'cloud/aws.md', name: '亚马逊云' },
{ id: 'cloud/tencentCloud.md', name: '腾讯云' },
{ id: 'cloud/alicloud.md', name: '阿里云' },
{ id: 'cloud/aws.md', name: '亚马逊云' },
{ id: 'cloud/summary.md', name: '小结' },
],
},
Expand Down
12 changes: 8 additions & 4 deletions summary/summary.source.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@
* [实战 Django](compose/django.md)
* [实战 Rails](compose/rails.md)
* [实战 WordPress](compose/wordpress.md)
* [安全](security/README.md)
* [实战 LNMP](compose/lnmp.md)
* [安全](security/README.md)
* [内核命名空间](security/kernel_ns.md)
* [控制组](security/control_group.md)
* [服务端防护](security/daemon_sec.md)
Expand All @@ -113,7 +114,10 @@
* [基本概念](kubernetes/concepts.md)
* [架构设计](kubernetes/design.md)
* [部署 Kubernetes](kubernetes/setup/README.md)
* [使用 Docker 容器部署](kubernetes/setup/docker.md)
* [使用 kubeadm 部署 kubernetes](kubernetes/setup/kubeadm.md)
* [在 Docker Desktop 使用](kubernetes/setup/docker-desktop.md)
* [一步步部署 kubernetes 集群](kubernetes/setup/systemd.md)
* [部署 Dashboard](kubernetes/setup/dashboard.md)
* [Kubernetes 命令行 kubectl](kubernetes/kubectl/README.md)
* [容器与云计算](cloud/README.md)
* [简介](cloud/intro.md)
Expand Down Expand Up @@ -149,8 +153,8 @@
* [MongoDB](appendix/repo/mongodb.md)
* [Redis](appendix/repo/redis.md)
* [附录三:Docker 命令查询](appendix/command/README.md)
* [客户端命令 (docker)](appendix/command/docker.md)
* [服务端命令 (dockerd)](appendix/command/dockerd.md)
* [客户端命令 -- docker](appendix/command/docker.md)
* [服务端命令 -- dockerd](appendix/command/dockerd.md)
* [附录四:Dockerfile 最佳实践](appendix/best_practices.md)
* [附录五:如何调试 Docker](appendix/debug.md)
* [附录六:资源链接](appendix/resources.md)

0 comments on commit bccaef9

Please sign in to comment.