会员模块

This commit is contained in:
2023-12-15 17:53:08 +08:00
commit 2a998468d9
282 changed files with 14521 additions and 0 deletions

View File

@@ -0,0 +1,148 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
Page({
/**
* 页面的初始数据
*/
data: {
userData : '', // 用户信息
goodsData : '', // 商品信息
aiSeeData : '', // 检测结果
baseData : '', // 基本资料
typesType : '', // 类型分类
typesData : '', // 舌象类型
resultData : '', // 舌象类型结果
imageId : '', // 结果id
typesState : false,// 舌象类型结果弹出
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setData({
imageId: options.tongue_id
})
// 获取用户信息
this.userInfo();
// 获取基本资料初始化
this.baseInfo();
// 获取检测报告结果
this.aiInfo(options.tongue_id)
// 获取舌象类型结果
wx.$api.record.types(this.data.imageId, {type: ''}).then(res => {
this.setData({
typesData : res.data
})
}).catch(err => { });
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {},
/**
* 用户信息
*/
userInfo() {
wx.$api.user.home().then(res => {
this.setData({
userData: res.data
})
}).catch(err => {})
},
/**
* 基本资料初始化
*/
baseInfo() {
wx.$api.water.Base().then(res => {
this.setData({
baseData: res.data.base
})
}).catch(err => {})
},
/**
* 检测报告结果
*/
aiInfo(imageid) {
wx.$api.record.aiSee(imageid).then(res => {
let {goods, tongue} = res.data
this.setData({
goodsData: goods,
aiSeeData: tongue
})
}).catch(err => { })
},
/**
* 舌象类型分类
*/
assayTap(e) {
this.setData({
typesType: e.currentTarget.dataset.type,
typesState: true
})
// 获取舌象类型结果
this.typesInfo();
},
/**
* 舌象类型结果
*/
typesInfo() {
wx.$api.record.types(this.data.imageId, {type: this.data.typesType}).then(res => {
switch (this.data.typesType){
case 'shexing':
this.setData({
resultData: res.data.shexing
})
break;
case 'shese':
this.setData({
resultData: res.data.shese
})
break;
case 'taizhi':
this.setData({
resultData: res.data.taizhi
})
break;
default:
this.setData({
resultData: res.data.taise
})
}
}).catch(err => { })
},
/**
* 舌象类型结果-关闭
*/
perfect() {
this.setData({
typesState: false
})
},
/**
* 查看检测原图
*/
previewImg(e) {
wx.previewImage({
urls : [e.currentTarget.dataset.imgs], //需要预览的图片http链接列表注意是数组
current : '' // 当前显示图片的http链接默认是第一个
})
}
})

View File

@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "评估报告"
}

View File

