https://www.npmjs.com/package/callapp-lib

一个封装了的唤起程序

示例程序可以参考这个
https://github.com/withwz/callapp-lib/blob/master/example/index.html

uniapp设置

在distribute-》android-》设置schemes,可以是一个数组

  1. "distribute": {
  2. "android": {
  3. "schemes": [
  4. "e3krnb",
  5. "ebb"
  6. ]
  7. }
  8. }

易帮帮示例

  1. <template>
  2. <view class="container">
  3. <CmdNavBar
  4. :back="`ooo`"
  5. left-text="我的"
  6. title="易帮帮"
  7. iconTwo="help"
  8. font-color="#fff"
  9. background-color="rgb(216,40,37)"
  10. @iconTwo="linkManager('../help/help')"
  11. />
  12. <!-- #ifdef APP-PLUS -->
  13. <view class="status-bar"></view>
  14. <view style="height:92upx"></view>
  15. <!-- #endif -->
  16. <button @click="install">安装</button>
  17. </view>
  18. </template>
  19. <script>
  20. import { mapState, mapActions, mapMutations } from "vuex";
  21. import CallApp from "callapp-lib";
  22. import { msgToken } from "@/api/request";
  23. import routerManager from "@/unit/routerManager/routerManager";
  24. import CmdNavBar from "@/components/cmd-nav-bar/cmd-nav-bar.vue";
  25. export default {
  26. data() {
  27. return {
  28. lib: ""
  29. };
  30. },
  31. computed: {
  32. ...mapState({
  33. userId: state => state.user.userId
  34. })
  35. },
  36. onLoad(params) {
  37. this.checkAppStatus();
  38. },
  39. methods: {
  40. ...mapMutations(["TOKEN_VERIFY"]),
  41. linkManager(url) {
  42. routerManager(url);
  43. },
  44. install() {
  45. const callLab = this.lib;
  46. console.log(callLab);
  47. callLab.open({
  48. path: "profile"
  49. });
  50. // 因为业务需要,我们需要添加 outChain 属性
  51. // 但是这样生成出来的 scheme 稍显复杂,所以下面的 log 其实是移除了 outChain 属性的
  52. // outChain 很少有同学会使用到,所以更方便大家理解
  53. // ykshortvideo://profile
  54. console.log(callLab.generateScheme({ path: "profile" }));
  55. // intent://profile#Intent;package=com.youku.shortvideo;scheme=ykshortvideo;S.browser_fallback_url=https%3A%2F%2Fdianliu.youku.com%2Fservice%2Fdownload;end;
  56. console.log(callLab.generateIntent({ path: "profile" }));
  57. // https://flash-link.youku.com?action=profile
  58. console.log(callLab.generateUniversalLink({ path: "profile" }));
  59. },
  60. checkAppStatus() {
  61. const option = {
  62. scheme: {
  63. protocol: "ebb"
  64. },
  65. /**
  66. * 应用宝链接
  67. */
  68. yingyongbao: "//a.app.qq.com/o/simple.jsp?",
  69. /**
  70. * 唤起失败跳转的链接
  71. */
  72. fallback: "https://www.baidu.com/",
  73. timeout: 2000
  74. };
  75. this.lib = new CallApp(option);
  76. }
  77. },
  78. components: {
  79. CmdNavBar
  80. }
  81. };
  82. </script>
  83. <style lang="scss" scoped>
  84. /*沉浸状态栏变化*/
  85. .status-bar {
  86. width: 750upx;
  87. height: var(--status-bar-height);
  88. }
  89. </style>