Commit 072e844f authored by xulili's avatar xulili

Merge remote-tracking branch 'origin/master'

parents 488e05ae cae71a8d
......@@ -158,6 +158,7 @@ export default {
})
.then(() => {
// 重定向对象不存在则返回顶层路径
// this.$router.replace(this.$route.query.redirect || '/homeMain')
this.$router.replace(this.$route.query.redirect || '/homeMain')
})
} else {
......
......@@ -9,7 +9,8 @@ module.exports = {
],
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-unused-vars': 'off'
},
parserOptions: {
parser: 'babel-eslint'
......
......@@ -3,6 +3,7 @@
"version": "0.1.0",
"private": true,
"scripts": {
"start": "vue-cli-service serve",
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
......
import request from '@/utils/request'
import request from '@/utils/requestEa'
// 案例
export function getCaseList(data) {
......
import request from '@/utils/request'
import request from '@/utils/requestEa'
export function ApiTestGet() {
return request({
......@@ -6,9 +6,20 @@ export function ApiTestGet() {
method: 'get'
})
}
export function ApiTestPost(inData) {
export function ApiTestCfPost(inData) {
let postData = {
args: inData
}
return request({
url: '',
method: 'post',
data: postData
})
}
export function ApiTestEaPost(inData) {
let postData = {
appCode: "0611",
args: inData
}
return request({
......
import axios from 'axios'
import { Message, MessageBox } from 'element-ui'
// import Router from '../router'
// import store from '../store'
// import { getToken } from '@/utils/auth'
const testEnv = require('../../config/dev.env')
// 创建axios实例
const service = axios.create({
baseURL: testEnv.BASE_API, // api 的 base_url
timeout: 50000 // 请求超时时间
})
// request拦截器
service.interceptors.request.use(
(config) => {
if (sessionStorage['token']) {
config.headers['token'] = sessionStorage['token']
config.headers['corpId'] = 'wwd1cdbca7b8b2b6c4'
config.headers['agentId'] = '1000015'
} else {
config.headers['businessId'] = '10'
}
return config;
},
(error) => {
Promise.reject(error)
}
)
// response 拦截器
service.interceptors.response.use(
response => {
console.log(response)
if(response.status == 200) {
return response.data
} else {
Message({
message: response.data.msg,
type: 'error',
duration: 5 * 1000
})
}
// let loadingSetting = Loading.service({
// fullscreen: true,
// lock: true,
// background: 'rgba(0,0,0,0.4)',
// text: '正在加载',
// spinner: 'el-icon-loading'
// })
// endLoading(loadingSetting)
// if (response.errorCode == '1001') {
// Router.push({ path: "/login" });
// }
},
error => {
console.log(error)
// console.log('err' + error) // for debug
// Message({
// message: error.message,
// type: 'error',
// duration: 50 * 1000
// })
// return Promise.reject(error)
}
)
// function endLoading (loading) {
// store.commit('LOADING', false)
// loading.close()
// }
// function startLoding () {
// store.commit('LOADING', true)
// }
export default service
import axios from 'axios'
import md5 from "js-md5"
let BASE_API = "https://gd.chfatech.com/guangdian"
const log = console.log.bind(console)
// let BASE_API = "https://gd.chfatech.com/guangdian"
let BASE_API = "http://111.26.165.55:8010/"
const zlog = console.log.bind(console)
// URL 编码与拼接
const createSign = (inPostData, inAppSecret) => {
......@@ -11,7 +13,7 @@ const createSign = (inPostData, inAppSecret) => {
let ts = inPostData.ts
let args = JSON.parse(JSON.stringify(inPostData.args));
let appSecret = inAppSecret
let res = "";
// URL 编码
......@@ -29,7 +31,7 @@ const createSign = (inPostData, inAppSecret) => {
// Basic Info
let basicInfo = {
appUser: "user001",
ver: "v1.0",
ver: "v2.17",
appSecret: "JeC0mmE2ZjZmOfdmTGImYzU5Yjg1AYU2M3F="
}
......@@ -42,11 +44,11 @@ const service = axios.create({
// request 拦截器
service.interceptors.request.use(
res => {
log('--->axios: res.data:', res.data)
// log('--->axios: res.data:', res.data)
let oldPostData = JSON.parse(JSON.stringify(res.data))
let newPostData = {
appUser: basicInfo.appUser,
appCode: oldPostData.appCode,
appCode: oldPostData.args.appCode,
ts: String(Date.parse(new Date())),
ver: basicInfo.ver,
args: oldPostData.args
......@@ -61,6 +63,9 @@ service.interceptors.request.use(
args: newPostData.args
}
delete postData.args.appCode
zlog()
res.data = postData
return res
......
import axios from 'axios'
export function wxRequest (url, data={}, header={}, method='post') {
// let URL = `http://172.16.0.111:8081${url}`
let URL = `http://139.155.48.151:8081${url}`
if(method == 'post') {
return new Promise(function(resolve, reject) {
axios({
url: URL,
method: method,
headers: header,
data: data
}).then(res => {
resolve(res.data)
}).catch(res => {
reject(res)
})
})
}
if(method == 'get') {
return new Promise(function(resolve, reject) {
axios({
url: URL,
method: method,
headers: header,
params: data
}).then(res => {
resolve(res.data)
}).catch(res => {
reject(res)
})
})
}
}
\ No newline at end of file
......@@ -14,7 +14,7 @@
<div class="main-money">{{item.money}}元代金券</div>
</div>
<div class="buttons">
<button class="button-send" @click="testButtonClick">推送</button>
<button class="button-send" @click="testApiCfPost">推送</button>
</div>
</div>
<div class="infos-tips">
......@@ -33,8 +33,8 @@
</template>
<script>
import { ApiTestGet, ApiTestPost } from "@/api/test/main";
const log = console.log.bind(console);
import { ApiTestCfPost, ApiTestEaPost } from "@/api/test/main";
// const log = console.log.bind(console);
export default {
name: "discountIndex",
......@@ -78,33 +78,29 @@ export default {
};
},
created() {
// this.testApiGet();
this.testApiPost();
},
methods: {
testApiGet() {
log("--->testApi: Start:");
ApiTestGet().then(res => {
log("--->Api: Get: res =", res);
testApiCfPost() {
let postData = {
appCode: '0606',
crmActionDate: '2020-01-10'
};
ApiTestCfPost(postData).then(res => {
});
log("--->testApi: End.");
},
testApiPost() {
log("--->testApi: Start:");
testApiEaPost() {
let postData = {
brief: "停车券兑换",
orderNo: "12345678",
point: "123.321",
procType: 46,
updateType: "dec",
vipId: 1
appCode: '0606',
crmActionDate: '2020-01-10'
};
ApiTestPost(postData).then(res => {
log("--->Api: Post: res =", res);
ApiTestEaPost(postData).then(res => {
});
log("--->testApi: End.");
},
testButtonClick() {},
testButtonClick() {
this.testApiPost()
},
buttonSingleMarketingClick() {
// this.$router.push("");
......
......@@ -1503,13 +1503,12 @@ aws4@^1.8.0:
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.9.0.tgz#24390e6ad61386b0a747265754d2a17219de862c"
integrity sha512-Uvq6hVe90D0B2WEnUqtdgY1bATGz3mw33nH9Y+dmA+w5DHvUmBgkr5rM/KCHpCsiFNRUfokW/szpPPgMK2hm4A==
axios@^0.19.0:
version "0.19.0"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.19.0.tgz#8e09bff3d9122e133f7b8101c8fbdd00ed3d2ab8"
integrity sha512-1uvKqKQta3KBxIz14F2v06AEHZ/dIoeKfbTRkK1E5oqjDnuEerLmYTgJB5AiQZHJcljpg1TuRzdjDR06qNk0DQ==
axios@^0.19.1:
version "0.19.1"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.19.1.tgz#8a6a04eed23dfe72747e1dd43c604b8f1677b5aa"
integrity sha512-Yl+7nfreYKaLRvAvjNPkvfjnQHJM1yLBY3zhqAwcJSwR/6ETkanUgylgtIvkvz0xJ+p/vZuNw8X7Hnb7Whsbpw==
dependencies:
follow-redirects "1.5.10"
is-buffer "^2.0.2"
babel-eslint@^10.0.3:
version "10.0.3"
......@@ -4404,11 +4403,6 @@ is-buffer@^1.1.5:
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be"
integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==
is-buffer@^2.0.2:
version "2.0.4"
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-2.0.4.tgz#3e572f23c8411a5cfd9557c849e3665e0b290623"
integrity sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==
is-callable@^1.1.4, is-callable@^1.1.5:
version "1.1.5"
resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.5.tgz#f7e46b596890456db74e7f6e976cb3273d06faab"
......
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