File tree Expand file tree Collapse file tree 7 files changed +73
-33
lines changed Expand file tree Collapse file tree 7 files changed +73
-33
lines changed Original file line number Diff line number Diff line change 2525 "t-button-group" : " tdesign-miniprogram/button-group/button-group" ,
2626 "t-cell" : " tdesign-miniprogram/cell/cell" ,
2727 "t-count-down" : " tdesign-miniprogram/count-down/count-down" ,
28+ "t-dialog" : " tdesign-miniprogram/dialog/dialog" ,
2829 "t-empty" : " tdesign-miniprogram/empty/empty" ,
2930 "t-icon" : " tdesign-miniprogram/icon/icon" ,
3031 "t-toast" : " tdesign-miniprogram/toast/toast" ,
Original file line number Diff line number Diff line change 11import infos from '../../data'
22import utils from '../../utils/index.js'
33import config from '../../config/index.js'
4+ import Toast from 'tdesign-miniprogram/toast/index' ;
5+
6+ let isSubscribeShow = false ;
47
58Page ( {
69 data : {
710 list : [ ] ,
811 value : 'index' ,
912 searchKeyword : '' ,
13+ subscribeModalVisible : false ,
1014 tabbars : [ {
1115 text : '首页' ,
1216 value : 'index' ,
@@ -43,6 +47,14 @@ Page({
4347 canIUseGetUserProfile : true
4448 } )
4549 }
50+
51+ const { scene } = wx . getLaunchOptionsSync ( ) // https://developers.weixin.qq.com/miniprogram/dev/reference/scene-list.html
52+ if ( scene === 1107 && ! isSubscribeShow ) {
53+ this . setData ( {
54+ subscribeModalVisible : true
55+ } )
56+ isSubscribeShow = true
57+ }
4658 } ,
4759
4860 handleTap ( e ) {
@@ -70,6 +82,24 @@ Page({
7082 } )
7183 } ,
7284
85+ handleSubscribe ( ) {
86+ const tmplIds = [ 'vjEDlUYrVJ05CauSw_V9jIWF-okt3OMCBtlz9yvjrfg' , 'Sbtj4X4gIKWRy0xDeWU8xCl8LejbTpIQ3gWiKh5JFp4' ] ;
87+ wx . requestSubscribeMessage ( {
88+ tmplIds,
89+ success : async ( res ) => {
90+ const accept = tmplIds . some ( key => res [ key ] === 'accept' )
91+ Toast ( {
92+ context : this ,
93+ selector : '#t-toast' ,
94+ message : accept ? '订阅成功' : '你拒绝了订阅' ,
95+ } ) ;
96+ } ,
97+ complete : ( ) => {
98+ this . setData ( { subscribeModalVisible : false } )
99+ }
100+ } )
101+ } ,
102+
73103 onShareAppMessage ( ) {
74104 return {
75105 title : '程序员做饭指南' ,
Original file line number Diff line number Diff line change 2020 list="{{item.list}}" />
2121</view>
2222
23+ <t-dialog
24+ visible="{{subscribeModalVisible}}"
25+ title="订阅新版本通知"
26+ content="第一时间接收【最新功能】的消息"
27+ confirm-btn="我知道了"
28+ bind:confirm="handleSubscribe"
29+ />
30+
2331<include src="/templates/tabbar.wxml" />
32+ <include src="/templates/base.wxml" />
Original file line number Diff line number Diff line change 3232 <t-icon name="info-circle" slot="left-icon" />
3333 <view slot="note">{{version}}</view>
3434 </t-cell>
35-
36- <t-toast id="t-toast" />
3735</view>
3836
39- <include src="/templates/tabbar.wxml" />
37+ <include src="/templates/tabbar.wxml" />
38+ <include src="/templates/base.wxml" />
Original file line number Diff line number Diff line change 1+ <t-toast id="t-toast" />
Original file line number Diff line number Diff line change 11{
2- "description" : " 项目配置文件" ,
2+ "description" : " 项目配置文件,详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html " ,
33 "miniprogramRoot" : " miniprogram/" ,
44 "cloudfunctionRoot" : " cloudfunctions/" ,
55 "packOptions" : {
66 "ignore" : [
77 {
8- "type " : " folder " ,
9- "value " : " HowToCook "
8+ "value " : " HowToCook " ,
9+ "type " : " folder "
1010 },
1111 {
12- "type " : " folder " ,
13- "value " : " node_modules "
12+ "value " : " node_modules " ,
13+ "type " : " folder "
1414 }
15- ]
15+ ],
16+ "include" : []
1617 },
1718 "setting" : {
1819 "urlCheck" : true ,
5253 "useCompilerPlugins" : [
5354 " less"
5455 ],
55- "ignoreUploadUnusedFiles" : true
56+ "ignoreUploadUnusedFiles" : true ,
57+ "useStaticServer" : true
5658 },
5759 "compileType" : " miniprogram" ,
5860 "libVersion" : " 2.22.1" ,
5961 "appid" : " wx01462be634a0d447" ,
6062 "projectname" : " HowToCookOnMiniprogram" ,
61- "debugOptions" : {
62- "hidedInDevtools" : []
63- },
64- "scripts" : {},
65- "staticServerOptions" : {
66- "baseURL" : " " ,
67- "servePath" : " "
68- },
69- "isGameTourist" : false ,
70- "cloudfunctionTemplateRoot" : " cloudfunctionTemplate" ,
63+ "cloudfunctionTemplateRoot" : " cloudfunctionTemplate/" ,
7164 "condition" : {
7265 "search" : {
7366 "list" : []
8780 "miniprogram" : {
8881 "list" : []
8982 }
83+ },
84+ "srcMiniprogramRoot" : " miniprogram/" ,
85+ "editorSetting" : {
86+ "tabIndent" : " insertSpaces" ,
87+ "tabSize" : 2
9088 }
9189}
Original file line number Diff line number Diff line change 11{
2- "setting" : {},
2+ "setting" : {
3+ "compileHotReLoad" : true
4+ },
35 "condition" : {
4- "plugin" : {
5- "list" : []
6- },
7- "game" : {
8- "list" : []
9- },
10- "gamePlugin" : {
11- "list" : []
12- },
136 "miniprogram" : {
147 "list" : [
158 {
5144 "name" : " search" ,
5245 "pathName" : " pages/search/index" ,
5346 "query" : " keyword=鸡蛋" ,
54- "scene" : null ,
55- "launchMode" : " default"
47+ "launchMode" : " default" ,
48+ "scene" : null
49+ },
50+ {
51+ "name" : " 订阅" ,
52+ "pathName" : " pages/index/index" ,
53+ "query" : " from=subscribe" ,
54+ "launchMode" : " default" ,
55+ "scene" : 1107
5656 }
5757 ]
5858 }
59- }
59+ },
60+ "projectname" : " HowToCookOnMiniprogram" ,
61+ "description" : " 项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html"
6062}
You can’t perform that action at this time.
0 commit comments