[水感应客户端最新]

This commit is contained in:
2023-06-21 17:14:39 +08:00
commit b3b4d4dae7
187 changed files with 12997 additions and 0 deletions

28
pages/user/about/about.js Normal file
View File

@@ -0,0 +1,28 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
Page({
/**
* 页面的初始数据
*/
data: {
barHeight : getApp().globalData.barHeight, // 状态栏高度
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
// 返回上一页
returnGo() {
wx.navigateBack({
delta: 1
})
},
})

View File

@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationStyle": "custom"
}

View File

@@ -0,0 +1,7 @@
<view class="navigation {{isFixedTop > 0 ? 'active' : ''}}" style="padding-top:{{barHeight}}px;">
<image bindtap="returnGo" class="navigation-arrow" src="{{isFixedTop > 0 ? '/static/icons/arrowBlack.png' : '/static/icons/arrowWrite.png'}}"></image>
</view>
<view class="about">
<image src="https://cdn.shuiganying.com/images/2023/05/23/6006cda58ec9ee64ef6cb557adf6cba9.jpg" mode="widthFix"></image>
</view>

View File

@@ -0,0 +1,30 @@
/* 返回上一页 */
.navigation{
position: fixed;
top: 0;
left: 0;
z-index: 99;
width: 100%;
height: 90rpx;
background-color: transparent;
transition: .2s;
}
.navigation.active {
background-color: transparent;
}
.navigation-arrow {
width: 44rpx;
height: 44rpx;
margin: 20rpx 15rpx 0 20rpx;
}
.about {
width: 100%;
}
image {
width: 100%;
display: block;
}

185
pages/user/code/code.js Normal file
View File

@@ -0,0 +1,185 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
Page({
/**
* 页面的初始数据
*/
data: {
barHeight : getApp().globalData.barHeight, // 状态栏高度
shareSee : false, //分享弹出
inviteText : '', //邀请码
inviteCode : '', //二维码
//海报
canvas : ''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
// 初始化画布
wx.createSelectorQuery().select('#coverCanvas').fields({node: true, size: true}).exec(canvasNode => {
const canvas = canvasNode[0].node
canvas.width = 375
canvas.height = 800
this.setData({
canvas
})
})
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 获取信息
this.inviteInfo();
// 小程序码
this.ShareInfo();
},
/**
* 获取信息
*/
inviteInfo() {
wx.$api.user.invitesCode().then(res => {
this.setData({
inviteText : res.data.invite
})
}).catch(err => {})
},
/**
* 小程序码
*/
ShareInfo() {
wx.$api.user.miniShare({
url: '/pages/index/index'
}).then(res => {
this.setData({
inviteCode: res.data.qrcode
})
}).catch(err => {})
},
/**
* 生成海报
*/
onCanvas(){
wx.showLoading({
title: '生成图片中...',
mask : true
})
const canvas = this.data.canvas
const ctx = canvas.getContext('2d')
const codeImgEl = canvas.createImage()
const backBackEl = canvas.createImage()
codeImgEl.src = this.data.inviteCode //二维码
backBackEl.src = 'https://cdn.shuiganying.com/images/2023/03/31/30a1fde15c33efce2c182ef5fb7073fd.jpg' //背景素材
const codeImgLoding = new Promise((resolve, reason) => {
codeImgEl.onload = () => {
resolve()
}
})
const backBackLoding = new Promise((resolve, reason) => {
backBackEl.onload = () => {
resolve()
}
})
Promise.all([codeImgLoding, backBackLoding]).then(() => {
ctx.drawImage(backBackEl, 0, 0, 375, 800)
// 绘制[二维码-白色背景]
ctx.fillStyle = "#ffffff";
ctx.fillRect(30, 400, 130, 130);
// 绘制[二维码-白色背景黑框]
ctx.strokeStyle = "#0e2c58";
ctx.lineWidth = 2
ctx.strokeRect(29, 399, 132, 132);
// 绘制[二维码]
ctx.drawImage(codeImgEl, 40, 410, 110, 110)
// 文字
ctx.font = "bold 14px Arial"; //字体大小
ctx.fillStyle = "#0e2c58"; //字体颜色
ctx.textAlign = "center"
ctx.fillText('扫描二维码了解更多', 96, 560);
wx.hideLoading()
wx.canvasToTempFilePath({
canvas: this.data.canvas,
success : res => {
wx.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success: saveRes => {
wx.showToast({
title: '海报已保存至您的相册',
icon : 'none'
})
this.setData({
shareSee: false
})
},
fail: () => {
wx.hideLoading()
wx.showModal({
title: '提示',
content: '暂未授权小程序写入您的相册,无法存储海报',
confirmColor: '#e50d01',
confirmText: '去设置',
success: res => {
if (res.confirm) {
wx.openSetting()
}
}
})
}
})
},
})
}).catch(err => {
wx.showToast({
title: '图片加载失败',
icon : 'none'
})
})
},
/**
* 分享弹出
*/
shareTap() {
this.setData({
shareSee: !this.data.shareSee
})
},
// 返回上一页
returnGo() {
wx.navigateBack({
delta: 1
})
},
/**
* 微信分享
*/
onShareAppMessage(){
this.setData({
shareSee: false
})
return {
title : '水感应修复、紧致、舒缓喷雾',
path : "/pages/index/index?invite=" + wx.getStorageSync("invite"),
imageUrl: "https://cdn.shuiganying.com/images/2023/04/04/9cd9968136e7efd85028fba69e4c587a.jpg"
}
}
})

View File

@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationStyle": "custom"
}

35
pages/user/code/code.wxml Normal file
View File

