Skip to content

Commit 14eea14

Browse files
author
v_guanglwen
committed
feat: 增加公众号页面
1 parent 4ecaa9f commit 14eea14

File tree

8 files changed

+74
-27
lines changed

8 files changed

+74
-27
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.js

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -55,26 +55,6 @@ Page({
5555
}
5656
})
5757
},
58-
// 打开公众号主页
59-
openofficialaccountprofile() {
60-
wx.openOfficialAccountProfile({
61-
username: 'gh_56fc3b00cc4f',
62-
success: (res) => {
63-
},
64-
fail: (res) => {
65-
}
66-
})
67-
},
68-
// 打开公众号文章
69-
openofficialaccountarticle() {
70-
wx.openOfficialAccountArticle({
71-
url: 'https://mp.weixin.qq.com/s/vTt8sZ_tTkTEVYgcydKqew', // 此处填写公众号文章连接
72-
success: (res) => {
73-
},
74-
fail: (res) => {
75-
}
76-
})
77-
},
7858
onUnload() {
7959
if (wx.offThemeChange) {
8060
wx.offThemeChange()

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@
1616
<view class="btn-area">
1717
<button type="primary" data-mode="fingerPrint" bindtap="exitminiprogram">退出当前小程序</button>
1818
</view>
19-
<view class="btn-area">
20-
<button type="primary" data-mode="fingerPrint" bindtap="openofficialaccountprofile">打开公众号主页</button>
21-
</view>
22-
<view class="btn-area">
23-
<button type="primary" data-mode="fingerPrint" bindtap="openofficialaccountarticle">打开公众号文章</button>
24-
</view>
2519
</view>
2620
<template is="foot" />
2721
</view>
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)