Commit 7aaf5f24 authored by leidahong's avatar leidahong

事件处理修复

parent e2776aad
......@@ -28,7 +28,6 @@ request.interceptors.response.use(
router.push("/");
} else {
Toast.fail(res.msg);
return res;
}
},
(err) => {
......
......@@ -3,8 +3,8 @@
<div class="banner">
<div class="user-box">
<img src="@/assets/imgs/def_photo.png" alt="头像" />
<div class="name">{{ $store.state.userInfo.userName }}</div>
<div class="dept">{{ $store.state.userInfo.nickName }}</div>
<div class="name">{{ userInfo.userName }}</div>
<div class="dept">{{ userInfo.nickName }}</div>
<div class="logout" @click="logout">退出登录</div>
</div>
</div>
......@@ -87,8 +87,10 @@ export default {
pageNum: 1,
pageSize: 10,
total: 0,
userInfo: {},
};
},
methods: {
getClass(day) {
if (day > 2) {
......@@ -170,6 +172,10 @@ export default {
activated() {
this.pageNum = 1;
this.getList();
this.userInfo = {
userName: localStorage.getItem("userName"),
nickName: localStorage.getItem("nickName"),
};
},
};
</script>
......
......@@ -62,6 +62,14 @@ export default {
},
methods: {
submit() {
if (this.afterHandleImgs.length === 0) {
Toast.fail("请上传处理后图片");
return;
}
if (this.content.trim() === "") {
Toast.fail("请填写处理内容");
return;
}
let data = {
beforeProcessImgList: this.beforeHandleImgs
.map((item) => item.url)
......@@ -75,10 +83,6 @@ export default {
};
handleEvent(data).then((res) => {
if (this.content.trim() === "") {
Toast.fail("请填写处理内容");
return;
}
if (res.code === 200) {
Toast.success("提交成功");
this.$router.replace("/home");
......
......@@ -29,7 +29,6 @@
</template>
<script>
import { getUserInfo, getMessageCount, getNishiseiInfo } from "../api/index";
export default {
name: "Home",
computed: {
......@@ -74,27 +73,6 @@ export default {
name: item.routerName,
});
},
getInfo() {
getUserInfo().then((res) => {
if (res.code === 200) {
this.$store.commit("SET_USERINFO", res.user);
}
});
getNishiseiInfo().then((res) => {
if (res.code === 200) {
localStorage.setItem("houseId", res.data.houseId);
localStorage.setItem("communityId", res.data.communityId);
}
});
getMessageCount().then((res) => {
if (res.code === 200) {
this.$store.commit("SET_READCOUNT", res.data);
}
});
},
},
mounted() {
this.getInfo();
},
};
</script>
......
......@@ -33,7 +33,14 @@
</template>
<script>
import { login, getCodeImg, getUserInfo } from "../api";
import {
login,
getCodeImg,
getUserInfo,
getNishiseiInfo,
getMessageCount,
} from "../api";
import { setToken } from "../utils/auth";
export default {
data() {
......@@ -62,6 +69,26 @@ export default {
login(this.form).then((res) => {
if (res.code === 200) {
setToken(res.data.access_token);
this.getInfo();
}
});
},
getInfo() {
getNishiseiInfo().then((res) => {
if (res.code === 200) {
localStorage.setItem("houseId", res.data.houseId);
localStorage.setItem("communityId", res.data.communityId);
}
});
getMessageCount().then((res) => {
if (res.code === 200) {
this.$store.commit("SET_READCOUNT", res.data);
}
});
getUserInfo().then((res) => {
if (res.code === 200) {
localStorage.setItem("userName", res.user.userName);
localStorage.setItem("nickName", res.user.nickName);
this.$router.replace("/home");
}
});
......
......@@ -12,7 +12,6 @@
/>
<van-field
is-link
:disabled="communityDisabled"
readonly
v-model="form.community"
v-bind="field('community', 1)"
......@@ -21,13 +20,12 @@
<van-field
readonly
is-link
:disabled="houseDisabled"
v-model="form.house"
v-bind="field('house', 1)"
@click="popupChange('house')"
/>
<van-field v-model="form.gridName" v-bind="field('gridName')" />
<van-field v-model="form.address" v-bind="field('address')" />
<van-field v-model="form.address" v-bind="field('address', 1)" />
<div class="content">
<van-field
......@@ -75,8 +73,11 @@
@click="popupChange('rankNo')"
/>
<van-field
readonly
is-link
v-model="form.expectedDays"
v-bind="field('expectedDays', 1)"
@click="popupChange('expectedDays')"
/>
<van-cell
readonly
......@@ -111,7 +112,13 @@
<van-popup v-model="popupShow" position="bottom">
<van-picker
v-if="
['category', 'rankNo', 'community', 'house'].includes(popupType)
[
'category',
'rankNo',
'community',
'house',
'expectedDays',
].includes(popupType)
"
show-toolbar
:columns="popupData"
......@@ -184,6 +191,11 @@ export default {
{ text: "三级事件", value: 3 },
],
community: [],
expectedDays: [
{ text: "1", value: 1 },
{ text: "3", value: 3 },
{ text: "7", value: 7 },
],
},
isPreview: false,
uploadType: "img",
......@@ -237,6 +249,9 @@ export default {
},
popupChange(type) {
if (type == "community" && this.communityDisabled) return;
if (type == "house" && this.houseDisabled) return;
this.popupType = type;
this.popupShow = true;
......@@ -253,6 +268,7 @@ export default {
}
},
reportDate: () => (this.currentDate = new Date()),
expectedDays: () => (this.popupData = this.popupList[type]),
};
handle[type]();
......@@ -292,6 +308,7 @@ export default {
},
rankNo: () => (this.form[this.popupType] = e.text),
reportDate: () => (this.form[this.popupType] = this.dateFormate(e)),
expectedDays: () => (this.form[this.popupType] = e.text),
};
handle[this.popupType]();
this.popupShow = false;
......
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