bug
This commit is contained in:
@@ -104,7 +104,9 @@
|
|||||||
onLoad (query) {
|
onLoad (query) {
|
||||||
this.id = query.id
|
this.id = query.id
|
||||||
this.qqmapsdk = new QQMapWX({
|
this.qqmapsdk = new QQMapWX({
|
||||||
key: '3RZBZ-LZUCF-CT6J5-NWKZH-FCWOQ-UUFKY'
|
key: process.env.NODE_ENV == "production" ?
|
||||||
|
"RWWBZ-64BEJ-MVLFJ-FTHLQ-JTR6J-SAB2S" :
|
||||||
|
"3RZBZ-LZUCF-CT6J5-NWKZH-FCWOQ-UUFKY"
|
||||||
})
|
})
|
||||||
|
|
||||||
this.$loading()
|
this.$loading()
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="my">
|
<div class="my">
|
||||||
<div class="user">
|
<div class="user" @click="toSetting">
|
||||||
<image src="https://jisheng-xiaochengxu.oss-cn-hangzhou.aliyuncs.com/admin/5bad9165-fa6e-4c81-894d-2beae426260b.png" />
|
<image src="https://jisheng-xiaochengxu.oss-cn-hangzhou.aliyuncs.com/admin/5bad9165-fa6e-4c81-894d-2beae426260b.png" />
|
||||||
<div class="right" v-if="isLogin">
|
<div class="right" v-if="isLogin">
|
||||||
<h2>张三</h2>
|
<h2>张三</h2>
|
||||||
@@ -63,48 +63,28 @@
|
|||||||
onLoad () {
|
onLoad () {
|
||||||
console.log(this.user)
|
console.log(this.user)
|
||||||
console.log(this.token)
|
console.log(this.token)
|
||||||
|
if (this.token) {
|
||||||
|
this.getUserInfo()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(['autoLogin', 'getUserInfo', 'getToken', 'getCode']),
|
...mapActions(['autoLogin', 'getUserInfo']),
|
||||||
|
|
||||||
login () {
|
toSetting () {
|
||||||
return new Promise(function (resolve, reject) {
|
if (!this.token) {
|
||||||
uni.login({
|
this.autoLogin()
|
||||||
success: function (res) {
|
} else {
|
||||||
if (res.code) {
|
this.$linkTo('./UserInfo')
|
||||||
resolve(res)
|
}
|
||||||
} else {
|
|
||||||
reject(res)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
fail: function () {
|
|
||||||
reject(false)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
toLogin () {
|
toLogin () {
|
||||||
wx.getUserProfile({
|
if (!this.token) {
|
||||||
desc: '用于完善会员资料',
|
this.autoLogin()
|
||||||
lang: 'zh_CN',
|
} else {
|
||||||
success: data => {
|
this.getUserInfo()
|
||||||
this.$loading()
|
}
|
||||||
this.getCode().then(res => {
|
|
||||||
this.getToken({
|
|
||||||
...data.userInfo,
|
|
||||||
code: res
|
|
||||||
}).then(e => {
|
|
||||||
console.log(e)
|
|
||||||
|
|
||||||
this.$hideLoading()
|
|
||||||
}).catch(() => {
|
|
||||||
this.$hideLoading()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
174
src/project/tianfuxing/AppMy/UserInfo.vue
Normal file
174
src/project/tianfuxing/AppMy/UserInfo.vue
Normal file
@@ -0,0 +1,174 @@
|
|||||||
|
<template>
|
||||||
|
<div class="userinfo">
|
||||||
|
<div class="section">
|
||||||
|
<div class="form">
|
||||||
|
<div class="form-item avatar">
|
||||||
|
<h2>头像</h2>
|
||||||
|
<div class="form-item__right" @click="uploadImg">
|
||||||
|
<button class="avatar-wrapper" open-type="chooseAvatar" bind:chooseavatar="onChooseAvatar">
|
||||||
|
<image class="avatar" :src="userInfo.avatar"></image>
|
||||||
|
</button>
|
||||||
|
<image class="right" src="/static/images/next.png" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-item">
|
||||||
|
<h2>昵称</h2>
|
||||||
|
<div class="form-item__right">
|
||||||
|
<input placeholder="请输入昵称" type="nickname" v-model="userInfo.nickname" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="btn" @click="save">保存</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
appName: '设置',
|
||||||
|
name: 'UserInfo',
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
userInfo: {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
onLoad () {
|
||||||
|
if (uni.getStorageSync('token')) {
|
||||||
|
this.userInfo = uni.getStorageSync('userInfo')
|
||||||
|
console.log(this.userInfo)
|
||||||
|
}
|
||||||
|
|
||||||
|
uni.$on('updateUserInfo', () => {
|
||||||
|
this.getUserInfo()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
getUserInfo () {
|
||||||
|
this.$http.post(`/app/getUserInfo`).then(res => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
this.isLogin = true
|
||||||
|
this.userInfo = res.data
|
||||||
|
uni.setStorageSync('userInfo', res.data)
|
||||||
|
uni.setStorageSync('token', res.data.id)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
uploadImg () {
|
||||||
|
uni.chooseImage({
|
||||||
|
count: 1,
|
||||||
|
sizeType: ['original', 'compressed'],
|
||||||
|
sourceType: ['album', 'camera'],
|
||||||
|
success: res => {
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
save () {
|
||||||
|
this.$loading()
|
||||||
|
this.$http.post('/app/editUserInfo', null, {
|
||||||
|
params: {
|
||||||
|
...this.userInfo
|
||||||
|
}
|
||||||
|
}).then(res => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
this.$toast('保存成功')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.userinfo {
|
||||||
|
.btn {
|
||||||
|
margin-top: 180rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section {
|
||||||
|
background: #fff;
|
||||||
|
|
||||||
|
&:first-child {
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
& > h2 {
|
||||||
|
position: relative;
|
||||||
|
height: 98rpx;
|
||||||
|
line-height: 98rpx;
|
||||||
|
padding: 0 50rpx;
|
||||||
|
color: #363636;
|
||||||
|
border-bottom: 1rpx solid #e9e9e9;
|
||||||
|
font-size: 34rpx;
|
||||||
|
|
||||||
|
&:after {
|
||||||
|
position: absolute;
|
||||||
|
left: 30rpx;
|
||||||
|
top: 50%;
|
||||||
|
z-index: 1;
|
||||||
|
width: 5rpx;
|
||||||
|
height: 50rpx;
|
||||||
|
background: #fd2c21;
|
||||||
|
content: ' ';
|
||||||
|
transform: translateY(-50%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.form {
|
||||||
|
.form-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
height: 88rpx;
|
||||||
|
padding: 0 30rpx;
|
||||||
|
border-bottom: 1rpx solid #e9e9e9;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
color: #4e4e4e;
|
||||||
|
font-size: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.avatar {
|
||||||
|
height: 160rpx;
|
||||||
|
|
||||||
|
.avatar-img {
|
||||||
|
width: 120rpx;
|
||||||
|
height: 120rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-item__right {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
input {
|
||||||
|
width: 500rpx;
|
||||||
|
text-align: right;
|
||||||
|
font-size: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
span {
|
||||||
|
color: #4e4e4e;
|
||||||
|
font-size: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.right {
|
||||||
|
width: 13rpx;
|
||||||
|
height: 21rpx;
|
||||||
|
margin-left: 10rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user