@@ -0,0 +1,199 @@
<image class="detailBack" src="https://api.siyuankunlun.com/storage/images/2023/11/14/cb73932e17282c5b0bf88ae404fb106b.png" mode="widthFix"></image>
<view class="detailCont">
<view class="top">
<view class="top-title">舌诊评估报告</view>
<image class="top-img" src="https://api.siyuankunlun.com/storage/images/2023/11/14/420c97db1d51c883e943a2b89dbf1648.png" mode="widthFix"></image>
</view>
<!-- 舌诊评估报告 -->
<view class="assay">
<view class="assayUser">
<view class="assayUser-top">
<image class="assayUser-top-head" src="{{userData.avatar ? userData.avatar : '/static/imgs/default_myHead.png'}}" mode="aspectFill"></image>
<view class="assayUser-top-name">Hi~{{userData.nickname}}</view>
</view>
<view class="assayUser-odds">
您有{{aiSeeData.ext.probability}}%的概率为:<text>{{aiSeeData.tizhi_name}}</text>
</view>
</view>
<view class="assayInfo" wx:if="{{baseData.height != '' && baseData.weight != '' && baseData.birthday != ''}}">
<view class="assayInfo-label">
<view class="assayInfo-label-name">身高(CM)</view>
<view class="assayInfo-label-text">{{baseData.height}}</view>
</view>
<view class="assayInfo-label">
<view class="assayInfo-label-name">体重(KG)</view>
<view class="assayInfo-label-text">{{baseData.weight}}</view>
</view>
<view class="assayInfo-label">
<view class="assayInfo-label-name">年龄(岁)</view>
<view class="assayInfo-label-text">{{baseData.age}}</view>
</view>
</view>
<view class="assayReport">
<image class="assayReport-back" src="https://api.siyuankunlun.com/storage/images/2023/11/20/567421eb85729d6cbdd8f5c1cab7e0b1.png"></image>
<view class="locateOne" bindtap="assayTap" data-type="taise">
<view class="locateOne-name">{{typesData.taise.name}}<image src="https://api.siyuankunlun.com/storage/images/2023/11/15/ea663baf0b9f8175250c9cd5fab8f8be.png" mode="widthFix"></image>
</view>
<view wx:if="{{ typesData.taise.match.length > 0}}">
<block wx:if="{{ typesData.taise.match.length == 1}}">
<view class="locateOne-tips" wx:for="{{ typesData.taise.match}}" wx:key="match">{{item.name}}</view>
</block>
<view class="locateOne-tips" wx:else>{{'有' + typesData.taise.count + '个结果'}}</view>
</view>
<view class="locateOne-tips" wx:else>正常</view>
</view>
<view class="locateTwo" bindtap="assayTap" data-type="taizhi">
<view class="locateOne-name">{{typesData.taizhi.name}}<image src="https://api.siyuankunlun.com/storage/images/2023/11/15/ea663baf0b9f8175250c9cd5fab8f8be.png" mode="widthFix"></image>
</view>
<view wx:if="{{ typesData.taizhi.match.length > 0}}">
<block wx:if="{{ typesData.taizhi.match.length == 1}}">
<view class="locateOne-tips" wx:for="{{ typesData.taizhi.match}}" wx:key="match">{{item.name}}</view>
</block>
<view class="locateOne-tips" wx:else>{{'有' + typesData.taizhi.count + '个结果'}}</view>
</view>
<view class="locateOne-tips" wx:else>正常</view>
</view>
<view class="locateThree" bindtap="assayTap" data-type="shese">
<view class="locateOne-name">{{typesData.shese.name}}<image src="https://api.siyuankunlun.com/storage/images/2023/11/15/ea663baf0b9f8175250c9cd5fab8f8be.png" mode="widthFix"></image>
</view>
<view wx:if="{{ typesData.shese.match.length > 0}}">
<block wx:if="{{ typesData.shese.match.length == 1}}">
<view class="locateOne-tips" wx:for="{{ typesData.shese.match}}" wx:key="match">{{item.name}}</view>
</block>
<view class="locateOne-tips" wx:else>{{'有' + typesData.shese.count + '个结果'}}</view>
</view>
<view class="locateOne-tips" wx:else>正常</view>
</view>
<view class="locateFour" bindtap="assayTap" data-type="shexing">
<view class="locateOne-name">{{typesData.shexing.name}}<image src="https://api.siyuankunlun.com/storage/images/2023/11/15/ea663baf0b9f8175250c9cd5fab8f8be.png" mode="widthFix"></image>
</view>
<view wx:if="{{ typesData.shexing.match.length > 0}}">
<block wx:if="{{ typesData.shexing.match.length == 1}}">
<view class="locateOne-tips" wx:for="{{ typesData.shexing.match}}" wx:key="match">{{item.name}}</view>
</block>
<view class="locateOne-tips" wx:else>{{'有' + typesData.shexing.count + '个结果'}}</view>
</view>
<view class="locateOne-tips" wx:else>正常</view>
</view>
</view>
<view class="assayMaster">
<view class="assayMaster-cont" bindtap="previewImg" data-imgs="{{aiSeeData.cut_image}}">查看检测原图</view>
</view>
<view class="assayResult">
<view class="assayResult-name">常见表现:</view>
<view class="assayResult-text">{{aiSeeData.changjianbiaoxian}}</view>
</view>
<view class="assayResult">
<view class="assayResult-name">微量元素匮乏:</view>
<view class="assayResult-text">{{aiSeeData.drink_water.ext.elements}}</view>
</view>
</view>
<!-- 对比 -->
<view class="assay">
<view class="ratioTop">
<view class="ratioTop-see">
<image class="ratioTop-img" src="https://api.siyuankunlun.com/storage/images/2023/11/14/85aa4d04fc050b44dfedeb839a60b965.png" mode="widthFix"></image>
<image class="ratioTop-img" src="https://api.siyuankunlun.com/storage/images/2023/11/14/8b96a34c64646c22a1a4b48cc8b12442.png" mode="widthFix"></image>
</view>
<view class="ratioTop-vs">VS</view>
</view>
<view class="ratioData">
<view class="ratioData-label">
<view class="ratioData-label-name" wx:for="{{aiSeeData.drink_water.pt}}" wx:key="pt">{{item}}</view>
</view>
<view class="ratioData-label">
<view class="ratioData-label-name" wx:for="{{aiSeeData.drink_water.sy}}" wx:key="sy">{{item}}</view>
</view>
</view>
<view class="ratioSuggest">
<view class="ratioSuggest-title">日常饮水建议</view>
<view class="ratioSuggest-text" wx:for="{{aiSeeData.drink_water.jy}}" wx:key="jy"><text>{{item.name}}</text>{{item.value}}</view>
</view>
</view>
<!-- 方案 -->
<view class="assay">
<view class="planTitle">
<view class="planTitle-name">饮用锶源昆仑最佳方案</view>
</view>
<view class="planCont">
<image src="https://api.siyuankunlun.com/storage/images/2023/11/14/031abe2163684a131eb11c7713efbdcc.png" class="planCont-img" mode="widthFix"></image>
<view class="planCont-brief">
<view class="planCont-brief-name">温水饮用锶源昆仑更好哦~</view>
<view class="planCont-brief-text">40~45℃水温饮用最佳从中医角度来说我们饮 用水的温度最好比自己体温要高,经常喝冷饮会损 耗体内的阳气,导致阴阳不平衡。</view>
</view>
</view>
</view>
<!-- 其他建议 -->
<view class="assay">
<view class="otherTitle">其他建议:</view>
<block wx:if="{{aiSeeData.shiliao.yc != '' && aiSeeData.shiliao.sc != ''}}">
<view class="otherLabel">
<view class="otherLabel-name">宜吃</view>
<view class="otherLabel-text">{{aiSeeData.shiliao.yc}}</view>
</view>
<view class="otherLabel red">
<view class="otherLabel-name">慎吃</view>
<view class="otherLabel-text">{{aiSeeData.shiliao.sc}}</view>
</view>
</block>
<view class="otherLabel" wx:else>
<view class="otherLabel-text">{{aiSeeData.shiliao.qt}}</view>
</view>
</view>
<!-- 产品 -->
<view class="assay">
<navigator class="goods" hover-class="none" url="/pages/mall/buy/index?id={{goodsData.goods_id}}">
<image class="goodsImg" src="{{goodsData.cover}}" mode="aspectFill"></image>
<view class="goodsCont">
<view class="goodsCont-name">{{goodsData.name}}</view>
<view class="goodsCont-specs">规格 500ml</view>
<view class="goodsCont-price">¥<text>{{goodsData.price.show}}</text></view>
<view class="goodsCont-btn">buy</view>
</view>
</navigator>
</view>
<!-- 温馨提示 -->
<view class="tips">*建议遵循为您定制的健康建议,逐步改善饮食和生活习惯。</view>
<!-- 机器人提示 -->
<view class="robot">
<image class="robotImg" src="https://api.siyuankunlun.com/storage/images/2023/11/14/2378a3c781d23ab4a104bf6a709b53ba.png" mode="widthFix"></image>
<view class="robotCont">
<view class="robotCont-name">建议您1个月后<text>(已明显改善生活习惯或有新的 体检结果后)</text></view>
<view class="robotCont-text">再次测试获得新的营养补充方案</view>
</view>
</view>
</view>
<!-- 按钮 -->
<view class="footer">
<view class="footer-flex">
<navigator hover-class="none" open-type="navigateBack" delta="1" class="footer-flex-btn">返回</navigator>
<navigator hover-class="none" url="/pages/record/share/share" class="footer-flex-btn footer-flex-share">邀请好友测试</navigator>
</view>
</view>
<!-- 舌象类型结果弹出 -->
<view class="refertoEject {{typesState ? 'active' : ''}}" catchtouchmove='true'></view>
<view class="refertoCont {{typesState ? 'active' : ''}}">
<view class="refertoCont-text">
<view class="refertoCont-title">{{resultData.name}}</view>
<view class="refertoCont-tips">
<block wx:if="{{resultData.match.length > 0}}">
<view class="refertoCont-tips-label" wx:for="{{resultData.match}}" wx:key="match">
<view class="refertoCont-tips-item">{{item.alias_name}}</view>{{item.description}}
</view>
</block>
<block wx:else>{{resultData.name + '正常'}}</block>
</view>
<view class="publicPop-btn">
<view class="publicPop-btn-go" bindtap="perfect">确定</view>
</view>
</view>
</view>

