App.vue 13.6 KB
Newer Older
yma16's avatar
yma16 已提交
1
<template>
Y
yma16 已提交
2
  <div id="app">
yma16's avatar
yma16 已提交
3
    <el-container>
yma16's avatar
yma16 已提交
4
      <el-aside v-if="!navigate_flag">
Y
yma16 已提交
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
        <router-link to="/">
          <svg
            class="icon"
            aria-hidden="true"
            style="width: auto; height: auto; padding-top: 5%"
          >
            <use xlink:href="#iconshejitouxiangai"></use>
          </svg>
        </router-link>
        <el-menu
          default-active=""
          class="el-menu-vertical-demo"
          @open="handleOpen"
          @close="handleClose"
        >
          <el-submenu index="1">
            <template slot="title">
              <i class="el-icon-user-solid"></i>
              <span slot="title">开发人员</span>
            </template>
            <el-menu-item-group>
              <el-submenu index="1-1">
yma16's avatar
yma16 已提交
27 28
                <template slot="title"
                  >yma16
yma16's avatar
yma16 已提交
29
                  </template
yma16's avatar
yma16 已提交
30
                >
Y
yma16 已提交
31
                <el-menu-item index="1-1-1">stay hungry</el-menu-item>
yma16's avatar
yma16 已提交
32
                <a @click="jumpToEcharts">
Y
yma16 已提交
33 34
                  <el-menu-item index="1-1-2">echarts</el-menu-item>
                </a>
yma16's avatar
yma16 已提交
35
                <a @click="jumpToAdmin">
Y
yma16 已提交
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
                  <el-menu-item index="1-1-3">superuser</el-menu-item>
                </a>
              </el-submenu>
              <el-submenu index="1-2">
                <template slot="title">location</template>
                <el-menu-item index="1-2-1" @click="jumpRouter('Home')"
                  >guiyang</el-menu-item
                >
              </el-submenu>
            </el-menu-item-group>
          </el-submenu>

          <el-submenu index="2">
            <template slot="title">
              <i class="el-icon-setting"></i>管理后台</template
            >
            <el-menu-item-group>
              <el-submenu index="2-1">
                <template slot="title">登录</template>
              </el-submenu>
              <el-submenu index="2-2">
                <template slot="title">注册</template>
              </el-submenu>
            </el-menu-item-group>
          </el-submenu>

          <el-submenu index="3">
            <template slot="title">
yma16's avatar
yma16 已提交
64
              <i class="el-icon-chat-line-round" :click="onlineWebsocket"></i
Y
yma16 已提交
65 66 67 68 69 70 71 72 73 74 75 76 77 78
              >线上聊天</template
            >
          </el-submenu>
        </el-menu>
      </el-aside>

      <el-container>
        <el-header>
          <a v-on:click="changeNavigate" style="cursor: pointer"
            ><i class="el-icon-s-promotion"></i>&nbsp;&nbsp;<span
              style="font-weight: bold"
              >{{ authSlogan }}</span
            ></a
          >
yma16's avatar
yma16 已提交
79 80 81
<!--          <i style="font-weight: bold; font-style: normal" v-if="chat_flag"-->
<!--            >&nbsp;&nbsp;在线聊天室</i-->
<!--          >-->
yma16's avatar
yma16 已提交
82
          <div style="float: right; overflow: hidden;display: flex;justify-items: center;align-items:center;word-spacing: 16px;">
yma16's avatar
yma16 已提交
83

yma16's avatar
yma16 已提交
84
            <span style="cursor: pointer;padding-right: 50px" v-if="currentUserName">
yma16's avatar
yma16 已提交
85 86
              <el-popover
                trigger="click">
yma16's avatar
yma16 已提交
87
                 <div style="display: flex;align-items: center;justify-items: center;justify-content: space-between;font-family: Arial">
yma16's avatar
yma16 已提交
88
                <span @click="loginOut" style="cursor: pointer; height: 16px">注销</span>
yma16's avatar
yma16 已提交
89
                 </div>
yma16's avatar
yma16 已提交
90
  <template slot="reference">
yma16's avatar
yma16 已提交
91 92 93 94 95 96
    <div style="display: flex;align-items: center;justify-items: center;justify-content: space-between;font-family: Arial">
      <el-avatar
        v-if="currentUserImg"
        @click="loginOut"
        :src="currentUserImg"
      ></el-avatar>
yma16's avatar
yma16 已提交
97 98
    <i style="font-weight: 300" v-if="currentUserImg">{{currentUserName}}</i>
    <i class="el-icon-user" style="font-weight: 300" v-else>{{currentUserName}}</i>
yma16's avatar
yma16 已提交
99
    </div>
yma16's avatar
yma16 已提交
100 101 102 103
  </template>
</el-popover>

            </span>
