Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sfp-program
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
Sweet Zhang
sfp-program
Commits
d445da23
Commit
d445da23
authored
Sep 01, 2022
by
Sweet Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
拦截器
parent
6e5d4852
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
96 additions
and
43 deletions
+96
-43
manifest.json
+22
-0
pages/dataImport/data-import.vue
+52
-21
pages/index/index.vue
+1
-1
util/interceptor.ts
+21
-21
No files found.
manifest.json
View file @
d445da23
...
...
@@ -74,5 +74,27 @@
"base"
:
"/sfp/"
,
"mode"
:
"hash"
}
//
"devServer"
:
{
//
"/api"
:{
//
"target"
:
"https://mdev.zuihuibi.cn"
,
//
"secure"
:
false
,
//
"changeOrigin"
:
"true"
,
//
"logLevel"
:
"debug"
,
//
"pathRewrite"
:{
"^/proxy"
:
""
}
//
},
//
//
"port"
:
3001
,
//
端口号
//
//
"disableHostCheck"
:
true
,
//
//
"proxy"
:
{
//
//
"/api"
:
{
//
//
"target"
:
"https://mdev.zuihuibi.cn"
,
//请求的目标域名
//
//
"changeOrigin"
:
true
,
//是否跨域
//
//
"secure"
:
false
//设置支持https协议的代理
//
//
"pathRewrite"
:
{
//匹配请求路径里面有
/api
会替换成https
:
//mdev.zuihuibi.cn
//
//
//
举例:/api/api/user
=>
https
:
//mdev.zuihuibi.cn/api/user
//
//
"^/api"
:
""
//
//
}
//
//
}
//
//
}
//
}
}
}
pages/dataImport/data-import.vue
View file @
d445da23
...
...
@@ -13,7 +13,7 @@
</view>
<!-- 自定义 -->
<view>
<button
class=
"mini-btn"
type=
"default"
size=
"mini"
@
click=
"
selectCustomPolicyYear
"
>
自定义
</button>
<button
class=
"mini-btn"
type=
"default"
size=
"mini"
@
click=
"
policyYearModalFlag=true
"
>
自定义
</button>
</view>
</view>
<!-- 提示信息-->
...
...
@@ -27,7 +27,7 @@
<button
class=
"mini-btn pasteDiscernment"
type=
"default"
size=
"mini"
>
粘贴并识别
</button>
</view>
<!-- 批量数据输入区域 -->
<
view
class=
"batchDataLists
"
>
<
scroll-view
class=
"batchDataLists"
upper-threshold=
"200"
scroll-y=
"true
"
>
<view
class=
"batchDataTh"
>
<text>
保单年度
</text>
<text>
现金价值
</text>
...
...
@@ -36,7 +36,7 @@
<text>
{{
item
.
nyear
}}
</text>
<text>
{{
item
.
cashValue
}}
</text>
</view>
</view>
</
scroll-
view>
</view>
<!-- 操作 -->
<view
class=
"optionContent"
>
...
...
@@ -44,25 +44,25 @@
<button
type=
"default"
plain=
"true"
@
click=
"calcute()"
>
{{
calcuteMethod
==
'2'
?
'输入批量数据'
:
'开始计算'
}}
</button>
</view>
<!-- 保单年度选择弹窗 -->
<view
class=
"policySelectContainer"
>
<view
class=
"policySelectContainer"
v-if=
"policyYearModalFlag"
>
<view
class=
"policyYearContainer"
>
<view
class=
"modalTitle"
>
<text></text>
<text>
选择保单年度
<text>
(可多选)
</text></text>
<icon
:type=
"'clear'"
size=
"26"
/>
<icon
:type=
"'clear'"
size=
"26"
@
click=
"policyYearModalFlag=false"
/>
</view>
<view
class=
"policyStepContainer"
>
<button
type=
"default"
plain=
"true"
class=
"actived
"
>
1~40
</button>
<button
type=
"default"
plain=
"true"
>
41~80
</button>
<button
type=
"default"
plain=
"true"
>
81~105
</button>
<button
type=
"default"
plain=
"true"
:class=
"
{'actived': customPolicyYearRange===0 }" @click="selectPolicyYearRange(0)
">1~40
</button>
<button
type=
"default"
plain=
"true"
:class=
"
{'actived': customPolicyYearRange===1 }" @click="selectPolicyYearRange(1)"
>41~80
</button>
<button
type=
"default"
plain=
"true"
:class=
"
{'actived': customPolicyYearRange===2 }" @click="selectPolicyYearRange(2)"
>81~105
</button>
</view>
<view
class=
"policyYearItemContainer"
>
<view
v-for=
"item of
40
"
>
<text>
{{
item
}}
</text>
<view
v-for=
"item of
customPolicyYearRangeCount"
@
click=
"selectCustomPolicyYears(item + customPolicyYearRange * customPolicyYearRangeCount)"
:class=
"
{'actived':getActiveStatus(item + customPolicyYearRange * customPolicyYearRangeCount)}
">
<text>
{{
item
+
customPolicyYearRange
*
customPolicyYearRangeCount
>
105
?
''
:
item
+
customPolicyYearRange
*
customPolicyYearRangeCount
}}
</text>
</view>
</view>
<view
class=
"confirm"
>
<button
type=
"default"
plain=
"true"
>
确定
</button>
<button
type=
"default"
plain=
"true"
@
click=
"confirmPolicyYears()"
>
确定
</button>
</view>
</view>
</view>
...
...
@@ -77,7 +77,11 @@
index
:
0
,
stepLists
:[
1
,
5
,
10
,
15
,
20
],
pasteData
:
""
,
irrAndSimpleInfos
:[{
nyear
:
1
,
cashValue
:
''
}]
irrAndSimpleInfos
:[{
nyear
:
1
,
cashValue
:
''
}],
customPolicyYearRange
:
0
,
customPolicyYearRangeCount
:
40
,
policyYearLists
:[],
policyYearModalFlag
:
false
,
}
},
methods
:{
...
...
@@ -88,8 +92,37 @@
// 选择自定义
selectCustomPolicyYear
(){
},
// 选择保单年度区间
selectPolicyYearRange
(
e
){
this
.
customPolicyYearRange
=
e
;
},
// 选择保单年度(自定义)
selectCustomPolicyYears
(
e
){
console
.
log
(
e
)
if
(
this
.
policyYearLists
.
filter
(
item
=>
item
.
nyear
==
e
).
pop
()){
this
.
policyYearLists
.
filter
(
item
=>
item
.
nyear
==
e
).
pop
()[
'isActived'
]
=
!
this
.
policyYearLists
.
filter
(
item
=>
item
.
nyear
==
e
).
pop
()[
'isActived'
]
}
else
{
this
.
policyYearLists
.
push
({
nyear
:
e
,
isActived
:
true
,
cashValue
:
''
})
}
},
// 获取选中状态
getActiveStatus
(
e
){
let
status
=
false
;
if
(
this
.
policyYearLists
.
filter
(
item
=>
item
.
nyear
==
e
).
pop
()){
status
=
this
.
policyYearLists
.
filter
(
item
=>
item
.
nyear
==
e
).
pop
()[
'isActived'
]
}
return
status
;
},
// 确认选择的保单年度
confirmPolicyYears
(){
this
.
policyYearModalFlag
=
false
;
if
(
this
.
policyYearLists
.
length
>
0
){
this
.
policyYearLists
.
sort
((
a
,
b
)
=>
a
.
nyear
-
b
.
nyear
)
}
this
.
irrAndSimpleInfos
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
policyYearLists
));
}
}
}
</
script
>
...
...
@@ -206,32 +239,30 @@
.batchDataLists
{
margin-top
:
20
rpx
;
background
:
#fff
;
padding-bottom
:
120
rpx
;
}
.batchDataLists
>
view
{
.batchDataLists
view
{
display
:
flex
;
text-align
:
center
;
border-bottom
:
1px
solid
#e4e4e4
;
}
.batchDataLists
>
view
:last-child
{
border
:
none
;
}
.batchDataLists
>
view
text
:first-child
{
.batchDataLists
view
text
:first-child
{
width
:
0
;
flex
:
0
0
35%
;
border-right
:
1px
solid
#e4e4e4
;
}
.batchDataLists
>
view
text
:last-child
{
.batchDataLists
view
text
:last-child
{
width
:
0
;
flex
:
0
0
65%
;
}
.batchDataLists
>
view
.batchDataTh
{
.batchDataLists
view
.batchDataTh
{
height
:
60
rpx
;
background
:
linear-gradient
(
135deg
,
#CEB07D
0%
,
#FFDDA9
56%
,
#FED495
100%
,
#FED495
100%
);
line-height
:
60
rpx
;
border-top-left-radius
:
12
rpx
;
border-top-right-radius
:
12
rpx
;
}
.batchDataLists
>
view
.batchDataTd
{
.batchDataLists
view
.batchDataTd
{
height
:
80
rpx
;
line-height
:
80
rpx
;
}
...
...
pages/index/index.vue
View file @
d445da23
...
...
@@ -111,7 +111,7 @@
<view
class=
"batchCalculateContent"
v-show=
"calcuteMethod==='2'"
>
<img
src=
"/static/images/batchFileImport.png"
alt=
""
style=
"width: 50%;"
>
<text>
暂无数据
</text>
<text
style=
"font-size:
28r
px;margin-top: 10rpx;"
>
点击下方按钮输入批量数据
</text>
<text
style=
"font-size:
14
px;margin-top: 10rpx;"
>
点击下方按钮输入批量数据
</text>
</view>
</view>
<!-- 现金价值单利复利结果展示 -->
...
...
util/interceptor.ts
View file @
d445da23
import
api
from
"../api/api"
;
import
{
baseURL
,
apiURL
,
sfpURL
}
from
"../environments/environment"
;
// 白名单,不需要携带token就允许被访问的接口
const
whiteApiList
=
[
'/api/authorize/obtainToken'
]
const
whiteApiList
=
[
'
https://mdev.zuihuibi.cn
/api/authorize/obtainToken'
]
export
const
interceptor
=
()
=>
{
...
...
@@ -17,26 +17,26 @@ export const interceptor = () => {
})
// 当本地没有token,并且接口地址没在白名单内,需要重新获取token
//
if (!uni.getStorageSync('uni-token') && !whiteApiList.includes(args.url)) {
//
return new Promise((resolve, reject)=>{
//
uni.request({
//
url:'https://mdev.zuihuibi.cn/api/authorize/obtainToken',
//
method:'POST',
//
data:{ticket: 'uni-app'},
//
success: (res) => {
//
if(res.statusCode===200){
//
uni.setStorageSync('uni-token',res.data['data']['token']);
//
window.location.href = window.location.href + '?' + 't_reload=' + new Date().getTime();
//
}
//
console.log(res)
//
},fail(err) {
//
reject(err);
//
},
//
})
//
uni.hideLoading()
//
return false
//
})
//
}
if
(
!
uni
.
getStorageSync
(
'uni-token'
)
&&
!
whiteApiList
.
includes
(
args
.
url
))
{
return
new
Promise
((
resolve
,
reject
)
=>
{
uni
.
request
({
url
:
'https://mdev.zuihuibi.cn/api/authorize/obtainToken'
,
method
:
'POST'
,
data
:{
ticket
:
'uni-app'
},
success
:
(
res
)
=>
{
if
(
res
.
statusCode
===
200
){
uni
.
setStorageSync
(
'uni-token'
,
res
.
data
[
'data'
][
'token'
]);
window
.
location
.
href
=
window
.
location
.
href
+
'?'
+
't_reload='
+
new
Date
().
getTime
();
}
console
.
log
(
res
)
},
fail
(
err
)
{
reject
(
err
);
},
})
uni
.
hideLoading
()
return
false
})
}
// request 触发前拼接 url
//设置请求头及token
...
...
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