View File

@@ -0,0 +1,651 @@
page {
background-color: #f7faff;
}
.detailBack {
width: 100%;
}
.detailCont {
width: 100vw;
position: absolute;
padding: 60rpx 30rpx;
box-sizing: border-box;
top: 0;
left: 0;
border-bottom: 90px solid transparent;
}
.top {
display: flex;
margin-bottom: 60rpx;
}
.top-title {
flex: 1;
font-size: 48rpx;
margin-top: 10rpx;
font-weight: 600;
}
.top-img {
width: 160rpx;
}
/* 分析 */
.assay {
background-color: #ffffff;
border-radius: 20rpx;
padding: 40rpx;
box-sizing: border-box;
margin-top: 30rpx;
box-shadow: 0 0 10rpx rgba(153, 153, 153, .2);
}
.assayUser-top {
display: flex;
line-height: 60rpx;
}
.assayUser-odds {
line-height: 80rpx;
}
.assayUser-odds text {
color: #3b7cff;
font-weight: 600;
font-size: 40rpx;
}
.assayUser-top-head {
width: 60rpx;
height: 60rpx;
border-radius: 50%;
}
.assayUser-top-name {
padding-left: 25rpx;
box-sizing: border-box;
width: calc(100% - 60rpx);
font-size: 36rpx;
font-weight: 600;
}
.assayInfo {
display: flex;
border: 2rpx solid #909090;
border-radius: 15rpx;
padding: 20rpx 0;
font-size: 26rpx;
margin-bottom: 30rpx;
}
.assayInfo-label {
text-align: center;
flex: 3;
}
.assayInfo-label-name {
margin-bottom: 10rpx;
}
.assayReport {
margin: 50rpx 0 40rpx;
position: relative;
padding-top: 45%;
font-size: 26rpx;
}
.assayReport-back {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
}
.locateOne, .locateTwo, .locateThree, .locateFour {
position: absolute;
z-index: 2;
}
.locateOne {
top: 0;
left: 0;
}
.locateTwo {
bottom: 42rpx;
left: 0;
}
.locateThree {
top: 48rpx;
right: 0;
}
.locateFour {
bottom: 4rpx;
right: 0;
}
.locateOne-name {
line-height: 44rpx;
display: flex;
font-weight: 600;
}
.locateOne-name image {
width: 26rpx;
margin: 10rpx 0 0 10rpx;
}
.locateOne-tips {
background-color: #e9f0ff;
border-radius: 80rpx;
padding: 0 15rpx;
line-height: 40rpx;
margin-top: 16rpx;
font-size: 24rpx;
}
.assayMaster {
text-align: center;
}
.assayMaster-cont {
margin-bottom: 30rpx;
font-size: 30rpx;
border-radius: 10rpx;
border: 2rpx solid #3b7cff;
display: inline-block;
color: #3b7cff;
padding: 0 15rpx;
line-height: 58rpx;
}
.assayResult {
margin-bottom: 50rpx;
border-bottom: 2rpx solid #eeeeee;
padding-bottom: 50rpx;
}
.assayResult-name {
font-weight: 600;
margin-bottom: 20rpx;
}
.assayResult-text {
line-height: 40rpx;
font-size: 28rpx;
}
.assayResult:last-child {
border: none;
margin-bottom: 0;
padding-bottom: 0;
}
/* 对比 */
.ratioTop {
position: relative;
}
.ratioTop-see {
text-align: center;
}
.ratioTop-img {
text-align: center;
width: 50%;
box-sizing: border-box;
}
.ratioTop-img:nth-child(1) {
padding: 0 20% 0 5%;
}
.ratioTop-img:nth-child(2) {
padding: 0 5% 0 20%;
}
.ratioTop-vs {
color: #3b7cff;
font-weight: 600;
font-size: 56rpx;
position: absolute;
width: 100rpx;
text-align: center;
top: 0;
left: calc(50% - 50rpx);
line-height: 160rpx;
}
.ratioData {
display: flex;
}
.ratioData-label {
flex: 2;
}
.ratioData-label-name {
background-color: #f7faff;
line-height: 80rpx;
margin-top: 20rpx;
text-align: center;
border-radius: 10rpx;
position: relative;
font-size: 26rpx;
}
.ratioData-label-name::after{
content: ' ';
position: absolute;
bottom: 0;
left: -20rpx;
border-width: 73rpx 20rpx;
border-style: solid;
border-color: transparent transparent #f7faff transparent;
border-radius: 15rpx;
}
.ratioData-label:first-child {
margin-right: 30rpx;
}
.ratioData-label:last-child {
margin-left: 30rpx;
}
.ratioData-label:last-child .ratioData-label-name {
background-color: #3b7cff;
color: #ffffff;
}
.ratioData-label:last-child .ratioData-label-name::after {
border-color: transparent transparent #3b7cff transparent;
}
.ratioSuggest {
margin-top: 30rpx;
}
.ratioSuggest-title {
margin: 60rpx 0 30rpx;
font-weight: 600;
font-size: 34rpx;
}
.ratioSuggest-text {
position: relative;
padding-left: 30rpx;
box-sizing: border-box;
line-height: 40rpx;
margin-top: 30rpx;
font-size: 28rpx;
}
.ratioSuggest-text::after {
position: absolute;
content: '';
left: 0;
top: 15rpx;
background-color: #000000;
width: 10rpx;
height: 10rpx;
border-radius: 50%;
}
.ratioSuggest-text text {
font-weight: 600;
}
/* 方案 */
.planCont {
margin-top: 50rpx;
display: flex;
}
.planCont-img {
width: 120rpx;
}
.planCont-brief {
width: calc(100% - 120rpx);
padding-left: 40rpx;
box-sizing: border-box;
}
.planCont-brief-name {
font-size: 32rpx;
margin-bottom: 20rpx;
}
.planCont-brief-text {
color: #666666;
font-size: 26rpx;
text-align: justify;
line-height: 40rpx;
}
.planTitle {
font-weight: 600;
font-size: 34rpx;
position: relative;
height: 40rpx;
}
.planTitle::after {
background-color: #d8e5ff;
content: '';
position: absolute;
left: 0;
bottom: -10rpx;
height: 30rpx;
width: 55%;
}
.planTitle-name {
position: absolute;
left: 0;
bottom: 0;
z-index: 2;
}
/* 其他建议 */
.otherTitle {
font-weight: 600;
font-size: 32rpx;
}
.otherLabel {
margin-top: 30rpx;
}
.otherLabel-name {
font-weight: 600;
color: #00d005;
position: relative;
padding-left: 30rpx;
}
.otherLabel-name::after {
position: absolute;
content: '';
left: 0;
top: 15rpx;
background-color: #00d005;
width: 10rpx;
height: 10rpx;
border-radius: 50%;
}
.otherLabel-text {
line-height: 40rpx;
margin-top: 30rpx;
text-align: justify;
font-size: 28rpx;
}
.otherLabel.red .otherLabel-name {
color: #d80000;
}
.otherLabel.red .otherLabel-name::after {
background-color: #d80000;
}
/* 产品 */
.goods {
position: relative;
}
.goodsImg {
width: 180rpx;
height: 180rpx;
border-radius: 10rpx;
display: block;
}
.goodsCont {
height: 180rpx;
position: absolute;
left: 0;
top: 0;
padding-left: 220rpx;
box-sizing: border-box;
width: 100%;
}
.goodsCont-name {
font-size: 32rpx;
}
.goodsCont-specs {
color: #999999;
font-size: 26rpx;
margin: 15rpx 0 30rpx;
}
.goodsCont-price {
font-weight: 600;
}
.goodsCont-price text {
font-size: 40rpx;
}
.goodsCont-btn {
position: absolute;
right: 0;
bottom: 0rpx;
background-color: #3c7dff;
display: inline-block;
color: #ffffff;
height: 68rpx;
line-height: 68rpx;
padding: 0 35rpx;
border-radius: 90rpx;
text-transform: uppercase;
}
/* 温馨提示 */
.tips {
text-align: center;
font-size: 26rpx;
margin: 30rpx 0;
color: #999999;
}
/* 机器人提示 */
.robot {
display: flex;
}
.robotImg {
width: 140rpx;
margin-top: 10rpx;
}
.robotCont {
background-color: #ffffff;
padding: 20rpx 30rpx;
box-sizing: border-box;
width: calc(100% - 160rpx);
margin-left: 20rpx;
border-radius: 15rpx;
line-height: 40rpx;
font-size: 26rpx;
}
.robotCont-name text {
color: #999999;
}
/* 底部按钮 */
.footer {
width: 100%;
height: 100px;
background-color: #f7faff;
position: fixed;
left: 0;
bottom: 0;
z-index: 9989;
padding: 30rpx 10rpx;
box-sizing: border-box;
display: block;
}
.footer.active {
display: none;
}
.footer-flex {
display: flex;
}
.footer-flex-btn {
flex: 2;
margin: 0 15rpx;
line-height: 48px;
background-color: transparent;
height: 48px;
text-align: center;
color: #3b7cff;
border-radius: 80rpx;
border: 2rpx solid #3b7cff;
}
.footer-flex-share {
background-color: #3b7cff;
color: #FFFFFF;
}
/* 饮水量弹出 */
.refertoEject {
position: fixed;
width: 100vw;
height: 100vh;
left: 0;
top: 0;
background-color: rgba(0, 0, 0, .6);
z-index: 10000;
display: none;
}
.refertoEject.active {
display: block;
}
.refertoCont {
-webkit-box-orient: vertical;
-webkit-box-pack: center;
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: 100000;
padding: 0 15%;
box-sizing: border-box;
text-align: center;
display: none;
}
.refertoCont.active {
display: -webkit-box;
}
.refertoCont-text {
background-color: #ffffff;
border-radius: 20rpx;
box-sizing: border-box;
position: relative;
}
.refertoCont-ls {
width: 200rpx;
}
.refertoCont-title {
text-align: center;
font-weight: 600;
padding: 30rpx 0;
font-size: 34rpx;
box-sizing: border-box;
border-bottom: 2rpx solid #e4e4e4;
}
.refertoCont-tips {
line-height: 48rpx;
text-align: justify;
padding: 30rpx 40rpx;
box-sizing: border-box;
font-size: 30rpx;
max-height: 30vh;
overflow-y: scroll;
}
.refertoCont-tips text {
color: #528cff;
font-weight: 600;
padding-right: 10rpx;
}
.refertoCont-tips-label {
position: relative;
padding-left: 30rpx;
box-sizing: border-box;
font-size: 30rpx;
margin-bottom: 30rpx;
}
.refertoCont-tips-label:last-child {
margin-bottom: 0;
}
.refertoCont-tips-label::after {
position: absolute;
content: '';
left: 0;
top: 18rpx;
width: 14rpx;
height: 14rpx;
border-radius: 50%;
background-color: #b3b3b3;
}
.refertoCont-tips-item {
display: inline-block;
font-size: 28rpx;
background-color: #528cff;
color: #ffffff;
padding: 0 13rpx;
border-radius: 10rpx;
margin-right: 15rpx;
height: 40rpx;
line-height: 40rpx;
}
.publicPop-btn {
line-height: 80rpx;
font-size: 32rpx;
display: flex;
border-top: 2rpx solid #e6e6e6;
padding: 30rpx 50rpx;
box-sizing: border-box;
}
.publicPop-btn-go {
width: 100%;
color: #ffffff;
background-color: #3b7cff;
text-align: center;
height: 90rpx;
line-height: 90rpx;
font-size: 30rpx;
border-radius: 90rpx;
}

