Commit d445da23 by Sweet Zhang

拦截器

parent 6e5d4852
...@@ -74,5 +74,27 @@ ...@@ -74,5 +74,27 @@
"base" : "/sfp/", "base" : "/sfp/",
"mode" : "hash" "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": ""
// // }
// // }
// // }
// }
} }
} }
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
</view> </view>
<!-- 自定义 --> <!-- 自定义 -->
<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>
</view> </view>
<!-- 提示信息--> <!-- 提示信息-->
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
<button class="mini-btn pasteDiscernment" type="default" size="mini">粘贴并识别</button> <button class="mini-btn pasteDiscernment" type="default" size="mini">粘贴并识别</button>
</view> </view>
<!-- 批量数据输入区域 --> <!-- 批量数据输入区域 -->
<view class="batchDataLists"> <scroll-view class="batchDataLists" upper-threshold="200" scroll-y="true">
<view class="batchDataTh"> <view class="batchDataTh">
<text>保单年度</text> <text>保单年度</text>
<text>现金价值</text> <text>现金价值</text>
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
<text>{{item.nyear}}</text> <text>{{item.nyear}}</text>
<text>{{item.cashValue}}</text> <text>{{item.cashValue}}</text>
</view> </view>
</view> </scroll-view>
</view> </view>
<!-- 操作 --> <!-- 操作 -->
<view class="optionContent"> <view class="optionContent">
...@@ -44,25 +44,25 @@ ...@@ -44,25 +44,25 @@
<button type="default" plain="true" @click="calcute()">{{calcuteMethod=='2' ? '输入批量数据' : '开始计算'}}</button> <button type="default" plain="true" @click="calcute()">{{calcuteMethod=='2' ? '输入批量数据' : '开始计算'}}</button>
</view> </view>
<!-- 保单年度选择弹窗 --> <!-- 保单年度选择弹窗 -->
<view class="policySelectContainer"> <view class="policySelectContainer" v-if="policyYearModalFlag">
<view class="policyYearContainer"> <view class="policyYearContainer">
<view class="modalTitle"> <view class="modalTitle">
<text></text> <text></text>
<text>选择保单年度<text>(可多选)</text></text> <text>选择保单年度<text>(可多选)</text></text>
<icon :type="'clear'" size="26"/> <icon :type="'clear'" size="26" @click="policyYearModalFlag=false"/>
</view> </view>
<view class="policyStepContainer"> <view class="policyStepContainer">
<button type="default" plain="true" class="actived">1~40</button> <button type="default" plain="true" :class="{'actived': customPolicyYearRange===0 }" @click="selectPolicyYearRange(0)">1~40</button>
<button type="default" plain="true">41~80</button> <button type="default" plain="true" :class="{'actived': customPolicyYearRange===1 }" @click="selectPolicyYearRange(1)">41~80</button>
<button type="default" plain="true">81~105</button> <button type="default" plain="true" :class="{'actived': customPolicyYearRange===2 }" @click="selectPolicyYearRange(2)">81~105</button>
</view> </view>
<view class="policyYearItemContainer"> <view class="policyYearItemContainer">
<view v-for="item of 40"> <view v-for="item of customPolicyYearRangeCount" @click="selectCustomPolicyYears(item + customPolicyYearRange * customPolicyYearRangeCount)" :class="{'actived':getActiveStatus(item + customPolicyYearRange * customPolicyYearRangeCount)}">
<text>{{item}}</text> <text>{{item + customPolicyYearRange * customPolicyYearRangeCount > 105 ? '' : item + customPolicyYearRange * customPolicyYearRangeCount}}</text>
</view> </view>
</view> </view>
<view class="confirm"> <view class="confirm">
<button type="default" plain="true">确定</button> <button type="default" plain="true" @click="confirmPolicyYears()">确定</button>
</view> </view>
</view> </view>
</view> </view>
...@@ -77,7 +77,11 @@ ...@@ -77,7 +77,11 @@
index:0, index:0,
stepLists:[1,5,10,15,20], stepLists:[1,5,10,15,20],
pasteData:"", pasteData:"",
irrAndSimpleInfos:[{nyear:1,cashValue:''}] irrAndSimpleInfos:[{nyear:1,cashValue:''}],
customPolicyYearRange:0,
customPolicyYearRangeCount:40,
policyYearLists:[],
policyYearModalFlag:false,
} }
}, },
methods:{ methods:{
...@@ -88,8 +92,37 @@ ...@@ -88,8 +92,37 @@
// 选择自定义 // 选择自定义
selectCustomPolicyYear(){ 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> </script>
...@@ -206,32 +239,30 @@ ...@@ -206,32 +239,30 @@
.batchDataLists{ .batchDataLists{
margin-top: 20rpx; margin-top: 20rpx;
background: #fff; background: #fff;
padding-bottom: 120rpx;
} }
.batchDataLists > view{ .batchDataLists view{
display: flex; display: flex;
text-align: center; text-align: center;
border-bottom: 1px solid #e4e4e4; border-bottom: 1px solid #e4e4e4;
} }
.batchDataLists > view:last-child{ .batchDataLists view text:first-child{
border: none;
}
.batchDataLists > view text:first-child{
width: 0; width: 0;
flex: 0 0 35%; flex: 0 0 35%;
border-right: 1px solid #e4e4e4; border-right: 1px solid #e4e4e4;
} }
.batchDataLists > view text:last-child{ .batchDataLists view text:last-child{
width: 0; width: 0;
flex: 0 0 65%; flex: 0 0 65%;
} }
.batchDataLists > view.batchDataTh{ .batchDataLists view.batchDataTh{
height: 60rpx; height: 60rpx;
background:linear-gradient(135deg, #CEB07D 0%, #FFDDA9 56%, #FED495 100%, #FED495 100%); background:linear-gradient(135deg, #CEB07D 0%, #FFDDA9 56%, #FED495 100%, #FED495 100%);
line-height: 60rpx; line-height: 60rpx;
border-top-left-radius: 12rpx; border-top-left-radius: 12rpx;
border-top-right-radius: 12rpx; border-top-right-radius: 12rpx;
} }
.batchDataLists > view.batchDataTd{ .batchDataLists view.batchDataTd{
height: 80rpx; height: 80rpx;
line-height: 80rpx; line-height: 80rpx;
} }
......
...@@ -111,7 +111,7 @@ ...@@ -111,7 +111,7 @@
<view class="batchCalculateContent" v-show="calcuteMethod==='2'"> <view class="batchCalculateContent" v-show="calcuteMethod==='2'">
<img src="/static/images/batchFileImport.png" alt="" style="width: 50%;"> <img src="/static/images/batchFileImport.png" alt="" style="width: 50%;">
<text>暂无数据</text> <text>暂无数据</text>
<text style="font-size: 28rpx;margin-top: 10rpx;">点击下方按钮输入批量数据</text> <text style="font-size: 14px;margin-top: 10rpx;">点击下方按钮输入批量数据</text>
</view> </view>
</view> </view>
<!-- 现金价值单利复利结果展示 --> <!-- 现金价值单利复利结果展示 -->
......
import api from "../api/api"; import api from "../api/api";
import {baseURL,apiURL,sfpURL} from "../environments/environment"; import {baseURL,apiURL,sfpURL} from "../environments/environment";
// 白名单,不需要携带token就允许被访问的接口 // 白名单,不需要携带token就允许被访问的接口
const whiteApiList = ['/api/authorize/obtainToken'] const whiteApiList = ['https://mdev.zuihuibi.cn/api/authorize/obtainToken']
export const interceptor = () => { export const interceptor = () => {
...@@ -17,26 +17,26 @@ export const interceptor = () => { ...@@ -17,26 +17,26 @@ export const interceptor = () => {
}) })
// 当本地没有token,并且接口地址没在白名单内,需要重新获取token // 当本地没有token,并且接口地址没在白名单内,需要重新获取token
// if (!uni.getStorageSync('uni-token') && !whiteApiList.includes(args.url)) { if (!uni.getStorageSync('uni-token') && !whiteApiList.includes(args.url)) {
// return new Promise((resolve, reject)=>{ return new Promise((resolve, reject)=>{
// uni.request({ uni.request({
// url:'https://mdev.zuihuibi.cn/api/authorize/obtainToken', url:'https://mdev.zuihuibi.cn/api/authorize/obtainToken',
// method:'POST', method:'POST',
// data:{ticket: 'uni-app'}, data:{ticket: 'uni-app'},
// success: (res) => { success: (res) => {
// if(res.statusCode===200){ if(res.statusCode===200){
// uni.setStorageSync('uni-token',res.data['data']['token']); uni.setStorageSync('uni-token',res.data['data']['token']);
// window.location.href = window.location.href + '?' + 't_reload=' + new Date().getTime(); window.location.href = window.location.href + '?' + 't_reload=' + new Date().getTime();
// } }
// console.log(res) console.log(res)
// },fail(err) { },fail(err) {
// reject(err); reject(err);
// }, },
// }) })
// uni.hideLoading() uni.hideLoading()
// return false return false
// }) })
// } }
// request 触发前拼接 url // request 触发前拼接 url
//设置请求头及token //设置请求头及token
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment