Browse Source

feat:权益包兑换

dev_des
1054425342@qq.com 2 months ago
parent
commit
6bb401b366
  1. 192
      components/DynamicIsland.vue
  2. 23
      pages/index/iSoul.vue
  3. 473
      pages/index/index.vue

192
components/DynamicIsland.vue

@ -16,82 +16,94 @@
> >
<!-- 展开状态 --> <!-- 展开状态 -->
<view v-if="!actualCompactState" class="expanded-content"> <view v-if="!actualCompactState" class="expanded-content">
<!-- <view style="display: flex;align-items: center;justify-content: center;color: white;" v-if="!(userInfo&&userInfo.token)"> <!-- <view style="display: flex;align-items: center;justify-content: center;color: white;" v-if="!(userInfo&&userInfo.token)">
去登录 去登录
</view> --> </view> -->
<template > <template>
<template v-if="styleType != 'timeShop'"> <template v-if="styleType != 'timeShop'">
<view class="top-section"> <view class="top-section">
<text class="welcome-text" v-if="userInfo&&userInfo.token">{{ title }}</text> <text class="welcome-text" v-if="userInfo && userInfo.token">{{
<text class="welcome-text" v-else @click="toLogin">hi 快去登录 ></text> title
<view class="qr-code"> }}</text>
<image <text class="welcome-text" v-else @click="toLogin"
style="width: 39rpx; height: 39rpx" >hi 快去登录 ></text
src="https://epic.js-dyyj.com/uploads/20250728/88e0991e58e692c86c25e42537edc6ca.png" >
></image> <view class="qr-code">
</view> <image
</view> style="width: 39rpx; height: 39rpx"
<view class="bottom-section"> src="https://epic.js-dyyj.com/uploads/20250728/88e0991e58e692c86c25e42537edc6ca.png"
<view class="stats-section"> ></image>
<view class="stat-item"> </view>
<text class="stat-number">{{ getStatNumber("权益") }}</text> </view>
<text class="stat-label">权益</text> <view class="bottom-section">
</view> <view class="stats-section">
<view class="stat-item"> <view class="stat-item">
<text class="stat-number">{{ getStatNumber("时间银行") }}</text> <text class="stat-number">{{ getStatNumber("权益") }}</text>
<text class="stat-label">时间银行</text> <text class="stat-label">权益</text>
</view> </view>
</view> <view class="stat-item">
<view class="divider"></view> <text class="stat-number">{{
<view class="action-section"> getStatNumber("时间银行")
<text class="action-text">{{ actionText }}</text> }}</text>
<image <text class="stat-label">时间银行</text>
@click="toWebView" </view>
class="avatar" </view>
src="https://epic.js-dyyj.com/uploads/20250728/7d9ba1fe109643681396cb03f60f3218.png" <view class="divider"></view>
mode="aspectFill" <view class="action-section">
></image> <text class="action-text">{{ actionText }}</text>
</view> <image
</view> @click="toWebView"
</template> class="avatar"
<template v-if="styleType == 'timeShop'"> src="https://epic.js-dyyj.com/uploads/20250728/7d9ba1fe109643681396cb03f60f3218.png"
<view class="bottom-section"> mode="aspectFill"
<view class="stats-section"> ></image>
<view class="stat-item"> </view>
<text class="stat-number">{{ getStatNumber("时间银行") }}</text> </view>
<text class="stat-label">时间银行</text> </template>
</view> <template v-if="styleType == 'timeShop'">
</view> <view class="bottom-section">
<view class="divider"></view> <view class="stats-section">
<view class="action-section"> <view class="stat-item">
<view class="action-text-box"> <text class="stat-number">{{
<view class="action-text-box-des"> getStatNumber("时间银行")
在努力一点点为更好的未来蓄力吧 }}</text>
</view> <text class="stat-label">时间银行</text>
<view class="action-text-box-msg"> </view>
<image </view>
class="action-text-box-img" <view class="divider"></view>
:src=" <view class="action-section">
showImg( <view class="action-text-box">
'/uploads/20250728/d7ac383902515c9b507c78fdc8d29520.png' <view class="action-text-box-des">
) 在努力一点点为更好的未来蓄力吧
" </view>
></image> <view class="action-text-box-msg">
今日点赞和留言<text <image
style="font-size: 30rpx; font-weight: bold; margin: 0 10rpx" class="action-text-box-img"
>100</text :src="
> showImg(
</view> '/uploads/20250728/d7ac383902515c9b507c78fdc8d29520.png'
</view> )
<image "
class="avatar" ></image>
src="https://epic.js-dyyj.com/uploads/20250728/7d9ba1fe109643681396cb03f60f3218.png" 今日点赞和留言<text
mode="aspectFill" style="
></image> font-size: 30rpx;
</view> font-weight: bold;
</view> margin: 0 10rpx;
</template> "
</template> >100</text
>
</view>
</view>
<image
class="avatar"
src="https://epic.js-dyyj.com/uploads/20250728/7d9ba1fe109643681396cb03f60f3218.png"
mode="aspectFill"
></image>
</view>
</view>
</template>
</template>
</view> </view>
<!-- 紧凑状态 --> <!-- 紧凑状态 -->
@ -212,11 +224,11 @@ export default {
this.removeScrollListener(); this.removeScrollListener();
}, },
methods: { methods: {
toLogin(){ toLogin() {
uni.navigateTo({ uni.navigateTo({
url: "/pages/login/login", url: "/pages/login/login",
}); });
}, },
handleToggle() { handleToggle() {
if (this.isScrolled) { if (this.isScrolled) {
// //
@ -258,9 +270,6 @@ export default {
if (this.isScrolled !== shouldScroll) { if (this.isScrolled !== shouldScroll) {
this.isScrolled = shouldScroll; this.isScrolled = shouldScroll;
// //
if (uni.vibrateShort) {
uni.vibrateShort();
}
} }
// //
@ -306,7 +315,7 @@ export default {
JSON.parse(uni.getStorageSync("userInfo"))) || JSON.parse(uni.getStorageSync("userInfo"))) ||
this.$store.state.user.userInfo || this.$store.state.user.userInfo ||
{}; {};
console.log(this.userInfo,'this.userInfo') console.log(this.userInfo, "this.userInfo");
// //
if (this.userInfo && this.userInfo.nickname) { if (this.userInfo && this.userInfo.nickname) {
this.currentTitle = `Hi!${this.userInfo.nickname},欢迎回来~`; this.currentTitle = `Hi!${this.userInfo.nickname},欢迎回来~`;
@ -316,11 +325,13 @@ export default {
this.userInfo = {}; this.userInfo = {};
} }
}, },
toWebView(){ toWebView() {
uni.navigateTo({ uni.navigateTo({
url:'/subPackages/webPage/webPage?url='+'https://www.dayunyuanjian.cn/dist/#/chat-demo' url:
}) "/subPackages/webPage/webPage?url=" +
} "https://www.dayunyuanjian.cn/dist/#/chat-demo",
});
},
}, },
}; };
</script> </script>
@ -333,6 +344,7 @@ export default {
position: relative; position: relative;
opacity: 1; opacity: 1;
transition: opacity 0.3s ease; transition: opacity 0.3s ease;
padding:24rpx 0
} }
.dynamic-island-placeholder.visible { .dynamic-island-placeholder.visible {
@ -346,7 +358,8 @@ export default {
} }
.dynamic-island { .dynamic-island {
margin: 24rpx auto 24rpx; // margin: 24rpx auto 24rpx;
margin: 0 auto;
z-index: 100; z-index: 100;
background: rgba(0, 0, 0, 0.75); background: rgba(0, 0, 0, 0.75);
@ -428,7 +441,6 @@ export default {
.qr-code { .qr-code {
width: 32rpx; width: 32rpx;
height: 32rpx; height: 32rpx;
} }
.qr-icon { .qr-icon {

23
pages/index/iSoul.vue

@ -94,9 +94,7 @@
<!-- 数字资产权益 --> <!-- 数字资产权益 -->
<view class="digital-assets"> <view class="digital-assets">
<view class="asset-card"> <view class="asset-card">
<image <image @click="handleAssetAction()" :src="
@click="handleAssetAction()"
:src="
showImg('/uploads/20250729/42598a2dcf4c9a6f8c6e122e54b65c4f.png') showImg('/uploads/20250729/42598a2dcf4c9a6f8c6e122e54b65c4f.png')
" mode="aspectFill" class="digital-img"></image> " mode="aspectFill" class="digital-img"></image>
@ -197,7 +195,7 @@
<view class="popup-content"> <view class="popup-content">
<view class="input-section"> <view class="input-section">
<text class="input-label">请输入兑换码</text> <text class="input-label">请输入兑换码</text>
<input class="exchange-input" v-model="exchangeCode" placeholder="请输入兑换码" maxlength="20" /> <input class="exchange-input" v-model="exchangeCode" placeholder="请输入兑换码" />
</view> </view>
<view class="popup-actions"> <view class="popup-actions">
<button class="cancel-btn" @click="closeExchangePopup">取消</button> <button class="cancel-btn" @click="closeExchangePopup">取消</button>
@ -387,11 +385,11 @@
}); });
break; break;
default: default:
uni.navigateTo({ uni.navigateTo({
url: "/subPackages/orderQy/list", url: "/subPackages/orderQy/list",
}); });
break; break;
} }
}, },
// //
@ -458,9 +456,16 @@
).then((res) => { ).then((res) => {
if (res.code == 200) { if (res.code == 200) {
uni.showToast({ uni.showToast({
title: "兑换成功", title: "兑换成功,为您跳转订单页~",
icon: "none", icon: "none",
}); });
this.closeExchangePopup()
setTimeout(() => {
uni.navigateTo({
url: "/subPackages/orderQy/list"
})
}, 2000)
} else { } else {
uni.showToast({ uni.showToast({

473
pages/index/index.vue

@ -1,240 +1,269 @@
<template> <template>
<view class="bg"> <view class="bg">
<headerVue @change="changeAddress" :address="addressInfo" fixed isLocation></headerVue> <headerVue
@change="changeAddress"
:address="addressInfo"
fixed
isLocation
></headerVue>
<!-- 灵动岛组件 --> <!-- 灵动岛组件 -->
<!-- 灵动岛组件 - 自包含无需传递参数 --> <!-- 灵动岛组件 - 自包含无需传递参数 -->
<DynamicIsland ref="dynamicIsland" :page-id="'index_page'" @toggle="handleIslandToggle" <DynamicIsland
@action="handleIslandAction" /> ref="dynamicIsland"
:page-id="'index_page'"
@toggle="handleIslandToggle"
@action="handleIslandAction"
/>
<view class="content" @click="handleContentClick"> <view class="content" @click="handleContentClick">
<!-- 权益商品区域 --> <!-- 权益商品区域 -->
<ProductSection v-if="productList.length" title="权益商品" :productList="productList" <ProductSection
moreUrl="/subPackages/equityGoods/index" detailUrlPrefix="/subPackages/equityGoods/detail" v-show="productList.length"
@like-toggle="handleLikeToggle" /> title="权益商品"
<ProductSection titleBgColor="#92FF8F" aiTagTextColor="#08FB05" aiTagBorderColor="#6EAA3D" title="有感商品" :productList="productList"
:productList="productListFeeling" moreUrl="/pages/index/sensoryStore" moreUrl="/subPackages/equityGoods/index"
detailUrlPrefix="/subPackages/techan/detail" @like-toggle="handleLikeToggle" isFeel /> detailUrlPrefix="/subPackages/equityGoods/detail"
<view class="tab-bar-placeholder"></view> @like-toggle="handleLikeToggle"
</view> />
<CustomTabBar :currentTab="0" /> <ProductSection
<MusicControl /> titleBgColor="#92FF8F"
</view> aiTagTextColor="#08FB05"
aiTagBorderColor="#6EAA3D"
title="有感商品"
:productList="productListFeeling"
moreUrl="/pages/index/sensoryStore"
detailUrlPrefix="/subPackages/techan/detail"
@like-toggle="handleLikeToggle"
isFeel
/>
<view class="tab-bar-placeholder"></view>
</view>
<CustomTabBar :currentTab="0" />
<MusicControl />
</view>
</template> </template>
<script> <script>
import MusicControl from "@/components/MusicControl.vue"; import MusicControl from "@/components/MusicControl.vue";
import headerVue from "@/components/header.vue"; import headerVue from "@/components/header.vue";
import CustomTabBar from "@/components/CustomTabBar.vue"; import CustomTabBar from "@/components/CustomTabBar.vue";
import DynamicIsland from "@/components/DynamicIsland.vue"; import DynamicIsland from "@/components/DynamicIsland.vue";
import ProductSection from "@/components/ProductSection.vue"; import ProductSection from "@/components/ProductSection.vue";
export default { export default {
components: { components: {
CustomTabBar, CustomTabBar,
headerVue, headerVue,
MusicControl, MusicControl,
DynamicIsland, DynamicIsland,
ProductSection, ProductSection,
}, },
computed: { computed: {
// //
}, },
data() { data() {
return { return {
topBanner: [], topBanner: [],
productList: [ productList: [
// { // {
// id: 1, // id: 1,
// image: // image:
// "https://epic.js-dyyj.com/uploads/20250728/58aed304917c9d60761f833c4f8dceb8.png", // "https://epic.js-dyyj.com/uploads/20250728/58aed304917c9d60761f833c4f8dceb8.png",
// avatar: // avatar:
// "https://epic.js-dyyj.com/uploads/20250728/d27ef6e6c26877da7775664fed376c6f.png", // "https://epic.js-dyyj.com/uploads/20250728/d27ef6e6c26877da7775664fed376c6f.png",
// aiName: "", // aiName: "",
// title: " | ", // title: " | ",
// price: "588.00", // price: "588.00",
// isLiked: true, // isLiked: true,
// }, // },
// { // {
// id: 2, // id: 2,
// image: // image:
// "https://epic.js-dyyj.com/uploads/20250728/00e8704b23a0c9fd57023527146211b9.png", // "https://epic.js-dyyj.com/uploads/20250728/00e8704b23a0c9fd57023527146211b9.png",
// avatar: // avatar:
// "https://epic.js-dyyj.com/uploads/20250728/d7bf0dd2f3f272afba687b525a7c575c.png", // "https://epic.js-dyyj.com/uploads/20250728/d7bf0dd2f3f272afba687b525a7c575c.png",
// aiName: "", // aiName: "",
// title: " | ", // title: " | ",
// price: "398.00", // price: "398.00",
// isLiked: false, // isLiked: false,
// }, // },
], ],
productListFeeling: [{ productListFeeling: [
id: 34, {
image: "https://epic.js-dyyj.com/uploads/20250728/22e319f3feb1b63fbb539d425c51fe70.png", id: 34,
title: "OUT OF SPACE 东方线香", image:
price: "138.00", "https://epic.js-dyyj.com/uploads/20250728/22e319f3feb1b63fbb539d425c51fe70.png",
isLiked: true, title: "OUT OF SPACE 东方线香",
isShop: true price: "138.00",
}, isLiked: true,
{ isShop: true,
id: 32, },
image: "https://epic.js-dyyj.com/uploads/20250728/cc9907153c887a6428283a407928db9a.png", {
title: "AI-Agent智能玩具", id: 32,
price: "398.00", image:
isLiked: false, "https://epic.js-dyyj.com/uploads/20250728/cc9907153c887a6428283a407928db9a.png",
}, title: "AI-Agent智能玩具",
], price: "398.00",
selectedText: '', isLiked: false,
addressInfo: null, },
}; ],
}, selectedText: "",
onLoad() {}, addressInfo: null,
async onReady() { isLoading: true, //
let res = await this.$main.getLocationInfo() };
console.log(res) },
this.addressInfo = res onLoad() {},
this.selectedText = res && res.city async onReady() {
uni.setStorageSync('SYS_ADDRESS_INFO', JSON.stringify(res)) let res = await this.$main.getLocationInfo();
this.getList(); console.log(res);
this.geBenefitPackaget() this.addressInfo = res;
this.selectedText = res && res.city;
}, uni.setStorageSync("SYS_ADDRESS_INFO", JSON.stringify(res));
onShow() { this.getList();
this.browse_record({ this.geBenefitPackaget();
type: "page", },
title: "首页" onShow() {
}); this.browse_record({
this.$nextTick(() => { type: "page",
this.$refs.dynamicIsland.getUserInfo(); title: "首页",
}) });
}, this.$nextTick(() => {
onPageScroll(e) { this.$refs.dynamicIsland.getUserInfo();
// ID });
uni.$emit("pageScroll_index_page", e.scrollTop); },
}, onPageScroll(e) {
onReachBottom() {}, // ID
methods: { uni.$emit("pageScroll_index_page", e.scrollTop);
changeAddress(res){ },
this.addressInfo = res onReachBottom() {},
uni.setStorageSync('SYS_ADDRESS_INFO', JSON.stringify(res)) methods: {
this.geBenefitPackaget() changeAddress(res) {
}, this.addressInfo = res;
gotoUrlNew(item, index) { uni.setStorageSync("SYS_ADDRESS_INFO", JSON.stringify(res));
if (index == 0) { this.geBenefitPackaget();
uni.switchTab({ },
url: "/pages/index/readingBody", gotoUrlNew(item, index) {
}); if (index == 0) {
} else if (index == 1) { uni.switchTab({
uni.switchTab({ url: "/pages/index/readingBody",
url: "/pages/index/intelligentAgent", });
}); } else if (index == 1) {
} uni.switchTab({
}, url: "/pages/index/intelligentAgent",
viewDetail(item) { });
if (item.url) { }
uni.navigateTo({ },
url: "/subPackages/webPage/webPage?url=" + encodeURIComponent(item.url), viewDetail(item) {
}); if (item.url) {
return; uni.navigateTo({
} url:
uni.navigateTo({ "/subPackages/webPage/webPage?url=" + encodeURIComponent(item.url),
url: "/subPackages/letter/detail?id=" + item.id, });
}); return;
}, }
getList() { uni.navigateTo({
// url: "/subPackages/letter/detail?id=" + item.id,
this.Post({ });
type_id: 3, },
position: 17, getList() {
}, //
"/api/adv/getAdv" this.Post(
).then((res) => { {
if (res.data) { type_id: 3,
this.topBanner = res.data; position: 17,
} },
}); "/api/adv/getAdv"
}, ).then((res) => {
geBenefitPackaget() { if (res.data) {
this.Post({ this.topBanner = res.data;
cityId: this.addressInfo.cityId }
}, });
"/framework/index/benefitPackage/list", },
'DES' geBenefitPackaget() {
).then((res) => { this.Post(
if (res.data) { {
this.productList = res.data.map(item => { cityId: this.addressInfo.cityId,
return { },
...item, "/framework/index/benefitPackage/list",
image: item.mainUrl, "DES"
id: item.benefitPackageId, ).then((res) => {
avatar: "https://epic.js-dyyj.com/uploads/20250728/d27ef6e6c26877da7775664fed376c6f.png", if (res.data) {
aiName: "文徵明", this.productList = res.data.map((item) => {
} return {
}) ...item,
} image: item.mainUrl,
}); id: item.benefitPackageId,
}, avatar:
gotoVideo(item) { "https://epic.js-dyyj.com/uploads/20250728/d27ef6e6c26877da7775664fed376c6f.png",
uni.navigateTo({ aiName: "文徵明",
url: "/subPackages/video/video?item=" + };
encodeURIComponent(JSON.stringify(item)), });
}); }
}, });
},
gotoVideo(item) {
uni.navigateTo({
url:
"/subPackages/video/video?item=" +
encodeURIComponent(JSON.stringify(item)),
});
},
// //
handleLikeToggle({ handleLikeToggle({ item, index }) {
item, this.productList[index] = item;
index },
}) {
this.productList[index] = item;
},
// //
handleIslandToggle(isExpanded) { handleIslandToggle(isExpanded) {
console.log("灵动岛状态切换:", isExpanded ? "展开模式" : "紧凑模式"); console.log("灵动岛状态切换:", isExpanded ? "展开模式" : "紧凑模式");
}, },
// //
handleIslandAction() { handleIslandAction() {
uni.showToast({ uni.showToast({
title: "执行操作", title: "执行操作",
icon: "none", icon: "none",
}); });
console.log("执行操作"); console.log("执行操作");
}, },
// //
handleContentClick() { handleContentClick() {
// //
if (this.$refs.dynamicIsland) { if (this.$refs.dynamicIsland) {
this.$refs.dynamicIsland.collapseIsland(); this.$refs.dynamicIsland.collapseIsland();
} }
}, },
}, },
}; };
</script> </script>
<style> <style>
page {} page {
}
</style> </style>
<style lang="scss" scoped> <style lang="scss" scoped>
.bg { .bg {
min-height: 100vh; min-height: 100vh;
background: #f5f5f5; background: #f5f5f5;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
/* 页面样式 */ /* 页面样式 */
.content { .content {
height: calc(100vh - 123rpx); height: 100%;
width: 100%; width: 100%;
padding: 0 20rpx; padding: 0 20rpx;
box-sizing: border-box; box-sizing: border-box;
margin-top: 20rpx; margin-top: 20rpx;
} }
.tab-bar-placeholder { .tab-bar-placeholder {
height: 143rpx; height: 143rpx;
width: 100%; width: 100%;
} }
</style> </style>

Loading…
Cancel
Save