160
pages/record/index.js Normal file
View File

@@ -0,0 +1,160 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
Page({
/**
* 页面的初始数据
*/
data: {
isFixedTop : 0,
barHeight : getApp().globalData.statusBarHeight, // 状态栏高度
needBase : '', // 是否需要完善资料
typesState : false, // 拍摄结果弹出
baseState : false // 是否完善资料弹出
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 获取登录状态
if(wx.getStorageSync("token")){
// 获取初始化
this.initInfo();
}
},
/**
* 初始化
*/
initInfo () {
wx.$api.water.Init().then(res => {
this.setData({
needBase: res.data.need_base
})
}).catch(err => {})
},
/**
* 上传图片信息
*/
uploadPhoto() {
if(wx.getStorageSync("token")){
// 是否需要完善资料
if(this.data.needBase) {
this.setData({
baseState: true
})
return
}
// 拍摄
wx.chooseMedia({
count : 1,
mediaType: ['image'],
sourceType: ['camera'],
camera : 'front',
success : path => {
if(wx.cropImage){
wx.cropImage({
src: path.tempFiles[0].tempFilePath, // 图片路径
cropScale: '3:4', // 裁剪比例
success: res=> {
// 上传图片
wx.$api.file.uploadImg(res.tempFilePath, {}).then(res=>{
// 获取舌诊检测接口
this.checkEnter(res.url);
this.setData({
typesState: true
})
})
},
complete: err => {}
})
return
}
// 上传图片
wx.$api.file.uploadImg(path.tempFiles[0].tempFilePath, {}).then(res=>{
this.checkEnter(res.url);
this.setData({
typesState: true
})
})
}
})
}else {
// 去登录
wx.navigateTo({
url: "/pages/login/index"
})
}
},
/**
* 皮肤检测接口
*/
checkEnter(img) {
wx.$api.record.tongue({image: img}).then(res => {
wx.navigateTo({
url: "/pages/record/detail/detail?tongue_id=" + res.data.tongue_id
})
this.setData({
typesState: false
})
}).catch(err => {
this.setData({
typesState: false
})
})
},
/**
* 处理未登录时的转跳
*/
userNav(e){
let pageUrl = e.currentTarget.dataset.url
if(wx.getStorageSync("token")){
wx.navigateTo({
url: pageUrl
})
}else{
// 去登录
wx.navigateTo({
url: "/pages/login/index"
})
}
},
/**
* 关闭完善资料弹出
*/
establish() {
this.setData({
baseState: false
})
},
/**
* 完善资料跳转
*/
perfect() {
this.setData({
baseState: false
})
wx.navigateTo({
url: '/pages/clock/base/base'
})
}
})

