feat: move project

This commit is contained in:
ckaaaa 2025-09-16 13:41:49 +08:00
commit 4a940f28ba
97 changed files with 5047 additions and 0 deletions

16
custom-tab-bar/data.js Normal file
View file

@ -0,0 +1,16 @@
export default [{
icon: 'home',
text: '动态',
url: 'pages/home/home',
},
{
icon: 'share',
text: '分销',
url: 'pages/faxianlist/faxianlist',
},
{
icon: 'person',
text: '我的',
url: 'pages/usercenter/index',
},
];

66
custom-tab-bar/index.js Normal file
View file

@ -0,0 +1,66 @@
import TabMenu from './data';
import R from '../utils/request';
import C from '../utils/constant';
Component({
data: {
active: 0,
list: [],
is_share: false,
cdnHost: C.cdnHost,
},
ready() {
R.get('/index.php/api/v1/my').then(({ model }) => {
this.setData({
is_share: !!model.is_share,
list: TabMenu.filter((_, idx) => {
if (model.is_share) {
return true
} else {
return idx !== 1
}
})
});
});
},
methods: {
goTakePhoto() {
wx.navigateTo({
url: '/pages/takephoto/takephoto',
})
},
onChange(event) {
this.setData({ active: event.detail.value });
wx.switchTab({
url: this.data.list[event.detail.value].url.startsWith('/')
? this.data.list[event.detail.value].url
: `/${this.data.list[event.detail.value].url}`,
});
},
init() {
const page = getCurrentPages().pop();
const route = page ? page.route.split('?')[0] : '';
const active = this.data.list.findIndex(
(item) =>
(item.url.startsWith('/') ? item.url.substr(1) : item.url) ===
`${route}`,
);
this.setData({ active });
},
getPhoneNumber(e) {
console.log(e.detail.code) // 动态令牌
console.log(e.detail.errMsg) // 回调信息(成功失败都会返回)
console.log(e.detail.errno) // 错误码(失败时返回)
if (!e.detail.errno) {
R.post('/index.php/api/v1/bind_auth_phone', { code: e.detail.code }).then(() => {
this.setData({ hasPhone: true })
this.goTakePhoto();
})
} else {
// e.detail.errMsg
}
},
},
});

View file

@ -0,0 +1,9 @@
{
"component": true,
"usingComponents": {
"t-tab-bar": "tdesign-miniprogram/tab-bar/tab-bar",
"t-tab-bar-item": "tdesign-miniprogram/tab-bar-item/tab-bar-item",
"t-icon": "tdesign-miniprogram/icon/icon",
"t-image": "tdesign-miniprogram/image/image"
}
}

36
custom-tab-bar/index.wxml Normal file
View file

@ -0,0 +1,36 @@
<view class="tabline">
<t-tab-bar value="{{active}}" bindchange="onChange" split="{{false}}">
<t-tab-bar-item wx:for="{{list}}" wx:for-item="item" wx:for-index="index" wx:key="index">
<view class="{{'custom-tab-bar-wrapper ' + ('tab' + index) + ' ' + (index == active ? 'cur' : '')}}">
<t-icon prefix="wr" name="{{item.icon}}" size="40rpx" />
<view class="text">{{ item.text }}</view>
</view>
</t-tab-bar-item>
<!-- <t-tab-bar-item>
<view class="{{'custom-tab-bar-wrapper ' + ('tab' + 0) + ' ' + (0 == active ? 'cur' : '')}}">
<t-icon prefix="wr" name="{{list[0].icon}}" size="40rpx" />
<view class="text">{{ list[0].text }}</view>
</view>
</t-tab-bar-item>
<t-tab-bar-item wx:if="{{is_share}}">
<view class="{{'custom-tab-bar-wrapper ' + ('tab' + 1) + ' ' + (1 == active ? 'cur' : '')}}">
<t-icon prefix="wr" name="{{list[1].icon}}" size="40rpx" />
<view class="text">{{ list[1].text }}</view>
</view>
</t-tab-bar-item>
<t-tab-bar-item>
<view class="{{'custom-tab-bar-wrapper ' + ('tab' + 2) + ' ' + (2 == active ? 'cur' : '')}}">
<t-icon prefix="wr" name="{{list[2].icon}}" size="40rpx" />
<view class="text">{{ list[2].text }}</view>
</view>
</t-tab-bar-item> -->
<!-- <view class="camera" bind:tap="goTakePhoto" wx:if="{{hasPhone}}">
<t-image loading=" " mode="aspectFill" src="{{cdnHost + '/static/camera.png?v=5'}}" width="29" height="23" />
<view class="txt">发现</view>
</view>
<button open-type="getPhoneNumber" class="camera" bindgetphonenumber="getPhoneNumber" wx:else>
<t-image loading=" " mode="aspectFill" src="{{cdnHost + '/static/camera.png?v=5'}}" width="29" height="23" />
<view class="txt">发现</view>
</button> -->
</t-tab-bar>
</view>

40
custom-tab-bar/index.wxss Normal file
View file

@ -0,0 +1,40 @@
.tabline {
position: relative;
}
.custom-tab-bar-wrapper {
display: flex;
align-items: center;
}
.text {
font-size: 28rpx;
padding-left: 10rpx;
}
.camera {
position: absolute;
left: 50%;
top: 20rpx;
border-radius: 20rpx;
height: 78rpx;
width: 176rpx;
background: linear-gradient(180deg, rgb(74, 137, 254) 0%, rgb(47, 103, 254) 100%);
transform: translateX(-50%);
display: flex;
align-items: center;
justify-content: center;
z-index: 2;
font-size: 28rpx;
color: #fff;
}
.camera .txt{
display: flex;
align-items: center;
padding-left:10rpx;
white-space: nowrap;
}
.custom-tab-bar-wrapper.cur {
color: #2966f5;
}