first commit

This commit is contained in:
Jane Doe
2025-03-04 15:25:38 +08:00
commit 4ad00dedd5
188 changed files with 7420 additions and 0 deletions

View File

@@ -0,0 +1,187 @@
var e = getApp();
Page({
data: {
isVip: false,
startTime: "--",
endTime: "--",
selectedType: null,
cards: [],
isQuota: false,
show: false,
isIOS: false, // 是否为 iOS 系统
},
onLoad: function (e) {
const that = this;
getApp().check_status()
.then(function(res) {
that.setData({
show: res.data.data.show
});
if (!that.data.show) {
wx.showModal({
title: "提示",
content: "iOS 暂时无法使用此功能,请稍后再试。",
showCancel: false,
confirmText: "知道了",
success: () => {
// 可选:用户确认后返回上一级页面
wx.reLaunch({
url: "/pages/index/index",
})
}
});
return; // 停止执行后续逻辑
}
})
.catch(function(err) {
console.error("获取文章信息失败:", err);
})
.finally(function() {
console.log("check_status调用完成");
});
// 使用 wx.getDeviceInfo() 检测系统是否为 iOS
// 非 iOS 系统,继续加载页面逻辑
var t = wx.getStorageSync("cards").filter(function (t) {
return t.is_quota === JSON.parse(e.isQuota || "false");
});
console.log("renderCards", t);
this.setData({
cards: t,
isQuota: JSON.parse(e.isQuota || "false"),
});
},
onRecharge: function (e) {
this.setData({
selectedType: e.currentTarget.dataset.type,
});
},
// open_button: function (e) {
// // 如果是 iOS弹出提示框备用逻辑
// if (this.data.isIOS) {
// wx.showModal({
// title: "提示",
// content: "iOS 暂时无法使用此功能,请稍后再试。",
// showCancel: false,
// confirmText: "知道了",
// });
// return;
// }
// // 非 iOS 正常跳转到支付小程序
// var t = e.currentTarget.dataset.type,
// n = e.currentTarget.dataset.price;
// this.setData({
// selectedType: t,
// }),
// console.log(t, n),
// wx.navigateToMiniProgram({
// appId: "wxbe54dfa3311e0443",
// path: "pages/payment/payment?type="
// .concat(t, "&externalOpenid=")
// .concat(wx.getStorageSync("openid"), "&total_fee=")
// .concat(n, "&transaction_type=member&isDebug=false"),
// envVersion: "release",
// success: function (e) {
// console.log("跳转到支付小程序成功", e);
// },
// fail: function (e) {
// console.error("跳转到支付小程序失败", e);
// },
// });
// },
open_button: function(t) {
var n = t.currentTarget.dataset.type, o = t.currentTarget.dataset.price;
this.setData({
selectedType: n
}), console.log(t), e.apiRequest({
url: "/myapp/wx_pay/",
method: "POST",
data: {
type: n,
openid: wx.getStorageSync("openid"),
total_fee: o,
transaction_type: "member"
},
success: function(t) {
console.log(t), t.data && t.data.paySign ? wx.requestPayment({
timeStamp: t.data.timeStamp,
nonceStr: t.data.nonceStr,
package: t.data.package,
signType: "RSA",
paySign: t.data.paySign,
success: function(t) {
e.getinfo().then(function() {
console.log(wx.getStorageSync("cards")), wx.navigateBack({
delta: 1,
success: function(e) {
console.log("返回上一页成功");
}
});
}).catch(function(e) {
console.error("An error occurred:", e);
}), console.log(t), wx.showToast({
title: "支付成功",
icon: "success"
});
},
fail: function(e) {
wx.showToast({
title: "支付失败",
icon: "error"
});
}
}) : wx.showToast({
title: "创建订单失败",
icon: "error"
});
}
});
},
onReady: function () {},
onShow: function () {
var t = this;
e.getUserInfo()
.then(function () {
t.setData({
isVip: wx.getStorageSync("isMember"),
startTime: t.formatEndTime(wx.getStorageSync("startTime")),
endTime: t.formatEndTime(wx.getStorageSync("endTime")),
});
})
.catch(function (e) {
console.error("获取用户信息失败:", e);
})
.finally(function () {
console.log("getUserInfo调用完成");
});
//
},
formatEndTime: function(e) {
// 将秒时间戳转换为毫秒时间戳
var date = new Date(e * 1000);
// 格式化为“YYYY年MM月DD日”
var year = date.getFullYear();
var month = String(date.getMonth() + 1).padStart(2, "0"); // 月份从 0 开始,需要 +1
var day = String(date.getDate()).padStart(2, "0");
var formattedDate = `${year}-${month}-${day}`;
return formattedDate
},
onHide: function () {},
onUnload: function () {},
onPullDownRefresh: function () {},
onReachBottom: function () {},
onShareAppMessage: function () {},
});

