1323 lines
46 KiB
Vue
1323 lines
46 KiB
Vue
<template>
|
||
<view class="container">
|
||
<!-- 自定义头部导航栏 -->
|
||
<ZdyNavbar @right-click="edit" isRightButton rightButtonText="编辑" :title="data.navbar.title"
|
||
:bgColor="data.navbar.bgColor" :isBack="true" />
|
||
<scroll-view scroll-x="true" class="footer-btn" :show-scrollbar="false">
|
||
<view class="footer-box">
|
||
<view class="btn" v-for="(item, index) in data.typeList" :key="index" :class="{ active: data.type == index }"
|
||
@click="setType(index)">
|
||
{{ item }}
|
||
</view>
|
||
</view>
|
||
</scroll-view>
|
||
<view style="display: flex;align-items: center;background: #fff;border-radius: 10px;margin: 10px;padding: 2px;">
|
||
<image src="/static/image/other/notice.png" style="width: 16px;height: 16px;margin-right: 10rpx;"></image>
|
||
此功能不具备真实性,仅供娱乐
|
||
</view>
|
||
<image :src="data.code" mode="widthFix" style="width:calc( 100vw - 24px);margin:0 12px;" @click="previewImage">
|
||
</image>
|
||
<view class="button-container">
|
||
<button class="btn-save-image" @click="saveImage">保存图片</button>
|
||
</view>
|
||
<view style="width: 0px;height: 0;overflow: hidden;" v-if="data.shuaxing">
|
||
<l-painter isCanvasToTempFilePath @success="successImage" @progress="progress" css="width:351px;height:250px;"
|
||
v-if="data.type == 0">
|
||
<l-painter-view
|
||
:css="`width:351px;height:250px;background-image: url('/static/image/other/certificate/graduate/graduate1.png');position: relative;`">
|
||
<!-- 标题 -->
|
||
<l-painter-view :css="`position: absolute;left:${data.graduate.type == 0 ? 46 : 85}px;top:67px;`">
|
||
<l-painter-image :src="data.graduate.title"
|
||
:css="`width: ${data.graduate.type == 0 ? 144 : 64}px;height: 18px;`" />
|
||
</l-painter-view>
|
||
<!-- 头像 -->
|
||
<l-painter-view :css="`position: absolute;left:65px;bottom:55px;`">
|
||
<l-painter-image :src="data.graduate.avatar" :css="`width: 39px;height: 55px;`" />
|
||
</l-painter-view>
|
||
<!-- 注册号码 -->
|
||
<l-painter-view :css="`position: absolute;left:112px;bottom:59px;`">
|
||
<l-painter-text :css="data.textCss" :text="'注册号码:' + data.graduate.code" />
|
||
</l-painter-view>
|
||
<!-- 姓名,性别 -->
|
||
<l-painter-view :css="`position: absolute;left:209px;top:67px;`">
|
||
<l-painter-text :css="data.textCssRight" :text="'学生' + data.graduate.name + ',性别' + data.graduate.sex" />
|
||
</l-painter-view>
|
||
<!-- 注册号码 -->
|
||
<l-painter-view :css="`position: absolute;left:209px;top:77px;`">
|
||
<l-painter-text :css="data.textCssRight" :text="'生于' + data.graduate.birth" />
|
||
</l-painter-view>
|
||
<!-- 注册号码 -->
|
||
<l-painter-view :css="`position: absolute;left:209px;top:87px;`">
|
||
<l-painter-text :css="data.textCssRight"
|
||
:text="'于' + data.graduate.satrt + '至' + data.graduate.end + '在本校'" />
|
||
</l-painter-view>
|
||
<!-- 注册号码 -->
|
||
<l-painter-view :css="`position: absolute;left:209px;top:97px;`">
|
||
<l-painter-text :css="data.textCssRight" :text="data.graduate.college" />
|
||
</l-painter-view>
|
||
<!-- 注册号码 -->
|
||
<l-painter-view :css="`position: absolute;left:209px;top:107px;`">
|
||
<l-painter-text :css="data.textCssRight" :text="data.graduate.major" />
|
||
</l-painter-view>
|
||
<!-- 注册号码 -->
|
||
<l-painter-view :css="`position: absolute;left:209px;top:117px;`">
|
||
<l-painter-text :css="data.textCssRight" :text="'四年制本科学习,'" />
|
||
</l-painter-view>
|
||
<!-- 注册号码 -->
|
||
<l-painter-view :css="`position: absolute;left:209px;top:127px;`">
|
||
<l-painter-text :css="data.textCssRight" :text="'修完培养方案规定的内容,'" />
|
||
</l-painter-view>
|
||
<!-- 注册号码 -->
|
||
<l-painter-view :css="`position: absolute;left:209px;top:137px;`">
|
||
<l-painter-text :css="data.textCssRight" :text="'成绩合格,准予毕业。'" />
|
||
</l-painter-view>
|
||
<!-- 注册号码 -->
|
||
<l-painter-view :css="`position: absolute;left:256px;bottom:68px;width:50px;text-align: center;`">
|
||
<l-painter-text :css="data.textCssRight + 'text-align: center;'"
|
||
:text="data.graduate.type == 0 ? '五道口职业技术学院' : '清华大学'" />
|
||
</l-painter-view>
|
||
<!-- 注册号码 -->
|
||
<l-painter-view :css="`position: absolute;left:256px;bottom:59px;width:50px;text-align: center;`">
|
||
<l-painter-text :css="data.textCssRight + 'text-align: center;'" :text="data.graduate.time" />
|
||
</l-painter-view>
|
||
<!-- 公章 -->
|
||
<l-painter-view :css="`position: absolute;right:41px;bottom:62px;`">
|
||
<l-painter-image :src="data.graduate.icon" :css="`width: 54px;height: 54px;`" />
|
||
</l-painter-view>
|
||
<l-painter-view v-if="$isVip()" :css="`position: absolute;left:117px;bottom:127px;`">
|
||
<l-painter-image src="/static/image/other/card/shuiyin2.png" css="width: 97px;height: 28px;" />
|
||
</l-painter-view>
|
||
</l-painter-view>
|
||
</l-painter>
|
||
<l-painter isCanvasToTempFilePath @success="successImage" @progress="progress" css="width:351px;height:262px;"
|
||
v-else-if="data.type == 1">
|
||
<l-painter-view
|
||
:css="`width:351px;height:262px;background-image: url('/static/image/other/certificate/graduate/graduate2.png');position: relative;`">
|
||
<l-painter-view :css="`position: absolute;right:126px;bottom:113px;`">
|
||
<l-painter-text :css="data.textCss2 + 'text-align: right;color:#838383;'" :text="data.graduate.name" />
|
||
</l-painter-view>
|
||
<l-painter-view v-if="$isVip()" :css="`position: absolute;left:117px;bottom:127px;`">
|
||
<l-painter-image src="/static/image/other/card/shuiyin2.png" css="width: 97px;height: 28px;" />
|
||
</l-painter-view>
|
||
</l-painter-view>
|
||
</l-painter>
|
||
<l-painter isCanvasToTempFilePath @success="successImage" @progress="progress" css="width:350px;height:552px;"
|
||
v-else-if="data.type == 2">
|
||
<l-painter-view
|
||
:css="`width:350px;height:552px;background-image: url('/static/image/other/certificate/couple/bgImage.png');position: relative;`">
|
||
<l-painter-view :css="`position: absolute;left:39px;top:123px;display: flex;align-items: center;`">
|
||
<l-painter-text :css="data.textCss3" :text="data.graduate.name" />
|
||
<l-painter-image src="/static/image/other/certificate/couple/love.png"
|
||
css="width: 10px;height: 9px;margin: 0 5px;" />
|
||
<l-painter-text :css="data.textCss3" :text="data.graduate.name2" />
|
||
</l-painter-view>
|
||
<l-painter-view :css="`position: absolute;left:39px;top:175px;display: flex;align-items: center;`">
|
||
<l-painter-text :css="data.textCss3" :text="data.graduate.time" />
|
||
</l-painter-view>
|
||
<l-painter-view :css="`position: absolute;left:39px;top:224px;display: flex;align-items: center;`">
|
||
<l-painter-text :css="data.textCss3 + 'width: 180px;'" :text="data.graduate.dec" />
|
||
</l-painter-view>
|
||
<l-painter-view :css="`position: absolute;left:33px;bottom:45px;display: flex;align-items: center;`">
|
||
<l-painter-text :css="data.textCss3 + 'width: 180px;'" :text="'发证时间:' + data.graduate.time" />
|
||
</l-painter-view>
|
||
<l-painter-view :css="`position: absolute;left:33px;bottom:27px;display: flex;align-items: center;`">
|
||
<l-painter-text :css="data.textCss3 + 'width: 180px;'"
|
||
:text="`发证单位:${$isVip() ? '装样大师恋爱委员会' : '幸福恋爱委员会'}`" />
|
||
</l-painter-view>
|
||
<l-painter-view :css="`position: absolute;right:34px;top:93px;`">
|
||
<l-painter-image :src="data.graduate.image" css="width: 160px;height: 110px;" />
|
||
</l-painter-view>
|
||
<l-painter-view :css="`position: absolute;right:19px;top:181px;`">
|
||
<l-painter-image :src="`/static/image/other/certificate/couple/${$isVip() ? 'icon1' : 'icon2'}.png`"
|
||
css="width: 104px;height: 92px;" />
|
||
</l-painter-view>
|
||
<l-painter-view :css="`position: absolute;right:55px;bottom:21px;`">
|
||
<l-painter-qrcode text="http://u8t.cn/QJ?sc=DpK" image="/static/image/other/certificate/couple/image.png"
|
||
css="width: 44px; height: 44px" />
|
||
</l-painter-view>
|
||
<l-painter-view v-if="$isVip()" :css="`position: absolute;left:117px;bottom:127px;`">
|
||
<l-painter-image src="/static/image/other/card/shuiyin2.png" css="width: 97px;height: 28px;" />
|
||
</l-painter-view>
|
||
</l-painter-view>
|
||
</l-painter>
|
||
<l-painter isCanvasToTempFilePath @success="successImage" @progress="progress" css="width:350px;height:552px;"
|
||
v-else-if="data.type == 3">
|
||
<l-painter-view
|
||
:css="`width:350px;height:552px;background-image: url('/static/image/other/certificate/couple/bgImage2.png');position: relative;`">
|
||
<l-painter-view :css="`position: absolute;left:39px;top:123px;display: flex;align-items: center;`">
|
||
<l-painter-text :css="data.textCss3" :text="data.graduate.name" />
|
||
<l-painter-image src="/static/image/other/certificate/couple/noLove.png"
|
||
css="width: 10px;height: 9px;margin: 0 5px;" />
|
||
<l-painter-text :css="data.textCss3" :text="data.graduate.name2" />
|
||
</l-painter-view>
|
||
<l-painter-view :css="`position: absolute;left:39px;top:175px;display: flex;align-items: center;`">
|
||
<l-painter-text :css="data.textCss3" :text="data.graduate.time" />
|
||
</l-painter-view>
|
||
<l-painter-view :css="`position: absolute;left:39px;top:224px;display: flex;align-items: center;`">
|
||
<l-painter-text :css="data.textCss3 + 'width: 180px;'" :text="data.graduate.dec" />
|
||
</l-painter-view>
|
||
<l-painter-view :css="`position: absolute;left:33px;bottom:45px;display: flex;align-items: center;`">
|
||
<l-painter-text :css="data.textCss3 + 'width: 180px;'" :text="'发证时间:' + data.graduate.time" />
|
||
</l-painter-view>
|
||
<l-painter-view :css="`position: absolute;left:33px;bottom:27px;display: flex;align-items: center;`">
|
||
<l-painter-text :css="data.textCss3 + 'width: 180px;'"
|
||
:text="`发证单位:${$isVip() ? '装样大师分手委员会' : '分手快乐委员会'}`" />
|
||
</l-painter-view>
|
||
<l-painter-view :css="`position: absolute;right:34px;top:93px;`">
|
||
<l-painter-image :src="data.graduate.image" css="width: 160px;height: 110px;" />
|
||
</l-painter-view>
|
||
<l-painter-view :css="`position: absolute;right:34px;top:93px;`">
|
||
<l-painter-image src="/static/image/other/certificate/couple/imageDask.png"
|
||
css="width: 160px;height: 110px;" />
|
||
</l-painter-view>
|
||
<l-painter-view :css="`position: absolute;right:19px;top:181px;`">
|
||
<l-painter-image :src="`/static/image/other/certificate/couple/${$isVip() ? 'icon1' : 'icon2'}2.png`"
|
||
css="width: 104px;height: 92px;" />
|
||
</l-painter-view>
|
||
<l-painter-view :css="`position: absolute;right:55px;bottom:21px;`">
|
||
<l-painter-qrcode text="http://u8t.cn/QJ?sc=DpK" image="/static/image/other/certificate/couple/image.png"
|
||
css="width: 44px; height: 44px" />
|
||
</l-painter-view>
|
||
<l-painter-view v-if="$isVip()" :css="`position: absolute;left:117px;bottom:127px;`">
|
||
<l-painter-image src="/static/image/other/card/shuiyin2.png" css="width: 97px;height: 28px;" />
|
||
</l-painter-view>
|
||
</l-painter-view>
|
||
</l-painter>
|
||
<l-painter isCanvasToTempFilePath @success="successImage" @progress="progress" css="width:351px;height:248px;"
|
||
v-else-if="data.type == 4">
|
||
<l-painter-view
|
||
:css="`width:351px;height:248px;background-image: url('/static/image/other/certificate/certificate/bgImg.png');position: relative;`">
|
||
<l-painter-view :css="`position: absolute;left:55px;top:85px;display: flex;align-items: center;`">
|
||
<l-painter-text :css="data.textCss4 +'width:50px;text-align:center;'+data.textFont" :text="data.graduate.name" />
|
||
</l-painter-view>
|
||
<l-painter-view :css="`position: absolute;left:108px;top:85px;display: flex;align-items: center;`">
|
||
<l-painter-text :css="data.textCss4 +data.textFont" :text="data.graduate.title1" />
|
||
</l-painter-view>
|
||
<l-painter-view :css="`position: absolute;left:60px;top:110px;display: flex;align-items: center;`">
|
||
<l-painter-text :css="data.textCss4 +data.textFont" :text="data.graduate.title2" />
|
||
</l-painter-view>
|
||
<l-painter-view :css="`position: absolute;left:60px;bottom:36px;display: flex;align-items: center;`">
|
||
<l-painter-text :css="data.textCss4 +data.textFont" :text="data.graduate.title3" />
|
||
</l-painter-view>
|
||
<l-painter-view :css="`position: absolute;left:0px;top:133px;display: flex;align-items: center;`">
|
||
<l-painter-text :css="data.textCss4 +'width:351px;text-align:center;font-size:36px;color:#E63C00;'+data.textFont"
|
||
:text="data.graduate.dec" />
|
||
</l-painter-view>
|
||
<l-painter-view v-if="$isVip()" :css="`position: absolute;left:117px;bottom:127px;`">
|
||
<l-painter-image src="/static/image/other/card/shuiyin2.png" css="width: 97px;height: 28px;" />
|
||
</l-painter-view>
|
||
</l-painter-view>
|
||
</l-painter>
|
||
<l-painter isCanvasToTempFilePath @success="successImage" @progress="progress" css="width:351px;height:248px;"
|
||
v-else-if="data.type == 5">
|
||
<l-painter-view
|
||
:css="`width:351px;height:248px;background-image: url('/static/image/other/certificate/certificate/bgImg2.png');position: relative;`">
|
||
<l-painter-view :css="`position: absolute;left:60px;top:95px;display: flex;align-items: center;`">
|
||
<l-painter-text :css="data.textCss5 +data.textFont" :text="data.graduate.name" />
|
||
</l-painter-view>
|
||
<l-painter-view :css="`position: absolute;left:60px;top:113px;display: flex;align-items: center;`">
|
||
<l-painter-text :css="data.textCss5 +data.textFont" :text="data.graduate.title1" />
|
||
</l-painter-view>
|
||
<l-painter-view :css="`position: absolute;left:0px;bottom:58px;display: flex;align-items: center;`">
|
||
<l-painter-text :css="data.textCss5 +'width:351px;text-align:center;'+data.textFont" :text="data.graduate.title2" />
|
||
</l-painter-view>
|
||
<l-painter-view :css="`position: absolute;left:0px;top:126px;display: flex;align-items: center;`">
|
||
<l-painter-text :css="data.textCss5 +'width:351px;text-align:center;font-size:36px;color:#F85400;'+data.textFont"
|
||
:text="data.graduate.dec" />
|
||
</l-painter-view>
|
||
<l-painter-view v-if="$isVip()" :css="`position: absolute;left:117px;bottom:127px;`">
|
||
<l-painter-image src="/static/image/other/card/shuiyin2.png" css="width: 97px;height: 28px;" />
|
||
</l-painter-view>
|
||
</l-painter-view>
|
||
</l-painter>
|
||
<l-painter isCanvasToTempFilePath @success="successImage" @progress="progress" css="width:351px;height:248px;"
|
||
v-else-if="data.type == 6">
|
||
<l-painter-view
|
||
:css="`width:351px;height:248px;background-image: url('/static/image/other/certificate/god/bgImg.png');position: relative;`">
|
||
<l-painter-view :css="`position: absolute;left:74px;top:181px;display: flex;align-items: center;`">
|
||
<l-painter-text :css="data.textCss6 +'width:60px;text-align:center;'" :text="data.graduate.name" />
|
||
</l-painter-view>
|
||
<l-painter-view :css="`position: absolute;left:74px;top:204px;display: flex;align-items: center;`">
|
||
<l-painter-text :css="data.textCss6 +'width:60px;text-align:center;'" :text="data.graduate.age" />
|
||
</l-painter-view>
|
||
<l-painter-view :css="`position: absolute;left:161px;top:44px;display: flex;align-items: center;`">
|
||
<l-painter-text :css="data.textCss6 +'width:166px;font-size:11px;'"
|
||
:text="' 兹证明 '+data.graduate.name+' 同志,肤白兹证明貌美,聪颖过人,身材窃窕,婉约温柔,沉鱼落雁,闭月羞花,迷倒一群高富帅,人称“女神”,通过外貌协会权威认证,特发此证。'" />
|
||
</l-painter-view>
|
||
<l-painter-view :css="`position: absolute;left:211px;top:171px;display: flex;align-items: center;`">
|
||
<l-painter-text :css="data.textCss6 " :text="data.graduate.time1" />
|
||
</l-painter-view>
|
||
<l-painter-view :css="`position: absolute;left:211px;top:190px;display: flex;align-items: center;`">
|
||
<l-painter-text :css="data.textCss6 " :text="data.graduate.time2" />
|
||
</l-painter-view>
|
||
<l-painter-view :css="`position: absolute;left:211px;top:208px;display: flex;align-items: center;`">
|
||
<l-painter-text :css="data.textCss6 " :text="'装样大师颜值委员会'" />
|
||
</l-painter-view>
|
||
<l-painter-view :css="`position: absolute;left:60px;top:84px;`">
|
||
<l-painter-image :src="data.graduate.avatar" css="width: 70px;height: 88px;" />
|
||
</l-painter-view>
|
||
<l-painter-view v-if="$isVip()" :css="`position: absolute;left:117px;bottom:127px;`">
|
||
<l-painter-image src="/static/image/other/card/shuiyin2.png" css="width: 97px;height: 28px;" />
|
||
</l-painter-view>
|
||
</l-painter-view>
|
||
</l-painter>
|
||
<l-painter isCanvasToTempFilePath @success="successImage" @progress="progress" css="width:351px;height:248px;"
|
||
v-else-if="data.type == 7">
|
||
<l-painter-view
|
||
:css="`width:351px;height:248px;background-image: url('/static/image/other/certificate/god/bgImg2.png');position: relative;`">
|
||
<l-painter-view :css="`position: absolute;left:74px;top:181px;display: flex;align-items: center;`">
|
||
<l-painter-text :css="data.textCss6 +'width:60px;text-align:center;'" :text="data.graduate.name" />
|
||
</l-painter-view>
|
||
<l-painter-view :css="`position: absolute;left:74px;top:204px;display: flex;align-items: center;`">
|
||
<l-painter-text :css="data.textCss6 +'width:60px;text-align:center;'" :text="data.graduate.age" />
|
||
</l-painter-view>
|
||
<l-painter-view :css="`position: absolute;left:161px;top:44px;display: flex;align-items: center;`">
|
||
<l-painter-text :css="data.textCss6 +'width:166px;font-size:11px;'"
|
||
:text="' 兹证明 '+data.graduate.name+'同志,肤若凝脂,气宇轩昂,聪慧果敢,身形挺拔,温润如玉,才貌双全,迷倒万千少女心,人称“男神”,经颜值与气质协会权威认证,特发此证。'" />
|
||
</l-painter-view>
|
||
<l-painter-view :css="`position: absolute;left:211px;top:171px;display: flex;align-items: center;`">
|
||
<l-painter-text :css="data.textCss6 " :text="data.graduate.time1" />
|
||
</l-painter-view>
|
||
<l-painter-view :css="`position: absolute;left:211px;top:190px;display: flex;align-items: center;`">
|
||
<l-painter-text :css="data.textCss6 " :text="data.graduate.time2" />
|
||
</l-painter-view>
|
||
<l-painter-view :css="`position: absolute;left:211px;top:208px;display: flex;align-items: center;`">
|
||
<l-painter-text :css="data.textCss6 " :text="'装样大师颜值委员会'" />
|
||
</l-painter-view>
|
||
<l-painter-view :css="`position: absolute;left:60px;top:84px;`">
|
||
<l-painter-image :src="data.graduate.avatar" css="width: 70px;height: 88px;" />
|
||
</l-painter-view>
|
||
<l-painter-view v-if="$isVip()" :css="`position: absolute;left:117px;bottom:127px;`">
|
||
<l-painter-image src="/static/image/other/card/shuiyin2.png" css="width: 97px;height: 28px;" />
|
||
</l-painter-view>
|
||
</l-painter-view>
|
||
</l-painter>
|
||
</view>
|
||
<!-- 编辑弹窗 -->
|
||
<view v-if="showEditPopup" class="popup-overlay">
|
||
<view class="popup-content">
|
||
<view class="popup-header">
|
||
<text class="popup-title">编辑证书</text>
|
||
<text class="popup-close" @click="closeEditPopup">×</text>
|
||
</view>
|
||
<view class="popup-body">
|
||
<!-- 毕业证书样式1 -->
|
||
<template v-if="data.type == 0">
|
||
<view class="form-row">
|
||
<text class="form-label">学校:</text>
|
||
<uni-data-select v-model="editForm.type" @change="typeChange" :localdata="data.range"></uni-data-select>
|
||
</view>
|
||
<view class="form-row">
|
||
<text class="form-label">姓名:</text>
|
||
<input class="form-input" v-model="editForm.name" type="text" />
|
||
</view>
|
||
<view class="form-row">
|
||
<text class="form-label">性别:</text>
|
||
<input class="form-input" v-model="editForm.sex" type="text" />
|
||
</view>
|
||
<view class="form-row">
|
||
<text class="form-label">出生日期:</text>
|
||
<input class="form-input" v-model="editForm.birth" type="text" />
|
||
</view>
|
||
<view class="form-row">
|
||
<text class="form-label">入学时间:</text>
|
||
<input class="form-input" v-model="editForm.satrt" type="text" />
|
||
</view>
|
||
<view class="form-row">
|
||
<text class="form-label">毕业时间:</text>
|
||
<input class="form-input" v-model="editForm.end" type="text" />
|
||
</view>
|
||
<view class="form-row">
|
||
<text class="form-label">学院:</text>
|
||
<input class="form-input" v-model="editForm.college" type="text" />
|
||
</view>
|
||
<view class="form-row">
|
||
<text class="form-label">专业:</text>
|
||
<input class="form-input" v-model="editForm.major" type="text" />
|
||
</view>
|
||
<view class="form-row">
|
||
<text class="form-label">证书编号:</text>
|
||
<input class="form-input" v-model="editForm.code" type="text" />
|
||
</view>
|
||
<view class="form-row">
|
||
<text class="form-label">发证时间:</text>
|
||
<input class="form-input" v-model="editForm.time" type="text" />
|
||
</view>
|
||
<view class="form-row">
|
||
<text class="form-label">照片:</text>
|
||
<view class="upload-container">
|
||
<image v-if="editForm.avatar" :src="editForm.avatar" class="upload-image" @click="chooseImage(39,55)" />
|
||
<view v-else class="upload-btn" @click="chooseImage(39,55)">
|
||
<text class="upload-text">点击上传照片</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<!-- 毕业证书样式2 -->
|
||
<template v-else-if="data.type == 1">
|
||
<view class="form-row">
|
||
<text class="form-label">姓名:</text>
|
||
<input class="form-input" v-model="editForm.name" type="text" />
|
||
</view>
|
||
</template>
|
||
|
||
<!-- 情侣证 -->
|
||
<template v-else-if="data.type == 2">
|
||
<view class="form-row">
|
||
<text class="form-label">姓名1:</text>
|
||
<input class="form-input" v-model="editForm.name" type="text" />
|
||
</view>
|
||
<view class="form-row">
|
||
<text class="form-label">姓名2:</text>
|
||
<input class="form-input" v-model="editForm.name2" type="text" />
|
||
</view>
|
||
<view class="form-row">
|
||
<text class="form-label">时间:</text>
|
||
<input class="form-input" v-model="editForm.time" type="text" />
|
||
</view>
|
||
<view class="form-row">
|
||
<text class="form-label">描述:</text>
|
||
<input class="form-input" v-model="editForm.dec" type="text" />
|
||
</view>
|
||
<view class="form-row">
|
||
<text class="form-label">照片:</text>
|
||
<view class="upload-container">
|
||
<image v-if="editForm.image" :src="editForm.image" class="upload-image" @click="chooseImage(160,110)" />
|
||
<view v-else class="upload-btn" @click="chooseImage(160,110)">
|
||
<text class="upload-text">点击上传照片</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<!-- 分手证 -->
|
||
<template v-else-if="data.type == 3">
|
||
<view class="form-row">
|
||
<text class="form-label">姓名1:</text>
|
||
<input class="form-input" v-model="editForm.name" type="text" />
|
||
</view>
|
||
<view class="form-row">
|
||
<text class="form-label">姓名2:</text>
|
||
<input class="form-input" v-model="editForm.name2" type="text" />
|
||
</view>
|
||
<view class="form-row">
|
||
<text class="form-label">时间:</text>
|
||
<input class="form-input" v-model="editForm.time" type="text" />
|
||
</view>
|
||
<view class="form-row">
|
||
<text class="form-label">描述:</text>
|
||
<input class="form-input" v-model="editForm.dec" type="text" />
|
||
</view>
|
||
<view class="form-row">
|
||
<text class="form-label">照片:</text>
|
||
<view class="upload-container">
|
||
<image v-if="editForm.image" :src="editForm.image" class="upload-image" @click="chooseImage(160,110)" />
|
||
<view v-else class="upload-btn" @click="chooseImage(160,110)">
|
||
<text class="upload-text">点击上传照片</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<!-- 奖状样式1 -->
|
||
<template v-else-if="data.type == 4">
|
||
<view class="form-row">
|
||
<text class="form-label">姓名:</text>
|
||
<input class="form-input" v-model="editForm.name" type="text" />
|
||
</view>
|
||
<view class="form-row">
|
||
<text class="form-label">标题1:</text>
|
||
<input class="form-input" v-model="editForm.title1" type="text" />
|
||
</view>
|
||
<view class="form-row">
|
||
<text class="form-label">标题2:</text>
|
||
<input class="form-input" v-model="editForm.title2" type="text" />
|
||
</view>
|
||
<view class="form-row">
|
||
<text class="form-label">标题3:</text>
|
||
<input class="form-input" v-model="editForm.title3" type="text" />
|
||
</view>
|
||
<view class="form-row">
|
||
<text class="form-label">描述:</text>
|
||
<input class="form-input" v-model="editForm.dec" type="text" />
|
||
</view>
|
||
</template>
|
||
|
||
<!-- 奖状样式2 -->
|
||
<template v-else-if="data.type == 5">
|
||
<view class="form-row">
|
||
<text class="form-label">姓名:</text>
|
||
<input class="form-input" v-model="editForm.name" type="text" />
|
||
</view>
|
||
<view class="form-row">
|
||
<text class="form-label">标题1:</text>
|
||
<input class="form-input" v-model="editForm.title1" type="text" />
|
||
</view>
|
||
<view class="form-row">
|
||
<text class="form-label">标题2:</text>
|
||
<input class="form-input" v-model="editForm.title2" type="text" />
|
||
</view>
|
||
<view class="form-row">
|
||
<text class="form-label">描述:</text>
|
||
<input class="form-input" v-model="editForm.dec" type="text" />
|
||
</view>
|
||
</template>
|
||
|
||
<!-- 女神证 -->
|
||
<template v-else-if="data.type == 6">
|
||
<view class="form-row">
|
||
<text class="form-label">姓名:</text>
|
||
<input class="form-input" v-model="editForm.name" type="text" />
|
||
</view>
|
||
<view class="form-row">
|
||
<text class="form-label">年龄:</text>
|
||
<input class="form-input" v-model="editForm.age" type="text" />
|
||
</view>
|
||
<view class="form-row">
|
||
<text class="form-label">照片:</text>
|
||
<view class="upload-container">
|
||
<image v-if="editForm.avatar" :src="editForm.avatar" class="upload-image" @click="chooseImage(70,88)" />
|
||
<view v-else class="upload-btn" @click="chooseImage(70,88)">
|
||
<text class="upload-text">点击上传照片</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="form-row">
|
||
<text class="form-label">时间1:</text>
|
||
<input class="form-input" v-model="editForm.time1" type="text" />
|
||
</view>
|
||
<view class="form-row">
|
||
<text class="form-label">时间2:</text>
|
||
<input class="form-input" v-model="editForm.time2" type="text" />
|
||
</view>
|
||
</template>
|
||
|
||
<!-- 男神证 -->
|
||
<template v-else-if="data.type == 7">
|
||
<view class="form-row">
|
||
<text class="form-label">姓名:</text>
|
||
<input class="form-input" v-model="editForm.name" type="text" />
|
||
</view>
|
||
<view class="form-row">
|
||
<text class="form-label">年龄:</text>
|
||
<input class="form-input" v-model="editForm.age" type="text" />
|
||
</view>
|
||
<view class="form-row">
|
||
<text class="form-label">照片:</text>
|
||
<view class="upload-container">
|
||
<image v-if="editForm.avatar" :src="editForm.avatar" class="upload-image" @click="chooseImage(70,88)" />
|
||
<view v-else class="upload-btn" @click="chooseImage(70,88)">
|
||
<text class="upload-text">点击上传照片</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="form-row">
|
||
<text class="form-label">时间1:</text>
|
||
<input class="form-input" v-model="editForm.time1" type="text" />
|
||
</view>
|
||
<view class="form-row">
|
||
<text class="form-label">时间2:</text>
|
||
<input class="form-input" v-model="editForm.time2" type="text" />
|
||
</view>
|
||
</template>
|
||
</view>
|
||
<view class="popup-footer">
|
||
<button class="btn-cancel" @click="closeEditPopup">取消</button>
|
||
<button class="btn-save" @click="saveEditForm">保存</button>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script setup>
|
||
// 自定义头部
|
||
import ZdyNavbar from "@/components/nav-bar/nav-bar.vue"
|
||
|
||
import {
|
||
ref,
|
||
reactive,
|
||
watch,
|
||
nextTick,
|
||
getCurrentInstance
|
||
} from "vue";
|
||
import {
|
||
onLoad,
|
||
onShow,
|
||
onUnload,
|
||
onReady,
|
||
onPullDownRefresh,
|
||
onReachBottom
|
||
} from "@dcloudio/uni-app";
|
||
const {
|
||
appContext,
|
||
proxy
|
||
} = getCurrentInstance();
|
||
const data = reactive({
|
||
type: 0,
|
||
graduate: {
|
||
type: 0,
|
||
avatar: '',
|
||
title: '/static/image/other/certificate/graduate/title1.png',
|
||
icon: '/static/image/other/certificate/graduate/icon1.png',
|
||
bgImg: '/static/image/other/certificate/graduate/graduate1.png',
|
||
code: "v1ToV631231311",
|
||
name: '某某',
|
||
sex: '男',
|
||
birth: '2000年1月1日',
|
||
satrt: '2019年9月',
|
||
end: '2023年6月',
|
||
college: '计算机科学与技术学院',
|
||
major: '计算机科学与技术专业',
|
||
time: '2023年6月30日'
|
||
},
|
||
range: [{
|
||
"value": 0,
|
||
"text": "五道口职业技术学院"
|
||
}, {
|
||
"value": 1,
|
||
"text": "清华大学"
|
||
}],
|
||
shuaxing: true,
|
||
navbar: {
|
||
title: "证书",
|
||
bgColor: '#EDEDED',
|
||
},
|
||
width: 800,
|
||
height: 600,
|
||
code: '',
|
||
textCss: 'word-spacing: 50px;letter-spacing: 20px;word-spacing: 20px;font-family: "SimSun", "宋体", sans-serif;width:100px;color:#3D3D3D;font-size:4px; mix-blend-mode: overlay;',
|
||
textCssRight: 'word-spacing: 50px;letter-spacing: 20px;word-spacing: 20px;font-family: "SimSun", "宋体", sans-serif;width:100px;color:#3D3D3D;font-size:5px; mix-blend-mode: overlay;',
|
||
textCss2: 'word-spacing: 50px;letter-spacing: 20px;word-spacing: 20px;font-family: "宋体", sans-serif;width:100px;color:#3D3D3D;font-size:5.2px; mix-blend-mode: overlay;',
|
||
textCss3: 'word-spacing: 50px;letter-spacing: 20px;word-spacing: 20px;font-family: "宋体", sans-serif;color:#3D3D3D;font-size:12px; mix-blend-mode: overlay;',
|
||
textCss4: 'font-weight: bold;font-family: "宋体", sans-serif;color:#3D3D3D;font-size:13px; mix-blend-mode: overlay;',
|
||
textCss5: 'font-weight: bold;font-family: "宋体", sans-serif;color:#3D3D3D;font-size:13px; mix-blend-mode: overlay;',
|
||
textCss6: 'font-weight: bold;font-family: "宋体", sans-serif;color:#3D3D3D;font-size:10px; mix-blend-mode: overlay;',
|
||
textCss7: 'font-weight: bold;font-family: "宋体", sans-serif;color:#3D3D3D;font-size:13px; mix-blend-mode: overlay;',
|
||
textFont:'font-family:"certificate";',
|
||
textCssLeft: 'text-align: left;',
|
||
textCssCenter: 'text-align: center;',
|
||
typeList: [
|
||
'毕业证书样式1',
|
||
'毕业证书样式2',
|
||
'情侣证',
|
||
'分手证',
|
||
'奖状样式1',
|
||
'奖状样式2',
|
||
'女神证',
|
||
'男神证',
|
||
]
|
||
})
|
||
|
||
// 弹窗相关
|
||
const showEditPopup = ref(false);
|
||
const editForm = ref({});
|
||
onLoad((option) => {
|
||
uni.showLoading({
|
||
title: "生成中"
|
||
})
|
||
// 进入毕业证书页面埋点
|
||
proxy.$apiUserEvent('all', {
|
||
type: 'event',
|
||
key: 'certificate',
|
||
prefix: '.uni.other.',
|
||
value: "证书"
|
||
})
|
||
let graduateData = uni.getStorageSync("graduateData")
|
||
if (graduateData) {
|
||
data.graduate = graduateData
|
||
}
|
||
uni.$on("editFormPhoto", (info) => {
|
||
data.code = ""
|
||
if(data.type==2||data.type==3){
|
||
editForm.value.image = info;
|
||
}else{
|
||
editForm.value.avatar = info;
|
||
}
|
||
// editForm.value.avatar = info;
|
||
// data.graduate.avatar = info;
|
||
})
|
||
const config = uni.getStorageSync('config')
|
||
console.log("---config---", config);
|
||
const font = config.config['client.uniapp.font']
|
||
|
||
console.log("字体地址信息", font.certificate);
|
||
// Font loading logic
|
||
const fontUrl = font.certificate;
|
||
const fontName = 'certificate';
|
||
|
||
const loadFont = (path) => {
|
||
uni.loadFontFace({
|
||
family: fontName,
|
||
source: `url("${path}")`,
|
||
success() {
|
||
console.log('字体加载成功');
|
||
},
|
||
fail(err) {
|
||
console.error('字体加载失败', err);
|
||
}
|
||
});
|
||
};
|
||
|
||
// #ifdef H5
|
||
// H5 环境直接从 URL 加载字体
|
||
loadFont(fontUrl);
|
||
// #endif
|
||
|
||
// #ifndef H5
|
||
// 非 H5 环境使用下载和保存逻辑
|
||
const savedFontPath = uni.getStorageSync(' ');
|
||
if (savedFontPath) {
|
||
loadFont(savedFontPath);
|
||
} else {
|
||
uni.downloadFile({
|
||
url: fontUrl,
|
||
success: (res) => {
|
||
if (res.statusCode === 200) {
|
||
uni.saveFile({
|
||
tempFilePath: res.tempFilePath,
|
||
success: (saveRes) => {
|
||
const savedPath = saveRes.savedFilePath;
|
||
uni.setStorageSync('certificate_font_path', savedPath);
|
||
console.log("字体保存路径", savedPath);
|
||
loadFont(savedPath);
|
||
},
|
||
fail: (err) => {
|
||
console.error('保存文件失败', err);
|
||
// Fallback: 尝试加载临时路径
|
||
loadFont(res.tempFilePath);
|
||
}
|
||
});
|
||
}
|
||
},
|
||
fail: (err) => {
|
||
console.error('下载字体失败', err);
|
||
}
|
||
});
|
||
}
|
||
// #endif
|
||
})
|
||
onUnload(() => {
|
||
uni.$off('editFormPhoto')
|
||
})
|
||
onReady(() => {
|
||
|
||
})
|
||
onShow(() => {})
|
||
onPullDownRefresh(() => {
|
||
setTimeout(() => {
|
||
uni.stopPullDownRefresh();
|
||
}, 1000);
|
||
})
|
||
onReachBottom(() => {
|
||
|
||
})
|
||
|
||
function setType(index) {
|
||
uni.showLoading({
|
||
title: "生成中"
|
||
})
|
||
data.type = index
|
||
if (index == 0 || index == 1) {
|
||
let graduateData = uni.getStorageSync("graduateData") || {
|
||
type: 0,
|
||
avatar: '',
|
||
title: '/static/image/other/certificate/graduate/title1.png',
|
||
icon: '/static/image/other/certificate/graduate/icon1.png',
|
||
bgImg: '/static/image/other/certificate/graduate/graduate1.png',
|
||
code: "v1ToV631231311",
|
||
name: '某某',
|
||
sex: '男',
|
||
birth: '2000年1月1日',
|
||
satrt: '2019年9月',
|
||
end: '2023年6月',
|
||
college: '计算机科学与技术学院',
|
||
major: '计算机科学与技术专业',
|
||
time: '2023年6月30日'
|
||
}
|
||
data.graduate = graduateData
|
||
} else if (index == 2) {
|
||
let graduateData = uni.getStorageSync("graduateData2") || {
|
||
name: '熊大',
|
||
name2: "光头强",
|
||
time: "2026年5月20日",
|
||
image: "/static/image/other/certificate/couple/image.png",
|
||
dec: '手牵手不走散 你是我心中的 No.1'
|
||
}
|
||
data.graduate = graduateData
|
||
} else if (index == 3) {
|
||
let graduateData = uni.getStorageSync("graduateData3") || {
|
||
name: '熊大',
|
||
name2: "光头强",
|
||
time: "2026年5月20日",
|
||
image: "/static/image/other/certificate/couple/image.png",
|
||
dec: '谢谢你的出现,让遗憾的是,我们终究没能走到最后。'
|
||
}
|
||
data.graduate = graduateData
|
||
} else if (index == 4) {
|
||
let graduateData = uni.getStorageSync("graduateData4") || {
|
||
name: '熊大',
|
||
title1: '宝宝',
|
||
title2: '恭喜你在本年度被评为:',
|
||
title3: '特发此证 以资鼓励',
|
||
dec: '拉屎大王'
|
||
}
|
||
data.graduate = graduateData
|
||
} else if (index == 5) {
|
||
let graduateData = uni.getStorageSync("graduateData5") || {
|
||
name: '熊大',
|
||
title1: '恭喜你在本年度被评为:',
|
||
title2: '特发此证 以资鼓励',
|
||
dec: '干饭大王'
|
||
}
|
||
data.graduate = graduateData
|
||
} else if (index == 6) {
|
||
let graduateData = uni.getStorageSync("graduateData6") || {
|
||
name: '朱碧石',
|
||
age: '男',
|
||
avatar: '/static/image/other/certificate/god/image1.png',
|
||
time1: '长期有效',
|
||
time2: '2026年4月14日'
|
||
}
|
||
data.graduate = graduateData
|
||
} else if (index == 7) {
|
||
let graduateData = uni.getStorageSync("graduateData7") || {
|
||
name: '良子',
|
||
age: '男',
|
||
avatar: '/static/image/other/certificate/god/image2.png',
|
||
time1: '长期有效',
|
||
time2: '2026年4月14日'
|
||
}
|
||
data.graduate = graduateData
|
||
}
|
||
}
|
||
|
||
function typeChange(e) {
|
||
console.log(e);
|
||
if (e) {
|
||
editForm.value.title = '/static/image/other/certificate/graduate/title2.png';
|
||
editForm.value.icon = '/static/image/other/certificate/graduate/icon2.png';
|
||
} else {
|
||
editForm.value.title = '/static/image/other/certificate/graduate/title1.png';
|
||
editForm.value.icon = '/static/image/other/certificate/graduate/icon1.png';
|
||
}
|
||
}
|
||
|
||
function successImage(e) {
|
||
data.code = e
|
||
uni.hideLoading()
|
||
}
|
||
|
||
function progress(e) {
|
||
// console.log(e)
|
||
|
||
}
|
||
// 打开编辑弹窗
|
||
function edit() {
|
||
console.log(data.graduate)
|
||
// 复制当前表单数据到编辑表单
|
||
editForm.value = JSON.parse(JSON.stringify(data.graduate));
|
||
// 显示弹窗
|
||
showEditPopup.value = true;
|
||
}
|
||
|
||
// 关闭编辑弹窗
|
||
function closeEditPopup() {
|
||
showEditPopup.value = false;
|
||
}
|
||
|
||
// 保存编辑表单
|
||
function saveEditForm() {
|
||
uni.showLoading({
|
||
title: "生成中"
|
||
})
|
||
data.shuaxing = false
|
||
// 将编辑后的数据复制回原始表单
|
||
data.graduate = editForm.value
|
||
setTimeout(() => {
|
||
data.shuaxing = true
|
||
}, 100)
|
||
uni.setStorageSync(["graduateData", "graduateData", "graduateData2", "graduateData3", "graduateData4",
|
||
"graduateData5", "graduateData6", "graduateData7"
|
||
][data.type], data.graduate)
|
||
// 关闭弹窗
|
||
showEditPopup.value = false;
|
||
}
|
||
|
||
// 选择图片
|
||
function chooseImage(width,height) {
|
||
uni.chooseImage({
|
||
count: 1,
|
||
sizeType: ['original', 'compressed'],
|
||
sourceType: ['album', 'camera'],
|
||
success: (res) => {
|
||
uni.navigateTo({
|
||
url: '/pages/other/qf-image/qf-image?src=' + res.tempFilePaths[0]+'&width='+width+'&height='+height
|
||
})
|
||
},
|
||
fail: (err) => {
|
||
console.log('选择图片失败', err);
|
||
}
|
||
});
|
||
}
|
||
|
||
|
||
/**
|
||
* 将本地图片路径通过 Canvas 转换为 File 对象
|
||
* @param {string} localPath - 本地图片路径(如从 uni.chooseImage 获取的 tempFilePath)
|
||
* @param {Object} options - 可选参数
|
||
* @param {string} options.format - 输出格式 'image/png' 或 'image/jpeg',默认 'image/png'
|
||
* @param {number} options.quality - 图片质量(仅 jpeg 有效),0~1,默认 0.92
|
||
* @param {number} options.maxWidth - 最大宽度(等比缩放),不填则使用原图尺寸
|
||
* @param {number} options.maxHeight - 最大高度(等比缩放),不填则使用原图尺寸
|
||
* @returns {Promise<File>} 返回一个 Promise,resolve 为 File 对象
|
||
*/
|
||
function convertLocalImageToFile(localPath) {
|
||
return new Promise((resolve, reject) => {
|
||
// 1. 读取本地图片为 Base64(避免 Image 对象直接加载本地路径的兼容问题)
|
||
plus.io.resolveLocalFileSystemURL(localPath, (entry) => {
|
||
entry.file((file) => {
|
||
const reader = new plus.io.FileReader();
|
||
reader.onload = (e) => {
|
||
const base64Data = e.target.result; // 格式如 data:image/jpeg;base64,/9j/...
|
||
resolve(e.target.result)
|
||
};
|
||
reader.onerror = (err) => reject(err);
|
||
reader.readAsDataURL(file); // 读取为 DataURL
|
||
}, reject);
|
||
}, reject);
|
||
|
||
});
|
||
}
|
||
// 预览图片
|
||
function previewImage() {
|
||
if (data.code) {
|
||
uni.previewImage({
|
||
urls: [data.code],
|
||
current: 0
|
||
});
|
||
}
|
||
}
|
||
|
||
// 保存图片
|
||
function saveImage() {
|
||
if (data.code) {
|
||
console.log(data.code)
|
||
uni.showLoading({
|
||
title: '保存中...'
|
||
});
|
||
try {
|
||
// 检查是否为base64格式
|
||
if (data.code.startsWith('data:image')) {
|
||
// 处理base64格式图片
|
||
console.log('开始处理base64图片');
|
||
uni.base64ToTempFile({
|
||
base64: data.code.split(',')[1], // 去除base64前缀
|
||
success: (res) => {
|
||
console.log('base64转换成功', res);
|
||
if (res.tempFilePath) {
|
||
uni.saveImageToPhotosAlbum({
|
||
filePath: res.tempFilePath,
|
||
success: () => {
|
||
console.log('保存图片成功');
|
||
uni.hideLoading();
|
||
uni.showToast({
|
||
title: '保存成功',
|
||
icon: 'success'
|
||
});
|
||
},
|
||
fail: (err) => {
|
||
console.log('保存图片失败', err);
|
||
uni.hideLoading();
|
||
uni.showToast({
|
||
title: '保存失败',
|
||
icon: 'none'
|
||
});
|
||
}
|
||
});
|
||
} else {
|
||
console.log('base64转换失败,无临时文件路径');
|
||
uni.hideLoading();
|
||
uni.showToast({
|
||
title: '转换失败',
|
||
icon: 'none'
|
||
});
|
||
}
|
||
},
|
||
fail: (err) => {
|
||
console.log('base64转换失败', err);
|
||
uni.hideLoading();
|
||
uni.showToast({
|
||
title: '转换失败',
|
||
icon: 'none'
|
||
});
|
||
}
|
||
});
|
||
} else if (data.code.startsWith('_') || data.code.includes('temp') || data.code.includes('cache') || data
|
||
.code.includes('_doc') || data.code.includes('_tmp')) {
|
||
// 处理本地临时文件
|
||
console.log('开始处理本地临时文件');
|
||
uni.saveImageToPhotosAlbum({
|
||
filePath: data.code,
|
||
success: () => {
|
||
console.log('保存本地文件成功');
|
||
uni.hideLoading();
|
||
uni.showToast({
|
||
title: '保存成功',
|
||
icon: 'success'
|
||
});
|
||
},
|
||
fail: (err) => {
|
||
console.log('保存本地文件失败', err);
|
||
uni.hideLoading();
|
||
uni.showToast({
|
||
title: '保存失败',
|
||
icon: 'none'
|
||
});
|
||
}
|
||
});
|
||
} else {
|
||
// 处理网络图片
|
||
console.log('开始处理网络图片');
|
||
uni.downloadFile({
|
||
url: data.code,
|
||
success: (res) => {
|
||
console.log('下载图片成功', res);
|
||
if (res.statusCode === 200 && res.tempFilePath) {
|
||
uni.saveImageToPhotosAlbum({
|
||
filePath: res.tempFilePath,
|
||
success: () => {
|
||
console.log('保存图片成功');
|
||
uni.hideLoading();
|
||
uni.showToast({
|
||
title: '保存成功',
|
||
icon: 'success'
|
||
});
|
||
},
|
||
fail: (err) => {
|
||
console.log('保存图片失败', err);
|
||
uni.hideLoading();
|
||
uni.showToast({
|
||
title: '保存失败',
|
||
icon: 'none'
|
||
});
|
||
}
|
||
});
|
||
} else {
|
||
console.log('下载图片失败,状态码:', res.statusCode);
|
||
uni.hideLoading();
|
||
uni.showToast({
|
||
title: '下载失败',
|
||
icon: 'none'
|
||
});
|
||
}
|
||
},
|
||
fail: (err) => {
|
||
console.log('下载图片失败', err);
|
||
uni.hideLoading();
|
||
uni.showToast({
|
||
title: '下载失败',
|
||
icon: 'none'
|
||
});
|
||
}
|
||
});
|
||
}
|
||
} catch (error) {
|
||
console.log('保存图片异常', error);
|
||
uni.hideLoading();
|
||
uni.showToast({
|
||
title: '保存失败',
|
||
icon: 'none'
|
||
});
|
||
}
|
||
} else {
|
||
uni.showToast({
|
||
title: '暂无图片可保存',
|
||
icon: 'none'
|
||
});
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss">
|
||
page {
|
||
background-color: #ededed;
|
||
}
|
||
|
||
.box {
|
||
width: 750rpx;
|
||
height: 500rpx;
|
||
background-image: url('/static/image/other/certificate/graduate/graduate1.png');
|
||
background-repeat: no-repeat;
|
||
background-size: 100% 100%;
|
||
position: relative;
|
||
|
||
.title {
|
||
position: absolute;
|
||
width: 288rpx;
|
||
height: 36rpx;
|
||
display: flex;
|
||
justify-content: center;
|
||
align-items: center;
|
||
left: 92rpx;
|
||
top: 134rpx;
|
||
|
||
image {
|
||
height: 36rpx;
|
||
}
|
||
}
|
||
|
||
.icon {
|
||
position: absolute;
|
||
width: 108rpx;
|
||
height: 108rpx;
|
||
display: flex;
|
||
justify-content: center;
|
||
align-items: center;
|
||
right: 82rpx;
|
||
bottom: 124rpx;
|
||
|
||
image {
|
||
height: 108rpx;
|
||
}
|
||
}
|
||
}
|
||
|
||
@font-face {
|
||
font-family: "card";
|
||
src: url("/static/font/card.ttf");
|
||
}
|
||
|
||
* {
|
||
box-sizing: content-box;
|
||
}
|
||
|
||
.aadadad {
|
||
text-align: center;
|
||
}
|
||
|
||
.heiti {
|
||
font-family: "SimHei", "Microsoft YaHei", sans-serif;
|
||
}
|
||
|
||
/* 弹窗样式 */
|
||
.popup-overlay {
|
||
position: fixed;
|
||
top: 0;
|
||
left: 0;
|
||
right: 0;
|
||
bottom: 0;
|
||
background-color: rgba(0, 0, 0, 0.5);
|
||
display: flex;
|
||
justify-content: center;
|
||
align-items: center;
|
||
z-index: 9999;
|
||
}
|
||
|
||
.popup-content {
|
||
background-color: #fff;
|
||
border-radius: 10px;
|
||
width: 90%;
|
||
max-width: 500px;
|
||
max-height: 80vh;
|
||
overflow-y: auto;
|
||
}
|
||
|
||
.popup-header {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
padding: 20rpx;
|
||
border-bottom: 1rpx solid #eee;
|
||
}
|
||
|
||
.popup-title {
|
||
font-size: 32rpx;
|
||
font-weight: bold;
|
||
color: #333;
|
||
}
|
||
|
||
.popup-close {
|
||
font-size: 48rpx;
|
||
color: #999;
|
||
cursor: pointer;
|
||
}
|
||
|
||
.popup-body {
|
||
padding: 20rpx;
|
||
}
|
||
|
||
.form-section {
|
||
margin-bottom: 30rpx;
|
||
padding: 20rpx;
|
||
background-color: #f5f5f5;
|
||
border-radius: 8rpx;
|
||
}
|
||
|
||
.section-title {
|
||
font-size: 28rpx;
|
||
font-weight: bold;
|
||
color: #333;
|
||
margin-bottom: 20rpx;
|
||
display: block;
|
||
}
|
||
|
||
.form-row {
|
||
display: flex;
|
||
align-items: center;
|
||
margin-bottom: 20rpx;
|
||
}
|
||
|
||
.form-label {
|
||
width: 200rpx;
|
||
font-size: 26rpx;
|
||
color: #333;
|
||
}
|
||
|
||
.form-input {
|
||
flex: 1;
|
||
padding: 15rpx;
|
||
border: 1rpx solid #ddd;
|
||
border-radius: 4rpx;
|
||
font-size: 26rpx;
|
||
}
|
||
|
||
.form-separator {
|
||
margin: 0 10rpx;
|
||
font-size: 26rpx;
|
||
color: #333;
|
||
}
|
||
|
||
.form-total {
|
||
margin-top: 10rpx;
|
||
padding-top: 10rpx;
|
||
border-top: 1rpx dashed #ddd;
|
||
}
|
||
|
||
.form-total-input {
|
||
background-color: #f9f9f9;
|
||
color: #ff6b35;
|
||
font-weight: bold;
|
||
}
|
||
|
||
/* 上传图片样式 */
|
||
.upload-container {
|
||
flex: 1;
|
||
position: relative;
|
||
}
|
||
|
||
.upload-btn {
|
||
width: 120rpx;
|
||
height: 160rpx;
|
||
border-radius: 8rpx;
|
||
border: 1rpx dashed #ddd;
|
||
display: flex;
|
||
justify-content: center;
|
||
align-items: center;
|
||
background-color: #f5f5f5;
|
||
}
|
||
|
||
.upload-text {
|
||
font-size: 22rpx;
|
||
color: #999;
|
||
text-align: center;
|
||
}
|
||
|
||
.upload-image {
|
||
width: 98rpx;
|
||
height: 115rpx;
|
||
border-radius: 1rpx;
|
||
object-fit: cover;
|
||
border: 1px dashed #ddd;
|
||
}
|
||
|
||
.popup-footer {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
padding: 20rpx;
|
||
border-top: 1rpx solid #eee;
|
||
}
|
||
|
||
.btn-cancel,
|
||
.btn-save {
|
||
width: calc(48% - 40rpx);
|
||
padding: 20rpx;
|
||
border-radius: 4rpx;
|
||
font-size: 28rpx;
|
||
}
|
||
|
||
.btn-cancel {
|
||
background-color: #f5f5f5;
|
||
color: #333;
|
||
// border: 1rpx solid #ddd;
|
||
}
|
||
|
||
.btn-save {
|
||
background-color: #187AFF;
|
||
color: #fff;
|
||
border: none;
|
||
|
||
}
|
||
|
||
/* 保存图片按钮 */
|
||
.button-container {
|
||
display: flex;
|
||
justify-content: center;
|
||
padding: 30rpx 0;
|
||
}
|
||
|
||
.btn-save-image {
|
||
background: linear-gradient(90deg, #187AFF 0%, #3295FC 100%);
|
||
color: #fff;
|
||
border: none;
|
||
padding: 18rpx 60rpx;
|
||
border-radius: 50rpx;
|
||
font-size: 26rpx;
|
||
font-weight: bold;
|
||
box-shadow: 0 3rpx 10rpx rgba(7, 66, 193, 0.3);
|
||
transition: all 0.3s ease;
|
||
text-align: center;
|
||
min-width: 160rpx;
|
||
}
|
||
|
||
.btn-save-image:hover {
|
||
transform: translateY(-2rpx);
|
||
box-shadow: 0 4rpx 12rpx rgba(7, 72, 193, 0.4);
|
||
}
|
||
|
||
.btn-save-image:active {
|
||
transform: translateY(0);
|
||
box-shadow: 0 2rpx 6rpx rgba(7, 140, 193, 0.3);
|
||
}
|
||
|
||
.footer-btn {
|
||
width: 100vw;
|
||
overflow-x: auto;
|
||
white-space: nowrap;
|
||
|
||
.footer-box {
|
||
display: inline-flex;
|
||
padding: 10rpx 0;
|
||
|
||
.btn {
|
||
padding: 8rpx 10rpx;
|
||
background: #FFFFFF;
|
||
border-radius: 12px;
|
||
text-align: center;
|
||
margin: 0 24rpx;
|
||
color: #767676;
|
||
font-size: 12px;
|
||
// border: 2px solid #FFFFFF;
|
||
min-width: 120rpx;
|
||
}
|
||
|
||
.active {
|
||
color: #1777FF;
|
||
// border: 2px solid #1777FF;
|
||
}
|
||
}
|
||
|
||
|
||
}
|
||
</style> |