Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
h5-watch
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
苏文标
h5-watch
Commits
c9214edc
Commit
c9214edc
authored
Oct 19, 2022
by
suwenbiao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
处理冲突
parent
36315d54
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
289 additions
and
101 deletions
+289
-101
App.vue
App.vue
+4
-19
index.js
api/index.js
+15
-1
login.vue
components/login/login.vue
+270
-81
No files found.
App.vue
View file @
c9214edc
<
script
>
export
default
{
onLaunch
()
{
let
status
=
navigator
.
userAgent
.
toLowerCase
();
if
(
status
.
match
(
/MicroMessenger/i
)
==
"micromessenger"
)
{
//微信浏览器
uni
.
setStorageSync
(
'browser_type'
,
'1'
)
}
else
{
//其他浏览器
uni
.
setStorageSync
(
'browser_type'
,
'0'
)
if
(
window
.
location
.
href
.
slice
(
window
.
location
.
href
.
indexOf
(
'/'
,
10
)
+
1
,
9999
).
length
>
5
&&
window
.
location
.
href
.
indexOf
(
"&code="
==
-
1
)){
uni
.
setStorageSync
(
'room_id'
,
window
.
location
.
href
.
slice
(
window
.
location
.
href
.
indexOf
(
'/'
,
10
)
+
1
,
9999
))
window
.
location
.
href
=
window
.
location
.
href
.
slice
(
0
,
window
.
location
.
href
.
indexOf
(
'/'
,
10
));
}
},
onShow
()
{
...
...
@@ -21,18 +17,7 @@
<
style
>
/*每个页面公共css */
.contents
{
.contents
{
overflow-x
:
hidden
;
}
uni-scroll-view
.uni-scroll-view
::-webkit-scrollbar
{
/* 隐藏滚动条,但依旧具备可以滚动的功能 */
display
:
none
;
width
:
0
!important
;
height
:
0
!important
;
-webkit-appearance
:
none
;
background
:
transparent
;
color
:
transparent
;
}
</
style
>
api/index.js
View file @
c9214edc
...
...
@@ -246,7 +246,19 @@ function delwatchtype() {
return
request
(
'/LiveRoomWatchType/delWatchType'
,
"POST"
,
{
})
}
//获取appid
function
getappid
()
{
return
request
(
'/ocLogin/getAppid'
,
"GET"
,
{
})
}
//wx登录
function
loginbywx
(
code
)
{
return
request
(
'/ocLogin/loginByWx'
,
"GET"
,
{
code
})
}
export
default
{
loginbywx
,
sendsms
,
getverification
,
loginforphone
,
...
...
@@ -287,5 +299,6 @@ export default {
livechatinfo
,
livechecktoken
,
livewatchurl
,
delwatchtype
delwatchtype
,
getappid
}
\ No newline at end of file
components/login/login.vue
View file @
c9214edc
...
...
@@ -6,104 +6,294 @@
<view
class=
""
>
登录即可查看详情内容
</view>
<view
class=
"wx_btn"
>
<img
src=
"../../static/images/wx_pic.png"
alt=
""
>
<text>
微信快捷登录
</text>
<view
class=
""
v-if=
"log_types==1"
>
<view
class=
"wx_btn"
@
click=
"go_login"
>
<img
src=
"../../static/images/wx_pic.png"
alt=
""
>
<text>
微信快捷登录
</text>
</view>
<view
class=
"wx_canelbtn"
@
click=
"is_show = false"
>
<text>
取消
</text>
</view>
</view>
<view
class=
"wx_canelbtn"
@
click=
"is_show = false"
>
<text>
取消
</text>
<view
class=
""
v-if=
"log_types==0"
>
<u--input
placeholder=
"请输入手机号"
border=
"none"
maxlength=
"11"
clearable
type=
"number"
inputAlign=
"center"
v-model=
"tel"
style=
"width: 88%;margin: 62rpx auto 32rpx auto;background-color: #F2F2F4;border-radius: 10rpx;font-size: 28rpx;padding: 20rpx 0;"
>
</u--input>
<view
class=
"input_imgcode"
>
<u--input
placeholder=
"请输入图片验证码"
border=
"none"
inputAlign=
"center"
v-model=
"icode"
style=
"width: 52.5%;background-color: #F2F2F4;border-radius: 10rpx;font-size: 28rpx;padding: 20rpx 0;float: left;"
>
</u--input>
<u--image
:showLoading=
"true"
:src=
"code_src"
width=
"280rpx"
height=
"88rpx"
@
click=
"clickcodeimg"
style=
"float: left;margin-left: 5%;"
></u--image>
</view>
<view
class=
"input_imgcode"
>
<u--input
placeholder=
"请输入短信验证码"
border=
"none"
inputAlign=
"center"
v-model=
"smscode"
style=
"width: 52.5%;background-color: #F2F2F4;border-radius: 10rpx;font-size: 28rpx;padding: 20rpx 0;float: left;"
>
</u--input>
<view
class=
"btn_getsms"
>
<u-notify
ref=
"uNotify"
message=
""
></u-notify>
<u-code
:seconds=
"seconds"
ref=
"uCode"
@
change=
"codeChange"
@
start=
"start"
></u-code>
<u-button
@
tap=
"getCode"
style=
"border: 2rpx solid #276EE8;outline: none;color: #276EE8;margin-top: 4rpx;"
>
{{
tips
}}
</u-button>
</view>
</view>
</view>
<view
class=
"agreement_view"
>
<view
class=
"check_agreement"
v-if=
"agree_agreement"
@
click=
"agree_agreement = agree_agreement ? false : true"
></view>
<view
class=
"check_agreement"
v-if=
"agree_agreement"
@
click=
"agree_agreement = agree_agreement ? false : true"
></view>
<view
class=
"notcheck_agreement"
v-if=
"!agree_agreement"
@
click=
"agree_agreement = agree_agreement ? false : true"
></view>
<text>
我已阅读并同意
<a
href=
"https://xs-service.finezb.com/privacyAgreement.html"
target=
"_blank"
>
《用户隐私协议》
</a>
和
<a
href=
"https://xs-service.finezb.com/privacyAgreement.html"
target=
"_blank"
>
《商家隐私协议》
</a>
</text>
@
click=
"agree_agreement = agree_agreement ? false : true"
></view>
<text>
我已阅读并同意
<a
href=
"https://xs-service.finezb.com/privacyAgreement.html"
target=
"_blank"
>
《用户隐私协议》
</a>
和
<a
href=
"https://xs-service.finezb.com/privacyAgreement.html"
target=
"_blank"
>
《商家隐私协议》
</a>
</text>
</view>
<view
class=
"btn_smslogin"
@
click=
"sumbit"
v-if=
"log_types==0"
>
登录
</view>
</view>
<view
class=
""
>
</view>
<pwdlogin></pwdlogin>
</u-popup>
</view>
</
template
>
<
script
>
import
pwdlogin
from
"@/components/login/password_login.vue"
export
default
{
name
:
"login"
,
props
:{
name
:
"login"
,
props
:
{
},
components
:{
pwdlogin
},
data
()
{
return
{
is_show
:
true
,
agree_agreement
:
true
tel
:
''
,
icode
:
''
,
smscode
:
''
,
is_show
:
true
,
agree_agreement
:
true
,
authorization_info
:
{},
code_src
:
''
,
numrandom
:
''
,
seconds
:
60
,
tips
:
'获取验证码'
,
log_types
:
''
,
};
},
mounted
()
{
let
status
=
navigator
.
userAgent
.
toLowerCase
();
if
(
status
.
match
(
/MicroMessenger/i
)
==
"micromessenger"
)
{
//微信浏览器
this
.
log_types
=
1
}
else
{
//其他浏览器
this
.
log_types
=
0
}
this
.
wx_loginok
()
this
.
getwxid
()
this
.
clickcodeimg
()
},
methods
:
{
//获取appid
getwxid
()
{
this
.
$api
.
getappid
().
then
(
res
=>
{
console
.
log
(
res
);
this
.
authorization_info
=
res
.
data
.
data
})
},
start
()
{
},
//判断是否微信登录成功
wx_loginok
(){
var
ahref
=
window
.
location
.
href
if
(
ahref
.
indexOf
(
"&code="
)
!=
-
1
){
wxcode
=
ahref
.
slice
(
ahref
.
indexOf
(
"&code="
)
+
6
,
ahref
.
indexOf
(
"&state="
))
this
.
$api
.
loginbywx
(
wxcode
).
then
(
res
=>
{
console
.
log
(
res
);
})
}
},
//发起登录
go_login
()
{
var
local
=
window
.
location
.
href
;
var
url
=
"https://open.weixin.qq.com/connect/oauth2/authorize?appid="
+
this
.
authorization_info
.
appId
+
"&redirect_uri="
+
encodeURIComponent
(
local
)
+
"&response_type=code&scope=snsapi_userinfo&state=1&component_appid="
+
this
.
authorization_info
.
componentAppId
+
"#wechat_redirect"
window
.
location
.
href
=
url
;
},
//图片验证码
clickcodeimg
()
{
this
.
numrandom
=
Date
.
now
()
+
Math
.
random
(
0
,
9
);
this
.
code_src
=
"https://oc-testapi.finezb.com/ocLogin/generateValidateCode?time="
+
this
.
numrandom
;
},
codeChange
(
text
)
{
this
.
tips
=
text
;
},
//获取短信验证码
getCode
()
{
if
(
this
.
$refs
.
uCode
.
canGetCode
)
{
this
.
$api
.
sendsms
(
this
.
tel
,
this
.
numrandom
,
this
.
icode
).
then
(
res
=>
{
console
.
log
(
res
);
if
(
res
.
data
.
code
===
200
){
this
.
$refs
.
uNotify
.
show
({
top
:
30
,
type
:
'success'
,
message
:
'发送成功'
,
duration
:
1000
*
3
,
fontSize
:
20
,
safeAreaInsetTop
:
true
})
this
.
$refs
.
uCode
.
start
();
}
else
{
this
.
$refs
.
uNotify
.
show
({
top
:
30
,
type
:
'error'
,
message
:
res
.
data
.
msg
,
duration
:
1000
*
3
,
fontSize
:
20
,
safeAreaInsetTop
:
true
})
}
})
// 通知验证码组件内部开始倒计时
}
else
{
this
.
$refs
.
uNotify
.
show
({
top
:
30
,
type
:
'warning'
,
message
:
'请在倒计时结束后再试'
,
duration
:
1000
*
3
,
fontSize
:
20
,
safeAreaInsetTop
:
true
})
}
},
//短信登录
sumbit
()
{
this
.
$api
.
loginforphone
(
this
.
tel
,
this
.
smscode
,
this
.
numrandom
,
this
.
icode
,
"0"
).
then
(
res
=>
{
console
.
log
(
res
);
if
(
!
res
.
data
.
data
.
avatar
)
{
uni
.
setStorageSync
(
'user_headimg'
,
'https://ts1.cn.mm.bing.net/th/id/R-C.baa2d1577cf82ad47aa705957237bff6?rik=IciTRLgFHnunww&riu=http%3a%2f%2fwww.sucaijishi.com%2fuploadfile%2f2016%2f0203%2f20160203022632945.png&ehk=4PjlDtyivWKN7CP%2b5JlcgUiuD1nyme8IaxbNbPnANIw%3d&risl=&pid=ImgRaw&r=0'
)
uni
.
setStorageSync
(
"user_token"
,
res
.
data
.
data
.
token
);
uni
.
setStorageSync
(
"user_phone"
,
this
.
tel
);
uni
.
setStorageSync
(
"user_name"
,
res
.
data
.
data
.
account
);
this
.
$refs
.
uNotify
.
show
({
top
:
30
,
type
:
'success'
,
message
:
'登录成功'
,
duration
:
1000
*
3
,
fontSize
:
20
,
safeAreaInsetTop
:
true
})
setTimeout
(()
=>
{
window
.
location
.
reload
()
},
1500
);
}
}).
catch
(
err
=>
{
console
.
log
(
err
);
});
},
}
}
</
script
>
<
style
>
.wx_view
{
text-align
:
center
;
font-size
:
28
rpx
;
padding-top
:
68
rpx
;
padding-bottom
:
80
rpx
;
}
.wx_view
>
img
{
width
:
122
rpx
;
height
:
122
rpx
;
}
.wx_btn
{
width
:
520
rpx
;
height
:
96
rpx
;
background
:
#00E36B
;
border-radius
:
60
rpx
;
margin
:
80
rpx
auto
24
rpx
auto
;
line-height
:
96
rpx
;
color
:
#fff
;
}
.wx_btn
img
{
width
:
52
rpx
;
height
:
52
rpx
;
vertical-align
:
middle
;
margin
:
0
16
rpx
;
}
.wx_canelbtn
{
width
:
520
rpx
;
font-size
:
24
rpx
;
height
:
96
rpx
;
background
:
#EEEEEE
;
border-radius
:
60
rpx
;
margin
:
0
auto
;
line-height
:
96
rpx
;
color
:
#777777
;
}
.agreement_view
{
margin-top
:
100
rpx
;
padding
:
0
50
rpx
;
}
.check_agreement
{
display
:
inline-block
;
vertical-align
:
middle
;
margin-right
:
20
rpx
;
width
:
28
rpx
;
height
:
28
rpx
;
background-color
:
#00E36B
;
border-radius
:
50%
;
}
.agreement_view
a
{
text-decoration
:
none
;
}
.notcheck_agreement
{
display
:
inline-block
;
vertical-align
:
middle
;
margin-right
:
20
rpx
;
width
:
25
rpx
;
height
:
25
rpx
;
border
:
1
rpx
solid
#ccc
;
border-radius
:
50%
;
}
</
style
>
\ No newline at end of file
.wx_view
{
text-align
:
center
;
font-size
:
28
rpx
;
padding-top
:
68
rpx
;
padding-bottom
:
80
rpx
;
}
.wx_view
>
img
{
width
:
122
rpx
;
height
:
122
rpx
;
}
.wx_btn
{
width
:
520
rpx
;
height
:
96
rpx
;
background
:
#00E36B
;
border-radius
:
60
rpx
;
margin
:
80
rpx
auto
24
rpx
auto
;
line-height
:
96
rpx
;
color
:
#fff
;
}
.wx_btn
img
{
width
:
52
rpx
;
height
:
52
rpx
;
vertical-align
:
middle
;
margin
:
0
16
rpx
;
}
.wx_canelbtn
{
width
:
520
rpx
;
font-size
:
24
rpx
;
height
:
96
rpx
;
background
:
#EEEEEE
;
border-radius
:
60
rpx
;
margin
:
0
auto
;
line-height
:
96
rpx
;
color
:
#777777
;
}
.agreement_view
{
font-size
:
20
rpx
;
margin-top
:
100
rpx
;
padding
:
0
50
rpx
;
}
.check_agreement
{
display
:
inline-block
;
vertical-align
:
middle
;
margin-right
:
20
rpx
;
width
:
28
rpx
;
height
:
28
rpx
;
background-color
:
#00E36B
;
border-radius
:
50%
;
}
.agreement_view
a
{
text-decoration
:
none
;
}
.notcheck_agreement
{
display
:
inline-block
;
vertical-align
:
middle
;
margin-right
:
20
rpx
;
width
:
25
rpx
;
height
:
25
rpx
;
border
:
1
rpx
solid
#ccc
;
border-radius
:
50%
;
}
.input_imgcode
{
width
:
88%
;
margin
:
30
rpx
auto
;
overflow
:
hidden
;
}
.btn_getsms
{
float
:
right
;
width
:
280
rpx
;
}
.btn_smslogin
{
width
:
686
rpx
;
height
:
80
rpx
;
background
:
#256EE7
;
border-radius
:
40
rpx
;
margin
:
80
rpx
auto
5
rpx
auto
;
line-height
:
80
rpx
;
color
:
#fff
;
font-size
:
30
rpx
;
}
</
style
>
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