From 7fb5514b8e73fefc538a4f0e6cdd6730ae1f3d13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E5=AE=8F=E6=9D=B0?= <1943105267@qq.com> Date: Thu, 17 Aug 2023 15:12:51 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BD=91=E7=BB=9C=E5=8A=9B=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 3 + src/api/zongzhi/st.js | 53 ++++ src/components/MyTable/index.vue | 70 ++++++ src/components/Pagination/index.vue | 115 +++++++++ src/main.js | 4 + src/utils/api.js | 81 ++++++ src/utils/request.js | 2 +- src/utils/scroll-to.js | 58 +++++ .../components/componentLeft.vue | 237 +++++++++++++++--- 9 files changed, 582 insertions(+), 41 deletions(-) create mode 100644 src/api/zongzhi/st.js create mode 100644 src/components/MyTable/index.vue create mode 100644 src/components/Pagination/index.vue create mode 100644 src/utils/api.js create mode 100644 src/utils/scroll-to.js diff --git a/.env.development b/.env.development index c629606..1a2d7ae 100644 --- a/.env.development +++ b/.env.development @@ -3,4 +3,7 @@ ENV = 'development' # base api VUE_APP_BASE_API = '/dashboard' + +VUE_APP_BASE_API2 = 'http://localhost:9027' + BASE_API = 'http://10.10.3.35:9070' diff --git a/src/api/zongzhi/st.js b/src/api/zongzhi/st.js new file mode 100644 index 0000000..0e43ee7 --- /dev/null +++ b/src/api/zongzhi/st.js @@ -0,0 +1,53 @@ +import request from '@/utils/request.js' + +// 网络安全官 +export function listSafetyadmin(query) { + return request({ + url: '/zongzhi/safetyadmin/list', + method: 'get', + params: query + }) +} + +// 查询网评员列表 +export function listCommentator(query) { + return request({ + url: '/zongzhi/commentator/list', + method: 'get', + params: query + }) +} + +// 查询网络平台列表 +export function listPingtai(query) { + return request({ + url: '/zongzhi/pingtai/list', + method: 'get', + params: query + }) +} + +// 查询网络安全支持单位列表 +export function listNetSafetyZcUnit(query) { + return request({ + url: '/zongzhi/supportunit/list', + method: 'get', + params: query + }) +} +// 查询网络民情责任人列表 +export function listPrincipal(query) { + return request({ + url: '/zongzhi/principal/list', + method: 'get', + params: query + }) +} +// 查询网络文明自愿者列表 +export function listVolunteer(query) { + return request({ + url: '/zongzhi/volunteer/list', + method: 'get', + params: query + }) +} diff --git a/src/components/MyTable/index.vue b/src/components/MyTable/index.vue new file mode 100644 index 0000000..37f4a99 --- /dev/null +++ b/src/components/MyTable/index.vue @@ -0,0 +1,70 @@ + + + + + diff --git a/src/components/Pagination/index.vue b/src/components/Pagination/index.vue new file mode 100644 index 0000000..6a67b30 --- /dev/null +++ b/src/components/Pagination/index.vue @@ -0,0 +1,115 @@ + + + + + diff --git a/src/main.js b/src/main.js index cc981a3..e744a37 100644 --- a/src/main.js +++ b/src/main.js @@ -20,6 +20,10 @@ import App from './App' import store from './store' import router from './router' +import MyTable from '@/components/MyTable' +import Paginations from '@/components/Pagination' +Vue.component('MyTable', MyTable) +Vue.component('Paginations', Paginations) import $ from 'jquery' Vue.prototype.$ = $ import drag from '@/directive/el-drag-dialog/index' diff --git a/src/utils/api.js b/src/utils/api.js new file mode 100644 index 0000000..b77850f --- /dev/null +++ b/src/utils/api.js @@ -0,0 +1,81 @@ +/* + * @Author: your name + * @Date: 2021-06-19 16:20:37 + * @LastEditTime: 2022-09-08 13:16:08 + * @LastEditors: 许宏杰 + * @Description: In User Settings Edit + * @FilePath: \mudushow\src\api\request.js + */ + +// import Vue from 'vue'; +import router from '../router' +import axios from 'axios' +import { Message } from 'element-ui' +// 实例化axios +const request = axios.create({ + baseURL: process.env.VUE_APP_BASE_API2, + timeout: 5000 +}) +// request--请求 拦截器 +request.interceptors.request.use( + (config) => { + debugger + // POST和PUT的请求参数转为formData + if (config.method === 'post' || config.method === 'put') { + if (config.url !== 'attachment/uploadimagefile') { + config.headers['Content-Type'] = 'multipart/form-data' + const params = config.data + const formData = new FormData() + Object.keys(params).forEach((key) => { + // 参数为null或者'null'时候不传入后台 + if (params[key] && params[key] !== 'null') { + formData.append(key, params[key]) + } + }) + config.data = formData + } + } + return config + }, + (error) => { + Promise.reject(error) + } +) + +// response--响应 拦截器 +request.interceptors.response.use( + (response) => { + // 系统返回状态判断 + if (response.data.code === 500) { + Message({ + message: response.data.message, + type: 'error', + duration: 5 * 1000 + }) + return Promise.reject(response.data) + } else if (response.data.code !== 200) { + Message({ + message: response.data.message, + type: 'error', + duration: 5 * 1000 + }) + } + // 以下是正确的数据判断 + return response.data + }, + (error) => { + let { message } = error + if (message == 'Network Error') { + message = '后端接口连接异常' + } else if (message.includes('timeout')) { + message = '系统接口请求超时' + } + Message({ + message: message, + type: 'error', + duration: 5 * 1000 + }) + return Promise.reject(error) + } +) +export { request } diff --git a/src/utils/request.js b/src/utils/request.js index 8713d6b..1ad8b52 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -12,7 +12,7 @@ import store from '@/store' import { getToken } from '@/utils/auth' // create an axios instance const service = axios.create({ - baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url + baseURL: process.env.VUE_APP_BASE_API2, // url = base url + request url // withCredentials: true, // send cookies when cross-domain requests timeout: 120 * 1000 // request timeout }) diff --git a/src/utils/scroll-to.js b/src/utils/scroll-to.js new file mode 100644 index 0000000..c5d8e04 --- /dev/null +++ b/src/utils/scroll-to.js @@ -0,0 +1,58 @@ +Math.easeInOutQuad = function(t, b, c, d) { + t /= d / 2 + if (t < 1) { + return c / 2 * t * t + b + } + t-- + return -c / 2 * (t * (t - 2) - 1) + b +} + +// requestAnimationFrame for Smart Animating http://goo.gl/sx5sts +var requestAnimFrame = (function() { + return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) { window.setTimeout(callback, 1000 / 60) } +})() + +/** + * Because it's so fucking difficult to detect the scrolling element, just move them all + * @param {number} amount + */ +function move(amount) { + document.documentElement.scrollTop = amount + document.body.parentNode.scrollTop = amount + document.body.scrollTop = amount +} + +function position() { + return document.documentElement.scrollTop || document.body.parentNode.scrollTop || document.body.scrollTop +} + +/** + * @param {number} to + * @param {number} duration + * @param {Function} callback + */ +export function scrollTo(to, duration, callback) { + const start = position() + const change = to - start + const increment = 20 + let currentTime = 0 + duration = (typeof (duration) === 'undefined') ? 500 : duration + var animateScroll = function() { + // increment the time + currentTime += increment + // find the value with the quadratic in-out easing function + var val = Math.easeInOutQuad(currentTime, start, change, duration) + // move the document.body + move(val) + // do the animation unless its over + if (currentTime < duration) { + requestAnimFrame(animateScroll) + } else { + if (callback && typeof (callback) === 'function') { + // the animation is done so lets callback + callback() + } + } + } + animateScroll() +} diff --git a/src/views/privateOrder/positiveEnergy/components/componentLeft.vue b/src/views/privateOrder/positiveEnergy/components/componentLeft.vue index a4e32f5..79895c6 100644 --- a/src/views/privateOrder/positiveEnergy/components/componentLeft.vue +++ b/src/views/privateOrder/positiveEnergy/components/componentLeft.vue @@ -15,21 +15,21 @@ v-for="(item, idx) in superviseObject" :key="idx" :class="['section-network-item', item.className]" - @click="openDetailDialog(item.title)" + @click="openDetailDialog(item.title,item.type)" @mouseover="volunteerMouseoveer(item.title)" @mouseleave="volunteerLeave(item.title)" >
银龄生活
凌云燕 @@ -113,7 +113,20 @@ :modal="false" >
- + +
+ +
+ +
@@ -234,6 +235,7 @@