cmy 1 rok pred
rodič
commit
9d3ad790a0

+ 0 - 12
pages.json

@@ -21,18 +21,6 @@
 				"navigationBarTitleText": "邀好友赚佣金"
 			}
 		},
-		// #ifdef H5
-		{
-			"path": "pages/user/model/modeltemplate/index",
-			"style": {
-				"navigationStyle": "custom",
-				"navigationBarTitleText": "模板页",
-				"app-plus": {
-					"titleNView": false
-				}
-			}
-		},
-		//#endif
 		// {
 		// 	"path": "pages/cart/cart",
 		// 	"style": {

+ 20 - 7
pages/modelData/index.vue

@@ -1,15 +1,27 @@
 <template>
-	<block>
-		<model1 v-if="modelId==3||modelId==1" :cardInfo='templateData' :isShare='isShare' :isLook='isLook'></model1>
-		<model2 v-if="modelId==2" :cardInfo='templateData' :isShare='isShare' :isLook='isLook'></model2>
-	</block>
+	<view>
+		<model1 :shareNumber='shareNumber' :isDefault='isDefault' v-if="modelId==3||modelId==1" :templateDetail='templateData' :isShare='isShare' :isLook='isLook'></model1>
+		<model2 :shareNumber='shareNumber' :isDefault='isDefault' v-if="modelId==4" :templateDetail='templateData' :isShare='isShare' :isLook='isLook'></model2>
+		<model3 :shareNumber='shareNumber' :isDefault='isDefault' v-if="modelId==5" :templateDetail='templateData' :isShare='isShare' :isLook='isLook'></model3>
+	</view>
 </template>
 
 <script>
 	import model1 from './modeltemplate/model_1.vue';
 	import model2 from './modeltemplate/model_2.vue'
