hmp 4 anni fa
parent
commit
1751cab2b9

+ 23 - 0
package-lock.json

@@ -31,6 +31,12 @@
         "@dcloudio/types": "^2.0.16"
       }
     },
+    "miniprogram-api-typings": {
+      "version": "3.4.2",
+      "resolved": "https://registry.nlark.com/miniprogram-api-typings/download/miniprogram-api-typings-3.4.2.tgz",
+      "integrity": "sha1-YlRgxL3kpMYBYswE3AVjbKtkh7Q=",
+      "dev": true
+    },
     "moment": {
       "version": "2.29.1",
       "resolved": "https://registry.nlark.com/moment/download/moment-2.29.1.tgz",
@@ -54,10 +60,27 @@
         "jssha": "^3.1.2"
       }
     },
+    "u-draw-poster": {
+      "version": "1.1.6",
+      "resolved": "https://registry.nlark.com/u-draw-poster/download/u-draw-poster-1.1.6.tgz",
+      "integrity": "sha1-V2M48ntWL7sVxoODJ7Ui+WyGIjA=",
+      "dev": true,
+      "requires": {
+        "@dcloudio/types": "^2.0.16",
+        "miniprogram-api-typings": "^3.1.3",
+        "vue": "^2.6.12"
+      }
+    },
     "uview-ui": {
       "version": "1.8.4",
       "resolved": "https://registry.npm.taobao.org/uview-ui/download/uview-ui-1.8.4.tgz",
       "integrity": "sha1-4yu/I3lCHTGQIuMk4ct7U4fTvUQ="
+    },
+    "vue": {
+      "version": "2.6.14",
+      "resolved": "https://registry.nlark.com/vue/download/vue-2.6.14.tgz",
+      "integrity": "sha1-5RqlJQJQ1Wmj+606ilpofWA24jU=",
+      "dev": true
     }
   }
 }

+ 3 - 0
package.json

@@ -15,5 +15,8 @@
     "tki-qrcode": "^0.1.6",
     "totp-generator": "0.0.9",
     "uview-ui": "^1.8.4"
+  },
+  "devDependencies": {
+    "u-draw-poster": "^1.1.6"
   }
 }

+ 2 - 20
pages.json

@@ -175,15 +175,6 @@
                 "enablePullDownRefresh": false
             }
             
-        }
-        ,{
-            "path" : "pages/checkstand/index",
-            "style" :                                                                                    
-            {
-                "navigationBarTitleText": "收银台",
-                "enablePullDownRefresh": false
-            }
-            
         }
         ,{
             "path" : "pages/checkstand/pay-qrcode",
@@ -195,15 +186,6 @@
                 "enablePullDownRefresh": false
             }
             
-        }
-        ,{
-            "path" : "pages/checkstand/order-res",
-            "style" :                                                                                    
-            {
-                "navigationBarTitleText": "支付详情",
-                "enablePullDownRefresh": false
-            }
-            
         }
         ,{
             "path" : "pages/pay/pay",
@@ -227,13 +209,13 @@
             "path" : "pages/material-download/material-download",
             "style" :                                                                                    
             {
-                "navigationBarTitleText": "物料下载",
+                "navigationBarTitleText": "选择模板",
                 "enablePullDownRefresh": false
             }
             
         }
         ,{
-            "path" : "pages/material-download/test",
+            "path" : "pages/material-download/createPoster",
             "style" :                                                                                    
             {
                 "navigationBarTitleText": "物料下载",

+ 0 - 156
pages/checkstand/index.vue

@@ -1,156 +0,0 @@
-<template>
-	<view class="check-panel flex-direction">
-		<image :src="logo" class="buyer-logo"></image>
-		<view class="title center">{{buyer}}</view>
-		<view class="input-content">
-			<view class="tips">交易金额</view>
-			<view class="input-bar center" @tap="show=true">
-				<view class="icon center">¥</view>
-				<view class="input center">
-					<view>{{orderAmount}}</view>
-					<view class="cusor"></view>
-				</view>
-			</view>
-			<view style="height: 50rpx;"></view>
-			<u-button class="button" type="warning" @click="pay">付款</u-button>
-		</view>
-
-		<view class="bottom-line center"> -- 联兑通提供技术支持 --</view>
-		<u-keyboard ref="uKeyboard" :show-tips="false" :safe-area-inset-bottom="true" :mask="false" v-model="show"
-			@change="handleInput" @backspace="handleDelete"></u-keyboard>
-	</view>
-</template>
-
-<script>
-	export default {
-		onLoad(option) {},
-		data() {
-			return {
-				show: true,
-				logo: "/static/icon/CMBCHINA.png",
-				buyer: "中国招商银行",
-				orderAmount: '',
-				shopId:''
-			}
-		},
-		onLoad(options) {
-			if (this.$isEmpty(options.shopId)) {
-				this.$u.toast('系统错误,无法识别商户')
-				return
-			}
-			this.shopId=options.shopId
-		},
-		methods: {
-			handleInput(num) {
-				if (this.orderAmount.length > 12) {
-					return
-				}
-				this.orderAmount = this.orderAmount + num
-			},
-			handleDelete() {
-				if (this.$isEmpty(this.orderAmount)) {
-					return
-				}
-				this.orderAmount = this.orderAmount.substr(0, this.orderAmount.length - 1)
-			},
-			pay(){
-				let now=new Date()
-				let min=now.getMinutes()
-				now.setMinutes(min + 30)
-				let expireTime=this.$dateTime.format(now)
-				
-				let params={
-					money:this.orderAmount,
-					shopId:this.shopId,
-					loginUserId:this.vuex_userId,
-					billsTitle:'用户支付',
-					expireTime
-				}
-				this.$api.loginUser.payBefore(params).then(res=>{
-					console.log(res);
-				})
-				return
-				uni.navigateTo({
-					url:"/pages/checkstand/order-res"+this.$u.queryParams(params)
-				})
-			}
-		}
-	}
-</script>
-
-<style lang="scss" scoped>
-	.check-panel {
-		.buyer-logo {
-			width: 100rpx;
-			height: 100rpx;
-			margin-top: 50rpx;
-			margin-left: calc(50% - 50rpx);
-		}
-
-		.title {
-			height: 70rpx;
-			letter-spacing: 3rpx;
-			color: #5D5D5D;
-		}
-
-		.input-content {
-			padding: 50rpx;
-			position: absolute;
-			top: 280rpx;
-			bottom: 0;
-			left: 0;
-			right: 0;
-			background-color: #FFFFFF;
-			width: 100%;
-			border-radius: 25rpx 25rpx 0 0;
-
-			.tips {
-				height: 100rpx;
-				font-size: 30rpx;
-				display: flex;
-				justify-content: left;
-				align-items: center;
-			}
-
-			.input-bar {
-				height: 150rpx;
-				border-bottom: 1rpx solid #DDDDDD;
-
-				.icon {
-					width: 15%;
-					font-size: 70rpx;
-					font-weight: 900;
-					height: 100%;
-				}
-
-				.input {
-					width: 85%;
-					height: 100%;
-					overflow: hidden;
-					font-size: 70rpx;
-				}
-
-				.cusor {
-					width: 2rpx;
-					height: 80%;
-					background-color: #FD711B;
-					animation: blink 1500ms infinite ease-in-out;
-				}
-			}
-		}
-	}
-
-	.bottom-line {
-		position: absolute;
-		bottom: 50rpx;
-		left: 0;
-		width: 100%;
-		color: #dddddd;
-	}
-
-	@keyframes blink {
-		from {
-			opacity: 0;
-		}
-	}
-</style>

+ 0 - 121
pages/checkstand/order-res.vue

@@ -1,121 +0,0 @@
-<template>
-	<view v-if="loading">
-		<u-modal v-model="loading" :show-title="false" :show-confirm-button="false">
-			<view class="slot-content center flex-direction">
-					<image  class="loading-icon" src="../../static/pay/loading.png"></image>
-					<view class="tips center">处理中</view>
-			</view>
-		</u-modal>
-	</view>
-	<view v-else class="check-panel flex-direction">
-		<image src="../../static/pay/success.png"></image>
-		<view class="text-status center">付款成功</view>
-		<view class="order-des center">{{orderDes}}</view>
-		<view class=" fee center">¥{{amount}}</view>
-		<button class="finish" @click="backToHome">完成</button>
-		<view class="bottom-line center">联兑通提供技术支持</view>
-	</view>
-</template>
-
-<script>
-	export default {
-		onLoad(option) {
-			this.timer =  setInterval(this.queryOrderStatus,500);
-		},
-		data() {
-			return {
-				counter: 0,
-				timer: null,
-				loading: true,
-				amount: 100,
-				orderDes: '扫码付款'
-			}
-		},
-		methods: {
-			queryOrderStatus(){
-				this.counter++;
-				console.log("轮询订单状态!");
-				if(this.counter>10){
-					clearInterval(this.timer);
-					this.loading = false;
-				}
-			},
-			backToHome(){
-				uni.switchTab({
-					url: '/pages/mine/mine'
-				})
-			}
-		}
-	}
-</script>
-
-<style lang="scss" scoped>
-	.check-panel{
-		background-color: #FFFFFF;
-		border-radius: 25rpx;
-		width: 90%;
-		min-height: 900rpx;
-		margin: 20rpx  5%;
-		image{
-			width: 150rpx;
-			height: 150rpx;
-			margin-top: 100rpx;
-			margin-left: calc(50% - 75rpx);
-		}
-		.order-des{
-			margin-top: 100rpx;
-			color: #575959;
-			width: 100%;
-			font-size: 30rpx;
-			letter-spacing: 2rpx;
-			height: 100rpx;
-		}
-		.fee{
-			height: 80rpx;
-			width: 100%;
-			color: #484a4b;
-			font-size: 80rpx;
-			// font-style: italic;
-			font-weight: 350;
-		}
-		.text-status{
-			color: #E1961A;
-			height: 70rpx;
-			width: 100%;
-		}
-		.finish{
-			position: absolute;
-			width: 40%;
-			left: 30%;
-			bottom: 25%;
-			color: #E1961A;
-			border-color:   #E1961A ;
-			letter-spacing: 20rpx;
-			background: transparent ;
-		}
-	}
-	.slot-content{
-		height: 300rpx;
-		.loading-icon{
-			width: 100rpx;
-			height: 100rpx;
-			animation: round 1s infinite linear;
-		}
-		.tips{
-			height: 80rpx;
-			color: #565757;
-		}
-	}
-	.bottom-line{
-		position: absolute;
-		bottom: 50rpx;
-		left: 0;
-		width: 100%;
-		color: #dddddd;
-	}
-	@keyframes round {
-	  from{
-	    transform: rotate(360deg);
-	  }
-	}
-</style>

+ 11 - 1
pages/index/index.vue

@@ -103,6 +103,8 @@
 				</view>
 			</view>
 		</view>
+		
+		<u-modal @confirm="$jump('/pages/member/member')" :show-cancel-button="true"  confirm-color="#ff9447" confirm-text="立即开启" cancel-text="暂不开启" v-model="isOpenMemberShow" content="请先创建会员中心"></u-modal>
 		<u-select @confirm="shopConfirm" v-model="shopShow" value-name="id" label-name="name" :list="shopList">
 		</u-select>
 	</view>
@@ -198,7 +200,10 @@
 						name: '添加服务',
 						path: '/pages/mine/card/card'
 					},
-				]
+				],
+				//是否开启会员中心
+				isOpenMember:false,
+				isOpenMemberShow:false,
 			}
 		},
 		onLoad() {
@@ -307,6 +312,7 @@
 				this.$cache.put("selectedShop", Object.assign(item, selectedShop))
 				this.$u.vuex('vuex_shopId', this.shopId)
 				this.$u.vuex('vuex_mallId', this.mallId)
+				this.$u.vuex('vuex_isOpenMember',item.isOpenMember==1?true:false)
 			},
 			shopConfirm(e) {
 				this.shopId = e[0].value
@@ -323,6 +329,10 @@
 				this.getStatistic()
 			},
 			operate(index) {
+				if (!this.vuex_isOpenMember && (index== 0 || index==1)) {
+					this.isOpenMemberShow=true
+					return
+				}
 				if (index == 0) {
 					this.$jump('/pages/pay/pay')
 				} else if (index == 1) {

+ 155 - 0
pages/material-download/comps/mp-swiper -tmp.vue

@@ -0,0 +1,155 @@
+<template>
+	<view class="swiper">
+		<view class="swiper-title">
+			<swiper :style="{height:fullHeight}" class="swiper-tall" :indicator-dots="indicatorDots"
+				:autoplay="autoplay" :previous-margin="previousMargin" :next-margin="nextMargin" :circular="circular"
+				@change="change" :current="swiperCurrentIndex">
+				<swiper-item class="swiper-container" v-for="(item,index) in list" :key="index" :item-id="index"
+					:data-year="index">
+					<view :animation="animationData[index]" class="swiper-item" style="position: relative;">
+						<image :src="item.image" mode=""></image>
+						<view class="content">
+							<text class="">{{shopDetail.name}}</text>
+							<tki-qrcode style="margin-top: -100rpx;" cid="1" ref="qrcode-charge" :val="qrcodeText"
+								size="260" :onval="true" :loadMake="true" :usingComponents="true" />
+						</view>
+					</view>
+				</swiper-item>
+			</swiper>
+		</view>
+		<view class="center flex-direction">
+			<text style="margin-bottom: 50rpx;">{{list[swiperCurrentIndex].name}}</text>
+			<view @click="createPoster" class="cu-btn  flex round text-lg"
+				style="padding: 46rpx 0;background-color: #EF9944;color: #FFFFFF;width: 76%;">
+				生成海报
+			</view>
+		</view>
+	</view>
+</template>
+<script>
+	import tkiQrcode from "tki-qrcode"
+	export default {
+		props: {
+			list: Array
+		},
+		components: {
+			tkiQrcode
+		},
+		data() {
+			return {
+				qrcodeText:'',
+				
+				screenHeight: 0,
+				animationData: {
+					0: {},
+					1: {},
+					2: {},
+					3: {}
+				},
+				title: '0',
+				indicatorDots: false,
+				autoplay: false,
+				previousMargin: uni.upx2px(82) + 'px',
+				nextMargin: uni.upx2px(82) + 'px',
+				circular: true,
+				zoomParam: 1.10,
+				swiperCurrentIndex: 0,
+				data: [],
+				max: 0,
+				//商户详情
+
+				shopDetail: {}
+			}
+		},
+		computed: {
+			fullHeight() {
+				const res = uni.getSystemInfoSync();
+				return res.windowHeight - (res.statusBarHeight + 44) + 'px';
+			}
+		},
+		async mounted(option) {
+			let res = await this.$api.shop.detail({
+				id: this.vuex_shopId
+			})
+			this.shopDetail = res.data
+			this.qrcodeText=this.$global.QR_PATH+this.vuex_shopId
+		},
+		created() {
+			this.animation = uni.createAnimation();
+			this.animation.scale(this.zoomParam).step();
+			this.animationData[0] = this.animation.export();
+		},
+		methods: {
+			createPoster() {
+				this.$emit('click', this.list[this.swiperCurrentIndex].image)
+			},
+			change(e) {
+				this.swiperCurrentIndex = e.detail.current;
+				this.title = e.detail.currentItemId;
+				for (let key in this.animationData) {
+					if (e.detail.currentItemId == key) {
+						this.animation.scale(this.zoomParam).step();
+						this.animationData[key] = this.animation.export();
+					} else {
+						this.animation.scale(1.0).step();
+						this.animationData[key] = this.animation.export();
+					}
+				}
+				this.$emit('change', this.list[this.swiperCurrentIndex].image)
+			}
+		}
+	}
+</script>
+
+<style>
+	page {
+		display: flex;
+		flex-wrap: wrap;
+	}
+
+	.content {
+		position: absolute;
+		display: flex;
+		flex-direction: column;
+		justify-content: center;
+		align-items: center;
+		top: 30rpx;
+	}
+
+
+	.save-btn {
+		background-color: #EF9944;
+		color: #FFFFFF;
+	}
+
+	.swiper-container {
+		display: flex;
+		align-items: center;
+	}
+
+	.swiper-item {
+		display: flex;
+		flex-wrap: wrap;
+		justify-content: center;
+		margin-left: auto;
+		margin-right: auto;
+		height: 760upx;
+		width: 544upx;
+		line-height: 300upx;
+		text-align: center;
+		margin-bottom: 50upx;
+	}
+
+
+
+	.swiper-tall {
+		display: flex;
+		align-items: center;
+	}
+
+	.swiper-title {
+		margin-top: -100rpx;
+		width: 760upx;
+		text-align: center;
+	}
+</style>

+ 9 - 31
pages/material-download/comps/mp-swiper.vue

@@ -6,23 +6,17 @@
 				@change="change" :current="swiperCurrentIndex">
 				<swiper-item class="swiper-container" v-for="(item,index) in list" :key="index" :item-id="index"
 					:data-year="index">
-					<view :animation="animationData[index]" class="swiper-item" style="position: relative;">
+					<view :animation="animationData[index]" class="swiper-item" >
 						<image :src="item.image" mode=""></image>
-						<view class="content">
-							<text class="">{{shopDetail.name}}</text>
-							<tki-qrcode style="margin-top: -100rpx;" cid="1" ref="qrcode-charge" :val="shopDetail.id" size="260" :onval="true"
-								:loadMake="true" :usingComponents="true" />
-						</view>
-
 					</view>
 				</swiper-item>
 			</swiper>
 		</view>
-
-		<view class="center">
-			<view class="cu-btn  flex round text-lg"
+		<view class="center flex-direction">
+			<text style="margin-bottom: 50rpx;font-size: 32rpx;">{{list[swiperCurrentIndex].name}}</text>
+			<view @click="createPoster" class="cu-btn  flex round text-lg"
 				style="padding: 46rpx 0;background-color: #EF9944;color: #FFFFFF;width: 76%;">
-				生成海报
+				下一步
 			</view>
 		</view>
 	</view>
@@ -55,9 +49,6 @@
 				swiperCurrentIndex: 0,
 				data: [],
 				max: 0,
-				//商户详情
-
-				shopDetail: {}
 			}
 		},
 		computed: {
@@ -66,18 +57,15 @@
 				return res.windowHeight - (res.statusBarHeight + 44) + 'px';
 			}
 		},
