nili 7 months ago
parent
commit
31956be4f1
  1. 6
      build/asset-manifest.json
  2. 2
      build/index.html
  3. 6
      build/static/js/main.359cfb57.js
  4. 0
      build/static/js/main.359cfb57.js.LICENSE.txt
  5. 1
      build/static/js/main.359cfb57.js.map
  6. 1
      build/static/js/main.7ee7a019.js.map
  7. 110
      src/declaration/umeng.d.ts
  8. 30
      src/page/RegisterPage.tsx

6
build/asset-manifest.json

@ -1,15 +1,15 @@
{
"files": {
"main.css": "/static/css/main.407c2891.css",
"main.js": "/static/js/main.7ee7a019.js",
"main.js": "/static/js/main.359cfb57.js",
"static/js/453.1d641cba.chunk.js": "/static/js/453.1d641cba.chunk.js",
"index.html": "/index.html",
"main.407c2891.css.map": "/static/css/main.407c2891.css.map",
"main.7ee7a019.js.map": "/static/js/main.7ee7a019.js.map",
"main.359cfb57.js.map": "/static/js/main.359cfb57.js.map",
"453.1d641cba.chunk.js.map": "/static/js/453.1d641cba.chunk.js.map"
},
"entrypoints": [
"static/css/main.407c2891.css",
"static/js/main.7ee7a019.js"
"static/js/main.359cfb57.js"
]
}

2
build/index.html

@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><script src="https://g.alicdn.com/jssdk/u-link/index.min.js"></script><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>奇迹畅玩</title><script defer="defer" src="/static/js/main.7ee7a019.js"></script><link href="/static/css/main.407c2891.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><script src="https://g.alicdn.com/jssdk/u-link/index.min.js"></script><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>奇迹畅玩</title><script defer="defer" src="/static/js/main.359cfb57.js"></script><link href="/static/css/main.407c2891.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>

6
build/static/js/main.7ee7a019.js → build/static/js/main.359cfb57.js

File diff suppressed because one or more lines are too long

0
build/static/js/main.7ee7a019.js.LICENSE.txt → build/static/js/main.359cfb57.js.LICENSE.txt

1
build/static/js/main.359cfb57.js.map

File diff suppressed because one or more lines are too long

1
build/static/js/main.7ee7a019.js.map

File diff suppressed because one or more lines are too long

110
src/declaration/umeng.d.ts

