shuishen
2023-01-17 79015ce868713e754fd3031f028123ea869b6200
更改
5 files modified
77 ■■■■ changed files
src/components/map/index.vue 7 ●●●●● patch | view | raw | blame | history
src/permission.js 36 ●●●● patch | view | raw | blame | history
src/router/axios.js 20 ●●●●● patch | view | raw | blame | history
src/views/layout/index.vue 10 ●●●●● patch | view | raw | blame | history
src/views/login/index.vue 4 ●●●● patch | view | raw | blame | history
src/components/map/index.vue
@@ -2,7 +2,7 @@
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2022-08-18 17:00:30
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2023-01-15 14:56:18
 * @LastEditTime: 2023-01-17 08:56:47
 * @FilePath: \srs-police-affairs\src\components\map\index.vue
 * @Description: 公用地图组件
 * 
@@ -22,7 +22,8 @@
            </el-tooltip>
        </div>
        <!-- 切换矢量图按钮 -->
        <div class="image-switch-icon-btn" title="切换影像" @mouseover="showImgBtn = true" @mouseleave="showImgBtn = false">
        <div style="display: none !important;" class="image-switch-icon-btn" title="切换影像" @mouseover="showImgBtn = true"
            @mouseleave="showImgBtn = false">
            <div class="icon-box">
                <img src="/img/base_map.png" alt />
            </div>
@@ -216,7 +217,7 @@
            let sqTileset = new global.DC.Tileset(
                'http://10.141.11.11:18080/sf3d/361102/model/wanda/tileset.json'
            )
            sqTileset.setHeight(12)
            sqTileset.setHeight(0)
            sqTitleLayer.addOverlay(sqTileset)
            // sqTileset.on(global.DC.MouseEventType.CLICK, (e) => {
src/permission.js
@@ -2,7 +2,7 @@
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2022-08-18 16:16:10
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2022-12-27 09:00:06
 * @LastEditTime: 2023-01-16 15:39:08
 * @FilePath: \srs-police-affairs\src\permission.js
 * @Description: 路由守卫
 * 
@@ -15,21 +15,21 @@
router.beforeEach((to, from, next) => {
    const meta = to.meta || {}
    next()
    // if (getToken()) {
    //     if (to.path === '/login') { // 如果登录成功访问登录页跳转到主页
    //         next({
    //             path: '/'
    //         })
    //     } else {
    //         next()
    //     }
    // } else {
    //     // 判断是否需要认证,没有登录访问去登录页
    //     if (meta.isAuth === false) {
    //         next()
    //     } else {
    //         next('/login')
    //     }
    // }
    // next()
    if (getToken()) {
        if (to.path === '/login') { // 如果登录成功访问登录页跳转到主页
            next({
                path: '/'
            })
        } else {
            next()
        }
    } else {
        // 判断是否需要认证,没有登录访问去登录页
        if (meta.isAuth === false) {
            next()
        } else {
            next('/login')
        }
    }
})
src/router/axios.js
@@ -2,7 +2,7 @@
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2022-07-29 15:19:13
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2023-01-09 11:37:35
 * @LastEditTime: 2023-01-16 15:43:03
 * @FilePath: \srs-police-affairs\src\router\axios.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
@@ -62,6 +62,12 @@
            config.baseURL = defaultApi
        } else if (config.requestBaseUrl == "fengtDS") {
            config.baseURL = searchAllApi
        } else {
            const meta = config.meta || {}
            const isToken = meta.isToken === false
            if (auth.getToken() && !isToken) {
                config.headers['Blade-Auth'] = "bearer " + auth.getToken()
            }
        }
        //headers判断是否需要
@@ -70,15 +76,11 @@
        //     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"
        }
        // if (config.text === true) {
        //     config.headers["Content-Type"] = "text/plain"
        // }
        // const token = auth.getToken()
src/views/layout/index.vue
@@ -2,7 +2,7 @@
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2022-08-18 16:18:24
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2023-01-12 10:26:58
 * @LastEditTime: 2023-01-16 15:50:43
 * @FilePath: \srs-police-affairs\src\views\layout\index.vue
 * @Description: 
 * 
@@ -89,7 +89,7 @@
</template>
<script>
import { getUserInfo,getToken } from '@/utils/auth'
import { getUserInfo, getToken } from '@/utils/auth'
export default {
    data () {
        return {
@@ -131,7 +131,9 @@
                {
                    menuName: '运维管理',
                    openExternal: true,
                    path: 'http://192.168.0.126:1888/#/security/security'
                    // 内网
                    path: 'http://10.141.11.11:8081/#/security/security'
                    // path: 'http://192.168.0.126:1888/#/security/security'
                }
            ],
@@ -196,7 +198,7 @@
        goToPath (params) {
            if (params.openExternal) {
                var path = params.path + "?token=" + getToken()
                console.log(path,3333)
                console.log(path, 3333)
                window.open(path)
                return
            }
src/views/login/index.vue
@@ -70,9 +70,9 @@
                //角色ID
                roleId: "",
                //用户名
                username: "admin",
                username: "",
                //密码
                password: "admin",
                password: "",
                //账号类型
                type: "account",
                //验证码的值