update axios response的解析

This commit is contained in:
lb 2022-08-04 16:13:20 +08:00
parent 8b060b8bf1
commit affea8af59
59 changed files with 329 additions and 318 deletions

View File

@ -2,6 +2,7 @@
"singleQuote": true, "singleQuote": true,
"tabWidth": 2, "tabWidth": 2,
"bracketSameLine": true, "bracketSameLine": true,
"htmlWhitespaceSensitivity": "ignore",
"embeddedLanguageFormatting": "auto", "embeddedLanguageFormatting": "auto",
"printWidth": 180, "printWidth": 180,
"quoteProps": "consistent", "quoteProps": "consistent",

View File

@ -17,7 +17,8 @@
:name="item.name" :name="item.name"
:label="item.title" :label="item.title"
:closable="item.name !== 'home'" :closable="item.name !== 'home'"
:class="{ 'is-iframe': tabIsIframe(item.iframeURL) }"> :class="{ 'is-iframe': tabIsIframe(item.iframeURL) }"
>
<template v-if="item.name === 'home'"> <template v-if="item.name === 'home'">
<svg slot="label" class="icon-svg aui-content--tabs-icon-nav" aria-hidden="true"><use xlink:href="#icon-home"></use></svg> <svg slot="label" class="icon-svg aui-content--tabs-icon-nav" aria-hidden="true"><use xlink:href="#icon-home"></use></svg>
</template> </template>
@ -41,8 +42,7 @@
import { isURL } from '@/utils/validate' import { isURL } from '@/utils/validate'
export default { export default {
data() { data() {
return { return {}
}
}, },
methods: { methods: {
// tabs, iframe // tabs, iframe
@ -54,9 +54,9 @@ export default {
tab = this.$store.state.contentTabs.filter(item => item.name === tab.name)[0] tab = this.$store.state.contentTabs.filter(item => item.name === tab.name)[0]
if (tab) { if (tab) {
this.$router.push({ this.$router.push({
'name': tab.name, name: tab.name,
'params': { ...tab.params }, params: { ...tab.params },
'query': { ...tab.query } query: { ...tab.query }
}) })
} }
}, },

View File

@ -6,7 +6,8 @@
:collapse="$store.state.sidebarFold" :collapse="$store.state.sidebarFold"
:unique-opened="true" :unique-opened="true"
:collapseTransition="false" :collapseTransition="false"
class="aui-sidebar__menu"> class="aui-sidebar__menu"
>
<sub-menu v-for="menu in $store.state.sidebarMenuList" :key="menu.id" :menu="menu" /> <sub-menu v-for="menu in $store.state.sidebarMenuList" :key="menu.id" :menu="menu" />
</el-menu> </el-menu>
</div> </div>
@ -17,8 +18,7 @@
import SubMenu from './main-sidebar-sub-menu' import SubMenu from './main-sidebar-sub-menu'
export default { export default {
data() { data() {
return { return {}
}
}, },
components: { components: {
SubMenu SubMenu

View File

@ -187,8 +187,8 @@
}) })
}).then(({data}) => { }).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataList = data.list this.dataList = data.data.list
this.totalPage = data.total this.totalPage = data.data.total
} else { } else {
this.dataList = [] this.dataList = []
this.totalPage = 0 this.totalPage = 0

View File

@ -169,8 +169,8 @@
}) })
}).then(({data}) => { }).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataList = data.list this.dataList = data.data.list
this.totalPage = data.total this.totalPage = data.data.total
} else { } else {
this.dataList = [] this.dataList = []
this.totalPage = 0 this.totalPage = 0

View File

@ -163,8 +163,8 @@
}) })
}).then(({data}) => { }).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataList = data.list this.dataList = data.data.list
this.totalPage = data.total this.totalPage = data.data.total
} else { } else {
this.dataList = [] this.dataList = []
this.totalPage = 0 this.totalPage = 0

View File

@ -38,8 +38,12 @@
<el-table-column prop="updateTime" header-align="center" align="center" label="更新时间"></el-table-column> <el-table-column prop="updateTime" header-align="center" align="center" label="更新时间"></el-table-column>
<el-table-column prop="version" header-align="center" align="center" label="版本号"></el-table-column> <el-table-column prop="version" header-align="center" align="center" label="版本号"></el-table-column>
<el-table-column prop="externalCode" header-align="center" align="center" label="外部系统代码"></el-table-column> <el-table-column prop="externalCode" header-align="center" align="center" label="外部系统代码"></el-table-column>
<el-table-column prop="externalCodeStatis" header-align="center" align="center" label="统一用的外部代码,代表用哪个设备的数据代替该设备,目前用于生产数量统计"> <el-table-column
</el-table-column> prop="externalCodeStatis"
header-align="center"
align="center"
label="统一用的外部代码,代表用哪个设备的数据代替该设备,目前用于生产数量统计"
></el-table-column>
<el-table-column fixed="right" header-align="center" align="center" width="150" label="操作"> <el-table-column fixed="right" header-align="center" align="center" width="150" label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button> <el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
@ -55,8 +59,7 @@
:page-size="pageSize" :page-size="pageSize"
:total="totalPage" :total="totalPage"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
> ></el-pagination>
</el-pagination>
<!-- 弹窗, 新增 / 修改 --> <!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update> <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
</div> </div>
@ -99,9 +102,10 @@ export default {
key: this.dataForm.key key: this.dataForm.key
}) })
}).then(({ data }) => { }).then(({ data }) => {
console.log('===', data)
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataList = data.list this.dataList = data.data.list
this.totalPage = data.total this.totalPage = data.data.total
} else { } else {
this.dataList = [] this.dataList = []
this.totalPage = 0 this.totalPage = 0

View File

@ -169,8 +169,8 @@
}) })
}).then(({data}) => { }).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataList = data.list this.dataList = data.data.list
this.totalPage = data.total this.totalPage = data.data.total
} else { } else {
this.dataList = [] this.dataList = []
this.totalPage = 0 this.totalPage = 0

View File

@ -199,8 +199,8 @@
}) })
}).then(({data}) => { }).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataList = data.list this.dataList = data.data.list
this.totalPage = data.total this.totalPage = data.data.total
} else { } else {
this.dataList = [] this.dataList = []
this.totalPage = 0 this.totalPage = 0

View File

@ -217,8 +217,8 @@
}) })
}).then(({data}) => { }).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataList = data.list this.dataList = data.data.list
this.totalPage = data.total this.totalPage = data.data.total
} else { } else {
this.dataList = [] this.dataList = []
this.totalPage = 0 this.totalPage = 0

View File

@ -163,8 +163,8 @@
}) })
}).then(({data}) => { }).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataList = data.list this.dataList = data.data.list
this.totalPage = data.total this.totalPage = data.data.total
} else { } else {
this.dataList = [] this.dataList = []
this.totalPage = 0 this.totalPage = 0

View File

@ -247,8 +247,8 @@
}) })
}).then(({data}) => { }).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataList = data.list this.dataList = data.data.list
this.totalPage = data.total this.totalPage = data.data.total
} else { } else {
this.dataList = [] this.dataList = []
this.totalPage = 0 this.totalPage = 0

View File

@ -193,8 +193,8 @@
}) })
}).then(({data}) => { }).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataList = data.list this.dataList = data.data.list
this.totalPage = data.total this.totalPage = data.data.total
} else { } else {
this.dataList = [] this.dataList = []
this.totalPage = 0 this.totalPage = 0

View File

@ -187,8 +187,8 @@
}) })
}).then(({data}) => { }).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataList = data.list this.dataList = data.data.list
this.totalPage = data.total this.totalPage = data.data.total
} else { } else {
this.dataList = [] this.dataList = []
this.totalPage = 0 this.totalPage = 0

View File

@ -181,8 +181,8 @@
}) })
}).then(({data}) => { }).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataList = data.list this.dataList = data.data.list
this.totalPage = data.total this.totalPage = data.data.total
} else { } else {
this.dataList = [] this.dataList = []
this.totalPage = 0 this.totalPage = 0

View File

@ -187,8 +187,8 @@
}) })
}).then(({data}) => { }).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataList = data.list this.dataList = data.data.list
this.totalPage = data.total this.totalPage = data.data.total
} else { } else {
this.dataList = [] this.dataList = []
this.totalPage = 0 this.totalPage = 0

View File

@ -181,8 +181,8 @@
}) })
}).then(({data}) => { }).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataList = data.list this.dataList = data.data.list
this.totalPage = data.totalCount this.totalPage = data.data.totalCount
} else { } else {
this.dataList = [] this.dataList = []
this.totalPage = 0 this.totalPage = 0

View File

@ -187,8 +187,8 @@
}) })
}).then(({data}) => { }).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataList = data.list this.dataList = data.data.list
this.totalPage = data.total this.totalPage = data.data.total
} else { } else {
this.dataList = [] this.dataList = []
this.totalPage = 0 this.totalPage = 0

View File

@ -205,8 +205,8 @@
}) })
}).then(({data}) => { }).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataList = data.list this.dataList = data.data.list
this.totalPage = data.total this.totalPage = data.data.total
} else { } else {
this.dataList = [] this.dataList = []
this.totalPage = 0 this.totalPage = 0

View File

@ -193,8 +193,8 @@
}) })
}).then(({data}) => { }).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataList = data.list this.dataList = data.data.list
this.totalPage = data.total this.totalPage = data.data.total
} else { } else {
this.dataList = [] this.dataList = []
this.totalPage = 0 this.totalPage = 0

View File

@ -133,8 +133,8 @@
}) })
}).then(({data}) => { }).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataList = data.list this.dataList = data.data.list
this.totalPage = data.total this.totalPage = data.data.total
} else { } else {
this.dataList = [] this.dataList = []
this.totalPage = 0 this.totalPage = 0

View File

@ -163,8 +163,8 @@
}) })
}).then(({data}) => { }).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataList = data.list this.dataList = data.data.list
this.totalPage = data.total this.totalPage = data.data.total
} else { } else {
this.dataList = [] this.dataList = []
this.totalPage = 0 this.totalPage = 0

View File

@ -193,8 +193,8 @@
}) })
}).then(({data}) => { }).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataList = data.list this.dataList = data.data.list
this.totalPage = data.total this.totalPage = data.data.total
} else { } else {
this.dataList = [] this.dataList = []
this.totalPage = 0 this.totalPage = 0

View File

@ -157,8 +157,8 @@
}) })
}).then(({data}) => { }).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataList = data.list this.dataList = data.data.list
this.totalPage = data.total this.totalPage = data.data.total
} else { } else {
this.dataList = [] this.dataList = []
this.totalPage = 0 this.totalPage = 0

View File

@ -193,8 +193,8 @@
}) })
}).then(({data}) => { }).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataList = data.list this.dataList = data.data.list
this.totalPage = data.total this.totalPage = data.data.total
} else { } else {
this.dataList = [] this.dataList = []
this.totalPage = 0 this.totalPage = 0

View File

@ -175,8 +175,8 @@
}) })
}).then(({data}) => { }).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataList = data.list this.dataList = data.data.list
this.totalPage = data.total this.totalPage = data.data.total
} else { } else {
this.dataList = [] this.dataList = []
this.totalPage = 0 this.totalPage = 0

View File

@ -169,8 +169,8 @@
}) })
}).then(({data}) => { }).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataList = data.list this.dataList = data.data.list
this.totalPage = data.total this.totalPage = data.data.total
} else { } else {
this.dataList = [] this.dataList = []
this.totalPage = 0 this.totalPage = 0

View File

@ -157,8 +157,8 @@
}) })
}).then(({data}) => { }).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataList = data.list this.dataList = data.data.list
this.totalPage = data.total this.totalPage = data.data.total
} else { } else {
this.dataList = [] this.dataList = []
this.totalPage = 0 this.totalPage = 0

View File

@ -187,8 +187,8 @@
}) })
}).then(({data}) => { }).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataList = data.list this.dataList = data.data.list
this.totalPage = data.total this.totalPage = data.data.total
} else { } else {
this.dataList = [] this.dataList = []
this.totalPage = 0 this.totalPage = 0

View File

@ -163,8 +163,8 @@
}) })
}).then(({data}) => { }).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataList = data.list this.dataList = data.data.list
this.totalPage = data.total this.totalPage = data.data.total
} else { } else {
this.dataList = [] this.dataList = []
this.totalPage = 0 this.totalPage = 0

View File

@ -45,7 +45,10 @@
<p> <p>
<a href="http://demo.open.renren.io/renren-security" target="_blank">{{ $t('login.demo') }}</a> <a href="http://demo.open.renren.io/renren-security" target="_blank">{{ $t('login.demo') }}</a>
</p> </p>
<p><a href="https://www.renren.io/" target="_blank">{{ $t('login.copyright') }}</a>2022 © renren.io</p> <p>
<a href="https://www.renren.io/" target="_blank">{{ $t('login.copyright') }}</a>
2022 © renren.io
</p>
</div> </div>
</main> </main>
</div> </div>
@ -63,7 +66,7 @@ export default {
dataForm: { dataForm: {
username: 'admin', username: 'admin',
password: 'admin', password: 'admin',
uuid: '', uuid: ''
// captcha: '' // captcha: ''
} }
} }
@ -71,12 +74,8 @@ export default {
computed: { computed: {
dataRule() { dataRule() {
return { return {
username: [ username: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } password: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }]
],
password: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
],
// captcha: [ // captcha: [
// { required: true, message: this.$t('validate.required'), trigger: 'blur' } // { required: true, message: this.$t('validate.required'), trigger: 'blur' }
// ] // ]
@ -93,21 +92,28 @@ export default {
this.captchaPath = `${window.SITE_CONFIG['apiURL']}/captcha?uuid=${this.dataForm.uuid}` this.captchaPath = `${window.SITE_CONFIG['apiURL']}/captcha?uuid=${this.dataForm.uuid}`
}, },
// //
dataFormSubmitHandle: debounce(function () { dataFormSubmitHandle: debounce(
this.$refs['dataForm'].validate((valid) => { function() {
this.$refs['dataForm'].validate(valid => {
if (!valid) { if (!valid) {
return false return false
} }
this.$http.post(this.$http.adornUrl('/login'), this.dataForm).then(({ data: res }) => { this.$http
.post(this.$http.adornUrl('/login'), this.dataForm)
.then(({ data: res }) => {
if (res.code !== 200) { if (res.code !== 200) {
// this.getCaptcha() // this.getCaptcha()
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }
Cookies.set('token', res.data.token) Cookies.set('token', res.data.token)
this.$router.replace({ name: 'home' }) this.$router.replace({ name: 'home' })
}).catch(() => {})
}) })
}, 1000, { 'leading': true, 'trailing': false }) .catch(() => {})
})
},
1000,
{ leading: true, trailing: false }
)
} }
} }
</script> </script>