<commit_before><template>
  <div id="home">
    <mu-flexbox class="header" :gutter="0">
      <mu-flexbox-item class="logo" :grow="menuAndContentWidth[0]" v-show="menuIsOpen">霸屏后台管理</mu-flexbox-item>
      <mu-flexbox-item :grow="menuAndContentWidth[1]" class="profile">
        <mu-appbar :zDepth="1">
          <mu-icon-button icon="menu" slot="left" @click="menuIsOpen=!menuIsOpen"/>
          <mu-paper class="user-headimg" circle :zDepth="1" slot="right" :style="headColor">{{firstName}}</mu-paper>
          <mu-icon-menu icon="more_vert" slot="right">
            <mu-menu-item title="个人信息"/>
            <mu-divider/>
            <mu-menu-item title="退出" @click="logout"/>
          </mu-icon-menu>
        </mu-appbar>
      </mu-flexbox-item>
    </mu-flexbox>
    <mu-flexbox class="content" :gutter="0" align="flex-start">
      <mu-flexbox-item class="content-left" :grow="menuAndContentWidth[0]" v-show="menuIsOpen">
        <mu-list @change="handleMenuChange" :value="activeMenu">
          <mu-list-item title="霸屏设置" toggleNested value="menu1">
            <mu-icon slot="left" value="inbox"/>
            <mu-list-item slot="nested" title="移动霸屏" value="menu1-1" to="/home/bp/mobile">
              <mu-icon slot="left" value="grade"/>
            </mu-list-item>
          </mu-list-item>
          <mu-list-item title="统计代码" toggleNested value="menu2">
            <mu-icon slot="left" value="inbox"/>
            <mu-list-item slot="nested" title="手机统计代码" value="menu2-1" to="/home/statistics/mobile">
              <mu-icon slot="left" value="grade"/>
            </mu-list-item>
          </mu-list-item>
          <mu-list-item title="系统管理" toggleNested value="menu3">
            <mu-icon slot="left" value="inbox"/>
            <mu-list-item slot="nested" title="个人设置" value="menu3-1" to="/home/setting/user">
              <mu-icon slot="left" value="grade"/>
            </mu-list-item>
          </mu-list-item>
        </mu-list>
      </mu-flexbox-item>
      <mu-flexbox-item class="content-right scrollbar" :grow="menuAndContentWidth[1]">
        <mu-content-block class="body">
          <router-view></router-view>
        </mu-content-block>
      </mu-flexbox-item>
    </mu-flexbox>
  </div>
</template>

