Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
account-book
Project
Project
Details
Activity
Releases
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
刘文虎
account-book
Commits
b6ac3681
Commit
b6ac3681
authored
Jul 20, 2022
by
刘文虎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登录拦截
parent
9fb45e34
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
210 additions
and
51 deletions
+210
-51
index.js
api/user/index.js
+16
-0
billing-details.vue
components/billing-details/billing-details.vue
+1
-1
billing-category.vue
components/billing-details/components/billing-category.vue
+9
-5
pages.json
pages.json
+0
-1
user-header.vue
pages/index/mine/components/user-header.vue
+9
-8
quick-login.vue
pages/login/quick-login/quick-login.vue
+11
-0
index.js
router/index.js
+37
-22
login.js
store/modules/login.js
+14
-12
changelog.md
uni_modules/uni-swiper-dot/changelog.md
+12
-0
package.json
uni_modules/uni-swiper-dot/package.json
+87
-0
readme.md
uni_modules/uni-swiper-dot/readme.md
+11
-0
request.js
utils/request.js
+3
-2
No files found.
api/user/index.js
0 → 100644
View file @
b6ac3681
import
request
from
"@/utils/request.js"
export
function
getUserInfo
()
{
return
request
({
url
:
`/rest/user`
,
method
:
'GET'
,
})
}
export
function
sendCode
(
data
)
{
return
request
({
url
:
`/anno/moblie/sendCode`
,
method
:
'GET'
,
data
})
}
components/billing-details/billing-details.vue
View file @
b6ac3681
...
@@ -68,7 +68,7 @@ export default {
...
@@ -68,7 +68,7 @@ export default {
billingTypeOptions
,
billingTypeOptions
,
takePhotoIcon
:
indexBaseUrl
+
'shangchuanbeizhu@3x.png'
,
takePhotoIcon
:
indexBaseUrl
+
'shangchuanbeizhu@3x.png'
,
takePhotoSuccessIcon
:
indexBaseUrl
+
'shangchuanbeizhuchenggong@3x.png'
,
takePhotoSuccessIcon
:
indexBaseUrl
+
'shangchuanbeizhuchenggong@3x.png'
,
show
:
tru
e
,
show
:
fals
e
,
customStyle
:
{
customStyle
:
{
width
:
'104rpx'
,
width
:
'104rpx'
,
height
:
'48rpx'
,
height
:
'48rpx'
,
...
...
components/billing-details/components/billing-category.vue
View file @
b6ac3681
<
template
>
<
template
>
<view
class=
"billing-category"
>
<view
class=
"billing-category"
>
<uni-swiper-dot
:info=
"swiperList"
:current=
"current"
field=
"content"
:mode=
"mode"
:dotsStyles=
"dotsStyles"
>
<uni-swiper-dot
:info=
"swiperList"
:current=
"current"
field=
"content"
:mode=
"mode"
:dotsStyles=
"dotsStyles"
>
<swiper
class=
"swiper"
circular
:indicator-dots=
"false"
indicator-color=
"#8d8d8d"
indicator-active-color=
"#02A074"
:autoplay=
"false"
:duration=
"duration"
@
change=
"change"
>
<swiper
class=
"swiper"
:indicator-dots=
"false"
indicator-color=
"#8d8d8d"
indicator-active-color=
"#02A074"
:autoplay=
"false"
:duration=
"duration"
@
change=
"change"
>
<swiper-item
v-for=
"(swiper, swiperIndex) in swiperList"
:key=
"swiperIndex"
>
<swiper-item
v-for=
"(swiper, swiperIndex) in swiperList"
:key=
"swiperIndex"
>
<view
class=
"swiper-item"
>
<view
class=
"swiper-item"
>
<view
class=
"billing-category-item"
:class=
"
{ active: item.value === checked }" v-for="(item, index) in list" :key="index" @click="handleCheck(item)">
<view
class=
"billing-category-item"
:class=
"
{ active: item.value === checked }" v-for="(item, index) in list" :key="index" @click="handleCheck(item)">
...
@@ -24,6 +24,9 @@ import { billingCategoryOptions } from '@/utils/options/index/index.js';
...
@@ -24,6 +24,9 @@ import { billingCategoryOptions } from '@/utils/options/index/index.js';
import
{
billBaseUrl
}
from
'@/utils/config.js'
;
import
{
billBaseUrl
}
from
'@/utils/config.js'
;
export
default
{
export
default
{
name
:
'billing-category'
,
name
:
'billing-category'
,
components
:{
UniSwiperDot
},
props
:
{
props
:
{
checked
:
{
checked
:
{
type
:
Number
|
String
,
type
:
Number
|
String
,
...
@@ -39,10 +42,12 @@ export default {
...
@@ -39,10 +42,12 @@ export default {
current
:
0
,
current
:
0
,
mode
:
'round'
,
mode
:
'round'
,
dotsStyles
:{
dotsStyles
:{
width
:
8
,
width
:
6
,
bottom
:
1
0
,
bottom
:
0
,
backgroundColor
:
'#8d8d8d'
,
backgroundColor
:
'#8d8d8d'
,
selectedBackgroundColor
:
'#02A074'
selectedBackgroundColor
:
'#02A074'
,
border
:
'none'
,
selectedBorder
:
'none'
}
}
};
};
},
},
...
@@ -52,7 +57,6 @@ export default {
...
@@ -52,7 +57,6 @@ export default {
},
},
change
(
e
)
{
change
(
e
)
{
this
.
current
=
e
.
detail
.
current
;
this
.
current
=
e
.
detail
.
current
;
console
.
log
(
this
.
current
)
}
}
}
}
};
};
...
...
pages.json
View file @
b6ac3681
...
@@ -301,7 +301,6 @@
...
@@ -301,7 +301,6 @@
"selectedColor"
:
"#303133"
,
"selectedColor"
:
"#303133"
,
"backgroundColor"
:
"#FFFFFF"
,
"backgroundColor"
:
"#FFFFFF"
,
"borderStyle"
:
"black"
,
"borderStyle"
:
"black"
,
"spacing"
:
"6px"
,
"list"
:
[{
"list"
:
[{
"pagePath"
:
"pages/index/index"
,
"pagePath"
:
"pages/index/index"
,
"iconPath"
:
"/static/image/index/shouye0@3x.png"
,
"iconPath"
:
"/static/image/index/shouye0@3x.png"
,
...
...
pages/index/mine/components/user-header.vue
View file @
b6ac3681
...
@@ -6,23 +6,23 @@
...
@@ -6,23 +6,23 @@
</view>
</view>
<view
class=
"user-info"
>
<view
class=
"user-info"
>
<view
class=
"user-nickname"
>
<view
class=
"user-nickname"
>
<text
v-if=
"userInfo.
nickname
"
>
{{
userInfo
.
nickname
}}
</text>
<text
v-if=
"userInfo.
id
"
>
{{
userInfo
.
nickname
}}
</text>
<text
v-else
>
立即登录
</text>
<text
v-else
>
立即登录
</text>
</view>
</view>
<view
class=
"license-num"
>
<view
class=
"license-num"
>
<text
v-if=
"userInfo.
nickname"
>
{{
userInfo
.
nickn
ame
}}
</text>
<text
v-if=
"userInfo.
id"
>
{{
userInfo
.
repairShopN
ame
}}
</text>
<text
v-else
>
登录可体验更多功能
</text>
<text
v-else
>
登录可体验更多功能
</text>
</view>
</view>
<view
class=
"vip"
v-if=
"
!userInfo.nickname
"
>
<view
class=
"vip"
v-if=
"
userInfo.id
"
>
<view
class=
"vip-icon"
>
<view
class=
"vip-icon"
>
<image
:src=
"isVip"
mode=
""
v-if=
"userInfo.
day > 0
"
></image>
<image
:src=
"isVip"
mode=
""
v-if=
"userInfo.
vip
"
></image>
<image
:src=
"notVip"
mode=
""
v-else
></image>
<image
:src=
"notVip"
mode=
""
v-else
></image>
</view>
</view>
<view
class=
"vip-text"
>
<view
class=
"vip-text"
>
<text
class=
"vip-text-is"
v-if=
"userInfo.
day > 0
"
>
会员权益剩余
{{}}
天
</text>
<text
class=
"vip-text-is"
v-if=
"userInfo.
vip
"
>
会员权益剩余
{{}}
天
</text>
<text
class=
"vip-text-no"
v-else
>
您还不是会员
</text>
<text
class=
"vip-text-no"
v-else
>
您还不是会员
</text>
</view>
</view>
<view
class=
"vip-renew"
v-if=
"userInfo.
day > 0
"
>
<view
class=
"vip-renew"
v-if=
"userInfo.
vip
"
>
<text>
续费
</text>
<text>
续费
</text>
<u-icon
name=
"arrow-right"
class=
"vip-renew-icon"
></u-icon>
<u-icon
name=
"arrow-right"
class=
"vip-renew-icon"
></u-icon>
</view>
</view>
...
@@ -52,8 +52,9 @@ export default {
...
@@ -52,8 +52,9 @@ export default {
},
},
notVip
(){
notVip
(){
return
this
.
baseUrl
+
'bushihuiyuan@3x.png'
return
this
.
baseUrl
+
'bushihuiyuan@3x.png'
}
},
}
},
};
};
</
script
>
</
script
>
...
...
pages/login/quick-login/quick-login.vue
View file @
b6ac3681
...
@@ -39,6 +39,7 @@
...
@@ -39,6 +39,7 @@
<
script
>
<
script
>
import
log
from
'@/utils/log.js'
import
log
from
'@/utils/log.js'
import
{
showToast
}
from
"@/utils/common.js"
import
{
mapGetters
}
from
'vuex'
;
import
{
mapGetters
}
from
'vuex'
;
export
default
{
export
default
{
components
:
{},
components
:
{},
...
@@ -270,6 +271,16 @@ export default {
...
@@ -270,6 +271,16 @@ export default {
}
}
this
.
$store
.
dispatch
(
'Auto_login'
,
params
).
then
((
res
)
=>
{
this
.
$store
.
dispatch
(
'Auto_login'
,
params
).
then
((
res
)
=>
{
console
.
log
(
"登录成功"
,
res
)
console
.
log
(
"登录成功"
,
res
)
this
.
$store
.
dispatch
(
'Get_UserInfo'
).
then
(()
=>
{
showToast
(
'登录成功'
);
setTimeout
(()
=>
{
uni
.
switchTab
({
url
:
"/pages/index/index"
})
},
1000
)
}).
catch
(()
=>
{
showToast
(
'获取用户信息失败'
);
})
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
showToast
(
'登录失败'
);
showToast
(
'登录失败'
);
console
.
log
(
"登录失败"
,
err
)
console
.
log
(
"登录失败"
,
err
)
...
...
router/index.js
View file @
b6ac3681
...
@@ -6,7 +6,6 @@ import {
...
@@ -6,7 +6,6 @@ import {
}
from
"@/utils/common.js"
}
from
"@/utils/common.js"
import
{
whiteList
}
from
"@/utils/config.js"
import
{
whiteList
}
from
"@/utils/config.js"
import
store
from
"../store/index.js"
import
store
from
"../store/index.js"
console
.
log
(
"store"
,
store
)
import
{
import
{
getCode
getCode
}
from
"@/utils/auth.js"
}
from
"@/utils/auth.js"
...
@@ -39,28 +38,44 @@ const router = createRouter({
...
@@ -39,28 +38,44 @@ const router = createRouter({
console
.
log
(
"需要鉴权"
)
console
.
log
(
"需要鉴权"
)
if
(
checkToken
()){
if
(
checkToken
()){
next
()
next
()
}
else
{
}
else
{
next
()
// next()
// if(store.getters.platform==='4'){
if
(
store
.
getters
.
platform
===
'4'
){
// showToast('登录已过期,请重新登录')
showToast
(
'登录已过期,请重新登录'
)
// setTimeout(()=>{
setTimeout
(()
=>
{
// next({
next
({
// path:'/pages/login/login'
path
:
'/pages/login/login'
// })
})
// },1500)
},
1500
)
// }else{
}
else
{
// store.dispatch('Auto_login').then(()=>{
store
.
dispatch
(
'Auto_login'
).
then
(()
=>
{
// next()
next
()
// }).catch(()=>{
// if(!store.getters.userInfo||!store.getters.userInfo.id){
// showToast('自动登录失败');
// console.log("未获取到用户信息")
// setTimeout(()=>{
// store.dispatch('Get_UserInfo').then(()=>{
// next({
// next()
// path:'/pages/login/login'
// }).catch(()=>{
// })
// showToast('获取用户信息失败');
// },1500)
// setTimeout(()=>{
// next({
// path:'/pages/login/login'
// })
// },1500)
// })
// }else{
// next()
// }
}).
catch
(()
=>
{
showToast
(
'自动登录失败'
);
setTimeout
(()
=>
{
next
({
path
:
'/pages/login/login'
})
},
1500
)
//
})
})
//
}
}
}
}
}
}
...
...
store/modules/login.js
View file @
b6ac3681
...
@@ -12,11 +12,10 @@ import {
...
@@ -12,11 +12,10 @@ import {
}
from
"@/utils/config.js"
}
from
"@/utils/config.js"
import
{
import
{
userAuthLogin
,
userAuthLogin
,
getProfile
,
getDVRHost
,
getHeadImageHost
,
subscribeCyzn
}
from
"@/api/login/index.js"
;
}
from
"@/api/login/index.js"
;
import
{
getUserInfo
,
}
from
"@/api/user/index.js"
;
import
{
import
{
wxLogin
wxLogin
}
from
"@/utils/auth.js"
}
from
"@/utils/auth.js"
...
@@ -140,8 +139,7 @@ const actions = {
...
@@ -140,8 +139,7 @@ const actions = {
loginChannel
:
loginChannel
,
loginChannel
:
loginChannel
,
code
:
code
,
code
:
code
,
}
}
console
.
log
(
code
)
// return false
return
false
if
(
params
){
if
(
params
){
info
=
{
info
=
{
...
info
,
...
info
,
...
@@ -149,23 +147,26 @@ const actions = {
...
@@ -149,23 +147,26 @@ const actions = {
}
}
}
}
let
res
=
await
userAuthLogin
(
info
)
let
res
=
await
userAuthLogin
(
info
)
let
{
token
}
=
res
.
data
setTimetamp
()
setTimetamp
()
setToken
(
res
.
token
)
setToken
(
token
)
await
dispatch
(
'Get_UserInfo'
)
resolve
(
res
)
resolve
(
res
)
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
e
)
console
.
log
(
"Auto_login错误"
,
e
)
reject
()
reject
(
e
)
}
}
})
})
},
},
// 获取用户信息
// 获取用户信息
GetInfo
({
Get
_User
Info
({
commit
,
commit
,
state
state
,
dispatch
})
{
})
{
return
new
Promise
(
async
(
resolve
,
reject
)
=>
{
return
new
Promise
(
async
(
resolve
,
reject
)
=>
{
try
{
try
{
let
res
=
await
get
Profile
()
let
res
=
await
get
UserInfo
()
let
{
let
{
code
,
code
,
data
data
...
@@ -174,6 +175,7 @@ const actions = {
...
@@ -174,6 +175,7 @@ const actions = {
commit
(
"SET_USERINFO"
,
data
)
commit
(
"SET_USERINFO"
,
data
)
resolve
(
res
)
resolve
(
res
)
}
catch
(
e
)
{
}
catch
(
e
)
{
dispatch
(
"LogOut"
)
console
.
log
(
e
)
console
.
log
(
e
)
reject
()
reject
()
}
}
...
...
uni_modules/uni-swiper-dot/changelog.md
0 → 100644
View file @
b6ac3681
## 1.2.0(2021-11-19)
-
优化 组件UI,并提供设计资源,详见:
[
https://uniapp.dcloud.io/component/uniui/resource
](
https://uniapp.dcloud.io/component/uniui/resource
)
-
文档迁移,详见:
[
https://uniapp.dcloud.io/component/uniui/uni-swiper-dot
](
https://uniapp.dcloud.io/component/uniui/uni-swiper-dot
)
## 1.1.0(2021-07-30)
-
组件兼容 vue3,如何创建vue3项目,详见
[
uni-app 项目支持 vue3 介绍
](
https://ask.dcloud.net.cn/article/37834
)
## 1.0.6(2021-05-12)
-
新增 示例地址
-
修复 示例项目缺少组件的Bug
## 1.0.5(2021-02-05)
-
调整为uni_modules目录规范
-
新增 clickItem 事件,支持指示点控制轮播
-
新增 支持 pc 可用
uni_modules/uni-swiper-dot/package.json
0 → 100644
View file @
b6ac3681
{
"id"
:
"uni-swiper-dot"
,
"displayName"
:
"uni-swiper-dot 轮播图指示点"
,
"version"
:
"1.2.0"
,
"description"
:
"自定义轮播图指示点组件"
,
"keywords"
:
[
"uni-ui"
,
"uniui"
,
"轮播图指示点"
,
"dot"
,
"swiper"
],
"repository"
:
"https://github.com/dcloudio/uni-ui"
,
"engines"
:
{
"HBuilderX"
:
""
},
"directories"
:
{
"example"
:
"../../temps/example_temps"
},
"dcloudext"
:
{
"category"
:
[
"前端组件"
,
"通用组件"
],
"sale"
:
{
"regular"
:
{
"price"
:
"0.00"
},
"sourcecode"
:
{
"price"
:
"0.00"
}
},
"contact"
:
{
"qq"
:
""
},
"declaration"
:
{
"ads"
:
"无"
,
"data"
:
"无"
,
"permissions"
:
"无"
},
"npmurl"
:
"https://www.npmjs.com/package/@dcloudio/uni-ui"
},
"uni_modules"
:
{
"dependencies"
:
[
"uni-scss"
],
"encrypt"
:
[],
"platforms"
:
{
"cloud"
:
{
"tcb"
:
"y"
,
"aliyun"
:
"y"
},
"client"
:
{
"App"
:
{
"app-vue"
:
"y"
,
"app-nvue"
:
"y"
},
"H5-mobile"
:
{
"Safari"
:
"y"
,
"Android Browser"
:
"y"
,
"微信浏览器(Android)"
:
"y"
,
"QQ浏览器(Android)"
:
"y"
},
"H5-pc"
:
{
"Chrome"
:
"y"
,
"IE"
:
"y"
,
"Edge"
:
"y"
,
"Firefox"
:
"y"
,
"Safari"
:
"y"
},
"小程序"
:
{
"微信"
:
"y"
,
"阿里"
:
"y"
,
"百度"
:
"y"
,
"字节跳动"
:
"y"
,
"QQ"
:
"y"
},
"快应用"
:
{
"华为"
:
"u"
,
"联盟"
:
"u"
},
"Vue"
:
{
"vue2"
:
"y"
,
"vue3"
:
"y"
}
}
}
}
}
\ No newline at end of file
uni_modules/uni-swiper-dot/readme.md
0 → 100644
View file @
b6ac3681
## SwiperDot 轮播图指示点
> **组件名:uni-swiper-dot**
> 代码块: `uSwiperDot`
自定义轮播图指示点
### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-swiper-dot)
#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839
\ No newline at end of file
utils/request.js
View file @
b6ac3681
...
@@ -46,7 +46,8 @@ function request({
...
@@ -46,7 +46,8 @@ function request({
console
.
log
(
"requestUrl="
+
url
)
console
.
log
(
"requestUrl="
+
url
)
// console.log("请求参数===")
// console.log("请求参数===")
// console.log(data)
// console.log(data)
header
[
"Authorization"
]
=
token
// header["Authorization"] ='Basic '+ token
header
[
"token"
]
=
'Bearer '
+
token
if
(
!
noLoading
)
{
if
(
!
noLoading
)
{
uni
.
showLoading
({
uni
.
showLoading
({
title
:
'加载中'
,
title
:
'加载中'
,
...
@@ -64,7 +65,7 @@ function request({
...
@@ -64,7 +65,7 @@ function request({
// 重置时间戳
// 重置时间戳
setTimetamp
()
setTimetamp
()
// console.log(res)
// console.log(res)
if
(
res
.
data
.
code
===
20
0
)
{
if
(
res
.
data
.
code
===
0
)
{
if
(
!
noLoading
)
{
if
(
!
noLoading
)
{
uni
.
hideLoading
()
uni
.
hideLoading
()
}
}
...
...
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