View File

@@ -0,0 +1,7 @@
{
"navigationBarTitleText": "会员中心",
"navigationBarBackgroundColor": "#222238",
"navigationBarTextStyle": "white",
"component": true,
"usingComponents": {}
}

View File

@@ -0,0 +1,32 @@
<view class="container" wx:if="{{show}}">
<view class="status-section" wx:if="{{isVip}}">
<view class="user-vip " style="position:relative;">
<image class="user-pic" src="/images/老师教师男人.png"></image>
<view style="width: 200px;text-align: left; color: rgb(253, 217, 10);font-weight: 800;">尊贵VIP</view>
</view>
<view class="right">
<view>开通时间:{{startTime}}</view>
<view>到期时间:{{endTime}}</view>
<button bindtap="open_button" class="renew-button small-button" data-price="{{cards[4].price}}" data-type="{{cards[4].type}}">续费</button>
</view>
</view>
<view class="recharge-options">
<text class="title">选择订阅套餐:</text>
<view bindtap="onRecharge" class="card" data-price="{{item.price}}" data-type="{{item.type}}" wx:for="{{cards}}" wx:key="index">
<image class="card-icon" src="https://file.guimiaokeji.com/VIP.png" wx:if="{{!isQuota}}"></image>
<image class="card-icon" src="../../images/积分.png" wx:if="{{isQuota}}"></image>
<view class="card-content">
<text class="card-title">{{item.title}}</text>
<view class="price-wrapper">
<text class="original-price">原价¥{{item.price*2}}</text>
<text class="current-price">限时¥{{item.price}}</text>
</view>
<view class='desc'>{{item.description}}</view>
</view>
<button bindtap="open_button" class="open-button" data-price="{{item.price}}" data-type="{{item.type}}" wx:if="{{selectedType===item.type}}">开通</button>
</view>
</view>
<view class="footer">
<text>成为会员,享受无限使用功能特权,体验更多专属内容!</text>
</view>
</view>

View File

@@ -0,0 +1,133 @@
page {
background-color: #222238;
border-top: 1px solid hsla(0,31%,87%,.5);
}
.container {
font-family: Arial;
padding: 20px;
}
.desc{
white-space: pre-wrap; /* 支持换行 */
color: #fff;
font-size: 22rpx;
font-weight: 300;
}
.status-section {
background: linear-gradient(90deg,#8d72d2,#7183f3);
display: flex;
justify-content: space-between;
margin-bottom: 20px;
text-align: center;
}
.footer,.recharge-options,.status-section {
border-radius: 10px;
box-shadow: 0 2px 10px rgba(0,0,0,.1);
color: #a790e2;
padding: 20px 10px;
width: 100%;
}
.card {
align-items: center;
background-color: #2f2f50;
border-radius: 20rpx;
box-shadow: 0 4px 6px rgba(0,0,0,.3),0 1px 3px rgba(0,0,0,.08);
display: flex;
margin-top: 10px;
padding: 10px;
transition: all .2s;
}
.card-icon {
height: 50px;
margin-right: 10px;
width: 50px;
}
.card-content {
flex-grow: 1;
width: 60%;
}
.card-title {
color: #a790e2;
font-size: 16px;
font-weight: 700;
}
.price-wrapper {
align-items: center;
display: flex;
}
.original-price {
color: #97a09a;
margin-right: 10rpx;
text-decoration: line-through;
}
.current-price {
color: #f861f8;
}
.renew-button {
line-height: 2.4rem;
}
.open-button,.renew-button {
background: linear-gradient(90deg,#592bcc,#d231d8);
border: none;
border-radius: 5px;
box-shadow: 0 4px 8px rgba(0,0,0,.2);
color: #fff;
cursor: pointer;
font-size: 1rem;
height: 2.5rem;
margin-top: 10px;
padding: .5rem 1rem;
text-align: center;
transition: background-color .3s,box-shadow .3s;
width: 6rem;
}
.open-button {
line-height: 1.9rem;
}
.open-button:hover,.renew-button:hover {
background-color: #e43333;
box-shadow: 0 6px 12px rgba(0,0,0,.3);
}
.small-button {
padding: 5px;
}
.footer {
color: #777;
font-size: 14px;
text-align: center;
}
.user-vip,.user-vip .user-pic {
height: 130rpx;
margin: 0 auto;
width: 130rpx;
}
.user-vip .user-pic {
background: #fff;
border-radius: 50%;
display: block;
overflow: hidden;
}
.right {
color: #fff;
}