123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <template>
- <view class="content">
- <button type="default" open-type="getPhoneNumber" @getphonenumber="decryptPhoneNumber">微信授权一键登录</button>
- <button @click="wxHttpTest" style="margin-top: 10rps;">miniprogram http请求</button>
- </view>
- </template>
- <script>
-
- export default {
- data() {
- return {
- }
- },
- methods: {
- decryptPhoneNumber(e) {
- console.log(e.detail.errMsg)
- console.log(e.detail.iv)
- console.log(e.detail.encryptedData)
- },
- wxHttpTest() {
- //try{
- this.$request({
- server:2,
- servant:1005,
- data:{
- // phone:Buffer.from('3246541321'),
- phone:'3246541321',
- type:1,
- //verifyInfo:Buffer.from('asdasd')
- verifyInfo:'asdasd',
- data:{
-
- }
- }
- })
- .then((res) =>{
- console.log(res);
- /* res的结构
- {
- code:0,错误码 number类型
- msg:"",错误消息 string类型
- data:对应loginRsp的js对象
- }
- */
- if(res.code === 0){//成功
-
- }else{
- //失败
- }
- }, (err) => {//出现异常
- console.log(err);
- })
- }
- }
- }
- </script>
- <style>
- .content {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- margin: 20rpx;
- }
- </style>
|