File tree Expand file tree Collapse file tree 7 files changed +61
-2
lines changed Expand file tree Collapse file tree 7 files changed +61
-2
lines changed Original file line number Diff line number Diff line change 2828 "t-tabs" : " tdesign-miniprogram/tabs/tabs" ,
2929 "t-tab-panel" : " tdesign-miniprogram/tabs/tab-panel" ,
3030 "t-loading" : " tdesign-miniprogram/loading/loading" ,
31+ "t-switch" : " tdesign-miniprogram/switch/switch" ,
3132 "t-steps" : " tdesign-miniprogram/steps/steps" ,
3233 "t-step" : " tdesign-miniprogram/steps/step-item"
3334 }
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " HowToCookOnMiniprogram" ,
3+ "version" : " 0.2.1" ,
4+ "description" : " " ,
5+ "main" : " app.js" ,
6+ "scripts" : {
7+ "test" : " echo \" Error: no test specified\" && exit 1"
8+ },
9+ "keywords" : [
10+ " howtocook" ,
11+ " miniprogram" ,
12+ " wechat"
13+ ],
14+ "author" : " leejim" ,
15+ "license" : " MIT" ,
16+ "dependencies" : {
17+ "tdesign-miniprogram" : " ^0.6.1"
18+ }
19+ }
Original file line number Diff line number Diff line change 1010 starred : false ,
1111 done : false ,
1212 stepIndexes : new Array ( 10 ) . fill ( 0 ) ,
13+ adFlag : false ,
1314 } ,
1415
1516 async onLoad ( options ) {
@@ -26,6 +27,14 @@ Page({
2627 }
2728 } ,
2829
30+ onShow ( ) {
31+ const adFlagStorage = wx . getStorageSync ( 'ad-flag' )
32+
33+ this . setData ( {
34+ adFlag : adFlagStorage === '' ? true : adFlagStorage ,
35+ } )
36+ } ,
37+
2938 async getData ( ) {
3039 const { id } = this . data ;
3140
Original file line number Diff line number Diff line change 4242 </t-tab-panel>
4343 </t-tabs>
4444
45- <ad-custom unit-id="adunit-376059436c4aaff9" style="margin-top: 32rpx"></ad-custom>
45+ <ad-custom wx:if="{{adFlag}}" unit-id="adunit-376059436c4aaff9" style="margin-top: 32rpx"></ad-custom>
4646
4747 <t-toast id="t-toast" />
4848 <view class="popup popup--top popup--{{startTimeout ? 'active' : 'normal'}}">
Original file line number Diff line number Diff line change 1212 value : 'my' ,
1313 icon : 'user'
1414 } ] ,
15- version : ''
15+ version : '' ,
16+ adFlag : true ,
1617 } ,
1718
1819 onLoad ( ) {
@@ -23,6 +24,14 @@ Page({
2324 } )
2425 } ,
2526
27+ onShow ( ) {
28+ const adFlagStorage = wx . getStorageSync ( 'ad-flag' )
29+
30+ this . setData ( {
31+ adFlag : adFlagStorage === '' ? true : adFlagStorage ,
32+ } )
33+ } ,
34+
2635 handleTabbarChange ( { detail } ) {
2736 const { value } = detail ;
2837
@@ -61,6 +70,15 @@ Page({
6170 }
6271 } )
6372 } ,
73+
74+ handleToggleAd ( { detail } ) {
75+ const adFlag = detail . value
76+
77+ wx . setStorageSync ( 'ad-flag' , adFlag )
78+ this . setData ( {
79+ adFlag
80+ } )
81+ } ,
6482
6583 onShareAppMessage ( ) {
6684 return {
Original file line number Diff line number Diff line change 1414 <t-cell title="订阅更新" hover arrow bind:click="handleSubscribe">
1515 <t-icon name="notification" slot="left-icon" />
1616 </t-cell>
17+ <t-cell title="广告开关">
18+ <t-icon name="money-circle" slot="left-icon" />
19+ <t-switch value="{{adFlag}}" bind:change="handleToggleAd" slot="note" />
20+ </t-cell>
1721 <t-cell title="收藏" hover arrow url="../myStarred/index">
1822 <t-icon name="control-platform" slot="left-icon" />
1923 </t-cell>
Original file line number Diff line number Diff line change 11{
2+ "setting" : {},
23 "condition" : {
34 "plugin" : {
45 "list" : []
1516 "name" : " 收藏页" ,
1617 "pathName" : " pages/myStarred/index" ,
1718 "query" : " " ,
19+ "launchMode" : " default" ,
20+ "scene" : null
21+ },
22+ {
23+ "name" : " 个人中心" ,
24+ "pathName" : " pages/my/index" ,
25+ "query" : " " ,
1826 "scene" : null ,
1927 "launchMode" : " default"
2028 }
You can’t perform that action at this time.
0 commit comments