add login loading and clear cache

3.x
smallchill 3 years ago
parent 53d82bef08
commit 35925e83c3
  1. 18
      src/page/index/tags.vue
  2. 7
      src/page/login/userlogin.vue

@ -10,6 +10,8 @@
@click="closeOthersTags">{{$t('tagsView.closeOthers')}}</div>
<div class="item"
@click="closeAllTags">{{$t('tagsView.closeAll')}}</div>
<div class="item"
@click="clearCacheTags">{{$t('tagsView.clearCache')}}</div>
</div>
<div class="avue-tags__box">
<el-tabs v-model="active"
@ -28,7 +30,7 @@
<i class="el-icon-refresh"
:class="{'turn':refresh}"
@click="handleRefresh"
v-if="active==item.fullPath"></i>
v-if="active===item.fullPath"></i>
</span>
</template>
@ -45,6 +47,7 @@
<el-dropdown-item @click="openSearch">{{$t('tagsView.search')}}</el-dropdown-item>
<el-dropdown-item @click="closeOthersTags">{{$t('tagsView.closeOthers')}}</el-dropdown-item>
<el-dropdown-item @click="closeAllTags">{{$t('tagsView.closeAll')}}</el-dropdown-item>
<el-dropdown-item @click="clearCacheTags">{{$t('tagsView.clearCache')}}</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
@ -54,6 +57,7 @@
</template>
<script>
import { mapGetters } from "vuex";
import {clearCache} from "@/api/user";
export default {
name: "tags",
data () {
@ -161,6 +165,18 @@ export default {
this.contextmenuFlag = false;
this.$store.commit('DEL_ALL_TAG')
this.$router.push(this.tagWel);
},
clearCacheTags() {
this.$confirm("是否需要清除缓存?", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
clearCache().then(() => {
this.contextmenuFlag = false;
this.$message.success('清除完毕');
})
});
}
}
};

@ -232,6 +232,11 @@ export default {
handleLogin () {
this.$refs.loginForm.validate(valid => {
if (valid) {
const loading = this.$loading({
lock: true,
text: '登录中,请稍后',
background: 'rgba(0, 0, 0, 0.7)'
});
this.$store.dispatch("LoginByUsername", this.loginForm).then(() => {
if (this.website.switchMode) {
const deptId = this.userInfo.dept_id;
@ -246,9 +251,11 @@ export default {
return false;
}
}
loading.close();
this.$router.push(this.tagWel);
}).catch((err) => {
console.log(err)
loading.close();
this.refreshCode();
});
}

Loading…
Cancel
Save