yuanshun
1 year ago
14 changed files with 395 additions and 8 deletions
@ -0,0 +1,27 @@ |
|||
import request from "../utils/request"; |
|||
|
|||
|
|||
//城市列表
|
|||
export function cityList(data:any) { |
|||
return request({ |
|||
url: '/sys/city/list', |
|||
method: 'get', |
|||
params:data |
|||
}) |
|||
} |
|||
//轮播
|
|||
export function bannerList(data:any) { |
|||
return request({ |
|||
url: '/home/banner/list', |
|||
method: 'get', |
|||
params:data |
|||
}) |
|||
} |
|||
//职位类型
|
|||
export function positionTypeList(data:any) { |
|||
return request({ |
|||
url: '/position/positionTypeApi', |
|||
method: 'get', |
|||
params:data |
|||
}) |
|||
} |
@ -1,4 +1,4 @@ |
|||
import { createPinia } from "pinia"; |
|||
|
|||
const store = createPinia |
|||
const store = createPinia(); |
|||
export default store |
@ -0,0 +1,27 @@ |
|||
import { defineStore } from 'pinia' |
|||
import { bannerList, positionTypeList } from '../api/task'; |
|||
export const taskStore = defineStore({ |
|||
id: 'task', |
|||
state: () => { |
|||
return { |
|||
cityList: [], |
|||
cityValue: localStorage.getItem('city') || '北京', |
|||
bannerList: [], |
|||
positionList:[] |
|||
} |
|||
}, |
|||
actions: { |
|||
setCityValue(value: string){ |
|||
this.cityValue = value |
|||
}, |
|||
setCityList(data: any){ |
|||
this.cityList=data |
|||
}, |
|||
setBannerList(data: any) { |
|||
this.bannerList=data |
|||
}, |
|||
setPositionList(data: any) { |
|||
this.positionList=data |
|||
} |
|||
} |
|||
}) |
@ -0,0 +1,23 @@ |
|||
import { defineStore } from 'pinia' |
|||
export const userStore = defineStore({ |
|||
id: 'user', |
|||
state: () => { |
|||
return { |
|||
token: localStorage.getItem('token') || '', |
|||
role: localStorage.getItem('role') || '1', |
|||
userInfo: {} |
|||
} |
|||
}, |
|||
actions: { |
|||
setRole(type: string){ |
|||
this.role = type |
|||
}, |
|||
setUserInfo(data: any){ |
|||
this.userInfo = data.user_info |
|||
this.token = data.token |
|||
this.role = data.user_info.role || '1' |
|||
localStorage.setItem('token',this.token) |
|||
localStorage.setItem('role',this.role) |
|||
}, |
|||
} |
|||
}) |
@ -0,0 +1,37 @@ |
|||
<script setup lang="ts"> |
|||
import { ref,reactive } from "vue"; |
|||
import { getPolicy} from '@/api/user' |
|||
import { showToast } from 'vant' |
|||
const state:any=reactive({ |
|||
htmlText:'' |
|||
}) |
|||
const onClickLeft = () => history.back(); |
|||
const getPolicyChange= async ()=>{ |
|||
const res:any=await getPolicy({ |
|||
id:16, |
|||
}) |
|||
if(res){ |
|||
state.htmlText=res.records[0].content |
|||
}else{ |
|||
showToast(res.msg) |
|||
} |
|||
} |
|||
getPolicyChange() |
|||
</script> |
|||
|
|||
<template> |
|||
<van-nav-bar |
|||
title="隐私政策" |
|||
left-text="" |
|||
left-arrow |
|||
@click-left="onClickLeft" |
|||
/> |
|||
<div class="text-agree"> |
|||
<div v-html="state.htmlText"></div> |
|||
</div> |
|||
</template> |
|||
<style scoped> |
|||
.text-agree{ |
|||
padding: 0.5rem 0.7rem; |
|||
} |
|||
</style> |
@ -0,0 +1,37 @@ |
|||
<script setup lang="ts"> |
|||
import { ref,reactive } from "vue"; |
|||
import { getPolicy} from '@/api/user' |
|||
import { showToast } from 'vant' |
|||
const state:any=reactive({ |
|||
htmlText:'' |
|||
}) |
|||
const onClickLeft = () => history.back(); |
|||
const getPolicyChange= async ()=>{ |
|||
const res:any=await getPolicy({ |
|||
id:17, |
|||
}) |
|||
if(res){ |
|||
state.htmlText=res.records[0].content |
|||
}else{ |
|||
showToast(res.msg) |
|||
} |
|||
} |
|||
getPolicyChange() |
|||
</script> |
|||
|
|||
<template> |
|||
<van-nav-bar |
|||
title="服务协议" |
|||
left-text="" |
|||
left-arrow |
|||
@click-left="onClickLeft" |
|||
/> |
|||
<div class="text-agree"> |
|||
<div v-html="state.htmlText"></div> |
|||
</div> |
|||
</template> |
|||
<style scoped> |
|||
.text-agree{ |
|||
padding: 0.5rem 0.7rem; |
|||
} |
|||
</style> |
@ -0,0 +1,45 @@ |
|||
<script setup lang="ts"> |
|||
import { inject } from 'vue'; |
|||
import { bannerList } from "../../../api/task"; |
|||
import { taskStore } from "../../../store/task"; |
|||
import { showToast } from 'vant' |
|||
|
|||
const store=taskStore() |
|||
const getBannerList=async ()=>{ |
|||
const res:any =await bannerList({type:2}) |
|||
console.log('city------',res); |
|||
if(res){ |
|||
store.setBannerList(res.list) |
|||
}else{ |
|||
showToast(res.msg) |
|||
} |
|||
} |
|||
if(store.bannerList.length<=0){ |
|||
getBannerList() |
|||
} |
|||
|
|||
</script> |
|||
<template> |
|||
<van-swipe :autoplay="3000" lazy-render> |
|||
<van-swipe-item v-for="(item,index) in store.bannerList" :key="index" > |
|||
<a :href="item.url" target="_blank" v-if="item.url"> |
|||
<img :src="item.picture" /> |
|||
</a> |
|||
<img v-else ="item.url" :src="item.picture" /> |
|||
</van-swipe-item> |
|||
</van-swipe> |
|||
|
|||
</template> |
|||
<style scoped> |
|||
>>> .van-swipe__track{ |
|||
height: 7.47rem; |
|||
} |
|||
.van-swipe__indicators{ |
|||
display: none; |
|||
} |
|||
>>> img{ |
|||
width: 100%; |
|||
height: 7.47rem; |
|||
border-radius: 0.5rem; |
|||
} |
|||
</style> |
@ -0,0 +1,69 @@ |
|||
<script setup lang="ts"> |
|||
import { inject } from 'vue'; |
|||
import { cityList } from "../../../api/task"; |
|||
import { taskStore } from "../../../store/task"; |
|||
import { showToast } from 'vant' |
|||
|
|||
const { closeCitySwitch }:any = inject('popup',) |
|||
const store=taskStore() |
|||
const leftBack = ()=>{ |
|||
closeCitySwitch() |
|||
} |
|||
const getCityList=async ()=>{ |
|||
const res:any =await cityList({}) |
|||
console.log('city------',res); |
|||
if(res){ |
|||
store.setCityList(res) |
|||
}else{ |
|||
showToast(res.msg) |
|||
} |
|||
} |
|||
if(store.cityList.length<=0){ |
|||
getCityList() |
|||
} |
|||
|
|||
</script> |
|||
<template> |
|||
|
|||
<van-nav-bar title="城市切换" left-arrow @click-left="leftBack"/> |
|||
<div class="city-switch"> |
|||
<h3>当前城市</h3> |
|||
<div class="city-switch-text"> |
|||
<span>{{ store.cityValue }}</span> |
|||
</div> |
|||
<h3>切换城市</h3> |
|||
<div class="city-switch-text"> |
|||
<span v-for="(item,index) in store.cityList" :key="index" @click="closeCitySwitch(item.name)">{{ item.name }}</span> |
|||
</div> |
|||
</div> |
|||
|
|||
</template> |
|||
<style scoped> |
|||
.city-switch{ |
|||
padding: 0 0.7rem; |
|||
} |
|||
.city-switch h3{ |
|||
font-size: 0.8rem; |
|||
line-height: 0.8rem; |
|||
font-weight: 500; |
|||
color: #000000; |
|||
margin: 0.7rem 0 0.96rem; |
|||
} |
|||
.city-switch-text span{ |
|||
width: 4.01rem; |
|||
height: 1.6rem; |
|||
line-height: 1.6rem; |
|||
background: #FFFFFF; |
|||
border: 1px solid #EBEBEB; |
|||
border-radius: 0.11rem; |
|||
font-size: 0.64rem; |
|||
text-align: center; |
|||
font-weight: 400; |
|||
color: #333333; |
|||
margin: 0 0.7rem 0.8rem 0; |
|||
display: inline-block; |
|||
} |
|||
.city-switch-text span:nth-child(4n){ |
|||
margin-right: 0px; |
|||
} |
|||
</style> |
@ -0,0 +1,85 @@ |
|||
<script setup lang="ts"> |
|||
import { inject,reactive } from 'vue'; |
|||
import { positionTypeList } from "../../../api/task"; |
|||
import { taskStore } from "../../../store/task"; |
|||
import { showToast } from 'vant' |
|||
const state=reactive({ |
|||
typeKey:0 |
|||
}) |
|||
const { closePositionType }:any = inject('popup') |
|||
const store=taskStore() |
|||
const leftBack = ()=>{ |
|||
closePositionType() |
|||
} |
|||
const getPositionTypeList=async ()=>{ |
|||
const res:any =await positionTypeList({}) |
|||
console.log('getPositionTypeList------',res); |
|||
if(res){ |
|||
store.setPositionList(res) |
|||
}else{ |
|||
showToast(res.msg) |
|||
} |
|||
} |
|||
if(store.positionList.length<=0){ |
|||
getPositionTypeList() |
|||
} |
|||
|
|||
</script> |
|||
<template> |
|||
|
|||
<van-nav-bar title="职位" left-arrow @click-left="leftBack"/> |
|||
<div class="position-type"> |
|||
<div class="position-type-left"> |
|||
<h5 :class="state.typeKey==index?'active':''" v-for="(item, index) in store.positionList" :key="index" >{{item.name}}</h5> |
|||
</div> |
|||
<div class="position-type-right"> |
|||
<span v-for="(item, index) in store.positionList[state.typeKey] && store.positionList[state.typeKey].children" :key="index">{{item.name}}</span> |
|||
</div> |
|||
</div> |
|||
|
|||
</template> |
|||
<style scoped> |
|||
.position-type{ |
|||
display: flex; |
|||
} |
|||
.position-type-left{ |
|||
width: 4.77rem; |
|||
height: calc(100vh - 46px); |
|||
background: #F6F6F6; |
|||
} |
|||
.position-type-left h5{ |
|||
width: 4.77rem; |
|||
height: 2.4rem; |
|||
line-height: 2.4rem; |
|||
background: #F6F6F6; |
|||
border-bottom: 1px solid #ffffff; |
|||
font-size: 0.75rem; |
|||
font-weight: 300; |
|||
color: #333333; |
|||
text-align: center; |
|||
} |
|||
.position-type-left h5.active{ |
|||
background: #EFEFEF; |
|||
} |
|||
.position-type-right{ |
|||
padding: 0.8rem 0 0 0.6rem; |
|||
} |
|||
.position-type-right span{ |
|||
width: 6.61rem; |
|||
height: 2.03rem; |
|||
line-height: 2.03rem; |
|||
background: #FFFFFF; |
|||
border: 1px solid #E9E9E9; |
|||
border-radius: 0.11rem; |
|||
font-size: 0.75rem; |
|||
font-weight: 300; |
|||
color: #666666; |
|||
text-align: center; |
|||
margin-right: 0.59rem; |
|||
margin-bottom: 0.64rem; |
|||
display: inline-block; |
|||
} |
|||
.position-type-right span:nth-child(2n){ |
|||
margin-right: 0px; |
|||
} |
|||
</style> |
Loading…
Reference in new issue