临时代码

main
RogerWork 11 months ago
parent 02fcf492b9
commit 2f27556b61
  1. 1
      package.json
  2. 7
      src/App.vue
  3. 3
      src/layout/index.vue
  4. 10
      src/request/config.js
  5. 111
      src/request/index.js
  6. 7
      src/views/update/index.vue
  7. 57
      yarn.lock

@ -11,6 +11,7 @@
"dependencies": {
"@element-plus/icons-vue": "^2.3.1",
"@types/node": "^20.10.4",
"axios": "^1.6.2",
"element-plus": "^2.4.3",
"normalize.css": "^8.0.1",
"vue": "^3.3.8",

@ -23,5 +23,10 @@ export default defineComponent({
</template>
<style>
#app {
padding: 0;
margin: 0;
height: 100%;
max-width: 1700px;
}
</style>

@ -24,10 +24,9 @@ import PageAside from "@/layout/components/PageAside.vue";
</template>
<style>
#app,
html,
body,
.el-container {
el-container {
padding: 0;
margin: 0;
height: 100%;

@ -0,0 +1,10 @@
export default {
method: 'get',
baseURL: 'http://localhost:8001',
headers: {
'Content-Type': 'application/json;charset=UTF-8'
},
timeout: 10000,
withCredentials: true,
responseType: 'json',
}

@ -0,0 +1,111 @@
import axios from "axios";
import config from "@/request/config.js";
import router from "@/router";
import { ElMessage } from 'element-plus';
export default function request(options) {
return new Promise((resolve, reject) => {
const instance = axios.create({...config});
// 请求拦截器
instance.interceptors.request.use(
(config) => {
let token = localStorage.getItem('pm_token');
if (token) {
config.headers.token = token;
} else {
router.push('/update')
}
return config;
},
(error) => {
console.log("request:", error);
if (error.code === "ECONNABORTED" && error.message.indexOf("timeout") !== -1) {
ElMessage({message: "请求超时", type: "error", showClose: true});
}
return Promise.reject(error)
}
);
// 响应拦截器
instance.interceptors.response.use(
(response) => {
return response.data;
},
(err) => {
if (err && err.response) {
switch (err.response.status) {
case 400:
err.message = "请求错误";
break
case 401:
err.message = "未授权";
break
case 403:
err.message = "拒绝访问";
break
case 404:
err.message = `请求地址出错:${err.response.config.url}`;
break
case 408:
err.message = "请求超时";
break;
case 500:
err.message = "服务器内部错误";
break;
case 501:
err.message = "服务未实现";
break;
case 502:
err.message = "网关错误";
break;
case 503:
err.message = "服务不可用";
break;
case 504:
err.message = "网关超时";
break;
case 505:
err.message = "HTTP版本不受支持";
break;
default:
}
}
console.log(err);
if (err.message) {
ElMessage({message: err.message, type: 'error', showClose: true});
}
return Promise.reject(err);
}
);
//请求处理
instance(options).then(
/**
* response 统一格式
* {
* code: 200,
* msg: '消息[String]',
* data: '返回数据[Any]'
* }
* code说明
* 200 成功
* -1 失败可能网络不通可能后台服务异常或其它异常
* -2 登录失效跳回登录
*/
(res) => {
if (res.code === 200) {
resolve(res);
}else{
if (res.code === -2) {
router.push("/login");
}
ElMessage({message: res.msg || "操作失败", type: "error", showClose: true});
reject(res);
}
}
).catch(
(error) => {
reject(error);
}
)
})
}

@ -54,6 +54,7 @@ const resetSearch = (formEl) => {
const tableData = reactive(
[
{
'update_time': '2023-12-13 16:16:18',
'name': '鼎新测试环境3.112',
'ip': '172.16.3.112',
'zz_num': '14105121',
@ -75,6 +76,7 @@ const tableData = reactive(
:rules="ipRule"
class="cinema-search"
:inline="true"
style="width: 100%"
>
<el-row>
<el-col :span="8">
@ -98,14 +100,15 @@ const tableData = reactive(
</el-row>
</el-form>
<el-table :data="tableData" style="width: 100%">
<el-table-column prop="update_time" label="更新时间" width="200"></el-table-column>
<el-table-column prop="name" label="影院名称" width="200"></el-table-column>
<el-table-column prop="ip" label="影院IP" width="120"></el-table-column>
<el-table-column prop="zz_num" label="专资编码" width="120"></el-table-column>
<el-table-column prop="inner_id" label="鼎新编码" width="100"></el-table-column>
<el-table-column prop="db_user" label="数据库账号" width="100"></el-table-column>
<el-table-column prop="db_pwd" label="数据库密码" width="120"></el-table-column>
<el-table-column prop="sys_ver" label="系统版本" width="120"></el-table-column>
<el-table-column prop="client_ver" label="客户端版本" width="200"></el-table-column>
<el-table-column prop="db_user" label="数据库账号" width="100"></el-table-column>
<el-table-column prop="db_pwd" label="数据库密码" width="120"></el-table-column>
</el-table>
</template>

@ -421,6 +421,20 @@ async-validator@^4.2.5:
resolved "https://registry.yarnpkg.com/async-validator/-/async-validator-4.2.5.tgz#c96ea3332a521699d0afaaceed510a54656c6339"
integrity sha512-7HhHjtERjqlNbZtqNqy2rckN/SpOOlmDliet+lP7k+eKZEjPk3DgyeU9lIXLdeLz0uBbbVp+9Qdow9wJWgwwfg==
asynckit@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==
axios@^1.6.2:
version "1.6.2"
resolved "https://registry.yarnpkg.com/axios/-/axios-1.6.2.tgz#de67d42c755b571d3e698df1b6504cde9b0ee9f2"
integrity sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==
dependencies:
follow-redirects "^1.15.0"
form-data "^4.0.0"
proxy-from-env "^1.1.0"
balanced-match@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee"
@ -460,6 +474,13 @@ braces@^3.0.2, braces@~3.0.2:
optionalDependencies:
fsevents "~2.3.2"
combined-stream@^1.0.8:
version "1.0.8"
resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f"
integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==
dependencies:
delayed-stream "~1.0.0"
csstype@^3.1.2:
version "3.1.3"
resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.3.tgz#d80ff294d114fb0e6ac500fbf85b60137d7eff81"
@ -477,6 +498,11 @@ debug@^4.3.4:
dependencies:
ms "2.1.2"
delayed-stream@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619"
integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==
element-plus@^2.4.3:
version "2.4.3"
resolved "https://registry.yarnpkg.com/element-plus/-/element-plus-2.4.3.tgz#ff21d0207d71752eb6a47a46609bc667f222841f"
@ -566,6 +592,20 @@ fill-range@^7.0.1:
dependencies:
to-regex-range "^5.0.1"
follow-redirects@^1.15.0:
version "1.15.3"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.3.tgz#fe2f3ef2690afce7e82ed0b44db08165b207123a"
integrity sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==
form-data@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452"
integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==
dependencies:
asynckit "^0.4.0"
combined-stream "^1.0.8"
mime-types "^2.1.12"
fsevents@~2.3.2, fsevents@~2.3.3:
version "2.3.3"
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6"
@ -684,6 +724,18 @@ micromatch@^4.0.4:
braces "^3.0.2"
picomatch "^2.3.1"
mime-db@1.52.0:
version "1.52.0"
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70"
integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==
mime-types@^2.1.12:
version "2.1.35"
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a"
integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==
dependencies:
mime-db "1.52.0"
minimatch@^9.0.3:
version "9.0.3"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.3.tgz#a6e00c3de44c3a542bfaae70abfc22420a6da825"
@ -764,6 +816,11 @@ postcss@^8.4.32:
picocolors "^1.0.0"
source-map-js "^1.0.2"
proxy-from-env@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2"
integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==
queue-microtask@^1.2.2:
version "1.2.3"
resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243"

Loading…
Cancel
Save