Y
yma16 已提交
104 105 106
            <a href="https://codechina.csdn.net/qq_38870145/myblogvue"
              ><img
                src="@/assets/img/code-china.png"
yma16's avatar
yma16 已提交
107
                style="cursor: pointer; height: 16px"
Y
yma16 已提交
108
            /></a>
yma16's avatar
yma16 已提交
109

Y
yma16 已提交
110 111 112
            <a href="https://github.com/yongma16"
              ><img
                src="@/assets/img/github-fill.png"
yma16's avatar
yma16 已提交
113
                style="cursor: pointer; height: 16px"
Y
yma16 已提交
114
            /></a>
yma16's avatar
yma16 已提交
115

Y
yma16 已提交
116 117 118 119 120 121 122 123 124 125 126
          </div>

          <!-- <a v-on:click="changeNavigate"><i class="el-icon-menu"></i></a> -->
        </el-header>

        <el-main id="mainappid" class="mainappclass">
          <!-- 路由 -->
          <router-view />
        </el-main>

        <el-footer>
yma16's avatar
yma16 已提交
127 128 129 130
          <div class="design-footer">
            <div class="footer_font">
              <div style="float: left"></div>
              <span>
131 132
                Copyright &copy;{{startTime}} yongma16.xyz
                个人空间&nbsp;&nbsp;&nbsp;</span>
yma16's avatar
yma16 已提交
133 134 135 136 137 138 139 140 141 142 143
              <span> 足迹:{{ readCount }}&nbsp;&nbsp;&nbsp;</span>
              <span
                ><img
                  src="@/assets/img/badge.png"
                  style="
                    cursor: pointer;
                    height: 16px;
                    margin-bottom: 0;
                    padding-bottom: 0;
                  "
                />&nbsp;&nbsp;<span style="cursor: pointer" @click="jumpIpDns"
144
                  >黔ICP备20001426号-1</span></span>
yma16's avatar
yma16 已提交
145 146
            </div>
            <!--            <div></div>-->
Y
yma16 已提交
147 148 149
          </div>
        </el-footer>
      </el-container>
yma16's avatar
yma16 已提交
150
    </el-container>
Y
yma16 已提交
151
  </div>
yma16's avatar
yma16 已提交
152 153 154
</template>

