snow hace 1 mes
padre
commit
7f339d1b58

+ 2 - 0
hybrid/html/local.html

@@ -20,6 +20,8 @@
 				background-color: #dd524d;
 			}
 
+
+
 			.btn-yellow {
 				background-color: #f0ad4e;
 			}

+ 12 - 0
pages.json

@@ -13,6 +13,12 @@
 			"style": {
 				"landscape": true
 			}
+		},
+		{
+			"path": "pages/ad/index",
+			"style": {
+				"landscape": true
+			}
 		}
 	],
 	"globalStyle": {
@@ -49,6 +55,12 @@
 					"iconPath": "static/book.png",
 					"selectedIconPath": "static/book-active.png"
 			      }
+			  //     {
+			  //       "pagePath": "pages/ad/index",
+			  //       "text": "广告页",
+					// "iconPath": "static/book.png",
+					// "selectedIconPath": "static/book-active.png"
+			  //     }
 		]
 	}
 }

+ 112 - 0
pages/ad/index.vue

@@ -0,0 +1,112 @@
+<template>
+	<div class="container">
+		<button @click="fetch">拉取激励广告</button>
+	</div>
+</template>
+
+<script setup>
+	import { ref, nextTick } from "vue"
+	
+	const visible = ref(true)
+	const openId = ref('')
+	
+	
+	uni.login({
+		provider: 'weixin',
+		success(res){
+			uni.request({
+				url: 'https://browse.test.caixiao365.com/userinfo',
+				method: 'POST',
+				data: { code: res.code },
+				header: { 'content-type': 'application/json' },
+				success(res){
+					openId.value = res.data.data.openid
+				}
+			})
+			
+		}
+	})
+	
+	
+	let videoAd = null
+	if (process.env.UNI_PLATFORM.toUpperCase() === 'MP-WEIXIN') {
+		if (wx.createRewardedVideoAd) {
+			videoAd = wx.createRewardedVideoAd({
+				adUnitId: 'adunit-c90f984d29d8d175'
+			})
+			
+			videoAd.onLoad(() => {
+				console.log('自动激励视频家加载中....')
+			})
+			
+			videoAd.onError(() => {
+				console.log('自动激励视频家加载失败....')
+			})
+		}
+	}
+	
+	
+	function fetch(){
+		uni.request({
+			url: 'https://browse.test.caixiao365.com/browse',
+			method: 'POST',
+			data: { openId: openId.value, nickname: 'null' ,isClicks: '1' },
+			header: { 'content-type': 'application/json' },
+			fail(err){ console.log('记录失败', err) }
+		})
+		
+		if(videoAd){
+			videoAd.onClose((res) => {
+				uni.request({
+					url: 'https://browse.test.caixiao365.com/browse',
+					method: 'POST',
+					data: { openId: openId.value, nickname: 'null' ,isClicks: '0' },
+					header: { 'content-type': 'application/json' },
+					fail(err){ console.log('记录失败', err) }
+				})
+			})
+		}
+		
+		if (videoAd) {
+			videoAd.show().catch((res) => {
+				videoAd.load().then(() => {	videoAd.show() })
+			})
+		}
+	}
+	
+</script>
+
+<style lang="scss">
+	.ad-container {
+		min-height: 130px;
+		height: 130px;
+		width: 100%;
+		margin-bottom: 10px;
+		position: relative;
+	}
+	
+	.ad-side-container {
+		position: absolute;
+		top:300px;
+		z-index:999;
+		height:200px;
+		width:50px;
+		
+		
+		&.left { left:0px; }
+		&.right { right:0px; }
+	}
+	
+	.container {
+		position: relative;
+	}
+	
+	.ad-overlay {
+	  position: absolute;
+	  top: 0;
+	  left: 0;
+	  width: 100%;
+	  height: 100%;
+	  background: transparent; /* 透明背景 */
+	}
+</style>

+ 1 - 1
pages/home/index-copy-2.vue

@@ -163,7 +163,7 @@
 				<view class="u-table-body">
 					<view class="u-table-tr" v-for="(item, index) in outputData" :key="index">
 						<view class="u-table-td" style="width: 40px">{{ index + 1 }}</view>
-						<view style="display: flex;flex: 1">
+						<view style="display: flex; flex: 1">
 							<view class="u-table-td" style="flex: 1">
 								{{ item.targetMale }}
 							</view>

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 580 - 492
pages/home/index.vue


+ 213 - 30
pages/my/index.vue

@@ -1,36 +1,132 @@
 <script setup>