5
pages/record/index.json Normal file
View File

@@ -0,0 +1,5 @@
{
"usingComponents": {},
"navigationStyle": "custom",
"navigationBarTextStyle": "white"
}

41
pages/record/index.wxml Normal file
View File

@@ -0,0 +1,41 @@
<view class="navigation {{isFixedTop > 50 ? 'active' : ''}}" style="padding-top:{{barHeight}}px;">
<image class="navigation-arrow" src="https://api.siyuankunlun.com/storage/images/2023/11/15/54dcd352eff2d8ad1f985a8374df09cd.png" mode="widthFix"></image>
</view>
<image class="recordBack" src="https://api.siyuankunlun.com/storage/images/2023/11/13/b26070a1632233907bddded8c28f0fe4.jpg" mode="aspectFill"></image>
<view class="recordCont">
<view class="recordCont-title">AI智能舌诊</view>
<view class="recordCont-tips">上传舌照 快速检测 专业分析</view>
<image class="recordCont-img" src="https://api.siyuankunlun.com/storage/images/2023/11/13/e6c4ba347287a6234864adcb88e04e1e.png" mode="widthFix"></image>
<view class="recordCont-text">
<text>尽量使用后置摄像头拍摄</text><text>请在无色灯光下使用</text>
</view>
<view class="recordCont-btn" bindtap="uploadPhoto">点击拍摄</view>
<view bindtap="userNav" data-url="/pages/record/list/list" class="rrecordCont-record">历史档案 去查看 > </view>
</view>
<!-- 拍摄结果等待中 -->
<view class="captureEject {{typesState ? 'active' : ''}}" catchtouchmove='true'></view>
<view class="captureCont {{typesState ? 'active' : ''}}">
<view class="captureCont-write">
<image class="captureCont-write-img" src="https://api.siyuankunlun.com/storage/images/2023/11/16/a40d11e61827dc608b3830c0fb4efd68.gif" mode="widthFix"></image>
<view class="captureCont-write-text">检测中,请等待...</view>
</view>
</view>
<!-- 是否完善资料弹出 -->
<view class="refertoEject {{baseState ? 'active' : ''}}" catchtouchmove='true'></view>
<view class="refertoCont {{baseState ? 'active' : ''}}" catchtouchmove='true'>
<view class="refertoCont-text">
<view class="refertoCont-title">完善资料提示</view>
<image class="refertoCont-ls" src="https://api.siyuankunlun.com/storage/images/2023/11/16/a2f3c4b5852fd4e613652d39640cd477.png" mode="widthFix"></image>
<view class="refertoCont-tips">
您还没有完善基本资料,完善资料后,可进行饮水打卡
</view>
<view class="publicPop-btn">
<view class="publicPop-btn-go" bindtap="establish">暂不完善</view>
<view class="publicPop-btn-go publicPop-btn-border" bindtap="perfect">去完善</view>
</view>
</view>
</view>