@@ -0,0 +1,35 @@
<view class="navigation {{isFixedTop > 0 ? 'active' : ''}}" style="padding-top:{{barHeight}}px;">
<image bindtap="returnGo" class="navigation-arrow" src="{{isFixedTop > 0 ? '/static/icons/arrowBlack.png' : '/static/icons/arrowWrite.png'}}"></image>
</view>
<view class="code">
<image src="https://cdn.shuiganying.com/images/2023/05/18/06efd96167f20daf9cd2da983274db41.png" class="code-back"></image>
<view class="code-cont">
<view class="code-img">
<image src="{{inviteCode}}" mode="widthFix"></image>
</view>
<view class="code-text"><text>扫描二维码了解更多</text></view>
</view>
<view class="code-share" bindtap="shareTap">
<image src="https://cdn.shuiganying.com/images/2023/03/28/ee2911df7a5e3f9959d5d320cd966146.png"></image>
<view class="code-share-name">分享</view>
</view>
</view>
<!-- 海报canvas -->
<canvas type="2d" style="width: 375px; height: 800px;" id="coverCanvas" class="canvas-img" />
<!-- 分享弹出 -->
<view class="sharePop {{shareSee ? 'active' : ''}}">
<view class="shareCont">
<button class="shareCont-label codeShare-button" open-type="share" hover-class="none">
<image src="https://cdn.shuiganying.com/images/2023/03/28/f8b773edc2fe6db8e45f96773b9a8dc4.png"></image>
微信好友
</button>
<view class="shareCont-label" bindtap="onCanvas">
<image src="https://cdn.shuiganying.com/images/2023/03/28/cfe0efbb53eaf7911ea5211923859c65.png"></image>
保存二维码
</view>
</view>
<view class="shareCancel" bindtap="shareTap">取消</view>
</view>

148
pages/user/code/code.wxss Normal file
View File

@@ -0,0 +1,148 @@
/* 返回上一页 */
.navigation{
position: fixed;
top: 0;
left: 0;
z-index: 99;
width: 100%;
height: 90rpx;
background-color: transparent;
transition: .2s;
}
.navigation.active {
background-color: transparent;
}
.navigation-arrow {
width: 44rpx;
height: 44rpx;
margin: 20rpx 15rpx 0 20rpx;
}
/* 二维码 */
.code {
width: 100vw;
height: 100vh;
position: relative;
}
.code-back {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
}
.code-cont {
width: 400rpx;
position: absolute;
z-index: 9;
text-align: center;
left: 0;
bottom: 30%;
}
.code-img{
margin: 0 auto 20rpx;
overflow: hidden;
width: 260rpx;
height: 260rpx;
border: 4rpx solid #144592;
background-color: #ffffff;
padding: 10rpx;
box-sizing: border-box;
}
.code-img image {
width: 100%;
}
.code-text {
color: #144592;
font-size: 28rpx;
font-weight: 600;
}
.code-share {
position: absolute;
z-index: 10;
left: 0;
bottom: 13%;
background: linear-gradient(to right, #3f7fff, #568fff);
width: 50rpx;
text-align: center;
border-radius: 0 26rpx 26rpx 0;
padding: 30rpx 15rpx 30rpx 12rpx;
box-shadow: 0 0 6rpx 6rpx rgba(0, 0, 0, .2);
}
.code-share-name {
writing-mode:vertical-rl;
font-size: 30rpx;
padding-left: 4rpx;
color: #fff;
}
.code-share image {
width: 36rpx;
height: 36rpx;
margin-bottom: 5rpx;
}
.sharePop {
position: fixed;
width: 100%;
z-index: 99;
left: 0;
bottom: 0;
background-color: #0a1930;
display: none;
}
.sharePop.active {
display: block;
}
.shareCont-label image {
width: 60rpx;
height: 60rpx;
display: block;
margin: 0 auto 10rpx;
}
.shareCancel {
border-top: 2rpx solid #0e2c58;
color: #ffffff;
width: 100%;
text-align: center;
line-height: 100rpx;
}
.shareCont{
display: flex;
padding: 30rpx 0;
}
.shareCont-label {
color: #ffffff;
flex: 2;
text-align: center;
font-size: 28rpx;
}
.codeShare-button {
background-color: transparent;
padding: 0;
font-weight: normal;
}
/* canvas */
.canvas-img {
position: fixed;
left: -10000%;
top: 0;
z-index: 99;
}

51
pages/user/help/help.js Normal file
View File

@@ -0,0 +1,51 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
Page({
data: {
helpsArr: [], //帮助列表
},
onLoad(options) {},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 获取帮助分类
this.helpsNavInfo();
},
/**
* 帮助分类
*/
helpsNavInfo() {
wx.$api.user.helpsNav().then(res => {
let listArr = this.data.helpsArr,
newData = []
for(let i of res.data){
for(let j of i.children){
j.isMore = false
}
}
newData = listArr.concat(res.data)
this.setData({
helpsArr: newData
})
}).catch(err => {})
},
/**
* 文字展开
*/
textMore(e){
let childIndex = e.currentTarget.dataset.index,
parentIndex = e.currentTarget.dataset.parent
this.setData({
[`helpsArr[${parentIndex}].children[${childIndex}].isMore`]: !this.data.helpsArr[parentIndex].children[childIndex].isMore
});
}
})

View File

@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "帮助中心"
}

114
pages/user/help/help.wxml Normal file
View File

@@ -0,0 +1,114 @@
<view class="help" wx:for="{{helpsArr}}" wx:key="helpsArr" wx:for-index="index">
<view class="help-title">{{item.title}}</view>
<view class="help-list">
<view class="help-item" wx:for="{{item.children}}" wx:for-item="items" wx:key="children" wx:for-index="childrenIndex">
<view class="help-item-name" bindtap="textMore" data-parent="{{index}}" data-index="{{childrenIndex}}">
<image class="help-item-img" src="{{items.cover}}"></image>
<view class="help-item-title">{{items.title}}</view>
<image class="help-item-arrow" src=" {{items.isMore ? '/static/icons/orderArrow_active.png' : '/static/icons/orderArrow.png'}}"></image>
</view>
<view class="help-item-text {{items.isMore ? 'active' : ''}}">
<rich-text nodes="{{items.content}}"></rich-text>
</view>
</view>
</view>
</view>
<!--
<view class="help">
<view class="help-title">水感应功效</view>
<view class="help-list">
<view class="help-item">
<view class="help-item-name">
<image class="help-item-img" src="/static/icons/toolIcon_02.png"></image>
<view class="help-item-title">水感应所含元素</view>
<image class="help-item-arrow" src="/static/icons/orderArrow.png"></image>
</view>
<view class="help-item-text {{helpShow ? 'active' : ''}}">
<text>**公认的精华元素:硒</text>
<text> **补充人体中硒的含量</text>
<text>**保湿护肤常用</text>
<text>**降低胶原蛋白损伤</text>
<text>**减少皮肤老化</text>
</view>
</view>
<view class="help-item">
<view class="help-item-name">
<image class="help-item-img" src="/static/icons/toolIcon_02.png"></image>
<view class="help-item-title">水感应水源</view>
<image class="help-item-arrow" src="/static/icons/orderArrow.png"></image>
</view>
<view class="help-item-text {{helpShow ? 'active' : ''}}">
<text>可以直接饮用的补水喷雾</text>
<text>理疗矿泉级</text>
<text>4300年自然净化水源</text>
</view>
</view>
<view class="help-item">
<view class="help-item-name">
<image class="help-item-img" src="/static/icons/toolIcon_02.png"></image>
<view class="help-item-title">水感应安全感</view>
<image class="help-item-arrow" src="/static/icons/orderArrow.png"></image>
</view>
<view class="help-item-text {{helpShow ? 'active' : ''}}">
<text>敏感肌的安全感</text>
<text>喷一下就拥有</text>
</view>
</view>
<view class="help-item">
<view class="help-item-name">
<image class="help-item-img" src="/static/icons/toolIcon_02.png"></image>
<view class="help-item-title">水感应补水</view>
<image class="help-item-arrow" src="/static/icons/orderArrow.png"></image>
</view>
<view class="help-item-text {{helpShow ? 'active' : ''}}">
<text>为什么补水越补越干</text>
<text>原因1、肌肤屏障受损需要修复</text>
<text>原因2、产品水分子过大效果差</text>
</view>
</view>
</view>
</view>
<view class="help">
<view class="help-title">过敏原因</view>
<view class="help-list">
<view class="help-item">
<view class="help-item-name">
<image class="help-item-img" src="/static/icons/toolIcon_02.png"></image>
<view class="help-item-title">肌肤严重缺水</view>
<image class="help-item-arrow" src="/static/icons/orderArrow.png"></image>
</view>
<view class="help-item-text {{helpShow ? 'active' : ''}}">
<text>发现了吧,过敏的时候总是觉得好痒!</text>
<text> 因为干燥和痒,这两者总是不离不弃。</text>
<text> 肌肤觉得痒,那就是在提醒你:</text>
<text> “我好渴,给补补水吧!”</text>
<text> 在这个容易缺水和过敏的季节,</text>
<text> 不管在家还是外出,</text>
<text> 拿出“水感应舒缓抗皱喷雾”喷一喷。</text>
<text> 这可是预防过敏的秘密武器哦,</text>
<text> 更适合外出携带随时使用呢!</text>
</view>
</view>
<view class="help-item">
<view class="help-item-name">
<image class="help-item-img" src="/static/icons/toolIcon_02.png"></image>
<view class="help-item-title">生活习惯不好</view>
<image class="help-item-arrow" src="/static/icons/orderArrow.png"></image>
</view>
<view class="help-item-text {{helpShow ? 'active' : ''}}">
<text>每天出门化妆,肌肤负担较大,</text>
<text> 卸妆不彻底有残留,</text>
<text> 过度清洁又损伤肌肤保护屏障。</text>
<text> 现代人作息不规律,晚睡早起,</text>
<text> 生活习惯差,肌肤过敏是难免的啦。</text>
<text> 爱美之心,人人有之,</text>
<text> 但你不必每天顶着浓妆出门。</text>
<text> 有了“水感应修复、紧致、舒缓喷雾”,</text>
<text> 睡个懒觉再出门,或淡妆外出,</text>
<text> 完全没有任何问题,</text>
<text> 美出新境界</text>
</view>
</view>
</view>
</view> -->

56
pages/user/help/help.wxss Normal file
View File

@@ -0,0 +1,56 @@
page {
background-color: #f4f4f6;
}
.help-title {
font-size: 34rpx;
margin-bottom: 40rpx;
}
.help {
padding: 40rpx 30rpx;
box-sizing: border-box;
background-color: #ffffff;
margin-top: 30rpx;
}
.help-item-name {
margin-bottom: 40rpx;
display: flex;
position: relative;
line-height: 44rpx;
}
.help-item:last-child .help-item-name {
margin-bottom: 0;
}
.help-item-img {
width: 40rpx;
height: 40rpx;
margin-right: 10rpx;
margin-top: 2rpx;
}
.help-item-arrow {
width: 44rpx;
height: 44rpx;
position: absolute;
right: 0;
}
.help-item-title {
width: calc(100% - 94rpx);
}
.help-item-text {
display: none;
}
.help-item-text.active {
display: block;
margin-top: 30rpx;
line-height: 48rpx;
color: #747474;
font-size: 28rpx;
}

140
pages/user/index.js Normal file
View File

@@ -0,0 +1,140 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
Page({
data: {
userLogin : false,
userData : '', //用户信息
ordersData : '', //订单数据
// Progress : '', //商品数
parentStatus: false //推荐人弹出
},
onLoad(options) {},
onShow() {
// 获取登录状态
if(wx.getStorageSync("token") != ''){
this.setData({
userLogin: true
})
// 获取用户信息
this.userInfo();
return
}
this.setData({
userLogin: false
})
},
/**
* 用户信息
*/
userInfo() {
wx.$api.user.userIndex().then(res => {
this.setData({
userData : res.data,
ordersData: res.data.count.orders,
Progress : res.data.count.progress
})
if(res.data.invite != '') {
wx.setStorage({
key : 'invite',
data : res.data.invite
})
}
}).catch(err => {})
},
/**
* 处理未登录时的转跳
*/
userNav(e){
let pageUrl = e.currentTarget.dataset.url
if(wx.getStorageSync("token") != ''){
wx.navigateTo({
url: pageUrl
})
}else{
// 去登录
wx.navigateTo({
url: "/pages/login/index"
})
}
},
/**
* 复制订单号
*/
copyUrl(val) {
wx.setClipboardData({
data: val.currentTarget.dataset.no,
success: () => {
wx.showToast({
title: "邀请码复制成功",
icon : "none"
})
}
})
},
/**
* 我的客服
*/
callCenter() {
wx.openCustomerServiceChat({
extInfo: {url: 'https://work.weixin.qq.com/kfid/kfcaf0d242864812bcb'},
corpId: 'ww988d2bd112e71dd2',
success: res=> {},
fail: err=> {
console.log(err)
}
})
},
/**
* 退出登录
*/
outLogin() {
wx.showModal({
title : '提示',
content : '是否退出登录',
success : res=> {
if (res.confirm) {
getApp().globalData.inviteText = ''
// 清理客户端登录缓存
wx.removeStorageSync("token")
// 清理邀请码
wx.removeStorageSync("invite")
this.setData({
userLogin: false
})
}
}
})
},
/**
* 推荐人弹出
*/
parentTap() {
this.setData({
parentStatus: !this.data.parentStatus
})
},
/**
* 拨打电话
*/
clickcall(e){
wx.makePhoneCall({
phoneNumber: e.currentTarget.dataset.tel
})
}
})

