需要修复商城顶部筛选左右滑动问题

This commit is contained in:
cbb
2025-12-24 17:53:13 +08:00
parent 6f418fae8a
commit b67f9611c7
48 changed files with 1067 additions and 221 deletions

View File

@@ -0,0 +1,7 @@
<script setup></script>
<template>
<view class="contacts">通讯录</view>
</template>
<style lang="scss" scoped></style>

View File

@@ -0,0 +1,75 @@
<script setup>
import { navigateTo } from '@/utils/router'
const btnList = [
{ name: '等级排行榜', icon: 'grade' },
{ name: '签到', icon: 'sign' },
{ name: '公司介绍', icon: 'company' },
{ name: '朋友圈', icon: 'circle' },
{ name: '线上商城', icon: 'mall' },
{ name: '我的拼团', icon: 'team' },
{ name: '项目入口', icon: 'project' }
]
const onGo = item => {
if (item === 'mall') {
navigateTo('/pages/mall/list')
}
}
</script>
<template>
<view class="discover-box">
<view
v-for="(item, index) in btnList"
:key="index"
class="card-box"
@click="onGo(item.icon)"
>
<view class="left-box">
<image
:src="`/static/images/discover/${item.icon}.png`"
mode="heightFix"
class="icon"
></image>
<text>{{ item.name }}</text>
</view>
<image
src="/static/images/public/right-arrow.png"
mode="heightFix"
class="right-box"
></image>
</view>
</view>
</template>
<style lang="scss" scoped>
.discover-box {
padding: 32rpx 24rpx;
.card-box {
padding: 20rpx 32rpx;
display: flex;
justify-content: space-between;
align-items: center;
.left-box {
display: flex;
align-items: center;
.icon {
height: 80rpx;
margin-right: 16rpx;
}
text {
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 32rpx;
color: #333333;
font-style: normal;
text-transform: none;
}
}
.right-box {
height: 32rpx;
}
}
}
</style>

View File

@@ -1,59 +1,67 @@
<template>
<view class="content">
<image class="logo" src="/static/logo.png"></image>
<view class="text-area">
<text class="title">{{ title }}</text>
</view>
</view>
</template>
<script setup>
import { onMounted, ref } from 'vue'
const cb = v => {
console.log(v)
}
import { onLoad } from '@dcloudio/uni-app'
import { onMounted, ref } from 'vue'
import { reLaunch } from '@/utils/router'
const cb = v => {
console.log(v)
}
// export default {
// data() {
// return {
// title: 'Hello'
// }
// },
// onLoad() {
// export default {
// data() {
// return {
// title: 'Hello'
// }
// },
// onLoad() {
// },
// methods: {
// },
// methods: {
// }
// }
const title = ref('你112好')
// }
// }
onLoad(() => {
// 3秒后跳转
setTimeout(() => {
reLaunch('/pages/news-list/news-list')
}, 3000)
})
const title = ref('这个是启动页')
</script>
<template>
<view class="content">
<image class="logo" src="/static/logo.png"></image>
<view class="text-area">
<text class="title">{{ title }}</text>
</view>
</view>
</template>
<style>
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.logo {
height: 200rpx;
width: 200rpx;
margin-top: 200rpx;
margin-left: auto;
margin-right: auto;
margin-bottom: 50rpx;
}
.logo {
height: 200rpx;
width: 200rpx;
margin-top: 200rpx;
margin-left: auto;
margin-right: auto;
margin-bottom: 50rpx;
}
.text-area {
display: flex;
justify-content: center;
}
.text-area {
display: flex;
justify-content: center;
}
.title {
font-size: 36rpx;
color: #8f8f94;
}
.title {
font-size: 36rpx;
color: #8f8f94;
}
</style>

View File

