123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- <template>
- <div id="top">
- <el-row>
- <el-col :span="24" class="top">
- <div class="w_1200">
- <el-col :span="22" class="date">
- {{ gettime }}
- </el-col>
- <el-col :span="2" class="btn" v-if="user && user.id"> {{ user.name }} | <el-link :underline="false" @click="toLogOut">注销</el-link> </el-col>
- <el-col :span="2" class="btn">
- <el-link :underline="false" @click="loginBtn()" target="_blank">注册</el-link>|<el-link :underline="false" @click="loginBtn()" target="_blank"
- >登录</el-link
- >
- </el-col>
- </div>
- </el-col>
- </el-row>
- </div>
- </template>
- <script>
- import { mapActions, mapState, createNamespacedHelpers } from 'vuex';
- export default {
- name: 'top',
- props: {},
- components: {},
- data: () => ({
- gettime: '',
- }),
- created() {
- this.currentTime();
- },
- computed: {
- ...mapState(['user']),
- },
- methods: {
- currentTime() {
- setInterval(this.getTime, 500);
- },
- getTime: function() {
- var _this = this;
- let yy = new Date().getFullYear();
- let mm = new Date().getMonth() + 1;
- let dd = new Date().getDate();
- let day = new Date().getDay();
- var weekday = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
- _this.gettime = yy + '-' + mm + '-' + dd + ' ' + weekday[day];
- },
- loginBtn() {
- window.location.href = 'http://free.liaoningdoupo.com/platlogin/';
- },
- toLogOut() {
- localStorage.removeItem('token');
- this.logout();
- window.location.href = 'http://free.liaoningdoupo.com/platlogin/';
- },
- },
- };
- </script>
- <style lang="less" scoped>
- .w_1200 {
- width: 1200px;
- margin: 0 auto;
- }
- .date {
- height: 40px;
- line-height: 40px;
- color: #fff;
- font-size: 16px;
- }
- .btn {
- height: 40px;
- line-height: 40px;
- color: #fff;
- }
- .btn .el-link {
- color: #fff;
- margin: 0 5px;
- }
- </style>
|