2024-12-18 15:46:27 +08:00
|
|
|
|
<script setup>
|
|
|
|
|
import {
|
|
|
|
|
onMounted,
|
|
|
|
|
ref,
|
|
|
|
|
reactive,
|
|
|
|
|
computed,
|
|
|
|
|
getCurrentInstance,
|
|
|
|
|
watch,
|
|
|
|
|
defineExpose,
|
|
|
|
|
} from 'vue';
|
|
|
|
|
import {
|
|
|
|
|
useStore,
|
|
|
|
|
} from 'vuex'
|
|
|
|
|
import {
|
|
|
|
|
onLoad
|
|
|
|
|
} from '@dcloudio/uni-app'
|
2025-01-05 15:43:14 +08:00
|
|
|
|
// 工具库
|
|
|
|
|
import util from '@/common/js/util';
|
|
|
|
|
//
|
|
|
|
|
import api from '@/api/index.js';
|
2024-12-18 15:46:27 +08:00
|
|
|
|
const treeData = ref([])
|
|
|
|
|
const store = useStore()
|
|
|
|
|
const userinfo = computed(() => {
|
|
|
|
|
let result = store.state.userinfo
|
|
|
|
|
return result
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
onLoad(() => {
|
2025-01-02 01:01:23 +08:00
|
|
|
|
// 获取榴莲果树
|
2024-12-18 15:46:27 +08:00
|
|
|
|
buyDurianList()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// 我的榴莲果树
|
|
|
|
|
function buyDurianList() {
|
2025-01-05 15:43:14 +08:00
|
|
|
|
api.durian.buyDurianList({}).then(rs => {
|
2025-01-02 01:01:23 +08:00
|
|
|
|
if (rs.code == 200) {
|
2025-02-19 16:54:49 +08:00
|
|
|
|
// 我的榴莲果树
|
2025-01-05 15:43:14 +08:00
|
|
|
|
treeData.value = rs.data.dataList.map(item => {
|
2025-02-19 16:54:49 +08:00
|
|
|
|
// orderType 0赠送 1兑换
|
|
|
|
|
item.style = {
|
|
|
|
|
'0': {
|
|
|
|
|
1: 'scroll1',
|
|
|
|
|
2: 'scroll2',
|
|
|
|
|
3: 'scroll3',
|
|
|
|
|
4: 'scroll4',
|
|
|
|
|
} [item.durianConfigId],
|
|
|
|
|
'1': {
|
|
|
|
|
1: 'buy1',
|
|
|
|
|
2: 'buy2',
|
|
|
|
|
3: 'buy3',
|
|
|
|
|
4: 'buy4',
|
|
|
|
|
} [item.durianConfigId],
|
|
|
|
|
} [item.orderType]
|
2025-01-05 15:43:14 +08:00
|
|
|
|
item.formatHash = formatStr(item.treeHash)
|
|
|
|
|
return item
|
|
|
|
|
})
|
2025-01-02 01:01:23 +08:00
|
|
|
|
return
|
2024-12-18 15:46:27 +08:00
|
|
|
|
}
|
2025-01-02 01:01:23 +08:00
|
|
|
|
util.alert({
|
|
|
|
|
content: rs.msg,
|
|
|
|
|
showCancel: false
|
|
|
|
|
})
|
2024-12-18 15:46:27 +08:00
|
|
|
|
})
|
|
|
|
|
}
|
2025-01-05 15:43:14 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 处理字符串
|
|
|
|
|
* @param {Object} str
|
|
|
|
|
*/
|
|
|
|
|
function formatStr(str) {
|
|
|
|
|
// 如果字符串长度小于等于6,直接返回原字符串
|
|
|
|
|
if (str.length <= 6) return str
|
|
|
|
|
return str.slice(0, 3) + '***' + str.slice(-3); // 拼接结果
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 跳转详情
|
|
|
|
|
* @param {Object} item
|
|
|
|
|
*/
|
|
|
|
|
function handleDetail(item) {
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: util.setUrl('/pages/index/durianLog', {
|
|
|
|
|
id: item.durianTreeId,
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 复制
|
|
|
|
|
* @param {Object} ev 需要复制的码
|
|
|
|
|
*/
|
|
|
|
|
function handleCopy(ev) {
|
|
|
|
|
util.copyText(ev)
|
|
|
|
|
}
|
2024-12-18 15:46:27 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<view class="appbw">
|
|
|
|
|
<!-- -->
|
|
|
|
|
<view class="list mlr40">
|
2025-02-19 16:54:49 +08:00
|
|
|
|
<view class="item rows mtb25 br15" v-for="(item,index) in treeData" :key="index" @click="handleDetail(item)"
|
|
|
|
|
:class="item.style">
|
2025-01-05 15:43:14 +08:00
|
|
|
|
<image class="wh180 fs0" src="/static/tree.png" mode="aspectFit" />
|
|
|
|
|
|
|
|
|
|
<view class="col f1 ml30 mtb30 c333 f26">
|
2025-02-19 16:54:49 +08:00
|
|
|
|
<view class="txt mtb10">每日可释放:{{item.releasableDaily}}</view>
|
2025-01-05 15:43:14 +08:00
|
|
|
|
<view class="txt mtb10">剩余可释放:{{item.remainFruitCount}}</view>
|
|
|
|
|
<view class="txt mtb10">当前级别:{{item.treeName}}</view>
|
|
|
|
|
<view class="txt mtb10" @click.stop="util.copyText(item.treeHash)">
|
|
|
|
|
<text>哈希值: {{item.formatHash}}</text>
|
2025-02-19 16:54:49 +08:00
|
|
|
|
<image class="wh20 ml10" src="/static/copy.png" mode="aspectFit" />
|
2025-01-05 15:43:14 +08:00
|
|
|
|
</view>
|
2024-12-18 15:46:27 +08:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2025-02-19 16:54:49 +08:00
|
|
|
|
<view class="tac c999 f40 mt80" v-if="!treeData[0]">当前暂无榴莲果树~</view>
|
2024-12-18 15:46:27 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
<!-- 填充 -->
|
|
|
|
|
<view class="fill" style="height: 60rpx;"></view>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
|
//
|
|
|
|
|
.list {
|
2025-02-19 16:54:49 +08:00
|
|
|
|
|
|
|
|
|
// 默认
|
2024-12-18 15:46:27 +08:00
|
|
|
|
.item {
|
|
|
|
|
background-color: #F4F4F4;
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-19 16:54:49 +08:00
|
|
|
|
// 卷轴赠送
|
|
|
|
|
.scroll1 {
|
|
|
|
|
background-color: #F4F4F4;
|
2024-12-18 15:46:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
2025-02-19 16:54:49 +08:00
|
|
|
|
.scroll2 {
|
2024-12-18 15:46:27 +08:00
|
|
|
|
background-color: #E4FBFF;
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-19 16:54:49 +08:00
|
|
|
|
.scroll3 {
|
2024-12-18 15:46:27 +08:00
|
|
|
|
background-color: #CACDFF;
|
|
|
|
|
}
|
2025-02-19 16:54:49 +08:00
|
|
|
|
|
|
|
|
|
.scroll4 {
|
|
|
|
|
background-color: #F4CAFF;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 普通购买
|
|
|
|
|
.buy1 {
|
|
|
|
|
background-color: rgb(225, 253, 204);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.buy2 {
|
|
|
|
|
background-color: #FFF0B1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.buy3 {
|
|
|
|
|
background-color: #CAF0F3;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.buy4 {
|
|
|
|
|
background-color: #FBC5C5;
|
|
|
|
|
}
|
2024-12-18 15:46:27 +08:00
|
|
|
|
}
|
|
|
|
|
</style>
|