<script>
yma16's avatar
yma16 已提交
155
import store from '@/store'
yma16's avatar
yma16 已提交
156
export default {
yma16's avatar
yma16 已提交
157 158 159
    name: 'App',
    data () {
        return {
160 161
            // 开始时间
            startTime: '',
yma16's avatar
yma16 已提交
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
            authSlogan: 'yma16',
            chat_flag: false,
            msg: 'yma16',
            navigate_flag: true,
            value: new Date(),
            baseUrl: '/api/',
            src: 'https://cube.elemecdn.com/6/94/4d3ea53c084bad6931a56d5158a48jpeg.jpeg',
            url: '/image/logo/logo.jpg',
            srcList: [
                'https://fuss10.elemecdn.com/8/27/f01c15bb73e1ef3793e64e6b7bbccjpeg.jpeg',
                'https://fuss10.elemecdn.com/1/8e/aeffeb4de74e2fde4bd74fc7b4486jpeg.jpeg'
            ],
            headerData: ['从现在开始,种一棵树', '从现在开始,种一棵树'],
            readCount: 0
        }
yma16's avatar
yma16 已提交
177
    },
yma16's avatar
yma16 已提交
178 179
    computed: {
        currentUserName: function () {
yma16's avatar
yma16 已提交
180 181 182 183 184 185
            return store.state.user.userInfo && store.state.user.userInfo.thirdUserInfo
                ? store.state.user.userInfo.thirdUserInfo.nickname : store.state.user.userInfo.name ? store.state.user.userInfo.name : ''
        },
        currentUserImg: function () {
            return store.state.user.userInfo && store.state.user.userInfo.thirdUserInfo
                ? store.state.user.userInfo.thirdUserInfo.figureurl_qq : ''
yma16's avatar
yma16 已提交
186
        }
yma16's avatar
yma16 已提交
187
    },
yma16's avatar
yma16 已提交
188
    mounted () {
189
        this.initStartTime()
yma16's avatar
yma16 已提交
190 191
        this.addReadCountFun()
        this.readCountFun()
Y
yma16 已提交
192
    },
yma16's avatar
yma16 已提交
193
    methods: {
194 195 196 197 198
        initStartTime () {
            const now = new Date()
            const year = now.getFullYear()
            this.startTime = `2021-${year}`
        },
yma16's avatar
yma16 已提交
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236
        jumpIpDns: function () {
            try {
                window.open('https://beian.miit.gov.cn')
            } catch (r) {
                window.location.href = 'https://beian.miit.gov.cn'
                throw Error(r)
            }
        },
        addReadCountFun: function () {
            const that = this
            let clientIp = '未知'
            try {
                console.warn('ip待定')
            } catch (e) {
                console.warn(e)
            }
            that.$axios
                .post(this.baseUrl + 'count/add/', {
                    ip: clientIp
                })
                .catch((e) => {
                    throw Error(e)
                })
        },
        readCountFun: function () {
            let that = this
            that.$axios
                .get(that.baseUrl + 'count/get/')
                .then((res) => {
                    this.readCount = res.data.num
                })
                .catch((error) => {
                    throw Error(error)
                })
        },
        changeNavigate: function () {
            this.navigate_flag = !this.navigate_flag // 取反
        },
Y
yma16 已提交
237

yma16's avatar
yma16 已提交
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310
        handleOpen (key, keyPath) {
            if (key === '3') {
                this.chat_flag = true
                this.onlineWebsocket() // 调用跳转
            }
            if (key === '2-1') {
                this.chat_flag = false
                this.loginAction() // 调用跳转
            }
            if (key === '2-2') {
                this.chat_flag = false
                this.registerAction() // 调用跳转
            }
        },
        handleClose (key, keyPath) {
            console.info(key, keyPath)
            if (key === '3') {
                this.chat_flag = false
            }
        },
        jumpRouter: function (params) {
            this.$router
                .push({
                    name: `${params}`
                })
                .catch((error) => {
                    throw Error(error)
                })
        },
        onlineWebsocket: function () {
            this.$router
                .push({
                    path: '/onlinewebsocket'
                })
                .catch((error) => {
                    throw Error(error)
                })
        },
        jumpToEcharts: function () {
            this.$router
                .push({
                    path: '/bilicom'
                })
                .catch((error) => {
                    throw Error(error)
                })
        },
        jumpToAdmin: function () {
            this.$router
                .push({
                    path: '/mavoneditor'
                })
                .catch((error) => {
                    throw Error(error)
                })
        },
        loginAction: function () {
            this.$router
                .push({
                    path: '/login'
                })
                .catch((error) => {
                    throw Error(error)
                })
        },
        registerAction: function () {
            this.$router
                .push({
                    path: '/register'
                })
                .catch((error) => {
                    throw Error(error)
                })
yma16's avatar
yma16 已提交
311 312 313 314
        },
        loginOut () {
            localStorage.removeItem('yma16siteUserInfo')
            window.location.reload()
yma16's avatar
yma16 已提交
315 316 317
        }
    }
}
yma16's avatar
yma16 已提交
318 319 320 321 322 323 324
</script>

<style>
html,
body,
#app,
.el-container {
Y
yma16 已提交
325 326 327 328
  margin: 0px;
  padding: 0%;
  border: 0px;
  height: 100%;
yma16's avatar
yma16 已提交
329
  /* background: url(../myblog_static/utils/fx_background/image/gg.jpg) center top no-repeat; */
Y
yma16 已提交
330
  /* background: url(/image/snow/gg.jpg) center top no-repeat; */
yma16's avatar
yma16 已提交
331 332 333
}

body {
Y
yma16 已提交
334 335
  background-color: #2f214b;
  /* background: url(/image/snow/gg.jpg) center top no-repeat; */
yma16's avatar
yma16 已提交
336 337 338
}

.el-header {
Y
yma16 已提交
339 340 341 342 343
  background-color: #d4beb4;
  /* color: rgb(48, 76, 77); */
  text-align: left;
  line-height: 60px;
  /* background: url(/image/snow/gg.jpg) center top no-repeat; */
yma16's avatar
yma16 已提交
344 345
}

yma16's avatar
yma16 已提交
346 347 348 349 350
.design-footer {
  position: relative;
  margin-top: 20px;
}

yma16's avatar
yma16 已提交
351
.footer_font {
Y
yma16 已提交
352 353
  position: relative;
  /* height: 100%; */
yma16's avatar
yma16 已提交
354 355 356
}

.el-footer {
Y
yma16 已提交
357 358 359 360 361 362
  height: 100%;
  background-color: #bba8a4;
  color: #333;
  text-align: center;
  /* line-height: 60px; */
  box-sizing: border-box;
yma16's avatar
yma16 已提交
363 364 365
}

.el-aside {
Y
yma16 已提交
366 367 368 369 370 371
  background-color: #be9a90;
  color: #333;
  text-align: center;
  line-height: 80px;
  width: 80px;
  min-height: 60px;
yma16's avatar
yma16 已提交
372 373 374
}

.activeleft {
Y
yma16 已提交
375 376
  transform: translateX(-100vw);
  /* 左移100 */
yma16's avatar
yma16 已提交
377 378 379
}

