Commit 41e5bbb1 authored by 程新智's avatar 程新智 👽

优化

parent 78df98d1
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
{{addressInfo.address}} {{addressInfo.detailInfo}} {{addressInfo.address}} {{addressInfo.detailInfo}}
</div> </div>
<div class="right__phone"> <div class="right__phone">
<span>{{addressInfo.userName}}</span> <span>{{addressInfo.telNumber}}</span>
<span v-if="addressInfo.defaultFlag">默认</span> <span v-if="addressInfo.defaultFlag">默认</span>
<span>{{addressInfo.userName}}</span> <span>{{addressInfo.telNumber}}</span>
</div> </div>
</div> </div>
<div class="address__right" @click="goAddress"> <div class="address__right" @click="goAddress">
...@@ -329,7 +329,9 @@ export default { ...@@ -329,7 +329,9 @@ export default {
/deep/ .u-modal__content__text { /deep/ .u-modal__content__text {
text-align: center !important; text-align: center !important;
} }
/deep/ .u-input__content__field-wrapper__field {
text-align: right !important;
}
.price__bottom { .price__bottom {
width: 100%; width: 100%;
height: 156rpx; height: 156rpx;
......
...@@ -94,12 +94,19 @@ export default { ...@@ -94,12 +94,19 @@ export default {
message: "请填写车型", message: "请填写车型",
trigger: ["blur", "change"], trigger: ["blur", "change"],
}, },
"carInfo.carNo": { "carInfo.carNo": [{
min: 7,
max: 8,
message: '车牌长度在7-8个字符之间'
},
{
type: "string", type: "string",
required: true, required: true,
message: "请填写车牌号", message: "请填写车牌号",
trigger: ["blur", "change"], trigger: ["blur", "change"],
}, },
]
}, },
carId: '', carId: '',
//免费挪车码 //免费挪车码
...@@ -112,7 +119,7 @@ export default { ...@@ -112,7 +119,7 @@ export default {
}, },
}, },
methods: { methods: {
goLoveCar(){ goLoveCar() {
uni.navigateTo({ uni.navigateTo({
url: '/pagesB/pages/move-car/loveCar?price=1' url: '/pagesB/pages/move-car/loveCar?price=1'
}); });
...@@ -120,8 +127,11 @@ export default { ...@@ -120,8 +127,11 @@ export default {
getCarCode() { getCarCode() {
//跳转到获取挪车码页面 //跳转到获取挪车码页面
this.$refs.form1.validate().then(res => { this.$refs.form1.validate().then(res => {
if(!this.model1.carInfo.id){ if (!this.model1.carInfo.id) {
let opts = { url: '/app/vehicleAdmin/add', method: 'post' }; let opts = {
url: '/app/vehicleAdmin/add',
method: 'post'
};
this.http.httpTokenRequest(opts, this.model1.carInfo).then(res => { this.http.httpTokenRequest(opts, this.model1.carInfo).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
...@@ -136,9 +146,12 @@ export default { ...@@ -136,9 +146,12 @@ export default {
}) })
}, },
getCarInfo(){ getCarInfo() {
if(this.carId){ if (this.carId) {
let opts = { url: '/app/vehicleAdmin/' + this.carId, method: 'get' }; let opts = {
url: '/app/vehicleAdmin/' + this.carId,
method: 'get'
};
this.http.httpTokenRequest(opts, {}).then(res => { this.http.httpTokenRequest(opts, {}).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.model1.carInfo = res.data.data this.model1.carInfo = res.data.data
...@@ -147,8 +160,11 @@ export default { ...@@ -147,8 +160,11 @@ export default {
} }
}, },
getMoveCode(){ getMoveCode() {
let opts = { url: '/app/mall/free/code', method: 'get' }; let opts = {
url: '/app/mall/free/code',
method: 'get'
};
this.http.httpTokenRequest(opts, {}).then(res => { this.http.httpTokenRequest(opts, {}).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.freeCode = res.data.data this.freeCode = res.data.data
...@@ -180,11 +196,16 @@ export default { ...@@ -180,11 +196,16 @@ export default {
text-align: right; text-align: right;
} }
/deep/ .u-input__content__field-wrapper__field {
text-align: right !important;
}
.self__input__km { .self__input__km {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
span{
span {
text-align: right; text-align: right;
display: inline-block; display: inline-block;
width: 100rpx; width: 100rpx;
...@@ -288,6 +309,7 @@ export default { ...@@ -288,6 +309,7 @@ export default {
text-align: right; text-align: right;
margin-top: 40rpx; margin-top: 40rpx;
margin-bottom: 200rpx; margin-bottom: 200rpx;
image { image {
width: 10rpx; width: 10rpx;
height: 20rpx; height: 20rpx;
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
--> -->
<template> <template>
<view class="appCotent"> <view class="appCotent">
<div class="addCar"> <div class="addCar">
<div class="add__content"> <div class="add__content">
<div class="add__title"> <div class="add__title">
填写车辆信息 填写车辆信息
...@@ -29,14 +29,14 @@ ...@@ -29,14 +29,14 @@
</div> </div>
<div class="add__user"> <div class="add__user">
<u-checkbox-group placement="row"> <u-checkbox-group placement="row">
<u-checkbox :checked='checked' @change="changeBtn" ></u-checkbox> <u-checkbox :checked='checked' @change="changeBtn"></u-checkbox>
</u-checkbox-group> </u-checkbox-group>
勾选同意<span>《用户服务协议》</span> 勾选同意<span>《用户服务协议》</span>
</div> </div>
<div class="add__btn add__no__bind" @click="addCarInfo()"> <div class="add__btn add__no__bind" @click="addCarInfo()">
完成 完成
</div> </div>
</div> </div>
</view> </view>
</template> </template>
...@@ -48,7 +48,7 @@ export default { ...@@ -48,7 +48,7 @@ export default {
}, },
data() { data() {
return { return {
checked:false, checked: false,
model1: { model1: {
carInfo: { carInfo: {
brand: '', brand: '',
...@@ -67,12 +67,19 @@ export default { ...@@ -67,12 +67,19 @@ export default {
message: "请填写车型", message: "请填写车型",
trigger: ["blur", "change"], trigger: ["blur", "change"],
}, },
"carInfo.carNo": { "carInfo.carNo": [{
min: 7,
max: 8,
message: '车牌长度在7-8个字符之间'
},
{
type: "string", type: "string",
required: true, required: true,
message: "请填写车牌号", message: "请填写车牌号",
trigger: ["blur", "change"], trigger: ["blur", "change"],
}, },
]
}, },
items: [{ items: [{
title: "挪车码编号", title: "挪车码编号",
...@@ -97,7 +104,7 @@ export default { ...@@ -97,7 +104,7 @@ export default {
}; };
}, },
methods: { methods: {
changeBtn(){ changeBtn() {
this.checked = !this.checked; this.checked = !this.checked;
}, },
goBack() { goBack() {
...@@ -105,10 +112,21 @@ export default { ...@@ -105,10 +112,21 @@ export default {
delta: 1 delta: 1
}) })
}, },
addCarInfo(){ addCarInfo() {
//表单验证 //表单验证
this.$refs.form1.validate().then(res => { this.$refs.form1.validate().then(res => {
let opts = { url: '/app/vehicleAdmin/add', method: 'post' }; if (!this.checked) {
uni.showToast({
title: "请同意用户协议",
icon: 'none',
duration: 2000,
});
return
}
let opts = {
url: '/app/vehicleAdmin/add',
method: 'post'
};
this.http.httpTokenRequest(opts, this.model1.carInfo).then(res => { this.http.httpTokenRequest(opts, this.model1.carInfo).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
//添加成功 //添加成功
...@@ -131,7 +149,8 @@ export default { ...@@ -131,7 +149,8 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.addCar { .addCar {
padding: 40rpx 0rpx; padding: 40rpx 0rpx;
/deep/.u-input__content__field-wrapper__field{
/deep/.u-input__content__field-wrapper__field {
text-align: right !important; text-align: right !important;
padding-right: 30rpx; padding-right: 30rpx;
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
--> -->
<template> <template>
<view class="appCotent"> <view class="appCotent">
<div class="editCar"> <div class="editCar">
<div class="add__content"> <div class="add__content">
<div class="add__title"> <div class="add__title">
填写车辆信息 填写车辆信息
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
</div> </div>
</u-form-item> </u-form-item>
<u-form-item label="车牌号" prop="carInfo.carNo" ref="item1"> </u-form-item> <u-form-item label="车牌号" prop="carInfo.carNo" ref="item1"> </u-form-item>
<car-number v-model="model1.carInfo.carNo"></car-number> <car-number v-if="model1.carInfo.carNo" v-model="model1.carInfo.carNo"></car-number>
</u--form> </u--form>
</div> </div>
</div> </div>
...@@ -34,9 +34,8 @@ ...@@ -34,9 +34,8 @@
<div class="add__btn add__back" @click="delModal"> <div class="add__btn add__back" @click="delModal">
删除 删除
</div> </div>
<u-modal :show="deleteShow" :title="deleteTitle" :content='deleteContent' <u-modal :show="deleteShow" :title="deleteTitle" :content='deleteContent' @confirm="confirmModal" @cancel="cancelModal" showCancelButton="true"></u-modal>
@confirm="confirmModal" @cancel="cancelModal" showCancelButton="true"></u-modal> </div>
</div>
</view> </view>
</template> </template>
...@@ -51,7 +50,9 @@ export default { ...@@ -51,7 +50,9 @@ export default {
//车辆id //车辆id
id: '', id: '',
model1: { model1: {
carInfo: {}, carInfo: {
carNo: '',
},
}, },
deleteShow: false, deleteShow: false,
deleteTitle: '删除车辆', deleteTitle: '删除车辆',
...@@ -69,12 +70,19 @@ export default { ...@@ -69,12 +70,19 @@ export default {
message: "请填写车型", message: "请填写车型",
trigger: ["blur", "change"], trigger: ["blur", "change"],
}, },
"carInfo.carNo": { "carInfo.carNo": [{
min: 7,
max: 8,
message: '车牌长度在7-8个字符之间'
},
{
type: "string", type: "string",
required: true, required: true,
message: "请填写车牌号", message: "请填写车牌号",
trigger: ["blur", "change"], trigger: ["blur", "change"],
}, },
]
}, },
items: [{ items: [{
title: "挪车码编号", title: "挪车码编号",
...@@ -104,18 +112,28 @@ export default { ...@@ -104,18 +112,28 @@ export default {
delta: 1 delta: 1
}) })
}, },
getCarInfo(){ getCarInfo() {
let opts = { url: '/app/vehicleAdmin/' + this.id, method: 'get' }; let opts = {
url: '/app/vehicleAdmin/' + this.id,
method: 'get'
};
this.http.httpTokenRequest(opts, {}).then(res => { this.http.httpTokenRequest(opts, {}).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.model1.carInfo = res.data.data this.$nextTick(() => {
this.model1.carInfo = res.data.data;
this.model1.carInfo.carNo = res.data.data.carNo;
this.$set(this.model1.carInfo, 'carNo', res.data.data.carNo);
});
} }
}) })
}, },
editCarInfo(){ editCarInfo() {
this.$refs.form1.validate().then(res => { this.$refs.form1.validate().then(res => {
let opts = { url: '/app/vehicleAdmin/edit', method: 'put' }; let opts = {
url: '/app/vehicleAdmin/edit',
method: 'put'
};
this.http.httpTokenRequest(opts, this.model1.carInfo).then(res => { this.http.httpTokenRequest(opts, this.model1.carInfo).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
//添加成功 //添加成功
...@@ -128,8 +146,11 @@ export default { ...@@ -128,8 +146,11 @@ export default {
}) })
}, },
//确认删除车辆 //确认删除车辆
confirmModal(){ confirmModal() {
let opts = { url: '/app/vehicleAdmin/remove/' + this.id, method: 'delete' }; let opts = {
url: '/app/vehicleAdmin/remove/' + this.id,
method: 'delete'
};
this.http.httpTokenRequest(opts, {}).then(res => { this.http.httpTokenRequest(opts, {}).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
uni.showToast({ uni.showToast({
...@@ -137,7 +158,7 @@ export default { ...@@ -137,7 +158,7 @@ export default {
icon: "success", icon: "success",
}); });
this.goBack() this.goBack()
}else{ } else {
uni.showToast({ uni.showToast({
title: res.data.msg, title: res.data.msg,
icon: "error", icon: "error",
...@@ -146,10 +167,10 @@ export default { ...@@ -146,10 +167,10 @@ export default {
}) })
this.deleteShow = false this.deleteShow = false
}, },
cancelModal(){ cancelModal() {
this.deleteShow = false this.deleteShow = false
}, },
delModal(){ delModal() {
this.deleteShow = true this.deleteShow = true
}, },
}, },
...@@ -160,7 +181,7 @@ export default { ...@@ -160,7 +181,7 @@ export default {
// 如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则 // 如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则
this.$refs.form1.setRules(this.rules) this.$refs.form1.setRules(this.rules)
}, },
onShow(){ onShow() {
this.getCarInfo() this.getCarInfo()
}, },
} }
...@@ -169,14 +190,17 @@ export default { ...@@ -169,14 +190,17 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.editCar { .editCar {
padding: 40rpx 0rpx; padding: 40rpx 0rpx;
/deep/ .u-input__content__field-wrapper__field{
/deep/ .u-input__content__field-wrapper__field {
text-align: right !important; text-align: right !important;
padding-right: 30rpx; padding-right: 30rpx;
justify-content: space-evenly; justify-content: space-evenly;
} }
.u-checkbox-group { .u-checkbox-group {
display: inline-block !important; display: inline-block !important;
} }
/deep/.u-checkbox-group--row { /deep/.u-checkbox-group--row {
display: inline-block !important; display: inline-block !important;
} }
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
<u-modal :show="deleteShow" :title="deleteTitle" :content='deleteContent' <u-modal :show="deleteShow" :title="deleteTitle" :content='deleteContent'
@confirm="confirmModal" @cancel="cancelModal" showCancelButton="true"></u-modal> @confirm="confirmModal" @cancel="cancelModal" showCancelButton="true"></u-modal>
</div> </div>
<u-gap bgColor="transparent" height="60"></u-gap>
<div class="love__btn" @click="addCar"> <div class="love__btn" @click="addCar">
<image src="@/static/move-car/love-car5.png"> 添加车辆 <image src="@/static/move-car/love-car5.png"> 添加车辆
</div> </div>
...@@ -203,7 +204,9 @@ export default { ...@@ -203,7 +204,9 @@ export default {
color: #FFFFFF; color: #FFFFFF;
line-height: 76rpx; line-height: 76rpx;
text-align: center; text-align: center;
position: fixed;
width: 670rpx;
bottom: 60rpx;
image { image {
width: 30rpx; width: 30rpx;
height: 30rpx; height: 30rpx;
......
<template> <template>
<view class="appCotent"> <view class="appCotent">
<view> <view>
<custom-tarbar :selected="3"></custom-tarbar> <custom-tarbar :selected="3"></custom-tarbar>
<view class="shop"> <view class="shop">
<div class="my__search" @click='goSearch'> <div class="my__search" @click='goSearch'>
...@@ -25,8 +25,9 @@ ...@@ -25,8 +25,9 @@
</div> </div>
<div class="shop__list__one"> <div class="shop__list__one">
<div class="view__title">车主精选 养车必备</div> <div class="view__title">车主精选 养车必备</div>
<div class="list__one__items">
<scroll-list ref="list" :option="option" @load="load"> <scroll-list ref="list" :option="option" @load="load">
<div class="list__one__items">
<div class="one__item" v-for="(vo,inx) in boutiqueMallList" :key="inx" @click="goDetail(vo.id)"> <div class="one__item" v-for="(vo,inx) in boutiqueMallList" :key="inx" @click="goDetail(vo.id)">
<div class="one__item__img"> <div class="one__item__img">
<image :src="getImage(vo.mainImgUrl)" /> <image :src="getImage(vo.mainImgUrl)" />
...@@ -38,14 +39,14 @@ ...@@ -38,14 +39,14 @@
{{vo.currentPrice/100}}<span class="num__two">{{vo.originalPrice/100}}</span> {{vo.currentPrice/100}}<span class="num__two">{{vo.originalPrice/100}}</span>
</div> </div>
</div> </div>
</scroll-list>
</div> </div>
</scroll-list>
</div> </div>
</view> </view>
<u-gap bgColor="transparent" height="60"></u-gap> <u-gap bgColor="transparent" height="60"></u-gap>
</view> </view>
</view> </view>
</template> </template>
...@@ -77,8 +78,13 @@ export default { ...@@ -77,8 +78,13 @@ export default {
// 加载数据 // 加载数据
load(paging) { load(paging) {
setTimeout(() => { setTimeout(() => {
let opts = { url: '/app/mall/list?pageSize='+paging.size+'&pageNum='+paging.page, method: 'get' }; let opts = {
this.http.httpTokenRequest(opts, {classification: "2"}).then(res => { url: '/app/mall/list?pageSize=' + paging.size + '&pageNum=' + paging.page,
method: 'get'
};
this.http.httpTokenRequest(opts, {
classification: "2"
}).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
let list = res.data.data.rows let list = res.data.data.rows
this.boutiqueMallList = [...this.boutiqueMallList, ...list]; this.boutiqueMallList = [...this.boutiqueMallList, ...list];
...@@ -104,33 +110,46 @@ export default { ...@@ -104,33 +110,46 @@ export default {
url: '/pagesC/pages/shop/detail?id=' + id url: '/pagesC/pages/shop/detail?id=' + id
}) })
}, },
getMallList(){ getMallList() {
let opts = { url: '/app/mall/list', method: 'get' }; let opts = {
this.http.httpTokenRequest(opts, {classification: "1"}).then(res => { url: '/app/mall/list',
method: 'get'
};
this.http.httpTokenRequest(opts, {
classification: "1"
}).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.mallList = res.data.data.rows this.mallList = res.data.data.rows
} }
}) })
}, },
getBoutiqueMallList(){ getBoutiqueMallList() {
let opts = { url: '/app/mall/list', method: 'get' }; let opts = {
this.http.httpTokenRequest(opts, {classification: "2"}).then(res => { url: '/app/mall/list',
method: 'get'
};
this.http.httpTokenRequest(opts, {
classification: "2"
}).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.boutiqueMallList = res.data.data.rows this.boutiqueMallList = res.data.data.rows
} }
}) })
}, },
getImage(imageUrl){ getImage(imageUrl) {
return imageUrl; return imageUrl;
}, },
getRotationList(){ getRotationList() {
let opts = { url: '/app/index/carouse/2', method: 'get' }; let opts = {
url: '/app/index/carouse/2',
method: 'get'
};
this.http.httpTokenRequest(opts, {}).then(res => { this.http.httpTokenRequest(opts, {}).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
let data = [] let data = []
data = res.data.data data = res.data.data
let imgList = [] let imgList = []
data.forEach(e=>{ data.forEach(e => {
imgList.push(e.imageUrl) imgList.push(e.imageUrl)
}) })
this.list3 = imgList this.list3 = imgList
...@@ -160,13 +179,13 @@ export default { ...@@ -160,13 +179,13 @@ export default {
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
flex-wrap: wrap; flex-wrap: wrap;
.one__item { .one__item {
width: 100%; width: 48%;
background: #FFFFFF; background: #FFFFFF;
box-shadow: 0rpx 0rpx 28rpx 1rpx rgba(232, 232, 232, 0.2); box-shadow: 0rpx 0rpx 28rpx 1rpx rgba(232, 232, 232, 0.2);
border-radius: 20rpx; border-radius: 20rpx;
margin-bottom: 30rpx; margin-bottom: 30rpx;
.one__item__img { .one__item__img {
width: 100%; width: 100%;
height: 320rpx; height: 320rpx;
...@@ -259,6 +278,8 @@ export default { ...@@ -259,6 +278,8 @@ export default {
.item2__img { .item2__img {
margin-bottom: 20rpx; margin-bottom: 20rpx;
text-align: center; text-align: center;
width: 145rpx;
height: 145rpx;
image { image {
width: 145rpx; width: 145rpx;
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<image v-if="image" :src="image" /> <image v-if="image" :src="image" />
<image v-else src="@/static/my/my2.png" /> <image v-else src="@/static/my/my2.png" />
<!-- 此处应该有默认头像 --> <!-- 此处应该有默认头像 -->
<!-- <image v-else src="@/static/my/my2.png" />--> <!-- <image v-else src="@/static/my/my2.png" />-->
<span> <span>
<image src="@/static/my/my6.png" /></span> <image src="@/static/my/my6.png" /></span>
</div> </div>
...@@ -140,8 +140,14 @@ export default { ...@@ -140,8 +140,14 @@ export default {
this.formData.forEach(element => { this.formData.forEach(element => {
if (element.label === '生日') { if (element.label === '生日') {
element.rules.label = this.transformTime(e.value) element.rules.label = this.transformTime(e.value)
let opts = { url: '/app/user/update', method: 'post' }; let opts = {
let userInfoItem = { type: 4, val: element.rules.label }; url: '/app/user/update',
method: 'post'
};
let userInfoItem = {
type: 4,
val: element.rules.label
};
this.http.httpTokenRequest(opts, userInfoItem).then(response => { this.http.httpTokenRequest(opts, userInfoItem).then(response => {
if (response.data.code == 200) { if (response.data.code == 200) {
...@@ -155,9 +161,15 @@ export default { ...@@ -155,9 +161,15 @@ export default {
this.formData.forEach(element => { this.formData.forEach(element => {
if (element.label === '性别') { if (element.label === '性别') {
element.rules.label = val element.rules.label = val
let opts = { url: '/app/user/update', method: 'post' }; let opts = {
let sex = (val=='男'?"0":"1") url: '/app/user/update',
let userInfoItem = { type: 3, val: sex }; method: 'post'
};
let sex = (val == '男' ? "0" : "1")
let userInfoItem = {
type: 3,
val: sex
};
this.http.httpTokenRequest(opts, userInfoItem).then(response => { this.http.httpTokenRequest(opts, userInfoItem).then(response => {
if (response.data.code == 200) { if (response.data.code == 200) {
...@@ -172,8 +184,14 @@ export default { ...@@ -172,8 +184,14 @@ export default {
this.formData.forEach(element => { this.formData.forEach(element => {
if (element.label === '昵称') { if (element.label === '昵称') {
element.rules.value = this.user__nikename element.rules.value = this.user__nikename
let opts = { url: '/app/user/update', method: 'post' }; let opts = {
let userInfoItem = { type: 2, val: this.user__nikename }; url: '/app/user/update',
method: 'post'
};
let userInfoItem = {
type: 2,
val: this.user__nikename
};
that.http.httpTokenRequest(opts, userInfoItem).then(response => { that.http.httpTokenRequest(opts, userInfoItem).then(response => {
if (response.data.code == 200) { if (response.data.code == 200) {
...@@ -229,53 +247,70 @@ export default { ...@@ -229,53 +247,70 @@ export default {
}, },
success: (res) => { success: (res) => {
let uploadData = JSON.parse(res.data) let uploadData = JSON.parse(res.data)
let opts = { url: '/app/user/update', method: 'post' }; let opts = {
let userInfoItem = { type: 1, val: uploadData.data.fileName }; url: '/app/user/update',
method: 'post'
};
let userInfoItem = {
type: 1,
val: uploadData.data.fileName
};
that.http.httpTokenRequest(opts, userInfoItem).then(response => { that.http.httpTokenRequest(opts, userInfoItem).then(response => {
if (response.data.code == 200) { if (response.data.code == 200) {
that.$nextTick(() => {
that.image = that.http.baseUrl + uploadData.data.fileName that.image = that.http.baseUrl + uploadData.data.fileName
}
}) })
} }
});
}
});
},
select() {
let that = this
uni.chooseImage({
count: 1, //默认9
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album'], //从相册选择
success: function (res) {
const tempFilePaths = res.tempFilePaths;
uni.uploadFile({
url: that.http.baseUrl + '/common/upload',
//url: 'http://192.168.2.21:7001/upload',//仅为示例,非真实的接口地址
method: 'POST',
filePath: tempFilePaths[0],
name: 'file',
formData: {
file: tempFilePaths[0]
},
success: (res) => {
let uploadData = JSON.parse(res.data)
let opts = { url: '/app/user/update', method: 'post' };
let userInfoItem = { type: 1, val: uploadData.data.fileName };
//console.log(userInfoItem)
that.http.httpTokenRequest(opts, userInfoItem).then(response => {
if (response.data.code == 200) {
that.userInfo.avatar = res.data.url
}
}) })
} }
}); });
} }
}); });
}, },
getUserInfo(){ // select() {
let opts = { url: '/app/user/info', method: 'get' }; // let that = this
// uni.chooseImage({
// count: 1, //默认9
// sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
// sourceType: ['album'], //从相册选择
// success: function (res) {
// const tempFilePaths = res.tempFilePaths;
// uni.uploadFile({
// url: that.http.baseUrl + '/common/upload',
// //url: 'http://192.168.2.21:7001/upload',//仅为示例,非真实的接口地址
// method: 'POST',
// filePath: tempFilePaths[0],
// name: 'file',
// formData: {
// file: tempFilePaths[0]
// },
// success: (res) => {
// let uploadData = JSON.parse(res.data)
// let opts = {
// url: '/app/user/update',
// method: 'post'
// };
// let userInfoItem = {
// type: 1,
// val: uploadData.data.fileName
// };
// //console.log(userInfoItem)
// that.http.httpTokenRequest(opts, userInfoItem).then(response => {
// if (response.data.code == 200) {
// that.userInfo.avatar = res.data.url
// }
// })
// }
// });
// }
// });
// },
getUserInfo() {
let opts = {
url: '/app/user/info',
method: 'get'
};
this.http.httpTokenRequest(opts, {}).then(res => { this.http.httpTokenRequest(opts, {}).then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
this.userInfo = res.data.data this.userInfo = res.data.data
...@@ -288,7 +323,7 @@ export default { ...@@ -288,7 +323,7 @@ export default {
element.rules.value = this.userInfo.nickName element.rules.value = this.userInfo.nickName
} }
if (element.label === '性别') { if (element.label === '性别') {
element.rules.label = this.userInfo.sex=="0"?"男":"女" element.rules.label = this.userInfo.sex == "0" ? "男" : "女"
} }
if (element.label === '生日') { if (element.label === '生日') {
element.rules.label = this.userInfo.birthday element.rules.label = this.userInfo.birthday
...@@ -297,9 +332,9 @@ export default { ...@@ -297,9 +332,9 @@ export default {
} }
}) })
}, },
editUserInfo(){ editUserInfo() {
let user = {} let user = {}
for(let i in this.formData){ for (let i in this.formData) {
let name = this.formData[i].rules.name let name = this.formData[i].rules.name
this.user[name] = this.formData[i].rules.value this.user[name] = this.formData[i].rules.value
} }
...@@ -368,6 +403,11 @@ export default { ...@@ -368,6 +403,11 @@ export default {
padding: 40rpx; padding: 40rpx;
/deep/ .form-container .line .input {
text-align: right !important;
padding-right: 20rpx;
}
.info__cover { .info__cover {
height: 140rpx; height: 140rpx;
background: #FFFFFF; background: #FFFFFF;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment