Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
J
jd-vx-app
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
jd-vx-app
Commits
41e5bbb1
Commit
41e5bbb1
authored
Apr 26, 2022
by
程新智
👽
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化
parent
78df98d1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
657 additions
and
526 deletions
+657
-526
getCarCode.vue
pagesA/pages/index/getCarCode.vue
+4
-2
getPrice.vue
pagesA/pages/index/getPrice.vue
+91
-69
addCar.vue
pagesB/pages/move-car/addCar.vue
+83
-64
editCar.vue
pagesB/pages/move-car/editCar.vue
+123
-99
loveCar.vue
pagesB/pages/move-car/loveCar.vue
+5
-2
index.vue
pagesC/pages/shop/index.vue
+117
-96
userInfo.vue
pagesD/pages/personal/userInfo.vue
+234
-194
No files found.
pagesA/pages/index/getCarCode.vue
View file @
41e5bbb1
...
...
@@ -12,8 +12,8 @@
{{
addressInfo
.
address
}}
 
{{
addressInfo
.
detailInfo
}}
</div>
<div
class=
"right__phone"
>
<span>
{{
addressInfo
.
userName
}}
</span>
<span>
{{
addressInfo
.
telNumber
}}
</span>
<span
v-if=
"addressInfo.defaultFlag"
>
默认
</span>
<span>
{{
addressInfo
.
userName
}}
</span>
<span>
{{
addressInfo
.
telNumber
}}
</span>
</div>
</div>
<div
class=
"address__right"
@
click=
"goAddress"
>
...
...
@@ -329,7 +329,9 @@ export default {
/
deep
/
.u-modal__content__text
{
text-align
:
center
!
important
;
}
/
deep
/
.u-input__content__field-wrapper__field
{
text-align
:
right
!
important
;
}
.price__bottom
{
width
:
100%
;
height
:
156rpx
;
...
...
pagesA/pages/index/getPrice.vue
View file @
41e5bbb1
...
...
@@ -8,8 +8,8 @@
<u-gap
bgColor=
"transparent"
height=
"30"
></u-gap>
<div
class=
"content__code"
>
<div
class=
"code__img"
>
<image
:src=
"freeCode.mainImgUrl"
class=
"code__img"
></image>
</div>
<image
:src=
"freeCode.mainImgUrl"
class=
"code__img"
></image>
</div>
<div
class=
"code__money"
>
<div
class=
"money__title"
>
<text>
{{
freeCode
.
title
}}
</text>
...
...
@@ -33,9 +33,9 @@
<u--input
v-model=
"model1.carInfo.carModel"
placeholder=
"请输入"
border=
"none"
></u--input>
</u-form-item>
<u-form-item
label=
"行驶里程"
prop=
"carInfo.mileage"
borderBottom
ref=
"item3"
>
<div
class=
"self__input__km"
>
<u--input
v-model=
"model1.carInfo.mileage"
placeholder=
"请输入"
border=
"none"
></u--input>
KM
</div>
<div
class=
"self__input__km"
>
<u--input
v-model=
"model1.carInfo.mileage"
placeholder=
"请输入"
border=
"none"
></u--input>
KM
</div>
</u-form-item>
<u-form-item
label=
"车牌号"
prop=
"carInfo.carNo"
ref=
"item1"
>
</u-form-item>
<car-number
v-model=
"model1.carInfo.carNo"
></car-number>
...
...
@@ -88,22 +88,29 @@ export default {
message
:
"请填写品牌"
,
trigger
:
[
"blur"
,
"change"
],
},
"carInfo.carModel"
:
{
type
:
"string"
,
required
:
true
,
message
:
"请填写车型"
,
trigger
:
[
"blur"
,
"change"
],
},
"carInfo.carNo"
:
{
type
:
"string"
,
required
:
true
,
message
:
"请填写车牌号"
,
trigger
:
[
"blur"
,
"change"
],
},
"carInfo.carModel"
:
{
type
:
"string"
,
required
:
true
,
message
:
"请填写车型"
,
trigger
:
[
"blur"
,
"change"
],
},
"carInfo.carNo"
:
[{
min
:
7
,
max
:
8
,
message
:
'车牌长度在7-8个字符之间'
},
{
type
:
"string"
,
required
:
true
,
message
:
"请填写车牌号"
,
trigger
:
[
"blur"
,
"change"
],
},
]
},
carId
:
''
,
//免费挪车码
freeCode
:
{},
carId
:
''
,
//免费挪车码
freeCode
:
{},
};
},
watch
:
{
...
...
@@ -112,61 +119,70 @@ export default {
},
},
methods
:
{
goLoveCar
(){
goLoveCar
()
{
uni
.
navigateTo
({
url
:
'/pagesB/pages/move-car/loveCar?price=1'
});
url
:
'/pagesB/pages/move-car/loveCar?price=1'
});
},
getCarCode
()
{
//跳转到获取挪车码页面
this
.
$refs
.
form1
.
validate
().
then
(
res
=>
{
if
(
!
this
.
model1
.
carInfo
.
id
){
let
opts
=
{
url
:
'/app/vehicleAdmin/add'
,
method
:
'post'
};
this
.
http
.
httpTokenRequest
(
opts
,
this
.
model1
.
carInfo
).
then
(
res
=>
{
if
(
res
.
data
.
code
==
200
)
{
}
})
}
this
.
$refs
.
form1
.
validate
().
then
(
res
=>
{
if
(
!
this
.
model1
.
carInfo
.
id
)
{
let
opts
=
{
url
:
'/app/vehicleAdmin/add'
,
method
:
'post'
};
this
.
http
.
httpTokenRequest
(
opts
,
this
.
model1
.
carInfo
).
then
(
res
=>
{
if
(
res
.
data
.
code
==
200
)
{
}
})
}
uni
.
navigateTo
({
url
:
'/pagesA/pages/index/getCarCode?carNo='
+
this
.
model1
.
carInfo
.
carNo
});
}).
catch
(
errors
=>
{
uni
.
$u
.
toast
(
'校验失败'
)
})
}).
catch
(
errors
=>
{
uni
.
$u
.
toast
(
'校验失败'
)
})
},
getCarInfo
(){
if
(
this
.
carId
){
let
opts
=
{
url
:
'/app/vehicleAdmin/'
+
this
.
carId
,
method
:
'get'
};
this
.
http
.
httpTokenRequest
(
opts
,
{}).
then
(
res
=>
{
if
(
res
.
data
.
code
==
200
)
{
this
.
model1
.
carInfo
=
res
.
data
.
data
}
})
}
},
getMoveCode
(){
let
opts
=
{
url
:
'/app/mall/free/code'
,
method
:
'get'
};
this
.
http
.
httpTokenRequest
(
opts
,
{}).
then
(
res
=>
{
if
(
res
.
data
.
code
==
200
)
{
this
.
freeCode
=
res
.
data
.
data
}
})
},
getCarInfo
()
{
if
(
this
.
carId
)
{
let
opts
=
{
url
:
'/app/vehicleAdmin/'
+
this
.
carId
,
method
:
'get'
};
this
.
http
.
httpTokenRequest
(
opts
,
{}).
then
(
res
=>
{
if
(
res
.
data
.
code
==
200
)
{
this
.
model1
.
carInfo
=
res
.
data
.
data
}
})
}
},
getMoveCode
()
{
let
opts
=
{
url
:
'/app/mall/free/code'
,
method
:
'get'
};
this
.
http
.
httpTokenRequest
(
opts
,
{}).
then
(
res
=>
{
if
(
res
.
data
.
code
==
200
)
{
this
.
freeCode
=
res
.
data
.
data
}
})
},
},
onReady
()
{
// 如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则
this
.
$refs
.
form1
.
setRules
(
this
.
rules
)
},
onShow
()
{
this
.
getCarInfo
()
this
.
getMoveCode
()
},
onLoad
(
e
)
{
this
.
orderId
=
e
.
orderId
},
onReady
()
{
// 如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则
this
.
$refs
.
form1
.
setRules
(
this
.
rules
)
},
onShow
()
{
this
.
getCarInfo
()
this
.
getMoveCode
()
},
onLoad
(
e
)
{
this
.
orderId
=
e
.
orderId
},
};
</
script
>
...
...
@@ -175,16 +191,21 @@ export default {
width
:
100%
;
height
:
100%
;
/
deep
/
.uni-input-input
,
/
deep
/
.uni-input-input
,
.uni-input-placeholder
{
text-align
:
right
;
}
/
deep
/
.u-input__content__field-wrapper__field
{
text-align
:
right
!
important
;
}
.self__input__km
{
display
:
flex
;
align-items
:
center
;
justify-content
:
space-between
;
span
{
span
{
text-align
:
right
;
display
:
inline-block
;
width
:
100rpx
;
...
...
@@ -287,7 +308,8 @@ export default {
color
:
#f1251b
;
text-align
:
right
;
margin-top
:
40rpx
;
margin-bottom
:
200rpx
;
margin-bottom
:
200rpx
;
image
{
width
:
10rpx
;
height
:
20rpx
;
...
...
pagesB/pages/move-car/addCar.vue
View file @
41e5bbb1
...
...
@@ -4,39 +4,39 @@
-->
<
template
>
<view
class=
"appCotent"
>
<div
class=
"addCar"
>
<div
class=
"add__content"
>
<div
class=
"add__title"
>
填写车辆信息
<div
class=
"addCar"
>
<div
class=
"add__content"
>
<div
class=
"add__title"
>
填写车辆信息
</div>
<div>
<u--form
labelPosition=
"left"
:model=
"model1"
:rules=
"rules"
ref=
"form1"
labelWidth=
"100"
>
<u-form-item
label=
"品牌"
prop=
"carInfo.brand"
borderBottom
ref=
"item1"
>
<u--input
v-model=
"model1.carInfo.brand"
placeholder=
"请输入"
border=
"none"
></u--input>
</u-form-item>
<u-form-item
label=
"车型"
prop=
"carInfo.carModel"
borderBottom
ref=
"item1"
>
<u--input
v-model=
"model1.carInfo.carModel"
placeholder=
"请输入"
border=
"none"
></u--input>
</u-form-item>
<u-form-item
label=
"行驶里程"
prop=
"carInfo.mileage"
borderBottom
ref=
"item1"
>
<div
class=
"self__input__km"
>
<u--input
v-model=
"model1.carInfo.mileage"
placeholder=
"请输入"
border=
"none"
></u--input>
KM
</div>
</u-form-item>
<u-form-item
label=
"车牌号"
prop=
"carInfo.carNo"
ref=
"item1"
>
</u-form-item>
<car-number
v-model=
"model1.carInfo.carNo"
></car-number>
</u--form>
</div>
</div>
<div>
<u--form
labelPosition=
"left"
:model=
"model1"
:rules=
"rules"
ref=
"form1"
labelWidth=
"100"
>
<u-form-item
label=
"品牌"
prop=
"carInfo.brand"
borderBottom
ref=
"item1"
>
<u--input
v-model=
"model1.carInfo.brand"
placeholder=
"请输入"
border=
"none"
></u--input>
</u-form-item>
<u-form-item
label=
"车型"
prop=
"carInfo.carModel"
borderBottom
ref=
"item1"
>
<u--input
v-model=
"model1.carInfo.carModel"
placeholder=
"请输入"
border=
"none"
></u--input>
</u-form-item>
<u-form-item
label=
"行驶里程"
prop=
"carInfo.mileage"
borderBottom
ref=
"item1"
>
<div
class=
"self__input__km"
>
<u--input
v-model=
"model1.carInfo.mileage"
placeholder=
"请输入"
border=
"none"
></u--input>
KM
</div>
</u-form-item>
<u-form-item
label=
"车牌号"
prop=
"carInfo.carNo"
ref=
"item1"
>
</u-form-item>
<car-number
v-model=
"model1.carInfo.carNo"
></car-number>
</u--form>
<div
class=
"add__user"
>
<u-checkbox-group
placement=
"row"
>
<u-checkbox
:checked=
'checked'
@
change=
"changeBtn"
></u-checkbox>
</u-checkbox-group>
勾选同意
<span>
《用户服务协议》
</span>
</div>
<div
class=
"add__btn add__no__bind"
@
click=
"addCarInfo()"
>
完成
</div>
</div>
<div
class=
"add__user"
>
<u-checkbox-group
placement=
"row"
>
<u-checkbox
:checked=
'checked'
@
change=
"changeBtn"
></u-checkbox>
</u-checkbox-group>
勾选同意
<span>
《用户服务协议》
</span>
</div>
<div
class=
"add__btn add__no__bind"
@
click=
"addCarInfo()"
>
完成
</div>
</div>
</view>
</
template
>
...
...
@@ -48,7 +48,7 @@ export default {
},
data
()
{
return
{
checked
:
false
,
checked
:
false
,
model1
:
{
carInfo
:
{
brand
:
''
,
...
...
@@ -61,18 +61,25 @@ export default {
message
:
"请填写品牌"
,
trigger
:
[
"blur"
,
"change"
],
},
"carInfo.carModel"
:
{
type
:
"string"
,
required
:
true
,
message
:
"请填写车型"
,
trigger
:
[
"blur"
,
"change"
],
},
"carInfo.carNo"
:
{
type
:
"string"
,
required
:
true
,
message
:
"请填写车牌号"
,
trigger
:
[
"blur"
,
"change"
],
},
"carInfo.carModel"
:
{
type
:
"string"
,
required
:
true
,
message
:
"请填写车型"
,
trigger
:
[
"blur"
,
"change"
],
},
"carInfo.carNo"
:
[{
min
:
7
,
max
:
8
,
message
:
'车牌长度在7-8个字符之间'
},
{
type
:
"string"
,
required
:
true
,
message
:
"请填写车牌号"
,
trigger
:
[
"blur"
,
"change"
],
},
]
},
items
:
[{
title
:
"挪车码编号"
,
...
...
@@ -97,7 +104,7 @@ export default {
};
},
methods
:
{
changeBtn
(){
changeBtn
()
{
this
.
checked
=
!
this
.
checked
;
},
goBack
()
{
...
...
@@ -105,33 +112,45 @@ export default {
delta
:
1
})
},
addCarInfo
(){
//表单验证
this
.
$refs
.
form1
.
validate
().
then
(
res
=>
{
let
opts
=
{
url
:
'/app/vehicleAdmin/add'
,
method
:
'post'
};
this
.
http
.
httpTokenRequest
(
opts
,
this
.
model1
.
carInfo
).
then
(
res
=>
{
if
(
res
.
data
.
code
==
200
)
{
//添加成功
uni
.
$u
.
toast
(
'添加成功'
)
this
.
goBack
()
}
})
}).
catch
(
errors
=>
{
uni
.
$u
.
toast
(
'校验失败'
)
})
},
addCarInfo
()
{
//表单验证
this
.
$refs
.
form1
.
validate
().
then
(
res
=>
{
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
=>
{
if
(
res
.
data
.
code
==
200
)
{
//添加成功
uni
.
$u
.
toast
(
'添加成功'
)
this
.
goBack
()
}
})
}).
catch
(
errors
=>
{
uni
.
$u
.
toast
(
'校验失败'
)
})
},
},
onReady
()
{
// 如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则
this
.
$refs
.
form1
.
setRules
(
this
.
rules
)
},
onReady
()
{
// 如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则
this
.
$refs
.
form1
.
setRules
(
this
.
rules
)
},
}
</
script
>
<
style
lang=
"scss"
scoped
>
.addCar
{
padding
:
40rpx
0rpx
;
/
deep
/
.u-input__content__field-wrapper__field
{
/
deep
/
.u-input__content__field-wrapper__field
{
text-align
:
right
!
important
;
padding-right
:
30rpx
;
}
...
...
pagesB/pages/move-car/editCar.vue
View file @
41e5bbb1
...
...
@@ -4,39 +4,38 @@
-->
<
template
>
<view
class=
"appCotent"
>
<div
class=
"editCar"
>
<div
class=
"add__content"
>
<div
class=
"add__title"
>
填写车辆信息
<div
class=
"editCar"
>
<div
class=
"add__content"
>
<div
class=
"add__title"
>
填写车辆信息
</div>
<div>
<u--form
labelPosition=
"left"
:model=
"model1"
:rules=
"rules"
ref=
"form1"
labelWidth=
"100"
>
<u-form-item
label=
"品牌"
prop=
"carInfo.brand"
borderBottom
ref=
"item1"
>
<u--input
v-model=
"model1.carInfo.brand"
placeholder=
"请输入"
border=
"none"
></u--input>
</u-form-item>
<u-form-item
label=
"车型"
prop=
"carInfo.carModel"
borderBottom
ref=
"item2"
>
<u--input
v-model=
"model1.carInfo.carModel"
placeholder=
"请输入"
border=
"none"
></u--input>
</u-form-item>
<u-form-item
label=
"行驶里程"
prop=
"carInfo.mileage"
borderBottom
ref=
"item3"
>
<div
class=
"self__input__km"
>
<u--input
v-model=
"model1.carInfo.mileage"
placeholder=
"请输入"
border=
"none"
></u--input>
KM
</div>
</u-form-item>
<u-form-item
label=
"车牌号"
prop=
"carInfo.carNo"
ref=
"item1"
>
</u-form-item>
<car-number
v-if=
"model1.carInfo.carNo"
v-model=
"model1.carInfo.carNo"
></car-number>
</u--form>
</div>
</div>
<div>
<u--form
labelPosition=
"left"
:model=
"model1"
:rules=
"rules"
ref=
"form1"
labelWidth=
"100"
>
<u-form-item
label=
"品牌"
prop=
"carInfo.brand"
borderBottom
ref=
"item1"
>
<u--input
v-model=
"model1.carInfo.brand"
placeholder=
"请输入"
border=
"none"
></u--input>
</u-form-item>
<u-form-item
label=
"车型"
prop=
"carInfo.carModel"
borderBottom
ref=
"item2"
>
<u--input
v-model=
"model1.carInfo.carModel"
placeholder=
"请输入"
border=
"none"
></u--input>
</u-form-item>
<u-form-item
label=
"行驶里程"
prop=
"carInfo.mileage"
borderBottom
ref=
"item3"
>
<div
class=
"self__input__km"
>
<u--input
v-model=
"model1.carInfo.mileage"
placeholder=
"请输入"
border=
"none"
></u--input>
KM
</div>
</u-form-item>
<u-form-item
label=
"车牌号"
prop=
"carInfo.carNo"
ref=
"item1"
>
</u-form-item>
<car-number
v-model=
"model1.carInfo.carNo"
></car-number>
</u--form>
</div>
</div>
<div
class=
"add__btn add__no__bind"
@
click=
"editCarInfo"
>
保存
</div>
<div
class=
"add__btn add__back"
@
click=
"delModal"
>
删除
<div
class=
"add__btn add__no__bind"
@
click=
"editCarInfo"
>
保存
</div>
<div
class=
"add__btn add__back"
@
click=
"delModal"
>
删除
</div>
<u-modal
:show=
"deleteShow"
:title=
"deleteTitle"
:content=
'deleteContent'
@
confirm=
"confirmModal"
@
cancel=
"cancelModal"
showCancelButton=
"true"
></u-modal>
</div>
<u-modal
:show=
"deleteShow"
:title=
"deleteTitle"
:content=
'deleteContent'
@
confirm=
"confirmModal"
@
cancel=
"cancelModal"
showCancelButton=
"true"
></u-modal>
</div>
</view>
</
template
>
...
...
@@ -51,11 +50,13 @@ export default {
//车辆id
id
:
''
,
model1
:
{
carInfo
:
{},
carInfo
:
{
carNo
:
''
,
},
},
deleteShow
:
false
,
deleteTitle
:
'删除车辆'
,
deleteContent
:
'确定删除车辆?'
,
deleteShow
:
false
,
deleteTitle
:
'删除车辆'
,
deleteContent
:
'确定删除车辆?'
,
rules
:
{
"carInfo.brand"
:
{
type
:
"string"
,
...
...
@@ -63,18 +64,25 @@ export default {
message
:
"请填写品牌"
,
trigger
:
[
"blur"
,
"change"
],
},
"carInfo.carModel"
:
{
type
:
"string"
,
required
:
true
,
message
:
"请填写车型"
,
trigger
:
[
"blur"
,
"change"
],
},
"carInfo.carNo"
:
{
type
:
"string"
,
required
:
true
,
message
:
"请填写车牌号"
,
trigger
:
[
"blur"
,
"change"
],
},
"carInfo.carModel"
:
{
type
:
"string"
,
required
:
true
,
message
:
"请填写车型"
,
trigger
:
[
"blur"
,
"change"
],
},
"carInfo.carNo"
:
[{
min
:
7
,
max
:
8
,
message
:
'车牌长度在7-8个字符之间'
},
{
type
:
"string"
,
required
:
true
,
message
:
"请填写车牌号"
,
trigger
:
[
"blur"
,
"change"
],
},
]
},
items
:
[{
title
:
"挪车码编号"
,
...
...
@@ -104,64 +112,77 @@ export default {
delta
:
1
})
},
getCarInfo
(){
let
opts
=
{
url
:
'/app/vehicleAdmin/'
+
this
.
id
,
method
:
'get'
};
this
.
http
.
httpTokenRequest
(
opts
,
{}).
then
(
res
=>
{
if
(
res
.
data
.
code
==
200
)
{
this
.
model1
.
carInfo
=
res
.
data
.
data
}
})
getCarInfo
()
{
let
opts
=
{
url
:
'/app/vehicleAdmin/'
+
this
.
id
,
method
:
'get'
};
this
.
http
.
httpTokenRequest
(
opts
,
{}).
then
(
res
=>
{
if
(
res
.
data
.
code
==
200
)
{
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
()
{
this
.
$refs
.
form1
.
validate
().
then
(
res
=>
{
let
opts
=
{
url
:
'/app/vehicleAdmin/edit'
,
method
:
'put'
};
this
.
http
.
httpTokenRequest
(
opts
,
this
.
model1
.
carInfo
).
then
(
res
=>
{
if
(
res
.
data
.
code
==
200
)
{
//添加成功
uni
.
$u
.
toast
(
'修改成功'
)
this
.
goBack
()
}
})
}).
catch
(
errors
=>
{
uni
.
$u
.
toast
(
'校验失败'
)
})
},
editCarInfo
(){
this
.
$refs
.
form1
.
validate
().
then
(
res
=>
{
let
opts
=
{
url
:
'/app/vehicleAdmin/edit'
,
method
:
'put'
};
this
.
http
.
httpTokenRequest
(
opts
,
this
.
model1
.
carInfo
).
then
(
res
=>
{
if
(
res
.
data
.
code
==
200
)
{
//添加成功
uni
.
$u
.
toast
(
'修改成功'
)
this
.
goBack
()
}
})
}).
catch
(
errors
=>
{
uni
.
$u
.
toast
(
'校验失败'
)
})
//确认删除车辆
confirmModal
()
{
let
opts
=
{
url
:
'/app/vehicleAdmin/remove/'
+
this
.
id
,
method
:
'delete'
};
this
.
http
.
httpTokenRequest
(
opts
,
{}).
then
(
res
=>
{
if
(
res
.
data
.
code
==
200
)
{
uni
.
showToast
({
title
:
'删除成功'
,
icon
:
"success"
,
});
this
.
goBack
()
}
else
{
uni
.
showToast
({
title
:
res
.
data
.
msg
,
icon
:
"error"
,
});
}
})
this
.
deleteShow
=
false
},
cancelModal
()
{
this
.
deleteShow
=
false
},
delModal
()
{
this
.
deleteShow
=
true
},
//确认删除车辆
confirmModal
(){
let
opts
=
{
url
:
'/app/vehicleAdmin/remove/'
+
this
.
id
,
method
:
'delete'
};
this
.
http
.
httpTokenRequest
(
opts
,
{}).
then
(
res
=>
{
if
(
res
.
data
.
code
==
200
)
{
uni
.
showToast
({
title
:
'删除成功'
,
icon
:
"success"
,
});
this
.
goBack
()
}
else
{
uni
.
showToast
({
title
:
res
.
data
.
msg
,
icon
:
"error"
,
});
}
})
this
.
deleteShow
=
false
},
cancelModal
(){
this
.
deleteShow
=
false
},
delModal
(){
this
.
deleteShow
=
true
},
},
onLoad
(
option
)
{
this
.
id
=
option
.
id
this
.
id
=
option
.
id
},
onReady
()
{
// 如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则
this
.
$refs
.
form1
.
setRules
(
this
.
rules
)
// 如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则
this
.
$refs
.
form1
.
setRules
(
this
.
rules
)
},
onShow
(){
this
.
getCarInfo
()
onShow
()
{
this
.
getCarInfo
()
},
}
</
script
>
...
...
@@ -169,15 +190,18 @@ export default {
<
style
lang=
"scss"
scoped
>
.editCar
{
padding
:
40rpx
0rpx
;
/
deep
/
.u-input__content__field-wrapper__field
{
/
deep
/
.u-input__content__field-wrapper__field
{
text-align
:
right
!
important
;
padding-right
:
30rpx
;
justify-content
:
space-evenly
;
}
.u-checkbox-group
{
display
:
inline-block
!
important
;
}
/
deep
/
.u-checkbox-group--row
{
/
deep
/
.u-checkbox-group--row
{
display
:
inline-block
!
important
;
}
...
...
pagesB/pages/move-car/loveCar.vue
View file @
41e5bbb1
...
...
@@ -28,6 +28,7 @@
<u-modal
:show=
"deleteShow"
:title=
"deleteTitle"
:content=
'deleteContent'
@
confirm=
"confirmModal"
@
cancel=
"cancelModal"
showCancelButton=
"true"
></u-modal>
</div>
<u-gap
bgColor=
"transparent"
height=
"60"
></u-gap>
<div
class=
"love__btn"
@
click=
"addCar"
>
<image
src=
"@/static/move-car/love-car5.png"
>
添加车辆
</div>
...
...
@@ -193,7 +194,7 @@ export default {
}
}
.love__btn
{
.love__btn
{
height
:
76rpx
;
background
:
url('@/static/move-car/love-car4.png')
no-repeat
;
background-size
:
contain
;
...
...
@@ -203,7 +204,9 @@ export default {
color
:
#FFFFFF
;
line-height
:
76rpx
;
text-align
:
center
;
position
:
fixed
;
width
:
670rpx
;
bottom
:
60rpx
;
image
{
width
:
30rpx
;
height
:
30rpx
;
...
...
pagesC/pages/shop/index.vue
View file @
41e5bbb1
<
template
>
<view
class=
"appCotent"
>
<view>
<custom-tarbar
:selected=
"3"
></custom-tarbar>
<view
class=
"shop"
>
<div
class=
"my__search"
@
click=
'goSearch'
>
<u-search
placeholder=
"搜搜你最想知道的"
:showAction=
'false'
bgColor=
'#ffffff'
v-model=
"keyword"
></u-search>
</div>
<div
class=
"shop__swiper"
>
<view
class=
"u-demo-block"
>
<u-swiper
:list=
"list3"
previousMargin=
"30"
nextMargin=
"30"
circular
:autoplay=
"false"
height=
'150'
radius=
"5"
bgColor=
"#ffffff"
></u-swiper>
</view>
</div>
<div
class=
"view__content"
>
<div
class=
"view__title"
>
超低价养车好物
</div>
<div
class=
"shop__list2"
>
<div
class=
"shop__item2"
v-for=
"(vo,inx) in mallList"
:key=
"inx"
@
click=
"goDetail(vo.id)"
>
<div
class=
"item2__img"
>
<image
:src=
"getImage(vo.mainImgUrl)"
/>
<view>
<custom-tarbar
:selected=
"3"
></custom-tarbar>
<view
class=
"shop"
>
<div
class=
"my__search"
@
click=
'goSearch'
>
<u-search
placeholder=
"搜搜你最想知道的"
:showAction=
'false'
bgColor=
'#ffffff'
v-model=
"keyword"
></u-search>
</div>
<div
class=
"shop__swiper"
>
<view
class=
"u-demo-block"
>
<u-swiper
:list=
"list3"
previousMargin=
"30"
nextMargin=
"30"
circular
:autoplay=
"false"
height=
'150'
radius=
"5"
bgColor=
"#ffffff"
></u-swiper>
</view>
</div>
<div
class=
"view__content"
>
<div
class=
"view__title"
>
超低价养车好物
</div>
<div
class=
"shop__list2"
>
<div
class=
"shop__item2"
v-for=
"(vo,inx) in mallList"
:key=
"inx"
@
click=
"goDetail(vo.id)"
>
<div
class=
"item2__img"
>
<image
:src=
"getImage(vo.mainImgUrl)"
/>
</div>
<div
class=
"item2__title"
>
{{
vo
.
title
}}
</div>
<div
class=
"item2__price"
>
¥
{{
vo
.
currentPrice
/
100
}}
</div>
</div>
<div
class=
"item2__title"
>
{{
vo
.
title
}}
</div>
<div
class=
"item2__price"
>
¥
{{
vo
.
currentPrice
/
100
}}
</div>
</div>
</div>
</div>
<div
class=
"shop__list__one"
>
<div
class=
"view__title"
>
车主精选 养车必备
</div>
<div
class=
"list__one__items"
>
<scroll-list
ref=
"list"
:option=
"option"
@
load=
"load"
>
<div
class=
"one__item"
v-for=
"(vo,inx) in boutiqueMallList"
:key=
"inx"
@
click=
"goDetail(vo.id)"
>
<div
class=
"one__item__img"
>
<image
:src=
"getImage(vo.mainImgUrl)"
/>
</div>
<div
class=
"one__item__title"
>
{{
vo
.
title
}}
</div>
<div
class=
"one__item__price"
>
¥
{{
vo
.
currentPrice
/
100
}}
<span
class=
"num__two"
>
¥
{{
vo
.
originalPrice
/
100
}}
</span>
</div>
<div
class=
"shop__list__one"
>
<div
class=
"view__title"
>
车主精选 养车必备
</div>
<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__img"
>
<image
:src=
"getImage(vo.mainImgUrl)"
/>
</div>
<div
class=
"one__item__title"
>
{{
vo
.
title
}}
</div>
<div
class=
"one__item__price"
>
¥
{{
vo
.
currentPrice
/
100
}}
<span
class=
"num__two"
>
¥
{{
vo
.
originalPrice
/
100
}}
</span>
</div>
</div>
</div>
</scroll-list>
</scroll-list>
</div>
</div>
</view>
<u-gap
bgColor=
"transparent"
height=
"60"
></u-gap>
</view>
<u-gap
bgColor=
"transparent"
height=
"60"
></u-gap>
</view>
</view>
</view>
</
template
>
...
...
@@ -57,42 +58,47 @@ export default {
},
data
()
{
return
{
option
:
{
size
:
10
,
auto
:
true
},
option
:
{
size
:
10
,
auto
:
true
},
keyword
:
''
,
list3
:
[
'https://cdn.uviewui.com/uview/swiper/swiper3.png'
,
'https://cdn.uviewui.com/uview/swiper/swiper2.png'
,
'https://cdn.uviewui.com/uview/swiper/swiper1.png'
,
],
//普通商品列表
mallList
:
[],
//精品商品
boutiqueMallList
:
[],
//普通商品列表
mallList
:
[],
//精品商品
boutiqueMallList
:
[],
}
},
methods
:
{
// 加载数据
load
(
paging
)
{
setTimeout
(()
=>
{
let
opts
=
{
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
)
{
let
list
=
res
.
data
.
data
.
rows
this
.
boutiqueMallList
=
[...
this
.
boutiqueMallList
,
...
list
];
setTimeout
(()
=>
{
let
opts
=
{
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
)
{
let
list
=
res
.
data
.
data
.
rows
this
.
boutiqueMallList
=
[...
this
.
boutiqueMallList
,
...
list
];
// 加载成功 参数对象{list: 当前列表,total: 数据总长度(后端查询的total)}
this
.
$refs
.
list
.
loadSuccess
({
list
:
this
.
boutiqueMallList
,
total
:
res
.
data
.
data
.
total
});
// 加载失败
// this.$refs.list.loadFail()
}
})
},
this
.
$u
.
random
(
100
,
1000
));
// 加载成功 参数对象{list: 当前列表,total: 数据总长度(后端查询的total)}
this
.
$refs
.
list
.
loadSuccess
({
list
:
this
.
boutiqueMallList
,
total
:
res
.
data
.
data
.
total
});
// 加载失败
// this.$refs.list.loadFail()
}
})
},
this
.
$u
.
random
(
100
,
1000
));
},
goSearch
()
{
uni
.
navigateTo
({
...
...
@@ -104,46 +110,59 @@ export default {
url
:
'/pagesC/pages/shop/detail?id='
+
id
})
},
getMallList
(){
let
opts
=
{
url
:
'/app/mall/list'
,
method
:
'get'
};
this
.
http
.
httpTokenRequest
(
opts
,
{
classification
:
"1"
}).
then
(
res
=>
{
if
(
res
.
data
.
code
==
200
)
{
this
.
mallList
=
res
.
data
.
data
.
rows
}
})
},
getBoutiqueMallList
(){
let
opts
=
{
url
:
'/app/mall/list'
,
method
:
'get'
};
this
.
http
.
httpTokenRequest
(
opts
,
{
classification
:
"2"
}).
then
(
res
=>
{
if
(
res
.
data
.
code
==
200
)
{
this
.
boutiqueMallList
=
res
.
data
.
data
.
rows
}
})
},
getImage
(
imageUrl
){
return
imageUrl
;
},
getRotationList
(){
let
opts
=
{
url
:
'/app/index/carouse/2'
,
method
:
'get'
};
getMallList
()
{
let
opts
=
{
url
:
'/app/mall/list'
,
method
:
'get'
};
this
.
http
.
httpTokenRequest
(
opts
,
{
classification
:
"1"
}).
then
(
res
=>
{
if
(
res
.
data
.
code
==
200
)
{
this
.
mallList
=
res
.
data
.
data
.
rows
}
})
},
getBoutiqueMallList
()
{
let
opts
=
{
url
:
'/app/mall/list'
,
method
:
'get'
};
this
.
http
.
httpTokenRequest
(
opts
,
{
classification
:
"2"
}).
then
(
res
=>
{
if
(
res
.
data
.
code
==
200
)
{
this
.
boutiqueMallList
=
res
.
data
.
data
.
rows
}
})
},
getImage
(
imageUrl
)
{
return
imageUrl
;
},
getRotationList
()
{
let
opts
=
{
url
:
'/app/index/carouse/2'
,
method
:
'get'
};
this
.
http
.
httpTokenRequest
(
opts
,
{}).
then
(
res
=>
{
if
(
res
.
data
.
code
==
200
)
{
let
data
=
[]
if
(
res
.
data
.
code
==
200
)
{
let
data
=
[]
data
=
res
.
data
.
data
let
imgList
=
[]
data
.
forEach
(
e
=>
{
data
.
forEach
(
e
=>
{
imgList
.
push
(
e
.
imageUrl
)
})
this
.
list3
=
imgList
}
}
})
},
},
onShow
()
{
this
.
getMallList
()
onShow
()
{
this
.
getMallList
()
this
.
getRotationList
()
//this.getBoutiqueMallList()
}
//this.getBoutiqueMallList()
}
};
</
script
>
...
...
@@ -160,13 +179,13 @@ export default {
align-items
:
center
;
justify-content
:
space-between
;
flex-wrap
:
wrap
;
.one__item
{
width
:
100
%
;
width
:
48
%
;
background
:
#FFFFFF
;
box-shadow
:
0rpx
0rpx
28rpx
1rpx
rgba
(
232
,
232
,
232
,
0
.2
);
border-radius
:
20rpx
;
margin-bottom
:
30rpx
;
.one__item__img
{
width
:
100%
;
height
:
320rpx
;
...
...
@@ -259,6 +278,8 @@ export default {
.item2__img
{
margin-bottom
:
20rpx
;
text-align
:
center
;
width
:
145rpx
;
height
:
145rpx
;
image
{
width
:
145rpx
;
...
...
pagesD/pages/personal/userInfo.vue
View file @
41e5bbb1
...
...
@@ -9,9 +9,9 @@
<span
class=
"cover__name"
>
头像
</span>
<div
class=
"cover"
>
<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>
<image
src=
"@/static/my/my6.png"
/></span>
</div>
...
...
@@ -29,13 +29,13 @@
<div
class=
"user__input user__sex"
@
click=
"select__sex('男')"
>
男
</div>
<div
class=
"user__input user__sex"
@
click=
"select__sex('女')"
>
女
</div>
<div
class=
"user__input user__sex"
@
click=
"select__sex('女')"
>
女
</div>
</u-popup>
<u-datetime-picker
:show=
"show__date"
v-model=
"dateValue"
ref=
'datetimePicker'
:minDate=
"-2209017600000"
mode=
"date"
@
confirm=
'confirm'
@
close=
'close__date'
@
cancel=
'close__date'
:formatter=
"formatter"
closeOnClickOverlay
>
</u-datetime-picker>
</u-datetime-picker>
<view
class=
"info__content"
>
<active-form
@
clickFn=
'clickFn'
:formDate
.
sync=
"formData"
></active-form>
</view>
...
...
@@ -54,7 +54,7 @@ export default {
show__date
:
false
,
image
:
''
,
userInfo
:
{
nickName
:
'默认昵称'
,
nickName
:
'默认昵称'
,
},
formData
:
[{
id
:
"kjjns"
,
//id必须唯一 可以是数字
...
...
@@ -108,205 +108,240 @@ export default {
}
},
onReady
()
{
// 微信小程序需要用此写法
this
.
$refs
.
datetimePicker
.
setFormatter
(
this
.
formatter
)
// 微信小程序需要用此写法
this
.
$refs
.
datetimePicker
.
setFormatter
(
this
.
formatter
)
},
methods
:
{
formatter
(
type
,
value
)
{
if
(
type
===
'year'
)
{
return
`
${
value
}
年`
}
if
(
type
===
'month'
)
{
return
`
${
value
}
月`
}
if
(
type
===
'day'
)
{
return
`
${
value
}
日`
}
return
value
},
transformTime
(
timestamp
)
{
if
(
timestamp
)
{
var
time
=
new
Date
(
timestamp
);
//console.log(time);
var
y
=
time
.
getFullYear
();
//getFullYear方法以四位数字返回年份
var
M
=
time
.
getMonth
()
+
1
;
// getMonth方法从 Date 对象返回月份 (0 ~ 11),返回结果需要手动加一
var
d
=
time
.
getDate
();
// getDate方法从 Date 对象返回一个月中的某一天 (1 ~ 31)
return
y
+
'-'
+
M
+
'-'
+
d
}
else
{
return
''
;
}
},
confirm
(
e
)
{
this
.
formData
.
forEach
(
element
=>
{
if
(
element
.
label
===
'生日'
)
{
element
.
rules
.
label
=
this
.
transformTime
(
e
.
value
)
let
opts
=
{
url
:
'/app/user/update'
,
method
:
'post'
};
let
userInfoItem
=
{
type
:
4
,
val
:
element
.
rules
.
label
};
this
.
http
.
httpTokenRequest
(
opts
,
userInfoItem
).
then
(
response
=>
{
if
(
response
.
data
.
code
==
200
)
{
}
})
}
});
this
.
show__date
=
false
},
select__sex
(
val
)
{
this
.
formData
.
forEach
(
element
=>
{
if
(
element
.
label
===
'性别'
)
{
element
.
rules
.
label
=
val
let
opts
=
{
url
:
'/app/user/update'
,
method
:
'post'
};
let
sex
=
(
val
==
'男'
?
"0"
:
"1"
)
let
userInfoItem
=
{
type
:
3
,
val
:
sex
};
this
.
http
.
httpTokenRequest
(
opts
,
userInfoItem
).
then
(
response
=>
{
if
(
response
.
data
.
code
==
200
)
{
}
})
}
});
this
.
show__six
=
false
},
save
()
{
this
.
formData
.
forEach
(
element
=>
{
if
(
element
.
label
===
'昵称'
)
{
element
.
rules
.
value
=
this
.
user__nikename
let
opts
=
{
url
:
'/app/user/update'
,
method
:
'post'
};
let
userInfoItem
=
{
type
:
2
,
val
:
this
.
user__nikename
};
that
.
http
.
httpTokenRequest
(
opts
,
userInfoItem
).
then
(
response
=>
{
if
(
response
.
data
.
code
==
200
)
{
}
})
}
});
this
.
show
=
false
},
clickFn
(
e
)
{
//console.log(e)
switch
(
e
)
{
case
1
:
this
.
show
=
true
break
;
case
2
:
this
.
show__six
=
true
break
;
case
3
:
this
.
show__date
=
true
break
;
}
},
close
()
{
this
.
show
=
false
;
},
close__sex
()
{
this
.
show__six
=
false
;
},
close__date
()
{
this
.
show__date
=
false
;
},
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
]
},
// 请求头一定要加,否则 iOS 图片上传会失败
header
:
{
'content-type'
:
'multipart/form-data'
},
success
:
(
res
)
=>
{
let
uploadData
=
JSON
.
parse
(
res
.
data
)
let
opts
=
{
url
:
'/app/user/update'
,
method
:
'post'
};
let
userInfoItem
=
{
type
:
1
,
val
:
uploadData
.
data
.
fileName
};
that
.
http
.
httpTokenRequest
(
opts
,
userInfoItem
).
then
(
response
=>
{
if
(
response
.
data
.
code
==
200
)
{
that
.
image
=
that
.
http
.
baseUrl
+
uploadData
.
data
.
fileName
}
})
}
});
}
});
formatter
(
type
,
value
)
{
if
(
type
===
'year'
)
{
return
`
${
value
}
年`
}
if
(
type
===
'month'
)
{
return
`
${
value
}
月`
}
if
(
type
===
'day'
)
{
return
`
${
value
}
日`
}
return
value
},
transformTime
(
timestamp
)
{
if
(
timestamp
)
{
var
time
=
new
Date
(
timestamp
);
//console.log(time);
var
y
=
time
.
getFullYear
();
//getFullYear方法以四位数字返回年份
var
M
=
time
.
getMonth
()
+
1
;
// getMonth方法从 Date 对象返回月份 (0 ~ 11),返回结果需要手动加一
var
d
=
time
.
getDate
();
// getDate方法从 Date 对象返回一个月中的某一天 (1 ~ 31)
return
y
+
'-'
+
M
+
'-'
+
d
}
else
{
return
''
;
}
},
confirm
(
e
)
{
this
.
formData
.
forEach
(
element
=>
{
if
(
element
.
label
===
'生日'
)
{
element
.
rules
.
label
=
this
.
transformTime
(
e
.
value
)
let
opts
=
{
url
:
'/app/user/update'
,
method
:
'post'
};
let
userInfoItem
=
{
type
:
4
,
val
:
element
.
rules
.
label
};
this
.
http
.
httpTokenRequest
(
opts
,
userInfoItem
).
then
(
response
=>
{
if
(
response
.
data
.
code
==
200
)
{
},
}
})
}
});
this
.
show__date
=
false
},
select__sex
(
val
)
{
this
.
formData
.
forEach
(
element
=>
{
if
(
element
.
label
===
'性别'
)
{
element
.
rules
.
label
=
val
let
opts
=
{
url
:
'/app/user/update'
,
method
:
'post'
};
let
sex
=
(
val
==
'男'
?
"0"
:
"1"
)
let
userInfoItem
=
{
type
:
3
,
val
:
sex
};
this
.
http
.
httpTokenRequest
(
opts
,
userInfoItem
).
then
(
response
=>
{
if
(
response
.
data
.
code
==
200
)
{
}
})
}
});
this
.
show__six
=
false
},
save
()
{
this
.
formData
.
forEach
(
element
=>
{
if
(
element
.
label
===
'昵称'
)
{
element
.
rules
.
value
=
this
.
user__nikename
let
opts
=
{
url
:
'/app/user/update'
,
method
:
'post'
};
let
userInfoItem
=
{
type
:
2
,
val
:
this
.
user__nikename
};
that
.
http
.
httpTokenRequest
(
opts
,
userInfoItem
).
then
(
response
=>
{
if
(
response
.
data
.
code
==
200
)
{
}
})
}
});
this
.
show
=
false
},
clickFn
(
e
)
{
//console.log(e)
switch
(
e
)
{
case
1
:
this
.
show
=
true
break
;
case
2
:
this
.
show__six
=
true
break
;
case
3
:
this
.
show__date
=
true
break
;
}
},
close
()
{
this
.
show
=
false
;
},
close__sex
()
{
this
.
show__six
=
false
;
},
close__date
()
{
this
.
show__date
=
false
;
},
select
()
{
let
that
=
this
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
}
})
}
});
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
]
},
// 请求头一定要加,否则 iOS 图片上传会失败
header
:
{
'content-type'
:
'multipart/form-data'
},
success
:
(
res
)
=>
{
let
uploadData
=
JSON
.
parse
(
res
.
data
)
let
opts
=
{
url
:
'/app/user/update'
,
method
:
'post'
};
let
userInfoItem
=
{
type
:
1
,
val
:
uploadData
.
data
.
fileName
};
that
.
http
.
httpTokenRequest
(
opts
,
userInfoItem
).
then
(
response
=>
{
if
(
response
.
data
.
code
==
200
)
{
that
.
$nextTick
(()
=>
{
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
()
{
let
opts
=
{
url
:
'/app/user/info'
,
method
:
'get'
};
this
.
http
.
httpTokenRequest
(
opts
,
{}).
then
(
res
=>
{
if
(
res
.
data
.
code
==
200
)
{
this
.
userInfo
=
res
.
data
.
data
this
.
image
=
this
.
http
.
baseUrl
+
this
.
userInfo
.
avatar
this
.
formData
.
forEach
(
element
=>
{
if
(
element
.
label
===
'手机号'
)
{
element
.
rules
.
value
=
this
.
userInfo
.
mobile
}
if
(
element
.
label
===
'昵称'
)
{
element
.
rules
.
value
=
this
.
userInfo
.
nickName
}
if
(
element
.
label
===
'性别'
)
{
element
.
rules
.
label
=
this
.
userInfo
.
sex
==
"0"
?
"男"
:
"女"
}
if
(
element
.
label
===
'生日'
)
{
element
.
rules
.
label
=
this
.
userInfo
.
birthday
}
})
}
})
},
editUserInfo
()
{
let
user
=
{}
for
(
let
i
in
this
.
formData
)
{
let
name
=
this
.
formData
[
i
].
rules
.
name
this
.
user
[
name
]
=
this
.
formData
[
i
].
rules
.
value
}
},
getUserInfo
(){
let
opts
=
{
url
:
'/app/user/info'
,
method
:
'get'
};
this
.
http
.
httpTokenRequest
(
opts
,
{}).
then
(
res
=>
{
if
(
res
.
data
.
code
==
200
)
{
this
.
userInfo
=
res
.
data
.
data
this
.
image
=
this
.
http
.
baseUrl
+
this
.
userInfo
.
avatar
this
.
formData
.
forEach
(
element
=>
{
if
(
element
.
label
===
'手机号'
)
{
element
.
rules
.
value
=
this
.
userInfo
.
mobile
}
if
(
element
.
label
===
'昵称'
)
{
element
.
rules
.
value
=
this
.
userInfo
.
nickName
}
if
(
element
.
label
===
'性别'
)
{
element
.
rules
.
label
=
this
.
userInfo
.
sex
==
"0"
?
"男"
:
"女"
}
if
(
element
.
label
===
'生日'
)
{
element
.
rules
.
label
=
this
.
userInfo
.
birthday
}
})
}
})
},
editUserInfo
(){
let
user
=
{}
for
(
let
i
in
this
.
formData
){
let
name
=
this
.
formData
[
i
].
rules
.
name
this
.
user
[
name
]
=
this
.
formData
[
i
].
rules
.
value
}
},
},
onShow
()
{
this
.
getUserInfo
()
this
.
getUserInfo
()
},
}
...
...
@@ -368,6 +403,11 @@ export default {
padding
:
40rpx
;
/
deep
/
.form-container
.line
.input
{
text-align
:
right
!
important
;
padding-right
:
20rpx
;
}
.info__cover
{
height
:
140rpx
;
background
:
#FFFFFF
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment