Commit 3cebdea6 authored by 罗超's avatar 罗超

临时提交

parent cb10135f
...@@ -3,90 +3,90 @@ import axios from 'axios' ...@@ -3,90 +3,90 @@ import axios from 'axios'
import md5 from 'js-md5' import md5 from 'js-md5'
//域名管理对象 //域名管理对象
Vue.prototype.domainManager = function () { Vue.prototype.domainManager = function() {
let domainUrl = ''; let domainUrl = '';
domainUrl = "http://192.168.2.214:8082"; domainUrl = "http://192.168.2.214:8082";
domainUrl="http://192.168.0.110"; //domainUrl="http://192.168.0.110";
let locationName = window.location.hostname; let locationName = window.location.hostname;
if (locationName.indexOf('testerp.oytour') !== -1) { if (locationName.indexOf('testerp.oytour') !== -1) {
domainUrl = "http://testapi.oytour.com"; domainUrl = "http://testapi.oytour.com";
} else if (locationName.indexOf('oytour') !== -1) { } else if (locationName.indexOf('oytour') !== -1) {
domainUrl = "http://reborn.oytour.com"; domainUrl = "http://reborn.oytour.com";
} }
var obj = { var obj = {
//主地址 //主地址
DomainUrl: domainUrl, DomainUrl: domainUrl,
//常用提交数据URL //常用提交数据URL
PostUrl: domainUrl + "/api/common/post", PostUrl: domainUrl + "/api/common/post",
}; };
return obj; return obj;
} }
//HTTP提交数据 //HTTP提交数据
Vue.prototype.apipost = function (cmd, msg, successCall, faildCall) { Vue.prototype.apipost = function(cmd, msg, successCall, faildCall) {
if (msg == null || msg == "") { if (msg == null || msg == "") {
msg = {} msg = {}
} }
var timestamp = (new Date()).valueOf(); var timestamp = (new Date()).valueOf();
var apiurl = this.domainManager().PostUrl; var apiurl = this.domainManager().PostUrl;
var token = ""; var token = "";
var key = ""; var key = "";
var tempLanguage = 0; var tempLanguage = 0;
if (this.getLocalStorage() != null) { if (this.getLocalStorage() != null) {
token = this.getLocalStorage().token; token = this.getLocalStorage().token;
key = this.getLocalStorage().SecretKey; key = this.getLocalStorage().SecretKey;
} }
var encodeMsg = encodeURIComponent(JSON.stringify(msg)).toLowerCase(); var encodeMsg = encodeURIComponent(JSON.stringify(msg)).toLowerCase();
var md5Str = md5(`cmd=${cmd}&msg=${encodeMsg}&timestamp=${timestamp}&token=${token}&key=${key}`); var md5Str = md5(`cmd=${cmd}&msg=${encodeMsg}&timestamp=${timestamp}&token=${token}&key=${key}`);
var postData = { var postData = {
msg: msg, msg: msg,
cmd: cmd, cmd: cmd,
timestamp: timestamp, timestamp: timestamp,
token: token, token: token,
sign: md5Str, sign: md5Str,
languageId: tempLanguage languageId: tempLanguage
} }
this.$axios.post(apiurl, postData, { this.$axios.post(apiurl, postData, {
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'Referer-Viitto': this.$route.path 'Referer-Viitto': this.$route.path
} }
}) })
.then(res => { .then(res => {
successCall(res); successCall(res);
}, faildCall) }, faildCall)
} }
//获取缓存 //获取缓存
Vue.prototype.getLocalStorage = function () { Vue.prototype.getLocalStorage = function() {
var localStorageData = window.localStorage["b2bUser"]; var localStorageData = window.localStorage["b2bUser"];
if (localStorageData !== undefined && localStorageData != 'undefined') { if (localStorageData !== undefined && localStorageData != 'undefined') {
return JSON.parse(localStorageData); return JSON.parse(localStorageData);
} else { } else {
return null; return null;
} }
} }
//向外跳转 //向外跳转
Vue.prototype.OpenNewUrl = function (URL) { Vue.prototype.OpenNewUrl = function(URL) {
if (URL&&URL != '') { if (URL && URL != '') {
if (URL.indexOf("https") != -1) { if (URL.indexOf("https") != -1) {
var str = 'http://' + URL.substring(8); var str = 'http://' + URL.substring(8);
window.open(str, '_blank'); window.open(str, '_blank');
} else if (URL.indexOf("http") != -1) { } else if (URL.indexOf("http") != -1) {
var str = 'http://' + URL.substring(7); var str = 'http://' + URL.substring(7);
window.open(str, '_blank'); window.open(str, '_blank');
} else { } else {
window.open("http://" + URL, '_blank'); window.open("http://" + URL, '_blank');
}
} }
}
} }
//公用跳转 //公用跳转
Vue.prototype.CommonJump = function (path, obj) { Vue.prototype.CommonJump = function(path, obj) {
this.$router.push({ this.$router.push({
path: path, path: path,
query: obj query: obj
}); });
} }
\ No newline at end of file
<template>
</template>
<script>
export default {
}
</script>
<style>
</style>
\ No newline at end of file
<template>
<div>{{r}}</div>
</template>
<script>
export default {
data() {
return {
r: "",
r2: {
code: 0,
msg: "请求成功",
data: {
detail: {
id: 157017,
mall_id: 1285,
user_id: 57936,
token: "JP2RJdnGiUP3Kx-UKJpWVzT3mcBlqu",
data: { id: 167282, user_id: 57936, qr_code_id: 157017 },
created_at: "2020-06-28 11:45:58",
path: "pages/goods/goods",
use_number: 0
}
}
}
};
},
mounted() {
this.r = this.format(this.r2.data.detail.data);
},
methods: {
format(e, t) {
var n = "";
for (var i in this.r2.data.detail.data)
n += "&" + i + "=" + (t ? encodeURIComponent(e[i]) : e[i]);
return n.substr(1);
}
}
};
</script>
<style></style>
const routes = [{ const routes = [{
path: '/', path: '/',
component: () =>
import('layouts/HomeLayout.vue'),
children: [{
path: '',
component: () => component: () =>
import('pages/Index.vue') import ('layouts/HomeLayout.vue'),
}, children: [{
{ path: '',
path: '/Index', component: () =>
component: () => import ('pages/Index.vue')
import('pages/Index.vue') },
}, {
{ path: '/Index',
path: '/About', //关于我们 component: () =>
component: () => import ('pages/Index.vue')
import('pages/About.vue') },
}, { {
path: '/contract', //契约管理 path: '/About', //关于我们
component: () => component: () =>
import('pages/contract.vue') import ('pages/About.vue')
}, { }, {
path: '/tour_visa', //签证护照管理 path: '/contract', //契约管理
component: () => component: () =>
import('pages/tour_visa.vue') import ('pages/contract.vue')
} }, {
] path: '/tour_visa', //签证护照管理
}, component: () =>
import ('pages/tour_visa.vue')
}, {
path: '/search', //签证护照管理
component: () =>
import ('pages/search.vue')
}
]
},
] ]
// Always leave this as last one // Always leave this as last one
if (process.env.MODE !== 'ssr') { //if (process.env.MODE !== 'ssr') {
routes.push({ routes.push({
path: '*', path: '*',
component: () => component: () =>
import('pages/Error404.vue') import ('pages/Error404.vue')
}) })
} //}
export default routes export default routes
\ No newline at end of file
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