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> @click="closeOthersTags">{{$t('tagsView.closeOthers')}}</div>
<div class="item" <div class="item"
@click="closeAllTags">{{$t('tagsView.closeAll')}}</div> @click="closeAllTags">{{$t('tagsView.closeAll')}}</div>
<div class="item"
@click="clearCacheTags">{{$t('tagsView.clearCache')}}</div>
</div> </div>
<div class="avue-tags__box"> <div class="avue-tags__box">
<el-tabs v-model="active" <el-tabs v-model="active"
@ -28,7 +30,7 @@
<i class="el-icon-refresh" <i class="el-icon-refresh"
:class="{'turn':refresh}" :class="{'turn':refresh}"
@click="handleRefresh" @click="handleRefresh"
v-if="active==item.fullPath"></i> v-if="active===item.fullPath"></i>
</span> </span>
</template> </template>
@ -45,6 +47,7 @@
<el-dropdown-item @click="openSearch">{{$t('tagsView.search')}}</el-dropdown-item> <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="closeOthersTags">{{$t('tagsView.closeOthers')}}</el-dropdown-item>
<el-dropdown-item @click="closeAllTags">{{$t('tagsView.closeAll')}}</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> </el-dropdown-menu>
</template> </template>
</el-dropdown> </el-dropdown>
@ -54,6 +57,7 @@
</template> </template>
<script> <script>
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import {clearCache} from "@/api/user";
export default { export default {
name: "tags", name: "tags",
data () { data () {
@ -161,6 +165,18 @@ export default {
this.contextmenuFlag = false; this.contextmenuFlag = false;
this.$store.commit('DEL_ALL_TAG') this.$store.commit('DEL_ALL_TAG')
this.$router.push(this.tagWel); 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 () { handleLogin () {
this.$refs.loginForm.validate(valid => { this.$refs.loginForm.validate(valid => {
if (valid) { if (valid) {
const loading = this.$loading({
lock: true,
text: '登录中,请稍后',
background: 'rgba(0, 0, 0, 0.7)'
});
this.$store.dispatch("LoginByUsername", this.loginForm).then(() => { this.$store.dispatch("LoginByUsername", this.loginForm).then(() => {
if (this.website.switchMode) { if (this.website.switchMode) {
const deptId = this.userInfo.dept_id; const deptId = this.userInfo.dept_id;
@ -246,9 +251,11 @@ export default {
return false; return false;
} }
} }
loading.close();
this.$router.push(this.tagWel); this.$router.push(this.tagWel);
}).catch((err) => { }).catch((err) => {
console.log(err) console.log(err)
loading.close();
this.refreshCode(); this.refreshCode();
}); });
} }

Loading…
Cancel
Save