优化页面
This commit is contained in:
@@ -1,106 +0,0 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const components_request = require("../../components/request.js");
|
||||
const components_postFile = require("../../components/postFile.js");
|
||||
const components_generateFileName = require("../../components/generateFileName.js");
|
||||
const _sfc_main = {
|
||||
inject: ["$global"],
|
||||
data() {
|
||||
return {
|
||||
userinfo: "",
|
||||
name: "",
|
||||
id: "",
|
||||
info: {},
|
||||
userSig: ""
|
||||
};
|
||||
},
|
||||
onLoad(option) {
|
||||
common_vendor.index.getStorage({
|
||||
key: "userinfo",
|
||||
success: (res) => {
|
||||
this.id = res.data.id;
|
||||
this.name = res.data.nickName;
|
||||
this.userinfo = res.data.headerIcon;
|
||||
}
|
||||
});
|
||||
common_vendor.index.getStorage({
|
||||
key: "userSig",
|
||||
success: (res) => {
|
||||
this.userSig = res.data;
|
||||
}
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
cancel() {
|
||||
common_vendor.index.navigateBack({
|
||||
delta: 1
|
||||
});
|
||||
},
|
||||
// 输入昵称
|
||||
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
|
||||
});
|
||||
components_postFile.uploadFile({
|
||||
path: this.userinfo,
|
||||
name: components_generateFileName.generateFileName()
|
||||
}).then((res) => {
|
||||
common_vendor.index.__f__("log", "at pages/Setting/Setting.vue:75", "上传成功········", res);
|
||||
this.userinfo = res;
|
||||
}).catch((err) => {
|
||||
common_vendor.index.__f__("log", "at pages/Setting/Setting.vue:79", err);
|
||||
});
|
||||
if (this.userinfo) {
|
||||
const res = await components_request.request({
|
||||
url: "user/updateUserInfo",
|
||||
method: "POST",
|
||||
data: {
|
||||
id: this.id,
|
||||
headerIcon: this.userinfo,
|
||||
nickName: this.name,
|
||||
usersig: this.userSig.userSig
|
||||
},
|
||||
userInfo: true
|
||||
});
|
||||
if (res.code === 200) {
|
||||
common_vendor.index.showToast({
|
||||
title: "修改成功",
|
||||
icon: "success"
|
||||
});
|
||||
common_vendor.index.setStorageSync("userinfo", res.data.info);
|
||||
common_vendor.index.hideLoading();
|
||||
common_vendor.index.navigateBack({
|
||||
delta: 1
|
||||
});
|
||||
} else {
|
||||
common_vendor.index.showToast({
|
||||
title: "修改失败",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
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)),
|
||||
e: common_vendor.o$1((...args) => $options.cancel && $options.cancel(...args))
|
||||
};
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-3c55a289"]]);
|
||||
wx.createPage(MiniProgramPage);
|
||||
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/Setting/Setting.js.map
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"navigationBarTitleText": "设置",
|
||||
"usingComponents": {}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
<view class="container data-v-3c55a289"><button class="login-btn data-v-3c55a289" open-type="chooseAvatar" bindchooseavatar="{{b}}"><image class="avatar data-v-3c55a289" src="{{a}}"></image></button><input type="nickname" class="weui-input data-v-3c55a289" placeholder="请输入昵称" bindblur="{{c}}"/><button class="weui-btn data-v-3c55a289" bindtap="{{d}}">修改</button><button class="weui-btn data-v-3c55a289" bindtap="{{e}}">取消</button></view>
|
||||
@@ -1,33 +0,0 @@
|
||||
|
||||
.container.data-v-3c55a289 {
|
||||
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-3c55a289 {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
border-radius: 50%;
|
||||
padding: 0px;
|
||||
margin-bottom: 60rpx;
|
||||
}
|
||||
.avatar.data-v-3c55a289 {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.weui-input.data-v-3c55a289 {
|
||||
width: 80%;
|
||||
text-align: center;
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
.weui-btn.data-v-3c55a289 {
|
||||
width: 40%;
|
||||
margin-top: 20rpx;
|
||||
background-color: #11cb2a00;
|
||||
color: #fff;
|
||||
}
|
||||
Reference in New Issue
Block a user