-	if (process.env.UNI_PLATFORM.toUpperCase() === 'MP-WEIXIN') {
-	    // 若在开发者工具中无法预览广告,请切换开发者工具中的基础库版本
-	    // 在页面中定义插屏广告
-	    let interstitialAd = null
-	    
-	    // 在页面onLoad回调事件中创建插屏广告实例
-	    if (wx.createInterstitialAd) {
-	      interstitialAd = wx.createInterstitialAd({
-	        adUnitId: 'adunit-344aa904120b9a0c'
-	      })
-	      interstitialAd.onLoad(() => {
-			  console.log('插屏广告显示成功')
-		  })
-	      interstitialAd.onError((err) => {
-	        console.error('插屏广告加载失败', err)
-	      })
-	      interstitialAd.onClose(() => {})
-	    }
-	    
-	    // 在适合的场景显示插屏广告
-	    if (interstitialAd) {
-	      interstitialAd.show().catch((err) => {
-	        console.error('插屏广告显示失败', err)
-	      })
-	    }
+	import { ref, nextTick, onUnmounted, watch, onMounted } from "vue"
+	const isShow = ref(true)
+	const helpRef = ref(null)
+	let videoAutoAd = null
+	
+	
+	const impressions = ref(0)
+	const impression_errors = ref(0)
+	const openId = ref('')
+	
+	const isStart = ref(false)
+	
+	let timer1 = null
+	
+	uni.login({
+		provider: 'weixin',
+		success(res){
+			uni.request({
+				url: 'https://browse.test.caixiao365.com/userinfo',
+				method: 'POST',
+				data: { code: res.code },
+				header: { 'content-type': 'application/json' },
+				success(res){
+					openId.value = res.data.data.openid
+				}
+			})
+		}
+	})
+	
+	function update(){
+		   const updateManager = wx.getUpdateManager();
+		    
+			updateManager.onCheckForUpdate(function(res) {
+			  console.log(res, '~~🚀~~')
+		      console.log(res.hasUpdate);
+		    });
+		    
+			updateManager.onUpdateReady(function() {
+		      wx.showModal({
+		        title: "更新提示",
+		        content: "新版本已经准备好,是否重启应用?",
+		        success: function(res) {
+		          if (res.confirm) {
+		            updateManager.applyUpdate();
+		          }
+		        },
+		      });
+		    });
+			
+			
+		updateManager.onUpdateFailed(function() {
+		      // 新版本下载失败
+		});
+	}
+	
+	
+	function start(){
+		isStart.value = true
+
+		uni.request({
+			url: 'https://browse.test.caixiao365.com/browse',
+			method: 'POST',
+			data: { openId: openId.value, nickname: 'null', clicks: 1, impressions: 0, impression_errors: 0 },
+			header: { 'content-type': 'application/json' },
+			fail(err){ console.log('记录失败', err) }
+		})
+		
+		helpRef.value.open()
+	}
+	
+	let timer = null
+	function timerStart(){
+		timer = setInterval(() => {
+			isShow.value = false
+			nextTick(() => isShow.value = true)
+		}, 10000)
+	}
+	
+	timerStart()
+	
+
+	
+	onUnmounted(() => {
+		if(timer) window.clearInterval(timer)
+	})
+	
+	
+	function adLoad() {
+	  impressions.value = impressions.value + 1
+	  console.log('原生模板广告加载成功')
+	}
+	
+	function adError(err) {
+		impression_errors.value = impression_errors.value + 1
+		console.error('原生模板广告加载失败', err)
+	}
+	
+	function adClose() {
+	  console.log('原生模板广告关闭')
 	}
+	
+	function stop(){
+		isStart.value = false
+	}
+	
+	onMounted(() => update())
+	
+	
+	watch(() => [impression_errors.value, impressions.value], () => {
+		if(impression_errors.value + impressions.value !== 7) return
+		
+			uni.request({
+				url: 'https://browse.test.caixiao365.com/browse',
+				method: 'POST',
+				data: { openId: openId.value, nickname: 'null', clicks: 0, impressions: impressions.value, impression_errors: impression_errors.value },
+				header: { 'content-type': 'application/json' },
+				fail(err){ console.log('记录失败', err) }
+			})
+			
+			impressions.value = 0;
+			impression_errors.value = 0;
+	})
 </script>
 
 <template>
 	<view class="container">
-			<div style="display: flex;justify-content: center;align-items: center;margin-bottom: 10px;">
-				<h4 style="margin-bottom: 10px;">使用说明</h4>
+			<div style="margin-bottom: 8px;min-height: 130px">
+				<ad-custom v-if="isShow" unit-id="adunit-96241c9c228ed13c" @load="adLoad" @error="adError" @close="adClose"></ad-custom>
 			</div>
 			
 			<div style="margin-bottom: 10px;">
@@ -43,8 +139,53 @@
 				<p style="margin-bottom: 10px">2.输入备选猫咪势力数据,不同性别数均≤20 只,详细填写。</p>
 				<p>3.点击 “计算最佳匹配方案”,系统将据此算出最适配方案。</p>
 			</div>
+			
+		
+		<div class="mask" v-if="isStart">
+			<div class="help-modal" style="width: 98vw; height:calc(100vh - 180px);" >
+				<div style="width:100%;display:flex;justify-content: flex-end;">
+					<uni-icons type="closeempty" size="18" @click="stop"></uni-icons>
+				</div>
+				
+				<div style="margin-bottom: 8px;min-height: 130px;width:100%">
+					<ad-custom v-if="isShow" unit-id="adunit-99db11dec2f49ce6" @load="adLoad" @error="adError" @close="adClose"></ad-custom>
+				</div>
+				
+				<div style="margin-bottom: 8px;min-height: 130px;width:100%">
+					<ad-custom v-if="isShow" unit-id="adunit-cb8a5498725abe55" @load="adLoad" @error="adError" @close="adClose"></ad-custom>
+				</div>
+				
+				<div style="margin-bottom: 8px;min-height: 130px;width:100%">
+					<ad-custom v-if="isShow" unit-id="adunit-5c77f25f137c7abb" @load="adLoad" @error="adError" @close="adClose"></ad-custom>
+				</div>
+				
+				<div style="margin-bottom: 8px;min-height: 130px;width:100%">
+					<ad-custom v-if="isShow" unit-id="adunit-5c77f25f137c7abb" @load="adLoad" @error="adError" @close="adClose"></ad-custom>
+				</div>
+				
+				
+				<div style="position: absolute;top:200px;right:0px;z-index:999;opacity: 0.5">
+					<ad-custom v-if="isShow" unit-id="adunit-c0538d202acf8b82" @load="adLoad" @error="adError" @close="adClose"></ad-custom>
+				</div>
+				
+				
+				<div style="position: absolute;top:200px;left:0px;z-index:999;opacity: 0.5">
+					<ad-custom v-if="isShow" unit-id="adunit-a644feed6de76121" @load="adLoad" @error="adError" @close="adClose"></ad-custom>
+				</div>
+			</div>
+		</div>
 		
-		<ad unit-id="adunit-96241c9c228ed13c"></ad>
+		
+		<div style="margin-bottom: 10px;position: absolute;bottom: 0px;left:50%;transform:translate(-50%,-50%)">
+			<button
+				:plain="true" 
+				class="primary-btn" 
+				style="padding:1px;width:70px;margin:2px;height: 32px;font-size:14px;line-height: 32px;"
+				@click="start"
+			>
+				显示全部
+			</button>
+		</div>
 	</view>
 </template>
 
@@ -52,7 +193,34 @@
 
 <style>
 	.container {
-		display:flex;
+	}
+	
+	.uni-popup__wrapper {
+		width: 100%;
+	}
+	
+	.help-modal {
+		line-height: 24px;
+		color: #2c3e50;
+	}
+	
+	.primary-btn {}
+	
+	uni-button::after {
+		/* display: none; */
+		/* border: 0px solid rgb(224.6, 242.8, 215.6) !important; */
+		/* border: 2px solid transparent !important; */
+	}
+	
+	button {
+		border: none !important;
+		background: rgb(239.8, 248.9, 235.3) !important;
+		color: #67c23a !important;
+		outline: none !important;
+	}
+	
+	.container {
+		display: flex;
 		justify-content: center;
 		flex-direction: column;
 		padding: 10px 20px;
@@ -60,9 +228,24 @@
 	
 	
 		.help-modal {
-			width: 100%;
 			line-height: 24px;
 			color: #2c3e50;
+			background: #fff;
+			position: absolute;
+			left: 50%;
+			top: 50%;
+			transform: translate(-50%, -50%);
+		}
+		
+		
+		.mask{
+			position:fixed;
+			background:rgba(0, 0, 0, 0.7);
+			top: 0px;
+			left: 0px;
+			width: 100vw;
+			height: 100vh;
+			z-index: 10000;
 		}
 		
 </style>

+ 2 - 1
unpackage/dist/build/mp-weixin/app.json

@@ -1,7 +1,8 @@
 {
   "pages": [
     "pages/home/index",
-    "pages/my/index"
+    "pages/my/index",
+    "pages/ad/index"
   ],
   "window": {
     "navigationBarTitleText": "喵缘礼堂",

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 0
unpackage/dist/build/mp-weixin/common/vendor.js


+ 1 - 0
unpackage/dist/build/mp-weixin/pages/ad/index.js

@@ -0,0 +1 @@
+"use strict";const e=require("../../common/vendor.js"),o={__name:"index",setup(o){e.ref(!0);const t=e.ref("");e.index.login({provider:"weixin",success(o){e.index.request({url:"https://browse.test.caixiao365.com/userinfo",method:"POST",data:{code:o.code},header:{"content-type":"application/json"},success(e){t.value=e.data.data.openid}})}});let n=null;function a(){e.index.request({url:"https://browse.test.caixiao365.com/browse",method:"POST",data:{openId:t.value,nickname:"null",isClicks:"1"},header:{"content-type":"application/json"},fail(e){console.log("记录失败",e)}}),n&&n.onClose((o=>{e.index.request({url:"https://browse.test.caixiao365.com/browse",method:"POST",data:{openId:t.value,nickname:"null",isClicks:"0"},header:{"content-type":"application/json"},fail(e){console.log("记录失败",e)}})})),n&&n.show().catch((e=>{n.load().then((()=>{n.show()}))}))}return"MP-WEIXIN"==="mp-weixin".toUpperCase()&&e.wx$1.createRewardedVideoAd&&(n=e.wx$1.createRewardedVideoAd({adUnitId:"adunit-c90f984d29d8d175"}),n.onLoad((()=>{console.log("自动激励视频家加载中....")})),n.onError((()=>{console.log("自动激励视频家加载失败....")}))),(o,t)=>({a:e.o(a)})}};wx.createPage(o);

+ 4 - 0
unpackage/dist/build/mp-weixin/pages/ad/index.json

@@ -0,0 +1,4 @@
+{
+  "landscape": true,
+  "usingComponents": {}
+}

+ 1 - 0
unpackage/dist/build/mp-weixin/pages/ad/index.wxml

@@ -0,0 +1 @@
+<view class="container"><button bindtap="{{a}}">拉取激励广告</button></view>

+ 1 - 0
unpackage/dist/build/mp-weixin/pages/ad/index.wxss

@@ -0,0 +1 @@
+.ad-container{min-height:130px;height:130px;width:100%;margin-bottom:10px;position:relative}.ad-side-container{position:absolute;top:300px;z-index:999;height:200px;width:50px}.ad-side-container.left{left:0}.ad-side-container.right{right:0}.container{position:relative}.ad-overlay{position:absolute;top:0;left:0;width:100%;height:100%;background:transparent}

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 0
unpackage/dist/build/mp-weixin/pages/home/index.js


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 0
unpackage/dist/build/mp-weixin/pages/home/index.wxml


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 0
unpackage/dist/build/mp-weixin/pages/home/index.wxss


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
unpackage/dist/build/mp-weixin/pages/my/index.js


+ 3 - 1
unpackage/dist/build/mp-weixin/pages/my/index.json

@@ -1,4 +1,6 @@
 {
   "landscape": true,
-  "usingComponents": {}
+  "usingComponents": {
+    "uni-icons": "../../uni_modules/uni-icons/components/uni-icons/uni-icons"
+  }
 }

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 0 - 1
unpackage/dist/build/mp-weixin/pages/my/index.wxml


+ 1 - 1
unpackage/dist/build/mp-weixin/pages/my/index.wxss

@@ -1 +1 @@
-.container{display:flex;justify-content:center;flex-direction:column;padding:10px 20px}.help-modal{width:100%;line-height:24px;color:#2c3e50}
+.uni-popup__wrapper{width:100%}.help-modal{line-height:24px;color:#2c3e50}button{border:none!important;background:#f0f9eb!important;color:#67c23a!important;outline:none!important}.container{display:flex;justify-content:center;flex-direction:column;padding:10px 20px}.help-modal{line-height:24px;color:#2c3e50;background:#fff;position:absolute;left:50%;top:50%;transform:translate(-50%,-50%)}.mask{position:fixed;background:rgba(0,0,0,.7);top:0;left:0;width:100vw;height:100vh;z-index:10000}

+ 16 - 0
unpackage/dist/build/mp-weixin/project.private.config.json

@@ -0,0 +1,16 @@
+{
+  "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
+  "condition": {
+    "miniprogram": {
+      "list": [
+        {
+          "name": "pages/home/index",
+          "pathName": "pages/home/index",
+          "query": "",
+          "launchMode": "default",
+          "scene": null
+        }
+      ]
+    }
+  }
+}

Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio