Skip to content

Commit 9200eb6

Browse files
bailin0824v_guanglwen
andauthored
feat: 增加openOfficialAccountArticle,openOfficialAccountProfile (#178)
* feat: 增加openOfficialAccountArticle,openOfficialAccountProfile * feat: 增加公众号页面 --------- Co-authored-by: v_guanglwen <v_guanglwen@tencent.com>
1 parent 543439e commit 9200eb6

File tree

7 files changed

+75
-3
lines changed

7 files changed

+75
-3
lines changed

miniprogram/app.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
"pages/api/get-user-info/get-user-info",
9393
"pages/api/request-payment/request-payment",
9494
"pages/api/jump/jump",
95+
"pages/api/official-account/official-account",
9596
"pages/api/share/share",
9697
"pages/api/share-button/share-button",
9798
"pages/api/custom-message/custom-message",
@@ -523,7 +524,9 @@
523524
],
524525
"multiSelectSupportedMaterials": [
525526
{
526-
"materialType": ["image/*"],
527+
"materialType": [
528+
"image/*"
529+
],
527530
"desc": "聊天内容长按多选打开",
528531
"path": "packageAPI/pages/chattool/material_open/material_open",
529532
"scopes": []

miniprogram/packageAPI/pages/api/jump/jump.wxml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<import src="../../../../common/head.wxml" />
22
<import src="../../../../common/foot.wxml" />
3-
43
<view class="container page" data-weui-theme="{{theme}}">
5-
<template is="head" />
4+
<template is="head" data="{{title: 'jumpApi'}}" />
65
<view class="page-body">
76
<!-- 暂时下架 -->
87
<!-- <view class="btn-area">
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
Page({
2+
onShareAppMessage() {
3+
return {
4+
title: '公众号',
5+
path: 'packageAPI/pages/api/official-account/official-account'
6+
}
7+
},
8+
9+
data: {
10+
theme: 'light',
11+
setting: {}
12+
},
13+
// 打开公众号主页
14+
openofficialaccountprofile() {
15+
wx.openOfficialAccountProfile({
16+
username: 'gh_56fc3b00cc4f',
17+
success: (res) => {
18+
},
19+
fail: (res) => {
20+
}
21+
})
22+
},
23+
// 打开公众号文章
24+
openofficialaccountarticle() {
25+
wx.openOfficialAccountArticle({
26+
url: 'https://mp.weixin.qq.com/s/vTt8sZ_tTkTEVYgcydKqew', // 此处填写公众号文章连接
27+
success: (res) => {
28+
},
29+
fail: (res) => {
30+
}
31+
})
32+
},
33+
onUnload() {
34+
if (wx.offThemeChange) {
35+
wx.offThemeChange()
36+
}
37+
},
38+
onLoad() {
39+
this.setData({
40+
theme: getApp().globalData.theme || 'light'
41+
})
42+
43+
if (wx.onThemeChange) {
44+
wx.onThemeChange(({ theme }) => {
45+
this.setData({ theme })
46+
})
47+
}
48+
}
49+
})
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"navigationBarTitleText": "公众号",
3+
"renderer": "webview"
4+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<import src="../../../../common/head.wxml" />
2+
<import src="../../../../common/foot.wxml" />
3+
<view class="container page" data-weui-theme="{{theme}}">
4+
<template is="head" data="{{title: 'officialAccount'}}" />
5+
<view class="page-body">
6+
<view class="btn-area">
7+
<button type="primary" data-mode="fingerPrint" bindtap="openofficialaccountprofile">打开公众号主页</button>
8+
</view>
9+
<view class="btn-area">
10+
<button type="primary" data-mode="fingerPrint" bindtap="openofficialaccountarticle">打开公众号文章</button>
11+
</view>
12+
</view>
13+
<template is="foot" />
14+
</view>

miniprogram/packageAPI/pages/api/official-account/official-account.wxss

Whitespace-only changes.

miniprogram/page/API/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ Page({
3131
}, {
3232
zh: '跳转',
3333
url: 'jump/jump'
34+
}, {
35+
zh: '公众号',
36+
url: 'official-account/official-account'
3437
}, {
3538
zh: '转发',
3639
url: 'share/share'

0 commit comments

Comments
 (0)