<script>
  import axios from '@/config/axios'

  export default {
    name: 'home',
    data () {
      return {
        activeMenu: 'menu1-1',
        menuIsOpen: true
      }
    },
    computed: {
      menuAndContentWidth () {
        if (this.menuIsOpen) return [1, 4]
        return [0, 1]
      },
      firstName () {
        return this.$store.state.oneself ? this.$store.state.oneself.username[0].toUpperCase() : ''
      },
      headColor () {
        let colors = ['#dd4e41', '#4c8bf5', '#ffce42', '#717171', '#b2b2b2', '#7e57c2', '#9999FF', '#660033', '#3399CC', '#333333']
        if (!this.$store.state.oneself) return {backgroundColor: '#2b2b2b'}
        let sub = (this.$store.state.oneself.id / 1024 * 65535 / 22 * 8388).toString()[1]
        return {backgroundColor: colors[sub]}
      }
    },
    watch: {
      '$route': 'fetchInitData'
    },
    methods: {
      handleMenuChange (val) {
        this.activeMenu = val
      },
      fetchInitData () {
        let self = this<commit_msg>添加个人信息功能<commit_after><template>
  <div id="home">
    <mu-flexbox class="header" :gutter="0">
      <mu-flexbox-item class="logo" :grow="menuAndContentWidth[0]" v-show="menuIsOpen">霸屏后台管理</mu-flexbox-item>
      <mu-flexbox-item :grow="menuAndContentWidth[1]" class="profile">
        <mu-appbar :zDepth="1">
          <mu-icon-button icon="menu" slot="left" @click="menuIsOpen=!menuIsOpen"/>
          <mu-paper class="user-headimg" circle :zDepth="1" slot="right" :style="headColor">{{firstName}}</mu-paper>
          <mu-icon-menu icon="more_vert" slot="right">
            <mu-menu-item title="个人信息" @click="dialogVisibility = true"/>
            <mu-divider/>
            <mu-menu-item title="退出" @click="logout"/>
          </mu-icon-menu>
        </mu-appbar>
      </mu-flexbox-item>
    </mu-flexbox>
    <mu-flexbox class="content" :gutter="0" align="flex-start">
      <mu-flexbox-item class="content-left" :grow="menuAndContentWidth[0]" v-show="menuIsOpen">
        <mu-list @change="handleMenuChange" :value="activeMenu">
          <mu-list-item title="霸屏设置" toggleNested value="menu1">
            <mu-icon slot="left" value="inbox"/>
            <mu-list-item slot="nested" title="移动霸屏" value="menu1-1" to="/home/bp/mobile">
              <mu-icon slot="left" value="grade"/>
            </mu-list-item>
          </mu-list-item>
          <mu-list-item title="统计代码" toggleNested value="menu2">
            <mu-icon slot="left" value="inbox"/>
            <mu-list-item slot="nested" title="手机统计代码" value="menu2-1" to="/home/statistics/mobile">
              <mu-icon slot="left" value="grade"/>
            </mu-list-item>
          </mu-list-item>
          <mu-list-item title="系统管理" toggleNested value="menu3">
            <mu-icon slot="left" value="inbox"/>
            <mu-list-item slot="nested" title="个人设置" value="menu3-1" to="/home/setting/user">
              <mu-icon slot="left" value="grade"/>
            </mu-list-item>
          </mu-list-item>
        </mu-list>
      </mu-flexbox-item>
      <mu-flexbox-item class="content-right scrollbar" :grow="menuAndContentWidth[1]">
        <mu-content-block class="body">
          <router-view></router-view>
        </mu-content-block>
      </mu-flexbox-item>
    </mu-flexbox>
    <mu-dialog :open="dialogVisibility" @close="dialogVisibility = false">
      {{$store.state.oneself.username}} 到期时间为:{{$store.state.oneself['expired_date']}}。可绑定域名50个
    </mu-dialog>
  </div>
</template>

<script>
  import axios from '@/config/axios'

  export default {
    name: 'home',
    data () {
      return {
        activeMenu: 'menu1-1',
        menuIsOpen: true,
        dialogVisibility: false
      }
    },
    computed: {
      menuAndContentWidth () {
        if (this.menuIsOpen) return [1, 4]
        return [0, 1]
      },
      firstName () {
        return this.$store.state.oneself ? this.$store.state.oneself.username[0].toUpperCase() : ''
      },
      headColor () {
        let colors = ['#dd4e41', '#4c8bf5', '#ffce42', '#717171', '#b2b2b2', '#7e57c2', '#9999FF', '#660033', '#3399CC', '#333333']
        if (!this.$store.state.oneself) return {backgroundColor: '#2b2b2b'}
        let sub = (this.$store.state.oneself.id / 1024 * 65535 / 22 * 8388).toString()[1]
        return {backgroundColor: colors[sub]}
      }
    },
    watch: {
      '$route': 'fetchInitData'
    },
    methods: {
      handleMenuChange (val) {
        this.activeMenu = val
      },
      fetchInitData () {
        let self = this
{'fraction_non_alphanumeric': 0.18623242042931162, 'fraction_numerical': 0.025166543301258327, 'mean_word_length': 2.4224924012158056, 'pattern_counts': {'":': 0, '<': 107, '<?xml version=': 0, '>': 107, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1860736', 'n_tokens_mistral': 2406, 'n_tokens_neox': 2348, 'n_words': 376}