Commit ff8a903a authored by 乐宝呗666's avatar 乐宝呗666

修改接口返回数据的问题

parent 8f4de510
......@@ -33,22 +33,10 @@ axios.interceptors.response.use(response => {
function errorState(status, data) {
Toast.clear() // 关闭 loading
if (status === 500 && data.message.indexOf("token invalid") !== -1) {
Toast({
message: '您的登录过期,将重新登录!',
onClose: () => {
//清除用户信息
localStorage.removeItem('backToken')
localStorage.removeItem('userId')
router.push({
path: '/',
query: {
redirect: router.history.current.fullPath
}
})
}
});
} else if (status === 401) {
if (!data) {
Toast.fail("网络出小差咯~")
}
if (status === 401) {
Toast({
message: '您的用户权限已被禁用,请联系管理员!',
onClose: () => {
......@@ -63,10 +51,29 @@ function errorState(status, data) {
})
}
});
} else if (status === 500 && data.message.indexOf("not have permission") !== -1) {
Toast.fail("抱歉,你无权访问该页面!")
} else if (!data) {
Toast.fail("网络出小差咯~")
}
if (status === 500 && data.message) {
if(data.message.indexOf("token invalid") !== -1){
Toast({
message: '您的登录过期,将重新登录!',
onClose: () => {
//清除用户信息
localStorage.removeItem('backToken')
localStorage.removeItem('userId')
router.push({
path: '/',
query: {
redirect: router.history.current.fullPath
}
})
}
});
}
if(data.message.indexOf("not have permission") !== -1){
Toast.fail("抱歉,你无权访问该页面!")
}
} else {
Toast.fail(data)
}
}
......@@ -118,14 +125,16 @@ const httpServer = (opts, data, file, timeout) => {
axios(httpDefaultOpts).then((res) => {
Toast.clear()
clearTimeout(markIndex)
successState(res)
if (res) {
if (res.status === 200) {
successState(res)
resolve(res)
}else{
errorState(res.status, res.data)
}
}).catch((response) => {
Toast.clear()
clearTimeout(markIndex)
debugger
if (response && response.response && response.response.status && response.response.data) {
errorState(response.response.status, response.response.data)
}
......
......@@ -100,7 +100,6 @@ export default {
},
// 提交数据
onSubmit() {
console.log(this.form)
let vm = this
let param = {}
for (let key in this.form) {
......@@ -118,7 +117,6 @@ export default {
)
.then((res) => {
if (res.data.resultCode === "200") {
this.form = res.data.data;
this.$router.replace({
path: "/success",
query: { txt: "信息修改成功", url: "/admin" },
......
This diff is collapsed.
......@@ -21,7 +21,7 @@
<div class="content">
<div class="learnvideo">
<div class="learn-title">学习视频</div>
<div class="learn-body">
<div class="learn-body" v-if="item.videos.length">
<span v-for="(s,i) in item.videos" :key="i">
<video controls width='100%' height='100%' poster="images/applets/video.png">
<source :src="s" />
......@@ -36,16 +36,21 @@
x5-video-ignore-metadata='true' -->
</span>
</div>
<div class="learn-body" v-if="!item.videos.length">暂无数据</div>
</div>
<div class="learnphoto">
<div class="learn-title">学习照片</div>
<div class="learn-body">
<img :src="s" v-for="(s,i) in item.images" :key="i" alt="" @click="sceneImg(item.images,i)">
<div class="learn-body" v-if="item.images.length">
<span v-for="(s,i) in item.images" :key="i">
<img :src="s" alt="" @click="sceneImg(item.images,i)" v-if="s">
<span v-else>暂无数据</span>
</span>
</div>
<div class="learn-body" v-if="!item.images.length">暂无数据</div>
</div>
<div class="learntextarea">
<div class="learn-title">有话对党说</div>
<div class="learn-body">{{item.content}}</div>
<div class="learn-body">{{item.content|| '暂无数据'}}</div>
</div>
</div>
</van-collapse-item>
......@@ -161,9 +166,6 @@ export default {
padding: 24px 0px;
height: calc(100% - 200px);
overflow-y: auto;
.van-pull-refresh {
overflow-y:auto;
}
.van-cell {
padding-left: 0;
padding-right: 0;
......
......@@ -24,7 +24,7 @@
<div class="content">
<div class="row-body">
<div class="title-label">展板版权方</div>
<div class="title-body">{{ item.assetCopyrightOwnerName }}</div>
<div class="title-body">{{ item.boardCopyrightOwnerName }}</div>
</div>
<div class="row-body">
<div class="title-label">展板宣传图</div>
......@@ -35,14 +35,14 @@
<div class="detail-body">
<div class="learn-title">展板简介</div>
<div class="learn-body textarea">
{{ item.remarks }}
{{ item.remarks || '暂无数据'}}
</div>
</div>
<div class="detail-body">
<div class="learn-title">展板视频</div>
<div class="learn-body">
<span class="file-box" v-for="(s, i) in item.videoUrl" :key="i">
<div class="learn-body" v-if="item.videoList.length">
<span class="file-box" v-for="(s, i) in item.videoList" :key="i">
<video
controls
width="100%"
......@@ -54,13 +54,14 @@
<span>{{ s.fileName }}</span>
</span>
</div>
<div class="learn-body" v-if="!item.videoList.length">暂无数据</div>
</div>
<div class="detail-body">
<div class="learn-title">展板音频</div>
<div class="learn-body">
<span
class="file-box"
v-for="(s, i) in item.guideAudioUrl"
v-for="(s, i) in item.audioList"
:key="i"
>
<audio
......@@ -74,6 +75,7 @@
<span>{{ s.fileName }}</span>
</span>
</div>
<div class="learn-body" v-if="!item.audioList.length">暂无数据</div>
</div>
</div>
</van-collapse-item>
......@@ -115,10 +117,6 @@ export default {
if (res.data.resultCode === "200") {
this.list = res.data.data;
this.activeNames = this.list.exhibitionBoardList[0].id;
this.list.exhibitionBoardList.forEach((item) => {
item.videoUrl = JSON.parse(item.videoUrl);
item.guideAudioUrl = JSON.parse(item.guideAudioUrl);
});
} else {
this.$toast(res.data.message);
}
......
......@@ -21,6 +21,7 @@ module.exports = {
proxy: {
'/mall': {
target: "http://192.168.110.67/mall",
// target: "http://192.168.204.66:8088/mall", // 子鹏
changeOrigin: true,
pathRewrite: {
'^/mall': '/' // 重写接口
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment