lhl 3 年 前
コミット
2a0ec21781

+ 25 - 58
pages.json

@@ -1,13 +1,8 @@
 {	
 	"easycom": {
-		// 下载安装的方式需要前面的"@/",npm安装的方式无需"@/"
-		// 下载安装方式
-		// "^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue"
-		// npm安装方式
 		"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
 	},
-	"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
-
+	"pages": [
 		{
 			"path": "pages/index/index",
 
@@ -47,20 +42,6 @@
 				"navigationBarTitleText": "公安县红十字会安心捐赠"
 			}
 		},
-		{
-			"path": "pages/form/donateList",
-			"style": {
-				// #ifndef MP
-				"app-plus": {
-					"titleNView": false
-				},
-				// #endif
-				"navigationBarBackgroundColor": "#457DBF",
-				"navigationBarTextStyle": "white",
-				"navigationBarTitleText": "公安县红十字会安心捐赠"
-			}
-		},
-		// donaSuccess
 		{
 			"path": "pages/form/donaSuccess",
 			"style": {
@@ -166,7 +147,6 @@
 				"navigationBarTitleText": "孝感红十字会安心捐赠"
 			}
 		},
-		// teamSign  perSign  donateLove  donateList myDonate
 		{
 			"path": "pages/applic/teamSign",
 			"style": {
@@ -206,17 +186,17 @@
 				"navigationBarTitleText": "定位"
 			}
 		},
-		{
-			"path": "pages/applic/tocontrilist",
-			"style": {
-				// #ifndef MP
-				"app-plus": {
-					"titleNView": false
-				},
-				// #endif
-				"navigationBarTitleText": "孝感红十字会"
-			}
-		},
+		// {
+		// 	"path": "pages/applic/tocontrilist",
+		// 	"style": {
+		// 		// #ifndef MP
+		// 		"app-plus": {
+		// 			"titleNView": false
+		// 		},
+		// 		// #endif
+		// 		"navigationBarTitleText": "孝感红十字会"
+		// 	}
+		// },
 		{
 			"path": "pages/applic/applicList",
 			"style": {
@@ -377,32 +357,19 @@
 				"navigationBarTitleText": "报名成功"
 			}
 		},
-		{
-			"path": "pages/applic/tohelpActi",
-			"style": {
-				// #ifndef MP
-				"app-plus": {
-					"titleNView": false
-				},
-				// #endif
-				"navigationBarBackgroundColor": "#457DBF",
-				"navigationBarTextStyle": "white",
-				"navigationBarTitleText": "人道救助"
-			}
-		},
-		{
-			"path": "pages/applic/toOrgan",
-			"style": {
-				// #ifndef MP
-				"app-plus": {
-					"titleNView": false
-				},
-				// #endif
-				"navigationBarBackgroundColor": "#457DBF",
-				"navigationBarTextStyle": "white",
-				"navigationBarTitleText": "器官捐献"
-			}
-		},
+		// {
+		// 	"path": "pages/applic/toOrgan",
+		// 	"style": {
+		// 		// #ifndef MP
+		// 		"app-plus": {
+		// 			"titleNView": false
+		// 		},
+		// 		// #endif
+		// 		"navigationBarBackgroundColor": "#457DBF",
+		// 		"navigationBarTextStyle": "white",
+		// 		"navigationBarTitleText": "器官捐献"
+		// 	}
+		// },
 		{
 			"path": "pages/applic/appliSystem",
 			"style": {

+ 0 - 11
pages/applic/toOrgan.vue

@@ -22,17 +22,6 @@
 					</view>
 				</navigator>		
 			</view>
-			<!-- <view class="box-1">
-				<navigator url="/pages/applic/applic">
-					<view class="img">
-						<image src="../../static/img/spread.png"></image>
-					</view>
-					<view class="title">
-						造血干细胞入库申请表
-					</view>
-				</navigator>
-				
-			</view> -->
 		</view>
 	</view>
 </template>

+ 0 - 91
pages/applic/tohelpActi.vue

@@ -1,91 +0,0 @@
-<template>
-	<view class="content">
-		<view class="box">
-			<view class="box-1">
-				为大力弘扬“人道、博爱、奉献”的红十字精神,积极发挥红十字会在保障和改善民生、建设和谐社会方面政府助手的作用,中国红十字会把救助因自然灾害、意外伤害事故、重特大疾病及其他原因造成基本生活和生存条件出现重大困难的贫困城乡居民作为协助政府推进建设和谐社会的重要内容,积极向社会开展募捐,向贫困家庭、弱势群体提供必要的人道救助。
-			</view>
-			<view class="box-1">
-				人道救助工作是中国红十字会面向困难群体开展的一项常规工作,是政府社会救助工作的重要补充,是红十字会在新时期参与社会管理的一项重要内容。重点关注人的生命和健康,以弱势群体为主要工作对象,以特色项目为载体,通过募集资金和物资,开展健康促进、大病救助、博爱援建、扶贫帮困、捐资助学等经常性的人道救助工作,并结合实际,兴办医疗、康复、养老等符合红十字会宗旨的社会公益事业。
-			</view>
-			<view class="box-2">
-				<image src="../../static/img/imgs02.png" mode=""></image>
-			</view>
-			<view class="box-1">
-				2019年全国两会,“人道救助”首次写入国务院《政府工作报告》,成为政府引导支持健康发展的一项事业,这对全国各级红十字组织和广大红十字工作者是极大的精神鼓舞和信心提振。人道救助作为一个独立概念,与慈善事业并列,表明人道理念与慈善精神、人道行动与慈善行为有所区分,凸显了人道救助的独特性。
-			</view>
-			<!-- <view class="box-3">
-				红十字会人道救助工作主要开展以下几类项目:
-			</view> -->
-		<!-- 	<view class="box-4">
-				1.大病医疗救助:对患有先天性心脏病、白血病等重特大疾病的贫困患者给予救助。
-			</view>
-			<view class="box-4">
-				2.心理支持:对因自然灾害、意外伤害事故、重大疾病等原因造成的精神伤害的弱势人群提供人道关怀和心理辅导。
-			</view>
-			<view class="box-4">
-				3.生活救助:对因自然灾害、意外伤害事故、重大疾病等原因造成的生活困难人群提供救助,对生活困难的学生提供资助。
-			</view>
-			<view class="box-4">
-				4.博爱援建:对经济欠发达地区及受灾地区开展民房和公共设施援建。
-			</view>
-			<view class="box-4">
-				5.生计救助:对城乡贫困人群提供种植、养殖、加工等技能培训和项目支持。
-			</view>
-			<view class="box-4">
-				6.福利事业:兴办康复、养老、医疗等非营利性实体,为孤老残疾等弱势群体提供服务。因人道救助项目涉及面广,具体申请人可根据实际情况,通过直接登录各级红十字会网站,或者直接联系各级红十字会进行申请。
-			</view> -->
-			<view class="box-5">
-				{{$store.state.baseName}}十字会人道救助联系电话:
-			</view>
-			<view class="phone">
-				********
-			</view>
-		</view>
-	</view>
-</template>
-
-<script>
-</script>
-
-<style lang="scss">
-	.content{
-		.box{
-			.box-1{
-				padding: 16rpx 16rpx 0;
-				text-indent:66rpx;
-				color: #333;
-				font-size: 32rpx;
-			}
-			.box-2{
-				width: 100%;
-				height: 421rpx;
-				margin-top: 16rpx;
-				image{
-					width: 100%;
-					height: 421rpx;
-				}
-			}
-			.box-3{
-				font-size: 32rpx;
-				text-indent:44rpx;
-				color: #333;
-				padding: 24rpx 16rpx 16rpx;
-			}
-			.box-4{
-				font-size: 32rpx;
-				text-indent:44rpx;
-				color: #333;
-				padding: 14rpx 16rpx 0;
-			}
-			.box-5{
-				padding: 24rpx 16rpx 0;
-			}
-			.phone{
-				color: #ba2c29;
-				display: flex;
-				justify-content: center;
-				padding-bottom:24rpx;
-			}
-		}
-	}
-</style>

+ 541 - 587
pages/form/certificates.vue

@@ -1,588 +1,542 @@
-<template>
-	<view class="content">
-		<view class="team" v-if="!is_over">
-			<empty></empty>
-		</view>
-		<view class="certificates" v-if='is_over'>
-			
-			<canvas v-if="showcanvas" id="qrShareBox" canvas-id="qrShareBox" class="tki-qrcode-canvas" />
-			<image class="imgbox" v-else :src="img" mode=" aspectFill"></image>
-		</view>
-
-	</view>
-</template>
-<script>
-import { get_training, sign_training, detail_training} from '@/api/train.js';
-import jyfParser from "@/components/jyf-parser/jyf-parser";
-import {
-		weixindata,
-		weixinlocation
-	} from '@/utils/wxAuthorized.js';
-		import empty from '@/components/empty';
-	import {
-		userinfo
-	} from '@/api/user.js';
-	import {
-		mapState,
-		mapMutations
-	} from 'vuex';
-export default {
-	components: {
-		empty,
-	  jyfParser
-	 },
-	data() {
-		return {
-			is_over:1,
-			type:'',//0是个人报名,1是团体报名
-			id:'',
-			description:'',
-			list:'',
-			//个人
-			name:'',
-			phone:'',
-			addr:'',
-			work:'',
-			//团队
-			company:'',
-			address:'',
-			companyName:'',
-			companyphone:'',
-			num:'',
-			people:'神农架林区红十字会',
-			signDate:'',
-			loading: true, //是否载入图片中
-			size: 180,
-			ratio: 1, //页面比例用于计算
-			canHeight: '',
-			canWeidth: '',
-			url:'',
-			img:'',
-			showcanvas:true,
-			uid:''
-		};
-	},
-	onLoad(option) {
-		this.type = option.type;
-		this.id = option.id;
-		this.IndexShare();
-		this.loadData();
-		
-	},
-	onReady() {
-		detail_training({
-			id:this.id,
-		}).then(({data}) => {
-			console.log(999,data)
-			this.name = data.name
-			this.signDate = data.add_time
-			this.is_over = data.is_over
-		console.log(3,data.add_time)
-		let obj = this;
-		let name = obj.name
-		let signDate = obj.signDate
-	
-		function getRecTime(timestamp, fmt) {
-			let d = new Date(timestamp * 1000)
-				// f = fmt || 'yyyy/MM/dd', 
-			let	f = fmt || 'yyyy.MM.dd'
-			let	o = {
-					'M+': d.getMonth() + 1, //月份 
-					'd+': d.getDate(), //日 
-					'h+': d.getHours(), //小时 
-					'm+': d.getMinutes(), //分 
-					's+': d.getSeconds(), //秒 
-					'q+': Math.floor((d.getMonth() + 3) / 3), //季度 
-					'S': d.getMilliseconds() //毫秒 
-				};
-			if (/(y+)/.test(f)) {
-				f = f.replace(RegExp.$1, (d.getFullYear() + '').substr(4 - RegExp.$1.length));
-			}
-			for (let k in o) {
-				if (new RegExp('(' + k + ')').test(f)) {
-					f = f.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)));
-				}
-			}
-			return f;
-			console.log(f)
-		}
-		let m = getRecTime(signDate)
-		let query = uni.createSelectorQuery();
-		// this.loadData();
-		// 获取页面比例
-		query
-			.select('.certificates')
-			.fields({
-					size: true
-				},
-				e => {
-					console.log('获取页面比例',e)
-					// 保存比例
-					this.ratio = e.width / 750;
-				}
-			)
-			.exec();
-		// 获取画布宽高信息
-		query
-			.select('#qrShareBox')
-			.fields({
-					size: true
-				},
-				e => {
-					console.log('获取画布宽高信息',e)
-					obj.canHeight = e.height;
-					obj.canWeidth = e.width;
-				}
-			)
-			.exec();
-		let ctxBg = '/static/img/graduation.png'; //画布背景
-		let src = '/static/icon/erweima.jpg' // 二维码
-		let context = uni.createCanvasContext('qrShareBox');
-		// 插入背景图片
-		context.drawImage(ctxBg, 0, 0, obj.canWeidth, obj.canHeight);
-		
-		const codeSize = obj.size * obj.ratio; //计算二维码大小
-		const codeX = ((750 - obj.size) * obj.ratio) / 2; //二维码所在x轴位置
-		const codeY = 999 * obj.ratio; //二维码所在y轴位置
-		// console.log('二维码大小',codeSize)
-		// console.log('二维码所在x轴位置',codeX)
-		// console.log('二维码所在y轴位置',codeY)
-		const codeBoxColor = '#FFFFFF'; //包裹框颜色
-		const codeBoxWidht = 0; //包裹边框宽度
-		const codeBoxSize = (codeBoxWidht / 2) * obj.ratio; //计算二维码白色包裹框大小
-		const codeBoxX = codeX - codeBoxSize; //包裹框初始X轴
-		const codeBoxY = codeY - codeBoxSize; //包裹框初始Y轴
-		const codeBoxEnd = codeSize + codeBoxWidht * obj.ratio; //计算包裹框大小
-		const fontTop = codeY + codeBoxEnd + (codeBoxWidht + 20) * obj.ratio; //文字距离上边距高度
-		const fontSize = 24 * obj.ratio; //文字大小
-		const fontText = ''; //文字内容
-		const fontLeft = (codeSize - fontSize * fontText.length) / 2 + codeX; //文字左侧距离
-		// // 插入文字
-		context.setFontSize(32 * obj.ratio)
-		// 画横线
-		context.moveTo(90 * obj.ratio, 586 * obj.ratio)
-		context.lineTo(250 * obj.ratio, 586 * obj.ratio)
-		context.stroke();
-		context.setTextAlign('center')
-		context.fillText(name, 170 * obj.ratio, 574 * obj.ratio)
-		context.setTextAlign('left')
-		context.fillText('先生/女士', 260 * obj.ratio, 580 * obj.ratio)
-		
-		context.setFontSize(31 * obj.ratio)
-		
-		context.fillText('您已完成神农架林区红十字会普及培训', 105 * obj.ratio, 670 * obj.ratio)
-		context.fillText('的全部课程,特发此证。', 105 * obj.ratio, 720 * obj.ratio)
-		context.setFontSize(22 * obj.ratio)
-		context.fillText('签发人:', 300 * obj.ratio, 800 * obj.ratio)
-		context.fillText('Siger:', 300 * obj.ratio, 830 * obj.ratio)
-		// 画横线
-		context.moveTo(380 * obj.ratio, 830 * obj.ratio)
-		context.lineTo(660 * obj.ratio, 830 * obj.ratio)
-		context.stroke()
-		context.fillText('签发日期:', 300 * obj.ratio, 880 * obj.ratio)
-		context.fillText('Issuer Date:', 300 * obj.ratio, 910 * obj.ratio)
-		context.setFontSize(26 * obj.ratio)
-		context.fillText(m, 475 * obj.ratio, 908 * obj.ratio)
-		context.fillText('神农架林区红十字会', 440 * obj.ratio, 820 * obj.ratio)
-		// 画横线
-		context.moveTo(430 * obj.ratio, 915 * obj.ratio)
-		context.lineTo(660 * obj.ratio, 915 * obj.ratio)
-		context.stroke()
-		context.setFontSize(fontSize);
-		context.fillText(fontText, fontLeft, fontTop);
-		
-		// 插入边框
-		context.beginPath();
-		context.setLineJoin('round'); //边框类型
-		context.setLineWidth(codeBoxWidht * obj.ratio);
-		context.setStrokeStyle(codeBoxColor); //设置包裹框颜色
-		context.strokeRect(codeBoxX, codeBoxY, codeBoxEnd, codeBoxEnd);
-		context.stroke();
-		// 插入二维码
-		context.drawImage(src, codeX, codeY, codeSize, codeSize);
-		context.draw(false,(e) => {
-			uni.canvasToTempFilePath({
-			  x: 0,
-			  y: 0,
-			  width: obj.canWeidth,
-			  height: obj.canHeight,
-			  destWidth: obj.canWeidth,
-			  destHeight: obj.canHeight,
-			  canvasId: 'qrShareBox',
-			  success: function(res) {
-				  console.log(res)
-					// uni.showModal({
-					// 	title:'zhi1'
-					// })
-			    // 在H5平台下,tempFilePath 为 base64
-					// console.log(res.tempFilePath)
-					obj.showcanvas = false;
-					obj.img = res.tempFilePath
-			  } 
-			})
-		})
-			})
-	
-	},
-
-	onShow() {
-		this.uid = this.userInfo.uid;
-		console.log('this.uid',this.uid)
-	},
-	computed: {
-		...mapState('user', ['hasLogin', 'userInfo'])
-	},
-	methods: {
-		...mapMutations('user', ['setUserInfo']),
-		// 分享
-		IndexShare() {
-			let obj = this;
-			let item = {
-				link:  obj.$store.state.baseURL + '/index/#/pages/train/sign?type=' + obj.type + '&id=' + obj.id + '&uid=' + obj.userInfo.uid,// 分享链接
-				imgUrl: obj.$store.state.baseURL + '/index/static/img/002.png',
-				desc: '结业证书',
-				title: '公安县红十字会',
-			};
-			console.log('分享加',item)
-			weixindata(item);
-		},
-		async loadData() {
-			let obj = this;
-			console.log('当前is_over',obj.is_over)
-			if( obj.is_over == 1 ) {
-				let uid = obj.userInfo.uid
-				console.log(9090,uid)
-			}
-			get_training({
-				id:obj.id,
-				// uid:uid
-			}).then(({ data }) => {
-				obj.list = data;
-				console.log(9988,data)
-				if(obj.list.content != null){
-					obj.description = obj.list.content.replace(/<img/g,"<img style='max-width:100%;height:auto;'");
-				}
-			});
-		
-		},		
-		submit(){
-			let obj = this;
-			let data = {};
-			if(obj.type==0){
-				if(!obj.name){
-					obj.$api.msg('请填写姓名!');
-					return;
-				}
-				if(!obj.phone){
-					obj.$api.msg('请输入联系方式!');
-					return;
-				}
-				if(!obj.addr){
-					obj.$api.msg('请输入联系方式!');
-					return;
-				}
-				data={
-					name:obj.name,
-					work:obj.addr,
-					phone:obj.phone,
-					tid:obj.id,
-					type:0
-				}
-			}
-			if(obj.type==1){
-				if(!obj.company){
-					obj.$api.msg('请填写企业名称!');
-					return;
-				}
-				if(!obj.address){
-					obj.$api.msg('请填写企业地址!');
-					return;
-				}
-				if(!obj.companyName){
-					obj.$api.msg('请填写负责人姓名!');
-					return;
-				}
-				if(!obj.companyphone){
-					obj.$api.msg('请输入联系方式!');
-					return;
-				}
-				if(!obj.num){
-					obj.$api.msg('请输入参加培训人数!');
-					return;
-				}
-				data={
-					company:obj.company,
-					address:obj.address,
-					name:obj.companyName,
-					phone:obj.companyphone,
-					num:obj.num,
-					tid:obj.id,
-					type:1
-				}
-			}
-			sign_training(data).then(function(e) {
-				console.log(data.type)
-				let type = data.type
-				uni.setStorageSync('type', type)
-				obj.$api.msg(e.msg);
-				setTimeout(function(){ 
-					uni.navigateTo({
-						url:'/pages/train/index'
-					})
-				}, 1000);
-			}).catch(e => {
-				obj.$api.msg(e.message);
-				setTimeout(function(){
-					uni.navigateTo({
-						url:'/pages/train/index'
-					})
-				}, 1000);
-			});;
-			
-		},
-		getRecTime(timestamp, fmt) {
-			let d = new Date(timestamp * 1000),
-				// f = fmt || 'yyyy/MM/dd', 
-				f = fmt || 'yyyy.MM.dd hh:mm:ss',
-				o = {
-					'M+': d.getMonth() + 1, //月份 
-					'd+': d.getDate(), //日 
-					'h+': d.getHours(), //小时 
-					'm+': d.getMinutes(), //分 
-					's+': d.getSeconds(), //秒 
-					'q+': Math.floor((d.getMonth() + 3) / 3), //季度 
-					'S': d.getMilliseconds() //毫秒 
-				};
-			if (/(y+)/.test(f)) {
-				f = f.replace(RegExp.$1, (d.getFullYear() + '').substr(4 - RegExp.$1.length));
-			}
-			for (let k in o) {
-				if (new RegExp('(' + k + ')').test(f)) {
-					f = f.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)));
-				}
-			}
-			return f;
-			console.log(f)
-		},
-	}
-};
-</script>
-
-<style lang="scss">
-page {
-	background: #FFFFFF;
-	width: 100%;
-	height: 100%;
-	.content {
-		height: 100%;
-	}
-}
-.box{
-	padding: 0rpx 25rpx;
-	width: 100%;
-}
-.top-image{
-	width: 100%;
-	height: 300rpx;
-}
-.top-title{
-	width: 100%;
-	text-align: center;
-	padding: 25rpx 0rpx;
-	font-size: 34rpx;
-	border-bottom:1rpx dashed #B5B5B5;
-}
-.canten{
-	text-align: center !important;
-}
-.addr{
-	color: #222222;
-	font-size: 28rpx;
-	padding: 25rpx 35rpx;
-}
-.text-box{
-	padding: 25rpx 25rpx;
-	padding-bottom: 0rpx !important;
-}
-.text{
-	color: #222222;
-	font-size: 28rpx;
-	padding-bottom: 15rpx;
-}
-.weixin-icon{
-	width: 100%;
-	text-align: center;
-	padding-top: 45rpx;
-	image{
-		width: 248rpx;
-		height: 248rpx;
-	}
-}
-.tip{
-	color: #222222;
-	font-size: 28rpx;
-	width: 100%;
-	text-align: center;
-	padding-bottom: 50rpx;
-}
-.sign-tip{
-	padding: 25rpx 0rpx;
-	text-align: center;
-	color: #222222;
-	font-size: 28rpx;
-}
-.form-box{
-	padding: 0rpx 35rpx;
-	.label{
-		font-size: 34rpx;
-		padding: 25rpx 0rpx;
-		text{
-			color: #E62129;
-			padding-left: 5rpx;
-		}
-	}
-	input{
-		font-size: 28rpx;
-		color: #222222;
-		border: 2rpx solid #979797;
-		padding: 0rpx 15rpx;
-		border-radius: 15rpx;
-		height: 80rpx;
-	}
-}
-.submit{
-	width: 70%;
-	margin: 0rpx auto;
-	margin-top: 80rpx;
-	margin-bottom: 80rpx;
-	padding: 25rpx 0;
-	text-align: center;
-	background-color: #E62129;
-	color: #FFFFFF;
-	font-size: 32rpx;
-	border-radius: 10rpx;
-}
-.grey{
-	background-color: #9B9B9B !important;
-}
-.certificates{
-	// padding: 24rpx;
-	width: 100%;
-	height: 100vh;
-
-}
-
-		.tki-qrcode-canvas {
-			// width: 700rpx;
-			// height: 1245rpx;
-			width: 750rpx;
-			// padding: 32rpx;
-			height: 1350rpx;
-			margin: 0 auto;
-		}
-	.bgimg{
-		width: 100%;
-		height: 100%;
-		image{
-			width: 100%;
-			height: 100%;
-		}
-	}
-	.box-mian{
-		
-			width: 100%;
-			height: 100%;
-			position: absolute;
-			padding:380rpx 94rpx 200rpx 94rpx;
-			color: #333;
-			left: 0;
-			top: 0;
-			display: flex;
-			flex-direction: column;
-			justify-content: center;
-			// align-items: center;
-			.name{
-				display: flex;
-				font-size: 32rpx;
-				.name-left{
-					text-align: center;
-					// padding: 0 24rpx;
-					width: 150rpx;
-					border-bottom: 2rpx solid #333;
-				}
-			}
-			.info{
-				margin-top: 68rpx;
-				text-indent: 64rpx;
-				line-height: 58rpx;
-			}
-			.signName{
-				margin-top: 32rpx;
-				display: flex;
-				.signName-left{
-					line-height: 34rpx;
-					.signName-1{
-						
-					}
-					.signName-2{
-						font-size: 28rpx;
-					}
-				}
-				.signName-right{
-					text-align: left;
-					// width: 100%;
-					padding: 0 12rpx;
-					margin-left: 12rpx;
-					
-					// width: 288rpx;
-					border-bottom: 2rpx solid #333;
-					// margin-bottom: 12rpx;
-					.list-input {
-						width: 100%;
-						padding: 0 12rpx;
-						height: 70rpx;
-						font-size: 32rpx;
-						text-align: left;
-						
-					}
-					.signDate{
-						display: flex;
-						align-items: center;
-					}
-				}
-			}
-			.signDate{
-				margin-top: 22rpx;
-				display: flex;
-				.signName-left{
-					line-height: 34rpx;
-					.signName-1{
-						
-					}
-					.signName-2{
-						font-size: 28rpx;
-					}
-				}
-				.signName-right{
-					text-align: left;
-					padding-left: 12rpx;
-					margin-left: 12rpx;
-					width: 288rpx;
-					border-bottom: 2rpx solid #333;
-					.list-input {
-						height: 70rpx;
-						font-size: 32rpx;
-						text-align: left;
-						
-					}
-					// margin-bottom: 12rpx;
-				}
-			}
-			// background-color: pink;
-		
-	}
-	.imgbox{
-		height: 1350rpx;
-		width:750rpx;
-	}
+<template>
+	<view class="content">
+		<view class="team" v-if="!is_over">
+			<empty></empty>
+		</view>
+		<view class="certificates" v-if='is_over'>
+
+			<canvas v-if="showcanvas" id="qrShareBox" canvas-id="qrShareBox" class="tki-qrcode-canvas" />
+			<image class="imgbox" v-else :src="img" mode=" aspectFill"></image>
+		</view>
+
+	</view>
+</template>
+<script>
+	import {
+		get_training,
+		sign_training,
+		detail_training
+	} from '@/api/train.js';
+	import jyfParser from "@/components/jyf-parser/jyf-parser";
+	import {
+		weixindata,
+		weixinlocation
+	} from '@/utils/wxAuthorized.js';
+	import empty from '@/components/empty';
+	import {
+		userinfo
+	} from '@/api/user.js';
+	import {
+		mapState,
+		mapMutations
+	} from 'vuex';
+	export default {
+		components: {
+			empty,
+			jyfParser
+		},
+		data() {
+			return {
+				is_over: 1,
+				type: '', //0是个人报名,1是团体报名
+				id: '',
+				description: '',
+				list: '',
+				//个人
+				name: '',
+				phone: '',
+				addr: '',
+				work: '',
+				//团队
+				company: '',
+				address: '',
+				companyName: '',
+				companyphone: '',
+				num: '',
+				people: '神农架林区红十字会',
+				signDate: '',
+				loading: true, //是否载入图片中
+				size: 180,
+				ratio: 1, //页面比例用于计算
+				canHeight: '',
+				canWeidth: '',
+				url: '',
+				img: '',
+				showcanvas: true,
+				uid: '',
+				sendtime: ''
+			};
+		},
+		onLoad(option) {
+			this.type = option.type;
+			// this.id = option.id;
+			this.name = decodeURI(option.name)
+			this.sendtime = option.sendtime
+			this.IndexShare();
+			// this.loadData();
+
+		},
+		onReady() {
+			// detail_training({
+			// 	id: this.id,
+			// }).then(({
+			// 	data
+			// }) => {
+			// 	console.log(999, data)
+			// 	this.name = data.name
+			// 	this.signDate = data.add_time
+			// 	this.is_over = data.is_over
+			// 	console.log(3, data.add_time)
+				let obj = this;
+				let name = obj.name
+				let signDate = obj.sendtime
+
+				function getRecTime(timestamp, fmt) {
+					let d = new Date(timestamp * 1000)
+					// f = fmt || 'yyyy/MM/dd', 
+					let f = fmt || 'yyyy.MM.dd'
+					let o = {
+						'M+': d.getMonth() + 1, //月份 
+						'd+': d.getDate(), //日 
+						'h+': d.getHours(), //小时 
+						'm+': d.getMinutes(), //分 
+						's+': d.getSeconds(), //秒 
+						'q+': Math.floor((d.getMonth() + 3) / 3), //季度 
+						'S': d.getMilliseconds() //毫秒 
+					};
+					if (/(y+)/.test(f)) {
+						f = f.replace(RegExp.$1, (d.getFullYear() + '').substr(4 - RegExp.$1.length));
+					}
+					for (let k in o) {
+						if (new RegExp('(' + k + ')').test(f)) {
+							f = f.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr((
+								'' + o[k]).length)));
+						}
+					}
+					return f;
+					console.log(f)
+				}
+				let m = getRecTime(signDate)
+				let query = uni.createSelectorQuery();
+				// this.loadData();
+				// 获取页面比例
+				query
+					.select('.certificates')
+					.fields({
+							size: true
+						},
+						e => {
+							console.log('获取页面比例', e)
+							// 保存比例
+							this.ratio = e.width / 750;
+						}
+					)
+					.exec();
+				// 获取画布宽高信息
+				query
+					.select('#qrShareBox')
+					.fields({
+							size: true
+						},
+						e => {
+							console.log('获取画布宽高信息', e)
+							obj.canHeight = e.height;
+							obj.canWeidth = e.width;
+						}
+					)
+					.exec();
+				let ctxBg = '/static/img/graduation.png'; //画布背景
+				let src = '/static/icon/erweima.jpg' // 二维码
+				let context = uni.createCanvasContext('qrShareBox');
+				// 插入背景图片
+				context.drawImage(ctxBg, 0, 0, obj.canWeidth, obj.canHeight);
+
+				const codeSize = obj.size * obj.ratio; //计算二维码大小
+				const codeX = ((750 - obj.size) * obj.ratio) / 2; //二维码所在x轴位置
+				const codeY = 999 * obj.ratio; //二维码所在y轴位置
+				// console.log('二维码大小',codeSize)
+				// console.log('二维码所在x轴位置',codeX)
+				// console.log('二维码所在y轴位置',codeY)
+				const codeBoxColor = '#FFFFFF'; //包裹框颜色
+				const codeBoxWidht = 0; //包裹边框宽度
+				const codeBoxSize = (codeBoxWidht / 2) * obj.ratio; //计算二维码白色包裹框大小
+				const codeBoxX = codeX - codeBoxSize; //包裹框初始X轴
+				const codeBoxY = codeY - codeBoxSize; //包裹框初始Y轴
+				const codeBoxEnd = codeSize + codeBoxWidht * obj.ratio; //计算包裹框大小
+				const fontTop = codeY + codeBoxEnd + (codeBoxWidht + 20) * obj.ratio; //文字距离上边距高度
+				const fontSize = 24 * obj.ratio; //文字大小
+				const fontText = ''; //文字内容
+				const fontLeft = (codeSize - fontSize * fontText.length) / 2 + codeX; //文字左侧距离
+				// // 插入文字
+				context.setFontSize(32 * obj.ratio)
+				// 画横线
+				context.moveTo(90 * obj.ratio, 586 * obj.ratio)
+				context.lineTo(250 * obj.ratio, 586 * obj.ratio)
+				context.stroke();
+				context.setTextAlign('center')
+				context.fillText(name, 170 * obj.ratio, 574 * obj.ratio)
+				context.setTextAlign('left')
+				context.fillText('先生/女士', 260 * obj.ratio, 580 * obj.ratio)
+
+				context.setFontSize(31 * obj.ratio)
+
+				context.fillText('您已完成公安县红十字会普及培训', 105 * obj.ratio, 670 * obj.ratio)
+				context.fillText('的全部课程,特发此证。', 105 * obj.ratio, 720 * obj.ratio)
+				context.setFontSize(22 * obj.ratio)
+				context.fillText('签发人:', 300 * obj.ratio, 800 * obj.ratio)
+				context.fillText('Siger:', 300 * obj.ratio, 830 * obj.ratio)
+				// 画横线
+				context.moveTo(380 * obj.ratio, 830 * obj.ratio)
+				context.lineTo(660 * obj.ratio, 830 * obj.ratio)
+				context.stroke()
+				context.fillText('签发日期:', 300 * obj.ratio, 880 * obj.ratio)
+				context.fillText('Issuer Date:', 300 * obj.ratio, 910 * obj.ratio)
+				context.setFontSize(26 * obj.ratio)
+				context.fillText(m, 475 * obj.ratio, 908 * obj.ratio)
+				context.fillText('公安县红十字会', 440 * obj.ratio, 820 * obj.ratio)
+				// 画横线
+				context.moveTo(430 * obj.ratio, 915 * obj.ratio)
+				context.lineTo(660 * obj.ratio, 915 * obj.ratio)
+				context.stroke()
+				context.setFontSize(fontSize);
+				context.fillText(fontText, fontLeft, fontTop);
+
+				// 插入边框
+				context.beginPath();
+				context.setLineJoin('round'); //边框类型
+				context.setLineWidth(codeBoxWidht * obj.ratio);
+				context.setStrokeStyle(codeBoxColor); //设置包裹框颜色
+				context.strokeRect(codeBoxX, codeBoxY, codeBoxEnd, codeBoxEnd);
+				context.stroke();
+				// 插入二维码
+				context.drawImage(src, codeX, codeY, codeSize, codeSize);
+				context.draw(false, (e) => {
+					uni.canvasToTempFilePath({
+						x: 0,
+						y: 0,
+						width: obj.canWeidth,
+						height: obj.canHeight,
+						destWidth: obj.canWeidth,
+			  	destHeight: obj.canHeight,
+						canvasId: 'qrShareBox',
+						success: function(res) {
+							console.log(res)
+							// uni.showModal({
+							// 	title:'zhi1'
+							// })
+							// 在H5平台下,tempFilePath 为 base64
+							// console.log(res.tempFilePath)
+							obj.showcanvas = false;
+							obj.img = res.tempFilePath
+			 		}
+					})
+				})
+			// })
+
+		},
+
+		onShow() {
+			this.uid = this.userInfo.uid;
+			console.log('this.uid', this.uid)
+		},
+		computed: {
+			...mapState('user', ['hasLogin', 'userInfo'])
+		},
+		methods: {
+			...mapMutations('user', ['setUserInfo']),
+			// 分享
+			IndexShare() {
+				let obj = this;
+				let item = {
+					link: obj.$store.state.baseURL + '/index/#/pages/form/certificates?name=' + encodeURI(obj.name) + '&sendtime=' + obj.sendtime,
+					imgUrl: obj.$store.state.baseURL + '/index/static/img/002.png',
+					desc: '结业证书',
+					title: '公安县红十字会',
+				};
+				console.log('分享加', item)
+				weixindata(item);
+			},
+			getRecTime(timestamp, fmt) {
+				let d = new Date(timestamp * 1000),
+					// f = fmt || 'yyyy/MM/dd', 
+					f = fmt || 'yyyy.MM.dd hh:mm:ss',
+					o = {
+						'M+': d.getMonth() + 1, //月份 
+						'd+': d.getDate(), //日 
+						'h+': d.getHours(), //小时 
+						'm+': d.getMinutes(), //分 
+						's+': d.getSeconds(), //秒 
+						'q+': Math.floor((d.getMonth() + 3) / 3), //季度 
+						'S': d.getMilliseconds() //毫秒 
+					};
+				if (/(y+)/.test(f)) {
+					f = f.replace(RegExp.$1, (d.getFullYear() + '').substr(4 - RegExp.$1.length));
+				}
+				for (let k in o) {
+					if (new RegExp('(' + k + ')').test(f)) {
+						f = f.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k])
+							.length)));
+					}
+				}
+				return f;
+				console.log(f)
+			},
+		}
+	};
+</script>
+
+<style lang="scss">
+	page {
+		background: #FFFFFF;
+		width: 100%;
+		height: 100%;
+
+		.content {
+			height: 100%;
+		}
+	}
+
+	.box {
+		padding: 0rpx 25rpx;
+		width: 100%;
+	}
+
+	.top-image {
+		width: 100%;
+		height: 300rpx;
+	}
+
+	.top-title {
+		width: 100%;
+		text-align: center;
+		padding: 25rpx 0rpx;
+		font-size: 34rpx;
+		border-bottom: 1rpx dashed #B5B5B5;
+	}
+
+	.canten {
+		text-align: center !important;
+	}
+
+	.addr {
+		color: #222222;
+		font-size: 28rpx;
+		padding: 25rpx 35rpx;
+	}
+
+	.text-box {
+		padding: 25rpx 25rpx;
+		padding-bottom: 0rpx !important;
+	}
+
+	.text {
+		color: #222222;
+		font-size: 28rpx;
+		padding-bottom: 15rpx;
+	}
+
+	.weixin-icon {
+		width: 100%;
+		text-align: center;
+		padding-top: 45rpx;
+
+		image {
+			width: 248rpx;
+			height: 248rpx;
+		}
+	}
+
+	.tip {
+		color: #222222;
+		font-size: 28rpx;
+		width: 100%;
+		text-align: center;
+		padding-bottom: 50rpx;
+	}
+
+	.sign-tip {
+		padding: 25rpx 0rpx;
+		text-align: center;
+		color: #222222;
+		font-size: 28rpx;
+	}
+
+	.form-box {
+		padding: 0rpx 35rpx;
+
+		.label {
+			font-size: 34rpx;
+			padding: 25rpx 0rpx;
+
+			text {
+				color: #E62129;
+				padding-left: 5rpx;
+			}
+		}
+
+		input {
+			font-size: 28rpx;
+			color: #222222;
+			border: 2rpx solid #979797;
+			padding: 0rpx 15rpx;
+			border-radius: 15rpx;
+			height: 80rpx;
+		}
+	}
+
+	.submit {
+		width: 70%;
+		margin: 0rpx auto;
+		margin-top: 80rpx;
+		margin-bottom: 80rpx;
+		padding: 25rpx 0;
+		text-align: center;
+		background-color: #E62129;
+		color: #FFFFFF;
+		font-size: 32rpx;
+		border-radius: 10rpx;
+	}
+
+	.grey {
+		background-color: #9B9B9B !important;
+	}
+
+	.certificates {
+		// padding: 24rpx;
+		width: 100%;
+		height: 100vh;
+
+	}
+
+	.tki-qrcode-canvas {
+		// width: 700rpx;
+		// height: 1245rpx;
+		width: 750rpx;
+		// padding: 32rpx;
+		height: 1350rpx;
+		margin: 0 auto;
+	}
+
+	.bgimg {
+		width: 100%;
+		height: 100%;
+
+		image {
+			width: 100%;
+			height: 100%;
+		}
+	}
+
+	.box-mian {
+
+		width: 100%;
+		height: 100%;
+		position: absolute;
+		padding: 380rpx 94rpx 200rpx 94rpx;
+		color: #333;
+		left: 0;
+		top: 0;
+		display: flex;
+		flex-direction: column;
+		justify-content: center;
+
+		// align-items: center;
+		.name {
+			display: flex;
+			font-size: 32rpx;
+
+			.name-left {
+				text-align: center;
+				// padding: 0 24rpx;
+				width: 150rpx;
+				border-bottom: 2rpx solid #333;
+			}
+		}
+
+		.info {
+			margin-top: 68rpx;
+			text-indent: 64rpx;
+			line-height: 58rpx;
+		}
+
+		.signName {
+			margin-top: 32rpx;
+			display: flex;
+
+			.signName-left {
+				line-height: 34rpx;
+
+				.signName-1 {}
+
+				.signName-2 {
+					font-size: 28rpx;
+				}
+			}
+
+			.signName-right {
+				text-align: left;
+				// width: 100%;
+				padding: 0 12rpx;
+				margin-left: 12rpx;
+
+				// width: 288rpx;
+				border-bottom: 2rpx solid #333;
+
+				// margin-bottom: 12rpx;
+				.list-input {
+					width: 100%;
+					padding: 0 12rpx;
+					height: 70rpx;
+					font-size: 32rpx;
+					text-align: left;
+
+				}
+
+				.signDate {
+					display: flex;
+					align-items: center;
+				}
+			}
+		}
+
+		.signDate {
+			margin-top: 22rpx;
+			display: flex;
+
+			.signName-left {
+				line-height: 34rpx;
+
+				.signName-1 {}
+
+				.signName-2 {
+					font-size: 28rpx;
+				}
+			}
+
+			.signName-right {
+				text-align: left;
+				padding-left: 12rpx;
+				margin-left: 12rpx;
+				width: 288rpx;
+				border-bottom: 2rpx solid #333;
+
+				.list-input {
+					height: 70rpx;
+					font-size: 32rpx;
+					text-align: left;
+
+				}
+
+				// margin-bottom: 12rpx;
+			}
+		}
+
+		// background-color: pink;
+
+	}
+
+	.imgbox {
+		height: 1350rpx;
+		width: 750rpx;
+	}
 </style>

