提交 caf01ce9 作者: 潘亚楠

合并分支 'dev' 到 'master'

引入用户操作指令,编写api,点击button发送api

查看合并请求 !1
# web_notebook # web_log_test
> A Vue.js project > 测试用户交互操作的日志收集
## Build Setup ## Build Setup
......
...@@ -23,7 +23,7 @@ module.exports = { ...@@ -23,7 +23,7 @@ module.exports = {
// Use Eslint Loader? // Use Eslint Loader?
// If true, your code will be linted during bundling and // If true, your code will be linted during bundling and
// linting errors and warnings will be shown in the console. // linting errors and warnings will be shown in the console.
useEslint: true, useEslint: false,
// If true, eslint errors and warnings will also be shown in the error overlay // If true, eslint errors and warnings will also be shown in the error overlay
// in the browser. // in the browser.
showEslintErrorsInOverlay: false, showEslintErrorsInOverlay: false,
......
...@@ -15119,9 +15119,9 @@ ...@@ -15119,9 +15119,9 @@
} }
}, },
"web_notebook-test1": { "web_notebook-test1": {
"version": "1.2.3", "version": "1.2.4",
"resolved": "http://39.106.145.141:9000/repository/node-public/web_notebook-test1/-/web_notebook-test1-1.2.3.tgz", "resolved": "http://39.106.145.141:9000/repository/node-public/web_notebook-test1/-/web_notebook-test1-1.2.4.tgz",
"integrity": "sha512-tsBfKkPaYnHc/1jA5J3Uh+g05ivdYklZOV6GyxnnkW9N8tKhisS3akBhjJncpzbvme7wGV56j1OWZFf7jcTOAg==", "integrity": "sha512-2DrOm/ooj89z2lmCOpwIMwmPj8cStnQ0BiEkQ59i/dn01j0jvJaRGmhlUFAutzgO75lEBjSF5/ML76UunHiePA==",
"requires": { "requires": {
"axios": "^0.18.0", "axios": "^0.18.0",
"vue-router": "^3.0.1", "vue-router": "^3.0.1",
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
"axios": "^0.18.0", "axios": "^0.18.0",
"vue-router": "^3.0.1", "vue-router": "^3.0.1",
"vuex": "^3.1.0", "vuex": "^3.1.0",
"web_notebook-test1": "^1.2.3" "web_notebook-test1": "^1.2.4"
}, },
"devDependencies": { "devDependencies": {
"autoprefixer": "^7.1.2", "autoprefixer": "^7.1.2",
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<el-header> <el-header>
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-button @click="$router.back()">首页</el-button> <el-button @click="$router.back()">返回</el-button>
</el-col> </el-col>
</el-row> </el-row>
</el-header> </el-header>
......
import request from '@/assets/js/axios.js';
/**
* 数据接口层
* @author author
* @date 2019-05-17
*/
const apiList = [
{
url:'/dev/rightServer',
method:'post',
defaultData:{
a:1
},
name:"rightServerPost"
},
{
url: '/dev/errorServer',
method: 'get',
name: 'errorServerGet',
}
]
const namespace = 'nodeApi';
request.add(namespace, apiList);
export default request.create(namespace);
\ No newline at end of file
import axios from '@/assets/js/axios.js';
/**
* 数据接口层
* @author author
* @date 2019-05-17
*/
export default {
/**
* @author author
* @information
* @date 2019-05-17
* @param {*} model 需要提交的数据
*/
getTableData (model) {
return axios.post('/business/notebook/query', model);
}
}
\ No newline at end of file
import axios from 'axios' import axios from 'axios'
import { Request } from 'web_notebook-test1';
axios.defaults.timeout = 60000 let version = 'v1'
axios.interceptors.request.use((config) => {
config.headers.token = window.token || ""
return config
}, (error) => {
return Promise.reject(error.response.data)
})
let path = { let path = {
// 开发 // 开发
development: `http://192.168.10.200:8020/upaLogs`, development: `http://192.168.10.200:8020/upaLogs`,
...@@ -21,14 +13,24 @@ let path = { ...@@ -21,14 +13,24 @@ let path = {
production: `https://gateway.allhome.com.cn/projectName/${version}` production: `https://gateway.allhome.com.cn/projectName/${version}`
} }
axios.defaults.baseURL = path[process.env.NODE_ENV]
/** // 组件库封装之后的请求
* 响应拦截器 const request = new Request({
* @author liuqiuyue baseURL: path[process.env.NODE_ENV],
* @date 2019-04-29 timeout: 60000,
*/ }, process.env.NODE_ENV, 'web_log_test');
axios.interceptors.response.use((res) => {
// token
const devToken = 'L2bhC0FyEWXo9zkt6mQ15lMzsSgS3dR/V+w5iWSiMmG0H0t1pL9lr4o+nSKXhjOm9qT+UrXqbLUpiWmITwS1q6TPmZvSumEkoEzpYFr0ylbxHafk+uE8yvK9OWiYl9WEH/JdnMw2LVnVYur7LOe/r57MMxw4e/NxGKPo07pqgn8=';
const token = window.token? window.token: (window.token = devToken);
// 设置拦截器
request.interceptors({
request: config => {
config.headers.token = token;
return config
},
response: res => {
let {message, result, statusCode} = res.data let {message, result, statusCode} = res.data
// 退出登录状态码 // 退出登录状态码
let logoutCodes = new Set([435001, 435011, 436050]) let logoutCodes = new Set([435001, 435011, 436050])
...@@ -44,8 +46,8 @@ axios.interceptors.response.use((res) => { ...@@ -44,8 +46,8 @@ axios.interceptors.response.use((res) => {
} else { } else {
return Promise.reject({message,statusCode}) return Promise.reject({message,statusCode})
} }
}, (error) => { },
return Promise.reject(error.response.data) error: error => Promise.reject(error.response.data),
}) })
export default axios; export default request;
\ No newline at end of file \ No newline at end of file
...@@ -8,14 +8,21 @@ import store from './store.js'; ...@@ -8,14 +8,21 @@ import store from './store.js';
import element from 'element-ui'; import element from 'element-ui';
// 引入扫描文件 // 引入扫描文件
import scan from './scanfile.js'; import scan from './scanfile.js';
// 操作收集指令
import collect from 'web_notebook-test1';
// debug
import debug from 'debug';
// 引入样式 // 引入样式
import './style/index.scss'; import './style/index.scss';
Vue.use(collect);
Vue.use(element); Vue.use(element);
Vue.use(scan); Vue.use(scan);
Vue.config.productionTip = false; Vue.config.productionTip = false;
console.log(process.env.NODE_ENV )
if (process.env.NODE_ENV === 'development') {
debug.enable('test*')
}
/* eslint-disable no-new */ /* eslint-disable no-new */
new Vue({ new Vue({
el: '#app', el: '#app',
......
...@@ -11,8 +11,10 @@ ...@@ -11,8 +11,10 @@
* @author 潘亚楠 * @author 潘亚楠
* @information button点击操作日志手机测试页 * @information button点击操作日志手机测试页
*/ */
import debug from 'debug'; import createDebug from 'debug';
console.log(debug); import nodeApi from '@/api/node'
const debug = createDebug('testButtonClick')
export default { export default {
name: 'ButtonClick', name: 'ButtonClick',
methods: { methods: {
...@@ -21,16 +23,25 @@ export default { ...@@ -21,16 +23,25 @@ export default {
* @author 潘亚楠 * @author 潘亚楠
* @information 服务器正常响应的点击事件 * @information 服务器正常响应的点击事件
*/ */
successfulClick() { async successfulClick() {
const model = {
"userName": "string",
"password": "string"
}
let res = await nodeApi.rightServerPost({
param: [1, 2],
data: model
});
}, },
/** /**
* @date 2019.10.24 * @date 2019.10.24
* @author 潘亚楠 * @author 潘亚楠
* @information 服务器异常响应的点击事件 * @information 服务器异常响应的点击事件
*/ */
errorClick() { async errorClick() {
await nodeApi.errorServerGet({
query: {test: 111}
})
} }
} }
} }
......
<template> <template>
<div id="index"> <div id="index">
<el-button @click="$router.push('buttonClick')">按钮测试</el-button> <el-card class="box-card">
<qj-demo message="基础组件说明"></qj-demo> <div>
<qj-business msg1="业务组件说明"></qj-business> <div class='title'>Button点击</div>
<div v-for="o in 4" :key="o" class="text item">
{{'说明TODO ' + o }}
</div>
</div>
<template slot="footer">
<div>
发布人:张某某
</div>
<div>
<el-button type="info" plain @click="$router.push('buttonClick')">按钮测试页</el-button>
</div>
</template>
</el-card>
</div> </div>
</template> </template>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论