Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mayi-mp-shop
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
程默
mayi-mp-shop
Commits
b0a49ca0
Commit
b0a49ca0
authored
May 18, 2023
by
李嘉林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化
parent
a3d88967
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
120 additions
and
10 deletions
+120
-10
src/api/login.js
+7
-0
src/components/login/loginBox.vue
+105
-6
src/components/restaurantList/index.vue
+7
-3
src/utils/index.js
+1
-1
No files found.
src/api/login.js
View file @
b0a49ca0
...
...
@@ -39,5 +39,11 @@ console.log(process.env,'-----------------config------')
getLogin
(
data
)
{
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/login`
,
data
)
},
validatePhone
(
data
)
{
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/validate_phone?mobilephone=
${
data
.
mobilephone
}
`
)
},
verifycode
(
data
)
{
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/common/send_mb_code`
,
data
)
},
}
\ No newline at end of file
src/components/login/loginBox.vue
View file @
b0a49ca0
...
...
@@ -15,11 +15,11 @@
class=
"btn"
lang=
"zh_CN"
@
click=
"getUserProfile"
v-if=
"wxLoginFlag && !phoneLoginFlag"
v-if=
"wxLoginFlag && !phoneLoginFlag
&& !codeLoginFlag
"
>
微信一键登录
</div>
<div
class=
"phoneLogin"
v-if=
"phoneLoginFlag"
:style=
"
{background: phoneLoginBackground}">
<div
class=
"phoneLogin"
v-if=
"phoneLoginFlag
|| codeLoginFlag
"
:style=
"
{background: phoneLoginBackground}">
<div
class=
"phoneLabel flex"
>
<span
:style=
"
{
...
...
@@ -34,7 +34,7 @@
:placeholder=
"phoneInputPlaceholder"
/>
</div>
<div
class=
"passLabel flex"
>
<div
class=
"passLabel flex"
v-if=
"phoneLoginFlag"
>
<span
:style=
"
{
'font-size': labelStyleType == 1 ? customLabelSize + 'px' : '',
...
...
@@ -56,6 +56,22 @@
忘记密码
</div>
</div>
<!-- 验证码 -->
<div
class=
"passLabel codeLabel flex"
v-if=
"codeLoginFlag"
>
<span
:style=
"
{
'font-size': labelStyleType == 1 ? customLabelSize + 'px' : '',
'color': labelStyleType == 1 ? customLabelColor : ''
}"
>验证码
</span
>
<input
type=
"password"
v-model=
"loginMsg.verifycode"
:placeholder=
"'请输入短信验证码'"
/>
<div
class=
"getCode"
:style=
"
{'background':codeLoginFlagBackground || '#de001a'}" :disabled="true" :class="{'disabledBtn':sendCode.disabled}" @click="settime">
{{
sendCode
.
value
}}
</div>
</div>
<div
class=
"loginIn flex"
>
<div
class=
"loginBtn flex"
...
...
@@ -72,7 +88,7 @@
</div>
<div
class=
"wxLogin"
v-if=
"
phoneLoginFlag
&& wxLoginFlag"
v-if=
"
(phoneLoginFlag || codeLoginFlag)
&& wxLoginFlag"
@
click=
"getUserProfile"
>
微信一键登录
...
...
@@ -84,6 +100,7 @@
</
template
>
<
script
type=
"text/ecmascript-6"
>
import
login
from
"@/api/login"
export
default
{
name
:
"loginBox"
,
props
:
{
...
...
@@ -114,7 +131,15 @@ export default {
account
:
""
,
password
:
""
,
loginType
:
0
,
verifycode
:
""
,
},
verifycodeMsg
:
{},
sendCode
:
{
value
:
"获取验证码"
,
disabled
:
false
,
},
countdown
:
60
,
timer
:
null
,
};
},
components
:
{},
...
...
@@ -125,6 +150,9 @@ export default {
phoneLoginFlag
()
{
return
this
.
datas
.
componentData
.
phoneLoginFlag
;
},
codeLoginFlag
()
{
return
this
.
datas
.
componentData
.
codeLoginFlag
;
},
forgetPasswordType
()
{
return
this
.
datas
.
componentData
.
forgetPasswordType
;
},
...
...
@@ -158,6 +186,9 @@ export default {
phoneLoginBackground
()
{
return
this
.
datas
.
componentData
.
phoneLoginBackground
||
'#fff'
;
},
codeLoginFlagBackground
()
{
return
this
.
datas
.
componentData
.
codeLoginFlagBackground
||
'#333'
;
},
labelStyleType
()
{
return
this
.
datas
.
componentData
.
labelStyleType
;
},
...
...
@@ -183,6 +214,54 @@ export default {
created
()
{},
mounted
()
{},
methods
:
{
settime
()
{
if
(
this
.
sendCode
.
disabled
)
return
;
if
(
this
.
loginMsg
.
account
==
""
)
{
return
wx
.
showToast
({
title
:
'请输入手机号码'
,
icon
:
"none"
});
}
else
{
//判断手机号是否被注册
let
mobilephone
=
this
.
loginMsg
.
account
;
login
.
validatePhone
({
mobilephone
}).
then
(
res
=>
{
console
.
log
(
res
,
"123"
);
if
(
res
.
data
.
code
==
200
)
{
return
wx
.
showToast
({
title
:
'当前手机号未被注册!'
,
icon
:
"none"
});
}
else
{
this
.
sendCode
.
disabled
=
true
;
// 发送验证码
this
.
verifycodeMsg
.
mobilephone
=
this
.
loginMsg
.
account
;
this
.
verifycodeMsg
.
sendType
=
2
;
login
.
verifycode
(
this
.
verifycodeMsg
).
then
(
res
=>
{
console
.
log
(
res
,
"456"
);
if
(
res
.
data
.
code
==
-
1
)
{
this
.
sendCode
.
disabled
=
false
;
return
wx
.
showToast
({
title
:
res
.
data
.
msg
,
icon
:
"none"
});
}
else
{
this
.
timer
=
setInterval
(()
=>
{
if
(
this
.
countdown
>
1
)
{
this
.
sendCode
.
value
=
"重新发送("
+
this
.
countdown
+
")"
;
this
.
countdown
--
;
}
else
{
this
.
countdown
=
60
;
this
.
sendCode
.
value
=
"获取验证码"
;
clearInterval
(
this
.
timer
);
return
;
}
},
1000
);
}
});
}
});
}
},
getUserProfile
()
{
if
(
!
this
.
render
)
return
;
this
.
$emit
(
"getUserProfile"
);
...
...
@@ -201,7 +280,9 @@ export default {
},
loginIn
()
{
if
(
!
this
.
render
)
return
;
this
.
$emit
(
"loginIn"
,
this
.
loginMsg
);
this
.
loginMsg
.
loginType
=
this
.
phoneLoginFlag
?
0
:
1
;
// 0密码登录 1验证码登录
this
.
$emit
(
"loginIn"
,
{
val
:
this
.
loginMsg
,
type
:
this
.
phoneLoginFlag
?
0
:
1
});
},
forgetPassword
()
{
if
(
!
this
.
render
)
return
;
...
...
@@ -216,6 +297,7 @@ input {
background
:
none
;
outline
:
none
;
border
:
none
;
font-size
:
14px
;
}
.loginBox
{
.toCLogin
{
...
...
@@ -264,9 +346,9 @@ input {
color
:
#333
;
font-size
:
16px
;
flex-shrink
:
0
;
width
:
58px
;
}
input
{
margin-left
:
30px
;
width
:
44%
;
}
}
...
...
@@ -307,4 +389,21 @@ input {
}
}
}
.codeLabel
{
}
.getCode
{
flex-shrink
:
0
;
margin-left
:
16px
;
padding
:
0
10px
;
background
:
#de001a
;
border-radius
:
30px
;
border-radius
:
21px
;
height
:
30px
;
color
:
#fff
;
font-size
:
12px
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
}
</
style
>
src/components/restaurantList/index.vue
View file @
b0a49ca0
...
...
@@ -44,6 +44,7 @@
<
script
>
const
app
=
getApp
()
import
goods
from
"@/api/goods.js"
import
{
DFSImg
}
from
"@/utils/index"
;
export
default
{
name
:
"restaurant-list"
,
props
:
{
...
...
@@ -63,7 +64,7 @@ export default {
restaurantLabel
:
""
,
restaurantLogo
:
""
,
restaurantName
:
""
,
}
}
,
}
},
components
:
{},
...
...
@@ -78,7 +79,9 @@ export default {
return
provinceName
+
cityName
+
areaName
+
address
}
},
created
()
{
},
created
()
{
this
.
DFSImg
=
app
.
DFSImg
;
},
onLoad
(
options
)
{
// console.log(options,'商家推荐options')
console
.
log
(
"当前的地址"
,
wx
.
getStorageSync
(
'location'
));
...
...
@@ -97,7 +100,8 @@ export default {
if
(
res
.
data
.
code
==
200
&&
res
.
data
.
data
)
{
_this
.
showList
=
true
;
_this
.
sourceData
=
res
.
data
.
data
;
console
.
log
(
_this
.
sourceData
,
"商家数据"
);
_this
.
sourceData
.
restaurantLogo
=
DFSImg
(
res
.
data
.
data
.
restaurantLogo
);
console
.
log
(
_this
.
sourceData
,
DFSImg
(
res
.
data
.
data
.
restaurantLogo
),
"商家数据"
);
}
else
{
_this
.
showList
=
false
;
// wx.showToast({
...
...
src/utils/index.js
View file @
b0a49ca0
...
...
@@ -118,7 +118,7 @@ export function DFSImg(path, w, h, type = 0) { //
path
+=
'.'
+
w
+
'x'
+
h
+
'.jpg'
;
}
return
baseImg
[
Math
.
floor
(
Math
.
random
()
*
100
)
%
baseImg
.
length
]
+
path
;
return
baseImg
+
path
;
}
}
// 获取Navbar高度
...
...
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