243
pages/record/index.wxss Normal file
View File

@@ -0,0 +1,243 @@
/* 顶部 */
.navigation {
position: fixed;
top: 0;
left: 0;
z-index: 999;
width: 100%;
height: 90rpx;
background-color: transparent;
transition: .5s;
}
.navigation.active {
background-color: #ffffff;
}
.navigation-arrow {
width: 120rpx;
margin-left: 40rpx;
}
.recordBack {
width: 100vw;
height: 100vh;
display: block;
}
.recordCont {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-box-pack: center;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: 9;
text-align: center;
padding: 0 100rpx 40rpx;
box-sizing: border-box;
overflow-y: scroll;
}
.recordCont-title {
font-weight: 600;
font-size: 86rpx;
letter-spacing: 2px;
padding-top: 100rpx;
}
.recordCont-tips {
display: inline-block;
border: 2rpx solid #2e2f2f;
font-size: 28rpx;
padding: 0 30rpx;
border-radius: 90rpx;
line-height: 50rpx;
margin-top: 30rpx;
position: relative;
margin-bottom: 40rpx;
}
.recordCont-tips::after {
position: absolute;
content: '';
left: calc(50% - 45rpx);
bottom: -40rpx;
width: 90rpx;
height: 4rpx;
background-color: #2e2f2f;
}
.recordCont-img {
width: 100%;
}
.recordCont-text text {
display: block;
line-height: 54rpx;
font-size: 30rpx;
}
.recordCont-btn {
background-color: #000000;
color: #ffffff;
display: inline-block;
height: 100rpx;
line-height: 100rpx;
padding: 0 130rpx;
font-size: 38rpx;
margin: 50rpx 0 30rpx;
border-radius: 100rpx;
}
.recordCont-record {
font-size: 30rpx;
}
/* 饮水量弹出 */
.captureEject {
position: fixed;
width: 100vw;
height: 100vh;
left: 0;
top: 0;
background-color: rgba(0, 0, 0, .6);
z-index: 10000;
display: none;
}
.captureEject.active {
display: block;
}
.captureCont {
-webkit-box-orient: vertical;
-webkit-box-pack: center;
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: 100000;
padding: 0 15%;
box-sizing: border-box;
text-align: center;
display: none;
}
.captureCont.active {
display: -webkit-box;
}
.captureCont-write {
background-color: #ffffff;
border-radius: 20rpx;
padding: 50rpx;
box-sizing: border-box;
}
.captureCont-write-img {
width: 60%;
}
.captureCont-write-text {
color: #528cff;
font-weight: 600;
margin-top: 20rpx;
}
/* 完善信息弹出 */
.refertoEject {
position: fixed;
width: 100vw;
height: 100vh;
left: 0;
top: 0;
background-color: rgba(0, 0, 0, .6);
z-index: 10000;
display: none;
}
.refertoEject.active {
display: block;
}
.refertoCont {
-webkit-box-orient: vertical;
-webkit-box-pack: center;
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: 100000;
padding: 0 15%;
box-sizing: border-box;
text-align: center;
display: none;
}
.refertoCont.active {
display: -webkit-box;
}
.refertoCont-text {
background-color: #ffffff;
border-radius: 20rpx;
box-sizing: border-box;
position: relative;
}
.refertoCont-ls {
width: 260rpx;
}
.refertoCont-title {
text-align: center;
font-weight: 600;
padding: 40rpx 0;
font-size: 34rpx;
box-sizing: border-box;
}
.refertoCont-tips {
line-height: 48rpx;
text-align: center;
padding: 0 60rpx 30rpx;
box-sizing: border-box;
}
.publicPop-btn {
line-height: 80rpx;
font-size: 32rpx;
display: flex;
border-top: 2rpx solid #e6e6e6;
}
.publicPop-btn-go {
width: 50%;
text-align: center;
height: 100rpx;
line-height: 100rpx;
font-size: 30rpx;
}
.publicPop-btn-border {
color: #528cff;
position: relative;
}
.publicPop-btn-border::after {
position: absolute;
content: '';
left: 0;
top: 0;
width: 2rpx;
height: 100rpx;
background-color: #e6e6e6;
}

93
pages/record/list/list.js Normal file
View File

@@ -0,0 +1,93 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
Page({
data: {
userLogin : false,
listArr : [], // 商品列表
page : {}, // 分页信息
lodingStats : false, // 加载状态
disabled : false, // 支付按钮
payStatus : false, // 支付弹框
catchtouchmove: false
},
onLoad(options) {},
onShow() {
// 获取登录状态
if(wx.getStorageSync("token") != ''){
this.setData({
userLogin: true,
disabled : false
})
// 获取检测结果列表
this.aiInfo();
} else {
this.setData({
userLogin: false
})
}
},
/**
* 检测结果列表
*/
aiInfo (page){
wx.$api.record.aiList({
page: page || 1
}).then(res => {
let listArr = this.data.listArr,
newData = []
if(page == 1 || page == undefined) listArr = []
newData = listArr.concat(res.data.data)
this.setData({
listArr : newData,
page : res.data.page,
lodingStats : false
})
wx.stopPullDownRefresh()
}).catch(err => { })
},
/**
* 处理未登录时的转跳
*/
assessGo(){
if(wx.getStorageSync("token") != ''){
wx.navigateTo({
url: '/pages/index/assess/assess?code=' + wx.getStorageSync("openid")
})
}else{
// 去登录
wx.navigateTo({
url: "/pages/login/index"
})
}
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
// 获取检测结果列表
this.aiInfo();
},
/**
* 上拉加载
*/
onReachBottom(){
this.setData({
lodingStats: true
})
let pageNumber = this.data.page.current
if(this.data.page.has_more){
pageNumber++
// 获取检测结果列表
this.aiInfo(pageNumber);
}
}
})

