1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <template>
- <view class="content">
- <!-- <button
- type="default"
- open-type="getPhoneNumber"
- @getphonenumber="decryptPhoneNumber"
- >
- 微信授权一键登录
- </button>
- <button @click="wxHttpTest" style="margin-top: 10rps">
- miniprogram http请求
- </button> -->
- uid:{{uid}}
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- uid:''
- };
- },
- onLoad(){
- this.uid = getApp().globalData.uid
-
- uni.$on('user_getUid',this.uidCallback)
- },
- onUnload(){
- uni.$off('user_getUid',this.uidCallback)
- },
- methods: {
- uidCallback(data){
- this.uid = data.uid
- },
- 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;
- margin: 20rpx;
- }
- </style>
|