+ 8 - 5
pages/form/certificatesList.vue

@@ -14,9 +14,6 @@
 							<image class="image" :src="baseURL + item.training.image"></image>
 							<view class="list-tpl">{{ item.training.title }}</view>
 						</view>
-						<view class="">
-							{{ item.training.title }}
-						</view>
 					</view>
 				</scroll-view>
 			</swiper-item>
@@ -105,10 +102,16 @@
 			},
 			//跳转到详情
 			ToDetail(e) {
-				let type = e.type;
+				console.log(e)
+				let type ;
+				if(e.num == 1) {
+					type = 0
+				}else {
+					type = 1
+				}
 				let id = e.id;
 				uni.navigateTo({
-					url: '/pages/form/certificates?type=' + type + '&id=' + id
+					url: '/pages/form/certificates?name=' + encodeURI(e.name) + '&sendtime=' + e.sendtime
 				});
 			}
 		}

+ 73 - 9
pages/user/user.vue

@@ -7,10 +7,10 @@
 			</view>
 			<view class="name-box">
 				<view class="name-top">
-					{{userInfo.nickname}}<text v-if="userInfo && userInfo.level_name">{{'('+ userInfo.level_name +')'}}</text>
+					{{userInfo.nickname}}<text v-if="userInfo && userInfo.level_name && userInfo.level > 1">{{'('+ userInfo.level_name +')'}}</text>
 				</view>