View File

@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "历史档案"
}

View File

@@ -0,0 +1,32 @@
<view class="report" wx:if="{{listArr.length > 0}}">
<view class="report-title">检测报告</view>
<view class="report-list">
<view class="report-item" wx:for="{{listArr}}" wx:key="listArr">
<view class="report-time">{{item.created_at}}</view>
<view class="report-tips">检测报告精准分析您舌诊问题</view>
<navigator hover-class="none" url="/pages/record/detail/detail?tongue_id={{item.tongue_id}}" class="report-btn">查看报告</navigator>
</view>
<view class="pagesLoding" wx:if="{{lodingStats}}">
<block wx:if="{{page.has_more}}">
<image class="pagesLoding-icon" src="/static/icons/refresh_loding.gif" mode="widthFix"></image>加载中...
</block>
<block wx:else>
没有更多了~
</block>
</view>
</view>
<view class="report-point">
<view class="report-point-text">
<text>*建议遵循为您定制的健康建议,逐步改善饮食和生活习惯。</text>
</view>
<!-- <view class="report-point-btn" bindtap="assessGo">再次拍摄</view> -->
</view>
</view>
<view class="pack-center pages-hint" wx:else>
<image src="https://cdn.shuiganying.com/images/2023/03/29/f01c427a1c0970cf3673d848ffc1591c.png"></image>
<view class="reportTips">
<view class="reportTips-title">暂无报告数据</view>
<view class="reportTips-text">进行AI智能舌诊后可查看历史数据</view>
<!-- <view class="reportTips-btn" bindtap="assessGo">立即拍摄</view> -->
</view>
</view>

105
pages/record/list/list.wxss Normal file
View File

@@ -0,0 +1,105 @@
page {
background-color: #f7faff;
}
/* 列表 */
.report {
width: 100%;
padding: 30rpx 30rpx 0;
box-sizing: border-box;
}
.report-title {
font-size: 36rpx;
}
.report-list {
margin-top: 30rpx;
}
.report-item {
background-color: #fff;
border-radius: 20rpx;
padding: 30rpx;
box-sizing: border-box;
box-shadow: 0 4rpx 30rpx 2rpx rgba(0, 0, 0, .05);
color: #0d0d0d;
position: relative;
margin-bottom: 30rpx;
}
.report-item:last-child {
margin: 0;
}
.report-time {
font-size: 34rpx;
}
.report-tips {
font-size: 28rpx;
margin-top: 20rpx;
line-height: 60rpx;
color: #414141;
}
.report-btn {
position: absolute;
right: 30rpx;
bottom: 30rpx;
color: #3b7cff;
border: #3b7cff 2rpx solid;
font-size: 26rpx;
line-height: 56rpx;
padding: 0 30rpx;
border-radius: 90rpx;
}
/* 友情提示 */
.report-point {
padding: 40rpx 50rpx;
box-sizing: border-box;
text-align: center;
}
.report-point-text {
color: #999999;
line-height: 50rpx;
}
.report-point-text text {
display: block;
font-size: 30rpx;
}
.report-point-btn {
margin-top: 50rpx;
background-color: #3b7cff;
display: inline-block;
color: #fff;
border-radius: 80rpx;
line-height: 90rpx;
width: 60%;
}
/* 暂无数据 */
.reportTips-title {
color: #000;
font-size: 34rpx;
line-height: 80rpx;
}
.reportTips-text {
font-size: 26rpx;
}
.reportTips-btn {
background-color: #3b7cff;
display: inline-block;
color: #fff;
line-height: 78rpx;
padding: 0 60rpx;
border-radius: 10rpx;
margin-top: 50rpx;
}

187
pages/record/share/share.js Normal file
View File

@@ -0,0 +1,187 @@
// pages/report/share/share.js
Page({
/**
* 页面的初始数据
*/
data: {
barHeight : getApp().globalData.statusBarHeight, // 状态栏高度
userData : '', // 用户信息
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.ShareInfo();
// 获取用户信息
this.userInfo();
},
/**
* 小程序码
*/
ShareInfo() {
wx.$api.user.miniShare({
url: '/pages/index/index'
}).then(res => {
this.setData({
inviteCode: res.data.qrcode
})
}).catch(err => {})
},
/**
* 用户信息
*/
userInfo() {
wx.$api.user.home().then(res => {
this.setData({
userData : res.data
})
}).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://api.siyuankunlun.com/storage/images/2023/11/17/1d57a567ca458f3cc162655cf9201bda.png' //背景素材
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.drawImage(codeImgEl, 260, 650, 80, 80)
// 文字
ctx.font = "bold 20px Arial"; //字体大小
ctx.fillStyle = "#3b7cff"; //字体颜色
ctx.textAlign = "center"
ctx.fillText('AI智能舌诊', 190, 530);
// 文字
ctx.font = "15px Arial"; //字体大小
ctx.fillStyle = "#000000"; //字体颜色
ctx.textAlign = "center"
ctx.fillText('上传舌照 快速检测 专业分析', 190, 573);
// 文字
ctx.font = "14px Arial"; //字体大小
ctx.fillStyle = "#666666"; //字体颜色
ctx.textAlign = "center"
ctx.fillText('舌形、舌色、苔质、苔色、微量元素等~', 188, 605);
// 文字
ctx.font = "15px Arial"; //字体大小
ctx.fillStyle = "#000000"; //字体颜色
ctx.fillText('锶源昆仑,舌诊评估检测', 145, 682);
// 文字
ctx.font = "15px Arial"; //字体大小
ctx.fillStyle = "#000000"; //字体颜色
ctx.fillText('为您推荐饮水建议', 120, 713);
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'
})
})
},
/**
* 返回上一页
*/
returnGo() {
wx.navigateBack({
delta: 1
})
},
/**
* 微信分享
*/
onShareAppMessage(){
return {
title : this.data.userData.nickname + '' + '邀请您一起AI测肤',
path : "/pages/index/index?invite=" + this.data.userData.invite,
imageUrl: "https://api.siyuankunlun.com/storage/images/2023/11/13/e6c4ba347287a6234864adcb88e04e1e.png"
}
}
})

