惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
V2EX
P
Proofpoint News Feed
D
DataBreaches.Net
C
Check Point Blog
L
LangChain Blog
量子位
美团技术团队
Vercel News
Vercel News
人人都是产品经理
人人都是产品经理
N
Netflix TechBlog - Medium
V
Visual Studio Blog
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
MongoDB | Blog
MongoDB | Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Last Week in AI
Last Week in AI
The GitHub Blog
The GitHub Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
U
Unit 42
腾讯CDC
M
MIT News - Artificial intelligence
Microsoft Azure Blog
Microsoft Azure Blog
Blog — PlanetScale
Blog — PlanetScale

时间的朋友

Windows 命令行密码重置 Anaconda安装 typescript 注解解读1 Konvajs Shape加载自定义图片 sshpass 使用 why-is-node-running webgl笔记 SharedArrayBuffer is not defined blender 常用快捷键 | 时间的朋友 vue -- v3.4commit提交记录2 vue2 升级vue3报错问题整理 着色器 expressjs 源码 hyper-V arch linux 网络配置 element input数字格式化 three 拼接货架 WebAudio笔记 Windows nginx重启bat脚本 vue -- v3.4commit提交记录 URI malformed vue3 -- Class 对象在组件中使用范例 | 时间的朋友 ruby 安装和升级 element-plus 老版本cascader使用卡死问题 vue3 内置Transition组件 | 时间的朋友 前端memo的实现 | 时间的朋友 Vue -- vue-class-component源码 | 时间的朋友 linux 优化脚本 typescript 装饰器 | 时间的朋友 microbundle 源码 | 时间的朋友 WSL2问题解决WslRegisterDistribution failed with error: 0x800701bc
小程序 -- 内部使用webview绑定微信公众号openId | 时间的朋友
2023-04-12 · via 时间的朋友

Published: · LastMod: April 14, 2023 · 203 words

小程序 – 内部使用webview绑定微信公众号openId 🔗

小程序内部 🔗

1
2
3
4
5
6
7
<template>
	<web-view :src="url"></web-view>
</template>
<script setup>
    // 最后路径
const url = computed(() => `${baseURL}/chat-list?token=${userStore.switchToken}&officialIsBind=${official.value}&schema=${userStore.schema}&userInfo=${JSON.stringify(userStore.wxUserInfo)}`)
</script>

h5内部 🔗

1
2
3
4
5
6

router.beforeEach(() => {
    if(query.officialIsBind === 'false') {
        window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa40d62540ee5255f&redirect_uri=http://xxxxxxxxxx/login&response_type=code&scope=snsapi_base&connect_redirect=1#wechat_redirect`
    }
})

这里redirect_uri要设置另外一个页面,比如说login

微信会在回调时调用这个login页面

/login?code=xxxxx&state=xxxx

这里code是微信回调的,state可以在上面这个链接中附带,128个字节

在login页面调用后端接口绑定小程序和公众号两边的openId