@ -1,13 +1,97 @@
declare function ULink(options: [{
id: string;
data: {
inviteCode: string;
};
selector: string;
auto?: boolean;
timeout?: number;
lazy?: boolean;
useOpenInBrowerTips?: string,
useClipboard: (clipboardToken:string) => void
}]): void;
declare function ULink(options: [LinkOption]): void;
declare namespace ULink {
const isIOS: () => boolean;
const isWechat:boolean,
const isQQ:boolean
}
/**
* Ulink配置
*/
interface LinkConfig {
id: string; // 必填参数,后台生成的linkid
data?: object; // 自定义参数例如{a:1,b:2} 换起应用时会携带过去并映射成a=1&b=2
}
/**
*
*/
type ReadyCallback = {
(ctx: LinkInstance): void;
};
/**
*
*/
interface ISolutions {
wakeupUrl: string; // 唤起地址
type: "scheme" | "universalLink"; // 唤起类型
downloadUrl: string; // 下载地址
appkey: string; // 对应appkey
clipboardToken?: string; // 友盟后台开启剪切板能力时返回此字段,开启后可提高带参安装匹配成功率。
}
interface IWakeup {
action?: "" | "load" | "click"; // 设置统计上报的唤起方式
proxyOpenDownload?: IProxyOpenDownload; // 代理打开下载提示行为
beforeOpenDownload?: ICallback;
afterOpenDownload?: ICallback;
timeout?: number; //触发弹窗等待超时时间单位毫秒,默认200毫秒,安卓中微信强制为0
}
type ICallback = {
(ctx: LinkInstance): void;
};
type defaultActionCallback = {
(extdata?: object): void;
};
type IProxyOpenDownload = {
(defaultAction: defaultActionCallback, ctx: LinkInstance): any; // 如仍需执行默认弹窗行为可调用defaultActionCallback
};
/**
* Ulink实例
*/
interface LinkInstance {
ready(callback: ReadyCallback): void; // 配置下发
wakeup(config: IWakeup): LinkInstance; // 唤起
solution: ISolutions; // 配置下发内容
}
type ProxyOpenInBrowerTips = {
(): string;
};
type ProxyShowLoading = {
(): void;
};
type ProxySHideLoading = {
(): void;
};
/**
* token
*/
type SetClipboardText = {
(clipboardToken:string): string;
}
type LinkOption = {
id: string; // 必填参数,后台生成的linkid
selector?: string; // 需要点击唤起的元素选择器(采用事件代理模式,不必等元素创建后绑定),示例 '#idxx,#idxxx',参考文档https://developer.mozilla.org/zh-CN/docs/Web/API/Document_Object_Model/Locating_DOM_elements_using_selectors
data?: object; // 自定义参数例如{a:1,b:2} 换起应用时会携带过去并映射成a=1&b=2
proxyOpenDownload?: IProxyOpenDownload; // 自定义打开下载提示行为
timeout?: number; // 触发弹窗等待超时时间单位毫秒,默认200毫秒,安卓中微信强制为0
auto?: boolean; // 是否自动唤起,默认false,配置下发后不自动唤起应用(特别注意,部分web容器会限制自动唤起)
lazy?: boolean; // 是否将配置下发延迟到点击时下发,默认false,如果需延迟到点击时下发配置应设置为true
useOpenInBrowerTips?: string | ProxyOpenInBrowerTips; // 是否在微信和qq中使在浏览器中打开的提示,当值为string类型时,默认'default',值为function时,需要该函数返回蒙层html片段。
useLoading?: string | [ProxyShowLoading, ProxySHideLoading]; // 即将支持 当值为string类型时,默认'default',启用自带loading,当值为数值时,数组第一个函数触发唤起时触发,第二个函数关闭loading时触发
onready?:ReadyCallback; // 配置下发后触发
useClipboard?:boolean | SetClipboardText; //开发者在产品后台打开剪切板功能后此功能才生效,默认 为true, true 代表在唤起时用clipboardToken覆盖剪切板内容;false代表不会覆盖剪切板内容,开发者可以在onready后获取配置下发的token;如果是一个function,则将function返回的string写到剪切板,function的入参是配置下发的clipboardToken,当且仅当开发者需要自定义剪切板内容时使用。特别注意,若服务端剪切板功能关闭,则此配置完全失效。(2021.04.23上架生效)
};

30
src/page/RegisterPage.tsx

@ -1,6 +1,6 @@
// RegisterPage.js
import { Button, Image, Toast } from "antd-mobile";
import React, { useEffect } from "react";
import React, { useEffect, useState } from "react";
import { useParams } from "react-router-dom";
import { api } from "../api";
@ -9,6 +9,7 @@ import { InviteInfo } from "../api/generated";
const RegisterPage = () => {
const [info, setInfo] = React.useState<InviteInfo>();
const { inviteCode } = useParams();
const [ctx, setCTX] = useState<LinkInstance>();
useEffect(() => {
const getApp = async () => {
@ -40,11 +41,17 @@ const RegisterPage = () => {
useClipboard: (token: string) => {
return "inviteCode:" + inviteCode + "&umclp=" + token;
},
onready: (ctx) => {
setCTX(ctx);
},
},
]);
} else {
Toast.show("配置有误");
}
if (ULink.isIOS()) {
Toast.show("暂不支持ios");
}
};
getApp();
}, [inviteCode]);
@ -69,9 +76,24 @@ const RegisterPage = () => {
{info?.name}
</p>
<Button
// onClick={() => {
// Toast.show({ content: "目前暂不支持ios系统" });
// }}
onClick={() => {
if (ULink.isIOS()) {
Toast.show({ content: "目前暂不支持ios系统" });
}
ctx?.wakeup({
action: "click",
proxyOpenDownload: (defaultAction, cctx) => {
if (cctx.solution.type === "scheme") {
if (ULink.isWechat || ULink.isQQ) {
defaultAction();
} else {
window.location.href = cctx.solution.downloadUrl;
}
}
},
timeout: 2000,
});
}}
id="download"
style={{ width: 200, margin: "auto" }}
color="primary"

Loading…
Cancel
Save