refactor: 确立独立子工程架构 (backend, admin, mpuniapp) 并同步更新 AGENTS.md 规范
这个提交包含在:
@@ -0,0 +1,56 @@
|
||||
<template>
|
||||
<view>
|
||||
<page-head title="信息流广告"></page-head>
|
||||
<!-- #ifndef MP -->
|
||||
<ad adpid="1111111111" style="width: 100%;" @load="loadFun" @error="errorFun"></ad>
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef MP -->
|
||||
<view class="uni-center">微信小程序平台暂不支持测试广告位,需要开通uni-ad后可测试</view>
|
||||
<!-- #endif -->
|
||||
<view v-if="tips" class="uni-center">信息流广告加载失败,请退出当前页面重试。</view>
|
||||
<button @click="pushList">列表-信息流</button>
|
||||
<button @click="pushVideoAd">视频贴片-非全屏</button>
|
||||
<button @click="pushVideoAdL">视频贴片-横向全屏</button>
|
||||
<button @click="pushVideoAdP">视频贴片-竖向全屏</button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
const tips = ref(false)
|
||||
|
||||
const pushList = () => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/component/ad/list-view-ad',
|
||||
})
|
||||
}
|
||||
|
||||
const pushVideoAd = () => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/component/ad/video-ad',
|
||||
})
|
||||
}
|
||||
|
||||
const pushVideoAdL = () => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/component/ad/landscape-video-ad',
|
||||
})
|
||||
}
|
||||
|
||||
const pushVideoAdP = () => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/component/ad/portrait-video-ad',
|
||||
})
|
||||
}
|
||||
|
||||
const loadFun = () => {
|
||||
uni.showToast({
|
||||
position: "bottom",
|
||||
title: "信息流广告加载成功"
|
||||
})
|
||||
}
|
||||
|
||||
const errorFun = () => {
|
||||
tips.value = true;
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,92 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<!-- 视频组件 -->
|
||||
<video id="myVideo2" :src="src" :controls="true" :autoplay="false" class="video" @play="onVideoPlay">
|
||||
<!-- 信息流广告 - 覆盖在视频上方 -->
|
||||
<view v-if="adVisible" class="ad-container">
|
||||
<ad adpid="1597617406" class="ad-class" @load="loadFun" @error="errorFun" @close="closeAd"></ad>
|
||||
</view>
|
||||
</video>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
const src = ref("https://qiniu-web-assets.dcloud.net.cn/video/sample/2minute-demo.mp4")
|
||||
let showAd: boolean = false
|
||||
const adVisible = ref(false)
|
||||
|
||||
function setfs(){
|
||||
const videoContext = uni.createVideoContext('myVideo2');
|
||||
const direction : RequestFullScreenOptions = {direction:-90} as RequestFullScreenOptions;
|
||||
videoContext!.requestFullScreen(direction);
|
||||
}
|
||||
|
||||
function onVideoPlay() {
|
||||
if (!showAd) {
|
||||
const videoContext = uni.createVideoContext('myVideo2')
|
||||
videoContext!.stop();
|
||||
showAd = true;
|
||||
const direction : RequestFullScreenOptions = {direction:90} as RequestFullScreenOptions;
|
||||
videoContext!.requestFullScreen(direction);
|
||||
setTimeout(() => {
|
||||
adVisible.value = true;
|
||||
}, 100)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function closeAd() {
|
||||
console.log("执行了关闭");
|
||||
adVisible.value = false;
|
||||
const videoContext = uni.createVideoContext('myVideo2')
|
||||
videoContext!.play()
|
||||
}
|
||||
|
||||
function loadFun(){
|
||||
console.log("加载成功");
|
||||
}
|
||||
|
||||
function errorFun(e : UniAdErrorEvent){
|
||||
console.log(e.detail);
|
||||
}
|
||||
|
||||
onLoad(() => {
|
||||
// 页面加载逻辑
|
||||
})
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.container {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
/* align-items: center; */
|
||||
}
|
||||
|
||||
.video {
|
||||
width: 100%;
|
||||
height: 420rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.ad-class{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.ad-container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.7);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,43 @@
|
||||
<template>
|
||||
<list-view @scrolltolower="onScrollTolower" style="flex:1" show-scrollbar=false>
|
||||
<list-item v-for="index in listcount" :key="index" :type="(index != 0 && index%10 == 6) ? 0:1">
|
||||
<!-- #ifndef MP -->
|
||||
<ad v-if="index != 0 && index%10 == 6" adpid="1111111111" @load="onAdLoad" @error="onAdError" @close="onAdClose"></ad>
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef MP -->
|
||||
<view class="uni-center">微信小程序平台暂不支持测试广告位,需要开通uni-ad后可测试</view>
|
||||
<!-- #endif -->
|
||||
<text v-if="index == 0 || index%10 != 6" style="width: 100%; height: 200px;background-color: aquamarine;margin-top: 10px;">这是一条占位的信息{{index}}</text>
|
||||
</list-item>
|
||||
</list-view>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
|
||||
|
||||
// Data
|
||||
const listcount = ref(10)
|
||||
|
||||
// Methods
|
||||
function onScrollTolower(event : ScrollToLowerEvent) {
|
||||
setTimeout(() => {
|
||||
listcount.value = listcount.value + 10
|
||||
}, 300)
|
||||
}
|
||||
|
||||
function onAdLoad() {
|
||||
console.log("广告加载成功")
|
||||
uni.showToast({
|
||||
position: "center",
|
||||
title: "广告加载成功"
|
||||
})
|
||||
}
|
||||
|
||||
function onAdError(e : UniAdErrorEvent) {
|
||||
console.log("广告加载失败" + (e.detail))
|
||||
}
|
||||
|
||||
function onAdClose() {
|
||||
console.log("广告关闭了")
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,77 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<!-- 视频组件 -->
|
||||
<video id="myVideo1" :src="src" :controls="true" :autoplay="false" class="video" @play="onVideoPlay">
|
||||
<!-- 信息流广告 - 覆盖在视频上方 -->
|
||||
<view v-if="adVisible" class="ad-container">
|
||||
<!-- 1204745639 1000000001-->
|
||||
<ad adpid="1597617406" style="width: 100%; height: 100%;" @load="loadFun" @error="errorFun" @close="closeAd"></ad>
|
||||
</view>
|
||||
</video>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
const src = ref("https://qiniu-web-assets.dcloud.net.cn/video/sample/2minute-demo.mp4")
|
||||
let showAd: boolean = false
|
||||
const adVisible = ref(false)
|
||||
|
||||
function setfs(){
|
||||
const videoContext = uni.createVideoContext('myVideo1')
|
||||
videoContext!.requestFullScreen({direction:0});
|
||||
}
|
||||
|
||||
function onVideoPlay() {
|
||||
if (!showAd) {
|
||||
const videoContext = uni.createVideoContext('myVideo1')
|
||||
videoContext!.stop();
|
||||
showAd = true;
|
||||
videoContext!.requestFullScreen({direction:0});
|
||||
adVisible.value = true;
|
||||
}
|
||||
}
|
||||
|
||||
function closeAd() {
|
||||
console.log("执行了关闭");
|
||||
adVisible.value = false;
|
||||
const videoContext = uni.createVideoContext('myVideo1')
|
||||
videoContext!.play()
|
||||
}
|
||||
|
||||
function loadFun(){
|
||||
console.log("加载成功");
|
||||
}
|
||||
|
||||
function errorFun(e : UniAdErrorEvent){
|
||||
console.log(e.detail);
|
||||
}
|
||||
|
||||
onLoad(() => {
|
||||
// 页面加载逻辑
|
||||
})
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.container {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.video {
|
||||
width: 100%;
|
||||
height: 420rpx;
|
||||
}
|
||||
|
||||
.ad-container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.7);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,74 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<!-- 视频组件 -->
|
||||
<video id="myVideo" :src="src" :controls="true" :autoplay="false" class="video" @play="onVideoPlay">
|
||||
</video>
|
||||
<!-- 信息流广告 - 覆盖在视频上方 -->
|
||||
<view v-if="adVisible" class="ad-container">
|
||||
<ad adpid="1597617406" style="width: 100%;height: 420rpx;" @load="loadFun" @error="errorFun" @close="closeAd"></ad>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
const src = ref("https://qiniu-web-assets.dcloud.net.cn/video/sample/2minute-demo.mp4")
|
||||
let showAd: boolean = false
|
||||
const adVisible = ref(false)
|
||||
|
||||
function onVideoPlay() {
|
||||
if (!showAd) {
|
||||
showAd = true;
|
||||
adVisible.value = true;
|
||||
const videoContext = uni.createVideoContext('myVideo')
|
||||
videoContext!.stop();
|
||||
}
|
||||
}
|
||||
|
||||
function closeAd() {
|
||||
console.log("执行了关闭");
|
||||
adVisible.value = false;
|
||||
const videoContext = uni.createVideoContext('myVideo')
|
||||
videoContext!.play()
|
||||
}
|
||||
|
||||
function loadFun(){
|
||||
console.log("加载成功");
|
||||
}
|
||||
|
||||
function errorFun(e : UniAdErrorEvent){
|
||||
console.log(e.detail);
|
||||
}
|
||||
|
||||
onLoad(() => {
|
||||
// 页面加载逻辑
|
||||
})
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.container {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.video {
|
||||
width: 100%;
|
||||
height: 420rpx;
|
||||
}
|
||||
|
||||
.ad-container {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 420rpx;
|
||||
background-color: rgba(0, 0, 0, 0.7);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 999;
|
||||
}
|
||||
</style>
|
||||
在新工单中引用
屏蔽一个用户