Skip to content

Commit 6bcf18d

Browse files
author
memakergytcom
committed
resize logo
1 parent 0ab1827 commit 6bcf18d

File tree

5 files changed

+64
-1
lines changed

5 files changed

+64
-1
lines changed

components/add-tips

Lines changed: 0 additions & 1 deletion
This file was deleted.

components/add-tips/index.js

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
const STORAGE_KEY = 'PLUG-ADD-MYAPP-KEY';
2+
Component({
3+
properties: {
4+
name: {
5+
type: String,
6+
value: '测试'
7+
},
8+
duration: {
9+
type: Number,
10+
value: 10
11+
},
12+
logo: {
13+
type: String,
14+
value: 'https://imgkr.cn-bj.ufileos.com/c958e4cd-6bab-43ed-93aa-697207cf33a5.png'
15+
},
16+
custom: {
17+
type: Boolean,
18+
value: false
19+
}
20+
},
21+
lifetimes: {
22+
attached: function() {
23+
if (wx.getStorageSync(STORAGE_KEY)) return;
24+
let rect = wx.getMenuButtonBoundingClientRect ? wx.getMenuButtonBoundingClientRect() : null;
25+
let { screenWidth } = wx.getSystemInfoSync();
26+
this.setData({
27+
navbarHeight: rect.bottom,
28+
arrowR:screenWidth-rect.right+rect.width*3/4-5,
29+
bodyR: screenWidth - rect.right
30+
})
31+
this.setData({
32+
SHOW_TOP: true
33+
});
34+
setTimeout(() => {
35+
this.setData({
36+
SHOW_TOP: false
37+
})
38+
}, this.data.duration * 1000);
39+
},
40+
},
41+
data: {
42+
SHOW_TOP: false
43+
},
44+
methods: {
45+
hidden: function() {
46+
this.setData({
47+
SHOW_TOP: false
48+
},()=>{
49+
wx.setStorageSync(STORAGE_KEY, true)
50+
});
51+
}
52+
}
53+
})

components/add-tips/index.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"component": true
3+
}

components/add-tips/index.wxml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<view class="box" wx:if="{{SHOW_TOP}}" style="top:{{custom?navbarHeight:0}}px;">
2+
<view class='arrow' style="margin-right:{{arrowR}}px;"></view>
3+
<view class='body' bindtap='hidden' style="margin-right:{{bodyR}}px;">
4+
<image src="{{logo}}" class="logo"></image>
5+
<view class="tips">将“{{name}}”添加到我的小程序,以后使用更方便</view>
6+
</view>
7+
</view>

components/add-tips/index.wxss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.box{position:fixed;right:0;z-index:999;display:flex;justify-content:flex-end;align-items:flex-end;flex-direction:column;width:600rpx;}.arrow{width:0;height:0;border-width:5px;border-style:solid;border-color:transparent transparent rgba(0,0,0,0.75) transparent;}.body{background-color:rgba(0,0,0,0.75);border-radius:2px;display:flex;align-items:center;justify-content:center;height:42px;padding:10px;}.tips{flex:1;color:#FFF;font-size:14px;font-weight:700;}.logo{height:42px;width:42px;border-radius:8px;margin-right:10px;}

0 commit comments

Comments
 (0)