登录选择小区

dev
bibi 3 years ago
parent 8efa6fa4d3
commit 4d652df0a1

@ -16,4 +16,27 @@ export function loginTel(params) {
data: params, data: params,
}) })
} }
// 退出登录 // 退出登录
export function quit(params) {
return httpService({
url: `/user/quit`,
method: 'post',
data: params,
})
}
// 省市区
export function allCity(params) {
return httpService({
url: `/city/allCity`,
method: 'get',
params: params,
})
}
// 查找所有小区
export function findcommunity(params) {
return httpService({
url: `/community/findAll`,
method: 'get',
params: params,
})
}

@ -1,6 +1,11 @@
import store from '@/store' import store from '@/store'
import axios from 'axios'
import qs from 'qs'
export default { export default {
install: function (Vue) { install: function (Vue) {
//axios
Vue.prototype.$axios = axios
Vue.prototype.qs = qs
// 上传 // 上传
Vue.prototype.$upload = process.env.VUE_APP_URL + store.getters.getCommunityCode + '/manage/user/upload/uploadImg' Vue.prototype.$upload = process.env.VUE_APP_URL + store.getters.getCommunityCode + '/manage/user/upload/uploadImg'
// 静态地址 // 静态地址

@ -17,7 +17,7 @@
type="link" type="link"
icon="form" icon="form"
slot="extra" slot="extra"
@click="editRole(item.id)" @click.stop="editRole(item.id)"
> >
</a-button> </a-button>
<a-button <a-button
@ -25,7 +25,7 @@
slot="extra" slot="extra"
style="color: #ff4d4f" style="color: #ff4d4f"
icon="delete" icon="delete"
@click="delRole(item.id)" @click.stop="delRole(item.id)"
></a-button> ></a-button>
<div <div
v-for="(rolechild, indexs) in item.childrenList" v-for="(rolechild, indexs) in item.childrenList"

@ -22,7 +22,7 @@
type="link" type="link"
icon="form" icon="form"
slot="extra" slot="extra"
@click="editRole(item.id)" @click.stop="editRole(item.id)"
> >
</a-button> </a-button>
<a-button <a-button
@ -30,7 +30,7 @@
slot="extra" slot="extra"
style="color: #ff4d4f" style="color: #ff4d4f"
icon="delete" icon="delete"
@click="delRole(item.id)" @click.stop="delRole(item.id)"
></a-button> ></a-button>
<div <div
v-for="(rolechild, indexs) in item.childrenList" v-for="(rolechild, indexs) in item.childrenList"

@ -39,6 +39,7 @@
</template> </template>
<script> <script>
import yMenu from "./yMenu"; import yMenu from "./yMenu";
import { quit } from "@/api/public/login"
export default { export default {
components: { components: {
yMenu, yMenu,
@ -100,9 +101,14 @@ export default {
this.tagActive = n; this.tagActive = n;
sessionStorage.setItem('index',n) sessionStorage.setItem('index',n)
}, },
logout(){ async logout(){
this.$router.push({name:'Login'}) let res = await quit()
this.setToken(null); if(res.code === 200){
this.$message.success(res.msg)
this.$router.push({name:'Login'});
}else{
this.$message.error(res.msg)
}
} }
}, },
}; };

@ -47,19 +47,19 @@
</a-row> </a-row>
</div> </div>
<div class="login-input" v-else-if="activeName === '2'"> <div class="login-input" v-else-if="activeName === '2'">
<a-select <a-cascader :options="cityList" placeholder="请选择城市" v-model='cityvalue' :show-search="{ filter }" @change="onChange" :field-names="{ label: 'name', value: 'id', children: 'cityList' }"/>
placeholder="请选择小区"
v-model="communityCode" <span class="form">
> <a-select v-model="communityCode" notFoundContent='该城市无可选择小区' :disabled='cityvalue.length===0' placeholder="请选择小区">
<a-select-option value="123456">华西村</a-select-option> <a-select-option v-for="item in communityList" :key='item.id' :value='item.code'>{{item.name}}</a-select-option>
<a-select-option value="1234">地球村</a-select-option> </a-select>
</a-select> <a-input placeholder="请输入手机号码" v-model="form.tel"></a-input>
<a-input placeholder="请输入手机号码" v-model="form.tel"></a-input> <a-input
<a-input placeholder="请输入验证码"
placeholder="请输入验证码" v-model="form.code"
v-model="form.code" style="width: 60%"
style="width: 60%" ></a-input>
></a-input> </span>
<a-button type="primary" @click="getCode"></a-button> <a-button type="primary" @click="getCode"></a-button>
<a-row> <a-row>
<a-col :span="12" style="margin-left: 23px" <a-col :span="12" style="margin-left: 23px"
@ -194,7 +194,7 @@
</template> </template>
<script> <script>
import { loginTel, sendTelCode } from "../../api/public/login"; import { loginTel, sendTelCode, allCity, findcommunity } from "../../api/public/login";
export default { export default {
name: "Login", name: "Login",
data() { data() {
@ -234,10 +234,14 @@ export default {
}, },
], ],
}, },
cityList:[],//
cityvalue:[], //
communityList:[] //
}; };
}, },
created() { created() {
this.keyupEnter(); this.keyupEnter();
this.getCity()
}, },
watch: { watch: {
communityCode:{ communityCode:{
@ -247,6 +251,30 @@ export default {
} }
}, },
methods: { methods: {
async getCity(){
let res = await allCity()
this.cityList = res.data
},
getCommunity(cityId){
this.$axios({
method:'get',
url:process.env.VUE_APP_URL+'manage/community/findAll',
params:{ //
cityId:cityId
}
}).then((response) =>{ //使ES6
this.communityList = response.data.data
}).catch((error) =>{
console.log(error) //
})
},
onChange(data){
this.getCommunity(data[2])
},
filter(inputValue, path) {
return path.some(cityList => cityList.name.toLowerCase().indexOf(inputValue.toLowerCase()) > -1);
},
// enter // enter
keyupEnter() { keyupEnter() {
document.onkeydown = (e) => { document.onkeydown = (e) => {
@ -367,7 +395,7 @@ export default {
/deep/.ant-form-item { /deep/.ant-form-item {
margin-top: -10px; margin-top: -10px;
} }
.login-input { .login-input .form{
text-align: left; text-align: left;
margin-top: 20px; margin-top: 20px;
/deep/.ant-input { /deep/.ant-input {
@ -375,7 +403,8 @@ export default {
border-bottom: 1px solid #f4eded; border-bottom: 1px solid #f4eded;
border-radius: 0; border-radius: 0;
width: 90%; width: 90%;
margin: 25px; margin-left: 25px;
margin-bottom: 20px;
} }
/deep/.ant-select { /deep/.ant-select {
border: 0px; border: 0px;
@ -383,7 +412,16 @@ export default {
border-radius: 0; border-radius: 0;
width: 90%; width: 90%;
margin-left: 25px; margin-left: 25px;
margin-bottom: 10px; margin-top: 15px;
margin-bottom: 15px;
} }
} }
/deep/.ant-cascader-picker{
text-align: left;
margin-top: 20px;
margin-left: 25px;
width:90%;
overflow-y:hidden;
overflow-x:hidden;
}
</style> </style>

Loading…
Cancel
Save