Shuaishuai Dai
2 years ago
commit
50f9ab4191
32 changed files with 14896 additions and 0 deletions
@ -0,0 +1,9 @@
@@ -0,0 +1,9 @@
|
||||
root = true |
||||
|
||||
[*] |
||||
charset = utf-8 |
||||
indent_style = space |
||||
indent_size = 2 |
||||
end_of_line = lf |
||||
insert_final_newline = true |
||||
trim_trailing_whitespace = true |
@ -0,0 +1,7 @@
@@ -0,0 +1,7 @@
|
||||
/dist |
||||
/src-bex/www |
||||
/src-capacitor |
||||
/src-cordova |
||||
/.quasar |
||||
/node_modules |
||||
.eslintrc.js |
@ -0,0 +1,66 @@
@@ -0,0 +1,66 @@
|
||||
|
||||
module.exports = { |
||||
// https://eslint.org/docs/user-guide/configuring#configuration-cascading-and-hierarchy
|
||||
// This option interrupts the configuration hierarchy at this file
|
||||
// Remove this if you have an higher level ESLint config file (it usually happens into a monorepos)
|
||||
root: true, |
||||
|
||||
parserOptions: { |
||||
parser: '@babel/eslint-parser', |
||||
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
|
||||
sourceType: 'module' // Allows for the use of imports
|
||||
}, |
||||
|
||||
env: { |
||||
browser: true, |
||||
'vue/setup-compiler-macros': true |
||||
}, |
||||
|
||||
// Rules order is important, please avoid shuffling them
|
||||
extends: [ |
||||
// Base ESLint recommended rules
|
||||
// 'eslint:recommended',
|
||||
|
||||
// Uncomment any of the lines below to choose desired strictness,
|
||||
// but leave only one uncommented!
|
||||
// See https://eslint.vuejs.org/rules/#available-rules (look for Vuejs 2 ones)
|
||||
'plugin:vue/essential', // Priority A: Essential (Error Prevention)
|
||||
// 'plugin:vue/strongly-recommended', // Priority B: Strongly Recommended (Improving Readability)
|
||||
// 'plugin:vue/recommended', // Priority C: Recommended (Minimizing Arbitrary Choices and Cognitive Overhead)
|
||||
|
||||
// https://github.com/prettier/eslint-config-prettier#installation
|
||||
// usage with Prettier, provided by 'eslint-config-prettier'.
|
||||
'prettier' |
||||
], |
||||
|
||||
plugins: [ |
||||
// https://eslint.vuejs.org/user-guide/#why-doesn-t-it-work-on-vue-file
|
||||
// required to lint *.vue files
|
||||
'vue', |
||||
|
||||
// https://github.com/typescript-eslint/typescript-eslint/issues/389#issuecomment-509292674
|
||||
// Prettier has not been included as plugin to avoid performance impact
|
||||
// add it as an extension for your IDE
|
||||
|
||||
], |
||||
|
||||
globals: { |
||||
ga: 'readonly', // Google Analytics
|
||||
cordova: 'readonly', |
||||
__statics: 'readonly', |
||||
process: 'readonly', |
||||
Capacitor: 'readonly', |
||||
chrome: 'readonly' |
||||
}, |
||||
|
||||
// add your custom rules here
|
||||
rules: { |
||||
|
||||
'prefer-promise-reject-errors': 'off', |
||||
|
||||
'vue/multi-word-component-names': 'off', |
||||
|
||||
// allow debugger during development only
|
||||
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off' |
||||
} |
||||
} |
@ -0,0 +1,33 @@
@@ -0,0 +1,33 @@
|
||||
.DS_Store |
||||
.thumbs.db |
||||
node_modules |
||||
|
||||
# Quasar core related directories |
||||
.quasar |
||||
/dist |
||||
|
||||
# Cordova related directories and files |
||||
/src-cordova/node_modules |
||||
/src-cordova/platforms |
||||
/src-cordova/plugins |
||||
/src-cordova/www |
||||
|
||||
# Capacitor related directories and files |
||||
/src-capacitor/www |
||||
/src-capacitor/node_modules |
||||
|
||||
# BEX related directories and files |
||||
/src-bex/www |
||||
/src-bex/js/core |
||||
|
||||
# Log files |
||||
npm-debug.log* |
||||
yarn-debug.log* |
||||
yarn-error.log* |
||||
|
||||
# Editor directories and files |
||||
.idea |
||||
*.suo |
||||
*.ntvs* |
||||
*.njsproj |
||||
*.sln |
@ -0,0 +1,8 @@
@@ -0,0 +1,8 @@
|
||||
// https://github.com/michael-ciniawsky/postcss-load-config
|
||||
|
||||
module.exports = { |
||||
plugins: [ |
||||
// to edit target browsers: use "browserslist" field in package.json
|
||||
require('autoprefixer') |
||||
] |
||||
} |
@ -0,0 +1,12 @@
@@ -0,0 +1,12 @@
|
||||
{ |
||||
"recommendations": [ |
||||
"dbaeumer.vscode-eslint", |
||||
"esbenp.prettier-vscode", |
||||
"octref.vetur" |
||||
], |
||||
"unwantedRecommendations": [ |
||||
"hookyqr.beautify", |
||||
"dbaeumer.jshint", |
||||
"ms-vscode.vscode-typescript-tslint-plugin" |
||||
] |
||||
} |
@ -0,0 +1,11 @@
@@ -0,0 +1,11 @@
|
||||
{ |
||||
"vetur.validation.template": false, |
||||
"vetur.format.enable": false, |
||||
"eslint.validate": [ |
||||
"javascript", |
||||
"javascriptreact", |
||||
"typescript", |
||||
"vue" |
||||
], |
||||
"vetur.experimental.templateInterpolationService": true |
||||
} |
@ -0,0 +1,31 @@
@@ -0,0 +1,31 @@
|
||||
# chatbot (chatbot-web) |
||||
|
||||
chatbot web |
||||
|
||||
## Install the dependencies |
||||
```bash |
||||
yarn |
||||
# or |
||||
npm install |
||||
``` |
||||
|
||||
### Start the app in development mode (hot-code reloading, error reporting, etc.) |
||||
```bash |
||||
quasar dev |
||||
``` |
||||
|
||||
|
||||
### Lint the files |
||||
```bash |
||||
yarn lint |
||||
# or |
||||
npm run lint |
||||
``` |
||||
|
||||
### Build the app for production |
||||
```bash |
||||
quasar build |
||||
``` |
||||
|
||||
### Customize the configuration |
||||
See [Configuring quasar.conf.js](https://v1.quasar.dev/quasar-cli/quasar-conf-js). |
@ -0,0 +1,7 @@
@@ -0,0 +1,7 @@
|
||||
/* eslint-env node */ |
||||
|
||||
module.exports = { |
||||
presets: [ |
||||
'@quasar/babel-preset-app' |
||||
] |
||||
} |
@ -0,0 +1,36 @@
@@ -0,0 +1,36 @@
|
||||
{ |
||||
"compilerOptions": { |
||||
"baseUrl": ".", |
||||
"paths": { |
||||
"src/*": [ |
||||
"src/*" |
||||
], |
||||
"app/*": [ |
||||
"*" |
||||
], |
||||
"components/*": [ |
||||
"src/components/*" |
||||
], |
||||
"layouts/*": [ |
||||
"src/layouts/*" |
||||
], |
||||
"pages/*": [ |
||||
"src/pages/*" |
||||
], |
||||
"assets/*": [ |
||||
"src/assets/*" |
||||
], |
||||
"boot/*": [ |
||||
"src/boot/*" |
||||
], |
||||
"vue$": [ |
||||
"node_modules/vue/dist/vue.esm.js" |
||||
] |
||||
} |
||||
}, |
||||
"exclude": [ |
||||
"dist", |
||||
".quasar", |
||||
"node_modules" |
||||
] |
||||
} |
@ -0,0 +1,44 @@
@@ -0,0 +1,44 @@
|
||||
{ |
||||
"name": "chatbot-web", |
||||
"version": "0.0.1", |
||||
"description": "chatbot web ", |
||||
"productName": "chatbot", |
||||
"author": "dashan <dashanblog@163.com>", |
||||
"private": true, |
||||
"scripts": { |
||||
"lint": "eslint --ext .js,.vue ./", |
||||
"test": "echo \"No test specified\" && exit 0" |
||||
}, |
||||
"dependencies": { |
||||
"@quasar/extras": "^1.0.0", |
||||
"core-js": "^3.6.5", |
||||
"quasar": "^1.0.0" |
||||
}, |
||||
"devDependencies": { |
||||
"@babel/eslint-parser": "^7.13.14", |
||||
"@quasar/app": "^2.0.0", |
||||
"axios": "^1.3.2", |
||||
"eslint": "^8.10.0", |
||||
"eslint-config-prettier": "^8.1.0", |
||||
"eslint-plugin-vue": "^9.0.0", |
||||
"eslint-webpack-plugin": "^2.0.0", |
||||
"prettier": "^2.5.1", |
||||
"qs": "^6.11.0" |
||||
}, |
||||
"browserslist": [ |
||||
"last 10 Chrome versions", |
||||
"last 10 Firefox versions", |
||||
"last 4 Edge versions", |
||||
"last 7 Safari versions", |
||||
"last 8 Android versions", |
||||
"last 8 ChromeAndroid versions", |
||||
"last 8 FirefoxAndroid versions", |
||||
"last 10 iOS versions", |
||||
"last 5 Opera versions" |
||||
], |
||||
"engines": { |
||||
"node": ">= 10.18.1", |
||||
"npm": ">= 6.13.4", |
||||
"yarn": ">= 1.21.1" |
||||
} |
||||
} |
After Width: | Height: | Size: 63 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 859 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 9.4 KiB |
@ -0,0 +1,206 @@
@@ -0,0 +1,206 @@
|
||||
/* eslint-env node */ |
||||
|
||||
/* |
||||
* This file runs in a Node context (it's NOT transpiled by Babel), so use only |
||||
* the ES6 features that are supported by your Node version. https://node.green/
|
||||
*/ |
||||
|
||||
// Configuration for your app
|
||||
// https://v1.quasar.dev/quasar-cli/quasar-conf-js
|
||||
|
||||
const ESLintPlugin = require('eslint-webpack-plugin') |
||||
|
||||
module.exports = function (/* ctx */) { |
||||
return { |
||||
// https://v1.quasar.dev/quasar-cli/supporting-ts
|
||||
supportTS: false, |
||||
|
||||
// https://v1.quasar.dev/quasar-cli/prefetch-feature
|
||||
// preFetch: true,
|
||||
|
||||
// app boot file (/src/boot)
|
||||
// --> boot files are part of "main.js"
|
||||
// https://v1.quasar.dev/quasar-cli/boot-files
|
||||
boot: [ |
||||
|
||||
|
||||
], |
||||
|
||||
// https://v1.quasar.dev/quasar-cli/quasar-conf-js#Property%3A-css
|
||||
css: [ |
||||
'app.scss' |
||||
], |
||||
|
||||
// https://github.com/quasarframework/quasar/tree/dev/extras
|
||||
extras: [ |
||||
// 'ionicons-v4',
|
||||
// 'mdi-v5',
|
||||
// 'fontawesome-v6',
|
||||
// 'eva-icons',
|
||||
// 'themify',
|
||||
// 'line-awesome',
|
||||
// 'roboto-font-latin-ext', // this or either 'roboto-font', NEVER both!
|
||||
|
||||
'roboto-font', // optional, you are not bound to it
|
||||
'material-icons', // optional, you are not bound to it
|
||||
], |
||||
|
||||
// Full list of options: https://v1.quasar.dev/quasar-cli/quasar-conf-js#Property%3A-build
|
||||
build: { |
||||
vueRouterMode: 'hash', // available values: 'hash', 'history'
|
||||
|
||||
// transpile: false,
|
||||
|
||||
// Add dependencies for transpiling with Babel (Array of string/regex)
|
||||
// (from node_modules, which are by default not transpiled).
|
||||
// Applies only if "transpile" is set to true.
|
||||
// transpileDependencies: [],
|
||||
|
||||
// rtl: false, // https://v1.quasar.dev/options/rtl-support
|
||||
// preloadChunks: true,
|
||||
// showProgress: false,
|
||||
// gzip: true,
|
||||
// analyze: true,
|
||||
|
||||
// Options below are automatically set depending on the env, set them if you want to override
|
||||
// extractCSS: false,
|
||||
|
||||
// https://v1.quasar.dev/quasar-cli/handling-webpack
|
||||
// "chain" is a webpack-chain object https://github.com/neutrinojs/webpack-chain
|
||||
chainWebpack (chain) { |
||||
chain.plugin('eslint-webpack-plugin') |
||||
.use(ESLintPlugin, [{ extensions: [ 'js', 'vue' ] }]) |
||||
} |
||||
}, |
||||
|
||||
// Full list of options: https://v1.quasar.dev/quasar-cli/quasar-conf-js#Property%3A-devServer
|
||||
devServer: { |
||||
https: false, |
||||
port: 8080, |
||||
open: true, // opens browser window automatically
|
||||
proxy: { |
||||
// 接口地址代理
|
||||
'/': { |
||||
target: 'http://localhost:8090', // 接口的域名
|
||||
secure: false, // 如果是https接口,需要配置这个参数
|
||||
changeOrigin: true // 如果接口跨域,需要进行这个参数配置
|
||||
} |
||||
}
|
||||
}, |
||||
|
||||
// https://v1.quasar.dev/quasar-cli/quasar-conf-js#Property%3A-framework
|
||||
framework: { |
||||
iconSet: 'material-icons', // Quasar icon set
|
||||
lang: 'en-us', // Quasar language pack
|
||||
config: {}, |
||||
|
||||
// Possible values for "importStrategy":
|
||||
// * 'auto' - (DEFAULT) Auto-import needed Quasar components & directives
|
||||
// * 'all' - Manually specify what to import
|
||||
importStrategy: 'auto', |
||||
|
||||
// For special cases outside of where "auto" importStrategy can have an impact
|
||||
// (like functional components as one of the examples),
|
||||
// you can manually specify Quasar components/directives to be available everywhere:
|
||||
//
|
||||
// components: [],
|
||||
// directives: [],
|
||||
|
||||
// Quasar plugins
|
||||
plugins: [] |
||||
}, |
||||
|
||||
// animations: 'all', // --- includes all animations
|
||||
// https://v1.quasar.dev/options/animations
|
||||
animations: [], |
||||
|
||||
// https://v1.quasar.dev/quasar-cli/developing-ssr/configuring-ssr
|
||||
ssr: { |
||||
pwa: false |
||||
}, |
||||
|
||||
// https://v1.quasar.dev/quasar-cli/developing-pwa/configuring-pwa
|
||||
pwa: { |
||||
workboxPluginMode: 'GenerateSW', // 'GenerateSW' or 'InjectManifest'
|
||||
workboxOptions: {}, // only for GenerateSW
|
||||
manifest: { |
||||
name: `chatbot`, |
||||
short_name: `chatbot`, |
||||
description: `chatbot web `, |
||||
display: 'standalone', |
||||
orientation: 'portrait', |
||||
background_color: '#ffffff', |
||||
theme_color: '#027be3', |
||||
icons: [ |
||||
{ |
||||
src: 'icons/icon-128x128.png', |
||||
sizes: '128x128', |
||||
type: 'image/png' |
||||
}, |
||||
{ |
||||
src: 'icons/icon-192x192.png', |
||||
sizes: '192x192', |
||||
type: 'image/png' |
||||
}, |
||||
{ |
||||
src: 'icons/icon-256x256.png', |
||||
sizes: '256x256', |
||||
type: 'image/png' |
||||
}, |
||||
{ |
||||
src: 'icons/icon-384x384.png', |
||||
sizes: '384x384', |
||||
type: 'image/png' |
||||
}, |
||||
{ |
||||
src: 'icons/icon-512x512.png', |
||||
sizes: '512x512', |
||||
type: 'image/png' |
||||
} |
||||
] |
||||
} |
||||
}, |
||||
|
||||
// Full list of options: https://v1.quasar.dev/quasar-cli/developing-cordova-apps/configuring-cordova
|
||||
cordova: { |
||||
// noIosLegacyBuildFlag: true, // uncomment only if you know what you are doing
|
||||
}, |
||||
|
||||
// Full list of options: https://v1.quasar.dev/quasar-cli/developing-capacitor-apps/configuring-capacitor
|
||||
capacitor: { |
||||
hideSplashscreen: true |
||||
}, |
||||
|
||||
// Full list of options: https://v1.quasar.dev/quasar-cli/developing-electron-apps/configuring-electron
|
||||
electron: { |
||||
bundler: 'packager', // 'packager' or 'builder'
|
||||
|
||||
packager: { |
||||
// https://github.com/electron-userland/electron-packager/blob/master/docs/api.md#options
|
||||
|
||||
// OS X / Mac App Store
|
||||
// appBundleId: '',
|
||||
// appCategoryType: '',
|
||||
// osxSign: '',
|
||||
// protocol: 'myapp://path',
|
||||
|
||||
// Windows only
|
||||
// win32metadata: { ... }
|
||||
}, |
||||
|
||||
builder: { |
||||
// https://www.electron.build/configuration/configuration
|
||||
|
||||
appId: 'chatbot-web' |
||||
}, |
||||
|
||||
// More info: https://v1.quasar.dev/quasar-cli/developing-electron-apps/node-integration
|
||||
nodeIntegration: true, |
||||
|
||||
extendWebpack (/* cfg */) { |
||||
// do something with Electron main process Webpack cfg
|
||||
// chainWebpack also available besides this extendWebpack
|
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,11 @@
@@ -0,0 +1,11 @@
|
||||
<template> |
||||
<div id="q-app"> |
||||
<router-view /> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
name: 'App' |
||||
} |
||||
</script> |
@ -0,0 +1,7 @@
@@ -0,0 +1,7 @@
|
||||
import service from "../../utils/request"; |
||||
export const sendQuestion= (param)=>{ |
||||
return service({//获取新闻列表
|
||||
url:'/bot?question='+param, |
||||
method:'get' |
||||
}) |
||||
} |
@ -0,0 +1,49 @@
@@ -0,0 +1,49 @@
|
||||
<template> |
||||
<q-item |
||||
clickable |
||||
tag="a" |
||||
target="_blank" |
||||
:href="link" |
||||
> |
||||
<q-item-section |
||||
v-if="icon" |
||||
avatar |
||||
> |
||||
<q-icon :name="icon" /> |
||||
</q-item-section> |
||||
|
||||
<q-item-section> |
||||
<q-item-label>{{ title }}</q-item-label> |
||||
<q-item-label caption> |
||||
{{ caption }} |
||||
</q-item-label> |
||||
</q-item-section> |
||||
</q-item> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
name: 'EssentialLink', |
||||
props: { |
||||
title: { |
||||
type: String, |
||||
required: true |
||||
}, |
||||
|
||||
caption: { |
||||
type: String, |
||||
default: '' |
||||
}, |
||||
|
||||
link: { |
||||
type: String, |
||||
default: '#' |
||||
}, |
||||
|
||||
icon: { |
||||
type: String, |
||||
default: '' |
||||
} |
||||
} |
||||
} |
||||
</script> |
@ -0,0 +1,25 @@
@@ -0,0 +1,25 @@
|
||||
// Quasar SCSS (& Sass) Variables |
||||
// -------------------------------------------------- |
||||
// To customize the look and feel of this app, you can override |
||||
// the Sass/SCSS variables found in Quasar's source Sass/SCSS files. |
||||
|
||||
// Check documentation for full list of Quasar variables |
||||
|
||||
// Your own variables (that are declared here) and Quasar's own |
||||
// ones will be available out of the box in your .vue/.scss/.sass files |
||||
|
||||
// It's highly recommended to change the default colors |
||||
// to match your app's branding. |
||||
// Tip: Use the "Theme Builder" on Quasar's documentation website. |
||||
|
||||
$primary : #1976D2; |
||||
$secondary : #26A69A; |
||||
$accent : #9C27B0; |
||||
|
||||
$dark : #1D1D1D; |
||||
$dark-page : #121212; |
||||
|
||||
$positive : #21BA45; |
||||
$negative : #C10015; |
||||
$info : #31CCEC; |
||||
$warning : #F2C037; |
@ -0,0 +1,22 @@
@@ -0,0 +1,22 @@
|
||||
<!DOCTYPE html> |
||||
<html> |
||||
<head> |
||||
<title><%= productName %></title> |
||||
|
||||
<meta charset="utf-8"> |
||||
<meta name="description" content="<%= productDescription %>"> |
||||
<meta name="format-detection" content="telephone=no"> |
||||
<meta name="msapplication-tap-highlight" content="no"> |
||||
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width<% if (ctx.mode.cordova || ctx.mode.capacitor) { %>, viewport-fit=cover <% } %>"> |
||||
|
||||
<link rel="icon" type="image/png" sizes="128x128" href="icons/favicon-128x128.png"> |
||||
<link rel="icon" type="image/png" sizes="96x96" href="icons/favicon-96x96.png"> |
||||
<link rel="icon" type="image/png" sizes="32x32" href="icons/favicon-32x32.png"> |
||||
<link rel="icon" type="image/png" sizes="16x16" href="icons/favicon-16x16.png"> |
||||
<link rel="icon" type="image/ico" href="favicon.ico"> |
||||
</head> |
||||
<body> |
||||
<!-- DO NOT touch the following DIV --> |
||||
<div id="q-app"></div> |
||||
</body> |
||||
</html> |
@ -0,0 +1,96 @@
@@ -0,0 +1,96 @@
|
||||
<template> |
||||
<q-layout view="lHh Lpr lFf" ref="main"> |
||||
<q-header elevated> |
||||
<q-toolbar> |
||||
<q-toolbar-title> ChatBot </q-toolbar-title> |
||||
|
||||
<div>version v0.1</div> |
||||
</q-toolbar> |
||||
</q-header> |
||||
|
||||
<q-page-container class="bg-grey-2" ref="content"> |
||||
<router-view :messages="messages" :disable="disable" /> |
||||
</q-page-container> |
||||
<q-footer elevated class="no-shadow" ref="footer"> |
||||
<q-toolbar |
||||
class="bg-grey-3 text-black no-shadow row justify-center q-pt-md q-pb-sm" |
||||
> |
||||
<q-input |
||||
:disable="disable" |
||||
class="WAL__field col-grow q-mr-sm" |
||||
style="max-width: 1000px" |
||||
bg-color="white" |
||||
bottom-slots |
||||
v-model="search_text" |
||||
label="请输入你的问题" |
||||
counter |
||||
rounded |
||||
outlined |
||||
> |
||||
<template v-slot:after> |
||||
<q-btn |
||||
:disable="disable" |
||||
round |
||||
dense |
||||
flat |
||||
icon="send" |
||||
@click="sendMsg" |
||||
/> |
||||
</template> |
||||
</q-input> |
||||
</q-toolbar> |
||||
</q-footer> |
||||
</q-layout> |
||||
</template> |
||||
|
||||
<script> |
||||
import { sendQuestion } from "../api/chatbot/chatbot"; |
||||
export default { |
||||
name: "MainLayout", |
||||
data() { |
||||
return { |
||||
search_text: "", |
||||
disable: false, |
||||
messages: [ |
||||
{ |
||||
name: "bot", |
||||
text: ["请告诉我你的问题"], |
||||
sent: false, |
||||
}, |
||||
], |
||||
}; |
||||
}, |
||||
methods: { |
||||
//发送问题 |
||||
async sendMsg() { |
||||
if (!this.search_text) { |
||||
return; |
||||
} |
||||
this.disable = true; |
||||
//讲自己的问题加入到msg集合中 |
||||
|
||||
this.addMessage("me", true, this.search_text); |
||||
await sendQuestion(this.search_text).then((res) => { |
||||
//发送问题给机器人 |
||||
this.addMessage("bot", true, res.data); |
||||
|
||||
//清空输入框 |
||||
this.search_text = ""; |
||||
this.disable = false; |
||||
}); |
||||
}, |
||||
addMessage(name, sent, text) { |
||||
this.messages.push({ |
||||
name: name, |
||||
text: [text], |
||||
sent: sent, |
||||
}); |
||||
}, |
||||
}, |
||||
}; |
||||
</script> |
||||
<style lang="css"> |
||||
.bg-white { |
||||
background: #fff !important; |
||||
} |
||||
</style> |
@ -0,0 +1,29 @@
@@ -0,0 +1,29 @@
|
||||
<template> |
||||
<div class="fullscreen bg-blue text-white text-center q-pa-md flex flex-center"> |
||||
<div> |
||||
<div style="font-size: 30vh"> |
||||
404 |
||||
</div> |
||||
|
||||
<div class="text-h2" style="opacity:.4"> |
||||
Oops. Nothing here... |
||||
</div> |
||||
|
||||
<q-btn |
||||
class="q-mt-xl" |
||||
color="white" |
||||
text-color="blue" |
||||
unelevated |
||||
to="/" |
||||
label="Go Home" |
||||
no-caps |
||||
/> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
name: 'ErrorNotFound' |
||||
} |
||||
</script> |
@ -0,0 +1,47 @@
@@ -0,0 +1,47 @@
|
||||
<template> |
||||
<q-page class="q-pa-md row box"> |
||||
<q-scroll-area |
||||
ref="scrollArea" |
||||
class="row justify-center" |
||||
style="width: 100%; max-width: 100%" |
||||
> |
||||
<div class="justify-center row"> |
||||
<div |
||||
style="width: 100%; max-width: 51%" |
||||
v-for="(message, index) in messages" |
||||
:key="index" |
||||
> |
||||
<q-chat-message |
||||
style="white-space: pre-wrap;" |
||||
:text="message.text" |
||||
:name="message.name" |
||||
:sent="message.sent" |
||||
/> |
||||
</div> |
||||
<div style="width: 100%; max-width: 51%" v-show="disable"> |
||||
<q-chat-message :text='text' :name="name"/> |
||||
</div> |
||||
</div> |
||||
</q-scroll-area> |
||||
</q-page> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
props: ["messages", "disable"], |
||||
watch: { |
||||
messages: function (val) { |
||||
//当消息集合变动时 滚动到容器底部 |
||||
this.$refs.scrollArea.setScrollPosition("vertical", 9999999, 300); |
||||
}, |
||||
}, |
||||
data(){ |
||||
return{ |
||||
text:['请稍等...'], |
||||
name:"bot" |
||||
} |
||||
}, |
||||
|
||||
methods: {}, |
||||
}; |
||||
</script> |
@ -0,0 +1,30 @@
@@ -0,0 +1,30 @@
|
||||
import Vue from 'vue' |
||||
import VueRouter from 'vue-router' |
||||
|
||||
import routes from './routes' |
||||
|
||||
Vue.use(VueRouter) |
||||
|
||||
/* |
||||
* If not building with SSR mode, you can |
||||
* directly export the Router instantiation; |
||||
* |
||||
* The function below can be async too; either use |
||||
* async/await or return a Promise which resolves |
||||
* with the Router instance. |
||||
*/ |
||||
|
||||
export default function (/* { store, ssrContext } */) { |
||||
const Router = new VueRouter({ |
||||
scrollBehavior: () => ({ x: 0, y: 0 }), |
||||
routes, |
||||
|
||||
// Leave these as they are and change in quasar.conf.js instead!
|
||||
// quasar.conf.js -> build -> vueRouterMode
|
||||
// quasar.conf.js -> build -> publicPath
|
||||
mode: process.env.VUE_ROUTER_MODE, |
||||
base: process.env.VUE_ROUTER_BASE |
||||
}) |
||||
|
||||
return Router |
||||
} |
@ -0,0 +1,19 @@
@@ -0,0 +1,19 @@
|
||||
|
||||
const routes = [ |
||||
{ |
||||
path: '/', |
||||
component: () => import('layouts/MainLayout.vue'), |
||||
children: [ |
||||
{ path: '', component: () => import('pages/Index.vue') } |
||||
] |
||||
}, |
||||
|
||||
// Always leave this as last one,
|
||||
// but you can also remove it
|
||||
{ |
||||
path: '*', |
||||
component: () => import('pages/Error404.vue') |
||||
} |
||||
] |
||||
|
||||
export default routes |
@ -0,0 +1,119 @@
@@ -0,0 +1,119 @@
|
||||
import axios from 'axios' |
||||
|
||||
//1. 创建新的axios实例,
|
||||
const service = axios.create({ |
||||
// 公共接口
|
||||
baseURL: process.env.BASE_API, |
||||
// 超时时间 单位是ms
|
||||
timeout: 600 * 1000 |
||||
}) |
||||
const servicedownload = axios.create({ |
||||
// 公共接口
|
||||
baseURL: process.env.BASE_API, |
||||
// 超时时间 单位是ms
|
||||
timeout: 20 * 1000, |
||||
responseType: 'blob' |
||||
}) |
||||
|
||||
service.interceptors.request.use( |
||||
(config) => { |
||||
return config |
||||
}, |
||||
(error) => { |
||||
Promise.reject(error) |
||||
} |
||||
) |
||||
|
||||
// response拦截器
|
||||
service.interceptors.response.use( |
||||
(response) => { |
||||
return response |
||||
}, |
||||
(error) => { |
||||
// if (error && error.response) {
|
||||
// switch (error.response.status) {
|
||||
// case 400:
|
||||
// error.message = '请求错误(400)'
|
||||
// break
|
||||
// case 401:
|
||||
// error.message = '未授权,请重新登录(401)'
|
||||
// router.push('/login')
|
||||
// break
|
||||
// case 403:
|
||||
// error.message = '拒绝访问(403)'
|
||||
// break
|
||||
// case 404:
|
||||
// error.message = '请求出错(404)'
|
||||
// break
|
||||
// case 408:
|
||||
// error.message = '请求超时(408)'
|
||||
// break
|
||||
// case 500:
|
||||
// error.message = '服务器错误(500)'
|
||||
// break
|
||||
// case 501:
|
||||
// error.message = '服务未实现(501)'
|
||||
// break
|
||||
// case 502:
|
||||
// error.message = '网络错误(502)'
|
||||
// break
|
||||
// case 503:
|
||||
// error.message = '服务不可用(503)'
|
||||
// break
|
||||
// case 504:
|
||||
// error.message = '网络超时(504)'
|
||||
// break
|
||||
// case 505:
|
||||
// error.message = 'HTTP版本不受支持(505)'
|
||||
// break
|
||||
// default:
|
||||
// error.message = '连接出错'
|
||||
// }
|
||||
// } else {
|
||||
// error.message = '连接服务器失败!'
|
||||
// }
|
||||
// ElMessage({
|
||||
// message: error.message,
|
||||
// type: 'error'
|
||||
// })
|
||||
|
||||
return Promise.reject(error) |
||||
} |
||||
) |
||||
|
||||
// 2、封装请求方式
|
||||
// @param url 接口地址
|
||||
// @param data 携带参数
|
||||
// @param file 上传文件对象
|
||||
// @param auth 是否携带token
|
||||
// get请求
|
||||
export function get(url, data) { |
||||
return service.get(url, data) |
||||
} |
||||
|
||||
// post请求
|
||||
export function post(url, data) { |
||||
return service.post(url, data) |
||||
} |
||||
|
||||
// put请求
|
||||
export function put(url, data) { |
||||
return service.put(url, data) |
||||
} |
||||
|
||||
// delete 请求
|
||||
export function del(url, data) { |
||||
return service.delete(url, data) |
||||
} |
||||
|
||||
// upload 请求
|
||||
export function uploader(url, file) { |
||||
let params = new FormData() |
||||
params.append('file', file) |
||||
return service.post(url, params) |
||||
} |
||||
// upload 请求
|
||||
export function download(url, data) { |
||||
return servicedownload.get(url, data) |
||||
} |
||||
export default service |
Loading…
Reference in new issue