Merge branch 'develop'
# Conflicts: # pages/my/my.vue
This commit is contained in:
@@ -637,7 +637,7 @@
|
||||
// }
|
||||
};
|
||||
|
||||
// 测试tabbar功能的方法
|
||||
//测试tabbar功能的方法
|
||||
const testTabbar = () => {
|
||||
nextTick(() => {
|
||||
if (tabbarRef.value) {
|
||||
@@ -648,9 +648,9 @@
|
||||
tabbarRef.value.showRedDot(2);
|
||||
|
||||
// 3秒后隐藏红点
|
||||
setTimeout(() => {
|
||||
tabbarRef.value.hideRedDot(2);
|
||||
}, 3000);
|
||||
// setTimeout(() => {
|
||||
// tabbarRef.value.hideRedDot(2);
|
||||
// }, 3000);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
+165
-24
@@ -9,7 +9,17 @@
|
||||
:style="{'background-image': `url(${myInfoBackGround || '/static/big_background_my.png'})`, 'background-size':'cover','background-repeat':'no-repeat'}">
|
||||
<view class="user-info" @click="goToPage('myInfo')">
|
||||
<image class="avatar" :src="avatar" mode="aspectFill"></image>
|
||||
<text class="username">{{username}}</text>
|
||||
<view class="user-info-content">
|
||||
<text class="username">{{username}}</text>
|
||||
<scroll-view class="honor_box" scroll-x="true" show-scrollbar="false">
|
||||
<view class="honor_wrap">
|
||||
<view class="honor_item" v-for="item in honor_list" :key="item.id">
|
||||
<image class="honor_image" src="/static/wdsc.png" mode="aspectFill"></image>
|
||||
<text class="honor_text">{{ item.nick_name }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 统计数据 -->
|
||||
@@ -27,9 +37,12 @@
|
||||
<text class="stats-label">患者送花数</text>
|
||||
</view>
|
||||
<view class="divder"></view>
|
||||
<view class="signbox">
|
||||
<view class="signbox" v-if="sign_in == 0" @click="onSignClick">
|
||||
<view class="sign">签到</view>
|
||||
</view>
|
||||
<view class="signbox_1" v-else @click="goToPage('pointMall')">
|
||||
<view class="sign">{{ formatToChineseUnit(totalPoints) }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -117,13 +130,15 @@
|
||||
</up-scroll-list>
|
||||
</view>
|
||||
|
||||
<!-- #ifdef APP -->
|
||||
<!-- 常用操作 -->
|
||||
<view class="section">
|
||||
<view class="section-title">常用操作</view>
|
||||
<view class="operation-grid">
|
||||
<view class="operation-item" @click="goToPage('wechatUnbind')">
|
||||
<up-image :src="wxjbImg" width="48rpx" height="48rpx"></up-image>
|
||||
<text>微信解绑</text>
|
||||
<text v-if="isBoundWechat">微信解绑</text>
|
||||
<text v-else>微信绑定</text>
|
||||
</view>
|
||||
<view class="operation-item" @click="goToPage('changePhone')">
|
||||
<up-image :src="ghsjhImg" width="48rpx" height="48rpx"></up-image>
|
||||
@@ -135,10 +150,11 @@
|
||||
</view>
|
||||
<view class="operation-item" @click="showVersion">
|
||||
<up-image :src="versionImg" width="48rpx" height="48rpx"></up-image>
|
||||
<text>V4.1.4</text>
|
||||
<text>V{{version}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
<view class="setbox">
|
||||
<!-- 福利卡兑换 -->
|
||||
<view class="sectioncell benefit-section">
|
||||
@@ -209,6 +225,7 @@
|
||||
import {
|
||||
onShow
|
||||
} from "@dcloudio/uni-app";
|
||||
import version from '@/utils/version.js'
|
||||
import hzshImg from "@/static/hzsh.png"
|
||||
import hzfzImg from "@/static/hzfz.png"
|
||||
import qfxxImg from "@/static/qfxz.png"
|
||||
@@ -236,6 +253,7 @@
|
||||
import cyyhk from "@/static/cyhhk.png"
|
||||
import settingImg from "@/static/setting.png"
|
||||
import api from '@/api/api.js'
|
||||
import my_api from '@/api/my_api.js'
|
||||
import navTo from "@/utils/navTo"
|
||||
import linkUrl from "@/utils/docUrl"
|
||||
// 响应式数据
|
||||
@@ -248,7 +266,9 @@
|
||||
const consultCount = ref(0)
|
||||
const flowerCount = ref(0)
|
||||
const myInfoBackGround = ref('')
|
||||
|
||||
const totalPoints = ref(0)
|
||||
const sign_in = ref(0)
|
||||
const honor_list = ref([])
|
||||
// 从storage获取用户信息
|
||||
const getUserInfoFromStorage = () => {
|
||||
try {
|
||||
@@ -263,35 +283,79 @@
|
||||
}
|
||||
}
|
||||
|
||||
// 签到点击事件
|
||||
const onSignClick = async () => {
|
||||
|
||||
try {
|
||||
// 调用添加积分接口
|
||||
const res = await api.addBonusPointsN({
|
||||
score_type:1
|
||||
});
|
||||
|
||||
if (res && res.code ==1) {
|
||||
// 签到成功
|
||||
sign_in.value = 1;
|
||||
uni.showToast({
|
||||
title: '签到成功,获得'+res.bonuspoints+'积分',
|
||||
icon: 'none'
|
||||
});
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res?.msg || '签到失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('签到失败:', error);
|
||||
uni.showToast({
|
||||
title: '签到失败,请重试',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const fetchMyInfo = async () => {
|
||||
try {
|
||||
const res = await api.getMyInfo({})
|
||||
if (res && res.code === 200 && res.data) {
|
||||
const data = res.data
|
||||
myInfoBackGround.value = data.myInfoBackGround;
|
||||
followupCount.value = data.follow_patient_num || data.relationPatientNum || 0
|
||||
consultCount.value = data.consult_total || data.consultCount || 0
|
||||
flowerCount.value = data.give_flower_num || data.flowerCount || 0
|
||||
myInfoBackGround.value = data.myInfoBackGround;
|
||||
followupCount.value = data.expert_apply_num || 0
|
||||
consultCount.value = data.consult_total_num || 0
|
||||
flowerCount.value = data.ping_flowewr_num || 0
|
||||
totalPoints.value = data.total_points || 0
|
||||
sign_in.value = data.sign_in || 0
|
||||
honor_list.value = data.honor_list || []
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('获取我的信息失败', e)
|
||||
}
|
||||
}
|
||||
|
||||
// 数字格式化为中文单位(万/亿)
|
||||
const formatToChineseUnit = (value, fractionDigits = 1) => {
|
||||
if (value == null || value === '' || isNaN(Number(value))) return value;
|
||||
const num = Number(value);
|
||||
const sign = num < 0 ? '-' : '';
|
||||
const abs = Math.abs(num);
|
||||
|
||||
if (abs < 10000) {
|
||||
return sign + String(abs);
|
||||
}
|
||||
if (abs < 100000000) {
|
||||
const v = (abs / 10000).toFixed(fractionDigits);
|
||||
return sign + (v.indexOf('.') > -1 ? v.replace(/\.0+$/, '').replace(/(\.\d*?)0+$/, '$1') : v) + '万';
|
||||
}
|
||||
const v = (abs / 100000000).toFixed(fractionDigits);
|
||||
return sign + (v.indexOf('.') > -1 ? v.replace(/\.0+$/, '').replace(/(\.\d*?)0+$/, '$1') : v) + '亿';
|
||||
}
|
||||
|
||||
// 方法
|
||||
const toggleFontSize = () => {
|
||||
isLargeFont.value = !isLargeFont.value;
|
||||
console.log('切换字体大小:', isLargeFont.value ? '大字版' : '普通版');
|
||||
};
|
||||
|
||||
const checkin = () => {
|
||||
console.log('签到');
|
||||
uni.showToast({
|
||||
title: '签到成功',
|
||||
icon: 'none'
|
||||
});
|
||||
};
|
||||
|
||||
const goToPage = (page) => {
|
||||
console.log('跳转到页面:', page);
|
||||
let url="";
|
||||
@@ -333,6 +397,9 @@
|
||||
case 'myPoints':
|
||||
url="/pages_app/myPoint/myPoint"
|
||||
break;
|
||||
case 'pointMall':
|
||||
url="/pages_goods/pointMall/pointMall"
|
||||
break;
|
||||
case 'myBenefits':
|
||||
url="/pages_app/myWelfare/myWelfare"
|
||||
break;
|
||||
@@ -382,7 +449,7 @@
|
||||
const showVersion = () => {
|
||||
uni.showModal({
|
||||
title: '版本信息',
|
||||
content: '当前版本:V4.1.4',
|
||||
content: '当前版本:V'+version,
|
||||
showCancel: false
|
||||
});
|
||||
};
|
||||
@@ -411,10 +478,19 @@
|
||||
})
|
||||
}
|
||||
|
||||
const getIsBoundWechat = async () => {
|
||||
const res = await my_api.isBoundWechat()
|
||||
console.log(res)
|
||||
if (res.code === 200 && res.data) {
|
||||
isBoundWechat.value = res.data
|
||||
}
|
||||
}
|
||||
const isBoundWechat = ref(false)
|
||||
onShow(() => {
|
||||
console.log('我的页面显示');
|
||||
getUserInfoFromStorage() // 先从storage获取用户信息
|
||||
fetchMyInfo() // 然后从API获取最新数据
|
||||
getIsBoundWechat()
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -468,11 +544,57 @@
|
||||
|
||||
}
|
||||
|
||||
.username {
|
||||
color: $white;
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
.user-info-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 10rpx;
|
||||
|
||||
.username {
|
||||
color: $white;
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.honor_box {
|
||||
width: 500rpx;
|
||||
/* 根据设计可调整宽度,使内容可横向滚动 */
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.honor_wrap {
|
||||
display: inline-flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
gap: 10rpx;
|
||||
}
|
||||
|
||||
.honor_item {
|
||||
display: inline-flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
gap: 10rpx;
|
||||
flex: 0 0 auto;
|
||||
padding: 6rpx 12rpx;
|
||||
border: 2rpx solid rgba(255, 255, 255, 0.6);
|
||||
border-radius: 24rpx;
|
||||
background: rgba(255, 255, 255, 0.08);
|
||||
}
|
||||
|
||||
.honor_image {
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
}
|
||||
|
||||
.honor_text {
|
||||
font-size: 24rpx;
|
||||
color: $white;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
.stats-section {
|
||||
@@ -514,6 +636,26 @@
|
||||
}
|
||||
}
|
||||
|
||||
.signbox_1 {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 54rpx;
|
||||
width: 160rpx;
|
||||
height: 56rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border: 1rpx solid #fc564a;
|
||||
border-radius: 30rpx 0 0 30rpx;
|
||||
background: #fff url("@/static/qd_bg.9.png")no-repeat 0 0;
|
||||
background-size: 57rpx 56rpx;
|
||||
|
||||
.sign {
|
||||
margin-left: 60rpx;
|
||||
font-size: 28rpx;
|
||||
color: #fc564a;
|
||||
}
|
||||
}
|
||||
|
||||
.stats-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -546,8 +688,7 @@
|
||||
gap: 8rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 通用section样式
|
||||
.section {
|
||||
background-color: $white;
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<template>
|
||||
<web-view :src="url"></web-view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
url: ''
|
||||
}
|
||||
},
|
||||
onLoad(item) {
|
||||
// 传入需要跳转的链接 使用web-view标签进行跳转
|
||||
this.url = decodeURIComponent(item.url)
|
||||
// console.log(this.url)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user