-		async mounted(option) {
-			let res = await this.$api.shop.detail({
-				id: this.vuex_shopId
-			})
-			this.shopDetail = res.data
-		},
 		created() {
 			this.animation = uni.createAnimation();
 			this.animation.scale(this.zoomParam).step();
 			this.animationData[0] = this.animation.export();
 		},
 		methods: {
+			createPoster() {
+				this.$emit('click', this.swiperCurrentIndex)
+			},
 			change(e) {
 				this.swiperCurrentIndex = e.detail.current;
 				this.title = e.detail.currentItemId;
@@ -90,7 +78,7 @@
 						this.animationData[key] = this.animation.export();
 					}
 				}
-				this.$emit('change', this.swiperCurrentIndex)
+				this.$emit('change', this.list[this.swiperCurrentIndex].image)
 			}
 		}
 	}
@@ -102,16 +90,6 @@
 		flex-wrap: wrap;
 	}
 
-	.content {
-		position: absolute;
-		display: flex;
-		flex-direction: column;
-		justify-content: center;
-		align-items: center;
-		top: 30rpx;
-	}
-
-
 	.save-btn {
 		background-color: #EF9944;
 		color: #FFFFFF;

+ 133 - 0
pages/material-download/createPoster.vue

@@ -0,0 +1,133 @@
+<template>
+	<view class="index">
+		<view class="center">
+			<image :show-menu-by-longpress="true" :src="imgUrl"
+				style="width: 670rpx; height: 940rpx;margin-top: 50rpx;" />
+		</view>
+		<view style="position: fixed; top: 999999999999999999999rpx">
+			<!-- #ifdef MP-WEIXIN -->
+			<canvas id="canvas" type="2d" style="width: 670rpx; height: 940rpx" />
+			<!-- #endif -->
+			<!-- #ifndef MP-WEIXIN -->
+			<canvas canvas-id="canvas" id="canvas" style="width: 670rpx; height: 940rpx" />
+			<!-- #endif -->
+		</view>
+		<view class="" style="position: fixed;bottom: 150rpx;width: 100%;">
+			<view class="center">
+				<view @click="savePhoto" class="cu-btn  flex round text-lg"
+					style="padding: 46rpx 0;background-color: #EF9944;color: #FFFFFF;width: 76%;">
+					<u-icon name="download"></u-icon>
+					<text class="margin-left-20">保存到相册</text>
+				</view>
+			</view>
+		</view>
+	</view>
+</template>
+<script>
+	import DrawPoster from "u-draw-poster";
+	import {
+		drawQrCode
+	} from "u-draw-poster";
+	DrawPoster.useCtx(drawQrCode);
+	export default {
+		data: () => ({
+			imgUrl: '',
+		}),
+		async onLoad(options) {
+			// 创建绘制工具
+			const dp = await DrawPoster.build({
+				selector: 'canvas',
+				loading: true,
+				debugging: true,
+			});
+			const w = (dp.canvas.width = 670);
+			const h = (dp.canvas.height = 940);
+
+			//初始化参数
+			let index = options.index
+			let bgImg = `/static/poster/wuliao${index}.png`
+			let shopDetail = this.$cache.get('selectedShop')
+			
+			let qrCodeText = this.$global.QR_PATH + this.vuex_shopId
+			let titleParams={
+				x:w / 2 - 60,
+				y:h / 2 - 240,
+				color:"#000",
+				text:shopDetail.name
+			}
+			let qrParams = {
+				x: w / 2 - 175,
+				y: h / 2 - 200,
+				text: qrCodeText,
+				size: 350,
+				margin: 5,
+			}
+			
+			if (index==2) {
+				titleParams.y=h / 2 - 90
+				qrParams.y=h / 2 - 60
+			}
+			
+			if (index==3) {
+				titleParams.color='#fff'
+				titleParams.y=h / 2 - 150
+				qrParams.y=h / 2 - 120
+			}
+			
+			if (index==4) {
+				titleParams.y=h / 2 - 240
+				qrParams.y=h / 2 - 210
+			}
+			
+
+
+			// 绘制基本背景
+			dp.draw((ctx) => {
+				ctx.fillStyle = '#ffffff';
+				ctx.fillRoundRect(0, 0, w, h, 20);
+				ctx.clip();
+				ctx.fillRect(0, 0, w, h - 160);
+			});
+			// 绘制图片内容
+			dp.draw(async (ctx) => {
+				await Promise.all([
+					ctx.drawImage(bgImg, 0, 0, w, h),
+				]);
+				// 用户二维码
+				await ctx.drawQrCode(qrParams);
+			});
+
+			// 绘制底部文字内容
+			dp.draw((ctx) => {
+				ctx.fillStyle = titleParams.color;
+				ctx.font = '34px PingFang SC';
+				ctx.fillText(titleParams.text, titleParams.x, titleParams.y);
+			});
+			this.imgUrl = await dp.createImagePath();
+		},
+		methods: {
+			savePhoto() {
+				uni.saveImageToPhotosAlbum({
+					filePath: this.imgUrl,
+					success: function() {
+						uni.showToast({
+							title: "保存成功",
+							icon: "none"
+						});
+					},
+					fail: function() {
+						uni.showToast({
+							title: "保存失败,请稍后重试",
+							icon: "none"
+						});
+					}
+				});
+			}
+		}
+	};
+</script>
+
+
+<style lang="scss">
+
+</style>

+ 35 - 515
pages/material-download/material-download.vue

@@ -1,525 +1,45 @@
 <template>
-    <view class="poster_page">
-		<mp-swiper :list="list"></mp-swiper>
-		<!-- <swiper class="poster_swiper" previous-margin="110rpx" circular :current="swiperIndex" next-margin="110rpx" @change="onSwiperChange">
-		    <swiper-item v-for="(item, index) of list" :key="index">
-		        <view class="goods_info_box" :class="{ active: swiperIndex == index }">
-		            <image class="goods_image" :src="item.image" mode="scaleToFill"></image>
-		        </view>
-		    </swiper-item>
-		</swiper> -->
-        <!-- <canvas canvas-id="poster" class="poster_canvas"></canvas> -->
-       
-<!--        <view class="share_save_box">
-			<view class="push_button" @click="onSaveImg">
-				<text style="font-size: 28rpx;">保存图片</text>
-			</view>
-        </view> -->
-    </view>
+	<view class="poster_page">
+		<mp-swiper :list="list" @click="createPoster"></mp-swiper>
+	</view>
 </template>
 <script>
-// 文字换行
-function drawtext(text, maxWidth) {
-    let textArr = text.split("");
-    let len = textArr.length;
-    // 上个节点
-    let previousNode = 0;
-    // 记录节点宽度
-    let nodeWidth = 0;
-    // 文本换行数组
-    let rowText = [];
-    // 如果是字母,侧保存长度
-    let letterWidth = 0;
-    // 汉字宽度
-    let chineseWidth = 21;
-    // otherFont宽度
-    let otherWidth = 10.5;
-    for (let i = 0; i < len; i++) {
-        if (/[\u4e00-\u9fa5]|[\uFE30-\uFFA0]/g.test(textArr[i])) {
-            if(letterWidth > 0){
-                if(nodeWidth + chineseWidth + letterWidth * otherWidth > maxWidth){
-                    rowText.push({
-                        type: "text",
-                        content: text.substring(previousNode, i)
-                    });
-                    previousNode = i;
-                    nodeWidth = chineseWidth;
-                    letterWidth = 0;
-                } else {
-                    nodeWidth += chineseWidth + letterWidth * otherWidth;
-                    letterWidth = 0;
-                }
-            } else {
-                if(nodeWidth + chineseWidth > maxWidth){
-                    rowText.push({
-                        type: "text",
-                        content: text.substring(previousNode, i)
-                    });
-                    previousNode = i;
-                    nodeWidth = chineseWidth;
-                }else{
-                    nodeWidth += chineseWidth;
-                }
-            }
-        } else {
-            if(/\n/g.test(textArr[i])){
-                rowText.push({
-                    type: "break",
-                    content: text.substring(previousNode, i)
-                });
-                previousNode = i + 1;
-                nodeWidth = 0;
-                letterWidth = 0;
-            }else if(textArr[i] == "\\" && textArr[i + 1] == "n"){
-                rowText.push({
-                    type: "break",
-                    content: text.substring(previousNode, i)
-                });
-                previousNode = i + 2;
-                nodeWidth = 0;
-                letterWidth = 0;
-            }else if(/[a-zA-Z0-9]/g.test(textArr[i])){
-                letterWidth += 1;
-                if(nodeWidth + letterWidth * otherWidth > maxWidth){
-                    rowText.push({
-                        type: "text",
-                        content: text.substring(previousNode, i + 1 - letterWidth)
-                    });
-                    previousNode = i + 1 - letterWidth;
-                    nodeWidth = letterWidth * otherWidth;
-                    letterWidth = 0;
-                }
-            } else{
-                if(nodeWidth + otherWidth > maxWidth){
-                    rowText.push({
-                        type: "text",
-                        content: text.substring(previousNode, i)
-                    });
-                    previousNode = i;
-                    nodeWidth = otherWidth;
-                }else{
-                    nodeWidth += otherWidth;
-                }
-            }
-        }
-    }
-    if (previousNode < len) {
-        rowText.push({
-            type: "text",
-            content: text.substring(previousNode, len)
-        });
-    }
-    return rowText;
-}
-let settingWritePhotosAlbum = false;
-
-import mpSwiper from "./comps/mp-swiper.vue"
-export default {
-	components:{
-		mpSwiper
-	},
-    data() {
-        return {
-			type:'',
-			list:[
-				{
-					title:'麻辣烫',
-					image:'/static/icon/wuliao1.png'
-				},
-				{
-					title:'麻辣烫',
-					image:'/static/icon/wuliao1.png'
-				},
-				{
-					title:'麻辣烫',
-					image:'/static/icon/wuliao1.png'
-				},
-				{
-					title:'麻辣烫',
-					image:'/static/icon/wuliao1.png'
-				},
-				{
-					title:'麻辣烫',
-					image:'/static/icon/wuliao1.png'
-				}
-			],
-			cardCur:0,
-			//平台
-			platformName: "联兑通",
-			recommendCodeGoods: "",
-			//二维码
-            swiperIndex: 0,
-            posterImgs: [],
-            h5SaveImg: ""
-        };
-    },
-    onLoad(options) {
-		
-    },
-    computed: {
-    },
-    //方法
-    methods: {
-		cardSwiper(e){
-			console.log(e);
+	import mpSwiper from "./comps/mp-swiper.vue"
+	export default {
+		components: {
+			mpSwiper
 		},
-		fetchData1(id){
-			this.$request.get(myApi.live.page,{params:{size:300,id:id}}).then(res=>{
-				this.list=[]
-				res.data.records.forEach(item=>{
-					let obj={}
-					obj.headImgs=item.pic
-					if(item.account>-0.000001&&item.account<0.000001){
-						obj.goodsPrice="免费观看"
-					}else{
-						obj.goodsPrice=item.account
+		data() {
+			return {
+				list: [{
+						name: '模板1',
+						image: 'https://guosen-bucket-ldt.obs.cn-south-1.myhuaweicloud.com:443/09fd8a561be341898cf0a18676cb5543-gx8N2ZYZ1Tgfd68d224f9be781b5350604a93eb19665.png'
+					},
+					{
+						name: '模板2',
+						image: 'https://guosen-bucket-ldt.obs.cn-south-1.myhuaweicloud.com:443/78978a6eff7e405aa94ce88c2e2c5db8-sIJjjTCcbtWm8125a0b912d80d468bc514b4025468ca.png'
+					},
+					{
+						name: '模板3',
+						image: 'https://guosen-bucket-ldt.obs.cn-south-1.myhuaweicloud.com:443/ed3e1b59af934cf481fe8ec1747e1e3a-TztUhOtCZEHt83e8384035c15466d4a17cf6ee3c9519.png'
+					},
+					{
+						name: '模板4',
+						image: 'https://guosen-bucket-ldt.obs.cn-south-1.myhuaweicloud.com:443/be1bf10664ed47998752a423abae5d7f-cQkZEj7ZXbZ1662466380785e447bc1b1c3155317a95.png'
 					}
-					obj.goodsName=item.title
-					obj.id=item.id
-					this.list.push(obj)
-				})
-				this.getAccessToken()
-			})
+				],
+			};
 		},
-        // 轮播图变化
-        onSwiperChange(e) {
-            this.swiperIndex = e.detail.current;
-			this.getAccessToken()
-        },
-        // 创建海报
-        createPoster() {
-            return new Promise((resolve, reject) => {
-                uni.showLoading({
-                    title: '海报生成中'
-                });
-                const ctx = uni.createCanvasContext('poster');
-                ctx.fillRect(0, 0, 375, 673);
-                ctx.setFillStyle("#FFF");
-                ctx.fillRect(0, 0, 375, 673);
-                uni.downloadFile({
-                    url: this.list[this.swiperIndex].headImgs,
-                    success: (res) => {
-                        if (res.statusCode === 200) {
-                            ctx.drawImage(res.tempFilePath, 0, 0, 375, 375);
-                            uni.downloadFile({
-                                url: this.recommendCodeGoods,
-                                success: (res2) => {
-                                    if (res.statusCode === 200) {
-                                        // 商品标题
-                                        ctx.setFontSize(16);
-                                        ctx.setFillStyle('#333');
-                                        let drawtextList = drawtext(this.list[this.swiperIndex].goodsName, 420);
-                                        let textTop = 0;
-                                        drawtextList.forEach((item,index) => {
-                                            if(index < 2){
-                                                textTop = 380 + (index + 1) * 28;
-												if(index==0){
-													ctx.fillText(item.content, 22, textTop);
-												}else{
-													if(item.content.length>20){
-														ctx.fillText(item.content+"...", 22, textTop);
-													}else{
-														ctx.fillText(item.content, 22, textTop);
-													}
-												}
-                                            }
-                                        });
-                                        // 商品价格
-                                        ctx.setFontSize(20);
-                                        ctx.setFillStyle('#f00');
-                                        ctx.fillText(this.list[this.swiperIndex].goodsPrice, 17, textTop + 47);
-                                        // 商品分割线
-                                        ctx.beginPath();
-                                        ctx.setLineWidth(1);
-                                        ctx.moveTo(17, textTop + 70);
-                                        ctx.lineTo(358, textTop + 70);
-                                        ctx.setStrokeStyle('#eee');
-                                        ctx.stroke();
-                                        // 长按识别二维码访问
-                                        ctx.setFontSize(14);
-                                        ctx.setFillStyle('#333');
-                                        ctx.fillText("扫描二维码访问", 17, textTop + 136);
-                                        // 平台名称
-                                        ctx.setFontSize(12);
-                                        ctx.setFillStyle('#999');
-                                        ctx.fillText(this.platformName, 17, textTop + 170);
-                                        // 二维码
-                                        ctx.drawImage(res2.tempFilePath, 238, textTop + 88, 120, 120);
-                                        ctx.draw(true, () => {
-                                            // canvas画布转成图片并返回图片地址
-                                            uni.canvasToTempFilePath({
-                                                canvasId: 'poster',
-                                                width: 375,
-                                                height: 673,
-                                                success: (res) => {
-                                                    if(this.posterImgs[this.swiperIndex]){
-                                                        this.posterImgs[this.swiperIndex].temporary = res.tempFilePath;
-                                                    }else{
-                                                        this.posterImgs[this.swiperIndex] = {
-                                                            temporary: res.tempFilePath
-                                                        };
-                                                    }
-                                                    console.log("海报制作成功!");
-                                                    resolve(res.tempFilePath);
-                                                },
-                                                fail: () => {
-                                                    uni.hideLoading();
-                                                    reject();
-                                                }
-                                            })
-                                        });
-                                    } else {
-                                        uni.hideLoading();
-                                        uni.showToast({
-                                            title: '海报制作失败,图片下载失败',
-                                            icon: 'none'
-                                        });
-                                    }
-                                },
-                                fail: err => {
-                                    uni.hideLoading();
-                                    uni.showToast({
-                                        title: '海报制作失败,图片下载失败',
-                                        icon: 'none'
-                                    });
-                                }
-                            });
-                        } else {
-                            uni.hideLoading();
-                            uni.showToast({
-                                title: '海报制作失败,图片下载失败',
-                                icon: 'none'
-                            });
-                        }
-                    },
-                    fail: err => {
-                        uni.hideLoading();
-                        uni.showToast({
-                            title: '海报制作失败,图片下载失败',
-                            icon: 'none'
-                        });
-                    }
-                });
-            });
-        },
-        // 保存图片
-        async onSaveImg() {
-            let imgUrl = "";
-            if(this.posterImgs[this.swiperIndex] && this.posterImgs[this.swiperIndex].temporary){
-                imgUrl = await this.posterImgs[this.swiperIndex].temporary;
-            }else{
-                imgUrl = await this.createPoster();
-            }
-            // #ifdef H5
-            this.h5SaveImg = imgUrl;
-            uni.hideLoading();
-            // #endif
-            // #ifdef MP-WEIXIN
-            uni.showLoading({
-                title: '海报下载中'
-            });
-            if (settingWritePhotosAlbum) {
-                uni.getSetting({
-                    success: res => {
-                        if (res.authSetting['scope.writePhotosAlbum']) {
-                            uni.saveImageToPhotosAlbum({
-                                filePath: imgUrl,
-                                success: () => {
-                                    uni.showToast({
-                                        title: '保存成功'
-                                    });
-                                },
-                                complete: () => {
-                                    uni.hideLoading();
-                                }
-                            });
-                        } else {
-                            uni.showModal({
-                                title: '提示',
-                                content: '请先在设置页面打开“保存相册”使用权限',
-                                confirmText: '去设置',
-                                cancelText: '算了',
-                                success: data => {
-                                    if (data.confirm) {
-                                        uni.openSetting();
-                                    }
-                                },
-                                complete: () => {
-                                    uni.hideLoading();
-                                }
-                            });
-                        }
-                    },
-                    complete: () => {
-                        uni.hideLoading();
-                    }
-                });
-            } else {
-                settingWritePhotosAlbum = true;
-                uni.authorize({
-                    scope: 'scope.writePhotosAlbum',
-                    success: () => {
-                        uni.saveImageToPhotosAlbum({
-                            filePath: imgUrl,
-                            success: () => {
-                                uni.showToast({
-                                    title: '保存成功'
-                                });
-                            },
-                            complete: () => {
-                                uni.hideLoading();
-                            }
-                        });
-                    },
-                    complete: () => {
-                        uni.hideLoading();
-                    }
-                });
-            }
-            // #endif
-            // #ifdef APP-PLUS
-            uni.showLoading({
-                title: '海报下载中'
-            });
-            uni.saveImageToPhotosAlbum({
-                filePath: imgUrl,
-                success: () => {
-                    uni.hideLoading();
-                    uni.showToast({
-                        title: '保存成功'
-                    });
-                }
-            });
-            // #endif
-        }
-    }
-};
+		methods: {
+			createPoster(index) {
+				uni.navigateTo({
+					url:"createPoster?index="+(index+1)
+				})
+			},
+
+		}
+	};
 </script>
 <style lang="scss" scoped>
-.poster_page {
-    min-height: 100vh;
-    background-color: #f5f5f5;
-}
-.poster_canvas {
-    width: 750rpx;
-    height: 1324rpx;
-    position: fixed;
-    top: -10000rpx;
-    left: 0rpx;
-}
-.poster_swiper {
-    height: 950rpx;
-    width: 100%;
-    swiper-item {
-        box-sizing: border-box;
-        display: flex;
-        align-items: center;
-        .goods_info_box {
-            width: 100%;
-            height: 100%;
-            transform: scale(0.88);
-            transition: all 0.4s;
-            position: relative;
-            overflow: hidden;
-            background-color: #FFFFFF;
-            &.active {
-                transform: scale(1);
-            }
-            .goods_image {
-                width: 100%;
-                height: calc(100vw - 220rpx);
-            }
-            .goods_info {
-                padding: 24rpx;
-                .goods_name {
-                    color: #333;
-                    font-size: 30rpx;
-					overflow: hidden;
-					text-overflow: ellipsis;
-					display: -webkit-box;
-					-webkit-line-clamp: 2;
-					-webkit-box-orient: vertical;
-                }
-                .price_box {
-                    margin-top: 24rpx;
-                    display: flex;
-                    align-items: center;
-                    .price {
-                        font-size: 38rpx;
-                        color: red;
-                    }
-                    .store_price {
-                        margin-left: 30rpx;
-                        font-size: 26rpx;
-                        color: #999;
-                        text-decoration: line-through;
-                    }
-                }
-                .poster_info {
-                    border-top: 2rpx solid #f1f1f1;
-                    padding-top: 24rpx;
-                    margin-top: 24rpx;
-                    display: flex;
-                    align-items: center;
-                    justify-content: space-between;
-                    .info {
-                        display: flex;
-                        flex-direction: column;
-                        view {
-                            color: #333;
-                            font-size: 28rpx;
-                        }
-                        text {
-                            color: #999;
-                            font-size: 24rpx;
-                            margin-top: 20rpx;
-                        }
-                    }
-                    .poster_code_image {
-                        width: 170rpx;
-                        height: 170rpx;
-                        flex-shrink: 0;
-                    }
-                }
-            }
-        }
-    }
-}
-.push_button{
-	position:relative;
-	color:#FFF;
-	display:block;
-	text-decoration:none;
-	margin:0 auto;
-	border-radius:40rpx;
-	text-align:center;
-	padding:12rpx 80rpx;
-	-webkit-transition: all 0.1s;
-	-moz-transition: all 0.1s;
-	transition: all 0.1s;
-	
-	background-color: rgba(232, 0, 0,.7);
-	-webkit-box-shadow: 2px 4px 2px rgba(232, 0, 0,.5);
-	-moz-box-shadow: 2px 4px 2px rgba(232, 0, 0,.5);
-	box-shadow: 2px 4px 2px rgba(232, 0, 0,.5);
-}
-.push_button:active{
-	-webkit-box-shadow: 0px 2px 0px rgba(232, 0, 0,.5);
-	-moz-box-shadow: 0px 2px 0px rgba(232, 0, 0,.5);
-	box-shadow: 0px 2px 0px rgba(232, 0, 0,.5);
-	position:relative;
-	top:7px;
-}
 
-
-.share_save_box {
-    position: fixed;
-    bottom: calc((100vh - 950rpx - 140rpx) / 4);
-    left: 0;
-    z-index: 6;
-    width: 100%;
-    display: flex;
-}
 </style>
-
-

+ 0 - 125
pages/material-download/test.vue

@@ -1,125 +0,0 @@
-<template>
-	<view class="swiper">
-		<view class="swiper-title" >
-			<swiper :style="{height:fullHeight}" class="swiper-tall" :indicator-dots="indicatorDots" :autoplay="autoplay" :previous-margin="previousMargin"
-			 :next-margin="nextMargin" :circular="circular" @change="change" :current="swiperCurrentIndex">
-				<swiper-item class="swiper-container" v-for="(item,index) in imgs" :key="index"
-				 :item-id="index" :data-year="index">
-				 
-				<view class="swiper-item">
-					<image :animation="animationData[index]" :src="item" mode=""></image>
-				</view>
-				</swiper-item>
-			</swiper>
-		</view>
-		
-		<view class="center">
-			<view class="cu-btn  flex round text-lg" style="padding: 46rpx 0;background-color: #EF9944;color: #FFFFFF;width: 76%;">
-				生成海报
-			</view>
-		</view>
-	</view>
-</template>
-<script>
-	export default {
-		data() {
-			return {
-				screenHeight: 0,
-				animationData: {
-					0:{},
-					1:{},
-					2:{}
-				},
-				title: '0',
-				indicatorDots: false,
-				autoplay: false,
-				previousMargin: uni.upx2px(82)+'px',
-				nextMargin: uni.upx2px(82)+'px',
-				circular: true,
-				zoomParam: 1.10,
-				swiperCurrentIndex: 0,
-				data: [],
-				max: 0,
-				imgs:[
-					'/static/icon/wuliao.png',
-					'/static/icon/wuliao.png',
-					'/static/icon/wuliao.png',
-					'/static/icon/wuliao.png',
-				]
-			}
-		},
-		computed:{
-			fullHeight() {
-				const res = uni.getSystemInfoSync();
-				return res.windowHeight  - (res.statusBarHeight+44)+'px';
-			}
-		},
-		onLoad() {
-			this.animation = uni.createAnimation();
-			this.animation.scale(this.zoomParam).step();
-			this.animationData[0] = this.animation.export();
-		},
-		methods: {
-			change(e) {
-				this.swiperCurrentIndex = e.detail.current;
-				this.title = e.detail.currentItemId;
-				for (let key in this.animationData) {
-					if (e.detail.currentItemId == key) {
-						this.animation.scale(this.zoomParam).step();
-						this.animationData[key] = this.animation.export();
-					} else {
-						this.animation.scale(1.0).step();
-						this.animationData[key] = this.animation.export();
-					}
-				}
-				this.$emit('change',this.swiperCurrentIndex)
-			}
-		}
-	}
-</script>
-
-<style>
-	page{
-		display: flex;
-		flex-wrap: wrap;  
-	}
-	
-	
-	
-	.save-btn{
-		background-color: #EF9944;
-		color: #FFFFFF;
-	}
-	
-	.swiper-container {
-		display: flex;
-		align-items: center;
-	}
-
-	.swiper-item {
-		display: flex;
-		flex-wrap: wrap;
-		justify-content: center;
-		margin-left: auto;
-		margin-right: auto;
-		height: 760upx;
-		width: 544upx;
-		line-height: 300upx;
-		text-align: center;
-		margin-bottom: 50upx;
-	}
-
-
-
-	.swiper-tall {
-		display: flex;
-		align-items: center;
-	}
-
-	.swiper-title {
-		margin-top: -100rpx;
-		width: 760upx;
-		text-align: center;
-	}
-
-</style>

BIN
static/del/del.png


BIN
static/icon/CMBCHINA.png


BIN
static/icon/del.png


BIN
static/icon/empty.png


BIN
static/icon/empty1.png


BIN
static/icon/empty2.png


BIN
static/icon/empty3.png


BIN
static/icon/empty4.png


BIN
static/icon/faqi.png


BIN
static/icon/logo.png


BIN
static/icon/photo.png


BIN
static/icon/points-value.png


BIN
static/icon/qingdan.png


BIN
static/icon/upload.png


BIN
static/icon/wuliao1.png


BIN
static/icon/yingye.png


BIN
static/icon/zhongguo.png


BIN
static/pay/loading.png


BIN
static/pay/success.png


BIN
static/poster/wuliao1.png


BIN
static/poster/wuliao2.png


BIN
static/poster/wuliao3.png


BIN
static/poster/wuliao4.png


+ 1 - 0
store/index.js

@@ -35,6 +35,7 @@ const store = new Vuex.Store({
 		vuex_audit: lifeData.vuex_audit ? lifeData.vuex_audit : 0,
 		vuex_mallId: lifeData.vuex_mallId ? lifeData.vuex_mallId : null,
 		vuex_shopId: lifeData.vuex_shopId ? lifeData.vuex_shopId : null,
+		vuex_isOpenMember: lifeData.vuex_isOpenMember ? lifeData.vuex_isOpenMember : false,
 	},
 	mutations: {
 		$uStore(state, payload) {