页面
This commit is contained in:
parent
5e32427925
commit
09e5b8014b
@ -19,20 +19,20 @@
|
|||||||
style="backdrop-filter: blur(2rpx); border-radius: 10rpx"
|
style="backdrop-filter: blur(2rpx); border-radius: 10rpx"
|
||||||
>
|
>
|
||||||
<view class="p-4">
|
<view class="p-4">
|
||||||
<view class="flex items-center leading-6" v-if="userInfo.id">
|
<view class="flex items-center leading-6" v-if="userStore.userInfo?.id">
|
||||||
<image class="w-18 h-18 rounded-full" :src="userInfo.avatar"></image>
|
<image class="w-18 h-18 rounded-full" :src="userStore.userInfo?.avatar"></image>
|
||||||
|
|
||||||
<view class="ml-2 flex-content-column">
|
<view class="ml-2 flex-content-column">
|
||||||
<view class="ps-1 font-size-4 font-bold">
|
<view class="ps-1 font-size-4 font-bold">
|
||||||
{{ userInfo.nickname }}
|
{{ userStore.userInfo?.nickname }}
|
||||||
</view>
|
</view>
|
||||||
<view class="ml-1 font-size-3" style="align-items: end">
|
<view class="ml-1 font-size-3" style="align-items: end">
|
||||||
<text class="pe-2 font-size-3">ID:{{ userInfo.id }}</text>
|
<text class="pe-2 font-size-3">ID:{{ userStore.userInfo?.id }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex items-center leading-6" v-else @click="toLogin">
|
<view class="flex items-center leading-6" v-else @click="toLogin">
|
||||||
<image class="w-18 h-18 rounded-full" :src="userInfo.avatar"></image>
|
<image class="w-18 h-18 rounded-full" :src="userStore.userInfo?.avatar"></image>
|
||||||
<view class="ml-2 font-size-4">去登录</view>
|
<view class="ml-2 font-size-4">去登录</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -121,100 +121,94 @@
|
|||||||
<fly-login v-model="show" />
|
<fly-login v-model="show" />
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<!-- setup -->
|
|
||||||
<script lang="ts" name="WxLogin">
|
|
||||||
import { getUrl, getWebUrl, getShopWebUrl, hasLogin } from '@/utils'
|
|
||||||
|
|
||||||
|
<script lang="ts" setup name="WxLogin">
|
||||||
import { useUserStore } from '@/store'
|
import { useUserStore } from '@/store'
|
||||||
const userStore = useUserStore()
|
import { getUrl, getWebUrl, getShopWebUrl, hasLogin } from '@/utils'
|
||||||
import { defineComponent } from 'vue'
|
|
||||||
|
|
||||||
export default defineComponent({
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
isLogin: false,
|
|
||||||
userIsLogin: false,
|
|
||||||
show: false,
|
|
||||||
userInfo: {},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onLoad(option) {
|
|
||||||
this.getUserInfo()
|
|
||||||
// this.userStore = useUserStore()
|
|
||||||
// this.userIsLogin = useUserStore().userInfo.id ? true : false
|
|
||||||
// console.log('获取用户信息', this.userIsLogin)
|
|
||||||
// console.log('获取用户信息', this.userInfo)
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
toLogin() {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: '/pages/login/login',
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
async getUserInfo() {
|
|
||||||
this.hasLogin = userStore.userInfo.nickname
|
|
||||||
const res = await getInfoAPI()
|
|
||||||
if (res.code === 1) {
|
|
||||||
console.log('用户信息:', res.data)
|
|
||||||
this.userInfo = res.data
|
|
||||||
this.addressinfo.group_id = res.data.group_id
|
|
||||||
this.addressinfo.phone = res.data.phone
|
|
||||||
this.address_string = res.data.district_name + res.data.street_name + res.data.village_name
|
|
||||||
|
|
||||||
this.nickname = this.userInfo['nickname']
|
|
||||||
this.phone = this.userInfo['phone']
|
|
||||||
}
|
|
||||||
},
|
|
||||||
more(item) {
|
|
||||||
this.islogin = hasLogin()
|
|
||||||
if (this.islogin === false) {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: '/pages/login/login',
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (this.islogin === true) {
|
|
||||||
// console.log(item)
|
|
||||||
if (item.type == 1) {
|
|
||||||
getUrl(item.url)
|
|
||||||
} else if (item.type == 2) {
|
|
||||||
getWebUrl(item.url)
|
|
||||||
} else if (item.type == 3) {
|
|
||||||
getShopWebUrl(item.url)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
// function more(item) {
|
|
||||||
// const islogin = hasLogin()
|
|
||||||
// // const islogin = true
|
|
||||||
// if (islogin === false) {
|
|
||||||
// uni.navigateTo({
|
|
||||||
// url: '/pages/login/login',
|
|
||||||
// })
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (islogin === true) {
|
|
||||||
// // console.log(item)
|
|
||||||
// if (item.type == 1) {
|
|
||||||
// getUrl(item.url)
|
|
||||||
// } else if (item.type == 2) {
|
|
||||||
// getWebUrl(item.url)
|
|
||||||
// } else if (item.type == 3) {
|
|
||||||
// getShopWebUrl(item.url)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// const show = ref(false)
|
|
||||||
// const userStore = useUserStore()
|
// const userStore = useUserStore()
|
||||||
|
|
||||||
// function toLogin() {
|
import { defineComponent } from 'vue'
|
||||||
// uni.navigateTo({
|
|
||||||
// url: '/pages/login/login',
|
// export default defineComponent({
|
||||||
|
// data() {
|
||||||
|
// return {
|
||||||
|
// isLogin: false,
|
||||||
|
// userIsLogin: false,
|
||||||
|
// show: false,
|
||||||
|
// userStore: {},
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// onLoad(option) {
|
||||||
|
// this.userStore = useUserStore()
|
||||||
|
// this.userIsLogin = useUserStore().userInfo.id ? true : false
|
||||||
|
// console.log('获取用户信息', this.userIsLogin)
|
||||||
|
// console.log('获取用户信息', this.userStore.userInfo)
|
||||||
|
// },
|
||||||
|
// methods: {
|
||||||
|
// toLogin() {
|
||||||
|
// uni.navigateTo({
|
||||||
|
// url: '/pages/login/login',
|
||||||
|
// })
|
||||||
|
// },
|
||||||
|
// more(item) {
|
||||||
|
// this.islogin = hasLogin()
|
||||||
|
// if (this.islogin === false) {
|
||||||
|
// uni.navigateTo({
|
||||||
|
// url: '/pages/login/login',
|
||||||
|
// })
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
// if (this.islogin === true) {
|
||||||
|
// // console.log(item)
|
||||||
|
// if (item.type == 1) {
|
||||||
|
// getUrl(item.url)
|
||||||
|
// } else if (item.type == 2) {
|
||||||
|
// getWebUrl(item.url)
|
||||||
|
// } else if (item.type == 3) {
|
||||||
|
// getShopWebUrl(item.url)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// })
|
||||||
|
function more(item) {
|
||||||
|
const islogin = hasLogin()
|
||||||
|
// const islogin = true
|
||||||
|
if (islogin === false) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/login/login',
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (islogin === true) {
|
||||||
|
// console.log(item)
|
||||||
|
if (item.type == 1) {
|
||||||
|
getUrl(item.url)
|
||||||
|
} else if (item.type == 2) {
|
||||||
|
getWebUrl(item.url)
|
||||||
|
} else if (item.type == 3) {
|
||||||
|
getShopWebUrl(item.url)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const show = ref(false)
|
||||||
|
const userStore = useUserStore()
|
||||||
|
|
||||||
|
function toLogin() {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/login/login',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// const logout = () => {
|
||||||
|
// uni.showModal({
|
||||||
|
// title: '确认退出当前账号?',
|
||||||
|
// success: (res) => {
|
||||||
|
// if (res.confirm) {
|
||||||
|
// userStore.logout()
|
||||||
|
// }
|
||||||
|
// },
|
||||||
// })
|
// })
|
||||||
// }
|
// }
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<!-- <route lang="json5">
|
<route lang="json5">
|
||||||
{
|
{
|
||||||
style: { navigationStyle: 'custom', navigationBarTitleText: '我的' },
|
style: { navigationStyle: 'custom', navigationBarTitleText: '我的' },
|
||||||
}
|
}
|
||||||
@ -13,225 +13,25 @@
|
|||||||
import { useUserStore } from '@/store'
|
import { useUserStore } from '@/store'
|
||||||
import { http } from '@/utils/http'
|
import { http } from '@/utils/http'
|
||||||
import WxLogin from './components/wx-login.vue'
|
import WxLogin from './components/wx-login.vue'
|
||||||
</script> -->
|
|
||||||
|
|
||||||
<route lang="json5">
|
|
||||||
{
|
|
||||||
style: { navigationStyle: 'custom', navigationBarTitleText: '我的' },
|
|
||||||
}
|
|
||||||
</route>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<view class="background_home">
|
|
||||||
<view class=" " style="">
|
|
||||||
<view class="relative h-50">
|
|
||||||
<!-- <wd-img
|
|
||||||
radius="0px 0px 20rpx 20rpx "
|
|
||||||
:width="'100%'"
|
|
||||||
:height="'100%'"
|
|
||||||
src="https://img.shetu66.com/2023/06/14/1686734441937414.png"
|
|
||||||
/> -->
|
|
||||||
<view
|
|
||||||
class="m-4 absolute bottom-0 text-left left-0 right-0 text-white bg-black bg-opacity-0"
|
|
||||||
style="backdrop-filter: blur(2rpx); border-radius: 10rpx"
|
|
||||||
>
|
|
||||||
<view class="p-4">
|
|
||||||
<view class="flex items-center leading-6" v-if="userInfo.id">
|
|
||||||
<image class="w-18 h-18 rounded-full" :src="userInfo.avatar"></image>
|
|
||||||
|
|
||||||
<view class="ml-2 flex-content-column">
|
|
||||||
<view class="ps-1 font-size-4 font-bold">
|
|
||||||
{{ userInfo.nickname }}
|
|
||||||
</view>
|
|
||||||
<view class="ml-1 font-size-3" style="align-items: end">
|
|
||||||
<text class="pe-2 font-size-3">ID:{{ userInfo.id }}</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="flex items-center leading-6" v-else @click="toLogin">
|
|
||||||
<image class="w-18 h-18 rounded-full" :src="userInfo.avatar"></image>
|
|
||||||
<view class="ml-2 font-size-4">去登录</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="p-2">
|
|
||||||
<wd-card>
|
|
||||||
<wd-grid :gutter="2" :column="4">
|
|
||||||
<view
|
|
||||||
@click="more(item)"
|
|
||||||
v-for="item in [
|
|
||||||
{
|
|
||||||
name: '我的钱包',
|
|
||||||
url: '/pages/users/user_money/index',
|
|
||||||
type: 2,
|
|
||||||
icon: '/static/icons/my1.png',
|
|
||||||
color: 'green',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '我的订单',
|
|
||||||
url: '/pages/users/order_list/index?status=-1',
|
|
||||||
type: 2,
|
|
||||||
icon: '/static/icons/my2.png',
|
|
||||||
color: 'green',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '我的收藏',
|
|
||||||
url: '/pages/users/user_goods_collection/index',
|
|
||||||
type: 2,
|
|
||||||
icon: '/static/icons/my3.png',
|
|
||||||
color: 'blue',
|
|
||||||
},
|
|
||||||
// {
|
|
||||||
// name: '浏览记录',
|
|
||||||
// url: '/pages/users/browsingHistory/index',
|
|
||||||
// type: 2,
|
|
||||||
// icon: '/static/icons/my4.png',
|
|
||||||
// color: 'blue',
|
|
||||||
// },
|
|
||||||
{
|
|
||||||
name: '平台客服',
|
|
||||||
url: '17309090670',
|
|
||||||
type: 2,
|
|
||||||
icon: '/static/icons/my4.png',
|
|
||||||
color: 'blue',
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
name: '上传商品',
|
|
||||||
url: '/pages/my/uploadProduct',
|
|
||||||
type: 1,
|
|
||||||
icon: '/static/icons/my5.png',
|
|
||||||
color: 'red',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '设置',
|
|
||||||
url: '/pages/my/setting',
|
|
||||||
type: 1,
|
|
||||||
icon: '/static/icons/my7.png',
|
|
||||||
color: 'red',
|
|
||||||
},
|
|
||||||
// {
|
|
||||||
// name: '上传商品',
|
|
||||||
// url: '/pages/my/uploadProduct',
|
|
||||||
// type: 1,
|
|
||||||
// icon: '/static/icons/rural_ecommerce.png',
|
|
||||||
// color: 'red',
|
|
||||||
// },
|
|
||||||
]"
|
|
||||||
>
|
|
||||||
<wd-grid-item use-slot>
|
|
||||||
<view class="p-2">
|
|
||||||
<wd-img radius="20rpx" :width="'60rpx'" :height="'60rpx'" :src="item.icon" />
|
|
||||||
<view class="p-2 text-center color-black font-size-3">
|
|
||||||
{{ item.name }}
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</wd-grid-item>
|
|
||||||
</view>
|
|
||||||
</wd-grid>
|
|
||||||
</wd-card>
|
|
||||||
<!-- <button v-if="hasLogin" class="mt-2" @click="logout">退出登录</button> -->
|
|
||||||
</view>
|
|
||||||
<fly-login v-model="show" />
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
<!-- setup -->
|
|
||||||
<script lang="ts" name="WxLogin">
|
|
||||||
import { getUrl, getWebUrl, getShopWebUrl, hasLogin } from '@/utils'
|
|
||||||
import { getInfoAPI } from '@/service/crmeb/product.ts'
|
|
||||||
import { useUserStore } from '@/store'
|
|
||||||
const userStore = useUserStore()
|
|
||||||
import { defineComponent } from 'vue'
|
|
||||||
|
|
||||||
export default defineComponent({
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
isLogin: false,
|
|
||||||
userIsLogin: false,
|
|
||||||
show: false,
|
|
||||||
userInfo: {},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onLoad(option) {
|
|
||||||
this.getUserInfo()
|
|
||||||
// this.userStore = useUserStore()
|
|
||||||
// this.userIsLogin = useUserStore().userInfo.id ? true : false
|
|
||||||
// console.log('获取用户信息', this.userIsLogin)
|
|
||||||
// console.log('获取用户信息', this.userInfo)
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
toLogin() {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: '/pages/login/login',
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
async getUserInfo() {
|
|
||||||
this.hasLogin = userStore.userInfo.nickname
|
|
||||||
const res = await getInfoAPI()
|
|
||||||
if (res.code === 1) {
|
|
||||||
console.log('用户信息:', res.data)
|
|
||||||
this.userInfo = res.data
|
|
||||||
// this.addressinfo.group_id = res.data.group_id
|
|
||||||
// this.addressinfo.phone = res.data.phone
|
|
||||||
// this.address_string = res.data.district_name + res.data.street_name + res.data.village_name
|
|
||||||
|
|
||||||
// this.nickname = this.userInfo['nickname']
|
|
||||||
// this.phone = this.userInfo['phone']
|
|
||||||
}
|
|
||||||
},
|
|
||||||
more(item) {
|
|
||||||
this.islogin = hasLogin()
|
|
||||||
if (this.islogin === false) {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: '/pages/login/login',
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (this.islogin === true) {
|
|
||||||
// console.log(item)
|
|
||||||
if (item.type == 1) {
|
|
||||||
getUrl(item.url)
|
|
||||||
} else if (item.type == 2) {
|
|
||||||
getWebUrl(item.url)
|
|
||||||
} else if (item.type == 3) {
|
|
||||||
getShopWebUrl(item.url)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
// function more(item) {
|
|
||||||
// const islogin = hasLogin()
|
|
||||||
// // const islogin = true
|
|
||||||
// if (islogin === false) {
|
|
||||||
// uni.navigateTo({
|
|
||||||
// url: '/pages/login/login',
|
|
||||||
// })
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (islogin === true) {
|
|
||||||
// // console.log(item)
|
|
||||||
// if (item.type == 1) {
|
|
||||||
// getUrl(item.url)
|
|
||||||
// } else if (item.type == 2) {
|
|
||||||
// getWebUrl(item.url)
|
|
||||||
// } else if (item.type == 3) {
|
|
||||||
// getShopWebUrl(item.url)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// const show = ref(false)
|
|
||||||
// const userStore = useUserStore()
|
// const userStore = useUserStore()
|
||||||
|
// const hasLogin = computed(() => userStore.userInfo?.nickname)
|
||||||
|
|
||||||
// function toLogin() {
|
// userStore.wxLogin()
|
||||||
// uni.navigateTo({
|
// // 用户登录,获取openId
|
||||||
// url: '/pages/login/login',
|
// uni.login({
|
||||||
// })
|
// provider: 'weixin',
|
||||||
// }
|
// success: async ({ code }) => {
|
||||||
|
// const res = await http<{ session_key: string; openid: string }>({
|
||||||
|
// method: 'POST',
|
||||||
|
// url: '/api/auth/routineLogin',
|
||||||
|
// data: {
|
||||||
|
// code,
|
||||||
|
// },
|
||||||
|
// })
|
||||||
|
// console.log('微信登录-1:', res)
|
||||||
|
// // {code: 0, msg: "success", data: {session_key: "JTzhLVK+oM3X58uJ/heDcQ==", openid: "oSYa06xPVqjsK-eFYzt0kSPYu1q4"}}
|
||||||
|
// openId.value = res.data.openid
|
||||||
|
// userStore.setUserInfo({ openid: res.data.openid })
|
||||||
|
// },
|
||||||
|
// })
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user