.activeright {
Y
yma16 已提交
380 381
  transform: translateX(100vw);
  /* 右移100 */
yma16's avatar
yma16 已提交
382 383 384
}

.el-main {
Y
yma16 已提交
385 386 387
  /* background-color: #e9eef3; */
  text-align: left;
  opacity: 1;
yma16's avatar
yma16 已提交
388
  /* background: url(../myblog_static/utils/fx_background/image/gg.jpg) center top no-repeat; */
Y
yma16 已提交
389 390
  margin: 0;
  padding: 0;
yma16's avatar
yma16 已提交
391 392 393
}

.mainappclass {
Y
yma16 已提交
394 395 396
  margin: 0;
  padding: 0;
  overflow: auto;
yma16's avatar
yma16 已提交
397 398 399
}

.mainappclass::-webkit-scrollbar {
Y
yma16 已提交
400
  display: none;
yma16's avatar
yma16 已提交
401 402
}

Y
yma16 已提交
403 404 405 406 407
body > .el-container {
  color: #475669;
  opacity: 0.5;
  padding: 0%;
  margin-bottom: 40px;
yma16's avatar
yma16 已提交
408 409 410 411
}

.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
Y
yma16 已提交
412
  line-height: 260px;
yma16's avatar
yma16 已提交
413 414 415
}

.el-container:nth-child(7) .el-aside {
Y
yma16 已提交
416
  line-height: 320px;
yma16's avatar
yma16 已提交
417 418 419
}

.el-carousel__item h3 {
Y
yma16 已提交
420 421 422 423 424
  color: #475669;
  font-size: 14px;
  opacity: 0.5;
  line-height: 150px;
  margin: 0;
yma16's avatar
yma16 已提交
425 426 427
}

.el-carousel__item:nth-child(2n) {
Y
yma16 已提交
428 429
  /* background-image: url("/image/navigation/previewFix.jpg"); */
  transition-duration: 2s;
yma16's avatar
yma16 已提交
430 431 432
}

.el-carousel__item:nth-child(2n + 1) {
Y
yma16 已提交
433 434
  /* background-image: url("/image/navigation/original.jpg"); */
  transition-duration: 2s;
yma16's avatar
yma16 已提交
435 436 437
}

.footerclass {
Y
yma16 已提交
438 439
  position: relative;
  display: flex;
yma16's avatar
yma16 已提交
440 441 442
}

.midfooter {
Y
yma16 已提交
443 444 445 446
  position: relative;
  left: 50%;
  top: 50%;
  transform: translateX(-50%, -50%);
yma16's avatar
yma16 已提交
447 448 449
}

.heart {
Y
yma16 已提交
450 451 452 453 454 455 456 457
  width: 30px;
  height: 30px;
  position: relative;
  background: pink;
  transform: rotate(45deg);
  animation-name: change;
  animation-duration: 2s;
  animation-iteration-count: infinite;
yma16's avatar
yma16 已提交
458 459 460
}

.heart::before {
Y
yma16 已提交
461 462 463 464 465 466 467
  content: "";
  width: 30px;
  height: 30px;
  background: pink;
  border-radius: 50%;
  position: absolute;
  transform: translateX(-15px);
yma16's avatar
yma16 已提交
468 469 470
}

.heart::after {
Y
yma16 已提交
471 472 473 474 475 476 477 478 479
  content: "";
  width: 30px;
  height: 30px;
  background: pink;
  border-radius: 50%;
  position: absolute;
  /* 定位 */
  transform: translate(0px, -15px);
  /* transform: translateX(-100px); */
yma16's avatar
yma16 已提交
480 481 482
}

@keyframes change {
Y
yma16 已提交
483 484 485
  0% {
    transform: rotate(45deg) scale(0.25);
  }
yma16's avatar
yma16 已提交
486

Y
yma16 已提交
487 488 489
  50% {
    transform: rotate(45deg) scale(0.5);
  }
yma16's avatar
yma16 已提交
490

Y
yma16 已提交
491 492 493
  100% {
    transform: rotate(45deg) scale(0.25);
  }
yma16's avatar
yma16 已提交
494
}
yma16's avatar
yma16 已提交
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515
::-webkit-scrollbar {
  width: 10px;
  /* height:5px; */
  /* display: none; */
}
::-webkit-scrollbar-track {
  background: rgba(226, 247, 255, 0.5);
  border-radius: 2px;
  /* display: none; */
}
::-webkit-scrollbar-track-piece {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  /* display: none; */
}
::-webkit-scrollbar-thumb {
  background: #ff995e;
  height: 2px;
  border-radius: 2px;
  /* display: none; */
}
yma16's avatar
yma16 已提交
516
@keyframes backdiv {
Y
yma16 已提交
517 518 519
  50% {
    background: #ffe6f2;
  }
yma16's avatar
yma16 已提交
520 521
}
</style>