fix:维保查询独立前端项目
parent
cca2215a60
commit
1aa1e592af
|
|
@ -0,0 +1,3 @@
|
||||||
|
VUE_APP_TITLE=OMS-WB
|
||||||
|
ENV='development'
|
||||||
|
VUE_APP_BASE_API='/dev-api'
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
VUE_APP_TITLE=OMS-WB
|
||||||
|
ENV='production'
|
||||||
|
VUE_APP_BASE_API='/prod-api'
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
node_modules
|
||||||
|
/dist
|
||||||
|
/.idea
|
||||||
|
/.vscode
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
.DS_Store
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
module.exports = {
|
||||||
|
presets: ['@vue/cli-plugin-babel/preset']
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,27 @@
|
||||||
|
{
|
||||||
|
"name": "oms-wb-vue",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vue-cli-service serve",
|
||||||
|
"build": "vue-cli-service build"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"axios": "0.28.1",
|
||||||
|
"core-js": "3.37.1",
|
||||||
|
"element-ui": "2.15.14",
|
||||||
|
"vue": "2.6.12",
|
||||||
|
"vue-router": "3.4.9"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@vue/cli-plugin-babel": "4.4.6",
|
||||||
|
"@vue/cli-service": "4.4.6",
|
||||||
|
"sass": "1.32.13",
|
||||||
|
"sass-loader": "10.1.1",
|
||||||
|
"vue-template-compiler": "2.6.12"
|
||||||
|
},
|
||||||
|
"browserslist": [
|
||||||
|
"> 1%",
|
||||||
|
"last 2 versions"
|
||||||
|
]
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
|
|
@ -0,0 +1,16 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh-CN">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||||
|
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||||
|
<title><%= htmlWebpackPlugin.options.title %></title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<noscript>
|
||||||
|
<strong>请开启 JavaScript 后再使用该页面。</strong>
|
||||||
|
</noscript>
|
||||||
|
<div id="app"></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
<template>
|
||||||
|
<router-view />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'App'
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
html,
|
||||||
|
body,
|
||||||
|
#app {
|
||||||
|
height: 100%;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
* {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
function normalizeSerialNumbers(input) {
|
||||||
|
const values = Array.isArray(input) ? input : [input]
|
||||||
|
return [...new Set(values
|
||||||
|
.map(item => (item || '').toString().trim())
|
||||||
|
.filter(Boolean))]
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildQueryPayload(input) {
|
||||||
|
const serialNumbers = normalizeSerialNumbers(input)
|
||||||
|
return {
|
||||||
|
serialNumber: serialNumbers[0] || '',
|
||||||
|
serialNumbers
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getProductInfo(serialNumberOrNumbers) {
|
||||||
|
return request({
|
||||||
|
url: '/manage/service/product',
|
||||||
|
method: 'post',
|
||||||
|
data: buildQueryPayload(serialNumberOrNumbers)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getOrderInfo(serialNumberOrNumbers) {
|
||||||
|
return request({
|
||||||
|
url: '/manage/service/order',
|
||||||
|
method: 'post',
|
||||||
|
data: buildQueryPayload(serialNumberOrNumbers)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getWarrantyInfo(serialNumberOrNumbers) {
|
||||||
|
return request({
|
||||||
|
url: '/manage/service/query',
|
||||||
|
method: 'post',
|
||||||
|
data: buildQueryPayload(serialNumberOrNumbers)
|
||||||
|
})
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 152 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
|
|
@ -0,0 +1,13 @@
|
||||||
|
import Vue from 'vue'
|
||||||
|
import ElementUI from 'element-ui'
|
||||||
|
import 'element-ui/lib/theme-chalk/index.css'
|
||||||
|
import App from './App.vue'
|
||||||
|
import router from './router'
|
||||||
|
|
||||||
|
Vue.config.productionTip = false
|
||||||
|
Vue.use(ElementUI)
|
||||||
|
|
||||||
|
new Vue({
|
||||||
|
router,
|
||||||
|
render: h => h(App)
|
||||||
|
}).$mount('#app')
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
import Vue from 'vue'
|
||||||
|
import Router from 'vue-router'
|
||||||
|
import ServiceQuery from '@/views/manage/service/index.vue'
|
||||||
|
|
||||||
|
Vue.use(Router)
|
||||||
|
|
||||||
|
const router = new Router({
|
||||||
|
mode: 'hash',
|
||||||
|
routes: [
|
||||||
|
{
|
||||||
|
path: '/',
|
||||||
|
name: 'ServiceQuery',
|
||||||
|
component: ServiceQuery
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
|
export default router
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
import axios from 'axios'
|
||||||
|
import { Message } from 'element-ui'
|
||||||
|
|
||||||
|
const service = axios.create({
|
||||||
|
baseURL: process.env.VUE_APP_BASE_API,
|
||||||
|
timeout: 120000,
|
||||||
|
withCredentials: true,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json;charset=utf-8',
|
||||||
|
'X-Requested-With': 'H5'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
service.interceptors.response.use(
|
||||||
|
response => {
|
||||||
|
const res = response.data || {}
|
||||||
|
const code = res.code || 200
|
||||||
|
|
||||||
|
if (code === 200 || code === '200' || code === 0 || code === '0') {
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
const msg = res.msg || '请求失败'
|
||||||
|
Message.error(msg)
|
||||||
|
return Promise.reject(new Error(msg))
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
let message = error.message || '请求失败'
|
||||||
|
|
||||||
|
if (message === 'Network Error') {
|
||||||
|
message = '后端接口连接异常'
|
||||||
|
} else if (message.includes('timeout')) {
|
||||||
|
message = '系统接口请求超时'
|
||||||
|
} else if (message.includes('Request failed with status code')) {
|
||||||
|
message = '系统接口异常:' + message.slice(-3)
|
||||||
|
}
|
||||||
|
|
||||||
|
Message.error(message)
|
||||||
|
return Promise.reject(error)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
export default service
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,50 @@
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
const path = require('path')
|
||||||
|
|
||||||
|
function resolve(dir) {
|
||||||
|
return path.join(__dirname, dir)
|
||||||
|
}
|
||||||
|
|
||||||
|
const baseUrl = 'http://localhost:28080'
|
||||||
|
const port = process.env.port || process.env.npm_config_port || 8080
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
publicPath: '/',
|
||||||
|
outputDir: 'dist',
|
||||||
|
assetsDir: 'static',
|
||||||
|
productionSourceMap: false,
|
||||||
|
devServer: {
|
||||||
|
host: '0.0.0.0',
|
||||||
|
port,
|
||||||
|
open: true,
|
||||||
|
proxy: {
|
||||||
|
[process.env.VUE_APP_BASE_API]: {
|
||||||
|
target: baseUrl,
|
||||||
|
changeOrigin: true,
|
||||||
|
cookieDomainRewrite: {
|
||||||
|
'*': ''
|
||||||
|
},
|
||||||
|
pathRewrite: {
|
||||||
|
['^' + process.env.VUE_APP_BASE_API]: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
css: {
|
||||||
|
loaderOptions: {
|
||||||
|
sass: {
|
||||||
|
sassOptions: {
|
||||||
|
outputStyle: 'expanded'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
configureWebpack: {
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
'@': resolve('src')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue