guanqb
2022-12-28 2d805c18b847d5fe6e4d97e1ddaa018590c205ef
Merge branch 'master' of http://192.168.2.114:10010/r/srs-police-affairs
11 files modified
283 ■■■■■ changed files
src/api/dept/index.js 2 ●●● patch | view | raw | blame | history
src/api/home/index.js 2 ●●● patch | view | raw | blame | history
src/api/panorama/index.js 2 ●●● patch | view | raw | blame | history
src/api/police/index.js 4 ●●●● patch | view | raw | blame | history
src/permission.js 12 ●●●● patch | view | raw | blame | history
src/router/axios.js 144 ●●●● patch | view | raw | blame | history
src/styles/media/index.scss 9 ●●●● patch | view | raw | blame | history
src/utils/auth.js 4 ●●●● patch | view | raw | blame | history
src/views/home/components/bottomContainer.vue 70 ●●●● patch | view | raw | blame | history
src/views/lyout/index.vue 32 ●●●● patch | view | raw | blame | history
vue.config.js 2 ●●● patch | view | raw | blame | history
src/api/dept/index.js
@@ -17,7 +17,7 @@
 */
export const getPoliceStationList = () => {
    return request({
        url: '/blade-system/dept/getAllPoliceStation',
        url: '/api/blade-system/dept/getAllPoliceStation',
        method: 'get',
    })
}
src/api/home/index.js
@@ -8,7 +8,7 @@
 */
export const getSchedulingList = () => {
    return request({
        url: `/scheduling/scheduling/page`,
        url: `/api/scheduling/scheduling/page`,
        method: 'get',
        params: {
            current: 1,
src/api/panorama/index.js
@@ -17,7 +17,7 @@
 */
export const getPanoramaList = () => {
    return request({
        url: '/panorama/panorama/all',
        url: '/api/panorama/panorama/all',
        method: 'get',
    })
}
src/api/police/index.js
@@ -17,7 +17,7 @@
 */
export const getHistoricalTrack = (params, requestBaseUrl = 'outside') => {
    return request({
        url: `/position/history/${params.channelId}`,
        url: `/api/position/history/${params.channelId}`,
        method: 'get',
        requestBaseUrl,
        params: params
@@ -32,7 +32,7 @@
 */
export const getCarList = (page, count, serialNumber) => {
    return request({
        url: '/policecar/policecar/page',
        url: '/api/policecar/policecar/page',
        method: 'get',
        params: {
            page,
src/permission.js
@@ -2,19 +2,19 @@
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2022-08-18 16:16:10
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2022-08-18 17:18:58
 * @FilePath: \srs-psb\src\permission.js
 * @LastEditTime: 2022-12-27 09:00:06
 * @FilePath: \srs-police-affairs\src\permission.js
 * @Description: 路由守卫
 * 
 * Copyright (c) 2022 by shuishen 1109946754@qq.com, All Rights Reserved. 
 */
import router from '@/router/page/index'
// import {
//     getToken
// } from './utils/auth'
import {
    getToken
} from './utils/auth'
router.beforeEach((to, from, next) => {
    // const meta = to.meta || {}
    const meta = to.meta || {}
    next()
    // if (getToken()) {
    //     if (to.path === '/login') { // 如果登录成功访问登录页跳转到主页
src/router/axios.js
@@ -13,92 +13,104 @@
 * isSerialize是否开启form表单提交
 * isToken是否需要token
 */
import axios from 'axios'
import router from '@/router/page/index.js'
import { Message } from 'element-ui'
import axios from "axios";
import router from "@/router/page/index.js";
import { Message } from "element-ui";
// 获取公共配置域名
// import router from '@/router/page/index.js'
// import { Message } from 'element-ui'
// import * as auth from '@/utils/auth'
import {Base64} from 'js-base64';
import * as auth from '@/utils/auth'
// 调用后台管理的
const service = axios.create({
    // baseURL: 'http://36.14.255.242:18080/api',
    // baseURL: 'http://192.168.0.102:1888/api',
    // baseURL: 'http://192.168.0.105:18080/api',
    // baseURL: 'http://192.168.0.115:82',
    // baseURL: 'http://192.168.0.112:18080',
    baseURL: 'http://192.168.0.115:1888/api',
  // baseURL: 'http://36.14.255.242:18080/api',
  // baseURL: 'http://192.168.0.102:1888/api',
  // baseURL: 'http://192.168.0.105:18080/api',
  // baseURL: 'http://192.168.0.115:82',
  // baseURL: 'http://192.168.0.112:18080',
  // baseURL: 'http://192.168.0.115:1888/api',
    // baseURL: 'http://192.168.0.115:82',
    // baseURL: 'http://192.168.0.106:1888/api',
  // baseURL: 'http://192.168.0.115:82',
  // baseURL: 'http://192.168.0.106:1888/api',
    // 内网部署地址
    // baseURL: 'http://10.141.11.11:82',
    timeout: 600000 // request timeout
})
  // 内网部署地址
  // baseURL: 'http://10.141.11.11:82',
  timeout: 600000, // request timeout
});
// 返回其他状态码
service.defaults.validateStatus = function (status) {
    return status >= 200 && status <= 500
}
  return status >= 200 && status <= 500;
};
// 跨域请求,允许保存cookie
// service.defaults.withCredentials = true
// http request拦截
service.interceptors.request.use(
    (config) => {
        // 调用监控平台的
        if (config.requestBaseUrl == 'outside') {
            // config.baseURL = 'http://192.168.0.115:1888/api'
            // config.baseURL = 'http://192.168.0.105:80/api'
            // config.baseURL = 'http://192.168.0.115:18080/api'
            // 内网部署地址
            // config.baseURL = 'http://10.141.11.11:18185/api'
            config.baseURL = 'http://192.168.0.115:18185/api'
            // config.baseURL = 'http://192.168.0.106:1888/api'
        } else if (config.requestBaseUrl == 'fengt') {
            config.baseURL = 'http://10.141.11.11:18080'
        }
        // const token = auth.getToken()
        // 添加token
        // token && (config.headers.token = token)
        return config
    },
    (error) => {
        return Promise.reject(error)
  (config) => {
    // 调用监控平台的
    if (config.requestBaseUrl == "outside") {
      // config.baseURL = 'http://192.168.0.115:1888/api'
      // config.baseURL = 'http://192.168.0.105:80/api'
      // config.baseURL = 'http://192.168.0.115:18080/api'
      // 内网部署地址
      // config.baseURL = 'http://10.141.11.11:18185/api'
      config.baseURL = "http://192.168.0.115:18185/api";
      // config.baseURL = 'http://192.168.0.106:1888/api'
    } else if (config.requestBaseUrl == "fengt") {
      config.baseURL = "http://10.141.11.11:18080";
    }
)
    //headers判断是否需要
    const authorization = config.authorization === false;
    if (!authorization) {
      config.headers["Authorization"] = `Basic ${Base64.encode("saber:saber_secret")}`;
    }
    //让每个请求携带token
    const meta = config.meta || {};
    const isToken = meta.isToken === false;
    if (auth.getToken() && !isToken) {
      config.headers['Blade-Auth'] = "bearer " + auth.getToken();
    }
    //headers中配置text请求
    if (config.text === true) {
      config.headers["Content-Type"] = "text/plain";
    }
    // const token = auth.getToken()
    // 添加token
    // token && (config.headers.token = token)
    return config;
  },
  (error) => {
    return Promise.reject(error);
  }
);
// http response 拦截
service.interceptors.response.use(
    (res) => {
        const code = res.data.code
        if (code == 403 && res.data.data == 'token 验证失败!') {
            // sessionStorage.removeItem('token')
            router.push('/login')
        } else {
            return res
        }
    },
    (error) => {
        Message({
            message: error.message,
            type: 'error',
            duration: 5 * 1000
        })
        return Promise.reject(new Error(error))
  (res) => {
    const code = res.data.code;
    if (code==401 || code == 403 || res.data.data == "token 验证失败!") {
      // sessionStorage.removeItem('token')
      router.push("/login");
    } else {
      return res;
    }
)
  },
  (error) => {
    Message({
      message: error.message,
      type: "error",
      duration: 5 * 1000,
    });
export default service
    return Promise.reject(new Error(error));
  }
);
export default service;
src/styles/media/index.scss
@@ -238,7 +238,7 @@
                                .timeTab {
                                    top: countSizeVh(22);
                                    right: countSizeVw(12, 1920);
                                    right: countSizeVw(400, 1920);
                                    border-radius: countSizeVh(6);
                                    span {
@@ -248,9 +248,14 @@
                                    }
                                }
                                .timeSeclect{
                                    top: countSizeVh(15);
                                    right: countSizeVw(128, 1920);
                                }
                                .history-tab {
                                    top: countSizeVh(22);
                                    right: countSizeVw(96, 1920);
                                    right: countSizeVw(12, 1920);
                                    border-radius: countSizeVh(6);
                                    span {
src/utils/auth.js
@@ -2,8 +2,8 @@
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2022-07-28 17:50:14
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2022-08-05 11:45:20
 * @FilePath: \zhny-dsj\src\utils\auth.js
 * @LastEditTime: 2022-12-26 14:31:40
 * @FilePath: \srs-police-affairs\src\utils\auth.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
export const getToken = () => {
src/views/home/components/bottomContainer.vue
@@ -2,18 +2,6 @@
    <div class="container">
        <div class="header">
            <div class="bottom-title">警情动态</div>
            <div class="history-tab">
                <span
                    class="beforetime"
                    :class="{ choosed: historytype == 0 }"
                    @click="historyTabClick(0)"
                >实时</span>
                <span
                    class="beforetime"
                    :class="{ choosed: historytype == 1 }"
                    @click="historyTabClick(1)"
                >历史</span>
            </div>
            <div class="timeTab" v-show="historytype">
                <span
                    class="beforetime"
@@ -26,6 +14,24 @@
                    @click="timeTabClick(1)"
                >月</span>
            </div>
            <div class="timeSeclect" v-show="historytype">
                <el-date-picker v-model="eventTime" type="daterange" align="right" unlink-panels range-separator="至"
                        start-placeholder="开始日期" end-placeholder="结束日期"
                        :picker-options="pickerOptions"></el-date-picker>
            </div>
            <div class="history-tab">
                <span
                    class="beforetime"
                    :class="{ choosed: historytype == 0 }"
                    @click="historyTabClick(0)"
                >实时</span>
                <span
                    class="beforetime"
                    :class="{ choosed: historytype == 1 }"
                    @click="historyTabClick(1)"
                >历史</span>
            </div>
        </div>
        <div class="body" ref="tableBox" @click="handleSelectClick($event)">
@@ -83,6 +89,34 @@
            policeSituationRealtimeArr: [],
            policeSituationHistoryArr: [],
            policeSituationHistorySaveArr: [],
            eventTime: '',
            pickerOptions: {
                shortcuts: [{
                    text: '最近一周',
                    onClick (picker) {
                        const end = new Date()
                        const start = new Date()
                        start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
                        picker.$emit('pick', [start, end])
                    }
                }, {
                    text: '最近一个月',
                    onClick (picker) {
                        const end = new Date()
                        const start = new Date()
                        start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
                        picker.$emit('pick', [start, end])
                    }
                }, {
                    text: '最近三个月',
                    onClick (picker) {
                        const end = new Date()
                        const start = new Date()
                        start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
                        picker.$emit('pick', [start, end])
                    }
                }]
            },
        }
    },
@@ -244,7 +278,7 @@
        .timeTab {
            position: absolute;
            top: 22px;
            right: 12px;
            right: 400px;
            display: flex;
            border-radius: 6px;
            overflow: hidden;
@@ -267,10 +301,18 @@
            }
        }
        .timeSeclect{
            width: 250px;
            height: 30px;
            position:absolute;
            top: 12px;
            right: 130px;
        }
        .history-tab {
            position: absolute;
            top: 22px;
            right: 96px;
            right: 12px;
            display: flex;
            border-radius: 6px;
            overflow: hidden;
src/views/lyout/index.vue
@@ -2,7 +2,7 @@
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2022-08-18 16:18:24
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2022-12-19 11:24:14
 * @LastEditTime: 2022-12-27 09:33:59
 * @FilePath: \srs-police-affairs\src\views\lyout\index.vue
 * @Description: 
 * 
@@ -93,9 +93,9 @@
</template>
<script>
import getUserInfo from '@/utils/auth'
import { getUserInfo } from '@/utils/auth'
export default {
    data() {
    data () {
        return {
            menuLeftList: [
                {
@@ -152,15 +152,14 @@
        }
    },
    created() {
    created () {
        this.currentUrl = this.$route.path
        this.user = getUserInfo()
        console.log(this.user, 4451211)
        this.init();
    },
    watch: {
        $route: {
            handler(newPath, oldPath) {
            handler (newPath, oldPath) {
                this.currentUrl = newPath.path
                this.$nextTick(() => {
@@ -180,15 +179,18 @@
        }
    },
    mounted() {
    mounted () {
    },
    methods: {
        init(){
            this.user = this.$store.state.user.userInfo;
        },
        //登出
        goTOLogout() {
        goTOLogout () {
            this.$store.dispatch("LogOut").then(() => {
                this.$router.push({ path: "/login" });
            });
                this.$router.push({ path: "/login" })
            })
        },
        /**
         * @description: 路由跳转的事件
@@ -196,7 +198,7 @@
         * @param {*} e 子元素上绑定的的自定义属性
         * @return {*} 没有返回值
         */
        goToPath(params) {
        goToPath (params) {
            if (params.openExternal) {
                window.open(params.path)
                return
@@ -213,7 +215,7 @@
        },
        flexibelClick() {
        flexibelClick () {
            this.show = !this.show
            if (this.$refs['target-name'].boxResize) this.$refs['target-name'].boxResize(this.show)
@@ -233,7 +235,7 @@
            }
        },
        resize(val, flag = false) {
        resize (val, flag = false) {
            this.boxWidth = val
            this.show = flag
@@ -258,7 +260,7 @@
            })
        },
        openUser() {
        openUser () {
            this.userOn = !this.userOn
            this.isShowUserDetail = !this.isShowUserDetail
        },
vue.config.js
@@ -153,7 +153,7 @@
    proxy: {
      "/api": {
        // target用于配置你允许访问数据的计算机名称,即是你的api接口的服务器地址
        target: "http://192.168.0.115:82",
        target: "http://192.168.0.115:1888/api",
        // ws: true, //启用webSocket
        changeOrigin: true, //开启代理跨域
        pathRewrite: {