@@ -1,5 +1,8 @@
<script setup>
import { ref, reactive } from 'vue'
import { useUI } from '@/utils/use-ui'
const { showToast } = useUI()
const formData = reactive({
username: '',
@@ -15,6 +18,16 @@
}
const onBottomBtn = () => {
if (!formData.username) {
showToast('请输入手机号/邮箱')
return
}
if (!formData.password) {
showToast('请输入密码')
return
}
console.log('确认')
}
</script>
@@ -38,14 +51,14 @@
v-model="formData.username"
placeholder="请输入手机号/邮箱"
></cb-input>
<cb-input
<!-- <cb-input
v-model="formData.code"
v-model:code="isCode"
type="number"
icon="6"
placeholder="请输入验证码"
@onGetCode="getCode"
></cb-input>
></cb-input> -->
<cb-input
v-model="formData.password"
type="password"

View File

@@ -3,8 +3,13 @@
import { onLoad } from '@dcloudio/uni-app'
import { useUI } from '@/utils/use-ui'
import { reLaunch, navigateTo } from '@/utils/router'
import { userLogin } from '@/api'
import { useTokenStore } from '@/stores/token'
import { useUserStore } from '@/stores/user'
const { showToast } = useUI()
const { setToken } = useTokenStore()
const { fetchUserInfo } = useUserStore()
const formData = reactive({
username: '',
@@ -12,9 +17,18 @@
agreement: false
})
const onLogin = () => {
showToast('登录成功')
console.log('登录:', formData)
const onLogin = async () => {
if (!formData.agreement) {
showToast('请同意协议')
return
}
const res = await userLogin({
account: formData.username,
password: formData.password
})
setToken(res.token)
await fetchUserInfo()
reLaunch('/pages/news-list/news-list')
}
const onRegister = () => {
@@ -26,7 +40,7 @@
}
onLoad(e => {
console.log('接收==', e.id)
console.log('接收参数,返回对应页面的时候使用', e)
})
</script>
@@ -50,9 +64,7 @@
<agreement-checkbox v-model="formData.agreement" />
<cb-button
class="bottom-btn"
:disabled="
!formData.username || !formData.password || !formData.agreement
"
:disabled="!formData.username || !formData.password"
@click="onLogin"
>
登录

View File

@@ -0,0 +1,7 @@
<script setup></script>
<template>
<view class="mall-confirm-order">确认订单</view>
</template>
<style lang="scss" scoped></style>

7
pages/mall/detail.vue Normal file
View File

@@ -0,0 +1,7 @@
<script setup></script>
<template>
<view class="mall-detail">商品详情</view>
</template>
<style lang="scss" scoped></style>

78
pages/mall/list.vue Normal file
View File

@@ -0,0 +1,78 @@
<script setup>
import { reactive } from 'vue'
// 顶部分类选项
const topNavOptions = [
{ name: '全部', value: '0' },
{ name: '休闲零食', value: '1' },
{ name: '中外名酒', value: '2' },
{ name: '家用洗漱', value: '3' },
{ name: '家电家具', value: '4' },
{ name: '电子产品', value: '5' },
{ name: '户外用品', value: '6' }
]
const formData = reactive({
name: '',
type: '0'
})
const onTop = value => {
formData.type = value
}
</script>
<template>
<view class="mall-list">
<cb-search v-model="formData.name"></cb-search>
<view class="top-options">
<view
v-for="item in topNavOptions"
:key="item.value"
:class="{ active: item.value === formData.type }"
class="text"
@click="onTop(item.value)"
>
{{ item.name }}
</view>
</view>
</view>
</template>
<style lang="scss" scoped>
.mall-list {
padding: 24rpx;
.top-options {
overflow: hidden;
margin-top: 32rpx;
display: flex;
flex-direction: row;
white-space: nowrap; /* 重要:防止换行 */
-webkit-overflow-scrolling: touch; /* iOS 平滑滚动 */
.text + .text {
margin-left: 16rpx;
}
.text {
flex-shrink: 0;
padding: 8rpx 16rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 28rpx;
color: #999999;
text-align: center;
font-style: normal;
text-transform: none;
background: #f4f4f4;
border-radius: 64rpx;
box-sizing: border-box;
}
.active {
padding: 6rpx 14rpx;
border-radius: 64rpx;
border: 2rpx solid #00d993;
color: #00d993;
}
}
}
</style>

221
pages/my-index/my-index.vue Normal file
View File

@@ -0,0 +1,221 @@
<script setup>
import { useUserStore } from '@/stores/user'
const bottomList = [
{ name: '我的钱包', icon: 'wallet' },
{ name: '我的团队', icon: 'team' },
{ name: '会议记录', icon: 'meeting' },
{ name: '我的朋友圈', icon: 'circle' },
{ name: '我的收藏', icon: 'collection' },
{ name: '在线客服', icon: 'customer' },
{ name: '系统设置', icon: 'system' }
]
const { userInfo } = useUserStore()
console.log(userInfo)
</script>
<template>
<view class="my-index">
<view class="top-info">
<view class="left-box">
<image
src="https://wx1.sinaimg.cn/mw690/92eeb099gy1i29hl0ne80j21jk2bcash.jpg"
mode="scaleToFill"
class="avatar"
></image>
<view class="nickname">
<text class="name">{{ userInfo.userName }}</text>
<text class="name">ID:{{ userInfo.userId }}</text>
</view>
</view>
<image
src="/static/images/public/right-arrow.png"
mode="heightFix"
class="right-box"
></image>
</view>
<!-- 卡片列表 -->
<view class="card-list">
<view class="top-box">
<view class="left-name">
<text>账户积分</text>
<text>2933</text>
</view>
<view class="right-btn">
<button>充值</button>
<button>提现</button>
</view>
</view>
<!-- 入口列表 -->
<view
v-for="(item, index) in bottomList"
:key="index"
class="item-box"
>
<view class="item-name">
<image
:src="`/static/images/my-index/${item.icon}.png`"
mode="heightFix"
class="icon"
></image>
<text>{{ item.name }}</text>
</view>
<image
src="/static/images/public/right-arrow.png"
mode="heightFix"
class="right-box"
></image>
</view>
</view>
</view>
</template>
<style lang="scss" scoped>
page {
background-color: #f7f7f7;
}
.my-index {
padding: 32rpx 26rpx;
.right-box {
height: 32rpx;
}
.top-info {
padding: 32rpx 46rpx;
background: #ffffff;
height: 192rpx;
border-radius: 16rpx;
display: flex;
justify-content: space-between;
align-items: center;
.left-box {
display: flex;
align-items: center;
.avatar {
width: 128rpx;
height: 128rpx;
border-radius: 128rpx;
margin-right: 32rpx;
}
.nickname {
display: flex;
flex-direction: column;
.name {
font-family: PingFang SC, PingFang SC;
font-weight: bold;
font-size: 32rpx;
color: #333333;
text-align: left;
font-style: normal;
text-transform: none;
&:last-child {
font-weight: 500;
font-size: 24rpx;
color: #999999;
margin-top: 16rpx;
}
}
}
}
}
.card-list {
margin-top: 28rpx;
background: #ffffff;
border-radius: 16rpx;
overflow: hidden;
.top-box {
padding: 12rpx 36rpx;
display: flex;
justify-content: space-between;
align-items: center;
background: linear-gradient(180deg, #00d993 0%, #00d9c5 100%);
position: relative;
&::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-image: url('/static/images/my-index/my-card-bg.png');
background-size: 30%;
background-position: center;
background-repeat: no-repeat;
z-index: 1;
pointer-events: none;
}
.left-name {
display: flex;
flex-direction: column;
text {
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 28rpx;
color: #ffffff;
text-align: center;
font-style: normal;
text-transform: none;
&:last-child {
font-weight: bold;
font-size: 40rpx;
margin-top: 10rpx;
}
}
}
.right-btn {
display: flex;
button {
width: 128rpx;
height: 64rpx;
line-height: 64rpx;
border-radius: 100rpx 100rpx 100rpx 100rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 28rpx;
color: #ffffff;
text-align: center;
font-style: normal;
text-transform: none;
background: transparent;
border: 2rpx solid #ffffff;
&::after {
border: none;
}
&:last-child {
margin-left: 16rpx;
background: #ffffff;
color: #00d993;
border: none;
}
}
}
}
.item-box {
padding: 23rpx 32rpx;
display: flex;
justify-content: space-between;
align-items: center;
.item-name {
display: flex;
justify-content: space-between;
align-items: center;
.icon {
height: 64rpx;
margin-right: 16rpx;
}
text {
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 32rpx;
color: #333333;
font-style: normal;
text-transform: none;
}
}
}
}
}
</style>

View File

@@ -0,0 +1,12 @@
<script setup>
import { useUserStore } from '@/stores/user'
const { userInfo } = useUserStore()
console.log(userInfo.userId, '====userInfo===')
</script>
<template>
<view class="news-list">消息列表</view>
</template>
<style lang="scss" scoped></style>