9.16下午更新 包含im
This commit is contained in:
+84
-31
@@ -1,20 +1,7 @@
|
||||
<template>
|
||||
<view class="my-code-page">
|
||||
<!-- 顶部导航栏 -->
|
||||
<uni-nav-bar
|
||||
left-icon="left"
|
||||
title="我的二维码"
|
||||
@cviewckLeft="goBack"
|
||||
fixed
|
||||
color="#8B2316"
|
||||
height="140rpx"
|
||||
:border="false"
|
||||
backgroundColor="#eeeeee"
|
||||
>
|
||||
<template v-slot:right>
|
||||
<uni-icons type="redo" color="#8B2316" size="22"></uni-icons>
|
||||
</template>
|
||||
</uni-nav-bar>
|
||||
<navBar title="我的二维码" />
|
||||
|
||||
<!-- 内容 -->
|
||||
<scroll-view scroll-y class="page-scroll">
|
||||
@@ -30,10 +17,10 @@
|
||||
<view class="rightCircle"></view>
|
||||
<view class="halfCircle"></view>
|
||||
<view class="avatar-wrapper">
|
||||
<image class="avatar" :src="avatarImg" mode="aspectFill" />
|
||||
<image class="avatar" :src="docUrl+userInfo.photo" mode="aspectFill" />
|
||||
</view>
|
||||
<view class="name-viewne">邹建东 主任医师</view>
|
||||
<view class="org-viewne">北京肝胆相照公益基金会</view>
|
||||
<view class="name-viewne">{{ userInfo.realName }} {{ userInfo.positionName }}</view>
|
||||
<view class="org-viewne">{{ userInfo.hospitalName }}</view>
|
||||
<view class="dash-viewne"></view>
|
||||
<view class="slogan">
|
||||
<text class="h1">不方便到医院就诊</text>
|
||||
@@ -44,7 +31,7 @@
|
||||
<up-image :src="viewnkImg" width="430rpx" height="131rpx" ></up-image>
|
||||
|
||||
</view>
|
||||
<image class="qr-img" :src="qrImg" mode="aspectFit" />
|
||||
<image class="qr-img" :src="docUrl+userInfo.qrcode" mode="aspectFit" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -72,25 +59,91 @@
|
||||
|
||||
<!-- 底部保存按钮 -->
|
||||
<view class="save-bar">
|
||||
<button class="save-btn" @cviewck="onSave">保存二维码到手机</button>
|
||||
<button class="save-btn" @click="onSave">保存二维码到手机</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import navBar from '@/components/navBar/navBar.vue'
|
||||
import { onShow } from "@dcloudio/uni-app";
|
||||
import { ref } from 'vue';
|
||||
|
||||
const avatarImg = '/static/xxtx.png';
|
||||
const qrImg = '/static/sfewm.png';
|
||||
import docUrl from '@/utils/docUrl'
|
||||
import bgImg from "@/static/background.jpg"
|
||||
import viewnkImg from "@/static/arr.png"
|
||||
|
||||
const userInfo = ref({})
|
||||
const goBack = () => {
|
||||
uni.navigateBack();
|
||||
};
|
||||
|
||||
onShow(()=>{
|
||||
userInfo.value = uni.getStorageSync('userInfo')
|
||||
})
|
||||
const onSave = () => {
|
||||
uni.showToast({ title: '已保存(示例)', icon: 'none' });
|
||||
// 检查是否有二维码图片
|
||||
if (!userInfo.value.qrcode) {
|
||||
uni.showToast({ title: '二维码不存在', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
|
||||
// 显示加载提示
|
||||
uni.showLoading({ title: '保存中...' });
|
||||
|
||||
// 下载二维码图片
|
||||
uni.downloadFile({
|
||||
url: docUrl + userInfo.value.qrcode,
|
||||
success: (res) => {
|
||||
if (res.statusCode === 200) {
|
||||
// 保存到相册
|
||||
uni.saveImageToPhotosAlbum({
|
||||
filePath: res.tempFilePath,
|
||||
success: () => {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: '保存成功',
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
});
|
||||
},
|
||||
fail: (err) => {
|
||||
uni.hideLoading();
|
||||
console.error('保存失败:', err);
|
||||
|
||||
// 根据错误类型给出不同提示
|
||||
if (err.errMsg.includes('auth deny') || err.errMsg.includes('authorize')) {
|
||||
uni.showModal({
|
||||
title: '权限提示',
|
||||
content: '需要相册权限才能保存图片,请在设置中开启权限',
|
||||
showCancel: false,
|
||||
confirmText: '知道了'
|
||||
});
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '保存失败,请重试',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: '下载失败,请检查网络',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
uni.hideLoading();
|
||||
console.error('下载失败:', err);
|
||||
uni.showToast({
|
||||
title: '下载失败,请检查网络',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -182,7 +235,7 @@ const onSave = () => {
|
||||
|
||||
width:100%;
|
||||
color: #ffffff;
|
||||
text-aviewgn: center;
|
||||
text-align: center;
|
||||
|
||||
.banner-title-small {
|
||||
font-size: 26rpx;
|
||||
@@ -279,10 +332,10 @@ const onSave = () => {
|
||||
font-weight:bold;
|
||||
letter-spacing: 8rpx;
|
||||
flex-direction: column;
|
||||
text-aviewgn: center;
|
||||
text-align: center;
|
||||
font-size: 40rpx;
|
||||
color: #1e88e5;
|
||||
viewne-height: 1.6;
|
||||
line-height: 1.6;
|
||||
text{
|
||||
text-align: center;
|
||||
}
|
||||
@@ -293,7 +346,7 @@ const onSave = () => {
|
||||
}
|
||||
.contact-qr {
|
||||
display: flex;
|
||||
aviewgn-items: center;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 20rpx;
|
||||
margin-top: 30rpx;
|
||||
@@ -305,12 +358,12 @@ const onSave = () => {
|
||||
color: #ffffff;
|
||||
|
||||
display: flex;
|
||||
aviewgn-items: center;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
.contact-text {
|
||||
white-space: pre-viewne;
|
||||
font-size: 26rpx;
|
||||
viewne-height: 1.5;
|
||||
line-height: 1.5;
|
||||
}
|
||||
.arrow {
|
||||
font-size: 36rpx;
|
||||
|
||||
Reference in New Issue
Block a user