View File

@@ -0,0 +1,5 @@
{
"usingComponents": {},
"navigationStyle": "custom",
"navigationBarTextStyle": "white"
}

View File

@@ -0,0 +1,41 @@
<view class="navigation {{isFixedTop > 0 ? 'active' : ''}}" style="padding-top:{{barHeight}}px;">
<image bindtap="returnGo" class="navigation-arrow" src="/static/icons/returnBlue.png"></image>
</view>
<!-- 顶部背景 -->
<view class="top">
<image class="top-back" src="https://api.siyuankunlun.com/storage/images/2023/11/13/b26070a1632233907bddded8c28f0fe4.jpg" mode="widthFix"></image>
<image class="top-img" src="https://api.siyuankunlun.com/storage/images/2023/11/13/e6c4ba347287a6234864adcb88e04e1e.png" mode="widthFix"></image>
</view>
<view class="seeCont">
<view class="seeBorder">
<view class="seeTop">
<view class="seeTop-img">
<image class="seeTop-img-title" src="https://api.siyuankunlun.com/storage/images/2023/11/14/420c97db1d51c883e943a2b89dbf1648.png" mode="widthFix"></image>
<image class="seeTop-img-line" src="/static/report/shareLine.png" mode="widthFix"></image>
</view>
<view class="seeTop-cont">
<view class="seeTop-cont-name">AI智能舌诊</view>
<view class="seeTop-cont-tips">上传舌照 快速检测 专业分析</view>
<view class="seeTop-cont-text">舌形、舌色、苔质、苔色、微量元素等~</view>
</view>
<view class="seeTop-share">
<view class="seeTop-share-title">
<view class="seeTop-share-name">锶源昆仑</view>
<view class="seeTop-share-text">舌诊评估检测,为您推荐饮水建议</view>
</view>
<view class="seeTop-share-code">
<image class="seeTop-share-img" src="{{inviteCode}}" mode="widthFix"></image>
</view>
</view>
</view>
</view>
<view class="seeBtn">
<button class="seeBtn-btn seeBtn-btn-border" open-type="share" hover-class="none">微信好友</button>
<view class="seeBtn-btn" bindtap="onCanvas">保存海报</view>
</view>
</view>
<!-- 海报canvas -->
<canvas type="2d" style="width: 375px; height: 800px;" id="coverCanvas" class="canvas-img" />

View File

@@ -0,0 +1,174 @@
page {
background-color: #f7faff;
}
/* 返回 */
.navigation{
position: fixed;
top: 0;
left: 0;
z-index: 999;
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;
}
/* 顶部背景 */
.top {
width: 100%;
position: relative;
height: 100vh;
overflow: hidden;
}
.top-back {
position: absolute;
height: 100%;
left: 0;
top: 0;
width: 100%;
z-index: 1;
}
.top-img {
position: absolute;
left: 20%;
top: 15%;
width: 60%;
z-index: 1;
}
/* 内容 */
.seeCont {
position: absolute;
bottom: 0;
z-index: 100;
width: 100%;
padding: 60rpx 30rpx 120rpx;
box-sizing: border-box;
}
.seeBorder {
border: 4rpx solid #ffffff;
border-radius: 15rpx;
overflow: hidden;
width: 100%;
box-sizing: border-box;
}
.seeTop {
background-color: #ffffff;
opacity: .75;
padding: 30rpx 50rpx;
box-sizing: border-box;
}
.seeTop-img {
text-align: center;
}
.seeTop-img-title {
width: 34%;
}
.seeTop-img-line {
width: 100%;
margin: 20rpx 0;
}
.seeTop-cont {
text-align: center;
font-size: 28rpx;
border-bottom: 2rpx dashed #3b7cff;
padding-bottom: 40rpx;
}
.seeTop-cont-name {
color: #3b7cff;
font-weight: 600;
font-size: 40rpx;
}
.seeTop-cont-tips {
margin: 30rpx 0 15rpx;
}
.seeTop-cont-tips text {
color: #3b7cff;
}
.seeTop-cont-text {
color: #666666;
}
.seeTop-share {
padding-top: 40rpx;
box-sizing: border-box;
display: flex;
}
.seeTop-share-title {
font-size: 26rpx;
line-height: 58rpx;
flex: 1;
}
.seeTop-share-code {
width: 110rpx;
height: 110rpx;
box-sizing: border-box;
}
.seeTop-share-img {
width: 100%;
height: 100%;
}
.seeBtn {
text-align: center;
width: 100%;
display: flex;
margin-top: 50rpx;
}
.seeBtn-btn {
flex: 2;
background-color: #3d7eff;
display: inline-block;
color: #ffffff;
border-radius: 90rpx;
height: 90rpx !important;
line-height: 90rpx !important;
padding: 0 80rpx !important;
margin: 0 15rpx !important;
border: 2rpx solid #3d7eff;
font-size: 30rpx;
}
.seeBtn-btn-border {
background-color: #ffffff;
color: #3d7eff;
font-weight: normal;
width: auto !important;
}
/* canvas */
.canvas-img {
position: fixed;
left: -10000%;
top: 0;
z-index: 99;
}