Quellcode durchsuchen

feat: 修改参数名称

huangzhichao vor 1 Jahr
Ursprung
Commit
8722544952
4 geänderte Dateien mit 12 neuen und 11 gelöschten Zeilen
  1. 2 2
      src/pages/index/index.tsx
  2. 6 5
      src/plugin/components/custom/index.tsx
  3. 2 2
      src/plugin/share/index.ts
  4. 2 2
      types/global.d.ts

+ 2 - 2
src/pages/index/index.tsx

@@ -9,7 +9,7 @@ const Index: React.FC = () => {
   useLoad(() => {
   useLoad(() => {
   })
   })
 
 
-  function openEmbeddedMiniProgram(appId, path) {
+  function onEmitOpenMiniProgram(appId, path) {
     Taro.openEmbeddedMiniProgram({
     Taro.openEmbeddedMiniProgram({
       appId,
       appId,
       path,
       path,
@@ -19,7 +19,7 @@ const Index: React.FC = () => {
 
 
   return (
   return (
     <View className='index'>
     <View className='index'>
-      <custom props={{ openEmbeddedMiniProgram, adpId: 'uh2321awe1', width:250 }}/>
+      <custom props={{ onEmitOpenMiniProgram, adpId: 'uh2321awe1', width:250 }}/>
     </View>
     </View>
   )
   )
 }
 }

+ 6 - 5
src/plugin/components/custom/index.tsx

@@ -19,7 +19,7 @@ function YLQCustom(props: PropsWithChildren<CustomPropsType>) {
   let {
   let {
     adpId,
     adpId,
     width,
     width,
-    openEmbeddedMiniProgram,
+    onEmitOpenMiniProgram,
     onError,
     onError,
     onLoad,
     onLoad,
     onClose
     onClose
@@ -37,7 +37,7 @@ function YLQCustom(props: PropsWithChildren<CustomPropsType>) {
   function init() {
   function init() {
     if (
     if (
         typeof adpId !== 'string' ||
         typeof adpId !== 'string' ||
-        typeof openEmbeddedMiniProgram !== 'function'
+        typeof onEmitOpenMiniProgram !== 'function'
       ) {
       ) {
       catchError('参数错误', 1031)
       catchError('参数错误', 1031)
       return
       return
@@ -107,7 +107,7 @@ function YLQCustom(props: PropsWithChildren<CustomPropsType>) {
     const orgPath = `path=${encodeURIComponent(landingPageAddress)}&${query}`
     const orgPath = `path=${encodeURIComponent(landingPageAddress)}&${query}`
     const path = AES.encrypt(orgPath, 'wx5ef216d1caf4a0eaylq').toString()
     const path = AES.encrypt(orgPath, 'wx5ef216d1caf4a0eaylq').toString()
 
 
-    openEmbeddedMiniProgram(
+    onEmitOpenMiniProgram(
       'wx5ef216d1caf4a0ea',
       'wx5ef216d1caf4a0ea',
       `/pages/ad-launch-page/index?q=${path}`
       `/pages/ad-launch-page/index?q=${path}`
     )
     )
@@ -194,10 +194,11 @@ function YLQCustom(props: PropsWithChildren<CustomPropsType>) {
   }
   }
 
 
   function catchError(message, code) {
   function catchError(message, code) {
-    onError({ message, code })
+    onError(code)
     setShow(false)
     setShow(false)
     adActionReport(reportBusinessType.adError, 'adError', {
     adActionReport(reportBusinessType.adError, 'adError', {
-      errorCode: code
+      errorCode: code,
+      message
     })
     })
   }
   }
 
 

+ 2 - 2
src/plugin/share/index.ts

@@ -6,7 +6,7 @@ export function wrapProps(props: PropsWithChildren<CustomPropsType>) {
   let {
   let {
     adpId,
     adpId,
     width,
     width,
-    openEmbeddedMiniProgram = noop,
+    onEmitOpenMiniProgram = noop,
     onError = noop,
     onError = noop,
     onLoad = noop,
     onLoad = noop,
     onClose = noop
     onClose = noop
@@ -15,7 +15,7 @@ export function wrapProps(props: PropsWithChildren<CustomPropsType>) {
   return {
   return {
     adpId,
     adpId,
     width,
     width,
-    openEmbeddedMiniProgram,
+    onEmitOpenMiniProgram,
     onError,
     onError,
     onLoad,
     onLoad,
     onClose
     onClose

+ 2 - 2
types/global.d.ts

@@ -36,8 +36,8 @@ declare namespace Taro {
 type CustomPropsType = {
 type CustomPropsType = {
   adpId: number
   adpId: number
   width?: number
   width?: number
-  openEmbeddedMiniProgram(appId: string, path: string): void
-  onError?(params: { message: string, code: number}): void
+  onEmitOpenMiniProgram(appId: string, path: string): void
+  onError?(code: number): void
   onLoad?(): void
   onLoad?(): void
   onClose?(): void
   onClose?(): void
 }
 }