feat: 金种子、邀请页、启动页API、银行卡
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
|
<su-sticky offsetTop="0" zIndex="20" bgColor="#F2F4F7">
|
||||||
<scroll-view scroll-x show-scrollbar="false" class="scroll-x-wrapper p-x-32">
|
<scroll-view scroll-x show-scrollbar="false" class="scroll-x-wrapper p-x-32">
|
||||||
<view class="navs flex-center ju-flex-start nowrap" style="width: auto;">
|
<view class="navs flex-center ju-flex-start nowrap" style="width: auto;">
|
||||||
<view
|
<view
|
||||||
@@ -14,6 +15,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
|
</su-sticky>
|
||||||
<view class="goodsPages">
|
<view class="goodsPages">
|
||||||
<goods-item
|
<goods-item
|
||||||
v-for="(tab, i) in props.list"
|
v-for="(tab, i) in props.list"
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="goodsItem-container">
|
|
||||||
<view v-show="i === props.index">
|
<view v-show="i === props.index">
|
||||||
<!-- top="120"下拉布局往下偏移,防止被悬浮菜单遮住 -->
|
<mescroll-body
|
||||||
<mescroll-uni
|
|
||||||
@init="mescrollInit"
|
@init="mescrollInit"
|
||||||
top="0"
|
top="0"
|
||||||
:down="downOption"
|
:down="downOption"
|
||||||
@@ -11,27 +9,18 @@
|
|||||||
@up="upCallback"
|
@up="upCallback"
|
||||||
@emptyclick="emptyClick"
|
@emptyclick="emptyClick"
|
||||||
v-if="i === props.index"
|
v-if="i === props.index"
|
||||||
:height="height + 'px'"
|
|
||||||
>
|
>
|
||||||
<!-- 数据列表 -->
|
<view class="flex-row wrap w100">
|
||||||
<!-- <good-list :list="goods"></good-list> -->
|
|
||||||
<!-- <view v-for="(v,i) in goods" :key="i">
|
|
||||||
{{ v.picUrl }}
|
|
||||||
</view> -->
|
|
||||||
|
|
||||||
<view class="flex-row wrap w100" ref="cardRef">
|
|
||||||
<view class="cardItem" v-for="(v, i) in goods" :key="i">
|
<view class="cardItem" v-for="(v, i) in goods" :key="i">
|
||||||
<card_goods :data="v"></card_goods>
|
<card_goods :data="v"></card_goods>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</mescroll-uni>
|
</mescroll-body>
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, watch, getCurrentInstance } from 'vue';
|
import { ref, watch, getCurrentInstance } from 'vue';
|
||||||
import { onPageScroll, onReachBottom } from '@dcloudio/uni-app';
|
|
||||||
import useMescroll from '@/uni_modules/mescroll-uni/hooks/useMescroll.js';
|
import useMescroll from '@/uni_modules/mescroll-uni/hooks/useMescroll.js';
|
||||||
import SpuApi from '@/sheep/api/product/spu';
|
import SpuApi from '@/sheep/api/product/spu';
|
||||||
import card_goods from './card_goods.vue';
|
import card_goods from './card_goods.vue';
|
||||||
@@ -39,7 +28,6 @@
|
|||||||
let goods = ref([]);
|
let goods = ref([]);
|
||||||
const column = ref(2);
|
const column = ref(2);
|
||||||
const columnChange = ref(false);
|
const columnChange = ref(false);
|
||||||
const height = ref(0);
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
i: Number, // 每个tab页的专属下标
|
i: Number, // 每个tab页的专属下标
|
||||||
index: {
|
index: {
|
||||||
@@ -77,7 +65,7 @@
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
const { mescrollInit, downCallback, getMescroll } = useMescroll(onPageScroll, onReachBottom); // 调用mescroll的hook
|
const { mescrollInit, downCallback, getMescroll } = useMescroll(); // 调用mescroll的hook
|
||||||
|
|
||||||
defineExpose({ getMescroll }); // 使父组件可以通过ref调用到getMescroll方法 (必须)
|
defineExpose({ getMescroll }); // 使父组件可以通过ref调用到getMescroll方法 (必须)
|
||||||
|
|
||||||
@@ -121,9 +109,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let cardRef = ref(null);
|
|
||||||
// 是否有下一页
|
|
||||||
let hasMore = ref(true);
|
|
||||||
const upCallback = (mescroll) => {
|
const upCallback = (mescroll) => {
|
||||||
SpuApi.getSpuPage({
|
SpuApi.getSpuPage({
|
||||||
pageNo: mescroll.num,
|
pageNo: mescroll.num,
|
||||||
@@ -139,10 +124,6 @@
|
|||||||
// }
|
// }
|
||||||
if (mescroll.num == 1) goods.value = []; //如果是第一页需手动制空列表
|
if (mescroll.num == 1) goods.value = []; //如果是第一页需手动制空列表
|
||||||
goods.value = goods.value.concat(list); //追加新数据
|
goods.value = goods.value.concat(list); //追加新数据
|
||||||
hasMore.value = goods.value.length < res.data.total;
|
|
||||||
// 计算容器高度
|
|
||||||
getHeight(mescroll.num);
|
|
||||||
|
|
||||||
mescroll.endSuccess(list.length); // 请求成功, 结束加载
|
mescroll.endSuccess(list.length); // 请求成功, 结束加载
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
@@ -156,40 +137,9 @@
|
|||||||
title: '点击了按钮,具体逻辑自行实现',
|
title: '点击了按钮,具体逻辑自行实现',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const getHeight = (num) => {
|
|
||||||
if (!goods.value.length) {
|
|
||||||
// 541
|
|
||||||
height.value = 10
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// 相除向上取整
|
|
||||||
let cardHeight = Math.ceil(goods.value.length / 2) * (541)
|
|
||||||
let sysInfo = uni.getSystemInfoSync()
|
|
||||||
const windowHeight = sysInfo.windowHeight;
|
|
||||||
const value1 = windowHeight - sysInfo.statusBarHeight - uni.upx2px(88) - uni.upx2px(120)
|
|
||||||
let value2 = uni.upx2px(cardHeight) + 55 + uni.upx2px(12)
|
|
||||||
// if(hasMore){
|
|
||||||
// value2 = uni.upx2px(cardHeight) + uni.upx2px(12)
|
|
||||||
// }
|
|
||||||
const isGreater = value1 > value2;
|
|
||||||
if(isGreater){
|
|
||||||
height.value = value2
|
|
||||||
}else{
|
|
||||||
height.value = value1
|
|
||||||
}
|
|
||||||
// console.error(windowHeight)
|
|
||||||
// console.log("最大高"+value1)
|
|
||||||
// console.log("内容高"+value2)
|
|
||||||
// console.error(height.value)
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.goodsItem-container {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
.cardItem {
|
.cardItem {
|
||||||
width: calc(50% - 8rpx);
|
width: calc(50% - 8rpx);
|
||||||
margin-right: 16rpx;
|
margin-right: 16rpx;
|
||||||
|
|||||||
+3
-2
@@ -2,8 +2,8 @@
|
|||||||
"name" : "优购商城",
|
"name" : "优购商城",
|
||||||
"appid" : "__UNI__8B19741",
|
"appid" : "__UNI__8B19741",
|
||||||
"description" : "",
|
"description" : "",
|
||||||
"versionName" : "1.3.2",
|
"versionName" : "1.3.3",
|
||||||
"versionCode" : 132,
|
"versionCode" : 133,
|
||||||
"transformPx" : false,
|
"transformPx" : false,
|
||||||
"app-plus" : {
|
"app-plus" : {
|
||||||
"privacy" : {
|
"privacy" : {
|
||||||
@@ -20,6 +20,7 @@
|
|||||||
},
|
},
|
||||||
"modules" : {
|
"modules" : {
|
||||||
"Camera" : {},
|
"Camera" : {},
|
||||||
|
"VideoPlayer" : {},
|
||||||
"Payment" : {},
|
"Payment" : {},
|
||||||
"OAuth" : {},
|
"OAuth" : {},
|
||||||
"Share" : {}
|
"Share" : {}
|
||||||
|
|||||||
+11
-5
@@ -738,6 +738,13 @@
|
|||||||
"enablePullDownRefresh": false
|
"enablePullDownRefresh": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "bankCard",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "银行卡",
|
||||||
|
"enablePullDownRefresh": false
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "phone",
|
"path": "phone",
|
||||||
"style": {
|
"style": {
|
||||||
@@ -964,12 +971,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"condition": {
|
"condition": {
|
||||||
//模式配置,仅开发期间生效
|
"current": 0,
|
||||||
"current": 0, //当前激活的模式(list 的索引项)
|
|
||||||
"list": [{
|
"list": [{
|
||||||
"name": "", //模式名称
|
"name": "",
|
||||||
"path": "", //启动页面,必选
|
"path": "",
|
||||||
"query": "" //启动参数,在页面的onLoad函数里面得到
|
"query": ""
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,373 @@
|
|||||||
|
<template>
|
||||||
|
<s-pages title="银行卡">
|
||||||
|
<view class="bg_img" style="min-height: 100vh">
|
||||||
|
<view class="p-32">
|
||||||
|
<view v-if="bankList.length" class="bank-list">
|
||||||
|
<view
|
||||||
|
v-for="(v, i) in bankList"
|
||||||
|
:key="i"
|
||||||
|
class="bank-card"
|
||||||
|
:style="{ backgroundColor: getBankCardColor(v?.bankName) }"
|
||||||
|
>
|
||||||
|
<view class="bank-card__title">{{ v.bankName || "-" }}</view>
|
||||||
|
<view class="bank-card__row bank-card__row--meta">
|
||||||
|
<view class="bank-card__name">{{ v.trueName || "姓名" }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="bank-card__row bank-card__row--no">
|
||||||
|
<view class="bank-card__mask">**** **** **** {{ getCardLast4(v.cardNumber) }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="add-card" @click="onAddBankCard">
|
||||||
|
<view class="add-card__inner">
|
||||||
|
<view class="add-card__plus">+</view>
|
||||||
|
<view class="add-card__text">添加银行卡</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<s-empty
|
||||||
|
v-if="!bankList.length && !loading"
|
||||||
|
text="暂无绑定银行卡"
|
||||||
|
icon="/static/data-empty.png"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<uni-popup ref="popupRef" type="center" border-radius="16rpx" background-color="#fff">
|
||||||
|
<view class="bank-popup">
|
||||||
|
<view class="bank-popup__title">添加银行卡</view>
|
||||||
|
|
||||||
|
<view class="bank-popup__form">
|
||||||
|
<view class="bank-popup__row">
|
||||||
|
<view class="bank-popup__label">姓名</view>
|
||||||
|
<view class="bank-popup__input">
|
||||||
|
<uni-easyinput
|
||||||
|
v-model="form.trueName"
|
||||||
|
placeholder="请输入姓名"
|
||||||
|
:inputBorder="false"
|
||||||
|
:clearable="false"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="bank-popup__row">
|
||||||
|
<view class="bank-popup__label">银行卡号</view>
|
||||||
|
<view class="bank-popup__input">
|
||||||
|
<uni-easyinput
|
||||||
|
v-model="form.cardNumber"
|
||||||
|
type="number"
|
||||||
|
placeholder="请输入银行卡号"
|
||||||
|
:inputBorder="false"
|
||||||
|
:clearable="false"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="bank-popup__row">
|
||||||
|
<view class="bank-popup__label">银行</view>
|
||||||
|
<view class="bank-popup__input">
|
||||||
|
<uni-easyinput
|
||||||
|
v-model="form.bankName"
|
||||||
|
placeholder="请输入开户行"
|
||||||
|
:inputBorder="false"
|
||||||
|
:clearable="false"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="bank-popup__row">
|
||||||
|
<view class="bank-popup__label">支行</view>
|
||||||
|
<view class="bank-popup__input">
|
||||||
|
<uni-easyinput
|
||||||
|
v-model="form.bankAddress"
|
||||||
|
placeholder="请输入支行"
|
||||||
|
:inputBorder="false"
|
||||||
|
:clearable="false"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="bank-popup__actions">
|
||||||
|
<view class="bank-popup__btn bank-popup__btn--cancel" @click="closeAddPopup">
|
||||||
|
取消
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
class="bank-popup__btn bank-popup__btn--confirm"
|
||||||
|
:class="{ disabled: submitting }"
|
||||||
|
@click="submitAddPopup"
|
||||||
|
>
|
||||||
|
确认
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</uni-popup>
|
||||||
|
</view>
|
||||||
|
</s-pages>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, reactive } from "vue";
|
||||||
|
import { onShow } from "@dcloudio/uni-app";
|
||||||
|
import sheep from "@/sheep";
|
||||||
|
import * as payApi from "@/sheep/api/home/pay";
|
||||||
|
|
||||||
|
let loading = ref(true);
|
||||||
|
let bankList = ref([]);
|
||||||
|
|
||||||
|
const getCardLast4 = (cardNumber) => {
|
||||||
|
const str = String(cardNumber || "");
|
||||||
|
return str ? str.slice(-4) : "----";
|
||||||
|
};
|
||||||
|
|
||||||
|
const getBankCardColor = (bankName) => {
|
||||||
|
const name = String(bankName || "");
|
||||||
|
const fixed = [
|
||||||
|
{ keyword: "中国银行", color: "#c65253" },
|
||||||
|
{ keyword: "农业银行", color: "#008c77" },
|
||||||
|
{ keyword: "工商银行", color: "#83aac8" },
|
||||||
|
];
|
||||||
|
for (const item of fixed) {
|
||||||
|
if (name.includes(item.keyword)) return item.color;
|
||||||
|
}
|
||||||
|
|
||||||
|
const palette = [
|
||||||
|
"#c65253",
|
||||||
|
"#008c77",
|
||||||
|
"#83aac8",
|
||||||
|
"#6b5b95",
|
||||||
|
"#2f4858",
|
||||||
|
"#b56576",
|
||||||
|
"#3a86ff",
|
||||||
|
"#2a9d8f",
|
||||||
|
];
|
||||||
|
let hash = 0;
|
||||||
|
for (let i = 0; i < name.length; i += 1) {
|
||||||
|
hash = (hash * 31 + name.charCodeAt(i)) >>> 0;
|
||||||
|
}
|
||||||
|
return palette[hash % palette.length];
|
||||||
|
};
|
||||||
|
|
||||||
|
const getBankList = async () => {
|
||||||
|
loading.value = true;
|
||||||
|
const res = await payApi.getBankList({}).catch(() => ({ code: -1 }));
|
||||||
|
loading.value = false;
|
||||||
|
if (res.code === 0) {
|
||||||
|
bankList.value = Array.isArray(res.data) ? res.data : [];
|
||||||
|
} else {
|
||||||
|
bankList.value = [];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let popupRef = ref(null);
|
||||||
|
let submitting = ref(false);
|
||||||
|
const form = reactive({
|
||||||
|
trueName: "",
|
||||||
|
cardNumber: "",
|
||||||
|
bankName: "",
|
||||||
|
bankAddress: "",
|
||||||
|
});
|
||||||
|
|
||||||
|
const resetForm = () => {
|
||||||
|
form.trueName = "";
|
||||||
|
form.cardNumber = "";
|
||||||
|
form.bankName = "";
|
||||||
|
form.bankAddress = "";
|
||||||
|
};
|
||||||
|
|
||||||
|
const openAddPopup = () => {
|
||||||
|
resetForm();
|
||||||
|
popupRef.value?.open?.("center");
|
||||||
|
};
|
||||||
|
|
||||||
|
const closeAddPopup = () => {
|
||||||
|
popupRef.value?.close?.();
|
||||||
|
};
|
||||||
|
|
||||||
|
const submitAddPopup = async () => {
|
||||||
|
if (submitting.value) return;
|
||||||
|
|
||||||
|
const trueName = String(form.trueName || "").trim();
|
||||||
|
const cardNumber = String(form.cardNumber || "").replace(/\s+/g, "");
|
||||||
|
const bankName = String(form.bankName || "").trim();
|
||||||
|
const bankAddress = String(form.bankAddress || "").trim();
|
||||||
|
|
||||||
|
if (!trueName) return sheep.$helper.toast("请输入姓名");
|
||||||
|
if (!cardNumber) return sheep.$helper.toast("请输入银行卡号");
|
||||||
|
if (!bankName) return sheep.$helper.toast("请输入开户行");
|
||||||
|
if (!bankAddress) return sheep.$helper.toast("请输入支行");
|
||||||
|
|
||||||
|
submitting.value = true;
|
||||||
|
const res = await payApi
|
||||||
|
.addBank({
|
||||||
|
trueName,
|
||||||
|
cardNumber,
|
||||||
|
bankName,
|
||||||
|
bankAddress,
|
||||||
|
})
|
||||||
|
.catch(() => ({ code: -1 }));
|
||||||
|
submitting.value = false;
|
||||||
|
|
||||||
|
if (res.code === 0) {
|
||||||
|
closeAddPopup();
|
||||||
|
sheep.$helper.toast("添加成功");
|
||||||
|
getBankList();
|
||||||
|
} else {
|
||||||
|
sheep.$helper.toast(res.msg || "添加失败");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const onAddBankCard = () => {
|
||||||
|
openAddPopup();
|
||||||
|
};
|
||||||
|
|
||||||
|
onShow(() => {
|
||||||
|
getBankList();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.bank-list {
|
||||||
|
margin-bottom: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bank-card {
|
||||||
|
border-radius: 18rpx;
|
||||||
|
padding: 34rpx 34rpx 30rpx;
|
||||||
|
margin-bottom: 26rpx;
|
||||||
|
box-shadow: 0 10rpx 26rpx rgba(0, 0, 0, 0.12);
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bank-card__title {
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
line-height: 1.2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bank-card__row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bank-card__row--meta {
|
||||||
|
margin-top: 30rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
opacity: 0.95;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bank-card__name {
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bank-card__row--no {
|
||||||
|
margin-top: 24rpx;
|
||||||
|
align-items: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bank-card__mask {
|
||||||
|
font-size: 32rpx;
|
||||||
|
letter-spacing: 1rpx;
|
||||||
|
opacity: 0.95;
|
||||||
|
white-space: pre;
|
||||||
|
}
|
||||||
|
|
||||||
|
.add-card {
|
||||||
|
background: rgba(255, 255, 255, 0.92);
|
||||||
|
border-radius: 18rpx;
|
||||||
|
box-shadow: 0 10rpx 26rpx rgba(0, 0, 0, 0.08);
|
||||||
|
height: 120rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.add-card__inner {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 0 34rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.add-card__plus {
|
||||||
|
font-size: 40rpx;
|
||||||
|
color: #2c2c2c;
|
||||||
|
width: 44rpx;
|
||||||
|
text-align: center;
|
||||||
|
margin-right: 14rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.add-card__text {
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #2c2c2c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bank-popup {
|
||||||
|
width: 650rpx;
|
||||||
|
padding: 36rpx 32rpx 32rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bank-popup__title {
|
||||||
|
font-size: 34rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #2c2c2c;
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 26rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bank-popup__form {
|
||||||
|
border-radius: 14rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bank-popup__row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 16rpx 0;
|
||||||
|
border-bottom: 1rpx solid rgba(0, 0, 0, 0.08);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bank-popup__row:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bank-popup__label {
|
||||||
|
width: 140rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #2c2c2c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bank-popup__input {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bank-popup__actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 18rpx;
|
||||||
|
margin-top: 28rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bank-popup__btn {
|
||||||
|
flex: 1;
|
||||||
|
height: 84rpx;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bank-popup__btn--cancel {
|
||||||
|
background: rgba(0, 0, 0, 0.06);
|
||||||
|
color: #2c2c2c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bank-popup__btn--confirm {
|
||||||
|
background: var(--color2);
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bank-popup__btn--confirm.disabled {
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
+665
-115
@@ -44,16 +44,140 @@
|
|||||||
>
|
>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="m-b-50" v-if="dataObj?.premiumList?.length">
|
<view class="seed-card seed-card--trend m-b-50">
|
||||||
<view class="title c32 f500 m-b-40 size32">金种子溢价表</view>
|
<view class="seed-card__header">
|
||||||
<view class="wrap">
|
<view class="seed-card__left">
|
||||||
<card_echart :options="chartOption" />
|
<view class="seed-card__icon">
|
||||||
|
<image
|
||||||
|
class="seed-card__icon-img"
|
||||||
|
src="/static/icon/2.svg"
|
||||||
|
mode="scaleToFill"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
<view class="seed-card__title">价格趋势走势</view>
|
||||||
|
</view>
|
||||||
|
<view class="seed-card__tabs">
|
||||||
|
<view
|
||||||
|
class="seed-card__tab"
|
||||||
|
:class="{ active: trendRange === '7D' }"
|
||||||
|
@click="trendRange = '7D'"
|
||||||
|
>7D</view
|
||||||
|
>
|
||||||
|
<view
|
||||||
|
class="seed-card__tab"
|
||||||
|
:class="{ active: trendRange === '1M' }"
|
||||||
|
@click="trendRange = '1M'"
|
||||||
|
>1M</view
|
||||||
|
>
|
||||||
|
<view
|
||||||
|
class="seed-card__tab"
|
||||||
|
:class="{ active: trendRange === '1Y' }"
|
||||||
|
@click="trendRange = '1Y'"
|
||||||
|
>1Y</view
|
||||||
|
>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="dataObj?.dividendPool?.length">
|
<view class="seed-card__body">
|
||||||
<view class="title c32 f500 m-b-40 size32">生态分红池</view>
|
<view class="emptyMask" v-if="!trendHasData">敬请期待</view>
|
||||||
<view class="wrap">
|
<card_echart :options="chartTrend" />
|
||||||
<card_echart :options="chartOption1" />
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="seed-card seed-card--pool m-b-50">
|
||||||
|
<view class="seed-card__header">
|
||||||
|
<view class="seed-card__left">
|
||||||
|
<view class="seed-card__icon">
|
||||||
|
<image
|
||||||
|
class="seed-card__icon-img"
|
||||||
|
src="/static/icon/3.svg"
|
||||||
|
mode="scaleToFill"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
<view>
|
||||||
|
<view class="seed-card__title">池体量增长动态</view>
|
||||||
|
<view class="seed-card__sub">近7日资金池规模变动情况</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="seed-card__badge">{{ poolRateText }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="seed-card__stats">
|
||||||
|
<view class="seed-card__stat">
|
||||||
|
<view class="seed-card__stat-label">总体量</view>
|
||||||
|
<view class="seed-card__stat-value">{{ poolTotalText }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="seed-card__stat">
|
||||||
|
<view class="seed-card__stat-label">今日增量</view>
|
||||||
|
<view class="seed-card__stat-value seed-card__stat-value--up">{{
|
||||||
|
poolTodayIncText
|
||||||
|
}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="seed-card__stat">
|
||||||
|
<view class="seed-card__stat-label">活跃占比</view>
|
||||||
|
<view class="seed-card__stat-value">{{ poolActiveText }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="seed-card__body">
|
||||||
|
<view class="emptyMask" v-if="!poolHasData">敬请期待</view>
|
||||||
|
<card_echart :options="chartPool" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="seed-card seed-card--fluctuation m-b-50">
|
||||||
|
<view class="seed-card__header">
|
||||||
|
<view class="seed-card__left">
|
||||||
|
<view class="seed-card__icon">
|
||||||
|
<image
|
||||||
|
class="seed-card__icon-img"
|
||||||
|
src="/static/icon/4.svg"
|
||||||
|
mode="scaleToFill"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
<view>
|
||||||
|
<view class="seed-card__title">金种子数量波动</view>
|
||||||
|
<view class="seed-card__sub">近7日全网总量变动</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="seed-card__badge">{{ fluctuationRateText }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="seed-card__totals">
|
||||||
|
<view class="seed-card__totals-left">
|
||||||
|
<view class="seed-card__totals-label">当前全网总量</view>
|
||||||
|
<view class="seed-card__totals-value">
|
||||||
|
{{ fluctuationTotalText }}<text class="seed-card__totals-unit">枚</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="seed-card__totals-right">
|
||||||
|
<view class="seed-card__totals-label">日变化率</view>
|
||||||
|
<view class="seed-card__totals-rate" :style="{ color: fluctuationRateColor }">
|
||||||
|
<text>{{ fluctuationRateText }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="seed-card__body">
|
||||||
|
<view class="emptyMask" v-if="!fluctuationHasData">敬请期待</view>
|
||||||
|
<card_echart :options="chartFluctuation" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="seed-card seed-card--valuation m-b-20">
|
||||||
|
<view class="seed-card__header">
|
||||||
|
<view class="seed-card__left">
|
||||||
|
<uni-icons type="info" size="18" color="#e54035" />
|
||||||
|
<view class="seed-card__title">单枚综合增值算法</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="valuation-formula">
|
||||||
|
<text class="valuation-formula__v">V</text
|
||||||
|
><text class="valuation-formula__sub">total</text>
|
||||||
|
<text class="valuation-formula__eq"> = </text>
|
||||||
|
<text class="valuation-formula__v">V</text
|
||||||
|
><text class="valuation-formula__sub">base</text>
|
||||||
|
<text class="valuation-formula__eq"> + </text>
|
||||||
|
<text class="valuation-formula__v">V</text
|
||||||
|
><text class="valuation-formula__sub">valuation</text>
|
||||||
|
</view>
|
||||||
|
<view class="valuation-desc">
|
||||||
|
综合增值由底价池增值与企业权益估值共同驱动,按日计算并同步更新。
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -64,7 +188,16 @@
|
|||||||
</s-layout>
|
</s-layout>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, onMounted, onUnmounted, getCurrentInstance, watch, nextTick } from 'vue';
|
import {
|
||||||
|
ref,
|
||||||
|
reactive,
|
||||||
|
computed,
|
||||||
|
onMounted,
|
||||||
|
onUnmounted,
|
||||||
|
getCurrentInstance,
|
||||||
|
watch,
|
||||||
|
nextTick,
|
||||||
|
} from 'vue';
|
||||||
import card_echart from '@/components/card_echart/card_echart.vue';
|
import card_echart from '@/components/card_echart/card_echart.vue';
|
||||||
import { onShow } from '@dcloudio/uni-app';
|
import { onShow } from '@dcloudio/uni-app';
|
||||||
import * as echarts from 'echarts';
|
import * as echarts from 'echarts';
|
||||||
@@ -111,140 +244,343 @@
|
|||||||
url: '/pages/home/pay/seed?type=1',
|
url: '/pages/home/pay/seed?type=1',
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
const chartOption = reactive({
|
|
||||||
// 添加grid配置,实现间距自适应
|
const formatCnyShort = (val) => {
|
||||||
|
const n = Number(val);
|
||||||
|
if (!Number.isFinite(n)) return '0';
|
||||||
|
const abs = Math.abs(n);
|
||||||
|
if (abs >= 1e8) return `${(n / 1e8).toFixed(2)}亿`;
|
||||||
|
if (abs >= 1e4) return `${(n / 1e4).toFixed(1)}万`;
|
||||||
|
return String(n);
|
||||||
|
};
|
||||||
|
|
||||||
|
const pad2 = (n) => String(n).padStart(2, '0');
|
||||||
|
const toLocalDateTime = (d) => {
|
||||||
|
const y = d.getFullYear();
|
||||||
|
const m = pad2(d.getMonth() + 1);
|
||||||
|
const day = pad2(d.getDate());
|
||||||
|
const hh = pad2(d.getHours());
|
||||||
|
const mm = pad2(d.getMinutes());
|
||||||
|
const ss = pad2(d.getSeconds());
|
||||||
|
return `${y}-${m}-${day}T${hh}:${mm}:${ss}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const buildTrendParams = () => {
|
||||||
|
const now = new Date();
|
||||||
|
const end = new Date(now);
|
||||||
|
end.setHours(23, 59, 59, 0);
|
||||||
|
const start = new Date(end);
|
||||||
|
let granularity = 'DAY';
|
||||||
|
if (trendRange.value === '7D') {
|
||||||
|
start.setDate(start.getDate() - 6);
|
||||||
|
granularity = 'DAY';
|
||||||
|
} else if (trendRange.value === '1M') {
|
||||||
|
start.setMonth(start.getMonth() - 1);
|
||||||
|
granularity = 'MONTH';
|
||||||
|
} else if (trendRange.value === '1Y') {
|
||||||
|
start.setFullYear(start.getFullYear() - 1);
|
||||||
|
granularity = 'YEAR';
|
||||||
|
}
|
||||||
|
start.setHours(0, 0, 0, 0);
|
||||||
|
return {
|
||||||
|
granularity,
|
||||||
|
startDateTime: toLocalDateTime(start),
|
||||||
|
endDateTime: toLocalDateTime(end),
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
let trendRange = ref('7D');
|
||||||
|
const chartTrend = reactive({
|
||||||
|
tooltip: {
|
||||||
|
trigger: 'axis',
|
||||||
|
confine: true,
|
||||||
|
backgroundColor: 'rgba(0, 0, 0, 0.75)',
|
||||||
|
borderWidth: 0,
|
||||||
|
padding: [8, 10],
|
||||||
|
textStyle: { color: '#ffffff', fontSize: 12 },
|
||||||
|
},
|
||||||
grid: {
|
grid: {
|
||||||
left: '3%',
|
left: '10%',
|
||||||
right: '4%',
|
right: '10%',
|
||||||
bottom: '3%',
|
bottom: '16%',
|
||||||
top: '0',
|
top: '12%',
|
||||||
height: 150,
|
containLabel: true,
|
||||||
},
|
},
|
||||||
xAxis: {
|
xAxis: {
|
||||||
type: 'category',
|
type: 'category',
|
||||||
data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
|
boundaryGap: false,
|
||||||
axisLabel: {
|
data: [],
|
||||||
color: '#BBBBBB',
|
axisTick: { show: false },
|
||||||
interval: 0,
|
axisLine: { show: false },
|
||||||
fontSize: 10,
|
axisLabel: { color: '#BBBBBB', fontSize: 10, margin: 14, interval: 'auto' },
|
||||||
},
|
|
||||||
axisLine: {
|
|
||||||
lineStyle: {
|
|
||||||
color: '#D9D9D9',
|
|
||||||
type: 'dashed',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: {
|
||||||
type: 'value',
|
type: 'value',
|
||||||
splitLine: {
|
splitLine: { show: false },
|
||||||
lineStyle: {
|
|
||||||
color: '#D9D9D9',
|
|
||||||
type: 'dashed',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
axisLabel: {
|
|
||||||
color: '#BBBBBB',
|
|
||||||
show: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
series: [
|
|
||||||
{
|
|
||||||
data: [820, 932, 901, 934, 1290, 1330, 1320],
|
|
||||||
smooth: true,
|
|
||||||
type: 'line',
|
|
||||||
symbol: 'none', // 不显示数据点
|
|
||||||
lineStyle: {
|
|
||||||
color: '#FA7E31',
|
|
||||||
},
|
|
||||||
triggerEvent: true, // 确保事件可以被触发
|
|
||||||
areaStyle: {
|
|
||||||
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
||||||
{ offset: 0, color: '#FF2B2B' },
|
|
||||||
{ offset: 1, color: '#FFFFFF' },
|
|
||||||
]),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
// 移动端优化配置
|
|
||||||
animation: false, // 禁用动画以提高性能
|
|
||||||
touchMoveThreshold: 10, // 增加触摸移动阈值,避免误触
|
|
||||||
roam: false, // 禁止缩放和平移
|
|
||||||
});
|
|
||||||
|
|
||||||
const chartOption1 = reactive({
|
|
||||||
// 添加grid配置,实现间距自适应
|
|
||||||
grid: {
|
|
||||||
left: '3%',
|
|
||||||
right: '4%',
|
|
||||||
bottom: '6%',
|
|
||||||
top: '0',
|
|
||||||
height: 150,
|
|
||||||
},
|
|
||||||
xAxis: {
|
|
||||||
data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
|
|
||||||
axisTick: { show: false },
|
|
||||||
axisLine: { show: false },
|
|
||||||
axisLabel: {
|
|
||||||
color: '#BBBBBB',
|
|
||||||
interval: 0,
|
|
||||||
fontSize: 10,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
yAxis: {
|
|
||||||
splitLine: {
|
|
||||||
lineStyle: {
|
|
||||||
color: '#D9D9D9',
|
|
||||||
type: 'dashed',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
axisTick: { show: false },
|
axisTick: { show: false },
|
||||||
axisLine: { show: false },
|
axisLine: { show: false },
|
||||||
axisLabel: { show: false },
|
axisLabel: { show: false },
|
||||||
},
|
},
|
||||||
color: ['#e54035'],
|
|
||||||
series: [
|
series: [
|
||||||
{
|
{
|
||||||
name: 'hill',
|
name: '价格',
|
||||||
type: 'pictorialBar',
|
data: [],
|
||||||
barCategoryGap: '0%',
|
smooth: true,
|
||||||
// symbol: 'path://M0,10 L10,10 L5,0 L0,10 z',
|
connectNulls: true,
|
||||||
symbol: 'path://M0,10 L10,10 C5.5,10 5.5,5 5,0 C4.5,5 4.5,10 0,10 z',
|
type: 'line',
|
||||||
itemStyle: {
|
symbol: 'none',
|
||||||
color: new echarts.graphic.LinearGradient(0, 0, 1, 1, [
|
lineStyle: { color: '#EE0A24', width: 3 },
|
||||||
{ offset: 0, color: '#F7772E' },
|
areaStyle: {
|
||||||
{ offset: 1, color: '#EE0A24' },
|
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
||||||
|
{ offset: 0, color: 'rgba(238, 10, 36, 0.22)' },
|
||||||
|
{ offset: 1, color: 'rgba(238, 10, 36, 0.00)' },
|
||||||
]),
|
]),
|
||||||
},
|
},
|
||||||
emphasis: {
|
|
||||||
itemStyle: {
|
|
||||||
opacity: 1,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
data: [123, 60, 25, 18, 12, 123, 60, 25],
|
|
||||||
z: 10,
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
touchMoveThreshold: 10,
|
||||||
|
roam: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const trendHasData = computed(() => {
|
||||||
|
const arr = chartTrend?.series?.[0]?.data;
|
||||||
|
return Array.isArray(arr) && arr.some((v) => v !== null && v !== undefined);
|
||||||
|
});
|
||||||
|
|
||||||
|
const applyTrendData = (list) => {
|
||||||
|
const arr = Array.isArray(list) ? list : [];
|
||||||
|
const points = arr.map((item, idx) => {
|
||||||
|
const label = item?.dateLabel ?? item?.dayOfWeek ?? item?.date ?? item?.time ?? '';
|
||||||
|
const v = Number(item?.value ?? item?.data ?? item?.price ?? item?.y ?? 0);
|
||||||
|
return { label: String(label || idx), v: Number.isFinite(v) ? v : 0 };
|
||||||
|
});
|
||||||
|
chartTrend.xAxis.data = points.map((p) => p.label);
|
||||||
|
chartTrend.series[0].data = points.map((p) => p.v);
|
||||||
|
const singlePoint = points.length === 1;
|
||||||
|
chartTrend.series[0].symbol = singlePoint ? 'circle' : 'none';
|
||||||
|
chartTrend.series[0].showSymbol = singlePoint;
|
||||||
|
chartTrend.series[0].symbolSize = singlePoint ? 6 : 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
const fetchTrend = async () => {
|
||||||
|
const params = buildTrendParams();
|
||||||
|
const res: any = await api.goldSeedTrend(params);
|
||||||
|
if (res?.code !== 0) {
|
||||||
|
applyTrendData([]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
applyTrendData(res?.data);
|
||||||
|
};
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => trendRange.value,
|
||||||
|
() => {
|
||||||
|
fetchTrend();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
const chartPool = reactive({
|
||||||
|
grid: {
|
||||||
|
left: '10%',
|
||||||
|
right: '10%',
|
||||||
|
bottom: '26%',
|
||||||
|
top: '10%',
|
||||||
|
containLabel: true,
|
||||||
|
},
|
||||||
|
tooltip: {
|
||||||
|
trigger: 'axis',
|
||||||
|
axisPointer: { type: 'cross', label: { backgroundColor: '#6a7985' } },
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
icon: 'roundRect',
|
||||||
|
itemWidth: 15,
|
||||||
|
itemHeight: 5,
|
||||||
|
data: ['分红池', '底价存池'],
|
||||||
|
},
|
||||||
|
color: ['rgba(238, 10, 36, 0.55)', 'rgba(247, 119, 46, 0.55)'],
|
||||||
|
xAxis: {
|
||||||
|
type: 'category',
|
||||||
|
boundaryGap: false,
|
||||||
|
data: [],
|
||||||
|
axisTick: { show: false },
|
||||||
|
axisLine: { show: false },
|
||||||
|
axisLabel: { color: '#BBBBBB', fontSize: 10, margin: 14, interval: 'auto' },
|
||||||
|
},
|
||||||
|
yAxis: {
|
||||||
|
type: 'value',
|
||||||
|
splitLine: { show: false },
|
||||||
|
axisTick: { show: false },
|
||||||
|
axisLine: { show: false },
|
||||||
|
axisLabel: { show: false },
|
||||||
|
},
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
name: '底价存池',
|
||||||
|
type: 'line',
|
||||||
|
stack: 'total',
|
||||||
|
smooth: true,
|
||||||
|
symbol: 'none',
|
||||||
|
data: [],
|
||||||
|
lineStyle: { color: 'transparent', width: 2 },
|
||||||
|
areaStyle: { color: 'rgba(247, 119, 46, 0.25)' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '分红池',
|
||||||
|
type: 'line',
|
||||||
|
stack: 'total',
|
||||||
|
smooth: true,
|
||||||
|
symbol: 'none',
|
||||||
|
data: [],
|
||||||
|
lineStyle: { color: 'transparent', width: 2 },
|
||||||
|
areaStyle: { color: 'rgba(238, 10, 36, 0.18)' },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
touchMoveThreshold: 10,
|
||||||
|
roam: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
const poolGrowthData = ref(null);
|
||||||
|
const poolTotalText = computed(() => {
|
||||||
|
const v = Number(poolGrowthData.value?.totalPool);
|
||||||
|
return Number.isFinite(v) ? formatCnyShort(v) : '0';
|
||||||
|
});
|
||||||
|
const poolTodayIncText = computed(() => {
|
||||||
|
const n = Number(poolGrowthData.value?.todayIncrement);
|
||||||
|
if (!Number.isFinite(n)) return '+0';
|
||||||
|
const sign = n > 0 ? '+' : '';
|
||||||
|
return `${sign}${formatCnyShort(n)}`;
|
||||||
|
});
|
||||||
|
const poolRateText = computed(() => {
|
||||||
|
const raw = poolGrowthData.value?.weekGrowthRate ?? poolGrowthData.value?.todayGrowthRate;
|
||||||
|
const n = Number(raw);
|
||||||
|
if (!Number.isFinite(n)) return '+0.0%';
|
||||||
|
const sign = n > 0 ? '+' : '';
|
||||||
|
return `${sign}${n.toFixed(1)}%`;
|
||||||
|
});
|
||||||
|
const poolActiveText = computed(() => {
|
||||||
|
const n = Number(poolGrowthData.value?.activeRate);
|
||||||
|
if (!Number.isFinite(n)) return '-';
|
||||||
|
return `${n.toFixed(1)}%`;
|
||||||
|
});
|
||||||
|
const poolHasData = computed(() => {
|
||||||
|
const s0 = chartPool?.series?.[0]?.data;
|
||||||
|
const s1 = chartPool?.series?.[1]?.data;
|
||||||
|
const has0 = Array.isArray(s0) && s0.length > 0;
|
||||||
|
const has1 = Array.isArray(s1) && s1.length > 0;
|
||||||
|
return has0 || has1;
|
||||||
|
});
|
||||||
|
const fetchPoolGrowth = async () => {
|
||||||
|
const res: any = await api.goldSeedPoolGrowth();
|
||||||
|
if (res?.code !== 0) {
|
||||||
|
poolGrowthData.value = null;
|
||||||
|
chartPool.xAxis.data = [];
|
||||||
|
chartPool.series[0].data = [];
|
||||||
|
chartPool.series[1].data = [];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
poolGrowthData.value = res?.data || {};
|
||||||
|
const list = Array.isArray(poolGrowthData.value?.dailyDataList)
|
||||||
|
? poolGrowthData.value.dailyDataList
|
||||||
|
: [];
|
||||||
|
const x = list.map((it) => it?.dayOfWeek ?? it?.dateLabel ?? '');
|
||||||
|
const dividend = list.map((it) => Number(it?.dividendPool) || 0);
|
||||||
|
const floor = list.map((it) => Number(it?.floorPool) || 0);
|
||||||
|
chartPool.xAxis.data = x;
|
||||||
|
chartPool.series[0].data = floor;
|
||||||
|
chartPool.series[1].data = dividend;
|
||||||
|
};
|
||||||
|
|
||||||
|
const chartFluctuation = reactive({
|
||||||
|
tooltip: { trigger: 'axis' },
|
||||||
|
grid: { left: '10%', right: '10%', bottom: '36%', top: '10%' },
|
||||||
|
xAxis: { type: 'category', boundaryGap: false, data: [] },
|
||||||
|
yAxis: { type: 'value', show: false },
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
name: '金种子总量',
|
||||||
|
type: 'line',
|
||||||
|
smooth: true,
|
||||||
|
symbol: 'none',
|
||||||
|
data: [],
|
||||||
|
markLine: {
|
||||||
|
symbol: ['none', 'none'],
|
||||||
|
lineStyle: { type: 'dashed', width: 1, color: 'rgba(229, 64, 53, 0.55)' },
|
||||||
|
label: {
|
||||||
|
formatter: `周均{c}`,
|
||||||
|
color: '#585654',
|
||||||
|
fontSize: 10,
|
||||||
|
position: 'end',
|
||||||
|
distance: -80,
|
||||||
|
offset: [0, -5],
|
||||||
|
},
|
||||||
|
data: [{ type: 'average', name: 'Avg' }],
|
||||||
|
},
|
||||||
|
lineStyle: { color: '#e54035', width: 3 },
|
||||||
|
areaStyle: {
|
||||||
|
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
||||||
|
{ offset: 0, color: 'rgba(229, 64, 53, 0.25)' },
|
||||||
|
{ offset: 1, color: 'rgba(229, 64, 53, 0.05)' },
|
||||||
|
]),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
touchMoveThreshold: 10,
|
||||||
|
roam: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
const fluctuationData = ref(null);
|
||||||
|
const fluctuationHasData = computed(() => {
|
||||||
|
const data = chartFluctuation?.series?.[0]?.data;
|
||||||
|
return Array.isArray(data) && data.length > 0;
|
||||||
|
});
|
||||||
|
const fluctuationTotalText = computed(() => {
|
||||||
|
const v = Number(fluctuationData.value?.totalCount);
|
||||||
|
return Number.isFinite(v) ? v.toLocaleString() : '0';
|
||||||
|
});
|
||||||
|
const fluctuationRateText = computed(() => {
|
||||||
|
const raw = fluctuationData.value?.changeRate;
|
||||||
|
const n = Number(raw);
|
||||||
|
if (!Number.isFinite(n)) return '+0.0%';
|
||||||
|
const sign = n >= 0 ? '+' : '';
|
||||||
|
return `${sign}${n.toFixed(1)}%`;
|
||||||
|
});
|
||||||
|
const fluctuationRateColor = computed(() => {
|
||||||
|
const raw = fluctuationData.value?.changeRate;
|
||||||
|
const n = Number(raw);
|
||||||
|
return n >= 0 ? '#e54035' : '#777777';
|
||||||
|
});
|
||||||
|
const fetchFluctuation = async () => {
|
||||||
|
const res: any = await api.goldSeedFluctuation();
|
||||||
|
if (res?.code !== 0) {
|
||||||
|
fluctuationData.value = null;
|
||||||
|
chartFluctuation.xAxis.data = [];
|
||||||
|
chartFluctuation.series[0].data = [];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fluctuationData.value = res?.data || {};
|
||||||
|
const list = Array.isArray(fluctuationData.value?.dailyDataList)
|
||||||
|
? fluctuationData.value.dailyDataList
|
||||||
|
: [];
|
||||||
|
const xData = list.map((it) => it?.dayOfWeek ?? it?.dateLabel ?? '');
|
||||||
|
const yData = list.map((it) => Number(it?.goldSeedCount) || 0);
|
||||||
|
chartFluctuation.xAxis.data = xData;
|
||||||
|
chartFluctuation.series[0].data = yData;
|
||||||
|
};
|
||||||
|
|
||||||
let load = ref(false);
|
let load = ref(false);
|
||||||
const getData = () => {
|
const getData = () => {
|
||||||
api.goldSeedIndex().then((res) => {
|
api.goldSeedIndex().then((res: any) => {
|
||||||
load.value = true;
|
load.value = true;
|
||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
dataObj = res.data;
|
dataObj = res.data;
|
||||||
let arr = dataObj.premiumList.map((item) => item.month);
|
fetchTrend();
|
||||||
let arr1 = dataObj.premiumList.map((item) => item.data);
|
|
||||||
let arr2 = dataObj.dividendPool.map((item) => item.month);
|
|
||||||
let arr3 = dataObj.dividendPool.map((item) => item.data);
|
|
||||||
chartOption.xAxis.data = arr;
|
|
||||||
chartOption.series[0].data = arr1;
|
|
||||||
chartOption1.xAxis.data = arr2;
|
|
||||||
chartOption1.series[0].data = arr3;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
getData();
|
getData();
|
||||||
|
fetchPoolGrowth();
|
||||||
|
fetchFluctuation();
|
||||||
});
|
});
|
||||||
let height = ref(0);
|
let height = ref(0);
|
||||||
height.value = sysInfo.statusBarHeight + uni.upx2px(88);
|
height.value = sysInfo.statusBarHeight + uni.upx2px(88);
|
||||||
@@ -319,4 +655,218 @@
|
|||||||
background: linear-gradient(270deg, #f7772e 0%, #ee0a24 99%);
|
background: linear-gradient(270deg, #f7772e 0%, #ee0a24 99%);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.seed-card {
|
||||||
|
background: #ffffff;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
padding: 24rpx 20rpx 18rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.seed-card__header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 16rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.seed-card__left {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12rpx;
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.seed-card__icon {
|
||||||
|
width: 28rpx;
|
||||||
|
height: 28rpx;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
// background: #ffe8e5;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.seed-card__icon--accent {
|
||||||
|
background: linear-gradient(127deg, #f7772e 18%, #ee0a24 122%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.seed-card__icon-img {
|
||||||
|
width: 28rpx;
|
||||||
|
height: 28rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.seed-card__title {
|
||||||
|
font-size: 30rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #585654;
|
||||||
|
line-height: 1.2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.seed-card__sub {
|
||||||
|
margin-top: 6rpx;
|
||||||
|
font-size: 22rpx;
|
||||||
|
color: #bbbbbb;
|
||||||
|
line-height: 1.2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.seed-card__tabs {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
background: #ffe8e5;
|
||||||
|
border-radius: 18rpx;
|
||||||
|
padding: 6rpx;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.seed-card__tab {
|
||||||
|
font-size: 22rpx;
|
||||||
|
color: #585654;
|
||||||
|
padding: 8rpx 16rpx;
|
||||||
|
border-radius: 14rpx;
|
||||||
|
line-height: 1.1;
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.seed-card__tab.active {
|
||||||
|
background: #ffffff;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.seed-card__badge {
|
||||||
|
font-size: 22rpx;
|
||||||
|
color: #e54035;
|
||||||
|
background: rgba(229, 64, 53, 0.12);
|
||||||
|
padding: 10rpx 16rpx;
|
||||||
|
border-radius: 14rpx;
|
||||||
|
line-height: 1;
|
||||||
|
font-weight: 700;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.seed-card__stats {
|
||||||
|
display: flex;
|
||||||
|
gap: 14rpx;
|
||||||
|
margin-top: 18rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.seed-card__stat {
|
||||||
|
flex: 1;
|
||||||
|
background: #fff6f5;
|
||||||
|
border-radius: 18rpx;
|
||||||
|
padding: 16rpx 16rpx 14rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.seed-card__stat-label {
|
||||||
|
font-size: 22rpx;
|
||||||
|
color: #bbbbbb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.seed-card__stat-value {
|
||||||
|
margin-top: 10rpx;
|
||||||
|
font-size: 26rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #585654;
|
||||||
|
}
|
||||||
|
|
||||||
|
.seed-card__stat-value--up {
|
||||||
|
color: #e54035;
|
||||||
|
}
|
||||||
|
|
||||||
|
.seed-card__totals {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 20rpx;
|
||||||
|
margin-top: 18rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.seed-card__totals-label {
|
||||||
|
font-size: 22rpx;
|
||||||
|
color: #bbbbbb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.seed-card__totals-value {
|
||||||
|
margin-top: 10rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #585654;
|
||||||
|
}
|
||||||
|
|
||||||
|
.seed-card__totals-unit {
|
||||||
|
font-size: 22rpx;
|
||||||
|
margin-left: 6rpx;
|
||||||
|
font-weight: 400;
|
||||||
|
color: #bbbbbb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.seed-card__totals-rate {
|
||||||
|
margin-top: 10rpx;
|
||||||
|
font-size: 26rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.seed-card__body {
|
||||||
|
height: 360rpx;
|
||||||
|
margin-top: 18rpx;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.emptyMask {
|
||||||
|
background: rgba(0, 0, 0, 0.22);
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: #fff;
|
||||||
|
z-index: 10;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
-webkit-backdrop-filter: blur(2px) saturate(120%);
|
||||||
|
backdrop-filter: blur(2px) saturate(120%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.valuation-formula {
|
||||||
|
margin-top: 18rpx;
|
||||||
|
padding: 18rpx 20rpx;
|
||||||
|
background: #fff6f5;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
font-size: 30rpx;
|
||||||
|
color: #585654;
|
||||||
|
display: flex;
|
||||||
|
align-items: baseline;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 6rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.valuation-formula__v {
|
||||||
|
font-weight: 800;
|
||||||
|
color: #e54035;
|
||||||
|
}
|
||||||
|
|
||||||
|
.valuation-formula__sub {
|
||||||
|
font-size: 22rpx;
|
||||||
|
color: #bbbbbb;
|
||||||
|
margin-right: 6rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.valuation-formula__eq {
|
||||||
|
font-weight: 700;
|
||||||
|
color: #585654;
|
||||||
|
}
|
||||||
|
|
||||||
|
.valuation-desc {
|
||||||
|
margin-top: 14rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #bbbbbb;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
+511
-123
@@ -1,35 +1,20 @@
|
|||||||
<template>
|
<template>
|
||||||
<s-layout title="邀请好友">
|
<s-layout title="邀请好友">
|
||||||
<view class="pages c34">
|
<view class="share_page_bg" id="captureBox">
|
||||||
<view class="con w100" id="conId">
|
<view class="slogan">
|
||||||
<view class="w100 conBg radius-8 hidden">
|
<view class="text" v-for="(t, idx) in sloganLines" :key="idx">{{ t }}</view>
|
||||||
<image
|
|
||||||
class="w100"
|
|
||||||
:src="$url + 'home/invite1.png'"
|
|
||||||
mode="widthFix"
|
|
||||||
@longpress="saveImg"
|
|
||||||
/>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="con_center w100 radius-8">
|
|
||||||
<view class="flex-center ju-flex-start">
|
<view class="share_card">
|
||||||
<view class="head">
|
<view class="con_center">
|
||||||
<image v-if="dataInfo?.avatar" :src="dataInfo?.avatar" mode="scaleToFill" />
|
<view class="center m-b-28">
|
||||||
<image v-else :src="`${$url}home/head.png`" mode="scaleToFill" />
|
<view class="con_name">邀好友来购物</view>
|
||||||
</view>
|
<view class="sub_title m-t-16">长按保存二维码或复制邀请码分享</view>
|
||||||
<view>
|
|
||||||
<view class="con_name size32 f700 c0"
|
|
||||||
>{{ dataInfo?.nickname || '昵称' }},邀请您加入优购商城</view
|
|
||||||
>
|
|
||||||
<view class="size28 c0">财富未来 全新出发</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="flex-center f700 size48 m-t-68 m-b-28 c0">
|
|
||||||
<view>邀请码</view>
|
|
||||||
<view>|</view>
|
|
||||||
<view>{{ inviteinfo?.inviteCode }}</view>
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="flex-center">
|
<view class="flex-center">
|
||||||
<view class="img m-b-22">
|
<view class="code flex-center code_wrap">
|
||||||
|
<view class="img">
|
||||||
<Qrcode
|
<Qrcode
|
||||||
ref="qrcodeRef"
|
ref="qrcodeRef"
|
||||||
:size="300"
|
:size="300"
|
||||||
@@ -38,124 +23,527 @@
|
|||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="center size20 c_999">扫描二维码, 注册并登录APP</view>
|
</view>
|
||||||
|
|
||||||
|
<view class="center m-t-32 m-b-24 label_text">您的推荐码</view>
|
||||||
|
|
||||||
|
<view class="invite_code_bar">
|
||||||
|
<view class="code_val">{{ inviteinfo?.inviteCode }}</view>
|
||||||
|
<view class="copy_btn" @click="copy(inviteinfo?.inviteCode)">
|
||||||
|
<view class="icon-copy"></view>
|
||||||
|
<text class="btn_text">复制</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- <view class="btns">
|
||||||
|
<view class="square-btn-outline" @click="saveImg">
|
||||||
|
<view class="icon-down"></view>
|
||||||
|
保存邀请图片至相册
|
||||||
|
</view>
|
||||||
|
<view class="square-btn" @click="openShare">
|
||||||
|
<view class="icon-link"></view>
|
||||||
|
分享给好友
|
||||||
|
</view>
|
||||||
|
</view> -->
|
||||||
|
|
||||||
|
<uni-popup ref="popup" type="share">
|
||||||
|
<uni-popup-share title="分享到" @select="doShare"></uni-popup-share>
|
||||||
|
</uni-popup>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="submit-btn m-t-68" @click="saveImg">保存到相册</view>
|
|
||||||
</view>
|
</view>
|
||||||
</s-layout>
|
</s-layout>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
|
||||||
import Qrcode from './components/Qrcode';
|
|
||||||
import sheep from '@/sheep';
|
|
||||||
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
|
||||||
import { ref, reactive, onMounted, onUnmounted, getCurrentInstance, watch, nextTick } from 'vue';
|
|
||||||
import * as api from '@/sheep/api/home/index';
|
|
||||||
let { proxy } = getCurrentInstance();
|
|
||||||
let dataInfo = ref({});
|
|
||||||
let inviteinfo = ref({});
|
|
||||||
let qrCodeUrl = ref(); //二维码地址
|
|
||||||
let qrcodeRef = ref();
|
|
||||||
|
|
||||||
onLoad(() => {});
|
<script setup>
|
||||||
//获取二维码
|
import Qrcode from './components/Qrcode';
|
||||||
function generateQRCode(text) {
|
import { getCurrentInstance, nextTick, ref } from 'vue';
|
||||||
|
import * as api from '@/sheep/api/home/index';
|
||||||
|
|
||||||
|
const instance = getCurrentInstance();
|
||||||
|
const proxy = instance?.proxy;
|
||||||
|
|
||||||
|
const sloganLines = ref(['优品赢四海', '购福赴新途']);
|
||||||
|
|
||||||
|
const inviteinfo = ref({});
|
||||||
|
const qrCodeUrl = ref('');
|
||||||
|
const qrcodeRef = ref(null);
|
||||||
|
const popup = ref(null);
|
||||||
|
|
||||||
|
const generateQRCode = (text) => {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
qrcodeRef.value.createQRcode(text);
|
qrcodeRef.value?.createQRcode(text);
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
const getData = () => {
|
|
||||||
sheep
|
const getinviteinfo = () => {
|
||||||
.$store('user')
|
|
||||||
.getInfo()
|
|
||||||
.then((res) => {
|
|
||||||
dataInfo.value = res;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
const getinviteinfo = () => {
|
|
||||||
api.inviteinfo().then((res) => {
|
api.inviteinfo().then((res) => {
|
||||||
inviteinfo.value = res.data;
|
inviteinfo.value = res?.data || {};
|
||||||
generateQRCode(res.data.inviteUrl);
|
if (inviteinfo.value?.inviteUrl) generateQRCode(inviteinfo.value.inviteUrl);
|
||||||
// generateQRCode('http://mall.suwizihe.org.cn:5010/h5/#/?code=' + inviteinfo.value.inviteCode);
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
getinviteinfo();
|
|
||||||
getData();
|
|
||||||
let conRef = ref();
|
|
||||||
const saveServiceQrcode = () => {
|
|
||||||
qrcodeRef.value.savePhoto();
|
|
||||||
};
|
|
||||||
const saveImg = async () => {
|
|
||||||
// uni.saveImageToPhotosAlbum({
|
|
||||||
// filePath: 'http://mall.suwizihe.org.cn:5010/h5/#/?code=' + inviteinfo.value.inviteCode,//qrcodeUrl.value
|
|
||||||
// success: () => {
|
|
||||||
// uni.showToast({
|
|
||||||
// title: '保存成功!',
|
|
||||||
// });
|
|
||||||
// },
|
|
||||||
// fail: (err) => {
|
|
||||||
// console.log(err);
|
|
||||||
// uni.showToast({ title: '保存失败', icon: 'none' });
|
|
||||||
// },
|
|
||||||
// });
|
|
||||||
qrcodeRef.value.savePhoto();
|
|
||||||
// if (qrcodeUrl.value) {
|
|
||||||
|
|
||||||
// return;
|
const getCaptureBoxRect = () =>
|
||||||
// }
|
new Promise((resolve, reject) => {
|
||||||
// if (qrcodeRef.value?.savePhoto) {
|
uni
|
||||||
// qrcodeRef.value.savePhoto();
|
.createSelectorQuery()
|
||||||
// } else {
|
.in(proxy)
|
||||||
// uni.showToast({ title: '二维码未生成', icon: 'none' });
|
.select('#captureBox')
|
||||||
// }
|
.boundingClientRect((rect) => {
|
||||||
};
|
if (!rect) {
|
||||||
const onQrGenerated = (path) => {
|
reject(new Error('captureBox not found'));
|
||||||
qrCodeUrl.value = path;
|
return;
|
||||||
};
|
}
|
||||||
</script>
|
resolve(rect);
|
||||||
<style lang="scss" scoped>
|
})
|
||||||
.pages {
|
.exec();
|
||||||
height: 100vh;
|
});
|
||||||
padding: 32rpx 40rpx;
|
|
||||||
box-sizing: border-box;
|
const saveToAlbum = (filePath) =>
|
||||||
|
new Promise((resolve, reject) => {
|
||||||
|
uni.saveImageToPhotosAlbum({
|
||||||
|
filePath,
|
||||||
|
success: () => resolve(true),
|
||||||
|
fail: (e) => reject(e),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const toFileUrlIfNeeded = (p) => (p.startsWith('file://') ? p : `file://${p}`);
|
||||||
|
|
||||||
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
||||||
|
|
||||||
|
let isSavingPoster = false;
|
||||||
|
|
||||||
|
const showSaveSuccessToast = () => {
|
||||||
|
uni.showToast({
|
||||||
|
title: '保存成功',
|
||||||
|
icon: 'success',
|
||||||
|
duration: 500,
|
||||||
|
});
|
||||||
|
setTimeout(() => uni.hideToast(), 500);
|
||||||
|
};
|
||||||
|
|
||||||
|
const drawCurrentWebviewToFile = async (params) => {
|
||||||
|
if (typeof plus === 'undefined' || !plus.webview || !plus.nativeObj) {
|
||||||
|
throw new Error('plus is not available');
|
||||||
}
|
}
|
||||||
|
|
||||||
.con {
|
const webview = plus.webview.getTopWebview?.() || plus.webview.currentWebview();
|
||||||
position: relative;
|
const bitmap = new plus.nativeObj.Bitmap(`share_bitmap_${Date.now()}`);
|
||||||
|
|
||||||
.conBg {
|
await new Promise((resolve, reject) => {
|
||||||
|
webview.draw(
|
||||||
|
bitmap,
|
||||||
|
() => resolve(true),
|
||||||
|
(e) => reject(e),
|
||||||
|
{ check: true },
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
const fileUrl = `_doc/share_capture_${Date.now()}.jpg`;
|
||||||
|
await new Promise((resolve, reject) => {
|
||||||
|
bitmap.save(
|
||||||
|
fileUrl,
|
||||||
|
params?.clip ? { overwrite: true, format: 'jpg', quality: 90, clip: params.clip } : { overwrite: true, format: 'jpg', quality: 90 },
|
||||||
|
() => resolve(true),
|
||||||
|
(e) => reject(e),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
bitmap.clear();
|
||||||
|
|
||||||
|
const localPath = plus.io.convertLocalFileSystemURL(fileUrl);
|
||||||
|
return {
|
||||||
|
localPath,
|
||||||
|
filePath: toFileUrlIfNeeded(localPath),
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
const savePoster = async () => {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
if (isSavingPoster) return;
|
||||||
|
isSavingPoster = true;
|
||||||
|
try {
|
||||||
|
uni.showLoading({ title: '生成图片...' });
|
||||||
|
await nextTick();
|
||||||
|
for (let i = 0; i < 8; i++) {
|
||||||
|
if (qrCodeUrl.value) break;
|
||||||
|
await sleep(200);
|
||||||
|
}
|
||||||
|
|
||||||
|
const rect = await getCaptureBoxRect();
|
||||||
|
const sysInfo = uni.getSystemInfoSync();
|
||||||
|
const ratioX =
|
||||||
|
typeof plus !== 'undefined' && plus.screen && plus.screen.resolutionWidth
|
||||||
|
? plus.screen.resolutionWidth / sysInfo.windowWidth
|
||||||
|
: sysInfo.pixelRatio || 1;
|
||||||
|
const ratioY =
|
||||||
|
typeof plus !== 'undefined' && plus.screen && plus.screen.resolutionHeight
|
||||||
|
? plus.screen.resolutionHeight / sysInfo.windowHeight
|
||||||
|
: sysInfo.pixelRatio || 1;
|
||||||
|
const maxWidth = Math.max(1, Math.floor(sysInfo.windowWidth * ratioX));
|
||||||
|
const maxHeight = Math.max(1, Math.floor(sysInfo.windowHeight * ratioY));
|
||||||
|
|
||||||
|
const clip = {
|
||||||
|
top: Math.max(0, Math.floor((rect.top || 0) * ratioY)),
|
||||||
|
left: Math.max(0, Math.floor((rect.left || 0) * ratioX)),
|
||||||
|
width: Math.max(1, Math.floor((rect.width || 1) * ratioX)),
|
||||||
|
height: Math.max(1, Math.floor((rect.height || 1) * ratioY)),
|
||||||
|
};
|
||||||
|
|
||||||
|
const sideExpand = Math.max(0, Math.floor(30 * ratioX));
|
||||||
|
const topExpand = Math.max(0, Math.floor(60 * ratioY));
|
||||||
|
const bottomExpand = Math.max(0, Math.floor(20 * ratioY));
|
||||||
|
|
||||||
|
clip.top = Math.max(0, clip.top - topExpand);
|
||||||
|
clip.left = Math.max(0, clip.left - sideExpand);
|
||||||
|
clip.width = clip.width + sideExpand * 2;
|
||||||
|
clip.height = clip.height + topExpand + bottomExpand;
|
||||||
|
|
||||||
|
if (clip.left >= maxWidth) clip.left = maxWidth - 1;
|
||||||
|
if (clip.top >= maxHeight) clip.top = maxHeight - 1;
|
||||||
|
if (clip.left + clip.width > maxWidth) clip.width = maxWidth - clip.left;
|
||||||
|
if (clip.top + clip.height > maxHeight) clip.height = maxHeight - clip.top;
|
||||||
|
|
||||||
|
const { localPath, filePath } = await drawCurrentWebviewToFile({ clip });
|
||||||
|
try {
|
||||||
|
await saveToAlbum(localPath);
|
||||||
|
} catch (e) {
|
||||||
|
await saveToAlbum(filePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
showSaveSuccessToast();
|
||||||
|
} catch (e) {
|
||||||
|
const msg =
|
||||||
|
(typeof e === 'string' && e) || e?.errMsg || e?.message || (e ? JSON.stringify(e) : 'unknown error');
|
||||||
|
uni.showModal({
|
||||||
|
title: '保存失败',
|
||||||
|
content:
|
||||||
|
msg.includes('authorize') || msg.includes('Permission')
|
||||||
|
? `${msg}\n\n请到系统设置开启相册权限后重试`
|
||||||
|
: msg,
|
||||||
|
showCancel: false,
|
||||||
|
});
|
||||||
|
} finally {
|
||||||
|
isSavingPoster = false;
|
||||||
|
uni.hideLoading();
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifndef APP-PLUS
|
||||||
|
uni.showToast({ title: '仅App支持整页保存', icon: 'none' });
|
||||||
|
// #endif
|
||||||
|
};
|
||||||
|
|
||||||
|
const saveImg = async () => {
|
||||||
|
await savePoster();
|
||||||
|
};
|
||||||
|
|
||||||
|
const saveServiceQrcode = async () => {
|
||||||
|
await savePoster();
|
||||||
|
};
|
||||||
|
|
||||||
|
const onQrGenerated = (path) => {
|
||||||
|
qrCodeUrl.value = path;
|
||||||
|
};
|
||||||
|
|
||||||
|
const copy = (text) => {
|
||||||
|
const val = text || inviteinfo.value?.inviteCode || '';
|
||||||
|
if (!val) return;
|
||||||
|
uni.setClipboardData({
|
||||||
|
data: val,
|
||||||
|
success: () => {
|
||||||
|
uni.showToast({ icon: 'none', title: '复制成功' });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const openShare = () => {
|
||||||
|
popup.value?.open?.();
|
||||||
|
};
|
||||||
|
|
||||||
|
const mapShareProvider = (name) => {
|
||||||
|
if (!name) return '';
|
||||||
|
const m = {
|
||||||
|
wx: 'weixin',
|
||||||
|
ali: 'alipay',
|
||||||
|
qq: 'qq',
|
||||||
|
sina: 'sinaweibo',
|
||||||
|
};
|
||||||
|
return m[name] || '';
|
||||||
|
};
|
||||||
|
|
||||||
|
const doShare = async (res) => {
|
||||||
|
const provider = mapShareProvider(res?.item?.name);
|
||||||
|
if (!provider) {
|
||||||
|
uni.showToast({ title: '当前渠道不支持', icon: 'none' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
try {
|
||||||
|
uni.showLoading({ title: '生成分享图片...' });
|
||||||
|
await nextTick();
|
||||||
|
await sleep(450);
|
||||||
|
uni.hideLoading();
|
||||||
|
const { localPath: shareImage } = await drawCurrentWebviewToFile();
|
||||||
|
uni.share({
|
||||||
|
provider,
|
||||||
|
type: 1,
|
||||||
|
imageUrl: shareImage,
|
||||||
|
success: () => uni.showToast({ title: '分享成功' }),
|
||||||
|
fail: () => uni.showToast({ title: '分享失败', icon: 'none' }),
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
uni.hideLoading();
|
||||||
|
uni.showToast({ title: '截图失败', icon: 'none' });
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
};
|
||||||
|
|
||||||
|
getinviteinfo();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
:deep(page) {
|
||||||
|
background: #fff6f7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.share_page_bg {
|
||||||
|
position: relative;
|
||||||
|
min-height: 100vh;
|
||||||
|
padding: 330rpx 40rpx 0rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
background: #fff6f7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.share_page_bg::before {
|
||||||
|
content: '';
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background-image: linear-gradient(
|
||||||
|
to bottom,
|
||||||
|
rgba(255, 246, 247, 0) 0%,
|
||||||
|
rgba(255, 246, 247, 0) 35%,
|
||||||
|
rgba(255, 246, 247, 1) 85%,
|
||||||
|
rgba(255, 246, 247, 1) 100%
|
||||||
|
),
|
||||||
|
url('/static/home/jinzhongzi_bg.png');
|
||||||
|
background-repeat: no-repeat, no-repeat;
|
||||||
|
background-position: center top, center -80rpx;
|
||||||
|
background-size: 100% 100%, 100% auto;
|
||||||
|
pointer-events: none;
|
||||||
|
z-index: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.slogan {
|
||||||
|
position: absolute;
|
||||||
|
top: 140rpx;
|
||||||
|
left: 50rpx;
|
||||||
|
right: 40rpx;
|
||||||
|
text-align: left;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 40rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
letter-spacing: 2rpx;
|
||||||
|
z-index: 1;
|
||||||
|
|
||||||
|
.text + .text {
|
||||||
|
margin-top: 10rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.share_card {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
width: 100%;
|
||||||
|
border-radius: 32rpx;
|
||||||
|
background: rgba(255, 255, 255, 0.92);
|
||||||
|
box-shadow: 0 18rpx 56rpx rgba(0, 0, 0, 0.12);
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.con_center {
|
.con_center {
|
||||||
// position: absolute;
|
padding: 60rpx 40rpx 44rpx;
|
||||||
// top: 0;
|
|
||||||
position: relative;
|
|
||||||
padding: 56rpx 28rpx;
|
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
z-index: 10;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.head {
|
|
||||||
width: 96rpx;
|
|
||||||
height: 96rpx;
|
|
||||||
border-radius: 50%;
|
|
||||||
overflow: hidden;
|
|
||||||
margin-right: 20rpx;
|
|
||||||
|
|
||||||
image {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.img {
|
|
||||||
padding: 20rpx;
|
|
||||||
background: #fff;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.con_name {
|
.con_name {
|
||||||
|
font-size: 40rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #1f2d23;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sub_title {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #5d6b61;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label_text {
|
||||||
|
font-size: 26rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.code {
|
||||||
|
width: 380rpx;
|
||||||
|
height: 380rpx;
|
||||||
|
border: 4rpx solid rgba(255, 111, 145, 0.28);
|
||||||
|
border-radius: 32rpx;
|
||||||
|
background: rgba(255, 255, 255, 0.6);
|
||||||
|
}
|
||||||
|
|
||||||
|
.code_wrap {
|
||||||
|
backdrop-filter: blur(10px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.img {
|
||||||
|
width: 300rpx;
|
||||||
|
height: 300rpx;
|
||||||
|
border-radius: 18rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invite_code_bar {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
background: transparent;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
overflow: visible;
|
||||||
|
height: 120rpx;
|
||||||
|
margin: 0;
|
||||||
|
gap: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.code_val {
|
||||||
|
flex: 1;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 56rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
letter-spacing: 4rpx;
|
||||||
|
text-align: center;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background: linear-gradient(to right, #ffb4a2, #ff6f91);
|
||||||
|
border-top-left-radius: 20rpx;
|
||||||
|
border-bottom-left-radius: 20rpx;
|
||||||
|
border-top-right-radius: 0;
|
||||||
|
border-bottom-right-radius: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.copy_btn {
|
||||||
|
width: 140rpx;
|
||||||
|
height: 120rpx;
|
||||||
|
background: #ff7a8a;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: #fff;
|
||||||
|
border-top-left-radius: 0;
|
||||||
|
border-bottom-left-radius: 0;
|
||||||
|
border-top-right-radius: 20rpx;
|
||||||
|
border-bottom-right-radius: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn_text {
|
||||||
|
color: #fff;
|
||||||
|
font-size: 22rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
margin-top: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-copy {
|
||||||
|
width: 24rpx;
|
||||||
|
height: 24rpx;
|
||||||
|
border: 1.3333rpx solid currentColor;
|
||||||
|
border-radius: 5.3333rpx;
|
||||||
|
position: relative;
|
||||||
|
margin-bottom: 5.3333rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-copy::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
left: -8rpx;
|
||||||
|
top: 8rpx;
|
||||||
|
width: 24rpx;
|
||||||
|
height: 24rpx;
|
||||||
|
border: 1.3333rpx solid currentColor;
|
||||||
|
border-radius: 5.3333rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btns {
|
||||||
|
margin-top: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.square-btn-outline {
|
||||||
|
width: 100%;
|
||||||
|
padding: 30rpx 0;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
background: transparent;
|
||||||
|
color: #2b5f3d;
|
||||||
|
border: 2rpx solid #2b5f3d;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.square-btn {
|
||||||
|
margin-top: 20rpx;
|
||||||
|
width: 100%;
|
||||||
|
padding: 30rpx 0;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
background: linear-gradient(90deg, #2f7a4a, #55a96d);
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-down {
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
border-left: 12rpx solid transparent;
|
||||||
|
border-right: 12rpx solid transparent;
|
||||||
|
border-top: 16rpx solid currentColor;
|
||||||
|
margin-right: 14rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-link {
|
||||||
|
width: 30rpx;
|
||||||
|
height: 30rpx;
|
||||||
|
position: relative;
|
||||||
|
margin-right: 14rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-link::before,
|
||||||
|
.icon-link::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
width: 18rpx;
|
||||||
|
height: 12rpx;
|
||||||
|
border: 4rpx solid rgba(255, 255, 255, 0.95);
|
||||||
|
border-radius: 18rpx;
|
||||||
|
top: 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-link::before {
|
||||||
|
left: 0;
|
||||||
|
transform: rotate(-18deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-link::after {
|
||||||
|
right: 0;
|
||||||
|
transform: rotate(18deg);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<!-- 首页,支持店铺装修 -->
|
<!-- 首页,支持店铺装修 -->
|
||||||
<template>
|
<template>
|
||||||
<s-pages title="首页" :showLeftButton="false">
|
<s-layout title="首页" :showLeftButton="false">
|
||||||
<view class="pagesIndex">
|
<view class="pagesIndex">
|
||||||
<s-custom-navbarIndex />
|
<s-custom-navbarIndex />
|
||||||
<view class="pages">
|
<view class="pages">
|
||||||
@@ -35,13 +35,11 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<su-sticky top="100rpx">
|
|
||||||
<view class="goodsIndex">
|
<view class="goodsIndex">
|
||||||
<goods :list="tagList" v-if="tagList?.length" />
|
<goods :list="tagList" v-if="tagList?.length" />
|
||||||
</view>
|
</view>
|
||||||
</su-sticky>
|
|
||||||
</view>
|
</view>
|
||||||
</s-pages>
|
</s-layout>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
@@ -51,7 +49,6 @@ import {
|
|||||||
} from 'vue';
|
} from 'vue';
|
||||||
import {
|
import {
|
||||||
onLoad,
|
onLoad,
|
||||||
onPageScroll,
|
|
||||||
onPullDownRefresh
|
onPullDownRefresh
|
||||||
} from '@dcloudio/uni-app';
|
} from '@dcloudio/uni-app';
|
||||||
import goods from '@/components/goods/goods.vue';
|
import goods from '@/components/goods/goods.vue';
|
||||||
@@ -237,7 +234,6 @@ onPullDownRefresh(() => {
|
|||||||
}, 1000);
|
}, 1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
onPageScroll(() => { });
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|||||||
@@ -1,6 +1,29 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="start-page">
|
<view class="start-page">
|
||||||
<image class="bg" :src="$url + 'home/startPage_yg.png'" mode="aspectFill" />
|
<video
|
||||||
|
v-if="bgSrc && isVideo"
|
||||||
|
class="bg"
|
||||||
|
:src="bgSrc"
|
||||||
|
autoplay
|
||||||
|
loop
|
||||||
|
muted
|
||||||
|
:controls="false"
|
||||||
|
:show-fullscreen-btn="false"
|
||||||
|
:show-play-btn="false"
|
||||||
|
:show-center-play-btn="false"
|
||||||
|
:enable-progress-gesture="false"
|
||||||
|
object-fit="cover"
|
||||||
|
@error="onMediaError"
|
||||||
|
@click="onMediaClick"
|
||||||
|
/>
|
||||||
|
<image
|
||||||
|
v-else-if="bgSrc"
|
||||||
|
class="bg"
|
||||||
|
:src="bgSrc"
|
||||||
|
mode="aspectFill"
|
||||||
|
@error="onMediaError"
|
||||||
|
@click="onMediaClick"
|
||||||
|
/>
|
||||||
<view class="count-down" :class="{ enabled: canEnter }" @click.stop="onEnterClick">
|
<view class="count-down" :class="{ enabled: canEnter }" @click.stop="onEnterClick">
|
||||||
{{ canEnter ? '进入' : `跳过 ${countDown}s` }}
|
{{ canEnter ? '进入' : `跳过 ${countDown}s` }}
|
||||||
</view>
|
</view>
|
||||||
@@ -8,12 +31,47 @@
|
|||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted, onUnmounted } from 'vue'
|
import { ref, onMounted, onUnmounted } from 'vue'
|
||||||
|
import * as IndexApi from '@/sheep/api/index/index'
|
||||||
|
|
||||||
|
const bgSrc = ref('')
|
||||||
|
const jumpUrl = ref('')
|
||||||
|
const isVideo = ref(false)
|
||||||
|
|
||||||
|
const isVideoUrl = (url) => {
|
||||||
|
const u = String(url || '')
|
||||||
|
if (!u) return false
|
||||||
|
const clean = u.split('?')[0].split('#')[0]
|
||||||
|
return /\.(mp4|mov|m4v|webm|ogg)$/i.test(clean)
|
||||||
|
}
|
||||||
|
|
||||||
|
const fetchStartPage = async () => {
|
||||||
|
try {
|
||||||
|
const res = await IndexApi.getstartpage({})
|
||||||
|
if (res?.code !== 0) return false
|
||||||
|
const data = res?.data || {}
|
||||||
|
const media = String(data?.picUrl || '').trim()
|
||||||
|
const url = String(data?.url || '').trim()
|
||||||
|
if (!media) return false
|
||||||
|
bgSrc.value = media
|
||||||
|
jumpUrl.value = url
|
||||||
|
isVideo.value = isVideoUrl(media)
|
||||||
|
return true
|
||||||
|
} catch (e) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onMediaError() {
|
||||||
|
bgSrc.value = ''
|
||||||
|
isVideo.value = false
|
||||||
|
}
|
||||||
|
|
||||||
const countDown = ref(3)
|
const countDown = ref(3)
|
||||||
let timer = null
|
let timer = null
|
||||||
const canEnter = ref(false)
|
const canEnter = ref(false)
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
fetchStartPage()
|
||||||
timer = setInterval(() => {
|
timer = setInterval(() => {
|
||||||
if (countDown.value <= 1) {
|
if (countDown.value <= 1) {
|
||||||
//点击进入
|
//点击进入
|
||||||
@@ -34,9 +92,25 @@ onUnmounted(() => {
|
|||||||
|
|
||||||
function toHome() {
|
function toHome() {
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url: '/pages/index/index'
|
url: '/pages/index/index',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onMediaClick() {
|
||||||
|
const url = String(jumpUrl.value || '').trim()
|
||||||
|
if (!url) return
|
||||||
|
if (/^https?:\/\//i.test(url)) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/public/webview?url=${encodeURIComponent(url)}`,
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (url.startsWith('/pages/')) {
|
||||||
|
uni.navigateTo({ url })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function onEnterClick() {
|
function onEnterClick() {
|
||||||
if (!canEnter.value) return
|
if (!canEnter.value) return
|
||||||
toHome()
|
toHome()
|
||||||
@@ -44,14 +118,18 @@ function onEnterClick() {
|
|||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.start-page {
|
.start-page {
|
||||||
position: relative;
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
background: #fff;
|
||||||
}
|
}
|
||||||
.bg {
|
.bg {
|
||||||
width: 100%;
|
position: absolute;
|
||||||
height: 100%;
|
inset: 0;
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
}
|
}
|
||||||
.count-down {
|
.count-down {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|||||||
@@ -76,6 +76,13 @@
|
|||||||
link: 'navigateTo',
|
link: 'navigateTo',
|
||||||
to: '/pages/home/pass',
|
to: '/pages/home/pass',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: '12',
|
||||||
|
title: '银行卡',
|
||||||
|
clickable: true,
|
||||||
|
link: 'navigateTo',
|
||||||
|
to: '/pages/home/bankCard',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: '5',
|
id: '5',
|
||||||
title: '隐私政策',
|
title: '隐私政策',
|
||||||
|
|||||||
@@ -51,6 +51,27 @@ export const goldSeedIndex = (params) => {
|
|||||||
params: params,
|
params: params,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
export const goldSeedTrend = (params) => {
|
||||||
|
return request({
|
||||||
|
url: '/member/app/gold-seed/trend',
|
||||||
|
method: 'GET',
|
||||||
|
params: params,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
export const goldSeedPoolGrowth = (params) => {
|
||||||
|
return request({
|
||||||
|
url: '/member/app/gold-seed/pool-growth',
|
||||||
|
method: 'GET',
|
||||||
|
params: params,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
export const goldSeedFluctuation = (params) => {
|
||||||
|
return request({
|
||||||
|
url: '/member/app/gold-seed/fluctuation',
|
||||||
|
method: 'GET',
|
||||||
|
params: params,
|
||||||
|
});
|
||||||
|
};
|
||||||
// 社员统计
|
// 社员统计
|
||||||
export const getTeamStats = (params) => {
|
export const getTeamStats = (params) => {
|
||||||
return request({
|
return request({
|
||||||
|
|||||||
@@ -93,6 +93,13 @@ export const getBankList = (params) => {
|
|||||||
params,
|
params,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
export const addBank = (data) => {
|
||||||
|
return request({
|
||||||
|
url: '/member/user/bank/create',
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
};
|
||||||
//获取待释放列表
|
//获取待释放列表
|
||||||
export const getReleaseList = (params) => {
|
export const getReleaseList = (params) => {
|
||||||
return request({
|
return request({
|
||||||
|
|||||||
@@ -7,6 +7,19 @@ export const getbannerlist = (params) => {
|
|||||||
params: params,
|
params: params,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
// 开屏页面图 promotion/splash-screen/get-latest
|
||||||
|
export const getstartpage = (params) => {
|
||||||
|
return request({
|
||||||
|
url: '/promotion/splash-screen/get-latest',
|
||||||
|
method: 'GET',
|
||||||
|
params: params,
|
||||||
|
custom: {
|
||||||
|
showLoading: false,
|
||||||
|
showError: false,
|
||||||
|
isToken: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
// 商品标签 product/tag/list
|
// 商品标签 product/tag/list
|
||||||
export const getproducttaglist = (params) => {
|
export const getproducttaglist = (params) => {
|
||||||
return request({
|
return request({
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 2.8 MiB |
@@ -0,0 +1,6 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="14" height="14" style="" filter="none">
|
||||||
|
|
||||||
|
<g>
|
||||||
|
<g fill="none" stroke="#FF6B9A" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M3 3v18h18"></path><path d="M7 12v5h12V8l-5 5l-4-4Z"></path></g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 355 B |
@@ -0,0 +1,6 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="14" height="14" style="" filter="none">
|
||||||
|
|
||||||
|
<g>
|
||||||
|
<g fill="none" stroke="rgb(59, 130, 246)" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><ellipse cx="12" cy="5" rx="9" ry="3"></ellipse><path d="M3 5v14a9 3 0 0 0 18 0V5"></path><path d="M3 12a9 3 0 0 0 18 0"></path></g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 423 B |
@@ -0,0 +1,6 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="14" height="14" style="" filter="none">
|
||||||
|
|
||||||
|
<g>
|
||||||
|
<path fill="none" stroke="#FF6B9A" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 3v18h18m-3-4V9m-5 8V5M8 17v-3"></path>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 329 B |
Reference in New Issue
Block a user