更新记录
1.0.2(2025-09-05)
1.0.2优化插屏广告
1.0.1(2025-09-05)
集成广告
1.0.0(2025-09-04)
1.0.0 集成uni-ad多种广告。
查看更多平台兼容性
云端兼容性
阿里云 | 腾讯云 | 支付宝云 |
---|---|---|
√ | √ | × |
云函数类插件通用教程
使用云函数类插件的前提是:使用HBuilderX 2.9+
shAd-package
不会用uni-ad广告?没关系,ad-package广告封装来帮你,使用方便,集成多种广告。
全面性广告集成,包含以下广告
- 信息流广告
- 快手内容联盟广告
- 激励视频广告
- 全屏视频广告
- Draw视频广告
使用方式
- 在pages.json的pages数组中放入以下页面代码
{
"path": "uni_modules/shAd-package/pages/common",
"style": {
"navigationBarTitleText": "UNI-AD封装示例"
}
},
{
"path": "uni_modules/shAd-package/pages/video-draw",
"style": {
"navigationBarTitleText": "Draw视频"
}
},
{
"path": "uni_modules/shAd-package/pages/content-video",
"style": {
"navigationStyle": "custom",
"enablePullDownRefresh": false,
"app-plus": {
"titleNView": false
// "bounce": "none"
}
}
},
{
"path": "uni_modules/shAd-package/pages/video-fullscreen",
"style": {
"navigationBarTitleText": "全屏视频"
}
},
{
"path": "uni_modules/shAd-package/pages/video-excitation",
"style": {
"navigationBarTitleText": "激励视频"
}
}
- 在tabbar使用内容联盟视频(示例项目)
"tabBar": {
"color": "#888888",
"selectedColor": "#FD7155",
"borderStyle": "#ffffff",
"backgroundColor": "#ffffff",
"list": [{
"pagePath": "uni_modules/shAd-package/pages/common",
"iconPath": "static/tabbar/index.png",
"selectedIconPath": "static/tabbar/indexcheck.png",
"text": "首页"
},
{
"pagePath": "uni_modules/shAd-package/pages/content-video",
"iconPath": "static/tabbar/mmt.png",
"selectedIconPath": "static/tabbar/mmtcheck.png",
"text": "视频"
}
]
}
- 在uni_modules/shAd-package/pages//ad-config.js配置你申请的各广告位的adpid。以下ADPID是官方标准基座的示例,实际使用需要更换为您自己申请的广告ID
export default {
INFORMATION_FLOW_ID: '1625451494', // 信息流广告ID
VIDEO_DRAW_ID: '1507000690', // Draw视频ID
VIDEO_EXCITATION: '1879553690', // 激励视频ID
VIDEO_FULLSCREEN: '1170364625', // 全屏视频ID
CONTENT_ID: '1111111112' // 内容联盟视频ID
}
-
在需要使用广告的页面
<view class="container2"> <view class="ad-wrap"> <view class="ad-item" v-for="(item, index) in adItems" :key="item.name" @click="toAdPage(item.url)"> <text class="button-text">{{ item.name }}</text> </view> </view> <view> <ad-information></ad-information> </view> </view> import adConfig from '@/uni_modules/shAd-package/pages/ad-config.js'; import AdInformation from '@/uni_modules/shAd-package/components/ad-information/ad-information.vue' data() { return { adItems: [{ name: '全屏视频', url: '/uni_modules/shAd-package/pages/video-fullscreen' }, { name: '激励视频', url: '/uni_modules/shAd-package/pages/video-excitation' }, { name: 'Draw视频', url: '/uni_modules/shAd-package/pages/video-draw' }, { name: '快手内容联盟广告', url: '/uni_modules/shAd-package/pages/content-video' } ] } } methods: { toAdPage(pageURL) { if (pageURL === '/uni_modules/shAd-package/pages/content-video') { uni.navigateTo({ url: pageURL }) return } console.log('页面地址', pageURL); uni.navigateTo({ url: pageURL }) } }