初始化

This commit is contained in:
2024-12-06 16:18:22 +08:00
commit 884dd70d83
751 changed files with 60883 additions and 0 deletions
@@ -0,0 +1,300 @@
const {
etmsPost,
etmsPostTemp
} = require("../../com");
const app = getApp();
// pages/accollect/index.js
Page({
/**
* 页面的初始数据
*/
data: {
tenantId: null,
collectId: null,
activityList: null,
metaData: null,
isLoadFinish: true,
},
/**
* 生命周期函数--监听页面加载
*/
async onLoad(query) {
if (query && query.scene) {
var parms = query.scene.split("_");
this.setData({
tenantId: parms[0],
collectId: parms[1],
})
}
if (query && query.tenantId) {
var tenantId = "";
var collectId = "";
if (query.tenantId) {
tenantId = query.tenantId;
}
if (query.collectId) {
collectId = query.collectId
}
this.setData({
tenantId: tenantId,
collectId: collectId,
})
}
this.goInit(3);
wx.showShareMenu({
withShareTicket: true, // 展示默认分享按钮
menus: ['shareAppMessage', 'shareTimeline'] //分享好友
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
this.goInit(2);
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
this.goInit(1);
},
async goInit(a) {
//请求锁
if (!this.data.isLoadFinish) {
return
}
this.setData({
isLoadFinish: false
})
//未登录走这个
if (!app.globalData.s) {
await this.login()
}
wx.showToast({
title: '加载中', //设置标题
mask: true, //是否打开遮罩,默认不打开
icon: 'loading' //图标样式,none为无图标
});
this.init();
},
setLoginInfo(res) {
app.globalData.s = res.s;
app.globalData.u = res.u;
app.globalData.openId = res.openId;
app.globalData.unionid = res.unionid;
app.globalData.nickName = res.nickName;
app.globalData.avatarUrl = res.avatarUrl;
app.globalData.phone = res.phone;
if (res.avatarUrl) {
app.globalData.isGetUser = true;
}
},
async login() {
var that = this;
return new Promise((resolve, reject) => {
wx.login({
success: (res) => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
resolve( etmsPostTemp(
"openParent2/WxMiniLogin", {
code: res.code,
},
that.setLoginInfo,
)) ;
},
});
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
var bascInfo = this.data.metaData;
var path = `pages/accollect/index?tenantId=${this.data.tenantId}&collectId=${this.data.collectId}`
return {
title: bascInfo.title,
imageUrl: bascInfo.imageCoverUrl,
path: path,
}
},
onShareTimeline() {
var bascInfo = this.data.metaData;
var path = `pages/accollect/index?tenantId=${this.data.tenantId}&collectId=${this.data.collectId}`
console.log(2222);
return {
title: bascInfo.title,
imageUrl: bascInfo.imageCoverUrl,
path: path,
}
},
/**
* 将阿伯数字转成中文
*/
addChinese(n) {
var cnum = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九', '十'];
function rp(n) {
var s = '';
n = '' + n; // 数字转为字符串
for (var i = 0; i < n.length; i++) {
s += cnum[parseInt(n.charAt(i))];
}
if (s.length == 2) { // 两位数的时候
// 如果个位数是0的时候,0改成十
if (s.charAt(1) == cnum[0]) {
s = s.charAt(0) + cnum[10];
// 如果是一十改成十
if (s == cnum[1] + cnum[10]) {
s = cnum[10]
}
} else if (s.charAt(0) == cnum[1]) {
// 如果十位数是一的话改成十
s = cnum[10] + s.charAt(1);
} else if (s.charAt(0) == cnum[2]) {
// 如果十位数是二的话改成十二
s = cnum[2] + cnum[10] + s.charAt(1);
} else if (s.charAt(0) == cnum[3]) {
s = cnum[3] + cnum[10] + s.charAt(1);
} else if (s.charAt(0) == cnum[4]) {
s = cnum[4] + cnum[10] + s.charAt(1);
} else if (s.charAt(0) == cnum[5]) {
s = cnum[5] + cnum[10] + s.charAt(1);
} else if (s.charAt(0) == cnum[6]) {
s = cnum[6] + cnum[10] + s.charAt(1);
} else if (s.charAt(0) == cnum[7]) {
s = cnum[7] + cnum[10] + s.charAt(1);
} else if (s.charAt(0) == cnum[8]) {
s = cnum[8] + cnum[10] + s.charAt(1);
} else if (s.charAt(0) == cnum[9]) {
s = cnum[9] + cnum[10] + s.charAt(1);
} else if (s.charAt(0) == cnum[10]) {
s = cnum[10] + cnum[10] + s.charAt(1);
}
}
return s;
}
return rp(n)
},
goDetail(e) {
const item = e.currentTarget.dataset['obj']
let url = "";
switch (item.bascInfo.activityType) {
case 0:
url = `../acdetail1/index?scene=${item.bascInfo.tenantId}_${item.bascInfo.activityMainId}`;
wx.navigateTo({
url: url
})
break;
case 2:
url = `../acdetail4/index?scene=${item.bascInfo.tenantId}_${item.bascInfo.activityMainId}`;
wx.navigateTo({
url: url
})
break;
case 1:
url = `../acdetail2/index?scene=${item.bascInfo.tenantId}_${item.bascInfo.activityMainId}`;
wx.navigateTo({
url: url
})
break;
case 3:
url = `../acdetail3/index?scene=${item.bascInfo.tenantId}_${item.bascInfo.activityMainId}`;
wx.navigateTo({
url: url
})
break;
}
},
isShowCountDownTime(data) {
let v = 0;
if (data.teamLeaderRoute && data.teamLeaderRoute.activityRouteId) {
var tempTeamLeaderRoute = data.teamLeaderRoute;
var temmpTotalCountDownTime = tempTeamLeaderRoute.exTimeCountDown;
v = temmpTotalCountDownTime
}
return v
},
c(data) {
if (data.teamLeaderRoute && data.teamLeaderRoute.activityRouteId) {
var tempTeamLeaderRoute = data.teamLeaderRoute;
var temmpTotalCountDownTime = tempTeamLeaderRoute.exTimeCountDown;
return temmpTotalCountDownTime
} else {
return false
}
},
init() {
etmsPost(
app.globalData,
"openParent2/WxMiniActivityCollectGet", {
tenantId: this.data.tenantId,
collectId: this.data.collectId,
},
(data) => {
app.globalData.microWebHomeUrl = data.activityList[0].wxMiniTenantConfig.microWebHomeUrl;
data.activityList = data.activityList.map((value, index) => {
let datac = data;
return {
...value,
Chinese: this.addChinese(index + 1),
isShowCountDownTime: this.c(datac) ? true : false,
totalCountDownTime: this.c(datac),
}
})
wx.setNavigationBarTitle({
title: data.title
})
wx.hideToast();
this.setData({
activityList: data.activityList,
metaData: data,
isLoadFinish: true,
})
}
);
}
})
@@ -0,0 +1,13 @@
{
"usingComponents": {
"t-tag": "tdesign-miniprogram/tag/tag",
"t-icon": "tdesign-miniprogram/icon/icon",
"t-button": "tdesign-miniprogram/button/button",
"t-divider": "tdesign-miniprogram/divider/divider",
"t-count-down": "tdesign-miniprogram/count-down/count-down",
"t-steps": "tdesign-miniprogram/steps/steps",
"t-step": "tdesign-miniprogram/steps/step-item",
"com-part":"../../components/comPart/compart"
},
"navigationBarTitleText": "活动集"
}
@@ -0,0 +1,134 @@
<!--pages/accollect/index.wxml-->
<view class="accollectPage">
<com-part metaData="{{metaData}}"></com-part>
<view class="activeList" wx:for="{{activityList}}" wx:key="index">
<view style="display: flex;justify-content: space-between;align-items: center;margin-bottom: 15px;">
<t-tag class="margin-16 zdy" variant="light">课程{{item.Chinese}}
</t-tag>
<t-tag variant="light" class="margin-16 ybm" wx:if="{{item.isActivitying}}">已报名
</t-tag>
<view wx:else="">
<view wx:if="{{item.bascInfo.activityType == 2 || item.bascInfo.activityType == 0}}">
<view wx:if="{{item.isActivitying&&item.teamLeaderRoute}}">
<view wx:if="{{item.teamLeaderRoute.countShortStatus===2}}">
<view>
<t-icon name="check-circle" size="xl" />
</view>
<!-- <t-tag variant="light" class="ybm">已报名
</t-tag> -->
</view>
<view wx:else>
<view wx:if="{{item.bascInfo.activityStatus===1}}">
<view wx:if="{{item.isShowCountDownTime}}" class="ec_teamRoute_time">
<view class="ac30_extime2">
距离活动结束
<t-count-down content="default" time="{{item.totalCountDownTime}}" theme="square" size="small" />
</view>
</view>
<view wx:else class="ac30_extime2">
<view> 截止{{item.teamLeaderRoute.activityEndTime}} </view>
</view>
</view>
<view wx:else class="ac30_extime2">
活动{{item.bascInfo.activityStatusDesc}}
</view>
</view>
</view>
<view wx:else class="ac30_extime2">
活动{{item.bascInfo.activityStatusDesc}}
</view>
</view>
<view wx:if="{{item.bascInfo.activityType == 3 || item.bascInfo.activityType == 3}}">
<view wx:if="{{item.activityExInfo.exType===0}}" class="ac3_titlle_price_desc ac1_titlle_price_desc_my">
<view class="ac30_extime2">
截止{{item.activityExInfo.exDateDesc}}
</view>
</view>
<view wx:if="{{item.activityExInfo.exType===1}}" class="ac3_titlle_price_desc ac1_titlle_price_desc_my">
<view class="ac3_extime2">
<t-count-down content="default" time="{{item.activityExInfo.exTimeCountDown}}" theme="square" size="small" />
</view>
</view>
<view wx:if="{{item.activityExInfo.exType===2}}" class="ac3_titlle_price_desc ac1_titlle_price_desc_my ac1_titlle_exover">
<view class="ac30_extime2">活动已结束</view>
</view>
</view>
</view>
</view>
<view class="pBody">
<view class="leftLayout">
<image src="{{item.bascInfo&&item.bascInfo.coverImage}}" mode="aspectFit" />
<view style="position: absolute;bottom: 0;left: 0;">
<t-tag theme="success" t-class="ac1_fenxiao_btn" shape="round" wx:if="{{item.bascInfo.activityType == 3}}">分销</t-tag>
<t-tag theme="danger" t-class="ac1_pt_btn" shape="round" wx:if="{{item.bascInfo.isMultiGroupPurchase&&item.bascInfo.activityType == 0}}">多阶拼团</t-tag>
<t-tag theme="success" t-class="ac1_pt_btn" shape="round" wx:if="{{!item.bascInfo.isMultiGroupPurchase&&item.bascInfo.activityType == 0}}">普通拼团</t-tag>
<t-tag theme="success" t-class="ac1_ms_btn" shape="round" wx:if="{{item.bascInfo.activityType == 2}}">秒杀</t-tag>
<t-tag theme="success" t-class="ac1_kj_btn" shape="round" wx:if="{{item.bascInfo.activityType == 1}}">砍价</t-tag>
</view>
</view>
<view class="rightLayout">
<view class="courseName">{{item.bascInfo&&item.bascInfo.courseName}}</view>
<view class="info">
<view class="courseT">
{{item.bascInfo.courseDesc}}
</view>
<view class="goDetail">
<text class="ckxq" bindtap="goDetail" data-obj="{{item}}">查看详情</text>
<t-icon name="chevron-right" color="#fe3e6d" />
</view>
</view>
<t-divider class="divider" />
<view class="priceShow">
<text class="payMustValuetext">{{item.bascInfo.payPriceDesc}}</text>
<view class="payMustValue">
¥{{item.bascInfo.payMustValue}}
</view>
<view class="originalPrice">
¥{{item.bascInfo.originalPrice}}
</view>
</view>
</view>
</view>
<view class="goPay" wx:if="{{item.bascInfo.activityStatus == 1&& !item.isActivitying}}" bindtap="goDetail" data-obj="{{item}}">
<text wx:if="{{item.bascInfo.activityType == 0}}">去开团</text>
<text wx:else>去报名</text>
</view>
<view class="goPay" style="background: #909399;" wx:if="{{item.bascInfo.activityStatus == 3}}">
<text>活动已结束</text>
</view>
<view style="display: flex;align-items: center;">
<view style="margin-top: 15px;flex: 1;" wx:if="{{item.bascInfo.groupPurchaseRule.items.length > 1 && item.bascInfo.activityStatus != 3}}">
<t-steps current="[]" readonly="true" active-icon=" ">
<t-step t-class-title="steps_color" wx:for="{{item.bascInfo.groupPurchaseRule.items}}" wx:for-index="tIndex" wx:for-item='tItme' wx:key="tIndex" wx:if="{{tIndex < 3}}">
<view slot="content">
<view class="stepC">
<view>{{tItme.limitCount}}人团</view>
<view>¥{{tItme.money}}</view>
</view>
</view>
</t-step>
</t-steps>
</view>
<view wx:if="{{item.bascInfo.groupPurchaseRule.items.length > 3}}" style="color: #feeb62;margin-top: 19px;font-weight: 700;font-size: 30px;">
...
</view>
</view>
</view>
</view>
@@ -0,0 +1,351 @@
/* pages/accollect/index.wxss */
.accollectPage {
padding: 12px;
}
page {
/* background-color: #f4f6fa; */
color: rgba(0, 0, 0, 0.9);
font-family: Microsoft YaHei;
background-color: #fff;
}
.ac30_extime2,
.ac30_extime {
color: #b3b3b3;
font-size: 14px;
}
.ac1_pt_btn {
background-color: #e34d59 !important;
border: #e34d59 !important;
position: relative;
}
.ac1_ms_btn {
background-color: #ff4133 !important;
border: #ff4133 !important;
position: relative;
}
.ac1_fenxiao_btn {
background-color: #FF6A2F !important;
border: #FF6A2F !important;
position: relative;
}
.ac1_kj_btn {
background-color: #ff6670 !important;
border: #ff6670 !important;
position: relative;
}
.ac1_kj_btn::after {
content: "";
position: absolute;
top: 0;
right: -41px;
height: 100%;
width: 50px;
z-index: 2;
background-color: #ff6670;
clip-path: path("M 0,0 C 24,0 8,24 48,20 L 0, 22 Z");
}
.ac1_pt_btn::after {
content: "";
position: absolute;
top: 0;
right: -41px;
height: 100%;
width: 50px;
z-index: 2;
background-color: #e34d59;
clip-path: path("M 0,0 C 24,0 8,24 48,20 L 0, 22 Z");
}
.ac1_ms_btn::after {
content: "";
position: absolute;
top: 0;
right: -41px;
height: 100%;
width: 50px;
z-index: 2;
background-color: #ff4133;
clip-path: path("M 0,0 C 24,0 8,24 48,20 L 0, 22 Z");
}
.ac1_fenxiao_btn::after {
content: "";
position: absolute;
top: 0;
right: -41px;
height: 100%;
width: 50px;
z-index: 2;
background-color: #ff6a2f;
clip-path: path("M 0,0 C 24,0 8,24 48,20 L 0, 22 Z");
}
.activeList {
width: auto;
/* background-color: #fff; */
margin-bottom: 30px;
border-radius: 5px;
position: relative;
/* height: 166px; */
}
.pBody {
display: flex;
}
.rightLayout {
flex: 1;
margin-left: 10px;
box-sizing: border-box;
position: relative;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.courseName {
font-weight: 600;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
width: 100%;
}
.info {
font-size: 13px;
display: flex;
justify-content: space-between;
align-items: flex-end;
/* width: 100%;
overflow: auto; */
}
.goDetail {
display: flex;
align-items: center;
margin-left: 10px;
position: absolute;
background-color: #fff;
right: 0;
}
.goDetail::after {
content: '……';
position: absolute;
background-color: #fff;
width: 50%;
left: -50%;
}
.goDetail .ckxq {
color: #fe3e6d !important;
}
.courseT {
flex: 1;
width: 100px;
display: -webkit-box;
-webkit-line-clamp: 2;
overflow: hidden;
text-overflow: ellipsis;
-webkit-box-orient: vertical;
word-break: break-all;
}
.leftLayout {
/* padding: 5px; */
/* background-color: #f6f6f6; */
border-radius: 5px;
overflow: hidden;
height: 120px;
position: relative;
}
.leftLayout image {
height: 120px;
width: 160px;
display: block;
/* background-size: auto; */
}
.margin-16 {}
.zdy .t-tag {
padding: 0 20px 0 5px !important;
text-align: left !important;
background: rgb(254, 3, 63);
background: linear-gradient(90deg, rgba(254, 3, 63, 1) 0%, rgba(254, 82, 41, 1) 100%);
color: #fff;
-webkit-clip-path: polygon(0 0, 92% 0, 77% 100%, 0% 100%);
clip-path: polygon(0 0, 92% 0, 77% 100%, 0% 100%);
border-radius: 5px;
position: relative;
z-index: 1;
}
.t-tag__text,
.t-icon {
color: #fff;
}
.goPay {
display: block;
width: auto;
text-align: center;
color: #fff;
line-height: 42px;
height: 42px;
border-radius: 21px;
background: rgb(254, 3, 63);
background: linear-gradient(90deg, rgba(254, 3, 63, 1) 0%, rgba(254, 82, 41, 1) 100%);
margin-top: 15px;
}
.payMustValue {
color: #fe123c;
font-size: 24px;
font-weight: bold;
}
.originalPrice {
color: #999999;
text-decoration: line-through;
line-height: 40px;
margin-left: 5px;
font-size: 14px;
}
.payMustValuetext {
font-weight: normal;
font-size: 12px;
line-height: 40px;
color: #fe123c;
}
.priceShow {
display: flex;
/* justify-content: space-between; */
/* padding-right: 10px; */
}
.divider .t-divider--horizontal {
border-color: rgb(245, 240, 240);
}
.butie {
background-color: #f6d288;
height: 120%;
width: 30%;
-webkit-clip-path: polygon(26% 0, 92% 0, 80% 50%, 96% 50%, 20% 100%, 20% 54%, 0 54%);
clip-path: polygon(26% 0, 92% 0, 80% 50%, 96% 50%, 20% 100%, 20% 54%, 0 54%);
position: absolute;
bottom: 0;
right: 30%;
transform: translateX(36%);
color: #6f451b;
font-size: 11px;
text-align: center;
box-sizing: border-box;
}
.qiang {
width: 45%;
background-color: #cb4637;
border-radius: 0 5px 5px 0;
font-size: 30px;
color: #fff;
text-align: right;
padding-right: 10px;
box-sizing: border-box;
line-height: normal;
font-style: italic;
}
.ec_teamRoute_time {
text-align: center;
color: #FD5028;
font-size: 12px;
}
.ec_teamRoute_time2 {
text-align: center;
color: #FD5028;
font-size: 12px;
}
.t-tag {
height: 40rpx !important;
line-height: 36rpx !important;
padding: 1px 18rpx 1px 20rpx !important;
font-size: 20rpx !important;
}
.steps_color {
color: #FF123C !important;
font-size: 12px !important;
}
.stepC {
width: 80px;
height: 46px;
background: radial-gradient(circle, rgba(254, 241, 128, 1) 0%, rgba(254, 228, 66, 1) 100%);
border-radius: 15px;
line-height: 20px;
padding: 3px;
box-sizing: border-box;
color: #fe0a41;
}
.t-steps-item__icon-number {
width: 14px !important;
height: 14px !important;
background-color: #CCC !important;
}
.t-step--horizontal .t-steps-item--finish .t-steps-item__icon-number {
border-color: #fff !important;
color: #fff !important;
}
.t-icon {
font-size: 0px !important;
}
.t-steps-item--finish .t-steps-item__icon-number {
border-color: #CCC;
color: #CCC;
}
.t-step--horizontal.t-step--not-last-child .t-steps-item__inner:after {
content: '';
display: block;
height: 1px;
background: #cccccc;
position: absolute;
transform: translateY(-50%);
width: 100%;
top: 8px !important;
left: 50%;
background-color: #cccccc !important;
}
.ybm .t-tag--variant-light.t-tag--theme-default{
background-color: #07c160;
border-radius: 5px;
}