+	import model3 from './modeltemplate/model_3.vue'
 	export default {
-		props: {
+		props: {
+			// 浏览数量
+			shareNumber: {
+				type: Number,
+				default:0
+			},
+			// 是否显示默认数据
+			isDefault: {
+				type: Boolean,
+				default:true
+			},
 			templateData: {
 				type: Object,
 				default: ()=>{
@@ -29,10 +41,11 @@
 				type: Number,
 				default:0
 			},
-		},
+		},
 		components: {
 			model1,
-			model2
+			model2,
+			model3
 		},
 		data() {
 			return {

+ 72 - 64
pages/modelData/modeltemplate/model_1.vue

@@ -8,16 +8,11 @@
 			<view class="user-name">
 				{{cardInfo.name || '暂无'}}
 			</view>
-			<button type="default" class="top-btn fx-btn" v-if="isShare" open-type="share" >
+			<button type="default" class="top-btn fx-btn" v-if="isShare" open-type="share">
 				<image :src="baseURL + '/resource/icon/model1/fx.png'" mode=""></image>
 			</button>
-			<!-- 模板查看次数 -->
-			<view class="top-btn visit mvisit padding-r-10" v-if="isLook==1">
-				浏览:{{cardInfo.look_count}}
-			</view>
-			<!-- 别人查看次数 -->
-			<view class="top-btn visit padding-r-10" v-else-if="isLook==2">
-				浏览:{{cardInfo.card_look_count}}
+			<view class="top-btn visit mvisit padding-r-10" v-if="isLook==1||isLook==2">
+				浏览:{{shareNumber}}
 			</view>
 		</view>
 		<view class="m-body gr">
@@ -169,71 +164,90 @@
 	} from '@/api/user.js';
 	export default {
 		props: {
-			isShare:{
+			// 浏览数量
+			shareNumber: {
+				type: Number,
+				default:0
+			},
+			// 是否显示默认数据
+			isDefault: {
+				type: Boolean,
+				default: true
+			},
+			isShare: {
 				type: Boolean,
-				default:false
+				default: false
 			},
 			//1为模板2为用户
-			isLook:{
+			isLook: {
 				type: Number,
-				default:0
+				default: 0
 			},
-			cardInfo: {
+			templateDetail: {
 				type: Object,
 				default: () => {
-					return {
-						name: '佚名',
-						avatar: 'https://api.myjie.cn/resource/icon/base/f.png',
-						age: '41',
-						twelve: '鼠',
-						work_year: '10',
-						constellation: '处女座',
-						ancestral_place: '浙江',
-						minority: '汉族',
-						education: '本科',
-						service_area_all: ['浙江省台州市路桥区'],
-						service_min_price: 100,
-						service_max_price: 200,
-						service_time_type_title: '每小时',
-						service_intro_content: '高级育婴师证|高级催乳师证|早产儿护理师母婴护理证|金牌月嫂证|产后恢复师证|公共营养师证|月子药膳调理师证|国际宝宝睡眠咨询师证|普通话二级甲等|中央广播电视大学学历|学前教育专业,深耕幼教十年,技能全面,性格活泼,有亲和力,做事干净利落,有很强的责任心。对宝宝有爱心,体贴新手妈妈。专业技能熟练。应急能力强。让家人放心、产妇舒心的坐好月子。',
-						service_intro_imgs: ['https://api.myjie.cn/resource/icon/base/pj1.png',
-							'https://api.myjie.cn/resource/icon/base/pj2.png',
-							'https://api.myjie.cn/resource/icon/base/pj3.png',
-							'https://api.myjie.cn/resource/icon/base/pj4.png'
-						],
-						service_audit_imgs: ['https://api.myjie.cn/resource/icon/base/zs1.png',
-							'https://api.myjie.cn/resource/icon/base/zs2.png',
-							'https://api.myjie.cn/resource/icon/base/zs3.png',
-							'https://api.myjie.cn/resource/icon/base/zs4.png'
-						],
-						service_project_ar: [{
-								title: '婴幼儿睡眠管理',
-								content: '如:日夜颠倒、睡眠不规律、乳头混淆、奶睡、抱睡等问题,帮助宝爸宝妈规律孩子作息、解决婴幼儿喂养困扰,培养良好的生活、学习习惯。'
-							}, {
-								title: '特色月子餐',
-								content: '套用客户的一句话“养眼、养心更养胃”!家常菜、面食、点心、甜品、靓汤、五谷杂粮粥、婴幼儿花样辅食等。'
-							},
-							{
-								title: '早产儿特殊护理',
-								content: '包括早产儿基础护理、安全喂养方法、追赶性生长、消化与免疫系统等技能,根据宝宝具体情况给予早产儿家长的科学入户指导。'
-							},
-							{
-								title: '0-6岁早期教育',
-								content: '在婴孩最敏感最能接受的时期进行事半功倍的适时教育,针对不同年龄段的孩子,开发婴幼儿潜能的教育,为孩子多元化和健康人格打下良好基础。'
-							}
-						],
-						is_type_audit: 1
-					}
+					return {}
 				}
 			},
 		},
 		data() {
 			return {
+				default: {
+					name: '佚名',
+					avatar: 'https://api.myjie.cn/resource/icon/base/f.png',
+					age: '41',
+					twelve: '鼠',
+					work_year: '10',
+					constellation: '处女座',
+					ancestral_place: '浙江',
+					minority: '汉族',
+					education: '本科',
+					service_area_all: ['浙江省台州市路桥区'],
+					service_min_price: 100,
+					service_max_price: 200,
+					service_time_type_title: '每小时',
+					service_intro_content: '高级育婴师证|高级催乳师证|早产儿护理师母婴护理证|金牌月嫂证|产后恢复师证|公共营养师证|月子药膳调理师证|国际宝宝睡眠咨询师证|普通话二级甲等|中央广播电视大学学历|学前教育专业,深耕幼教十年,技能全面,性格活泼,有亲和力,做事干净利落,有很强的责任心。对宝宝有爱心,体贴新手妈妈。专业技能熟练。应急能力强。让家人放心、产妇舒心的坐好月子。',
+					service_intro_imgs: ['https://api.myjie.cn/resource/icon/base/pj1.png',
+						'https://api.myjie.cn/resource/icon/base/pj2.png',
+						'https://api.myjie.cn/resource/icon/base/pj3.png',
+						'https://api.myjie.cn/resource/icon/base/pj4.png'
+					],
+					service_audit_imgs: ['https://api.myjie.cn/resource/icon/base/zs1.png',
+						'https://api.myjie.cn/resource/icon/base/zs2.png',
+						'https://api.myjie.cn/resource/icon/base/zs3.png',
+						'https://api.myjie.cn/resource/icon/base/zs4.png'
+					],
+					service_project_ar: [{
+							title: '婴幼儿睡眠管理',
+							content: '如:日夜颠倒、睡眠不规律、乳头混淆、奶睡、抱睡等问题,帮助宝爸宝妈规律孩子作息、解决婴幼儿喂养困扰,培养良好的生活、学习习惯。'
+						}, {
+							title: '特色月子餐',
+							content: '套用客户的一句话“养眼、养心更养胃”!家常菜、面食、点心、甜品、靓汤、五谷杂粮粥、婴幼儿花样辅食等。'
+						},
+						{
+							title: '早产儿特殊护理',
+							content: '包括早产儿基础护理、安全喂养方法、追赶性生长、消化与免疫系统等技能,根据宝宝具体情况给予早产儿家长的科学入户指导。'
+						},
+						{
+							title: '0-6岁早期教育',
+							content: '在婴孩最敏感最能接受的时期进行事半功倍的适时教育,针对不同年龄段的孩子,开发婴幼儿潜能的教育,为孩子多元化和健康人格打下良好基础。'
+						}
+					],
+					is_type_audit: 1
+				}
 			}
 		},
 		computed: {
 			...mapState(['baseURL']),
-			...mapState('user', ['userInfo'])
+			...mapState('user', ['userInfo']),
+			cardInfo() {
+				console.log("进入");
+				if (this.isDefault) {
+					return this.default
+				} else {
+					return this.templateDetail
+				}
+			}
 		},
 		onShow() {
 			// this.getUser()
@@ -255,6 +269,7 @@
 	.mone {
 		background-color: #f8e1df;
 		padding-bottom: 30rpx;
+
 		.m-top {
 			width: 750rpx;
 			position: relative;
@@ -674,11 +689,4 @@
 			transform: rotateY(180deg);
 		}
 	}
-
-
-
-
-
-
-
 </style>

+ 112 - 0
pages/modelData/modeltemplate/model_3.vue

@@ -0,0 +1,112 @@
+
+<template>
+	<view class="mone">
+		
+		
+	</view>
+</template>
+
+<script>
+	import {
+		mapState,
+		mapMutations
+	} from 'vuex';
+	import {
+		getUserCardInfo,
+		getCommonUserCardInfo,
+		getShowTemplateItem,
+		subShowTemplateOrder
+	} from '@/api/model.js'
+	import {
+		getUser
+	} from '@/api/user.js';
+	export default {
+		props: {
+			isShare:{
+				type: Boolean,
+				default:false
+			},
+			//1为模板2为用户
+			isLook:{
+				type: Number,
+				default:0
+			},
+			cardInfo: {
+				type: Object,
+				default: () => {
+					return {
+						name: '佚名',
+						avatar: 'https://api.myjie.cn/resource/icon/base/f.png',
+						age: '41',
+						twelve: '鼠',
+						work_year: '10',
+						constellation: '处女座',
+						ancestral_place: '浙江',
+						minority: '汉族',
+						education: '本科',
+						service_area_all: ['浙江省台州市路桥区'],
+						service_min_price: 100,
+						service_max_price: 200,
+						service_time_type_title: '每小时',
+						service_intro_content: '高级育婴师证|高级催乳师证|早产儿护理师母婴护理证|金牌月嫂证|产后恢复师证|公共营养师证|月子药膳调理师证|国际宝宝睡眠咨询师证|普通话二级甲等|中央广播电视大学学历|学前教育专业,深耕幼教十年,技能全面,性格活泼,有亲和力,做事干净利落,有很强的责任心。对宝宝有爱心,体贴新手妈妈。专业技能熟练。应急能力强。让家人放心、产妇舒心的坐好月子。',
+						service_intro_imgs: ['https://api.myjie.cn/resource/icon/base/pj1.png',
+							'https://api.myjie.cn/resource/icon/base/pj2.png',
+							'https://api.myjie.cn/resource/icon/base/pj3.png',
+							'https://api.myjie.cn/resource/icon/base/pj4.png'
+						],
+						service_audit_imgs: ['https://api.myjie.cn/resource/icon/base/zs1.png',
+							'https://api.myjie.cn/resource/icon/base/zs2.png',
+							'https://api.myjie.cn/resource/icon/base/zs3.png',
+							'https://api.myjie.cn/resource/icon/base/zs4.png'
+						],
+						service_project_ar: [{
+								title: '婴幼儿睡眠管理',
+								content: '如:日夜颠倒、睡眠不规律、乳头混淆、奶睡、抱睡等问题,帮助宝爸宝妈规律孩子作息、解决婴幼儿喂养困扰,培养良好的生活、学习习惯。'
+							}, {
+								title: '特色月子餐',
+								content: '套用客户的一句话“养眼、养心更养胃”!家常菜、面食、点心、甜品、靓汤、五谷杂粮粥、婴幼儿花样辅食等。'
+							},
+							{
+								title: '早产儿特殊护理',
+								content: '包括早产儿基础护理、安全喂养方法、追赶性生长、消化与免疫系统等技能,根据宝宝具体情况给予早产儿家长的科学入户指导。'
+							},
+							{
+								title: '0-6岁早期教育',
+								content: '在婴孩最敏感最能接受的时期进行事半功倍的适时教育,针对不同年龄段的孩子,开发婴幼儿潜能的教育,为孩子多元化和健康人格打下良好基础。'
+							}
+						],
+						is_type_audit: 1
+					}
+				}
+			},
+		},
+		data() {
+			return {
+			}
+		},
+		computed: {
+			...mapState(['baseURL']),
+			...mapState('user', ['userInfo'])
+		},
+		onShow() {
+			// this.getUser()
+		},
+		onUnload() {
+			let pages = getCurrentPages(); //获取加载的页面
+			let currentPage = pages[pages.length - 2]; //获取当前页面的对象
+			if (currentPage.route == 'pages/public/wxLogin') {
+				uni.switchTab({
+					url: '/pages/index/index'
+				})
+			}
+		},
+		methods: {}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.mone {
+		background-color: #f8e1df;
+		padding-bottom: 30rpx;
+	}
+</style>

+ 52 - 60
pages/user/model/model.vue

@@ -1,6 +1,7 @@
 <template>
 	<view class="content mone" v-if="baseURL">
-		<model :modelId='mtype' :templateData='templateData' :isShare='isShare' :isLook='isLook'></model>
+		<model :modelId='mtype' :templateData='userTemplate' :isShare='isShare' :isLook='isLook' :isDefault='isDefault'
+			:share-number='shareNumber'></model>
 		<view class="bottom_padding" v-if="type!=1">
 
 		</view>
@@ -54,6 +55,10 @@
 	import {
 		getUser
 	} from '@/api/user.js';
+	import {
+		saveUrl,
+		interceptor
+	} from '@/utils/loginUtils.js';
 	import model from '@/pages/modelData/index.vue';
 	export default {
 		components: {
@@ -64,56 +69,11 @@
 				mtype: 1, //modelid
 				shareId: '', //保存分享uid
 				// 默认显示数据
-				cardInfo: {
-					name: '佚名',
-					avatar: 'https://api.myjie.cn/resource/icon/base/f.png',
-					age: '41',
-					twelve: '鼠',
-					work_year: '10',
-					constellation: '处女座',
-					ancestral_place: '浙江',
-					minority: '汉族',
-					education: '本科',
-					service_area_all: ['浙江省台州市路桥区'],
-					service_min_price: 100,
-					service_max_price: 200,
-					service_time_type_title: '每小时',
-					service_intro_content: '高级育婴师证|高级催乳师证|早产儿护理师母婴护理证|金牌月嫂证|产后恢复师证|公共营养师证|月子药膳调理师证|国际宝宝睡眠咨询师证|普通话二级甲等|中央广播电视大学学历|学前教育专业,深耕幼教十年,技能全面,性格活泼,有亲和力,做事干净利落,有很强的责任心。对宝宝有爱心,体贴新手妈妈。专业技能熟练。应急能力强。让家人放心、产妇舒心的坐好月子。',
-					service_intro_imgs: ['https://api.myjie.cn/resource/icon/base/pj1.png',
-						'https://api.myjie.cn/resource/icon/base/pj2.png',
-						'https://api.myjie.cn/resource/icon/base/pj3.png',
-						'https://api.myjie.cn/resource/icon/base/pj4.png'
-					],
-					service_audit_imgs: ['https://api.myjie.cn/resource/icon/base/zs1.png',
-						'https://api.myjie.cn/resource/icon/base/zs2.png',
-						'https://api.myjie.cn/resource/icon/base/zs3.png',
-						'https://api.myjie.cn/resource/icon/base/zs4.png'
-					],
-					service_imgs: ['https://api.myjie.cn/resource/icon/base/pj1.png',
-						'https://api.myjie.cn/resource/icon/base/pj2.png',
-						'https://api.myjie.cn/resource/icon/base/pj3.png',
-						'https://api.myjie.cn/resource/icon/base/pj4.png'
-					],
-					service_project_ar: [{
-							title: '婴幼儿睡眠管理',
-							content: '如:日夜颠倒、睡眠不规律、乳头混淆、奶睡、抱睡等问题,帮助宝爸宝妈规律孩子作息、解决婴幼儿喂养困扰,培养良好的生活、学习习惯。'
-						}, {
-							title: '特色月子餐',
-							content: '套用客户的一句话“养眼、养心更养胃”!家常菜、面食、点心、甜品、靓汤、五谷杂粮粥、婴幼儿花样辅食等。'
-						},
-						{
-							title: '早产儿特殊护理',
-							content: '包括早产儿基础护理、安全喂养方法、追赶性生长、消化与免疫系统等技能,根据宝宝具体情况给予早产儿家长的科学入户指导。'
-						},
-						{
-							title: '0-6岁早期教育',
-							content: '在婴孩最敏感最能接受的时期进行事半功倍的适时教育,针对不同年龄段的孩子,开发婴幼儿潜能的教育,为孩子多元化和健康人格打下良好基础。'
-						}
-					],
-					is_type_audit: 1
-				},
+				cardInfo: {},
+				// 是否显示默认
+				isDefault: false,
+				shareNumber: 0, //浏览量
 				userTemplate: {}, //用户展示数据
-				templateData: {}, //模板查看数据
 				modelInfo: {}, //当前模板信息
 				payType: 'wxpay',
 				type: 0, //0为商品页面进入1为个人中心进入修改预览2为分享查看预览,3为已购模板进入查看分享
@@ -143,15 +103,19 @@
 			// #endif
 
 			// 获取模板id
-			this.mtype = opt.mtype
+			this.mtype = +opt.mtype
 			// 获取查看类型
 			this.type = +opt.type
 			// 是否首页进入
 			if (this.type === 0) {
-				this.templateData = this.cardInfo;
 				this.isLook = 1;
 				this.getShowTemplateItem();
-				this.getCommonUserCardInfo(this.userInfo.uid);
+				if (this.userInfo.uid) {
+					this.getCommonUserCardInfo(this.userInfo.uid);
+				}else{
+					// 展示默认数据
+					this.isDefault = true;
+				}
 				return
 			}
 			//个人中心提交数据预览
@@ -161,14 +125,14 @@
 			}
 			//分享预览
 			if (this.type === 2) {
-				console.log(opt.type,'opt.type');
+				console.log(opt.type, 'opt.type');
 				this.isLook = 2;
 				this.getCommonUserCardInfo(opt.uid);
 				return
 			}
 			//我的模板页进入预览
 			if (this.type === 3) {
-				console.log(opt.type,'opt.type');
+				console.log(opt.type, 'opt.type');
 				this.isShare = true;
 				this.isLook = 2;
 				this.shareId = this.userInfo.uid;
@@ -246,14 +210,38 @@
 			...mapMutations('user', ['setUserInfo']),
 			// 模板预览
 			preview() {
-				this.templateData = this.userTemplate.id ? this.userTemplate : this.cardInfo;
+				if (!this.userInfo.uid) {
+					uni.showModal({
+						title: '提示',
+						content: '您未登录是否登录查看',
+						cancelText: '取消',
+						confirmText: '立即登录',
+						success: res => {
+							if (res.confirm) {
+								saveUrl();
+								interceptor();
+							}
+						},
+						fail: () => {},
+						complete: () => {}
+					});
+					return
+				}
+				// 判断是否显示默认数据
+				if (this.userTemplate.id) {
+					this.isDefault = false;
+				} else {
+					this.isDefault = true;
+				}
 				this.previewShow = true;
+
 				// 隐藏浏览数量
 				this.isLook = 0;
 			},
 			// 结束预览
 			outPreview() {
-				this.templateData = this.cardInfo;
+				// 显示默认数据
+				this.isDefault = true;
 				this.previewShow = false;
 				if (this.type == 0) {
 					this.isLook = 1;
@@ -367,7 +355,7 @@
 				}).then(res => {
 					that.modelInfo = res.data;
 					if (that.type == 0) {
-						that.cardInfo.look_count = res.data.look_count
+						that.shareNumber = res.data.look_count
 					}
 				})
 			},
@@ -385,8 +373,11 @@
 					res.data.service_area_all = arr
 					// 保存用户模板数据
 					that.userTemplate = res.data
-					if (that.type == 3||that.type == 2) {
-						that.templateData = res.data
+					// 判断是否从用户个人中心或者分享进入
+					if (that.type == 3 || that.type == 2) {
+						// 修改为非默认数据
+						that.isDefault = false;
+						that.shareNumber = res.data.card_look_count;
 					}
 				})
 			},
@@ -708,6 +699,7 @@
 			padding: 0;
 			border-radius: 0;
 			flex-grow: 1;
+
 			&::after {
 				border: none;
 			}