NEZ-3475 feat: login页面下载c2v文件增加confirm弹窗

This commit is contained in:
zyh
2024-05-21 17:11:40 +08:00
parent 244b04e067
commit 1510b652b7
3 changed files with 40 additions and 6 deletions

View File

@@ -205,7 +205,9 @@
border: 1px solid $--border-color-light; border: 1px solid $--border-color-light;
border-color: $--border-color-light; border-color: $--border-color-light;
} }
}
.c2vDialog{
.el-dialog{ .el-dialog{
.el-dialog__header{ .el-dialog__header{
padding: 16px 20px; padding: 16px 20px;
@@ -248,4 +250,4 @@
} }
} }
} }
} }

View File

@@ -35,7 +35,7 @@
<!-- <div v-if="!license.valid" class="license-upload">--> <!-- <div v-if="!license.valid" class="license-upload">-->
<div class="license-upload" v-if="!license.valid"> <div class="license-upload" v-if="!license.valid">
<!-- <button type="button" class="login-btn" @click="downloadMib"><span style="margin-right: 5px"><i class="nz-icon nz-icon-download1"></i></span>{{$t('license.dowLicense')}}</button>--> <!-- <button type="button" class="login-btn" @click="downloadMib"><span style="margin-right: 5px"><i class="nz-icon nz-icon-download1"></i></span>{{$t('license.dowLicense')}}</button>-->
<button type="button" class="login-btn download-btn" @click="downloadLogin"><span style="margin-right: 5px"><i class="nz-icon nz-icon-download1"></i></span>{{$t('license.downloadID')}} <button type="button" class="login-btn download-btn" @click="checkVisible = true"><span style="margin-right: 5px"><i class="nz-icon nz-icon-download1"></i></span>{{$t('license.downloadID')}}
</button> </button>
<button class="license-left-footer-download login-btn download-btn" @click.stop="openQrcode" style="margin-left: -4px;display: inline-block"> <button class="license-left-footer-download login-btn download-btn" @click.stop="openQrcode" style="margin-left: -4px;display: inline-block">
<i class="nz-icon nz-icon-erweima"></i> <i class="nz-icon nz-icon-erweima"></i>
@@ -201,6 +201,27 @@
</div> </div>
</div> </div>
</el-dialog> </el-dialog>
<el-dialog
class="nz-dialog c2vDialog"
:title="$t('license.downloadID')"
:show-close="true"
:visible.sync="checkVisible"
width="480px"
@close="closeCheckDialog"
>
<p class="check-tip">{{$t('license.check')}}</p>
<p class="check-tip">{{$t('license.check1')}}</p>
<p class="check-tip">{{$t('license.check2')}}</p>
<p class="check-tip">{{$t('license.check3')}}</p>
<p class="check-tip">{{$t('license.check4')}}</p>
<p class="check-tip isCheck">
<el-checkbox v-model="checkCompleted">{{$t('license.checkCompleted')}}</el-checkbox>
</p>
<div slot="footer">
<button @click="checkVisible = false" class="nz-btn nz-btn-size-normal nz-btn-style-light margin-r-10">{{$t("overall.close")}}</button>
<button @click="downloadLicense" class="nz-btn nz-btn-size-normal nz-btn-style-normal" :class="{'nz-btn-disabled': (downLoading || !checkCompleted)}" :disabled="(downLoading || !checkCompleted)">{{$t('overall.download')}}</button>
</div>
</el-dialog>
</div> </div>
</template> </template>
@@ -269,11 +290,17 @@ export default {
boxWidth: '', boxWidth: '',
boxHeight: '', boxHeight: '',
qrWidth: 10, qrWidth: 10,
paddingLeft: 0 paddingLeft: 0,
checkVisible: false,
downLoading: false,
checkCompleted: false
} }
}, },
methods: { methods: {
...mapActions(['loginSuccess']), ...mapActions(['loginSuccess']),
closeCheckDialog () {
this.checkCompleted = false
},
login () { login () {
if (this.loading || !this.license.valid) { if (this.loading || !this.license.valid) {
return return
@@ -289,7 +316,7 @@ export default {
this.theme = res.data.user.theme this.theme = res.data.user.theme
this.userInfo = res.data.user this.userInfo = res.data.user
localStorage.setItem('nz-token', res.data.authToken) localStorage.setItem('nz-token', res.data.authToken)
localStorage.setItem('nz-userInfo', JSON.stringify( this.userInfo)) localStorage.setItem('nz-userInfo', JSON.stringify(this.userInfo))
if (res.data.authFlag === 1) { if (res.data.authFlag === 1) {
if (res.data.authBind === 0) { if (res.data.authBind === 0) {
this.verifyShow = true this.verifyShow = true
@@ -385,8 +412,11 @@ export default {
} }
}) })
}, },
downloadLogin () { downloadLicense () {
this.downLoading = true
this.$get('/sys/license/token').then(res => { this.$get('/sys/license/token').then(res => {
this.downLoading = false
this.checkVisible = false
let fileName = '' let fileName = ''
const resFileName = res.headers['content-disposition'].split('=')[1] const resFileName = res.headers['content-disposition'].split('=')[1]
if (resFileName) { if (resFileName) {
@@ -407,6 +437,7 @@ export default {
a.remove() // 将a标签移除 a.remove() // 将a标签移除
} }
}, error => { }, error => {
this.downLoading = false
const $self = this const $self = this
const reader = new FileReader() const reader = new FileReader()
reader.onload = function (event) { reader.onload = function (event) {

View File

@@ -165,7 +165,7 @@
</el-dialog> </el-dialog>
<el-dialog <el-dialog
class="nz-dialog" class="nz-dialog c2vDialog"
:title="$t('license.downloadID')" :title="$t('license.downloadID')"
:show-close="true" :show-close="true"
:visible.sync="checkVisible" :visible.sync="checkVisible"
@@ -333,6 +333,7 @@ export default {
this.downLoading = true this.downLoading = true
this.$get('/sys/license/token').then(res => { this.$get('/sys/license/token').then(res => {
this.downLoading = false this.downLoading = false
this.checkVisible = false
let fileName = '' let fileName = ''
const resFileName = res.headers['content-disposition'].split('=')[1] const resFileName = res.headers['content-disposition'].split('=')[1]
if (resFileName) { if (resFileName) {