App.vue
3.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<script>
import config from './utils/ip-config';
export default {
onLaunch() {
// #ifdef APP-PLUS
this.initPush()
uni.getPushClientId({
success: (res) => {
let push_clientid = res.cid
uni.setStorageSync('clientId', push_clientid)
},
fail(err) {
console.log(err)
}
})
// #endif
// #ifdef APP-PLUS
const dom = uni.requireNativePlugin('dom');
const domModule = uni.requireNativePlugin('dom')
domModule.addRule('fontFace', {
'fontFamily': "DingTalk_JinBuTi",
// 'src': "url('https://store.keliuyun.com/download/app/wechat/DingTalk_JinBuTi.ttf')"
'src':"url('./static/ttf/DingTalk_JinBuTi.ttf')"
});
dom.addRule('fontFace', {
'fontFamily': "D-DIN-PRO-700-Bold", // 自定义字体名称
'src':"url('./static/ttf/D-DIN-PRO-700-Bold.otf')"
// 'src': "url('https://store.keliuyun.com/download/app/wechat/D-DIN-PRO-700-Bold.otf')"
});
// #endif
// #ifdef APP
// 等待跳转动画结束
setTimeout(() => {
// 最长10s关闭启动屏 主动关屏在i18n资源文件中
plus.navigator.closeSplashscreen()
}, 10000)
// #endif
},
onShow: function() {
// #ifdef APP-PLUS
plus.runtime.setBadgeNumber(-1)
// #endif
},
onHide: function() {
console.log('App Hide')
},
methods: {
initPush() {
// 监听推送消息
uni.onPushMessage((res) => {
if (res.type === 'click') {
// 清除app角标数字
if(res.data.payload && res.data.payload.path){
uni.navigateTo({
url: res.data.payload.path
})
}
plus.runtime.setBadgeNumber(0)
return false
}
const pushData = res.data
uni.createPushMessage({
title: pushData.title || '',
content: pushData.content || '',
payload: pushData.payload || {},
sound: 'system',
cover: false,
badge: 1,
success: (res) => {
console.log('本地通知创建成功:', res)
},
fail: (err) => {
console.log('本地通知创建失败:', err)
// 备用方案:使用 plus.push 创建通知
if (plus.push) {
const options = {
title: pushData.title || '新消息',
content: pushData.content || '您有一条新消息',
payload: pushData.payload || {}
}
plus.push.createMessage(options.content, options.payload, {
title: options.title,
cover: false
})
}
}
})
})
},
}
}
</script>
<style lang="scss">
@import "./styles/variable.scss";
/* #ifndef APP-NVUE */
@import "./styles/ttf.scss";
body,
html {
// font-family: 'PingFang_Medium';
// font-family: Helvetica Neue, Helvetica, sans-serif;
font-family: $font-family-base;
}
/* #endif */
/* #ifndef APP-NVUE */
view {
box-sizing: border-box;
// font-family: Helvetica Neue, Helvetica, sans-serif;
font-family: $font-family-base;
}
/* #endif */
view {
// font-family: 'PingFang_Medium';
// font-family: Helvetica Neue, Helvetica, sans-serif;
font-family: $font-family-base;
}
//导航栏字体
.uni-page-head .uni-page-head__title {
font-weight: 700;
}
.p-empty {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
position: relative;
.p-empty-img {
width: 560rpx;
height: 300rpx;
margin: 0 auto;
}
.p-empty-text {
margin-top: 54rpx;
font-size: 28rpx;
color: #90949D;
text-align: center;
}
.chart-text {
margin-top: 0;
font-size: 24rpx;
}
}
</style>