6
pages/user/index.json Normal file
View File

@@ -0,0 +1,6 @@
{
"usingComponents": {},
"navigationBarBackgroundColor": "#5283ea",
"navigationBarTextStyle": "white",
"navigationBarTitleText": "我的"
}

182
pages/user/index.wxml Normal file
View File

@@ -0,0 +1,182 @@
<!-- 头部 -->
<view class="userTop {{userLogin ? '' : 'active'}}" wx:if="{{userLogin}}">
<!-- <image class="userTop-back" src="https://cdn.shuiganying.com/images/2023/04/04/f7b8292135e06241fa2ccad8633200d4.png" mode="aspectFill"></image> -->
<navigator class="userTop-url" hover-class="none" url="./setup/setup">
<view class="userTop-cont">
<view class="userTop-head">
<image src="{{userData.avatar ? userData.avatar: '/static/imgs/userHead.png'}}" mode="aspectFill"></image>
<view class="userTop-head-vip" wx:if="{{userData.identity.id == 2}}">{{userData.identity.name}}</view>
</view>
<view class="userTop-name">
{{userData.nickname}}<image class="userTop-name-vip" mode="widthFix" wx:if="{{userData.identity.id > 2}}" src="{{userData.identityShow.right.cover}}"></image>
</view>
</view>
</navigator>
<view class="bar">
<view class="barCont">
<block wx:if="{{userData.identity.id <= 2}}">
<view class="barTips">
<view class="barTips-name">购买产品<text>{{Progress.now}}</text>瓶</view>
<view class="barTips-text">累计购买{{Progress.total}}瓶可成为创客</view>
</view>
<view class="barBack"><text style="width: {{Progress.progress + '%'}};"></text></view>
</block>
<block wx:else>
<view class="barTips barTips-center">
<view class="barTips-name">{{Progress.text}}</view>
</view>
</block>
</view>
<view class="barBtn active" wx:if="{{userData.identity.id <= 2}}">努力中</view>
<navigator wx:else class="barBtn barBtn-active" hover-class="none" target="miniProgram" app-id="wx256d29149b783fad" path="pages/index/index" version="release">
经销商通道
</navigator>
</view>
</view>
<!-- active -->
<navigator hover-class="none" url="/pages/login/index" class="userTop active" wx:else>
<image class="userTop-back" src="https://cdn.shuiganying.com/images/2023/04/04/f7b8292135e06241fa2ccad8633200d4.png" mode="widthFix"></image>
<view class="userTop-cont">
<image class="userTop-head" src="/static/imgs/userHead.png"></image>
<view class="userTop-name">登录 / 注册</view>
</view>
</navigator>
<!-- 主内容 -->
<view class="userCont {{userLogin ? '' : 'active'}}">
<!-- 订单 -->
<view class="userOrder">
<view class="userOrder-cont">
<view class="userOrder-title">
<view class="userOrder-title-name">我的订单</view>
<view hover-class="none" bindtap="userNav" data-url="/pages/order/index?list_type=" class="userOrder-title-more">全部<image class="userOrder-title-arrow" src="/static/icons/orderArrow.png" mode="widthFix"></image>
</view>
</view>
<view class="userOrder-list">
<view class="userOrder-item" bindtap="userNav" data-url="/pages/order/index?list_type=unpay">
<image class="userOrder-item-icon" src="https://cdn.shuiganying.com/images/2023/04/04/c4699c1348369a7a2e6ff0a76adf00e5.png" mode="widthFix"></image>
<view class="userOrder-item-name">待付款</view>
<block wx:if="{{userLogin}}">
<view class="userOrder-item-number" wx:if="{{ordersData.init > 0}}">{{ordersData.init}}</view>
</block>
</view>
<view class="userOrder-item" bindtap="userNav" data-url="/pages/order/index?list_type=paid">
<image class="userOrder-item-icon" src="https://cdn.shuiganying.com/images/2023/04/04/3951244643921a98d3ae4bd35576041a.png" mode="widthFix"></image>
<view class="userOrder-item-name">待发货</view>
<block wx:if="{{userLogin}}">
<view class="userOrder-item-number" wx:if="{{ordersData.paid > 0}}">{{ordersData.paid}}</view>
</block>
</view>
<view class="userOrder-item" bindtap="userNav" data-url="/pages/order/index?list_type=delivered">
<image class="userOrder-item-icon" src="https://cdn.shuiganying.com/images/2023/04/04/49397fe2e8df547425d97f83f35da099.png" mode="widthFix"></image>
<view class="userOrder-item-name">待收货</view>
<block wx:if="{{userLogin}}">
<view class="userOrder-item-number" wx:if="{{ordersData.delivered > 0}}">{{ordersData.delivered}}</view>
</block>
</view>
<view class="userOrder-item" bindtap="userNav" data-url="/pages/order/index?list_type=signed">
<image class="userOrder-item-icon" src="https://cdn.shuiganying.com/images/2023/04/04/cf133394e075d4acafc2426cc777dbaf.png" mode="widthFix"></image>
<view class="userOrder-item-name">已签收</view>
</view>
</view>
</view>
</view>
<!-- 展示数据 -->
<view class="entry">
<navigator hover-class="none" url="/pages/report/index" open-type="switchTab" class="entry-item">
<image class="entry-item-img" src="https://cdn.shuiganying.com/images/2023/04/04/1cca1dbeff0f7271de5869fcb0b517e3.png"></image>
<view class="entry-item-name">报告查看</view>
</navigator>
<view class="entry-item" bindtap="userNav" data-url="/pages/health/collect/collect">
<image class="entry-item-img" src="https://cdn.shuiganying.com/images/2023/04/04/679705fa9ff30ae9619b7d4b49b63e10.png"></image>
<view class="entry-item-name">我的收藏</view>
</view>
<view class="entry-item" bindtap="userNav" data-url="/pages/health/praise/praise">
<image class="entry-item-img" src="https://cdn.shuiganying.com/images/2023/04/04/382a79a7a418ca132b7dca846420e500.png"></image>
<view class="entry-item-name">我的点赞</view>
</view>
<view class="entry-item" bindtap="userNav" data-url="/pages/mall/coupon/coupon">
<image class="entry-item-img" src="https://cdn.shuiganying.com/images/2023/04/04/389e7995b42fc23a1c1ebd35fa232905.png"></image>
<view class="entry-item-name">兑换券</view>
</view>
<view class="entry-item" bindtap="userNav" data-url="/pages/site/index">
<image class="entry-item-img" src="https://cdn.shuiganying.com/images/2023/04/04/98126e111b421d877f14c15e4769cfcc.png"></image>
<view class="entry-item-name">地址管理</view>
</view>
<navigator hover-class="none" url="/pages/health/index" class="entry-item">
<image class="entry-item-img" src="https://cdn.shuiganying.com/images/2023/04/04/c4efd36af444df550cb866f09c54edd7.png"></image>
<view class="entry-item-name">健康知识</view>
</navigator>
<view class="entry-item" bindtap="userNav" data-url="./code/code">
<image class="entry-item-img" src="https://cdn.shuiganying.com/images/2023/04/04/88ef7b720e1713fa5be17d509845d6eb.png"></image>
<view class="entry-item-name">邀请好友</view>
</view>
<view class="entry-item" bindtap="parentTap" wx:if="{{userData.parent != null}}">
<image class="entry-item-img" src="https://cdn.shuiganying.com/images/2023/04/04/84e3bad4916135db56716d914a4dc8e4.png"></image>
<view class="entry-item-name">推荐人</view>
</view>
<!-- <navigator class="entry-item" hover-class="none" target="miniProgram" app-id="wx256d29149b783fad" path="pages/index/index" version="release">
<image class="entry-item-img" src="https://cdn.shuiganying.com/images/2023/04/04/84e3bad4916135db56716d914a4dc8e4.png"></image>
<view class="entry-item-name">申请代理</view>
</navigator> -->
</view>
<!-- 常用工具 -->
<view class="tool">
<view class="tool-title">
常用工具
</view>
<view class="tool-list">
<block wx:if="{{userData.can_share}}">
<view class="tool-item" wx:if="{{userLogin}}">
<image class="tool-item-img" src="https://cdn.shuiganying.com/images/2023/04/13/bb06808b4b3f3b71258ffab830e37973.png"></image>
<view class="tool-item-name">我的邀请码</view>
<view class="tool-item-code">
{{userData.invite}}<view class="tool-item-copy" bindtap="copyUrl" data-no="{{userData.invite}}">复制</view>
</view>
</view>
</block>
<view class="tool-item" bindtap="userNav" data-url="./setup/setup">
<image class="tool-item-img" src="https://cdn.shuiganying.com/images/2023/04/04/92dc81e66f90df7e106d69745de2ea48.png"></image>
<view class="tool-item-name">用户设置</view>
<image class="tool-item-arrow" src="/static/icons/orderArrow.png"></image>
</view>
<navigator class="tool-item" hover-class="none" url="./help/help">
<image class="tool-item-img" src="https://cdn.shuiganying.com/images/2023/04/04/7c86674c3ee1b2fdd1bb1459070e8ce3.png"></image>
<view class="tool-item-name">帮助中心</view>
<image class="tool-item-arrow" src="/static/icons/orderArrow.png"></image>
</navigator>
<navigator class="tool-item" hover-class="none" url="./about/about">
<image class="tool-item-img" src="https://cdn.shuiganying.com/images/2023/04/04/5db51a2cc893ba3fa0a80e4341c2b201.png"></image>
<view class="tool-item-name">关于水感应</view>
<image class="tool-item-arrow" src="/static/icons/orderArrow.png"></image>
</navigator>
<view class="tool-item btn" bindtap="callCenter">
<image class="tool-item-img" src="https://cdn.shuiganying.com/images/2023/04/04/5f22c6b7f07fd58741d2b6d629af5be5.png"></image>
<view class="tool-item-name">我的客服</view>
<image class="tool-item-arrow" src="/static/icons/orderArrow.png"></image>
</view>
<view class="tool-item" bindtap="outLogin" wx:if="{{userLogin}}">
<image class="tool-item-img" src="https://cdn.shuiganying.com/images/2023/04/04/bd88c54abcabcae95d1f616c0f9d9dd8.png"></image>
<view class="tool-item-name">退出登录</view>
<image class="tool-item-arrow" src="/static/icons/orderArrow.png"></image>
</view>
</view>
</view>
</view>
<!-- 推荐人弹出 -->
<view class="parentEject {{parentStatus ? 'active' : ''}}" catchtouchmove='true'></view>
<view class="parentPop {{parentStatus ? 'active' : ''}}" catchtouchmove='true'>
<image class="parentPop-back" src="https://cdn.shuiganying.com/images/2023/04/28/7ef0020933eeb4da3f9ba5f319a4e8a5.png" mode="aspectFill"></image>
<image class="parentPop-close" bindtap="parentTap" src="https://cdn.shuiganying.com/images/2023/04/27/c7aaa09b4ccd4bbd298b0e18aae68cfb.png" mode="widthFix"></image>
<view class="parentPop-cont">
<image class="parentPop-img" src="https://cdn.shuiganying.com/images/2023/04/27/988c792478a648e2df52ab90c60ea30e.png" mode="widthFix"></image>
<image class="parentPop-head" src="{{userData.parent.avatar}}" mode="widthFix"></image>
<view class="parentPop-nick">{{userData.parent.nickname}}</view>
<view class="parentPop-user" bindtap="clickcall" data-tel="{{userData.parent.username}}">{{userData.parent.username}}</view>
</view>
</view>

