Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
html
/
wanda-ball
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
afdde5b8
authored
Jul 07, 2019
by
hank
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug
parent
d4c16422
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
146 additions
and
120 deletions
+146
-120
src/pages/user/Address.vue
+146
-120
No files found.
src/pages/user/Address.vue
View file @
afdde5b8
...
@@ -3,20 +3,21 @@
...
@@ -3,20 +3,21 @@
<group>
<group>
<x-input
title=
"姓 名:"
v-model=
"realName"
placeholder=
"姓名"
></x-input>
<x-input
title=
"姓 名:"
v-model=
"realName"
placeholder=
"姓名"
></x-input>
<x-input
title=
"手机号:"
is-type=
"china-mobile"
v-model=
"phoneNumber"
placeholder=
"11位手机号"
></x-input>
<x-input
title=
"手机号:"
is-type=
"china-mobile"
v-model=
"phoneNumber"
placeholder=
"11位手机号"
></x-input>
<cell
title=
"城市"
is-link
:value=
"area"
placeholder=
"您所在的城市"
value-align=
"left"
@
click
.
native=
"showPopupVisible"
>
<cell
<div
slot=
"title"
>
title=
"城市"
城
市:
is-link
</div>
:value=
"area"
placeholder=
"您所在的城市"
value-align=
"left"
@
click
.
native=
"showPopupVisible"
>
<div
slot=
"title"
>
城
市:
</div>
<div>
<div>
<span
v-if=
"!area"
style=
"color: #aab2bd"
>
您所在的城市
</span>
<span
v-if=
"!area"
style=
"color: #aab2bd"
>
您所在的城市
</span>
<span
v-else
style=
"color: black"
>
{{
area
}}
</span>
<span
v-else
style=
"color: black"
>
{{
area
}}
</span>
</div>
</div>
</cell>
</cell>
<x-textarea
<x-textarea
title=
"地 址:"
v-model=
"address"
placeholder=
"您的详细地址"
></x-textarea>
title=
"地 址:"
v-model=
"address"
placeholder=
"您的详细地址"
></x-textarea>
<!--
<x-input
title=
"摄协单位:"
v-model=
"company"
placeholder=
"摄协单位"
></x-input>
-->
<!--
<x-input
title=
"摄协单位:"
v-model=
"company"
placeholder=
"摄协单位"
></x-input>
-->
</group>
</group>
<div
class=
"textBox"
>
<div
class=
"textBox"
>
...
@@ -26,11 +27,7 @@
...
@@ -26,11 +27,7 @@
<p>
如因填写信息错误导致未能收到奖品,责任自负哦~
</p>
<p>
如因填写信息错误导致未能收到奖品,责任自负哦~
</p>
</div>
</div>
<div
class=
"save"
@
click=
"save"
>
保存
</div>
<div
class=
"save"
@
click=
"save"
>
保存
</div>
<popup
<popup
class=
"select"
v-model=
"popupVisible"
position=
"bottom"
>
class=
"select"
v-model=
"popupVisible"
position=
"bottom"
>
<div
class=
"noy"
>
<div
class=
"noy"
>
<p
class=
"no"
@
click=
"handleNot"
>
取消
</p>
<p
class=
"no"
@
click=
"handleNot"
>
取消
</p>
<p
class=
"yes"
@
click=
"handleYes"
>
确定
</p>
<p
class=
"yes"
@
click=
"handleYes"
>
确定
</p>
...
@@ -41,89 +38,102 @@
...
@@ -41,89 +38,102 @@
</
template
>
</
template
>
<
script
>
<
script
>
import
{
Group
,
XInput
,
XTextarea
,
Cell
}
from
'vux'
;
import
{
Group
,
XInput
,
XTextarea
,
Cell
}
from
"vux"
;
import
{
MessageBox
,
Toast
,
Picker
,
Popup
}
from
'mint-ui'
;
import
{
MessageBox
,
Toast
,
Picker
,
Popup
}
from
"mint-ui"
;
import
citys
from
'.//assets/city.js'
import
citys
from
".//assets/city.js"
;
import
axios
from
'axios'
;
import
axios
from
"axios"
;
import
{
clearTimeout
}
from
'timers'
;
import
{
clearTimeout
}
from
"timers"
;
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
realName
:
''
,
realName
:
""
,
phoneNumber
:
''
,
phoneNumber
:
""
,
address
:
''
,
address
:
""
,
company
:
''
,
company
:
""
,
userId
:
''
,
userId
:
""
,
alertOnoff
:
false
,
alertOnoff
:
false
,
area
:
''
,
area
:
""
,
popupVisible
:
false
,
popupVisible
:
false
,
slots
:
[
slots
:
[
{
{
flex
:
1
,
flex
:
1
,
defaultIndex
:
0
,
defaultIndex
:
0
,
values
:
[],
values
:
[],
className
:
'slot1'
,
className
:
"slot1"
,
textAlign
:
'center'
textAlign
:
"center"
},{
},
{
divider
:
true
,
divider
:
true
,
content
:
'-'
,
content
:
"-"
,
className
:
'slot2'
className
:
"slot2"
},
{
},
{
flex
:
1
,
flex
:
1
,
values
:
[],
values
:
[],
className
:
'slot3'
,
className
:
"slot3"
,
textAlign
:
'center'
textAlign
:
"center"
},{
},
{
divider
:
true
,
divider
:
true
,
content
:
'-'
,
content
:
"-"
,
className
:
'slot4'
className
:
"slot4"
},
{
},
{
flex
:
1
,
flex
:
1
,
values
:
[],
values
:
[],
className
:
'slot3'
,
className
:
"slot3"
,
textAlign
:
'center'
textAlign
:
"center"
}
}
],
],
addressTemp
:
[
'请选择'
,
'请选择'
,
'请选择'
],
addressTemp
:
[
"请选择"
,
"请选择"
,
"请选择"
],
address1
:
''
,
address1
:
""
};
};
},
},
mounted
()
{
var
modal
=
document
.
getElementsByClassName
(
"mint-popup"
)[
0
];
modal
.
addEventListener
(
"touchmove"
,
function
(
e
)
{
e
.
preventDefault
();
},
false
);
},
created
()
{
created
()
{
let
city
=
citys
.
provinceList
;
let
city
=
citys
.
provinceList
;
let
[
obj1
,
obj2
,
obj3
]
=
[[],[],
[]];
let
[
obj1
,
obj2
,
obj3
]
=
[[],
[],
[]];
for
(
let
i
=
0
;
i
<
city
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
city
.
length
;
i
++
)
{
let
obj
=
{
let
obj
=
{
name
:
city
[
i
].
name
,
name
:
city
[
i
].
name
,
id
:
city
[
i
].
id
,
id
:
city
[
i
].
id
,
childs
:
city
[
i
].
childs
childs
:
city
[
i
].
childs
}
};
// console.log(obj.childs)
// console.log(obj.childs)
obj1
[
i
]
=
obj
obj1
[
i
]
=
obj
;
}
}
obj2
=
obj1
[
0
].
childs
obj2
=
obj1
[
0
].
childs
;
obj3
=
obj2
[
0
].
childs
obj3
=
obj2
[
0
].
childs
;
console
.
log
(
obj1
[
0
].
childs
,
'obj1'
)
console
.
log
(
obj1
[
0
].
childs
,
"obj1"
);
this
.
obj2
=
obj1
[
0
].
childs
this
.
obj2
=
obj1
[
0
].
childs
;
console
.
log
(
this
.
obj2
,
'obj2'
)
console
.
log
(
this
.
obj2
,
"obj2"
);
this
.
obj3
=
obj2
[
0
].
childs
this
.
obj3
=
obj2
[
0
].
childs
;
console
.
log
(
obj3
,
'obj3'
)
console
.
log
(
obj3
,
"obj3"
);
// console.log(obj1, obj2, obj3, this.obj3)
// console.log(obj1, obj2, obj3, this.obj3)
this
.
slots
[
0
].
values
=
obj1
this
.
slots
[
0
].
values
=
obj1
;
this
.
slots
[
2
].
values
=
obj2
this
.
slots
[
2
].
values
=
obj2
;
this
.
slots
[
4
].
values
=
obj3
this
.
slots
[
4
].
values
=
obj3
;
// console.log(this.slots)
// console.log(this.slots)
this
.
hiddenBar
();
this
.
hiddenBar
();
this
.
getUserInfo
();
this
.
getUserInfo
();
},
},
activated
()
{
activated
()
{
this
.
getUserInfo
()
this
.
getUserInfo
();
},
},
methods
:
{
methods
:
{
getUserInfo
()
{
getUserInfo
()
{
axios
.
get
(
'/contest/user/info'
).
then
(
res
=>
{
axios
.
get
(
"/contest/user/info"
).
then
(
res
=>
{
// alert(JSON.stringify(res.data.data))
// alert(JSON.stringify(res.data.data))
this
.
realName
=
res
.
data
.
data
.
real_name
.
trim
();
this
.
realName
=
res
.
data
.
data
.
real_name
.
trim
();
this
.
phoneNumber
=
res
.
data
.
data
.
mobile
.
trim
();
this
.
phoneNumber
=
res
.
data
.
data
.
mobile
.
trim
();
...
@@ -131,93 +141,103 @@ export default {
...
@@ -131,93 +141,103 @@ export default {
this
.
area
=
res
.
data
.
data
.
area
.
trim
();
this
.
area
=
res
.
data
.
data
.
area
.
trim
();
this
.
userId
=
res
.
data
.
data
.
id
;
this
.
userId
=
res
.
data
.
data
.
id
;
this
.
company
=
res
.
data
.
data
.
company
.
trim
();
this
.
company
=
res
.
data
.
data
.
company
.
trim
();
});
});
},
},
getIndex
(
arr
,
key
,
value
)
{
getIndex
(
arr
,
key
,
value
)
{
// let arr = []
// let arr = []
var
children
=
[]
var
children
=
[];
var
index
var
index
;
for
(
let
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
let
obj
=
{
let
obj
=
{
name
:
arr
[
i
].
name
,
name
:
arr
[
i
].
name
,
id
:
arr
[
i
].
id
,
id
:
arr
[
i
].
id
,
childs
:
arr
[
i
].
childs
childs
:
arr
[
i
].
childs
}
};
// arr[i] = obj
// arr[i] = obj
if
(
arr
[
i
][
key
]
===
value
)
{
if
(
arr
[
i
][
key
]
===
value
)
{
index
=
i
index
=
i
;
children
=
arr
[
i
].
children
children
=
arr
[
i
].
children
;
}
}
}
}
return
index
return
index
;
},
},
onValuesChange
(
p
,
v
)
{
onValuesChange
(
p
,
v
)
{
this
.
Picker
=
p
this
.
Picker
=
p
;
// if(this.area) {
// if(this.area) {
// p.setValues(this.address)
// p.setValues(this.address)
// }
// }
console
.
log
(
v
)
console
.
log
(
v
);
if
(
v
[
0
])
{
if
(
v
[
0
])
{
p
.
setSlotValues
(
1
,
v
[
0
].
childs
)
p
.
setSlotValues
(
1
,
v
[
0
].
childs
);
}
}
if
(
v
[
1
])
{
if
(
v
[
1
])
{
p
.
setSlotValues
(
2
,
v
[
1
].
childs
)
p
.
setSlotValues
(
2
,
v
[
1
].
childs
);
}
}
this
.
address3
=
v
this
.
address3
=
v
;
},
},
showPopupVisible
()
{
showPopupVisible
()
{
if
(
this
.
area
)
{
if
(
this
.
area
)
{
this
.
addressTemp
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
area
)).
split
(
'-'
)
this
.
addressTemp
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
area
)).
split
(
"-"
);
let
index
,
index2
,
index3
let
index
,
index2
,
index3
;
index
=
this
.
getIndex
(
citys
.
provinceList
,
'name'
,
this
.
addressTemp
[
0
])
index
=
this
.
getIndex
(
citys
.
provinceList
,
"name"
,
this
.
addressTemp
[
0
]);
index2
=
this
.
getIndex
(
citys
.
provinceList
[
index
].
childs
,
'name'
,
this
.
addressTemp
[
1
])
index2
=
this
.
getIndex
(
index3
=
this
.
getIndex
(
citys
.
provinceList
[
index
].
childs
[
index2
].
childs
,
'name'
,
this
.
addressTemp
[
2
])
citys
.
provinceList
[
index
].
childs
,
console
.
log
(
index
,
index2
,
index3
,
citys
.
provinceList
[
index
].
childs
[
index2
].
childs
,
'aaaa'
)
"name"
,
this
.
slots
[
0
].
defaultIndex
=
index
this
.
addressTemp
[
1
]
this
.
slots
[
2
].
defaultIndex
=
index2
);
this
.
slots
[
4
].
defaultIndex
=
index3
index3
=
this
.
getIndex
(
citys
.
provinceList
[
index
].
childs
[
index2
].
childs
,
"name"
,
this
.
addressTemp
[
2
]
);
console
.
log
(
index
,
index2
,
index3
,
citys
.
provinceList
[
index
].
childs
[
index2
].
childs
,
"aaaa"
);
this
.
slots
[
0
].
defaultIndex
=
index
;
this
.
slots
[
2
].
defaultIndex
=
index2
;
this
.
slots
[
4
].
defaultIndex
=
index3
;
}
}
this
.
popupVisible
=
true
;
this
.
popupVisible
=
true
;
},
},
handleNot
()
{
handleNot
()
{
this
.
popupVisible
=
false
;
this
.
popupVisible
=
false
;
},
},
//确认
//确认
handleYes
()
{
handleYes
()
{
this
.
address3
=
this
.
address3
.
map
(
item
=>
{
this
.
address3
=
this
.
address3
.
map
(
item
=>
{
return
item
.
name
return
item
.
name
;
})
});
if
(
this
.
address3
.
length
&&
this
.
address3
.
includes
(
'请选择'
))
{
if
(
this
.
address3
.
length
&&
this
.
address3
.
includes
(
"请选择"
))
{
return
return
;
}
}
if
(
this
.
address3
.
join
(
'-'
)
!==
''
&&
this
.
address3
.
join
(
'-'
)
!==
'--'
)
{
if
(
this
.
address3
.
join
(
"-"
)
!==
""
&&
this
.
address3
.
join
(
"-"
)
!==
"--"
)
{
this
.
area
=
this
.
address3
.
join
(
'-'
)
this
.
area
=
this
.
address3
.
join
(
"-"
);
}
}
this
.
popupVisible
=
false
;
this
.
popupVisible
=
false
;
},
},
save
()
{
save
()
{
if
(
!
this
.
realName
.
trim
())
{
if
(
!
this
.
realName
.
trim
())
{
Toast
({
message
:
'姓名必须填写'
});
Toast
({
message
:
"姓名必须填写"
});
return
return
;
}
}
if
(
!
this
.
phoneNumber
.
trim
())
{
if
(
!
this
.
phoneNumber
.
trim
())
{
Toast
({
message
:
'手机号码必须填写'
});
Toast
({
message
:
"手机号码必须填写"
});
return
return
;
}
}
if
(
!
this
.
area
.
trim
())
{
if
(
!
this
.
area
.
trim
())
{
Toast
({
message
:
'所在城市必须填写'
});
Toast
({
message
:
"所在城市必须填写"
});
return
return
;
}
}
axios
axios
.
post
(
'/contest/user/save'
,
{
.
post
(
"/contest/user/save"
,
{
address
:
this
.
address
.
trim
(),
address
:
this
.
address
.
trim
(),
area
:
this
.
area
.
trim
(),
area
:
this
.
area
.
trim
(),
real_name
:
this
.
realName
.
trim
(),
real_name
:
this
.
realName
.
trim
(),
...
@@ -228,44 +248,50 @@ export default {
...
@@ -228,44 +248,50 @@ export default {
.
then
(
res
=>
{
.
then
(
res
=>
{
console
.
log
(
res
);
console
.
log
(
res
);
if
(
res
.
data
.
code
===
0
)
{
if
(
res
.
data
.
code
===
0
)
{
Toast
({
message
:
'保存成功'
});
Toast
({
message
:
"保存成功"
});
setTimeout
(()
=>
{
setTimeout
(()
=>
{
if
(
location
.
href
.
includes
(
'isIndex'
))
{
if
(
location
.
href
.
includes
(
"isIndex"
))
{
window
.
wx
.
miniProgram
.
getEnv
((
res
)
=>
{
window
.
wx
.
miniProgram
.
getEnv
(
res
=>
{
if
(
res
.
miniprogram
)
{
if
(
res
.
miniprogram
)
{
window
.
wx
.
miniProgram
.
navigateTo
({
url
:
'/pages/upload/upload'
})
window
.
wx
.
miniProgram
.
navigateTo
({
url
:
"/pages/upload/upload"
});
}
else
{
}
else
{
this
.
$router
.
push
({
path
:
'/imgup'
});
this
.
$router
.
push
({
path
:
"/imgup"
});
}
}
})
});
}
else
{
}
else
{
this
.
$router
.
push
({
path
:
'/'
});
this
.
$router
.
push
({
path
:
"/"
});
}
}
},
500
);
},
500
);
}
else
{
}
else
{
Toast
({
message
:
'保存失败'
});
Toast
({
message
:
"保存失败"
});
}
}
}).
catch
((
err
)
=>
{
})
.
catch
(
err
=>
{
console
.
log
(
err
);
console
.
log
(
err
);
Toast
({
message
:
err
.
response
.
data
.
msg
});
Toast
({
message
:
err
.
response
.
data
.
msg
});
});
});
},
},
hiddenBar
()
{
hiddenBar
()
{
document
.
addEventListener
(
"WeixinJSBridgeReady"
,
function
onBridgeReady
()
{
document
.
addEventListener
(
"WeixinJSBridgeReady"
,
function
onBridgeReady
()
{
WeixinJSBridge
.
call
(
"hideToolbar"
);
// 隐藏底部状态栏
WeixinJSBridge
.
call
(
"hideToolbar"
);
// 隐藏底部状态栏
// WeixinJSBridge.call("hideOptionMenu"); // 隐藏右上角的三个点的选项
// WeixinJSBridge.call("hideOptionMenu"); // 隐藏右上角的三个点的选项
// WeixinJSBridge.call("showToolbar"); // 显示底部状态栏
// WeixinJSBridge.call("showToolbar"); // 显示底部状态栏
// WeixinJSBridge.call("showOptionMenu"); // 显示右上角的三个点的选项
// WeixinJSBridge.call("showOptionMenu"); // 显示右上角的三个点的选项
});
}
},
);
}
},
},
components
:
{
components
:
{
Group
,
Group
,
XInput
,
XInput
,
XTextarea
,
XTextarea
,
Cell
,
Cell
,
Picker
,
Popup
Picker
,
Popup
}
}
};
};
</
script
>
</
script
>
...
@@ -274,18 +300,18 @@ export default {
...
@@ -274,18 +300,18 @@ export default {
//
@import
'~vux/src/styles/reset.less'
;
//
@import
'~vux/src/styles/reset.less'
;
.mainWrap
{
.mainWrap
{
.picker
{
.picker
{
width
:
100vw
;
width
:
100vw
;
}
}
.noy
{
.noy
{
display
:
flex
;
display
:
flex
;
justify-content
:
space-between
;
justify-content
:
space-between
;
box-sizing
:
border-box
;
box-sizing
:
border-box
;
padding
:
.28rem
10vw
;
padding
:
0
.28rem
10vw
;
font-size
:
0.5rem
;
font-size
:
0.5rem
;
.no
{
}
.no
{
}
.yes
{
.yes
{
}
}
}
}
background
:
#f5f5f5
;
background
:
#f5f5f5
;
...
...
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