小程序开发,细节优化

This commit is contained in:
devil 2020-01-10 18:35:25 +08:00
parent 74f7e23178
commit 7c62f2ddc1
18 changed files with 437 additions and 77 deletions

View File

@ -32,6 +32,20 @@ return array (
'log_write' =>
array (
),
'plugins_service_users_center_left_menu_handle' =>
array (
0 => 'app\\plugins\\wallet\\Hook',
1 => 'app\\plugins\\membershiplevelvip\\Hook',
2 => 'app\\plugins\\coupon\\Hook',
3 => 'app\\plugins\\distribution\\Hook',
),
'plugins_service_header_navigation_top_right_handle' =>
array (
0 => 'app\\plugins\\wallet\\Hook',
1 => 'app\\plugins\\membershiplevelvip\\Hook',
2 => 'app\\plugins\\coupon\\Hook',
3 => 'app\\plugins\\distribution\\Hook',
),
'plugins_css' =>
array (
0 => 'app\\plugins\\membershiplevelvip\\Hook',
@ -95,18 +109,6 @@ return array (
array (
0 => 'app\\plugins\\membershiplevelvip\\Hook',
),
'plugins_service_users_center_left_menu_handle' =>
array (
0 => 'app\\plugins\\membershiplevelvip\\Hook',
1 => 'app\\plugins\\coupon\\Hook',
2 => 'app\\plugins\\distribution\\Hook',
),
'plugins_service_header_navigation_top_right_handle' =>
array (
0 => 'app\\plugins\\membershiplevelvip\\Hook',
1 => 'app\\plugins\\coupon\\Hook',
2 => 'app\\plugins\\distribution\\Hook',
),
'plugins_js' =>
array (
0 => 'app\\plugins\\coupon\\Hook',

View File

@ -331,6 +331,10 @@ class FileUtil
//这里设置客户端的弹出对话框显示的文件名
Header("Content-Disposition: attachment; filename=".$show_name);
// 清除前面输出的内容
ob_clean();
flush();
//一次性将数据传输给客户端
//echo fread($file, filesize($file_path));
//一次只传输1024个字节的数据给客户端

View File

@ -64,6 +64,11 @@ Page({
},
});
} else {
self.setData({
avatar: user.avatar || app.data.default_user_head_src,
nickname: user.user_name_view || '用户名',
});
self.get_data();
}
}
@ -106,7 +111,7 @@ Page({
user_order_status_list: temp_user_order_status_list,
customer_service_tel: data.customer_service_tel || null,
common_user_center_notice: data.common_user_center_notice || null,
avatar: (data.avatar != null) ? data.avatar : ((this.data.avatar || null) == null ? app.data.default_user_head_src : this.data.avatar),
avatar: ((data.avatar || null) != null) ? data.avatar : ((this.data.avatar || null) == null ? app.data.default_user_head_src : this.data.avatar),
nickname: (data.nickname != null) ? data.nickname : this.data.nickname,
message_total: ((data.common_message_total || 0) == 0) ? 0 : data.common_message_total,
head_nav_list: temp_head_nav_list,

View File

@ -62,6 +62,11 @@ Page({
},
});
} else {
self.setData({
avatar: user.avatar || app.data.default_user_head_src,
nickname: user.user_name_view || '用户名',
});
self.get_data();
}
}
@ -104,7 +109,7 @@ Page({
user_order_status_list: temp_user_order_status_list,
customer_service_tel: data.customer_service_tel || null,
common_user_center_notice: data.common_user_center_notice || null,
avatar: data.avatar != null ? data.avatar : (this.data.avatar || null) == null ? app.data.default_user_head_src : this.data.avatar,
avatar: (data.avatar || null) != null ? data.avatar : (this.data.avatar || null) == null ? app.data.default_user_head_src : this.data.avatar,
nickname: data.nickname != null ? data.nickname : this.data.nickname,
message_total: (data.common_message_total || 0) == 0 ? 0 : data.common_message_total,
head_nav_list: temp_head_nav_list,

View File

@ -57,6 +57,11 @@ Page({
},
});
} else {
self.setData({
avatar: user.avatar || app.data.default_user_head_src,
nickname: user.user_name_view || '用户名',
});
self.get_data();
}
}
@ -99,7 +104,7 @@ Page({
user_order_status_list: temp_user_order_status_list,
customer_service_tel: data.customer_service_tel || null,
common_user_center_notice: data.common_user_center_notice || null,
avatar: (data.avatar != null) ? data.avatar : ((this.data.avatar || null) == null ? app.data.default_user_head_src : this.data.avatar),
avatar: ((data.avatar || null) != null) ? data.avatar : ((this.data.avatar || null) == null ? app.data.default_user_head_src : this.data.avatar),
nickname: (data.nickname != null) ? data.nickname : this.data.nickname,
message_total: ((data.common_message_total || 0) == 0) ? 0 : data.common_message_total,
head_nav_list: temp_head_nav_list,

View File

@ -56,6 +56,11 @@ Page({
},
});
} else {
self.setData({
avatar: user.avatar || app.data.default_user_head_src,
nickname: user.user_name_view || '用户名',
});
self.get_data();
}
}
@ -98,7 +103,7 @@ Page({
user_order_status_list: temp_user_order_status_list,
customer_service_tel: data.customer_service_tel || null,
common_user_center_notice: data.common_user_center_notice || null,
avatar: (data.avatar != null) ? data.avatar : ((this.data.avatar || null) == null ? app.data.default_user_head_src : this.data.avatar),
avatar: ((data.avatar || null) != null) ? data.avatar : ((this.data.avatar || null) == null ? app.data.default_user_head_src : this.data.avatar),
nickname: (data.nickname != null) ? data.nickname : this.data.nickname,
message_total: ((data.common_message_total || 0) == 0) ? 0 : data.common_message_total,
head_nav_list: temp_head_nav_list,

View File

@ -37,7 +37,8 @@
"pages/plugins/membershiplevelvip/shouyi-detail/shouyi-detail",
"pages/plugins/membershiplevelvip/shouyi/shouyi",
"pages/plugins/membershiplevelvip/tongji/tongji",
"pages/plugins/membershiplevelvip/tuiguang/tuiguang"
"pages/plugins/membershiplevelvip/tuiguang/tuiguang",
"pages/plugins/membershiplevelvip/tuandui/tuandui"
],
"window": {
"navigationBarTitleText": "{{application_title}}",

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@ -118,6 +118,7 @@ Page({
// 请求生成支付订单
var self = this;
self.setData({ submit_disabled_status: true });
wx.showLoading({ title: "处理中..." });
wx.request({
url: app.get_request_url("create", "buy", "membershiplevelvip"),

View File

@ -0,0 +1,147 @@
const app = getApp();
Page({
data: {
data_list: [],
data_page_total: 0,
data_page: 1,
data_list_loding_status: 1,
data_bottom_line_status: false,
params: null,
},
onLoad(params) {
this.setData({
params: params,
});
this.init();
},
onShow() { },
init() {
var user = app.get_user_info(this, 'init');
if (user != false) {
// 用户未绑定用户则转到登录页面
if (app.user_is_need_login(user)) {
wx.redirectTo({
url: "/pages/login/login?event_callback=init"
});
return false;
} else {
// 获取数据
this.get_data_list();
}
} else {
this.setData({
data_list_loding_status: 0,
data_bottom_line_status: false,
});
}
},
// 获取数据
get_data_list(is_mandatory) {
// 分页是否还有数据
if ((is_mandatory || 0) == 0) {
if (this.data.data_bottom_line_status == true) {
return false;
}
}
// 加载loding
wx.showLoading({ title: "加载中..." });
this.setData({
data_list_loding_status: 1
});
// 获取数据
wx.request({
url: app.get_request_url("index", "team", "membershiplevelvip"),
method: "POST",
data: {
page: this.data.data_page,
},
dataType: "json",
success: res => {
wx.hideLoading();
wx.stopPullDownRefresh();
if (res.data.code == 0) {
if (res.data.data.data.length > 0) {
if (this.data.data_page <= 1) {
var temp_data_list = res.data.data.data;
} else {
var temp_data_list = this.data.data_list;
var temp_data = res.data.data.data;
for (var i in temp_data) {
temp_data_list.push(temp_data[i]);
}
}
this.setData({
data_list: temp_data_list,
data_total: res.data.data.total,
data_page_total: res.data.data.page_total,
data_list_loding_status: 3,
data_page: this.data.data_page + 1,
});
// 是否还有数据
if (this.data.data_page > 1 && this.data.data_page > this.data.data_page_total) {
this.setData({ data_bottom_line_status: true });
} else {
this.setData({ data_bottom_line_status: false });
}
} else {
this.setData({
data_list_loding_status: 0,
data_list: [],
data_bottom_line_status: false,
});
}
} else {
this.setData({
data_list_loding_status: 0,
});
if (app.is_login_check(res.data, this, 'get_data_list')) {
app.showToast(res.data.msg);
}
}
},
fail: () => {
wx.hideLoading();
wx.stopPullDownRefresh();
this.setData({
data_list_loding_status: 2,
});
app.showToast("服务器请求出错");
}
});
},
// 下拉刷新
onPullDownRefresh() {
this.setData({
data_page: 1
});
this.get_data_list(1);
},
// 滚动加载
scroll_lower(e) {
this.get_data_list();
},
// 头像查看
avatar_event(e) {
var value = e.currentTarget.dataset.value || null;
if (value != null)
{
wx.previewImage({
current: value,
urls: [value]
});
} else {
app.showToast('头像地址有误');
}
},
});

View File

@ -0,0 +1,5 @@
{
"enablePullDownRefresh": true,
"navigationBarBackgroundColor": "#1d1611",
"navigationBarTitleText": "我的团队"
}

View File

@ -0,0 +1,40 @@
<scroll-view scroll-y="{{true}}" class="scroll-box" bindscrolltolower="scroll_lower" lower-threshold="30">
<view class="data-list">
<view class="item bg-white spacing-mb" wx:if="{{data_list.length > 0}}" wx:for="{{data_list}}" wx:key="key">
<view class="base oh br-b">
<image src="{{item.avatar}}" class="avatar dis-block fl" mode="widthFix" bindtap="avatar_event" data-value="{{item.avatar}}" />
<text class="fr nickname cr-888">{{item.user_name_view || ''}}</text>
</view>
<view class="content">
<view class="multi-text">
<text class="title cr-666">消费金额</text>
<text class="value">{{item.order_total}}</text>
<text class="unit cr-888">元</text>
</view>
<view class="multi-text">
<text class="title cr-666">下级消费</text>
<text class="value">{{item.find_order_total}}</text>
<text class="unit cr-888">元</text>
</view>
<view class="multi-text">
<text class="title cr-666">下级用户</text>
<text class="value">{{item.referrer_count}}</text>
<text class="unit cr-888">人</text>
</view>
<view class="multi-text">
<text class="title cr-666">加入时间</text>
<text class="value">{{item.add_time_time}}</text>
</view>
</view>
</view>
<view wx:if="{{data_list.length == 0}}">
<import src="/pages/common/nodata.wxml" />
<template is="nodata" data="{{status: data_list_loding_status}}">
</template>
</view>
<import src="/pages/common/bottom_line.wxml" />
<template is="bottom_line" data="{{status: data_bottom_line_status}}"></template>
</view>
</scroll-view>

View File

@ -0,0 +1,29 @@
.scroll-box {
height: 100vh;
}
.data-list .item .base {
padding: 15rpx 10rpx;
}
.data-list .item .base .avatar {
width: 60rpx;
height: 60rpx;
border-radius: 50%;
}
.data-list .item .base .nickname {
margin-top: 10rpx;
}
.data-list .item .content {
padding: 20rpx 10rpx;
}
.data-list .item .content .multi-text {
line-height: 50rpx;
}
.data-list .item .content .multi-text .title {
margin-right: 30rpx;
}
.data-list .item .content .multi-text .value {
font-weight: 500;
}
.data-list .item .content .multi-text .unit {
margin-left: 10rpx;
}

View File

@ -8,30 +8,10 @@ Page({
user_vip: null,
avatar: app.data.default_user_head_src,
nickname: "用户名",
submit_disabled_status: false,
// 导航
nav_list: [
{
icon: "/images/plugins/membershiplevelvip/user-center-order-icon.png",
title: "开通订单",
url: "/pages/plugins/membershiplevelvip/order/order",
},
{
icon: "/images/plugins/membershiplevelvip/user-center-tuiguang-icon.png",
title: "推广返利",
url: "/pages/plugins/membershiplevelvip/tuiguang/tuiguang",
},
{
icon: "/images/plugins/membershiplevelvip/user-center-shouyi-icon.png",
title: "收益明细",
url: "/pages/plugins/membershiplevelvip/shouyi/shouyi",
},
{
icon: "/images/plugins/membershiplevelvip/user-center-tongji-icon.png",
title: "数据统计",
url: "/pages/plugins/membershiplevelvip/tongji/tongji",
}
],
nav_list: [],
},
onLoad(params) {
@ -65,6 +45,11 @@ Page({
},
});
} else {
self.setData({
avatar: user.avatar || app.data.default_user_head_src,
nickname: user.user_name_view || '用户名',
});
self.get_data();
}
}
@ -83,13 +68,67 @@ Page({
wx.stopPullDownRefresh();
if (res.data.code == 0) {
var data = res.data.data;
var data_base = data.base || null;
var user_vip = data.user_vip || null;
self.setData({
data_base: data.base || null,
user_vip: data.user_vip || null,
data_base: data_base,
user_vip: user_vip,
avatar: (user_vip != null && (user_vip.icon || null) == null) ? self.data.avatar : user_vip.icon,
data_list_loding_msg: '',
data_list_loding_status: 0,
data_bottom_line_status: false,
});
// 导航处理
var nav_list = [];
if (data_base != null)
{
// 开启会员购买
if ((data_base.is_user_buy || 0) == 1)
{
nav_list.push({
icon: "/images/plugins/membershiplevelvip/user-center-order-icon.png",
title: "开通订单",
url: "/pages/plugins/membershiplevelvip/order/order",
});
// 开启返佣
if ((data_base.is_commission || 0) == 1)
{
nav_list.push({
icon: "/images/plugins/membershiplevelvip/user-center-shouyi-icon.png",
title: "收益明细",
url: "/pages/plugins/membershiplevelvip/shouyi/shouyi",
});
}
// 开启推广
if ((data_base.is_propaganda || 0) == 1) {
nav_list.push({
icon: "/images/plugins/membershiplevelvip/user-center-tuandui-icon.png",
title: "我的团队",
url: "/pages/plugins/membershiplevelvip/tuandui/tuandui",
});
nav_list.push({
icon: "/images/plugins/membershiplevelvip/user-center-tuiguang-icon.png",
title: "推广返利",
url: "/pages/plugins/membershiplevelvip/tuiguang/tuiguang",
});
nav_list.push({
icon: "/images/plugins/membershiplevelvip/user-center-tongji-icon.png",
title: "数据统计",
url: "/pages/plugins/membershiplevelvip/tongji/tongji",
});
}
nav_list.push({
icon: "/images/plugins/membershiplevelvip/user-center-shouye-icon.png",
title: "会员首页",
url: "/pages/plugins/membershiplevelvip/index/index",
});
}
}
self.setData({ nav_list: nav_list });
} else {
self.setData({
data_bottom_line_status: false,
@ -134,4 +173,48 @@ Page({
this.setData({ avatar: app.data.default_user_head_src });
},
// 连续开通会员事件
uservip_renew_event(e) {
var self = this;
wx.showModal({
title: '温馨提示',
content: '按照原时长和费用续费,确定继续吗?',
confirmText: '确认',
cancelText: '暂不',
success: (result) => {
if (result.confirm) {
// 请求生成支付订单
self.setData({ submit_disabled_status: true });
wx.showLoading({ title: "处理中..." });
wx.request({
url: app.get_request_url("renew", "buy", "membershiplevelvip"),
method: "POST",
data: {},
dataType: "json",
header: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
wx.hideLoading();
self.setData({ submit_disabled_status: false });
if (res.data.code == 0) {
// 进入以后会员中心并发起支付
wx.redirectTo({
url: '/pages/plugins/membershiplevelvip/order/order?is_pay=1&order_id=' + res.data.data.id,
});
} else {
if (app.is_login_check(res.data, self, 'uservip_renew_event')) {
app.showToast(res.data.msg);
}
}
},
fail: () => {
self.setData({ submit_disabled_status: false });
wx.hideLoading();
app.showToast("服务器请求出错");
}
});
}
},
});
},
});

View File

@ -5,15 +5,17 @@
<text class="item-name dis-block cr-888">{{nickname}}</text>
</view>
<view class="head-base fl">
<view class="single-text level-name">VIP1</view>
<block wx:if="{{(user_vip || null) != null}}">
<block wx:if="{{(user_vip.user_vip_model || null) == 'pay'}}">
<view class="single-text level-name">{{user_vip.level_name}}</view>
<view class="single-text">
<block wx:if="{{user_vip.is_permanent == 1}}">
<block wx:if="{{(user_vip.is_permanent || 0) == 1}}">
<text class="title">有效期</text>
<text class="value cr-fff">{{user_vip.permanent_value}}</text>
<text class="unit">{{user_vip.permanent_unit}}</text>
</block>
<block wx:else>
<block wx:if="{{user_vip.surplus_time_number == 0}}">
<block wx:if="{{(user_vip.surplus_time_number || 0) == 0}}">
<view class="cr-888">会员已过期或未开通</view>
<navigator url="/pages/plugins/membershiplevelvip/buy/buy" hover-class="none">
<button wx:if="{{(data_base.is_user_buy || null) == 1}}" size="mini" type="default" hover-class="none" class="submit-buy">开通会员</button>
@ -26,9 +28,10 @@
<block wx:if="{{(user_vip.is_supported_renew || null) == null || user_vip.is_supported_renew != 1}}">
<block wx:if="{{(plugins_base.is_supported_renew_old_order || null) == 1}}">
<button size="mini" type="default" hover-class="none" class="renew-buy">续费会员</button>
<button size="mini" type="default" hover-class="none" class="renew-buy" bindtap="uservip_renew_event" disabled="{{submit_disabled_status}}">续费会员</button>
</block>
<block wx:else>
<block wx:if="{{(data_base || null) != null && (data_base.is_user_buy || 0) == 1}}">
<navigator url="/pages/plugins/membershiplevelvip/buy/buy" hover-class="none">
<button size="mini" type="default" hover-class="none" class="submit-buy">连续开通</button>
</navigator>
@ -36,12 +39,27 @@
</block>
</block>
</block>
</block>
</view>
</block>
<block wx:else>
<view class="single-text level-name spacing-mt">{{user_vip.level_name}}</view>
</block>
</block>
<block wx:else>
<block wx:if="{{(user_vip.user_vip_model || null) == 'pay'}}">
<block wx:if="{{(data_base || null) != null && (data_base.is_user_buy || 0) == 1}}">
<navigator url="/pages/plugins/membershiplevelvip/buy/buy" hover-class="none">
<button size="mini" type="default" hover-class="none" class="submit-buy">开通会员</button>
</navigator>
</block>
</block>
</block>
</view>
</view>
<!-- 导航 -->
<view class="nav spacing-mt oh bg-white">
<view wx:if="{{nav_list.length > 0 && data_base != null && (data_base.is_user_buy || 0) == 1}}" class="nav spacing-mt oh bg-white">
<block wx:for="{{nav_list}}" wx:key="key">
<navigator url="{{item.url}}" hover-class="none">
<view class="item fl tc">
@ -55,13 +73,17 @@
<!-- 通知 -->
<view class="tips-container spacing-mb">
<!-- 未开通会员介绍 -->
<view wx:if="{{(user_vip || null) == null && (data_base.not_opening_vip_desc || null) != null && data_base.not_opening_vip_desc.length > 0}}" class="tips-item spacing-mt">
<block wx:if="{{(data_base.is_user_buy || 0) == 1}}">
<block wx:if="{{((user_vip || null) == null) || ((user_vip || null) == null && (user_vip.surplus_time_number || 0) == 0)}}">
<view wx:if="{{(data_base.not_opening_vip_desc || null) != null && data_base.not_opening_vip_desc.length > 0}}" class="tips-item spacing-mt">
<view class="not-opening-vip-desc">
<view wx:for="{{data_base.not_opening_vip_desc}}" wx:key="key" class="item">
{{item}}
</view>
</view>
</view>
</block>
</block>
<!-- 会员中心通知 -->
<view wx:if="{{(data_base.user_vip_center_notice || null) != null && data_base.user_vip_center_notice.length > 0}}" class="tips-item spacing-mt">

View File

@ -11,8 +11,9 @@
padding-bottom: 30rpx;
}
.head-item .avatar {
width: 160rpx;
height: 160rpx;
width: 140rpx;
height: 140rpx;
padding: 20rpx;
border-radius: 50%;
border: 1px solid #3d3c3c;
}

View File

@ -57,6 +57,11 @@ Page({
},
});
} else {
self.setData({
avatar: user.avatar || app.data.default_user_head_src,
nickname: user.user_name_view || '用户名',
});
self.get_data();
}
}
@ -99,7 +104,7 @@ Page({
user_order_status_list: temp_user_order_status_list,
customer_service_tel: data.customer_service_tel || null,
common_user_center_notice: data.common_user_center_notice || null,
avatar: (data.avatar != null) ? data.avatar : ((this.data.avatar || null) == null ? app.data.default_user_head_src : this.data.avatar),
avatar: ((data.avatar || null) != null) ? data.avatar : ((this.data.avatar || null) == null ? app.data.default_user_head_src : this.data.avatar),
nickname: (data.nickname != null) ? data.nickname : this.data.nickname,
message_total: ((data.common_message_total || 0) == 0) ? 0 : data.common_message_total,
head_nav_list: temp_head_nav_list,