Commit 8306be9e by kyle

登录logo路径修改

parent 91ab25ee
<template> <template>
<view class="wrapper"> <view class="wrapper">
<view class="logo"> <view class="logo">
<img src="/static/cffp_logo.jpg" alt="logo" srcset=""> <img :src="imgSrc" alt="logo" srcset="">
<view>欢迎登录使用CFFP</view> <view>欢迎登录使用CFFP</view>
</view> </view>
<view class="content"> <view class="content">
...@@ -97,7 +97,8 @@ ...@@ -97,7 +97,8 @@
account:null, account:null,
doublePassword:null, doublePassword:null,
agreeFlag:false, agreeFlag:false,
userId:null userId:null,
imgSrc:'static/cffp_logo.jpg'
} }
}, },
methods: { methods: {
...@@ -292,9 +293,22 @@ ...@@ -292,9 +293,22 @@
password:null, password:null,
} }
}, },
checkToken(){
api.checkToken().then(res=>{
if(res['success']){}else{
api.obtainToken().then(res=>{
if(res.success){
uni.setStorageSync('uni-token',res.data['token']);
}
})
}
})
},
}, },
mounted() { mounted() {
this.checkToken()
} }
} }
</script> </script>
......
...@@ -88,20 +88,20 @@ ...@@ -88,20 +88,20 @@
"router" : { "router" : {
"base" : "/cffp/", "base" : "/cffp/",
"mode" : "history" "mode" : "history"
},
"devServer" : {
"proxy" : {
"/api" : {
"port" : 3000, // 端口号
"target" : "https://mdev.zuihuibi.cn", //请求的目标域名
"changeOrigin" : true, //是否跨域
"secure" : false, //设置支持https协议的代理
"logLevel" : "debug",
"pathRewrite" : {
"^/api" : ""
}
}
}
} }
// "devServer" : {
// "proxy" : {
// "/api" : {
// "port" : 3000, // 端口号
// "target" : "https://mdev.zuihuibi.cn", //请求的目标域名
// "changeOrigin" : true, //是否跨域
// "secure" : false, //设置支持https协议的代理
// "logLevel" : "debug",
// "pathRewrite" : {
// "^/api" : ""
// }
// }
// }
// }
} }
} }
...@@ -10,14 +10,14 @@ export const interceptor = () => { ...@@ -10,14 +10,14 @@ export const interceptor = () => {
// 请求拦截器 // 请求拦截器
invoke(args) { invoke(args) {
// console.log('请求拦截器',args); console.log('请求拦截器',args);
// 加载loading // 加载loading
uni.showLoading({ uni.showLoading({
title: '加载中...' title: '加载中...'
}) })
// 当本地没有token,并且接口地址没在白名单内,需要重新获取token // 当本地没有token,并且接口地址没在白名单内,需要重新获取token
if (!uni.getStorageSync('uni-token') && !whiteApiList.includes(args.url)) { if (!uni.getStorageSync('uni-token') && !whiteApiList.includes(args.url)) {
// console.log('-----------') console.log('-----------')
return new Promise((resolve, reject)=>{ return new Promise((resolve, reject)=>{
uni.request({ uni.request({
url: '/api/authorize/obtainToken', url: '/api/authorize/obtainToken',
...@@ -44,7 +44,7 @@ export const interceptor = () => { ...@@ -44,7 +44,7 @@ export const interceptor = () => {
'content-type': args.method === 'POST' ? 'application/json' : 'application/x-www-form-urlencoded', 'content-type': args.method === 'POST' ? 'application/json' : 'application/x-www-form-urlencoded',
'X-Authorization': uni.getStorageSync('uni-token') 'X-Authorization': uni.getStorageSync('uni-token')
} }
// console.log(args.header) console.log(args.header)
}, },
// 响应拦截器,可以对数据进行预处理 // 响应拦截器,可以对数据进行预处理
......
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