调整
This commit is contained in:
+97
-70
@@ -1,57 +1,61 @@
|
||||
<template>
|
||||
<view>
|
||||
<uni-nav-bar leftText=" " :fixed="true" :border="false" leftIcon="back" @clickLeft="leftClick" color="#000000" backgroundColor="#fff" :statusBar="true" :title="$t('navbar.changinfo')"></uni-nav-bar>
|
||||
<view class="content">
|
||||
<view class="cell">
|
||||
<view>{{$t('mine.avatar')}}</view>
|
||||
<view class="right">
|
||||
<uni-file-picker fileMediatype="image" limit="1" @select="select" @delete="delfn" :del-icon="false" disable-preview :imageStyles="imageStyles">
|
||||
<image :src="userinfo.avatar_pull==''?'/static/image/mine/user.png':userinfo.avatar_pull" mode="" class="addimg"></image>
|
||||
</uni-file-picker>
|
||||
<form @submit="bcFn">
|
||||
<view class="content">
|
||||
|
||||
<view class="cell">
|
||||
<view>{{$t('mine.avatar')}}</view>
|
||||
<view class="right">
|
||||
<button class="avatar-btn" open-type="chooseAvatar" @chooseavatar="onChooseAvatar" >
|
||||
<image :src="userinfo.avatar_pull==''?'/static/image/mine/user.png':userinfo.avatar_pull" mode="" class="addimg"></image>
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cell1">
|
||||
<view>{{$t('mine.nickname')}}</view>
|
||||
<view class="right select" @click="chackfn()">
|
||||
<text v-if="ischack">{{ userinfo.nickname }}</text>
|
||||
<input v-else :placeholder="$t('mine.nickinput')" type="nickname" name="nickname" />
|
||||
<uni-icons type="right" size="18"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cell1">
|
||||
<view>门店名称</view>
|
||||
<view class="right select">
|
||||
<input placeholder="请填写门店名称" v-model="userinfo.shop_name" />
|
||||
<uni-icons type="right" size="18"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cell1">
|
||||
<view>门店电话</view>
|
||||
<view class="right select">
|
||||
<input placeholder="请填写门店电话" v-model="userinfo.mobile" />
|
||||
<uni-icons type="right" size="18"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cell1">
|
||||
<view>门店位置</view>
|
||||
<view class="right select">
|
||||
<input placeholder="请选择门店位置" v-model="userinfo.location_name" disabled="disabled" @focus="showMap = true" @click="showMap = true" />
|
||||
<uni-icons type="right" size="18"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
<view v-show="showMap" style="height: 300px; margin: 0 20px 20px 20px;">
|
||||
<map
|
||||
style="width: 100%; height: 100%;"
|
||||
:latitude="centerLat"
|
||||
:longitude="centerLng"
|
||||
:markers="markers"
|
||||
scale="14"
|
||||
@tap="onMapTap"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cell1">
|
||||
<view>{{$t('mine.nickname')}}</view>
|
||||
<view class="right select">
|
||||
<input :placeholder="$t('mine.nickinput')" v-model="userinfo.nickname" />
|
||||
<uni-icons type="right" size="18"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cell1">
|
||||
<view>店铺名称</view>
|
||||
<view class="right select">
|
||||
<input placeholder="请填写名称" v-model="userinfo.shop_name" />
|
||||
<uni-icons type="right" size="18"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cell1">
|
||||
<view>店铺电话</view>
|
||||
<view class="right select">
|
||||
<input placeholder="请填写店铺电话" v-model="userinfo.mobile" />
|
||||
<uni-icons type="right" size="18"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cell1">
|
||||
<view>店铺位置</view>
|
||||
<view class="right select">
|
||||
<input placeholder="请选择店铺位置" v-model="userinfo.location_name" disabled="disabled" @focus="showMap = true" @click="showMap = true" />
|
||||
<uni-icons type="right" size="18"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
<view v-show="showMap" style="height: 300px; margin: 0 20px 20px 20px;">
|
||||
<map
|
||||
style="width: 100%; height: 100%;"
|
||||
:latitude="centerLat"
|
||||
:longitude="centerLng"
|
||||
:markers="markers"
|
||||
scale="14"
|
||||
@tap="onMapTap"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="foot">
|
||||
<button class="btn" @click="bcFn">{{$t('button.save')}}</button>
|
||||
</view>
|
||||
<view class="foot">
|
||||
<button class="btn" form-type="submit">{{$t('button.save')}}</button>
|
||||
</view>
|
||||
</form>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
@@ -62,6 +66,7 @@
|
||||
centerLat: 39.9042,
|
||||
centerLng: 116.4074,
|
||||
markers: [],
|
||||
ischack:true,
|
||||
// 若需逆地理,请配置腾讯地图 key(可存储在此或通过 storage 注入)
|
||||
qqMapKey: 'HQBBZ-SC76W-YUNRZ-34IAD-ARN6K-TZBZ4',
|
||||
showMap: false,
|
||||
@@ -89,6 +94,9 @@
|
||||
this.getinfo()
|
||||
},
|
||||
methods: {
|
||||
chackfn(){
|
||||
this.ischack = false
|
||||
},
|
||||
getFuzzy() {
|
||||
return new Promise((resolve, reject) => {
|
||||
wx.getSetting({
|
||||
@@ -222,6 +230,12 @@
|
||||
}
|
||||
});
|
||||
},
|
||||
onChooseAvatar(e) {
|
||||
// 微信返回的是临时文件地址
|
||||
this.userinfo.avatar = e.detail.avatarUrl
|
||||
this.userinfo.avatar_pull = e.detail.avatarUrl
|
||||
this.uploadfn(e.detail.avatarUrl)
|
||||
},
|
||||
delfn(){
|
||||
this.userinfo.avatar =''
|
||||
},
|
||||
@@ -233,39 +247,52 @@
|
||||
leftClick(){
|
||||
uni.navigateBack({})
|
||||
},
|
||||
bcFn(){
|
||||
bcFn(e) {
|
||||
const nickname = e.detail.value.nickname
|
||||
|
||||
if (nickname) {
|
||||
this.userinfo.nickname = nickname
|
||||
}
|
||||
// 同步到 userinfo,方便后续使用
|
||||
request({
|
||||
url:'common/user/update',
|
||||
method:'POST',
|
||||
data:{
|
||||
nickname:this.userinfo.nickname,
|
||||
avatar:this.userinfo.avatar,
|
||||
mobile:this.userinfo.mobile,
|
||||
shop_name:this.userinfo.shop_name,
|
||||
location_name:this.userinfo.location_name,
|
||||
latitude:this.userinfo.latitude,
|
||||
longitude:this.userinfo.longitude
|
||||
url: 'common/user/update',
|
||||
method: 'POST',
|
||||
data: {
|
||||
nickname:this.userinfo.nickname,
|
||||
avatar: this.userinfo.avatar,
|
||||
mobile: this.userinfo.mobile,
|
||||
shop_name: this.userinfo.shop_name,
|
||||
location_name: this.userinfo.location_name,
|
||||
latitude: this.userinfo.latitude,
|
||||
longitude: this.userinfo.longitude
|
||||
}
|
||||
}).then(res => {
|
||||
uni.showToast({
|
||||
title: res.data.message,
|
||||
icon: 'none'
|
||||
});
|
||||
if(res.data.code ==200){
|
||||
setTimeout(() => {
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/mine',// 替换为你要跳转的页面路径
|
||||
});
|
||||
}, 1000);
|
||||
|
||||
title: res.data.message,
|
||||
icon: 'none'
|
||||
})
|
||||
|
||||
if (res.data.code == 200) {
|
||||
setTimeout(() => {
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/mine'
|
||||
})
|
||||
}, 1000)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.avatar-btn{
|
||||
background: #fff;
|
||||
}
|
||||
.avatar-btn::after{
|
||||
border: 1px solid #fff !important;
|
||||
}
|
||||
.uniui-right{
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
|
||||
Reference in New Issue
Block a user