Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
杨炀
/
ztx_wx_admin
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
023f830b
authored
2023-10-08 19:27:13 +0800
by
华明祺
1
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
登录
1 parent
79cf495e
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
390 additions
and
326 deletions
App.vue
common/login.js
common/request.js
config.js
pages/index/login.vue
pages/index/order.vue
App.vue
View file @
023f830
<
script
>
import
*
as
loginServer
from
'@/common/login.js'
;
import
*
as
api
from
'@/common/api.js'
;
import
config
from
'@/config.js'
;
import
{
h5Login
}
from
'@/common/login.js'
;
import
*
as
api
from
'@/common/api.js'
;
import
config
from
'@/config.js'
;
let
firstload
=
false
export
default
{
onLaunch
:
function
(
)
{
console
.
log
(
'App Launch'
);
let
loginUrl
=
[
'pages/index/login'
,
'pages/index/register'
]
let
firstload
=
false
export
default
{
onLaunch
:
function
(
options
)
{
console
.
log
(
'App Launch'
,
options
);
firstload
=
true
this
.
globalData
.
baseUrl
=
config
.
baseUrl
;
this
.
globalData
.
baseUrl_api
=
config
.
baseUrl_api
;
this
.
globalData
.
fileUrl
=
config
.
fileUrl
;
new
Promise
((
resolve
,
reject
)
=>
{
uni
.
checkSession
({
success
:
res
=>
{
loginServer
.
getCurrUser
(
true
)
.
catch
(()
=>
{
return
loginServer
.
pcLogin
();
})
.
then
(
user
=>
{
resolve
(
user
);
});
},
fail
:
res
=>
{
loginServer
.
wxLogin
()
.
then
(
loginRes
=>
{
return
loginServer
.
pcLogin
(
loginRes
.
code
);
})
.
then
(
user
=>
{
resolve
(
user
);
});
}
});
})
.
then
(()
=>
{
return
loginServer
.
getNowOpenId
()
})
.
then
(()
=>
{
return
loginServer
.
initData
()
// console.log(22222222)
// const currUser = uni.getStorageSync('currUser');
// // console.log(currUser)
// return Promise.all([api.getVenue(), api.getOwnMemberInfo()]).then(res => {
// let ven = res[0].data;
// let men = res[1]?.data;
// if (ven.venuePic) {
// ven.venuePicArr = ven.venuePic.split(',');
// }
// if (ven.businessPeriod) {
// ven.startBus = ven.businessPeriod.split(',')[0];
// ven.endBus = ven.businessPeriod.split(',')[1];
// }
// ven.latitude = ven.lal.split(',')[0];
// ven.longitude = ven.lal.split(',')[1];
// this.globalData.venue = ven;
// this.globalData.isVip = men?.isVip;
// // this.globalData.relateProjectId = men.info.relateProjectId;
// this.globalData.relateProjectIdList = men?.info?.relateProjectIdList;
// this.globalData.relateVenueProjectIdList = men?.info?.relateVenueProjectIdList;
this
.
globalData
.
baseUrl_api
=
config
.
baseUrl_api
;
// this.globalData.venueConfig = {
// normalOverDay: ven.resSiteConfig?.normalOrderNum,
// normalPeriodStart: ven.resSiteConfig?.normalOrderPeriod.split(',')[0],
// normalPeriodEnd: ven.resSiteConfig?.normalOrderPeriod.split(',')[1]
// };
// if (men?.isVip) {
// this.globalData.venueConfig.memberOverDay = ven.resSiteConfig?.memberOrderNum;
// this.globalData.venueConfig.memberPeriodStart = ven.resSiteConfig?.memberOrderPeriod.split(',')[0];
// this.globalData.venueConfig.memberPeriodEnd = ven.resSiteConfig?.memberOrderPeriod.split(',')[1];
// }
// });
})
if
(
loginUrl
.
indexOf
(
options
.
path
)
==-
1
){
let
userName
=
uni
.
getStorageSync
(
'userName'
)
if
(
userName
)
{
h5Login
(
userName
)
.
then
(()
=>
{
this
.
globalData
.
isLogin
=
true
;
let
firstLoadCallback
=
getApp
().
firstLoadCallback
;
if
(
firstLoadCallback
)
{
firstLoadCallback
();
}
});
},
onShow
:
function
()
{
console
.
log
(
'App Show'
);
// loginServer.getNowOpenId()
if
(
!
firstload
)
{
loginServer
.
getCurrUser
(
true
)
})
.
catch
(()
=>
{
return
loginServer
.
pcLogin
().
then
(()
=>
{
uni
.
redirectTo
({
url
:
getCurrentPages
()[
getCurrentPages
().
length
-
1
].
$page
.
fullPath
url
:
'/pages/index/login'
})
});
})
}
else
{
this
.
globalData
.
isLogin
=
false
;
uni
.
redirectTo
({
url
:
'/pages/index/login'
})
}
}
},
onShow
:
function
()
{
console
.
log
(
'App Show'
);
},
onHide
:
function
()
{
console
.
log
(
'App Hide'
);
}
};
};
</
script
>
<
style
lang=
"scss"
>
...
...
common/login.js
View file @
023f830
import
request
from
'./request'
import
*
as
api
from
'@/common/api.js'
;
import
*
as
api
from
'@/common/api.js'
let
appId
=
''
// #ifdef MP
const
accountInfo
=
uni
.
getAccountInfoSync
()
const
appId
=
accountInfo
.
miniProgram
.
appId
;
appId
=
accountInfo
.
miniProgram
.
appId
// #endif
function
wxLogin
()
{
...
...
@@ -22,81 +22,59 @@ function wxLogin() {
})
}
function
pcLogin
(
code
)
{
if
(
code
)
{
return
pcLoginByCode
(
code
)
}
else
{
const
currUser
=
uni
.
getStorageSync
(
'currUser'
)
||
{}
if
(
currUser
.
openId
)
{
return
pcLoginByOpenId
(
currUser
.
openId
);
}
else
{
return
wxLogin
().
then
((
loginRes
)
=>
{
return
pcLoginByCode
(
loginRes
.
code
)
function
pcLogin
(
data
)
{
return
request
({
url
:
'/login'
,
method
:
'post'
,
params
:
data
}).
then
((
res
)
=>
{
uni
.
setStorageSync
(
'userName'
,
data
.
username
)
uni
.
setStorageSync
(
'token'
,
'Bearer '
+
res
.
data
.
token
)
})
}
}
}
function
pcLoginByOpenId
(
openId
)
{
function
h5Login
(
userName
)
{
return
request
({
url
:
"/system/wx/loginByOpenId"
,
method
:
"POST"
,
url
:
`/h5Login`
,
method
:
'post'
,
params
:
{
appId
:
appId
,
openId
:
openId
username
:
userName
}
}).
then
((
res
)
=>
{
let
user
=
res
.
data
;
// console.log("openId " + openId, user)
uni
.
setStorageSync
(
'token'
,
'Bearer '
+
user
.
token
);
uni
.
setStorageSync
(
'currUser'
,
user
);
return
user
;
}).
catch
(()
=>
{
uni
.
removeStorageSync
(
'currUser'
)
uni
.
setStorageSync
(
'token'
,
'Bearer '
+
res
.
data
.
token
)
})
}
function
pcLoginByCode
(
code
)
{
return
request
({
// url: "/weixin/api/login",
url
:
"/system/wx/loginByJsCode"
,
method
:
"POST"
,
params
:
{
appId
:
appId
,
jsCode
:
code
}
}).
then
((
res
)
=>
{
let
user
=
res
.
data
// console.log("code: " + code, user)
// getNowOpenId()
uni
.
setStorageSync
(
'token'
,
'Bearer '
+
user
.
token
);
uni
.
setStorageSync
(
'currUser'
,
user
);
return
user
;
}).
catch
((
err
)
=>
{
uni
.
removeStorageSync
(
'currUser'
)
function
h5LoginAuto
()
{
const
userName
=
uni
.
getStorageSync
(
'userName'
)
if
(
userName
)
{
return
h5Login
(
userName
)
}
else
{
uni
.
redirectTo
({
url
:
'/pages/index/login'
})
}
}
function
getCurrUser
(
isAuto
)
{
return
request
({
url
:
"/system/wx/getUserInfo"
,
method
:
"GET"
,
url
:
'/system/wx/getUserInfo'
,
method
:
'GET'
,
opts
:
{
isAuto
:
isAuto
}
}).
then
((
res
)
=>
{
let
user
=
res
.
data
;
uni
.
setStorageSync
(
'currUser'
,
user
);
const
user
=
res
.
data
uni
.
setStorageSync
(
'currUser'
,
user
)
return
user
})
}
function
getWxUser
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
currUser
=
uni
.
getStorageSync
(
'currUser'
);
const
currUser
=
uni
.
getStorageSync
(
'currUser'
)
// getNowOpenId()
const
nowOpenId
=
uni
.
getStorageSync
(
'nowOpenId'
);
const
nowOpenId
=
uni
.
getStorageSync
(
'nowOpenId'
)
uni
.
getUserProfile
({
desc
:
'用于完善用户信息'
,
success
:
function
(
infoRes
)
{
...
...
@@ -104,7 +82,7 @@ function getWxUser() {
request
({
url
:
`/system/wx/updateWxUser?openId=
${
nowOpenId
}
`
,
method
:
"POST"
,
method
:
'POST'
,
params
:
{
appId
:
appId
,
openId
:
nowOpenId
,
...
...
@@ -116,9 +94,9 @@ function getWxUser() {
signature
:
infoRes
.
signature
}
}).
then
((
res
)
=>
{
let
user
=
res
.
data
;
uni
.
setStorageSync
(
'currUser'
,
user
);
resolve
(
user
);
const
user
=
res
.
data
uni
.
setStorageSync
(
'currUser'
,
user
)
resolve
(
user
)
}).
catch
(()
=>
{
reject
()
})
...
...
@@ -126,19 +104,19 @@ function getWxUser() {
fail
:
(
res
)
=>
{
reject
(
res
)
}
});
});
})
})
}
function
getWxUserPhone
(
phoneRes
)
{
// console.log(phoneRes)
const
currUser
=
uni
.
getStorageSync
(
'currUser'
);
const
currUser
=
uni
.
getStorageSync
(
'currUser'
)
// getNowOpenId()
const
nowOpenId
=
uni
.
getStorageSync
(
'nowOpenId'
);
const
nowOpenId
=
uni
.
getStorageSync
(
'nowOpenId'
)
return
request
({
url
:
`/system/wx/updateMobile?openId=
${
nowOpenId
}
`
,
method
:
"POST"
,
method
:
'POST'
,
params
:
{
appId
:
appId
,
userId
:
currUser
.
id
,
...
...
@@ -149,10 +127,10 @@ function getWxUserPhone(phoneRes) {
signature
:
phoneRes
.
signature
}
}).
then
((
res
)
=>
{
let
user
=
res
.
data
;
const
user
=
res
.
data
// uni.setStorageSync('token', 'Bearer '+ user.token);
uni
.
setStorageSync
(
'token'
,
user
.
token
);
uni
.
setStorageSync
(
'currUser'
,
user
);
uni
.
setStorageSync
(
'token'
,
user
.
token
)
uni
.
setStorageSync
(
'currUser'
,
user
)
return
user
})
}
...
...
@@ -166,7 +144,7 @@ function checkUserAuth(path) {
uni
.
navigateTo
({
url
:
'/pages/index/start?path='
+
encodeURIComponent
(
path
)
})
return
false
;
return
false
}
}
...
...
@@ -183,41 +161,48 @@ function getNowOpenId() {
function
initData
()
{
console
.
log
(
'initData'
)
const
currUser
=
uni
.
getStorageSync
(
'currUser'
);
// const currUser = uni.getStorageSync('currUser')
// console.log(currUser)
return
Promise
.
all
([
api
.
getVenue
(),
api
.
getOwnMemberInfo
()]).
then
(
res
=>
{
let
ven
=
res
[
0
].
data
;
let
men
=
res
[
1
]?.
data
;
const
ven
=
res
[
0
].
data
const
men
=
res
[
1
]?.
data
const
app
=
getApp
();
const
app
=
getApp
()
if
(
ven
.
venuePic
)
{
ven
.
venuePicArr
=
ven
.
venuePic
.
split
(
','
);
ven
.
venuePicArr
=
ven
.
venuePic
.
split
(
','
)
}
if
(
ven
.
businessPeriod
)
{
ven
.
startBus
=
ven
.
businessPeriod
.
split
(
','
)[
0
];
ven
.
endBus
=
ven
.
businessPeriod
.
split
(
','
)[
1
];
ven
.
startBus
=
ven
.
businessPeriod
.
split
(
','
)[
0
]
ven
.
endBus
=
ven
.
businessPeriod
.
split
(
','
)[
1
]
}
ven
.
latitude
=
ven
.
lal
.
split
(
','
)[
0
];
ven
.
longitude
=
ven
.
lal
.
split
(
','
)[
1
];
ven
.
latitude
=
ven
.
lal
.
split
(
','
)[
0
]
ven
.
longitude
=
ven
.
lal
.
split
(
','
)[
1
]
app
.
globalData
.
venue
=
ven
;
app
.
globalData
.
isVip
=
men
?.
isVip
;
app
.
globalData
.
venue
=
ven
app
.
globalData
.
isVip
=
men
?.
isVip
// app.globalData.relateProjectId = men.info.relateProjectId;
app
.
globalData
.
relateProjectIdList
=
men
?.
info
?.
relateProjectIdList
;
app
.
globalData
.
relateVenueProjectIdList
=
men
?.
info
?.
relateVenueProjectIdList
;
app
.
globalData
.
relateProjectIdList
=
men
?.
info
?.
relateProjectIdList
app
.
globalData
.
relateVenueProjectIdList
=
men
?.
info
?.
relateVenueProjectIdList
app
.
globalData
.
venueConfig
=
{
normalOverDay
:
ven
.
resSiteConfig
?.
normalOrderNum
,
normalPeriodStart
:
ven
.
resSiteConfig
?.
normalOrderPeriod
.
split
(
','
)[
0
],
normalPeriodEnd
:
ven
.
resSiteConfig
?.
normalOrderPeriod
.
split
(
','
)[
1
]
};
}
if
(
men
?.
isVip
)
{
app
.
globalData
.
venueConfig
.
memberOverDay
=
ven
.
resSiteConfig
?.
memberOrderNum
;
app
.
globalData
.
venueConfig
.
memberPeriodStart
=
ven
.
resSiteConfig
?.
memberOrderPeriod
.
split
(
','
)[
0
];
app
.
globalData
.
venueConfig
.
memberPeriodEnd
=
ven
.
resSiteConfig
?.
memberOrderPeriod
.
split
(
','
)[
1
];
app
.
globalData
.
venueConfig
.
memberOverDay
=
ven
.
resSiteConfig
?.
memberOrderNum
app
.
globalData
.
venueConfig
.
memberPeriodStart
=
ven
.
resSiteConfig
?.
memberOrderPeriod
.
split
(
','
)[
0
]
app
.
globalData
.
venueConfig
.
memberPeriodEnd
=
ven
.
resSiteConfig
?.
memberOrderPeriod
.
split
(
','
)[
1
]
}
});
})
}
function
getCodeImg
()
{
return
request
({
url
:
'/captchaImage'
,
method
:
'get'
})
}
export
{
...
...
@@ -228,5 +213,8 @@ export {
getWxUser
,
getWxUserPhone
,
checkUserAuth
,
initData
initData
,
getCodeImg
,
h5Login
,
h5LoginAuto
}
...
...
common/request.js
View file @
023f830
import
config
from
'@/config.js'
import
{
pcLogin
,
getNowOpenId
,
initData
h5LoginAuto
}
from
'./login'
const
excludeUrls
=
[
'
/system/wx/getUserInfo
'
]
const
excludeUrls
=
[
'
pages/index/login'
,
'pages/index/register
'
]
// 获取Token
function
getToken
()
{
try
{
const
token
=
uni
.
getStorageSync
(
'token'
);
const
token
=
uni
.
getStorageSync
(
'token'
)
if
(
token
)
{
return
token
}
else
{
...
...
@@ -23,22 +21,22 @@ function getToken() {
// 获取请求头
function
getHeaders
()
{
le
t
token
=
getToken
()
le
t
header
=
{
"Authorization"
:
token
,
"Content-Type"
:
"application/json"
,
//
根据自己的数据类型
cons
t
token
=
getToken
()
cons
t
header
=
{
'Authorization'
:
token
,
'Content-Type'
:
'application/json'
//
根据自己的数据类型
// "Content-Type":"application/x-www-form-urlencoded",
}
return
header
}
le
t
request
=
function
(
req
)
{
cons
t
request
=
function
(
req
)
{
req
.
method
=
req
.
method
.
toUpperCase
()
if
(
!
[
'GET'
,
'POST'
,
'PUT'
,
'DELETE'
].
includes
(
req
.
method
))
{
if
(
!
[
'GET'
,
'POST'
,
'PUT'
,
'DELETE'
].
includes
(
req
.
method
))
{
uni
.
showToast
({
title
:
`暂不支持的请求方式:
${
req
.
method
}
`
,
icon
:
'none'
});
})
return
}
...
...
@@ -53,36 +51,14 @@ let request = function(req) {
url
:
config
.
baseUrl_api
+
req
.
url
,
method
:
req
.
method
,
data
:
req
.
params
,
header
:
getHeaders
(),
header
:
getHeaders
()
}).
then
(
res
=>
{
switch
(
res
.
statusCode
)
{
case
200
:
const
data
=
res
.
data
||
{};
if
(
data
.
code
==
200
)
{
const
data
=
res
.
data
||
{}
if
(
data
.
code
=
==
200
)
{
resolve
(
data
)
}
else
{
//登录超时
if
(
data
.
code
==
60002
||
data
.
code
==
60001
)
{
if
(
req
.
url
!=
'/system/wx/getUserInfo'
)
{
reLogin
();
}
}
else
if
(
data
.
code
==
401
&&
req
.
url
!=
'/system/wx/getUserInfo'
)
{
pcLogin
()
.
then
(()
=>
{
return
getNowOpenId
()
})
.
then
(()
=>
{
return
initData
()
})
.
then
(()
=>
{
uni
.
hideLoading
();
uni
.
redirectTo
({
url
:
getCurrentPages
()[
getCurrentPages
().
length
-
1
].
$page
.
fullPath
})
})
}
else
{
if
(
!
excludeUrls
.
includes
(
req
.
url
))
{
uni
.
showToast
({
title
:
data
.
msg
,
...
...
@@ -90,7 +66,29 @@ let request = function(req) {
duration
:
3000
})
}
// 登录超时
if
(
data
.
code
===
60002
||
data
.
code
===
60001
)
{
uni
.
redirectTo
({
url
:
'/pages/index/login'
})
}
else
if
(
data
.
code
===
401
)
{
h5LoginAuto
()
.
then
(()
=>
{
uni
.
hideLoading
()
uni
.
redirectTo
({
url
:
getCurrentPages
()[
getCurrentPages
()
.
length
-
1
].
$page
.
fullPath
})
})
.
catch
(()
=>
{
uni
.
showToast
({
title
:
'服务异常,请稍后重试'
,
icon
:
'none'
})
})
}
reject
(
res
)
}
break
...
...
@@ -107,39 +105,4 @@ let request = function(req) {
})
}
function
reLogin
()
{
const
currUser
=
uni
.
getStorageSync
(
'currUser'
)
||
{}
if
(
currUser
.
openId
)
{
const
accountInfo
=
uni
.
getAccountInfoSync
()
pcLoginByOpenId
(
accountInfo
.
miniProgram
.
appId
,
currUser
.
openId
)
.
then
((
res
)
=>
{
let
user
=
res
.
data
;
uni
.
setStorageSync
(
'token'
,
'Bearer '
+
user
.
token
);
uni
.
setStorageSync
(
'currUser'
,
user
);
uni
.
showToast
({
title
:
'一走神把您的操作遗漏了,请重试'
,
icon
:
'none'
})
}).
catch
(()
=>
{
uni
.
showToast
({
title
:
'服务异常,请稍后重试'
,
icon
:
'none'
})
})
}
}
function
pcLoginByOpenId
(
appId
,
openId
)
{
return
request
({
url
:
"/system/wx/loginByOpenId"
,
method
:
"POST"
,
params
:
{
appId
:
appId
,
openId
:
openId
}
})
}
export
default
request
;
export
default
request
...
...
config.js
View file @
023f830
// prod
// const baseUrl = 'https://research.wtwuxicenter.com/';
// const baseUrl_api=`${baseUrl}/prod-api`;
// const baseUrl_api = 'https://research.wtwuxicenter.com/';
// uat
// const baseUrl = 'https://jxt.itechtop.cn';
const
baseUrl
=
'https://jxt.wtwuxicenter.com'
;
const
baseUrl_api
=
`
${
baseUrl
}
/prod-api`
;
// staging
// const baseUrl = 'https://5q5re1d432g2.ngrok2.xiaomiqiu123.top';
// const baseUrl = "http://192.168.1.118:8081";
// const baseUrl_api = `${baseUrl}`;
const
fileUrl
=
"http://r.itechtop.cn"
;
const
baseUrl_api
=
"http://192.168.1.96:8787"
;
export
default
{
baseUrl
:
baseUrl
,
fileUrl
:
fileUrl
,
baseUrl_api
:
baseUrl_api
,
baseUrl_api
};
\ No newline at end of file
...
...
pages/index/login.vue
View file @
023f830
<
template
>
<view>
<view
class=
"page-bg"
>
<image
class=
"ren1"
src=
"@/static/login/ren1.png"
/>
<image
class=
"ren1"
src=
"@/static/login/ren1.png"
/>
<!-- 登录 -->
<view
class=
"retop"
>
<image
class=
"logotop"
src=
"@/static/login/logo@2x.png"
></image>
...
...
@@ -15,16 +14,16 @@
<form
v-if=
"isActive==0"
>
<view
class=
"round-input-item"
>
<image
class=
"icon"
src=
"@/static/login/tag01@2x.png"
></image>
<input
placeholder=
"账号"
/>
<uni-easyinput
placeholder=
"账号"
v-model=
"form.username"
/>
</view>
<view
class=
"round-input-item"
>
<image
class=
"icon"
src=
"@/static/login/tag02@2x.png"
></image>
<input
placeholder=
"密码"
/>
<uni-easyinput
placeholder=
"密码"
v-model=
"form.password"
type=
"password"
/>
</view>
<view
class=
"round-input-item"
>
<image
class=
"icon"
src=
"@/static/login/tag03@2x.png"
></image>
<input
placeholder=
"图形验证码"
/>
<image/>
<uni-easyinput
placeholder=
"图形验证码"
v-model=
"form.code"
/>
<image
:src=
"codeUrl"
@
click=
"getCode"
/>
</view>
</form>
...
...
@@ -32,28 +31,28 @@
<form
v-if=
"isActive==1"
>
<view
class=
"round-input-item"
>
<image
class=
"icon"
src=
"@/static/login/tag01@2x.png"
></image>
<input
placeholder=
"请输入手机号"
/>
<input
placeholder=
"请输入手机号"
/>
</view>
<view
class=
"round-input-item"
>
<image
class=
"icon"
src=
"@/static/login/tag02@2x.png"
></image>
<input
placeholder=
"图形验证码"
/>
<image/>
<input
placeholder=
"图形验证码"
/>
<image
/>
</view>
<view
class=
"round-input-item"
>
<image
class=
"icon"
src=
"@/static/login/tag04@2x.png"
></image>
<input
placeholder=
"短信验证码"
/>
<input
placeholder=
"短信验证码"
/>
<text>
获取验证码
</text>
</view>
</form>
<view
class=
"flex-item"
>
<view
class=
"member"
@
click=
"changeAgree(isRember)"
>
<image
v-if=
"isRember"
src=
"@/static/login/xz_dwn@2x.png"
/>
<image
v-else
src=
"@/static/login/xz@2x.png"
/>
<!--
<view
class=
"member"
@
click=
"changeAgree(isRember)"
>
<image
v-if=
"isRember"
src=
"@/static/login/xz_dwn@2x.png"
/>
<image
v-else
src=
"@/static/login/xz@2x.png"
/>
记住密码
</view>
<view
class=
"text-red"
>
忘记密码
</view>
<view
class=
"text-red"
>
忘记密码
</view>
-->
</view>
<view
class=
"center-item"
>
<button
@
click=
"login"
class=
"btn-red"
>
登录
</button>
...
...
@@ -67,93 +66,277 @@
</view>
</view>
<image
class=
"ren2"
src=
"@/static/login/ren2.png"
/>
<image
class=
"ren2"
src=
"@/static/login/ren2.png"
/>
<view
class=
"fixedagree"
>
<image
@
click=
"changeAgree(agree)"
v-if=
"agree"
src=
"@/static/login/xz_dwn@2x.png"
></image>
<image
v-else
src=
"@/static/login/xz2@2x.png"
></image>
<view>
登录即代表您同意
<text>
《用户协议》
</text><text>
《隐私策略》
</text></view>
</view>
</view>
</view>
</
template
>
<
script
setup
>
import
{
ref
}
from
'vue'
const
isActive
=
ref
(
0
)
const
agree
=
ref
(
false
)
const
isRember
=
ref
(
true
)
import
{
onMounted
,
ref
}
from
'vue'
import
{
getCodeImg
,
pcLogin
}
from
'@/common/login.js'
const
isActive
=
ref
(
0
)
const
agree
=
ref
(
false
)
const
isRember
=
ref
(
true
)
const
codeUrl
=
ref
(
null
)
const
form
=
ref
({
username
:
null
,
password
:
null
,
code
:
null
,
uuid
:
null
})
const
app
=
getApp
()
function
changeActive
(
n
){
onMounted
(()
=>
{
getCode
()
})
function
changeActive
(
n
)
{
isActive
.
value
=
n
}
function
changeAgree
(
item
){
}
function
changeAgree
(
item
)
{
item
=
!
item
}
function
login
(){
let
path
=
'/pages/index/index'
;
uni
.
navigateTo
({
url
:
path
});
}
function
goRegister
(){
let
path
=
'/pages/index/register'
;
}
function
login
()
{
pcLogin
(
form
.
value
)
.
then
(()
=>
{
app
.
globalData
.
isLogin
=
true
uni
.
redirectTo
({
url
:
'/pages/index/index'
})
})
.
catch
(
getCode
)
}
function
goRegister
()
{
const
path
=
'/pages/index/register'
uni
.
navigateTo
({
url
:
path
});
}
})
}
function
getCode
()
{
getCodeImg
().
then
((
res
)
=>
{
codeUrl
.
value
=
'data:image/gif;base64,'
+
res
.
data
.
img
form
.
value
.
uuid
=
res
.
data
.
uuid
})
}
</
script
>
<
style
scoped
lang=
"scss"
>
.logotop
{
width
:
510
rpx
;
height
:
215
rpx
;
margin
:
5vh
auto
40
rpx
;
display
:
block
;}
.ren1
{
width
:
300
rpx
;
height
:
560
rpx
;
position
:
absolute
;
right
:
0
;
top
:
0
;}
.ren2
{
width
:
456
rpx
;
height
:
600
rpx
;
position
:
relative
;
top
:
20
rpx
;}
.retop
{
position
:
relative
;
z-index
:
1
;}
.page-bg
{
background
:
url('@/static/login/bg.png')
no-repeat
center
;
.logotop
{
width
:
510
rpx
;
height
:
215
rpx
;
margin
:
5vh
auto
40
rpx
;
display
:
block
;
}
.ren1
{
width
:
300
rpx
;
height
:
560
rpx
;
position
:
absolute
;
right
:
0
;
top
:
0
;
}
.ren2
{
width
:
456
rpx
;
height
:
600
rpx
;
position
:
relative
;
top
:
20
rpx
;
}
.retop
{
position
:
relative
;
z-index
:
1
;
}
.page-bg
{
background
:
url('@/static/login/bg.png')
no-repeat
center
;
background-size
:
cover
;
height
:
100vh
;
overflow
:
hidden
;
position
:
relative
;
height
:
100vh
;
overflow
:
hidden
;
position
:
relative
;
}
.loginbox
{
.loginNav
{
width
:
700
rpx
;
margin
:
0
auto
-53
rpx
;
height
:
133
rpx
;
overflow
:
hidden
;
position
:
relative
;
view
{
text-align
:
center
;
height
:
133
rpx
;
box-sizing
:
border-box
;
padding
:
26
rpx
0
0
;
}
.n1
{
background
:
url('@/static/login/tab1.png')
no-repeat
top
left
;
background-size
:
contain
;
opacity
:
0.7
;
width
:
407
rpx
;
position
:
absolute
;
left
:
0
;
}
.n2
{
background
:
url('@/static/login/tab2.png')
no-repeat
top
right
;
background-size
:
contain
;
opacity
:
0.7
;
width
:
399
rpx
;
position
:
absolute
;
right
:
0
;
}
.loginbox
{
.loginNav{
width
:
700
rpx
;
margin
:
0
auto
-53
rpx
;
height
:
133
rpx
;
overflow
:
hidden
;
position
:
relative
;
view{
text-align
:
center
;
height
:
133
rpx
;
box-sizing
:
border-box
;
padding
:
26
rpx
0
0
;}
.n1
{
background
:
url('@/static/login/tab1.png')
no-repeat
top
left
;
background-size
:
contain
;
opacity
:
0.7
;
width
:
407
rpx
;
position
:
absolute
;
left
:
0
;}
.n2
{
background
:
url('@/static/login/tab2.png')
no-repeat
top
right
;
background-size
:
contain
;
opacity
:
0.7
;
width
:
399
rpx
;
position
:
absolute
;
right
:
0
;}
.active
{
color
:
#AD181F
;
opacity
:
1
;
&::after{
content
:
''
;
position
:
absolute
;
width
:
25
rpx
;
height
:
4
rpx
;
background
:
#AD181F
;
border-radius
:
2
rpx
;
left
:
0
;
right
:
0
;
margin
:
auto
;
bottom
:
50
rpx
;
.active
{
color
:
#AD181F
;
opacity
:
1
;
&::after
{
content
:
''
;
position
:
absolute
;
width
:
25
rpx
;
height
:
4
rpx
;
background
:
#AD181F
;
border-radius
:
2
rpx
;
left
:
0
;
right
:
0
;
margin
:
auto
;
bottom
:
50
rpx
;
}
}
}
}
.formbox
{
background
:
#fff
;
width
:
700
rpx
;
padding
:
50
rpx
;
margin
:
auto
;
border-radius
:
20
rpx
;}
.flex-item
{
display
:
flex
;
justify-content
:
space-between
;
margin
:
30
rpx
0
;
.formbox
{
background
:
#fff
;
width
:
700
rpx
;
padding
:
50
rpx
;
margin
:
auto
;
border-radius
:
20
rpx
;
}
.flex-item
{
display
:
flex
;
justify-content
:
space-between
;
margin
:
30
rpx
0
;
font-size
:
28
rpx
;
image{
width
:
30
rpx
;
height
:
30
rpx
;
margin-right
:
16
rpx
;}
image
{
width
:
30
rpx
;
height
:
30
rpx
;
margin-right
:
16
rpx
;
}
}
.member
{
color
:
#4C5359
;
display
:
flex
;
align-items
:
center
;
}
.center-item
{
text-align
:
center
;
margin
:
30
rpx
0
0
;
font-size
:
30
rpx
;
.btn-red
{
border-radius
:
40
rpx
;
width
:
600
rpx
;
line-height
:
80
rpx
;
font-size
:
36
rpx
;
}
.member
{
color
:
#4C5359
;
display
:
flex
;
align-items
:
center
;}
.center-item
{
text-align
:
center
;
margin
:
30
rpx
0
0
;
font-size
:
30
rpx
;
.btn-red{
border-radius
:
40
rpx
;
width
:
600
rpx
;
line-height
:
80
rpx
;
font-size
:
36
rpx
;}
}
.btn-red
{
background
:
#AD181F
;
color
:
#fff
;}
.text-red
{
color
:
#AD181F
;}
.round-input-item
{
overflow
:
hidden
;
background
:
RGBA
(
247
,
247
,
248
,
1
);
border-radius
:
40
rpx
;
.btn-red
{
background
:
#AD181F
;
color
:
#fff
;
}
.text-red
{
color
:
#AD181F
;
}
.round-input-item
{
overflow
:
hidden
;
background
:
RGBA
(
247
,
247
,
248
,
1
);
border-radius
:
40
rpx
;
padding
:
0
0
0
30
rpx
;
height
:
80
rpx
;
margin-bottom
:
30
rpx
;
display
:
flex
;
align-items
:
center
;
image{
width
:
180
rpx
;
height
:
80
rpx
;
&.icon{
width
:
30
rpx
;
height
:
30
rpx
;
margin-right
:
16
rpx
;}
height
:
80
rpx
;
margin-bottom
:
30
rpx
;
display
:
flex
;
align-items
:
center
;
image
{
width
:
180
rpx
;
height
:
80
rpx
;
&.icon
{
width
:
30
rpx
;
height
:
30
rpx
;
margin-right
:
16
rpx
;
}
}
input
{
border-left
:
1
rpx
solid
RGBA
(
214
,
216
,
219
,
1
);
padding
:
0
0
0
20
rpx
;
font-size
:
30
rpx
;
input
{
border-left
:
1
rpx
solid
RGBA
(
214
,
216
,
219
,
1
);
padding
:
0
0
0
20
rpx
;
font-size
:
30
rpx
;
}
input
::-webkit-input-placeholder
{
color
:
RGBA
(
158
,
166
,
174
,
1
);
font-size
:
30
rpx
;
}
input
::-webkit-input-placeholder
{
color
:
RGBA
(
158
,
166
,
174
,
1
);
font-size
:
30
rpx
;}
input
::placeholder
{
color
:
RGBA
(
158
,
166
,
174
,
1
);
font-size
:
30
rpx
;}
input
::-moz-placeholder
{
color
:
RGBA
(
158
,
166
,
174
,
1
);
font-size
:
30
rpx
;}
text
{
font-size
:
28
rpx
;
color
:
#014A9F
;}
input
::placeholder
{
color
:
RGBA
(
158
,
166
,
174
,
1
);
font-size
:
30
rpx
;
}
.fixedagree
{
position
:
fixed
;
bottom
:
5vh
;
color
:
rgba
(
255
,
255
,
255
,
0.7
);
display
:
flex
;
font-size
:
24
rpx
;
width
:
100vw
;
justify-content
:
center
;
image{
width
:
40
rpx
;
height
:
40
rpx
;
margin-right
:
20
rpx
;}
input
::-moz-placeholder
{
color
:
RGBA
(
158
,
166
,
174
,
1
);
font-size
:
30
rpx
;
}
text
{
font-size
:
28
rpx
;
color
:
#014A9F
;
}
}
.fixedagree
{
position
:
fixed
;
bottom
:
5vh
;
color
:
rgba
(
255
,
255
,
255
,
0.7
);
display
:
flex
;
font-size
:
24
rpx
;
width
:
100vw
;
justify-content
:
center
;
image
{
width
:
40
rpx
;
height
:
40
rpx
;
margin-right
:
20
rpx
;
}
}
</
style
>
\ No newline at end of file
...
...
pages/index/order.vue
View file @
023f830
杨炀
@yangyang
mentioned in commit
c49a1142
2023-10-08 11:28:23 UTC
mentioned in commit
c49a1142
Toggle commit list
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment