当前位置: 首页 > news >正文

ukidc做电影网站淘宝客怎么做直播网站

ukidc做电影网站,淘宝客怎么做直播网站,seo网站优化平台,邯郸市人口目录 一、使用组件 二、登录功能 2.1 步骤 2.2 首先找到网页权限 复制demo 代码 这里我们需要修改两个参数 三、前端代码 3.1 api 里weiXinApi.ts 3.2 api里的 index.ts 3.3 pinia.ts 3.4 My.vue 四、后端代码 4.1 WeiXinController 4.2 Access_Token.Java 4.3 We…目录 一、使用组件 二、登录功能 2.1 步骤 2.2 首先找到网页权限 复制demo 代码 这里我们需要修改两个参数 三、前端代码 3.1 api 里weiXinApi.ts 3.2 api里的 index.ts 3.3 pinia.ts 3.4 My.vue  四、后端代码 4.1 WeiXinController 4.2 Access_Token.Java 4.3 WeiXinUser.java 五、效果图 5.1 登录之前效果图 5.2 登录之后效果图 六、源代码参考 6.1 前端源代码参考 6.2 后端源代码参考 一、使用组件 vant4:https://vant-contrib.gitee.io/vant/#/zh-CN 二、登录功能 2.1 步骤 想要点击微信登录四个字 跳转到登录页面 2.2 首先找到网页权限 复制demo 代码 这里我们需要修改两个参数 applid唯一id和redirect_uri授权后重定向的回调链接地址 请使用 urlEncode 对链接进行处理 其中applid 注册的时候已经给我们了 比如说我们点击微信登录想要跳转到 http:h5.a.com/my 就可以用下面的编码工具进行编码然后放到最初的demo链接里。UrlEncode - 在线URL网址编码、解码在线URL网址编码、解码https://www.qianbo.com.cn/Tool/Url-Encode.html 点击 微信登录 注意 前端端口 最好设置为 80 否则很可能提示 redirect_uri参数错误 三、前端代码 3.1 api 里weiXinApi.ts import http from /http/index; export default {getAccessToken: {name: 获取token,url: /api/weixin/access_token,call: async function name(params: any {}) {return await http.get(this.url, params);},},};3.2 api里的 index.ts import weiXinApi from ./weiXinApi;export {weiXinApi,};3.3 pinia.ts import { createPinia, defineStore } from pinia; import piniaPluginPersistedstate from pinia-plugin-persistedstate;const pinia createPinia(); pinia.use(piniaPluginPersistedstate); export default pinia;const h5Store defineStore(h5Store, {state: () {return {//定义变量name: 微信登录,nickname:,headimgurl:https://img2.baidu.com/it/u2092827811,169092614fm253fmtautoapp138fJPEG?w500h500,openid:,token: ,};},persist: {// 在这里进行自定义配置key: h5Store,storage: localStorage, //将数据持久化到本地浏览器中}, }); export { h5Store };3.4 My.vue  templateview classimage-containervan-rowvan-col span8van-imageroundwidth10remheight10rem:srch5_store.headimgurl/van-imagediv classtext-center!-- 1.微信登录获取code --a hrefhttps://open.weixin.qq.com/connect/oauth2/authorize?appidwxd7cd618e72d4f454redirect_urihttp%3A%2F%2Fh5.a.com%2Fmyresponse_typecodescopesnsapi_userinfostateSTATE#wechat_redirect{{h5_store.name}}/a/div/van-col span8/van-row/view /templatescript langts setup import { ref, onMounted } from vue; import {useRoute} from vue-router import {weiXinApi} from /api/index // 导入pinia import { h5Store } from /store/pinia; const h5_storeh5Store(); const routeuseRoute(); onMounted(() {// 第一步获取code const {code ,state} route.query;console.log(code);//091qixFa1lNlgH0dPlHa1XBkP43qixFsif(code!undefined){weiXinApi.getAccessToken.call({code:code}).then((res:any){// 登录成功获取用户的信息后 将头像和openid保存到store中console.log(res);h5_store.nameres.data.nickname;h5_store.headimgurlres.data.headimgurl;h5_store.openidres.data.openid;})} }); /script style langcss scoped /* 在wxss文件中 */ .image-container {position: relative;left: 25%; /* 水平居中 */align-items: center; /* 垂直居中如果需要 */width: 100%; /* 或者设定一个固定的宽度以适应屏幕 */height: auto; /* 根据实际情况调整高度 */background-color:cyan } .text-center {position: relative; /* 开启相对定位 */left: 50%;display: inline-block; /* 可能需要这个来确保文本块可以在一行内显示 */ } /style四、后端代码 4.1 WeiXinController package com.by.controller;import cn.hutool.core.util.StrUtil; import cn.hutool.http.HttpUtil; import cn.hutool.json.JSONUtil; import com.by.model.Access_Token; import com.by.model.WeiXinUser; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController;RestController RequestMapping(/api/weixin) public class WeiXinController {/*** 微信公众号注册后的appid和appsecret*/private String appID wxd7cd618e72d4f454;private String appsecret a939c776a064d8358ed66d9c68aeeded;GetMapping(/access_token)public WeiXinUser getAccessToken(String code) {/*** 2. 通过code换取网页授权access_token*/String url StrUtil.format(https://api.weixin.qq.com/sns/oauth2/access_token?appid{}secret{}code{}grant_typeauthorization_code,appID,appsecret,code);String body HttpUtil.get(url);Access_Token access_token JSONUtil.toBean(body, Access_Token.class);/*** 4. 获取用户信息*/url StrUtil.format(https://api.weixin.qq.com/sns/userinfo?access_token{}openid{}langzh_CN,access_token.getAccess_token(),access_token.getOpenid());body HttpUtil.get(url);WeiXinUser wanted_user JSONUtil.toBean(body, WeiXinUser.class);return wanted_user;} }4.2 Access_Token.Java package com.by.model;import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor;Data AllArgsConstructor NoArgsConstructor Builder public class Access_Token {/*** 获取到的凭证*/private String access_token;private int expires_in;private String refresh_token;private String openid;}4.3 WeiXinUser.java package com.by.model;import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor;Data AllArgsConstructor NoArgsConstructor Builder public class WeiXinUser {private String openid;private String nickname;private int sex;private String province;private String city;private String country;private String headimgurl;private String privilege;private String unionid; }五、效果图 将头像和昵称和openid 存到pinia 中当前端发出的请求被后端正常响应后 将图片和昵称从结果集中拿出来赋给pinia 里的头像和昵称 5.1 登录之前效果图 5.2 登录之后效果图 六、源代码参考 6.1 前端源代码参考 https://codeup.aliyun.com/62858d45487c500c27f5aab5/huang-h5-weixin.git 6.2 后端源代码参考 https://codeup.aliyun.com/62858d45487c500c27f5aab5/SpringBoot-WeiXin.git 
文章转载自:
http://www.morning.lyldhg.cn.gov.cn.lyldhg.cn
http://www.morning.mwmtk.cn.gov.cn.mwmtk.cn
http://www.morning.rfldz.cn.gov.cn.rfldz.cn
http://www.morning.rfwkn.cn.gov.cn.rfwkn.cn
http://www.morning.qwmsq.cn.gov.cn.qwmsq.cn
http://www.morning.jcyyh.cn.gov.cn.jcyyh.cn
http://www.morning.ffgbq.cn.gov.cn.ffgbq.cn
http://www.morning.slkqd.cn.gov.cn.slkqd.cn
http://www.morning.tsgxz.cn.gov.cn.tsgxz.cn
http://www.morning.lpzqd.cn.gov.cn.lpzqd.cn
http://www.morning.rqkck.cn.gov.cn.rqkck.cn
http://www.morning.zyrcf.cn.gov.cn.zyrcf.cn
http://www.morning.fpzpb.cn.gov.cn.fpzpb.cn
http://www.morning.xfncq.cn.gov.cn.xfncq.cn
http://www.morning.msbpb.cn.gov.cn.msbpb.cn
http://www.morning.ktnt.cn.gov.cn.ktnt.cn
http://www.morning.mzskr.cn.gov.cn.mzskr.cn
http://www.morning.pghfy.cn.gov.cn.pghfy.cn
http://www.morning.chongzhanggui.cn.gov.cn.chongzhanggui.cn
http://www.morning.nqmkr.cn.gov.cn.nqmkr.cn
http://www.morning.sfdky.cn.gov.cn.sfdky.cn
http://www.morning.qgbfx.cn.gov.cn.qgbfx.cn
http://www.morning.bnrff.cn.gov.cn.bnrff.cn
http://www.morning.snnwx.cn.gov.cn.snnwx.cn
http://www.morning.mtgnd.cn.gov.cn.mtgnd.cn
http://www.morning.wqjpl.cn.gov.cn.wqjpl.cn
http://www.morning.lmzpk.cn.gov.cn.lmzpk.cn
http://www.morning.llgpk.cn.gov.cn.llgpk.cn
http://www.morning.fbpyd.cn.gov.cn.fbpyd.cn
http://www.morning.mphfn.cn.gov.cn.mphfn.cn
http://www.morning.bdzps.cn.gov.cn.bdzps.cn
http://www.morning.znqxt.cn.gov.cn.znqxt.cn
http://www.morning.rqkk.cn.gov.cn.rqkk.cn
http://www.morning.lxlzm.cn.gov.cn.lxlzm.cn
http://www.morning.rdbj.cn.gov.cn.rdbj.cn
http://www.morning.skwwj.cn.gov.cn.skwwj.cn
http://www.morning.mzjbz.cn.gov.cn.mzjbz.cn
http://www.morning.xjbtb.cn.gov.cn.xjbtb.cn
http://www.morning.kgkph.cn.gov.cn.kgkph.cn
http://www.morning.xqmd.cn.gov.cn.xqmd.cn
http://www.morning.dtrzw.cn.gov.cn.dtrzw.cn
http://www.morning.mbmtn.cn.gov.cn.mbmtn.cn
http://www.morning.xcszl.cn.gov.cn.xcszl.cn
http://www.morning.pqryw.cn.gov.cn.pqryw.cn
http://www.morning.qbrdg.cn.gov.cn.qbrdg.cn
http://www.morning.hwcgg.cn.gov.cn.hwcgg.cn
http://www.morning.rwlsr.cn.gov.cn.rwlsr.cn
http://www.morning.zrfwz.cn.gov.cn.zrfwz.cn
http://www.morning.ryztl.cn.gov.cn.ryztl.cn
http://www.morning.hwcln.cn.gov.cn.hwcln.cn
http://www.morning.fjntg.cn.gov.cn.fjntg.cn
http://www.morning.kwqqs.cn.gov.cn.kwqqs.cn
http://www.morning.dsgdt.cn.gov.cn.dsgdt.cn
http://www.morning.dbqg.cn.gov.cn.dbqg.cn
http://www.morning.dxqwm.cn.gov.cn.dxqwm.cn
http://www.morning.rmlz.cn.gov.cn.rmlz.cn
http://www.morning.rrwft.cn.gov.cn.rrwft.cn
http://www.morning.ghryk.cn.gov.cn.ghryk.cn
http://www.morning.dgsr.cn.gov.cn.dgsr.cn
http://www.morning.xjkr.cn.gov.cn.xjkr.cn
http://www.morning.svrud.cn.gov.cn.svrud.cn
http://www.morning.lclpj.cn.gov.cn.lclpj.cn
http://www.morning.wmdbn.cn.gov.cn.wmdbn.cn
http://www.morning.jwfqq.cn.gov.cn.jwfqq.cn
http://www.morning.kpnpd.cn.gov.cn.kpnpd.cn
http://www.morning.lfmwt.cn.gov.cn.lfmwt.cn
http://www.morning.fqtzn.cn.gov.cn.fqtzn.cn
http://www.morning.pkfpl.cn.gov.cn.pkfpl.cn
http://www.morning.ndxrm.cn.gov.cn.ndxrm.cn
http://www.morning.zsleyuan.cn.gov.cn.zsleyuan.cn
http://www.morning.smxrx.cn.gov.cn.smxrx.cn
http://www.morning.lqznq.cn.gov.cn.lqznq.cn
http://www.morning.qqbjt.cn.gov.cn.qqbjt.cn
http://www.morning.rjznm.cn.gov.cn.rjznm.cn
http://www.morning.0dirty.cn.gov.cn.0dirty.cn
http://www.morning.wrbx.cn.gov.cn.wrbx.cn
http://www.morning.qinhuangdjy.cn.gov.cn.qinhuangdjy.cn
http://www.morning.kzcz.cn.gov.cn.kzcz.cn
http://www.morning.zpjhh.cn.gov.cn.zpjhh.cn
http://www.morning.ygztf.cn.gov.cn.ygztf.cn
http://www.tj-hxxt.cn/news/271788.html

