api
This commit is contained in:
102
unpackage/dist/dev/mp-weixin/pages/UserInformation/UserInformation.js
vendored
Normal file
102
unpackage/dist/dev/mp-weixin/pages/UserInformation/UserInformation.js
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const components_request = require("../../components/request.js");
|
||||
const _sfc_main = {
|
||||
data() {
|
||||
return {
|
||||
userinfo: "https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0",
|
||||
name: "",
|
||||
id: "",
|
||||
info: {},
|
||||
userSig: ""
|
||||
};
|
||||
},
|
||||
onLoad(option) {
|
||||
common_vendor.index.getStorage({
|
||||
key: "userinfo",
|
||||
success: (res) => {
|
||||
this.id = res.data.id;
|
||||
}
|
||||
});
|
||||
common_vendor.index.getStorage({
|
||||
key: "userSig",
|
||||
success: (res) => {
|
||||
this.userSig = res.data;
|
||||
}
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
// 输入昵称
|
||||
inputName(e) {
|
||||
this.name = e.detail.value;
|
||||
},
|
||||
// 选择头像
|
||||
async Userinfo(e) {
|
||||
const { avatarUrl } = e.detail;
|
||||
this.userinfo = avatarUrl;
|
||||
},
|
||||
// 微信登录
|
||||
async wxLogin(e) {
|
||||
common_vendor.index.showLoading({
|
||||
title: "登录中...",
|
||||
mask: true
|
||||
});
|
||||
try {
|
||||
const { code } = await common_vendor.index.login({
|
||||
provider: "weixin",
|
||||
onlyAuthorize: true
|
||||
});
|
||||
common_vendor.index.__f__("log", "at pages/UserInformation/UserInformation.vue:68", "code", code);
|
||||
common_vendor.index.__f__("log", "at pages/UserInformation/UserInformation.vue:69", "code", this.name);
|
||||
common_vendor.index.__f__("log", "at pages/UserInformation/UserInformation.vue:70", "code", this.userinfo);
|
||||
common_vendor.index.__f__("log", "at pages/UserInformation/UserInformation.vue:71", "code", this.id);
|
||||
common_vendor.index.__f__("log", "at pages/UserInformation/UserInformation.vue:72", "code", this.userSig);
|
||||
const res = await components_request.request({
|
||||
url: "/user/inputUserInfo",
|
||||
method: "POST",
|
||||
data: {
|
||||
id: this.id,
|
||||
headerIcon: this.userinfo,
|
||||
nickName: this.name,
|
||||
code,
|
||||
usersig: this.userSig
|
||||
},
|
||||
userInfo: false
|
||||
});
|
||||
common_vendor.index.__f__("log", "at pages/UserInformation/UserInformation.vue:86", "res", res);
|
||||
if (res.data.code === 200) {
|
||||
common_vendor.index.showToast({
|
||||
title: "登录成功",
|
||||
icon: "success"
|
||||
});
|
||||
common_vendor.index.__f__("log", "at pages/UserInformation/UserInformation.vue:92", "登录成功", res.data);
|
||||
common_vendor.index.setStorageSync("userinfo", res.data.info);
|
||||
} else {
|
||||
common_vendor.index.showToast({
|
||||
title: "登录失败",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
common_vendor.index.__f__("error", "at pages/UserInformation/UserInformation.vue:115", "登录错误:", err);
|
||||
common_vendor.index.showToast({
|
||||
title: "请检查网络连接",
|
||||
icon: "none"
|
||||
});
|
||||
} finally {
|
||||
common_vendor.index.hideLoading();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return {
|
||||
a: $data.userinfo,
|
||||
b: common_vendor.o$1((...args) => $options.Userinfo && $options.Userinfo(...args)),
|
||||
c: common_vendor.o$1((...args) => $options.inputName && $options.inputName(...args)),
|
||||
d: common_vendor.o$1((...args) => $options.wxLogin && $options.wxLogin(...args))
|
||||
};
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-35d730ef"]]);
|
||||
wx.createPage(MiniProgramPage);
|
||||
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/UserInformation/UserInformation.js.map
|
||||
4
unpackage/dist/dev/mp-weixin/pages/UserInformation/UserInformation.json
vendored
Normal file
4
unpackage/dist/dev/mp-weixin/pages/UserInformation/UserInformation.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"navigationBarTitleText": "用户信息",
|
||||
"usingComponents": {}
|
||||
}
|
||||
1
unpackage/dist/dev/mp-weixin/pages/UserInformation/UserInformation.wxml
vendored
Normal file
1
unpackage/dist/dev/mp-weixin/pages/UserInformation/UserInformation.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<view class="container data-v-35d730ef"><button class="login-btn data-v-35d730ef" open-type="chooseAvatar" bindchooseavatar="{{b}}"><image class="avatar data-v-35d730ef" src="{{a}}"></image></button><input type="nickname" class="weui-input data-v-35d730ef" placeholder="请输入昵称" bindblur="{{c}}"/><button class="weui-btn data-v-35d730ef" bindtap="{{d}}">登录</button></view>
|
||||
33
unpackage/dist/dev/mp-weixin/pages/UserInformation/UserInformation.wxss
vendored
Normal file
33
unpackage/dist/dev/mp-weixin/pages/UserInformation/UserInformation.wxss
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
|
||||
.container.data-v-35d730ef {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background: linear-gradient(to bottom, #11cb2a6e, #2574fc6d);
|
||||
}
|
||||
.login-btn.data-v-35d730ef {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
border-radius: 50%;
|
||||
padding: 0px;
|
||||
margin-bottom: 60rpx;
|
||||
}
|
||||
.avatar.data-v-35d730ef {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.weui-input.data-v-35d730ef {
|
||||
width: 80%;
|
||||
text-align: center;
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
.weui-btn.data-v-35d730ef {
|
||||
width: 40%;
|
||||
margin-top: 20rpx;
|
||||
background-color: #11cb2a00;
|
||||
color: #fff;
|
||||
}
|
||||
Reference in New Issue
Block a user