451
pages/user/index.wxss Normal file
View File

@@ -0,0 +1,451 @@
page {
background-color: #f4f4f6;
}
/* 头部 */
.userTop {
background-color: #5283ea;
height: 380rpx;
position: relative;
}
.userTop.active {
height: 320rpx;
}
.userTop-url {
height: 190rpx;
position: relative;
}
.userTop-back,
.userTop-cont {
position: absolute;
left: 0;
width: 100%;
}
.userTop-back {
height: 100%;
bottom: 0;
}
.userTop-cont {
padding: 40rpx 60rpx;
box-sizing: border-box;
display: flex;
}
.userTop-head {
width: 110rpx;
height: 110rpx;
border: 4rpx solid #dae6ff;
background-color: #ffffff;
position: relative;
border-radius: 50%;
}
.userTop-head image {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
border-radius: 50%;
}
.userTop-name {
line-height: 110rpx;
color: #ffffff;
font-size: 38rpx;
padding-left: 40rpx;
box-sizing: border-box;
display: flex;
}
.userTop-name-vip {
width: 140rpx;
margin-left: 20rpx;
margin-top: 38rpx;
}
.userTop-head-vip{
position: absolute;
bottom: -16rpx;
left: 18%;
font-size: 24rpx;
color: #ffffff;
height: 32rpx;
line-height: 32rpx;
width: 64%;
text-align: center;
border-radius: 80rpx;
background-image: linear-gradient(to right, #ffa340, #ff7707);
}
.bar {
padding: 0 60rpx;
display: flex;
}
.barTips {
display: flex;
line-height: 38rpx;
color: #ffffff;
}
.barTips-center {
line-height: 54rpx;
}
.barTips-name {
flex: 1;
font-size: 26rpx;
}
.barTips-center .barTips-name {
font-weight: 600;
font-size: 28rpx;
}
.barTips-name text {
font-weight: 600;
padding: 0 5rpx;
}
.barTips-text {
font-size: 24rpx;
opacity: .8;
}
.barCont {
width: calc(100% - 170rpx);
}
.barBack {
width: 100%;
height: 6rpx;
position: relative;
border-radius: 200rpx;
margin-top: 15rpx;
}
.barBack::after {
position: absolute;
content: '';
left: 0;
top: 0;
height: 100%;
width: 100%;
background-color: #ffffff;
border-radius: 200rpx;
opacity: .5;
}
.barBack text {
position: absolute;
content: '';
left: 0;
top: 0;
height: 100%;
background-color: #ffffff;
border-radius: 100rpx;
opacity: 1;
}
.barBtn {
background-color: #ffffff;
border-radius: 100rpx;
border: 2rpx solid #ffffff;
width: 120rpx;
text-align: center;
margin-left: 40rpx;
color: #5283ea;
font-size: 24rpx;
height: 54rpx;
line-height: 54rpx;
}
.barBtn-active {
width: 180rpx;
}
.barBtn.active {
opacity: .8;
color: #999;
}
/* 主内容 */
.userCont {
width: 100%;
position: absolute;
top: 285rpx;
padding: 0 30rpx 30rpx;
box-sizing: border-box;
}
.userCont.active {
top: 210rpx;
}
/* 订单 */
.userOrder {
padding: 0 30rpx;
box-sizing: border-box;
width: 100%;
}
.userOrder-cont {
padding: 30rpx 0;
box-sizing: border-box;
border-radius: 20rpx 20rpx 0 0;
background-image: linear-gradient(to top, #eef5ff 5%, #ffffff 90%);
}
.userOrder-title {
display: flex;
margin-bottom: 30rpx;
line-height: 48rpx;
padding: 0 30rpx;
}
.userOrder-title-name {
flex: 1;
font-size: 34rpx;
}
.userOrder-title-more {
color: #a6a7ab;
font-size: 28rpx;
display: flex;
}
.userOrder-title-arrow {
width: 42rpx;
height: 42rpx;
margin-top: 3rpx;
}
.userOrder-list {
display: flex;
}
.userOrder-item {
flex: 4;
text-align: center;
position: relative;
}
.userOrder-item-name {
font-size: 26rpx;
margin-top: 5rpx;
color: #868686;
}
.userOrder-item-icon {
width: 42rpx;
height: 42rpx;
}
.userOrder-item-number {
border-radius: 50%;
color: #ffffff;
background-color: #ff9951;
position: absolute;
top: -15rpx;
right: 40rpx;
font-size: 24rpx;
width: 30rpx;
height: 30rpx;
line-height: 30rpx;
border: 4rpx solid #ffffff;
}
/* 入口 */
.entry {
background-color: #ffffff;
border-radius: 0 0 20rpx 20rpx;
padding: 30rpx 0 0;
box-sizing: border-box;
flex-wrap: wrap;
justify-content: flex-start;
width: 100%;
}
.entry-item {
width: 25%;
display: inline-block;
text-align: center;
font-size: 28rpx;
margin-bottom: 40rpx;
}
.entry-item-img {
width: 56rpx;
height: 56rpx;
display: block;
margin: 0 auto 10rpx;
}
.entry-item-name {
color: #313131;
}
/* 常用工具 */
.tool {
background-color: #ffffff;
border-radius: 20rpx;
padding: 30rpx 0 30rpx 30rpx;
box-sizing: border-box;
margin-top: 30rpx;
}
.tool-title {
margin-bottom: 30rpx;
line-height: 48rpx;
font-size: 34rpx;
}
.tool-list {
margin-top: 50rpx;
}
.tool-item {
display: flex;
padding-bottom: 35rpx;
line-height: 48rpx;
margin-bottom: 35rpx;
border-bottom: 2rpx solid #e1e1e1;
position: relative;
}
.tool-item.btn{
background-color: transparent;
font-weight: normal;
width: 100% !important;
padding: 0 0 40rpx !important;
}
.tool-item.btn::after{
border: none;
}
.tool-item:last-child {
border: none;
margin: 0;
padding-bottom: 15rpx;
}
.tool-item-img {
width: 48rpx;
height: 48rpx;
margin-right: 20rpx;
}
.tool-item-name {
color: #434343;
}
.tool-item-arrow {
width: 48rpx;
height: 48rpx;
position: absolute;
right: 30rpx;
}
.tool-item-code {
position: absolute;
right: 30rpx;
color: #ff9951;
font-size: 28rpx;
display: flex;
}
.tool-item-copy {
height: 34rpx;
line-height: 34rpx;
border: 2rpx solid #ff9951;
padding: 0 15rpx;
border-radius: 5rpx;
margin-left: 15rpx;
font-size: 26rpx;
margin-top: 4rpx;
}
/* 推荐人弹出 */
.parentEject {
position: fixed;
width: 100vw;
height: 100vh;
left: 0;
top: 0;
background-color: rgba(0, 0, 0, .6);
z-index: 1000;
display: none;
}
.parentEject.active{
display: block;
}
.parentPop {
width: 80%;
position: fixed;
left: 10%;
top: calc(50% - 200rpx);
z-index: 10001;
height: 400rpx;
display: none;
overflow: hidden;
}
.parentPop.active{
display: block;
}
.parentPop-back,
.parentPop-cont {
height: 320rpx;
position: absolute;
left: 0;
top: 0;
border-radius: 40rpx;
width: 100%;
}
.parentPop-cont {
padding: 60rpx;
box-sizing: border-box;
}
.parentPop-close {
width: 50rpx;
left: calc(50% - 25rpx);
position: absolute;
bottom: 10rpx;
}
.parentPop-img {
width: 220rpx;
position: absolute;
right: 40rpx;
top: 40rpx;
}
.parentPop-head {
width: 94rpx;
height: 94rpx;
border-radius: 100%;
border: 4rpx solid #ffffff;
}
.parentPop-nick {
margin: 10rpx 0 15rpx;
font-weight: 600;
color: #214b9b;
font-size: 32rpx;
}
.parentPop-user {
color: #666666;
}

154
pages/user/setup/setup.js Normal file
View File

@@ -0,0 +1,154 @@
// pages/user/setup/setup.js
Page({
/**
* 页面的初始数据
*/
data: {
userData : '', // 基础信息
avatar : '',
nickName : '',
nameState : false,
disabled : false,
birthday : '',
sexArray : [
{
id: 0,
name: '男'
},
{
id: 1,
name: '女'
},
],
sexIndex : '',
reviseType: '', // 修改类型
nameValue : '' // 限制5个字符
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 获取登录状态
if(wx.getStorageSync("token") != ''){
// 获取用户信息
this.userInfo();
}
},
/**
* 用户设置信息
*/
userInfo() {
wx.$api.user.userSetup().then(res => {
this.setData({
userData : res.data,
avatar : res.data.avatar,
nickName : res.data.nickname,
birthday : res.data.birthday,
sexIndex : res.data.sex
})
}).catch(err => {})
},
/**
* 头像上传
*/
updImg(e){
let type = e.currentTarget.dataset.type
this.setData({
reviseType: e.currentTarget.dataset.type
})
if(type == 'avatar') {
wx.chooseMedia({
count : 1,
success : path => {
// 上传图片
wx.$api.file.uploadImg(path.tempFiles[0].tempFilePath, {}).then(res=>{
this.setData({
avatar:res.url
})
this.settingInfo(type, res.path)
})
}
})
return
}
// 修改用户名
this.setData({
nameState: true
})
},
/*
姓名截取
*/
bindinput(e) {
this.setData({
nameValue: e.detail.value.substr(0,5)
})
},
// 修改用户名
freeform() {
this.settingInfo(this.data.reviseType, this.data.nameValue)
},
/*
出生年月日
*/
bindDateChange(e) {
this.setData({
birthday: e.detail.value
})
this.settingInfo('birthday', e.detail.value)
},
/*
性别选择
*/
radioChange (e) {
const sex = this.data.sexArray
for (let i = 0, len = sex.length; i < len; ++i) {
sex[i].checked = sex[i].id == e.detail.value
}
this.setData({
sexArray: sex,
sexId : e.detail.value
})
this.settingInfo('sex', e.detail.value)
},
/**
* 上传用户信息
*/
settingInfo(key, value) {
wx.$api.user.setting(key, {
value: value
}).then(() => {
this.setData({
nameState: false,
nameValue: ''
})
// 获取用户信息
this.userInfo();
}).catch(err => {})
},
// 关闭弹框
establish() {
this.setData({
nameState: false,
nameValue: ''
})
}
})

View File

@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "用户设置"
}

View File

@@ -0,0 +1,86 @@
<view class="setupItem">
<view class="label" bindtap="updImg" data-type="avatar">
<view class="label-name">
<image class="label-name-img" src="https://cdn.shuiganying.com/images/2023/04/04/92bfc09706bc88dcb1dfe7de959dbb38.png" mode="aspectFill"></image>
<view class="label-name-text">修改头像</view>
</view>
<view class="label-tips">
<image class="label-name-head" src="{{avatar ? avatar : '/static/imgs/userHead.png'}}" mode="aspectFill"></image>
<image class="label-name-arrow" src="/static/icons/arrow_more.png" mode="widthFix"></image>
</view>
</view>
<view class="label" bindtap="updImg" data-type="nickname">
<view class="label-name">
<image class="label-name-img" src="https://cdn.shuiganying.com/images/2023/04/04/3a96069a287b0de017a3c316b258ba98.png" mode="aspectFill"></image>
<view class="label-name-text">用户昵称</view>
</view>
<view class="label-tips">
<view class="label-name-nickName">{{nickName}}</view>
<image class="label-name-arrow" src="/static/icons/arrow_more.png" mode="widthFix"></image>
</view>
</view>
</view>
<view class="setupItem">
<view class="label" bindtap="updImg" data-type="name">
<view class="label-name">
<image class="label-name-img" src="https://cdn.shuiganying.com/images/2023/04/11/0bc07e80fdfbdf8116b88a1ea424a7dc.png" mode="aspectFill"></image>
<view class="label-name-text">真实姓名</view>
</view>
<view class="label-tips">
<view class="label-name-nickName">{{userData.name != '' ? userData.name : '填写真实姓名'}}</view>
<image class="label-name-arrow" src="/static/icons/arrow_more.png" mode="widthFix"></image>
</view>
</view>
<view class="label">
<view class="label-name">
<image class="label-name-img" src="https://cdn.shuiganying.com/images/2023/04/11/43e0d6957a9ed4e82d40569cd46fbf42.png" mode="aspectFill"></image>
<view class="label-name-text">出生年月</view>
</view>
<view class="label-tips">
<picker class="entry" mode="date" value="{{birthday}}" bindchange="bindDateChange">
{{birthday != '' ? birthday : '请选择出生年月'}}<image class="label-name-arrow" src="/static/icons/arrow_more.png" mode="widthFix"></image>
</picker>
</view>
</view>
<view class="label">
<view class="label-name">
<image class="label-name-img" src="https://cdn.shuiganying.com/images/2023/04/11/90494a71bcd9197f461d0a72ec9675a1.png" mode="aspectFill"></image>
<view class="label-name-text">年龄</view>
</view>
<view class="label-tips">
<view class="label-name-nickName">{{userData.age != '' ? userData.age : '-- '}}岁</view>
</view>
</view>
<view class="label" data-type="nickname">
<view class="label-name">
<image class="label-name-img" src="https://cdn.shuiganying.com/images/2023/04/11/e46db9876d39e75757080e444bcc4c0a.png" mode="aspectFill"></image>
<view class="label-name-text">性别</view>
</view>
<view class="label-tips">
<picker class="entry" bindchange="radioChange" value="{{sexIndex}}" range="{{sexArray}}" range-key="name" mode="selector">
<view class="picker">
{{sexArray[sexIndex].name}}
</view>
</picker>
<image class="label-name-arrow" src="/static/icons/arrow_more.png" mode="widthFix"></image>
</view>
</view>
</view>
<!-- 修改用户昵称 start -->
<view class="publicBack" wx:if="{{nameState}}"></view>
<view class="publicPop" wx:if="{{nameState}}">
<view class="publicPop-cont">
<view class="free-title">{{reviseType == 'nickname' ? '用户昵称' : '真实姓名'}}</view>
<form bindsubmit="freeform" class="site-form">
<view class="free-input">
<input placeholder="限制5个字符" type="text" value="{{nameValue}}" bindinput="bindinput" name="name"></input>
</view>
<view class="publicPop-btn">
<view class="publicPop-btn-go publicPop-btn-border" bindtap="establish">暂不修改</view>
<button class="publicPop-btn-go" form-type="submit" disabled="{{disabled}}">确认提交</button>
</view>
</form>
</view>
</view>

173
pages/user/setup/setup.wxss Normal file
View File

@@ -0,0 +1,173 @@
page {
background-color: #f8f8f8;
}
.setupItem {
margin-bottom: 30rpx;
background-color: #ffffff;
}
.label {
line-height: 60rpx;
display: flex;
padding: 30rpx;
box-sizing: border-box;
border-bottom: 2rpx solid #f7f9fa;
}
.label:last-child {
border: none;
}
.label-name {
display: flex;
flex: 1;
}
.label-name-img {
width: 34rpx;
height: 34rpx;
margin-top: 14rpx;
margin-right: 20rpx;
}
.label-tips,
.entry {
display: flex;
color: rgb(110, 110, 110);
}
.label-name-head {
width: 54rpx;
height: 54rpx;
border-radius: 50%;
margin-right: 20rpx;
}
.label-name-nickName {
padding-right: 10rpx;
color: rgb(110, 110, 110);
font-size: 30rpx;
}
.label-name-arrow {
width: 24rpx;
height: 24rpx;
margin-top: 18rpx;
}
.label-name-number {
display: inline-block;
background-color: #f8f8f8;
color: #ffffff;
border-radius: 60rpx;
height: 36rpx;
line-height: 36rpx;
padding: 0 20rpx;
font-size: 28rpx;
margin: 12rpx 20rpx 0 0;
}
/* 弹出层提示 */
.publicBack {
position: fixed;
width: 100vw;
height: 100vh;
left: 0;
top: 0;
background-color: rgba(0, 0, 0, .5);
z-index: 99;
}
.publicPop {
left: 50%;
top: 50%;
width: 240px;
margin-left: -120px;
margin-top: -340rpx;
position: fixed;
z-index: 100;
}
.publicPop-cont {
width: 100%;
background-color: #FFFFFF;
border-radius: 30rpx;
text-align: center;
overflow: hidden;
padding: 50rpx 0 0;
box-sizing: border-box;
}
.free-title {
font-weight: 600;
margin-bottom: 40rpx;
font-size: 34rpx;
}
.free-input {
padding: 0 30rpx;
box-sizing: border-box;
height: 90rpx;
line-height: 90rpx;
font-size: 30rpx;
}
.free-input input {
height: 90rpx;
border-radius: 10rpx;
background-color: #f8f8f8;
}
.publicPop-text {
color: #9d9d9d;
font-size: 32rpx;
text-align: center;
}
.publicPop-text text {
color: #000000;
font-size: 40rpx;
display: block;
font-weight: 600;
margin: 20rpx 0 10rpx;
}
.publicPop-btn {
line-height: 80rpx;
margin-top: 70rpx;
font-size: 32rpx;
display: flex;
border-top: 2rpx solid #f8f8f8;
}
.publicPop-btn button {
margin: 0 !important;
padding: 0 !important;
background-color: transparent;
font-weight: normal !important;
color: #6c78f8;
}
.publicPop-btn-go {
width: 50% !important;
text-align: center;
height: 90rpx !important;
line-height: 90rpx !important;
font-size: 30rpx !important;
}
.publicPop-btn-border {
position: relative;
}
.publicPop-btn-border::after {
position: absolute;
content: '';
right: 0;
top: 0;
width: 2rpx;
height: 100rpx;
background-color: #f8f8f8;
}