页面
This commit is contained in:
parent
3e613abdd7
commit
60ec7f93cc
@ -6,7 +6,7 @@ export interface IUserInfoVo {
|
|||||||
nickname: string
|
nickname: string
|
||||||
avatar: string
|
avatar: string
|
||||||
token: string
|
token: string
|
||||||
isset: boolean
|
village_id: number
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -126,7 +126,11 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/service/find",
|
"path": "pages/service/find",
|
||||||
"type": "page"
|
"type": "page",
|
||||||
|
"layout": "tabbar",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "服务"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/service/index",
|
"path": "pages/service/index",
|
||||||
|
@ -118,7 +118,7 @@ export default defineComponent({
|
|||||||
banner_list: [],
|
banner_list: [],
|
||||||
show: false,
|
show: false,
|
||||||
index_list: {},
|
index_list: {},
|
||||||
detail: {},
|
// detail: {},
|
||||||
category: {},
|
category: {},
|
||||||
currentTab: 1,
|
currentTab: 1,
|
||||||
city: '',
|
city: '',
|
||||||
@ -128,7 +128,7 @@ export default defineComponent({
|
|||||||
async onLoad(option) {
|
async onLoad(option) {
|
||||||
console.log(option)
|
console.log(option)
|
||||||
this.getCategory()
|
this.getCategory()
|
||||||
this.getDetail(1)
|
// this.getDetail(1)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
changeTab(item) {
|
changeTab(item) {
|
||||||
@ -149,11 +149,11 @@ export default defineComponent({
|
|||||||
// 使用正确的 map 方法返回新数组
|
// 使用正确的 map 方法返回新数组
|
||||||
this.index_list = res.data
|
this.index_list = res.data
|
||||||
},
|
},
|
||||||
async getDetail(id) {
|
// async getDetail(id) {
|
||||||
const res = await getArticleDetailAPI({ id: id })
|
// const res = await getArticleDetailAPI({ id: id })
|
||||||
// 使用正确的 map 方法返回新数组
|
// // 使用正确的 map 方法返回新数组
|
||||||
this.detail = res.data
|
// this.detail = res.data
|
||||||
},
|
// },
|
||||||
goPage(item) {
|
goPage(item) {
|
||||||
getUrl('/pages/about/detail?id=' + item.id)
|
getUrl('/pages/about/detail?id=' + item.id)
|
||||||
},
|
},
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
<route lang="json5">
|
||||||
|
{
|
||||||
|
layout: 'tabbar',
|
||||||
|
style: {
|
||||||
|
navigationBarTitleText: '服务',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</route>
|
||||||
<script>
|
<script>
|
||||||
import QQMapWX from 'qqmap-wx-jssdk'
|
import QQMapWX from 'qqmap-wx-jssdk'
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ const { safeAreaInsets } = uni.getSystemInfoSync()
|
|||||||
function more(item) {
|
function more(item) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
// url: `/pages/web_view/index?target=${item.url}&title=${item.name}`,
|
// url: `/pages/web_view/index?target=${item.url}&title=${item.name}`,
|
||||||
url: `/pages/service/find?keyword=${item.name}`,
|
url: `/pages/service/find?keyword=${item.keyword}`,
|
||||||
})
|
})
|
||||||
|
|
||||||
// uni.openLocation({
|
// uni.openLocation({
|
||||||
@ -81,54 +81,54 @@ function more(item) {
|
|||||||
color: 'green',
|
color: 'green',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: '农事服务',
|
name: '母婴服务',
|
||||||
keyword: '停车场',
|
keyword: '母婴',
|
||||||
url: '/pages/store/home/index?id=13',
|
url: '/pages/store/home/index?id=13',
|
||||||
icon: '/static/icons/fj_2.png',
|
icon: '/static/icons/fj_2.png',
|
||||||
color: 'blue',
|
color: 'blue',
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
name: '店铺街',
|
// name: '店铺街',
|
||||||
keyword: '停车场',
|
// keyword: '停车场',
|
||||||
url: '/pages/store/shopStreet/index',
|
// url: '/pages/store/shopStreet/index',
|
||||||
icon: '/static/icons/fj_3.png',
|
// icon: '/static/icons/fj_3.png',
|
||||||
color: 'orange',
|
// color: 'orange',
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
name: '特产产品',
|
// name: '特产产品',
|
||||||
keyword: '停车场',
|
// keyword: '停车场',
|
||||||
url: '/pages/activity/lease/index',
|
// url: '/pages/activity/lease/index',
|
||||||
icon: '/static/icons/fj_4.png',
|
// icon: '/static/icons/fj_4.png',
|
||||||
color: 'green',
|
// color: 'green',
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
name: '特色美食',
|
name: '特色美食',
|
||||||
keyword: '停车场',
|
keyword: '美食',
|
||||||
url: '/pages/store/home/index?id=13',
|
url: '/pages/store/home/index?id=13',
|
||||||
icon: '/static/icons/fj_5.png',
|
icon: '/static/icons/fj_5.png',
|
||||||
color: 'blue',
|
color: 'blue',
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
name: '当季产品',
|
// name: '当季产品',
|
||||||
keyword: '停车场',
|
// keyword: '停车场',
|
||||||
url: '/pages/activity/lease/index',
|
// url: '/pages/activity/lease/index',
|
||||||
icon: '/static/icons/fj_6.png',
|
// icon: '/static/icons/fj_6.png',
|
||||||
color: 'orange',
|
// color: 'orange',
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
name: '美丽乡村',
|
// name: '美丽乡村',
|
||||||
keyword: '停车场',
|
// keyword: '乡村',
|
||||||
url: '/pages/activity/lease/index',
|
// url: '/pages/activity/lease/index',
|
||||||
icon: '/static/icons/fj_7.png',
|
// icon: '/static/icons/fj_7.png',
|
||||||
color: 'red',
|
// color: 'red',
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
name: '景区景色',
|
// name: '景区景色',
|
||||||
keyword: '景区',
|
// keyword: '景区',
|
||||||
url: '/pages/activity/lease/index',
|
// url: '/pages/activity/lease/index',
|
||||||
icon: '/static/icons/fj_8.png',
|
// icon: '/static/icons/fj_8.png',
|
||||||
color: 'red',
|
// color: 'red',
|
||||||
},
|
// },
|
||||||
]"
|
]"
|
||||||
@click="more(item)"
|
@click="more(item)"
|
||||||
>
|
>
|
||||||
@ -181,13 +181,13 @@ function more(item) {
|
|||||||
icon: '/static/icons/ly_2.png',
|
icon: '/static/icons/ly_2.png',
|
||||||
color: 'blue',
|
color: 'blue',
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
name: '天气预报',
|
// name: '天气预报',
|
||||||
keyword: '景区',
|
// keyword: '景区',
|
||||||
url: '/pages/activity/lease/index',
|
// url: '/pages/activity/lease/index',
|
||||||
icon: '/static/icons/ly_3.png',
|
// icon: '/static/icons/ly_3.png',
|
||||||
color: 'orange',
|
// color: 'orange',
|
||||||
},
|
// },
|
||||||
]"
|
]"
|
||||||
@click="more(item)"
|
@click="more(item)"
|
||||||
>
|
>
|
||||||
|
@ -19,6 +19,7 @@ const userStore = useUserStore()
|
|||||||
|
|
||||||
// 检查是否授权
|
// 检查是否授权
|
||||||
const userId = computed(() => userStore.userInfo?.id)
|
const userId = computed(() => userStore.userInfo?.id)
|
||||||
|
const village_id = computed(() => userStore.userInfo?.village_id)
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -44,7 +45,7 @@ export default defineComponent({
|
|||||||
const target = option.target
|
const target = option.target
|
||||||
console.log('userId', userId.value)
|
console.log('userId', userId.value)
|
||||||
if (isMpWeixin) {
|
if (isMpWeixin) {
|
||||||
this.local_url = `${getUrlCrmebLogin()}?target=${target}&user_id=${userId.value}`
|
this.local_url = `${getUrlCrmebLogin()}?target=${target}&user_id=${userId.value}&village_id=${village_id.value}`
|
||||||
} else {
|
} else {
|
||||||
this.local_url = getUrlCrmebLogin() + target
|
this.local_url = getUrlCrmebLogin() + target
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ const userInfoState: IUserInfoVo = {
|
|||||||
nickname: '',
|
nickname: '',
|
||||||
avatar: '/static/images/default-avatar.png',
|
avatar: '/static/images/default-avatar.png',
|
||||||
token: '',
|
token: '',
|
||||||
isset: false,
|
village_id: 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useUserStore = defineStore(
|
export const useUserStore = defineStore(
|
||||||
@ -39,7 +39,7 @@ export const useUserStore = defineStore(
|
|||||||
// // val.avatar = 'https://oss.laf.run/ukw0y1-site/avatar.jpg?feige'
|
// // val.avatar = 'https://oss.laf.run/ukw0y1-site/avatar.jpg?feige'
|
||||||
// }
|
// }
|
||||||
// 判断是否设置村庄
|
// 判断是否设置村庄
|
||||||
val.isset = val.village ? true : false
|
val.village_id = val.village ? val.village : 0
|
||||||
userInfo.value = val
|
userInfo.value = val
|
||||||
}
|
}
|
||||||
const setUserAvatar = (avatar: string) => {
|
const setUserAvatar = (avatar: string) => {
|
||||||
@ -65,7 +65,7 @@ export const useUserStore = defineStore(
|
|||||||
removeUserInfo()
|
removeUserInfo()
|
||||||
}
|
}
|
||||||
const newData = userInfo.value
|
const newData = userInfo.value
|
||||||
newData.isset = !!user.village
|
newData.village_id = user.village ? user.village : 0
|
||||||
newData.avatar = user.avatar
|
newData.avatar = user.avatar
|
||||||
newData.nickname = user.nickname
|
newData.nickname = user.nickname
|
||||||
userInfo.value = newData
|
userInfo.value = newData
|
||||||
|
@ -223,11 +223,13 @@ import { useUserStore } from '@/store'
|
|||||||
export async function hasLogin() {
|
export async function hasLogin() {
|
||||||
const res = await getInfoAPI()
|
const res = await getInfoAPI()
|
||||||
// const res = await http.get('/api/user/info', {})
|
// const res = await http.get('/api/user/info', {})
|
||||||
console.log('hasLogin', res)
|
// console.log('hasLogin', res)
|
||||||
|
console.log('village_id', useUserStore().userInfo.village_id)
|
||||||
if (res.code === 401) {
|
if (res.code === 401) {
|
||||||
const hasLogin = false
|
const hasLogin = false
|
||||||
//强制跳转设置村庄
|
//强制跳转设置村庄
|
||||||
if (hasLogin && !useUserStore().userInfo.isset) {
|
|
||||||
|
if (hasLogin && useUserStore().userInfo.village_id === 0) {
|
||||||
// if (!this.phone) {
|
// if (!this.phone) {
|
||||||
// uni.showToast({
|
// uni.showToast({
|
||||||
// title: '请填写手机号',
|
// title: '请填写手机号',
|
||||||
@ -253,7 +255,7 @@ export async function hasLogin() {
|
|||||||
} else {
|
} else {
|
||||||
const hasLogin = true
|
const hasLogin = true
|
||||||
//强制跳转设置村庄
|
//强制跳转设置村庄
|
||||||
if (hasLogin && !useUserStore().userInfo.isset) {
|
if (hasLogin && useUserStore().userInfo.village_id === 0) {
|
||||||
// if (!this.phone) {
|
// if (!this.phone) {
|
||||||
// uni.showToast({
|
// uni.showToast({
|
||||||
// title: '请填写手机号',
|
// title: '请填写手机号',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user