import { $post } from '@/lu/axios.js' import $config from '@/config.js' const app_path = 'App' let url = '' let gzh = { id: '', jump: '', auth: '' } const urlPick = () => { if ($config.config.length > 0) { url = $config.config[0].url gzh = $config.config[0].gzh for (let i in $config.config) { if (!!$config.config[i].active) { url = $config.config[i].url gzh = $config.config[i].gzh break } } } } urlPick() export const GzhConfig = gzh export const WeChatPayPayTestAction = async (data) => await $post({ url: `${url}/api/Test/WeChatPay/pay_test`, data }) export const WeChatLoginTestAction = async (data) => await $post({ url: `${url}/api/Test/WeChat/login_test`, data }) export const yo = async (data) => await $post({ url: `${url}/api/yo`, data }) export const $image = (path) => { const path_ret = ['http://', 'https://', ';base64,'] for (let i = 0; i < path_ret.length; i++) { if (path.indexOf(path_ret[i]) !== -1) { return path } } return `${$config.url}${path}` } export const $response = (response, then, error = () => {}) => { if (response) { if (response.code != 200) { uni.$lu.toast(response.message); error() return } then() } }