| | |
| | | import { Toast } from "vant"; |
| | | import i18n from "@/i18n"; |
| | | import router from "@/router/router"; |
| | | import urlKyc from "./urlKyc"; |
| | | import { signatureGenerate } from "@/utils/signatureUtil"; |
| | | import { getStorage } from "@/utils/utis"; |
| | | axios.defaults.headers.post["Content-Type"] = |
| | | "application/x-www-form-urlencoded"; |
| | | |
| | | let baseUrl = "https://stock.niveshnav.com/wap/"; |
| | | let baseUrl = "https://api.usdtone.com/wap/"; |
| | | // let baseUrl = "http://192.168.0.105:18080/wap/"; |
| | | |
| | | // 创建 |
| | |
| | | // 拦截请求 |
| | | request.interceptors.request.use( |
| | | (config) => { |
| | | const arr = urlKyc.filter((item) => item === config.url); |
| | | if (arr.length !== 0 && store.state.user.kyc !== 2) { |
| | | return Toast.fail(i18n.t("请先实名认证!")); |
| | | } |
| | | if (config.loading) { |
| | | Toast.loading({ duration: 0, forbidClick: true }); |
| | | } |
| | |
| | | const { timestamp, signature } = signatureGenerate(); |
| | | if (timestamp) config.headers["tissuePaper"] = timestamp; |
| | | if (signature) config.headers["sign"] = signature; |
| | | config.headers["lang"] = getStorage("lang") || "en"; |
| | | return config; |
| | | }, |
| | | (error) => { |