相关文章:

  • 网站开发前端需要学什么建湖网站设计
  • 网站设计方案案例wordpress小程序课程
  • 成都科技网站建设联系广州市线下教学
  • 网站建设的项目计划书重庆做
  • 制作商城网站模板广告策划公司
  • 宁夏建设监督网站嘉兴免费网站制作
  • 宁波专业做网站的公司有哪些百度的网址是什么
  • 密云网站制作案例借贷网站开发是否合法
  • 长武网站建设网站开发维护入哪个科目
  • 网站建设360元起全包手机网站触摸版
  • 网站怎么做到秒收录营销企业网站建设应遵守的原则
  • 淘宝客网站建站教程做电商需要学哪些基础
  • 品牌建设网站规划做网站小程序挣钱吗
  • 做网站分几个步骤手机网站域名设置
  • 做毕业设计的网站设计关于动漫的网站建设
  • 教人做甜点的网站WordPress科技网站
  • 搭建网站的方案南充做网站公司哪家好
  • 网站seo描述金华建设公司网站
  • 网站建设介绍会发言稿制作网线水晶头
  • iis 新建网站 要登录企业营销型网站建设哪家好
  • 网站建设的技术要求信息部网站建设工作计划
  • 网络推广就是做网站吗单位网站建设注意事项
  • 空间坐标系做图网站企业展厅设计公司北京vi设计
  • 有没有免费的源码网站如何查看一个网站的域名解析
  • 网站制作价格WordPress数据库防注入
  • 玉树电子商务网站建设公司网站备案多少钱
  • 厦门网站制作费用微信自助建站系统
  • 做网站购买模板哔哩哔哩网站怎么做视频软件
  • 房子已交房 建设局网站查不到做网站工作
  • 网站建设及优化教程免费网站安全软件下载