更新记录

1.0.5(2025-07-15)

  • 【优化】部分代码

1.0.4(2025-07-08)

  • 【修改】使用文档

1.0.3(2025-07-08)

  • 【重要】苹果端:由.a库调整到.h
查看更多

平台兼容性

uni-app x(4.63)

Chrome Safari Android Android插件版本 iOS iOS插件版本 鸿蒙 微信小程序
- - 5.0 1.0.5 12 1.0.5 - -

Turbo UI 系列插件 - 微信SDK

  • 如您已购买Turbo UI,那么该插件可以免费使用源码版!

  • 使用需要打自定义基座,最新支持4.66,4.71,4.72版本,其他自测

  • 支持授权登录

  • uni-app 安卓AndroidManifest.xml配置 路径:/uni_modules/t-weixin-api/utssdk/app-android/AndroidManifest.xml

  • ${applicationId}改为你的应用包名

  • uni-app x 无需配置

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
    package="uts.sdk.modules.tWeixinApi">
    <uses-permission android:name="android.permission.INTERNET" />

    <queries>
        <package android:name="com.tencent.mm" />
    </queries>

    <application>
        <activity android:name="uts.sdk.modules.tWeixinApi.WXEntryActivity" android:label="@string/app_name"
            android:theme="@android:style/Theme.Translucent.NoTitleBar" android:exported="true"
            android:taskAffinity="${applicationId}" android:launchMode="singleTask">
        </activity>

        <activity-alias android:name="${applicationId}.wxapi.WXEntryActivity" android:exported="true"
            android:targetActivity="uts.sdk.modules.tWeixinApi.WXEntryActivity">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:scheme="wx" />
            </intent-filter>
        </activity-alias>

        <provider android:name="androidx.core.content.FileProvider" android:authorities="${applicationId}.fileprovider"
            android:exported="false" android:grantUriPermissions="true" tools:replace="android:authorities">
            <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_provider"
                tools:replace="android:resource" />
        </provider>
    </application>
</manifest>
  • uni-app/uni-app x iOS配置,路径:/uni_modules/t-weixin-api/utssdk/app-ios/Info.plist

  • 修改你的Appid
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>
        <key>LSApplicationQueriesSchemes</key>
        <array>
            <string>weixin</string>
            <string>weixinULAPI</string>
            <string>weixinURLParamsAPI</string>
        </array>
        <key>CFBundleURLTypes</key>
        <array>
            <dict>
                <key>CFBundleURLName</key>
                <string>weixin</string>
                <key>CFBundleURLSchemes</key>
                <array>
                    <string>你的Appid</string>
                </array>
            </dict>
        </array>
    </dict>
</plist>
  • uni-app x 使用示例

<script setup lang="uts">
    import {
        tWxRegister,
        TWeixinRegisterOptions,
        TWeixinResult,
        tWxAuth,
        TWeixinAuthOptions
    } from "@/uni_modules/t-weixin-api"
    const login = () => {
        new Promise((resolveT: (value: TWeixinResult) => void,rejectT: (value: TWeixinResult) => void) => {
            tWxAuth({
                scope: "snsapi_userinfo",
                state: "123",
                resolve: (result:TWeixinResult) => {
                    resolveT(result)
                },
                reject: (result: TWeixinResult) => {
                    rejectT(result)
                }
            } as TWeixinAuthOptions)
        }).then((result: TWeixinResult) => {
            console.log(result)
        })
    }
    onReady(() => {
        tWxRegister({
            appid: "你的Appid",
            universalLink: "你的urllink ios必填"
            success: (result : TWeixinResult) => {
                console.log("微信SDK注册成功",result)
            },
            fail: (result : TWeixinResult) => {
                console.log("微信SDK注册失败",result)
            }
        } as TWeixinRegisterOptions)
    })
</script>
  • uni-app 使用示例

<script setup>
    import {
        tWxRegister,
        tWxAuth
    } from "@/uni_modules/t-weixin-api"
    const login = () => {
        new Promise((resolveT,rejectT) => {
            tWxAuth({
                scope: "snsapi_userinfo",
                state: "123",
                resolve: (result) => {
                    resolveT(result)
                },
                reject: (result) => {
                    rejectT(result)
                }
            })
        }).then((result) => {
            console.log(result)
        })
    }
    onReady(() => {
        tWxRegister({
            appid: "你的Appid",
            universalLink: "你的urllink ios必填"
            success: (result) => {
                console.log("微信SDK注册成功",result)
            },
            fail: (result) => {
                console.log("微信SDK注册失败",result)
            }
        })
    })
</script>
  • 暴露的类型

export type TWeixinResult = {
    code: number;
    msg: string;
    data?: any;
}
export type TWeixinRegisterOptions = {
    appid: string;
    universalLink: string;
    success?: (result: TWeixinResult) => void;
    fail?: (result: TWeixinResult) => void;
}
export type TWeixinAuthOptions = {
    scope: string;
    state: string;
    resolve?: (result: TWeixinResult) => void;
    reject?: (result: TWeixinResult) => void;
}
// #ifdef APP-IOS
export type TWxRegisterApi = (options:TWeixinRegisterOptions) => void;
export type TWxAuthApi = (options:TWeixinAuthOptions) => void;
// #endif

隐私、权限声明

1. 本插件需要申请的系统权限列表:

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

插件使用的 微信 SDK会采集数据,详情可参考:https://support.weixin.qq.com/cgi-bin/mmsupportacctnodeweb-bin/pages/RYiYJkLOrQwu0nb8

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

暂无用户评论。

使用中有什么不明白的地方,就向插件作者提问吧~ 我要提问