-				<view class="" v-if="userInfo && userInfo.level_name" style="color: #fff;font-size: 32rpx;">
-					<text v-if="vip_endtime < newTime">已到期,立即续费</text><text>{{userInfo.vip_endtime | time}} 到期</text>
+				<view class="" v-if="userInfo && userInfo.level_name && userInfo.level > 1" style="color: #fff;font-size: 32rpx;">
+					<text v-if="vip_endtime < newTime">已到期,立即续费</text><text>{{userInfo.vip_endtime | time}} 到期<text @click="xuFei()">(续费)</text></text>
 				</view>
 			</view>
 		</view>
@@ -82,7 +82,7 @@
 			<view class="nav-item flex" @click="navTo('/pages/user/userSet')" >
 				<view class="item-left flex">
 					<image src="../../static/icon/u-set.png" mode="" class="img4"></image>
-					<view class="title">退出</view>
+					<view class="title">设置</view>
 				</view>
 				<view class="item-right">
 					>
@@ -110,7 +110,8 @@
 	import {
 		weixindata
 	} from '@/utils/wxAuthorized';
-	// #endif
+	// #endif
+	import { getVipmoney, createOrder } from '@/api/index.js'
 	export default {
 		data() {
 			return {
@@ -119,7 +120,9 @@
 				signDate:'',
 				id:0,
 				is_over:0,
-				newTime: 0,
+				newTime: 0,
+				money: '',
+				mid: '',
 			}
 		},
 		filters: {
@@ -137,10 +140,23 @@
 			},
 		},
 		onShow() {
-			console.log(this);
+			console.log(this);
+			let obj = this
 			//	判断是否已经登录
 			if (this.hasLogin) {
-				this.loadBaseData();
+				this.loadBaseData();
+				getVipmoney().then(({
+					data
+				}) => {
+					console.log(data, 'getVipmoney');
+					data.forEach(e => {
+						if (e.name == obj.userInfo.level_name) {
+							obj.money = e.pay_price;
+							obj.mid = e.id;
+							console.log(obj.money, obj.mid)
+						}
+					});
+				});
 			} else {
 				saveUrl();
 				uni.showModal({
@@ -175,10 +191,58 @@
 			// })
 		},
 		computed: {
-			...mapState('user', ['hasLogin', 'userInfo'])
+			...mapState('user', ['hasLogin', 'userInfo']),
+			...mapState(['weichatObj']),
 		},
 		methods: {
 			...mapMutations('user', ['setUserInfo','logout']),
+			// 续费
+			xuFei() {
+				let obj = this
+				uni.showModal({
+					title: '提示',
+					content: '续费' + obj.userInfo.level_name + '需要缴纳' + obj.money + '元年费,是否续费',
+					success: function(res) {
+						if (res.confirm) {
+							console.log('用户点击确定');
+							createOrder({
+								level_id: obj.mid,
+								body: '红会年费',
+								pay_type: 0,
+								// name: obj.name,
+								pay_price: obj.money,
+								from: 'weixin'
+							}).then(({data}) =>{
+								let res = data.jsConfig;
+								obj.weichatObj.chooseWXPay({
+									timestamp: res.timestamp,
+									nonceStr: res.nonceStr,
+									package: res.package,
+									signType: res.signType,
+									paySign: res.paySign,
+									success: function(res) {
+										// uni.navigateTo({
+										// 	url: '../joinSuc/joinNow'
+										// });
+										obj.loadBaseData()
+										uni.showModal({
+											title:'提示',
+											content: '续费成功'
+										})
+									},
+									fail: function(res) {
+										console.log(res, "失败")
+										console.log(res.errMsg)
+									}
+								});
+							})
+						} else if (res.cancel) {
+							console.log('用户点击取消');
+						}
+					}
+				});
+			},
+			// 登出
 			loginout() {
 				let obj = this;
 				uni.showModal({