0

我已经开发了一个自定义 Microsoft Teams 应用程序,它可以在桌面上正常运行,但它不能在移动应用程序上运行。它只显示有关调试的页面。

这是进入移动应用程序的标签:

在此处输入图像描述

我该如何解决?谢谢

这是桌面应用程序的选项卡:

在此处输入图像描述

这是我的个人应用程序的主页选项卡代码的一部分:

class Tab extends React.Component {
constructor(props) {
    super(props)
    this.state = {
        user: null,
        loading: true,
        isLogged: false,
        error: null,
        layout: true
    }
}

componentDidMount() {
    const params = new URLSearchParams(this.props.location.search);
    let teamsUser = {
        Tid: params.get('tid'),
        Aaid: params.get('aaId')
    }

    getUser(teamsUser).then((userResponse) => {
        this.setState({
            user: userResponse,
            loading: false,
            isLogged: true
        })
    }).catch((error) => {
        logger.warn(JSON.stringify(error));
        this.setState({
            error: error,
            loading: false
        })
    });
}

setLogged = (user) => {
    this.setState({
        user: user,
        isLogged: true,
        loading: false
    })
}

render() {
    let content;

    const { user, loading, isLogged, error } = this.state;

    if (loading) {
        content = <Loading></Loading>
    } else if (error) {
        throw Error(error)
    }
    else if (isLogged) {
        content = <Catalogue user={user}></Catalogue>
    } else {
        content = <UserLogin setLogged={this.setLogged}></UserLogin>
    }

    return (
        <Layout>
            {content}
        </Layout>
    );
}
}
export default Tab

这是我的清单,我将 url 与 tid 和 aaid 放在了一起:

        {
      "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.9/MicrosoftTeams.schema.json",
      "manifestVersion": "1.9",
      "version": "1.0.0",
      "id": "86af4197-14c8-4439-a440-3d33b4567f54",
      "packageName": "com.microsoft.teams.extension",
      "developer": {
        "name": "Teams App, Inc.",
        "websiteUrl": "https://localhost:3000",
        "privacyUrl": "https://localhost:3000/privacy",
        "termsOfUseUrl": "https://localhost:3000/termsofuse"
      },
      "icons": {
        "color": "color.png",
        "outline": "outline.png"
      },
      "name": {
        "short": "AppLocal",
        "full": ""
      },
      "description": {
        "short": "Short description for Personal App.",
        "full": "Full description of Personal App."
      },
      "accentColor": "#FFFFFF",
      "staticTabs": [
        {
          "entityId": "index",
          "name": "Catalogue",
          "contentUrl": "https://localhost:3000/catalogue?tid={tid}&aaId={userObjectId}",
          "websiteUrl": "https://localhost:3000/catalogue",
          "scopes": [
            "personal"
          ]
        },
        {
          "entityId": "live",
          "name": "Live",
          "contentUrl": "https://localhost:3000/live?tid={tid}&aaId={userObjectId}",
          "websiteUrl": "https://localhost:3000/live",
          "scopes": [
            "personal"
          ]
        },
        {
          "entityId": "about",
          "scopes": [
            "personal"
          ]
        }
      ],
      "permissions": [
        "identity",
        "messageTeamMembers"
      ],
      "validDomains": [
        "localhost:3000",
        "localhost"
      ]
    }

我希望上面提到的代码可以帮助你帮助我。

4

2 回答 2

1

我已经用你的代码进行了测试,我用 ngrok URL 替换了 localhost URL,它工作正常。在本地运行应用程序不会让你访问 Teams 应用程序功能。那么请您尝试使用ngrok url。

于 2021-04-30T09:03:44.467 回答
0

我解决了,我的错误在 App.js 文件中。尝试在 Microsoft Teams 外部打开 url 时,我有一个错误的路径重定向到另一个页面(上面发布的页面)。我已经删除它,所有工作都很好。谢谢大家

于 2021-05-04T08:09:59.817 回答