Commit 7aaf5f24 authored by leidahong's avatar leidahong

事件处理修复

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