From dbf2597d3b8ab4560c3a2aeb0d514dee5c35f3cd Mon Sep 17 00:00:00 2001
From: sfmind <130201237@qq.com>
Date: Sat, 19 Nov 2022 21:40:26 +0800
Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84=E9=A1=B5=E9=9D=A2=E6=8A=BD?=
=?UTF-8?q?=E5=8F=96=E7=BB=84=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../components/yd-banner/yd-banner.vue | 58 ++++
.../yd-product-box/yd-product-box.vue | 173 ++++++++++++
.../yd-product-more/yd-product-more.vue | 114 ++++++++
.../yd-text-price.vue} | 2 +-
yudao-ui-app/pages/index/index.vue | 255 ++----------------
yudao-ui-app/pages/profile/profile.vue | 68 ++---
6 files changed, 407 insertions(+), 263 deletions(-)
create mode 100644 yudao-ui-app/components/yd-banner/yd-banner.vue
create mode 100644 yudao-ui-app/components/yd-product-box/yd-product-box.vue
create mode 100644 yudao-ui-app/components/yd-product-more/yd-product-more.vue
rename yudao-ui-app/components/{custom-text-price/custom-text-price.vue => yd-text-price/yd-text-price.vue} (97%)
diff --git a/yudao-ui-app/components/yd-banner/yd-banner.vue b/yudao-ui-app/components/yd-banner/yd-banner.vue
new file mode 100644
index 0000000000..cef6606990
--- /dev/null
+++ b/yudao-ui-app/components/yd-banner/yd-banner.vue
@@ -0,0 +1,58 @@
+
+ (current = e.current)" :autoplay="true" @click="handleSwiperClick">
+
+
+
+
+
+
+
+
+
diff --git a/yudao-ui-app/components/yd-product-box/yd-product-box.vue b/yudao-ui-app/components/yd-product-box/yd-product-box.vue
new file mode 100644
index 0000000000..ad35b968fe
--- /dev/null
+++ b/yudao-ui-app/components/yd-product-box/yd-product-box.vue
@@ -0,0 +1,173 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/yudao-ui-app/components/yd-product-more/yd-product-more.vue b/yudao-ui-app/components/yd-product-more/yd-product-more.vue
new file mode 100644
index 0000000000..c5f6377214
--- /dev/null
+++ b/yudao-ui-app/components/yd-product-more/yd-product-more.vue
@@ -0,0 +1,114 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/yudao-ui-app/components/custom-text-price/custom-text-price.vue b/yudao-ui-app/components/yd-text-price/yd-text-price.vue
similarity index 97%
rename from yudao-ui-app/components/custom-text-price/custom-text-price.vue
rename to yudao-ui-app/components/yd-text-price/yd-text-price.vue
index dd5da46207..fab0339725 100644
--- a/yudao-ui-app/components/custom-text-price/custom-text-price.vue
+++ b/yudao-ui-app/components/yd-text-price/yd-text-price.vue
@@ -11,7 +11,7 @@
* 此组件简单的显示特定样式的(人名币)价格数字
*/
export default {
- name: 'custom-text-price',
+ name: 'yd-text-price',
components: {},
props: {
price: {
diff --git a/yudao-ui-app/pages/index/index.vue b/yudao-ui-app/pages/index/index.vue
index 8abb50891c..137de3b221 100644
--- a/yudao-ui-app/pages/index/index.vue
+++ b/yudao-ui-app/pages/index/index.vue
@@ -8,17 +8,13 @@
- (current = e.current)" :autoplay="true" @click="handleSwiperClick">
-
-
-
-
+
-
+
+
{{ item.title }}
@@ -30,81 +26,11 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -115,9 +41,23 @@ export default {
components: {},
data() {
return {
- current: 0,
- currentNum: 0,
- bannerList: ['https://cdn.uviewui.com/uview/swiper/swiper3.png', 'https://cdn.uviewui.com/uview/swiper/swiper2.png', 'https://cdn.uviewui.com/uview/swiper/swiper1.png'],
+ bannerList: [
+ {
+ id: 1,
+ title: '山不在高,有仙则名',
+ url: 'https://cdn.uviewui.com/uview/swiper/swiper1.png'
+ },
+ {
+ id: 2,
+ title: '水不在深,有龙则灵',
+ url: 'https://cdn.uviewui.com/uview/swiper/swiper2.png'
+ },
+ {
+ id: 3,
+ title: '斯是陋室,惟吾德馨',
+ url: 'https://cdn.uviewui.com/uview/swiper/swiper3.png'
+ }
+ ],
menuList: [
{ icon: 'gift', title: '热门推荐' },
{ icon: 'star', title: '收藏转发' },
@@ -162,15 +102,12 @@ export default {
price: '53.00'
}
],
- status: 'nomore',
- loadingText: '努力加载中...',
- loadmoreText: '轻轻上拉',
- nomoreText: '实在没有了...'
+ moreStatus: 'nomore'
}
},
onLoad() {
- this.loadBannerData();
- this.loadNoticeData();
+ this.loadBannerData()
+ this.loadNoticeData()
},
methods: {
loadBannerData() {
@@ -185,24 +122,9 @@ export default {
},
handleSearchClick(e) {
uni.$u.route('/pages/search/search')
- },
- handleSwiperClick(index) {
- console.log('点击了图片索引值:', index)
- },
- handleProdItemClick(productId) {
- uni.$u.route('/pages/product/product', {
- productId: productId
- })
}
},
computed: {
- swiperList() {
- return this.bannerList.map(item => {
- if (item) {
- return item
- }
- })
- },
noticeTextList() {
return this.noticeList.map(item => {
if (item.title) {
@@ -220,131 +142,8 @@ export default {
padding: 20rpx;
}
-.indicator {
- @include flex(row);
- justify-content: center;
-
- &__dot {
- height: 15rpx;
- width: 15rpx;
- border-radius: 100rpx;
- background-color: rgba(255, 255, 255, 0.35);
- margin: 0 10rpx;
- transition: background-color 0.3s;
-
- &--active {
- background-color: $custom-bg-color;
- }
- }
-}
-
.grid-title {
line-height: 50rpx;
font-size: 26rpx;
}
-
-.prod-block {
- margin-top: -160px;
- .bloc-header {
- @include flex-space-between;
- padding: 10rpx 20rpx;
-
- .bloc-title {
- color: $custom-bg-color;
- font-size: 34rpx;
- }
- .see-more {
- color: $custom-bg-color;
- background: $u-primary;
- padding: 0 30rpx;
- height: 50rpx;
- line-height: 50rpx;
- border-radius: 50rpx;
- font-size: 24rpx;
- }
- }
-
- &.half,
- &.list {
- margin-top: 0;
- .bloc-header {
- margin-top: 50rpx;
- margin-bottom: 20rpx;
- .bloc-title {
- color: #333333;
- }
- .more {
- font-size: 24rpx;
- }
- }
- }
-
- .prod-grid {
- width: 730rpx;
- margin: 0 auto;
- @include flex;
- flex-wrap: wrap;
- justify-content: left;
-
- &.half {
- .prod-item {
- width: 345rpx;
- margin: 10rpx;
- .prod-image {
- width: 345rpx;
- height: 345rpx;
- }
- }
- }
-
- .prod-item {
- width: 223rpx;
- margin: 10rpx;
- background: #ffffff;
- border-radius: 10rpx;
- box-shadow: 0rpx 6rpx 8rpx rgba(58,134,185,0.2);
- .prod-image {
- width: 223rpx;
- height: 223rpx;
- border-radius: 10rpx 10rpx 0 0;
- }
- .item-info {
- padding: 15rpx;
- .info-text {
- height: 70rpx;
- padding-bottom: 10rpx;
- }
- .price-and-cart {
- @include flex-space-between;
- }
- }
- }
- }
-}
-
-.prod-list {
- .prod-item {
- background: #ffffff;
- @include flex-space-between;
- border-bottom: $custom-border-style;
- padding: 20rpx;
- .prod-image {
- width: 200rpx;
- height: 200rpx;
- border-radius: 10rpx;
- }
-
- .item-info {
- flex: 1;
- padding: 20rpx 20rpx 0;
- .info-text {
- height: 100rpx;
- padding-bottom: 10rpx;
- }
- .price-and-cart {
- @include flex-space-between;
- }
- }
- }
-}
diff --git a/yudao-ui-app/pages/profile/profile.vue b/yudao-ui-app/pages/profile/profile.vue
index 9b66ea80ee..28dd56bc26 100644
--- a/yudao-ui-app/pages/profile/profile.vue
+++ b/yudao-ui-app/pages/profile/profile.vue
@@ -10,43 +10,22 @@
昵称:
-
- {{ userInfo.nickname }}
-
-
-
-
-
-
-
-
+
+
手机:
{{ userInfo.mobile }}
-
+
+
+
+
+
@@ -62,8 +41,13 @@ export default {
mobile: ''
},
avatarFiles: [],
- nameEditOn: false,
- tempName: ''
+ tempName: '',
+ borderStyle: 'none'
+ }
+ },
+ computed: {
+ nameUpdateVisible: function () {
+ return this.userInfo.nickname !== this.tempName
}
},
onLoad() {
@@ -73,6 +57,7 @@ export default {
loadUserInfoData() {
getUserInfo().then(res => {
this.userInfo = res.data
+ this.tempName = this.userInfo.nickname
})
},
handleAvatarClick() {
@@ -86,11 +71,22 @@ export default {
}
})
},
+ handleNameChange(val) {
+ let str = uni.$u.trim(val, 'all')
+ this.$nextTick(() => {
+ this.userInfo.nickname = str
+ })
+ },
handleSaveBtnClick() {
- updateNickname({ nickname: this.tempName }).then(res => {
- this.nameEditOn = false;
- this.userInfo.nickname = this.tempName
+ updateNickname({ nickname: this.userInfo.nickname }).then(res => {
+ this.tempName = this.userInfo.nickname
this.$store.commit('SET_USER_INFO', this.userInfo)
+ uni.$u.toast('已保存')
+ setTimeout(() => {
+ uni.switchTab({
+ url: '/pages/user/user'
+ })
+ }, 300)
})
}
}
@@ -107,7 +103,7 @@ export default {
font-size: 30rpx;
}
.info {
- @include flex-right;
+ @include flex-left;
.value {
font-size: 30rpx;
}
@@ -126,4 +122,8 @@ export default {
}
}
}
+
+.btn-group {
+ padding: 0 30rpx;
+}