Forráskód Böngészése

资料库版本修改

喻文俊 3 éve
szülő
commit
be297ede30

+ 330 - 328
common/config/caimeiApi.js

@@ -5,229 +5,229 @@
  */
 import requestUrl from '@/services/ajax.env.js'
 const caimeiApi = {
-	/**
+    /**
 	 * @封装公共get数据请求方法无加载动画
 	 * @方法参数:请求地址,请求后台需要的参数字段,回调函数
 	 * @自定义请求头信息
 	 */
-	get:function(url,data,callback){
+    get:function(url,data,callback){
 		 uni.request({
-			url: requestUrl + url,
-			data:data,
-			header: {
-				'Accept': 'application/json',
-				'Content-Type': 'application/x-www-form-urlencoded', 
-				'X-Token': uni.getStorageSync('token') ? uni.getStorageSync('token') : 'token',
-				'cookie': uni.getStorageSync('sessionid')
-			},
-			method: 'GET',
-			success: (response) => {
-				if(response.statusCode !== 200){
-					uni.showToast({icon: 'none',title:'服务器连接错误',duration: 2000})
-					callback(response.statusCode)
-				}else{
-					callback(response.data)
-				}
-			},
-			fail: (error) => {
-				if (error) {
-					uni.showToast({icon: 'none',title: '网络错误,请稍后重试',duration: 2000})
-				}
-			}
+            url: requestUrl + url,
+            data:data,
+            header: {
+                'Accept': 'application/json',
+                'Content-Type': 'application/x-www-form-urlencoded', 
+                'X-Token': uni.getStorageSync('token') ? uni.getStorageSync('token') : 'token',
+                'cookie': uni.getStorageSync('sessionid')
+            },
+            method: 'GET',
+            success: (response) => {
+                if(response.statusCode !== 200){
+                    uni.showToast({icon: 'none',title:'服务器连接错误',duration: 2000})
+                    callback(response.statusCode)
+                }else{
+                    callback(response.data)
+                }
+            },
+            fail: (error) => {
+                if (error) {
+                    uni.showToast({icon: 'none',title: '网络错误,请稍后重试',duration: 2000})
+                }
+            }
 		 })
-	},
-	/**
+    },
+    /**
 	 * @封装公共get数据请求方法有加载动画
 	 * @方法参数:请求地址,请求后台需要的参数字段,回调函数
 	 * @自定义请求头信息
 	 */
-	lodingGet:function(url,data,callback){
+    lodingGet:function(url,data,callback){
 		 uni.showLoading({mask: true,title:'加载中~',})
 		 uni.request({
-			url: requestUrl + url,
-			data:data,
-			header: {
-				'Accept': 'application/json',
-				'Content-Type': 'application/x-www-form-urlencoded', 
-				'X-Token': uni.getStorageSync('token') ? uni.getStorageSync('token') : 'token',
-				'cookie': uni.getStorageSync('sessionid')
-			},
-			method: 'GET',
-			success: (response) => {
-				if(response.statusCode !== 200){
-					uni.showToast({icon: 'none',title: '服务器连接错误',duration: 2000})
-					callback(response.statusCode)
-				}else{
-					callback(response.data)
-				}
-			},
-			fail: (error) => {
-				if (error) {
-					uni.showToast({icon: 'none',title: '网络错误,请稍后重试',duration: 2000})
-				}
-			},
-			complete: () => {
-				setTimeout(function () {
-					uni.hideLoading()
-				}, 250)
-			}
+            url: requestUrl + url,
+            data:data,
+            header: {
+                'Accept': 'application/json',
+                'Content-Type': 'application/x-www-form-urlencoded', 
+                'X-Token': uni.getStorageSync('token') ? uni.getStorageSync('token') : 'token',
+                'cookie': uni.getStorageSync('sessionid')
+            },
+            method: 'GET',
+            success: (response) => {
+                if(response.statusCode !== 200){
+                    uni.showToast({icon: 'none',title: '服务器连接错误',duration: 2000})
+                    callback(response.statusCode)
+                }else{
+                    callback(response.data)
+                }
+            },
+            fail: (error) => {
+                if (error) {
+                    uni.showToast({icon: 'none',title: '网络错误,请稍后重试',duration: 2000})
+                }
+            },
+            complete: () => {
+                setTimeout(function () {
+                    uni.hideLoading()
+                }, 250)
+            }
 		 })
-	},
-	/**
+    },
+    /**
 	 * @封装公共post数据请求方法
 	 * @方法参数:请求地址,请求后台需要的参数字段,回调函数
 	 */
-	post:function(url,data,loadingStatus,callback){
-		if(loadingStatus){uni.showLoading({mask: true,title:'加载中~'})}
-		uni.request({
-			url: requestUrl+url,
-			data:data,
-			header: {
-				'Accept': 'application/json',
-				'Content-Type': 'application/x-www-form-urlencoded',
-				'X-Token': uni.getStorageSync('token') ? uni.getStorageSync('token') : 'token',
-				'cookie': uni.getStorageSync('sessionid')
-			},
-			method: 'POST',
-			success: (response) => {
-				if(loadingStatus){uni.hideLoading()}
-				const result = response.data
-				callback(result)
-			},
-			fail: (error) => {
-				uni.hideLoading()
-				if (error) {
-					uni.showToast({icon: 'none',title: '网络错误,请稍后重试',duration: 2000})
-				}
-			}
-		})
-	},
-	getComStorage:function(key){// 获取本地Storage
-		return new Promise(function(resolve,reject) {
-			uni.getStorage({
-				key: key,
-				success: function (res){
-					resolve(res.data)
-				},
-				fail: function(res){
-					reject(false)
-				}
-			})
-		})
-	},
-	setStorage:function(key,data){// 存储本地Storage
-		return new Promise(function(resolve,reject) {
-			uni.setStorage({
-				key: key,
-				data:data,
-				success: function (res){
-				}
-			})
-		})
-	},
-	getStorage:function(){// 获取本地userInfo
-		return new Promise(function(resolve,reject) {
-			uni.getStorage({
-				key: 'userInfo',
-				success: function (res){
-					resolve(res.data)
-				},
-				fail: function(res){
-					reject(false)
-				}
-			})
-		})
-	},
-	getStorageAddressKey:function(){// 获取本地地址信息
-		return new Promise(function(resolve,reject) {
-			uni.getStorage({
-				key: 'address_key',
-				success: function (res){
-					resolve(res.data)
-				}
-			})
-		})
-	},
-	loginStatus:function(){
-	// 获取用户是否登陆 1:已登陆,否则未登陆
-		return new Promise(function(resolve,reject) {
-			uni.getStorage({
-				key: 'userInfo',
-				success: function (res){
-					if(res.data.code == '1'){
-						resolve(true)
-					} else {
-						resolve(false)
-					}
-				}
-			})
-		})
-	},
-	navToListPage:function({type,value,id,lType} = {}){	
-	// 跳转到列表页
-		if(lType=='4'){
-			const pages = getCurrentPages()
-			const prevPage = pages[pages.length-2]
-			prevPage.refresh = true
-			prevPage.listData = {
-				type: type,
-				from: value,
-				id: id
-			}
-			uni.navigateBack({
-				delta: 1
-			})
-		}else{
-			uni.navigateTo({
-				url:`/pages/goods/goods?type=${type}&from=${value}&id=${id}`
-			})
-		}
-	},
-	navigateToGoods:function({type,value,id,lType} = {}){
-	// 跳转到列表页
-		if(lType=='4'){
-			const pages = getCurrentPages()
-			const prevPage = pages[pages.length-2]
-			prevPage.refresh = true
-			prevPage.listData = {
-				type: type,
-				from: value,
-				id: id
-			}
-			uni.navigateBack({
-				delta: 1
-			})
-		}else{
-			uni.navigateTo({
-				url:`/pages/goods/goods-classify?type=${type}&from=${value}&id=${id}`
-			})
-		}
-	},
-	FlooryNavigateTo:function(pros){
-		if(pros.listType == 1){
-			if(pros.product.productCategory == '1'){
-				uni.navigateTo({
+    post:function(url,data,loadingStatus,callback){
+        if(loadingStatus){uni.showLoading({mask: true,title:'加载中~'})}
+        uni.request({
+            url: requestUrl+url,
+            data:data,
+            header: {
+                'Accept': 'application/json',
+                'Content-Type': 'application/x-www-form-urlencoded',
+                'X-Token': uni.getStorageSync('token') ? uni.getStorageSync('token') : 'token',
+                'cookie': uni.getStorageSync('sessionid')
+            },
+            method: 'POST',
+            success: (response) => {
+                if(loadingStatus){uni.hideLoading()}
+                const result = response.data
+                callback(result)
+            },
+            fail: (error) => {
+                uni.hideLoading()
+                if (error) {
+                    uni.showToast({icon: 'none',title: '网络错误,请稍后重试',duration: 2000})
+                }
+            }
+        })
+    },
+    getComStorage:function(key){// 获取本地Storage
+        return new Promise(function(resolve,reject) {
+            uni.getStorage({
+                key: key,
+                success: function (res){
+                    resolve(res.data)
+                },
+                fail: function(res){
+                    reject(false)
+                }
+            })
+        })
+    },
+    setStorage:function(key,data){// 存储本地Storage
+        return new Promise(function(resolve,reject) {
+            uni.setStorage({
+                key: key,
+                data:data,
+                success: function (res){
+                }
+            })
+        })
+    },
+    getStorage:function(){// 获取本地userInfo
+        return new Promise(function(resolve,reject) {
+            uni.getStorage({
+                key: 'userInfo',
+                success: function (res){
+                    resolve(res.data)
+                },
+                fail: function(res){
+                    reject(false)
+                }
+            })
+        })
+    },
+    getStorageAddressKey:function(){// 获取本地地址信息
+        return new Promise(function(resolve,reject) {
+            uni.getStorage({
+                key: 'address_key',
+                success: function (res){
+                    resolve(res.data)
+                }
+            })
+        })
+    },
+    loginStatus:function(){
+        // 获取用户是否登陆 1:已登陆,否则未登陆
+        return new Promise(function(resolve,reject) {
+            uni.getStorage({
+                key: 'userInfo',
+                success: function (res){
+                    if(res.data.code == '1'){
+                        resolve(true)
+                    } else {
+                        resolve(false)
+                    }
+                }
+            })
+        })
+    },
+    navToListPage:function({type,value,id,lType} = {}){	
+        // 跳转到列表页
+        if(lType=='4'){
+            const pages = getCurrentPages()
+            const prevPage = pages[pages.length-2]
+            prevPage.refresh = true
+            prevPage.listData = {
+                type: type,
+                from: value,
+                id: id
+            }
+            uni.navigateBack({
+                delta: 1
+            })
+        }else{
+            uni.navigateTo({
+                url:`/pages/goods/goods?type=${type}&from=${value}&id=${id}`
+            })
+        }
+    },
+    navigateToGoods:function({type,value,id,lType} = {}){
+        // 跳转到列表页
+        if(lType=='4'){
+            const pages = getCurrentPages()
+            const prevPage = pages[pages.length-2]
+            prevPage.refresh = true
+            prevPage.listData = {
+                type: type,
+                from: value,
+                id: id
+            }
+            uni.navigateBack({
+                delta: 1
+            })
+        }else{
+            uni.navigateTo({
+                url:`/pages/goods/goods-classify?type=${type}&from=${value}&id=${id}`
+            })
+        }
+    },
+    FlooryNavigateTo:function(pros){
+        if(pros.listType == 1){
+            if(pros.product.productCategory == '1'){
+                uni.navigateTo({
 				  	url:`/pages/goods/product?id=${pros.product.productId}`
-				})
-			}else{
-				uni.navigateTo({
+                })
+            }else{
+                uni.navigateTo({
 				  	url:`/pages/second/product/product-details?id=${pros.product.productId}`
-				})
-			}
-		}else{
-			/**
+                })
+            }
+        }else{
+            /**
 			 * 页面跳转类型
 			 * 1、二级页面,2、搜索项目仪器,3、直播页面,4、自由页面,5、商品详情,6、仪器项目详情,7、供应商主页
 			 * 8、专题活动页,9、二手市场介绍,10、二手商品列表,11、二手商品发布,12、商品搜索,13、信息详情
 			 * 14、品牌招商介绍页,15、维修保养介绍页,16、首页,17、注册页,18、信息中心,19、供应商列表
 			 **/
-			if(pros.linkType){
-				console.log(pros.linkType)
-				const typeMap = {
+            if(pros.linkType){
+                console.log(pros.linkType)
+                const typeMap = {
 				 	1:`/pages/goods/goods-instrument?linkId=${pros.linkParam.id}`,
 				 	2:`/pages/goods/instrument-details?id=${pros.linkParam.id}`,
 				 	3:`/pages/h5/article/page-image?image=${pros.adsImage}&title=专题直播`,
-					4:`/pages/h5/activity/activity?title=${pros.crmTitle}&link=${pros.crmLink}`,
+                    4:`/pages/h5/activity/activity?title=${pros.crmTitle}&link=${pros.crmLink}`,
 				 	5:`/pages/goods/product?id=${pros.linkParam.id}`,
 				 	// 7:`/pages/supplier/user/my-shop?shopId=${pros.linkParam.id}`,
 				 	8:'/pages/h5/activity/activity-list',
@@ -238,128 +238,130 @@ const caimeiApi = {
 				 	13:`/pages/h5/article/path?link=${pros.link}`,
 				 	14:`/pages/h5/article/path?link=${pros.link}`,
 				 	15:`/pages/h5/article/path?link=${pros.link}`,
-					// '-1':`/pages/h5/article/path?link=${pros.link}`,
+                    // '-1':`/pages/h5/article/path?link=${pros.link}`,
 				 	17:'/pages/login/register-select',
 				 	18:`/pages/h5/article/path?link=${pros.link}`,
 				 	19:`/pages/search/search-supplier?keyWord=${pros.linkParam.keyword}`,
-					21:'/pages/h5/activity/meobohui',
-					24:'/pages/user/coupon/coupon',
-					23:`/pages/h5/activity/activity-topic?linkId=${pros.linkParam.id}`
-				}
-				const url = typeMap[pros.linkType]
-				uni.navigateTo({
+                    21:'/pages/h5/activity/meobohui',
+                    23:`/pages/h5/activity/activity-topic?linkId=${pros.linkParam.id}`,
+                    24:'/pages/user/coupon/coupon',
+                    25:'/pages/goods/goods-doc-list' //美业资料
+                }
+                const url = typeMap[pros.linkType]
+                uni.navigateTo({
 				  	url:url
-				})
-			}
-		}
-	},
-	BannerNavigateTo:function(linkType,linkId,linkHref,keyword){//楼层跳转判断
-		if(linkType){
-			const typeMap = {
-				1:`/pages/goods/goods-instrument?linkId=${linkId}`,
-				2:`/pages/goods/instrument-details?id=${linkId}`,
-				4:`/pages/h5/activity/activity?id=${linkId}`,
-				5:`/pages/goods/product?id=${linkId}`, 
-				// 7:`/pages/supplier/user/my-shop?shopId=${linkId}`,
-				8:'/pages/h5/activity/activity-list',
-				9:'/pages/second/form/introduce',
-				10:'/pages/second/product/product-list',
-				11:'/pages/second/form/form',
-				12:`/pages/search/search?keyWord=${keyword}`,
-				13:`/pages/h5/article/path?link=${linkHref}`,
-				14:`/pages/h5/article/path?link=${linkHref}`,
-				15:`/pages/h5/article/path?link=${linkHref}`,
-				17:'/pages/login/register-select',
-				18:`/pages/h5/article/path?link=${linkHref}`,
-				19:`/pages/search/search-supplier?keyWord=${keyword}`,
-				21:'/pages/h5/activity/meobohui',
-				// '-1':`/pages/h5/article/path?link=${pros.link}`
-				24:'/pages/user/coupon/coupon'
-			}
-			const url = typeMap[linkType]
-			uni.navigateTo({
+                })
+            }
+        }
+    },
+    BannerNavigateTo:function(linkType,linkId,linkHref,keyword){//楼层跳转判断
+        if(linkType){
+            const typeMap = {
+                1:`/pages/goods/goods-instrument?linkId=${linkId}`,
+                2:`/pages/goods/instrument-details?id=${linkId}`,
+                4:`/pages/h5/activity/activity?id=${linkId}`,
+                5:`/pages/goods/product?id=${linkId}`, 
+                // 7:`/pages/supplier/user/my-shop?shopId=${linkId}`,
+                8:'/pages/h5/activity/activity-list',
+                9:'/pages/second/form/introduce',
+                10:'/pages/second/product/product-list',
+                11:'/pages/second/form/form',
+                12:`/pages/search/search?keyWord=${keyword}`,
+                13:`/pages/h5/article/path?link=${linkHref}`,
+                14:`/pages/h5/article/path?link=${linkHref}`,
+                15:`/pages/h5/article/path?link=${linkHref}`,
+                17:'/pages/login/register-select',
+                18:`/pages/h5/article/path?link=${linkHref}`,
+                19:`/pages/search/search-supplier?keyWord=${keyword}`,
+                21:'/pages/h5/activity/meobohui',
+                // '-1':`/pages/h5/article/path?link=${pros.link}`
+                24:'/pages/user/coupon/coupon',
+                25:'/pages/goods/goods-doc-list'  //美业资料
+            }
+            const url = typeMap[linkType]
+            uni.navigateTo({
 			 	url:url
-			})
-		}
-	},
-	navigateTo:function(url){
-		//路由跳转:页面之间路由跳转
-		uni.navigateTo({
-			url:url
-		})
-	},
-	redirectTo:function(url){
-	//路由跳转:关闭当前页跳转到新页面	
-		uni.redirectTo({
-			url:url
-		})
-	},
-	switchTabTo:function(url){
-	//路由跳转:底部 tab页
-		uni.switchTab({
-			url:url
-		})
-	},
-	isNumber:function(value){//验证是否为数字
+            })
+        }
+    },
+    navigateTo:function(url){
+        //路由跳转:页面之间路由跳转
+        uni.navigateTo({
+            url:url
+        })
+    },
+    redirectTo:function(url){
+        //路由跳转:关闭当前页跳转到新页面	
+        uni.redirectTo({
+            url:url
+        })
+    },
+    switchTabTo:function(url){
+        //路由跳转:底部 tab页
+        uni.switchTab({
+            url:url
+        })
+    },
+    isNumber:function(value){//验证是否为数字
 	    var patrn = /^(-)?\d+(\.\d+)?$/
 	    if (patrn.exec(value) == null || value == '') {
 	         return false
 	    } else {
 	         return true  
-		}	 
-	},
-	getWindowHeight:function(){
-		// 获取窗口高度
-		const {windowHeight, pixelRatio} = wx.getSystemInfoSync()
-		return windowHeight
-	},
-	adaptRichTextImg:function(res){
-		/**
+        }	 
+    },
+    getWindowHeight:function(){
+        // 获取窗口高度
+        const {windowHeight, pixelRatio} = wx.getSystemInfoSync()
+        return windowHeight
+    },
+    adaptRichTextImg:function(res){
+        /**
 		 *@富文本实现图片自适应
 		 *@style再添加自适应样式
 		 */ 
-		const html = res.replace(/<img[^>]*>/gi,function(match,capture){			
-			let match1 = match.replace(/<img*/gi, '<img style="width:100% !important;height:auto !important;float:left !important;"'),
-				results = match1.replace(/style=/gi, 'style="width:100%;height:auto;float:left;"')
-			return results
-		})
-		return html	
-	},
-	FormatMoney:function(num){
-		// 金额千分位
-		return num.toString().replace(/\d+/, function (n) { // 先提取整数部分
-			return n.replace(/(\d)(?=(\d{3})+$)/g, function ($1) { // 对整数部分添加分隔符
-				return $1 + ','
-			})
-		})
-	},
-	formatDate:function(){
-		//获取当前时间
-		let date = new Date()
-		let y = date.getFullYear()
-		let MM = date.getMonth() + 1
-		MM = MM < 10 ? ('0' + MM) : MM
-		let d = date.getDate()
-		d = d < 10 ? ('0' + d) : d
-		let h = date.getHours()
-		h = h < 10 ? ('0' + h) : h
-		let m = date.getMinutes()
-		m = m < 10 ? ('0' + m) : m
-		let s = date.getSeconds()
-		s = s < 10 ? ('0' + s) : s
+        const html = res.replace(/<img[^>]*>/gi,function(match,capture){			
+            let match1 = match.replace(/<img*/gi, '<img style="width:100% !important;height:auto !important;float:left !important;"'),
+                results = match1.replace(/style=/gi, 'style="width:100%;height:auto;float:left;"')
+            return results
+        })
+        return html	
+    },
+    FormatMoney:function(num){
+        // 金额千分位
+        return num.toString().replace(/\d+/, function (n) { // 先提取整数部分
+            return n.replace(/(\d)(?=(\d{3})+$)/g, function ($1) { // 对整数部分添加分隔符
+                return $1 + ','
+            })
+        })
+    },
+    formatDate:function(){
+        //获取当前时间
+        let date = new Date()
+        let y = date.getFullYear()
+        let MM = date.getMonth() + 1
+        MM = MM < 10 ? ('0' + MM) : MM
+        let d = date.getDate()
+        d = d < 10 ? ('0' + d) : d
+        let h = date.getHours()
+        h = h < 10 ? ('0' + h) : h
+        let m = date.getMinutes()
+        m = m < 10 ? ('0' + m) : m
+        let s = date.getSeconds()
+        s = s < 10 ? ('0' + s) : s
 	    return y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s
-	},
-	regexSets:function() {
-		let sets = {
-			'companyName': /^[\u4e00-\u9fa5\(\)()\s\da-zA-Z&]{2,50}$/gi,
-			'phoneAndTelephone': /^([1]\d{10}|([\((]?0[0-9]{2,3}[)\)]?[-]?)?([2-9][0-9]{6,7})+(\-[0-9]{1,4})?)$/,
-			'bankNum': /^([1-9]{1})(\d{18})$/,
-			'invalidChar': /^[\s\u4e00-\u9fa5a-z0-9_-]{0,}$/
-		}
-		return sets
-	},
-	timestampToTime:function(timestamp) {
-		// 时间戳转日期
+    },
+    regexSets:function() {
+        let sets = {
+            'companyName': /^[\u4e00-\u9fa5\(\)()\s\da-zA-Z&]{2,50}$/gi,
+            'phoneAndTelephone': /^([1]\d{10}|([\((]?0[0-9]{2,3}[)\)]?[-]?)?([2-9][0-9]{6,7})+(\-[0-9]{1,4})?)$/,
+            'bankNum': /^([1-9]{1})(\d{18})$/,
+            'invalidChar': /^[\s\u4e00-\u9fa5a-z0-9_-]{0,}$/
+        }
+        return sets
+    },
+    timestampToTime:function(timestamp) {
+        // 时间戳转日期
 	   let date = new Date(timestamp * 1000)//时间戳为10位需*1000,时间戳为13位的话不需乘1000
 	   let Y = date.getFullYear() + '-'
 	   let M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-'
@@ -368,33 +370,33 @@ const caimeiApi = {
 	   let m = (date.getMinutes() < 10 ? '0'+date.getMinutes() : date.getMinutes()) + ':'
 	   let s = (date.getSeconds() < 10 ? '0'+date.getSeconds() : date.getSeconds())
 	   return `${Y}${M}${D}${h}${m}${s}`
-	}
+    }
 }
 
 /**
  *@导出
  */ 
 module.exports = {
-	get: caimeiApi.get,
-	post: caimeiApi.post,
-	lodingGet: caimeiApi.lodingGet,
-	isNumber: caimeiApi.isNumber,
-	FormatMoney: caimeiApi.FormatMoney,
-	navigateTo: caimeiApi.navigateTo,
-	redirectTo: caimeiApi.redirectTo,
-	switchTabTo: caimeiApi.switchTabTo,
-	formatDate: caimeiApi.formatDate,
-	loginStatus: caimeiApi.loginStatus,
-	setStorage: caimeiApi.setStorage,
-	getStorage: caimeiApi.getStorage,
-	getComStorage: caimeiApi.getComStorage,
-	navToListPage: caimeiApi.navToListPage,
-	navigateToGoods: caimeiApi.navigateToGoods,
-	getWindowHeight: caimeiApi.getWindowHeight,
-	adaptRichTextImg: caimeiApi.adaptRichTextImg,
-	getStorageAddressKey: caimeiApi.getStorageAddressKey,
-	regexSets: caimeiApi.regexSets,
-	timestampToTime: caimeiApi.timestampToTime,
-	BannerNavigateTo:caimeiApi.BannerNavigateTo,
-	FlooryNavigateTo:caimeiApi.FlooryNavigateTo 
+    get: caimeiApi.get,
+    post: caimeiApi.post,
+    lodingGet: caimeiApi.lodingGet,
+    isNumber: caimeiApi.isNumber,
+    FormatMoney: caimeiApi.FormatMoney,
+    navigateTo: caimeiApi.navigateTo,
+    redirectTo: caimeiApi.redirectTo,
+    switchTabTo: caimeiApi.switchTabTo,
+    formatDate: caimeiApi.formatDate,
+    loginStatus: caimeiApi.loginStatus,
+    setStorage: caimeiApi.setStorage,
+    getStorage: caimeiApi.getStorage,
+    getComStorage: caimeiApi.getComStorage,
+    navToListPage: caimeiApi.navToListPage,
+    navigateToGoods: caimeiApi.navigateToGoods,
+    getWindowHeight: caimeiApi.getWindowHeight,
+    adaptRichTextImg: caimeiApi.adaptRichTextImg,
+    getStorageAddressKey: caimeiApi.getStorageAddressKey,
+    regexSets: caimeiApi.regexSets,
+    timestampToTime: caimeiApi.timestampToTime,
+    BannerNavigateTo:caimeiApi.BannerNavigateTo,
+    FlooryNavigateTo:caimeiApi.FlooryNavigateTo 
 }

+ 11 - 10
components/cm-module/homeIndex/navbars.vue

@@ -13,7 +13,7 @@
 
 <script>
 	export default{
-		name:"navbars",
+		name:'navbars',
 		props:{
 			list:{
 				type:Array
@@ -43,22 +43,23 @@
 				 * 14、品牌招商介绍页,15、维修保养介绍页,16、首页,17、注册页,18、信息中心,19、供应商列表
 				 * 23、新活动专题页面
 				 **/
-				console.log(pros);
+				console.log(pros)
 				if(pros.linkType){
 					 const typeMap = {
 						1:`/pages/goods/goods-instrument?linkId=${pros.linkParam.id}&title=${pros.name}`,
-						3:`/pages/h5/article/path-live`,
-						4:`/pages/h5/other/brands`,
-						10:`/pages/second/product/product-list`,
-						14:`/pages/h5/other/brand`,
-						15:`/pages/h5/other/repair`,
+						3:'/pages/h5/article/path-live',
+						4:'/pages/h5/other/brands',
+						10:'/pages/second/product/product-list',
+						14:'/pages/h5/other/brand',
+						15:'/pages/h5/other/repair',
 						18:`/pages/h5/article/path?link=${pros.link}`,
 						20:`/pages/goods/good-floor?linkId=${pros.linkParam.id}&title=${pros.name}`,
-						21:`/pages/h5/activity/meobohui`,
+						21:'/pages/h5/activity/meobohui',
 						22:`/pages/goods/good-floor-temp?linkId=${pros.linkParam.id}&title=${pros.name}`,
-						23:`/pages/h5/activity/activity-topic?linkId=${pros.linkParam.id}`  //活动专题页面
+						23:`/pages/h5/activity/activity-topic?linkId=${pros.linkParam.id}`,  //活动专题页面
+                        25:'/pages/goods/goods-doc-list' //美业资料
 					 }
-					const url = typeMap[pros.linkType];
+					const url = typeMap[pros.linkType]
 					this.$api.navigateTo(url)
 				}
 			}

+ 60 - 23
components/cm-module/productDetails/cm-product-doc.vue

@@ -48,6 +48,7 @@
                                 controls
                                 show-fullscreen-btn
                                 show-mute-btn
+                                play-btn-position="center"
                                 @play="handlePlayer('myVideo' + index)"
                                 v-if="item.fileUrl"
                             ></video>
@@ -153,7 +154,7 @@ export default {
             videoArchiveList: [], // 视频资料列表
             fileArchiveList: [], // 文件资料列表
             defaultImage: 'https://static.caimei365.com/app/img/icon2/PC-default.png', // 默认图片
-            videoCover: 'https://static.caimei365.com/app/img/icon2/video-cover.png', //默认视频封面
+            videoCover: 'https://static.caimei365.com/app/img/icon2/video-cover.png' //默认视频封面
         }
     },
     computed: {
@@ -162,7 +163,7 @@ export default {
         TipStatus: function() {
             // 资料权限
             const statusText = [
-                false,
+                false, // 正常访问
                 { text: '请登录后查看!', btn: '去登录', redirect: '/pages/login/login' },
                 { text: '请升级成为会员机构后方可查看!', btn: '去升级', redirect: '/pages/login/apply' },
                 { text: '请升级成为医美会员机构后方可查看!', btn: '去升级', redirect: '/pages/login/apply' },
@@ -175,25 +176,45 @@ export default {
     },
     created() {
         this.userId = uni.getStorageSync('userInfo').userId || -1
-        // uni.createVideoContext()
         this.getDetail()
     },
     methods: {
         // 获取商品资料详情
         getDetail() {
-            console.log(this.userId)
             this.BeautyArchive.GetProdcutArchiveDetails({
                 userId: this.userId,
                 archiveId: this.archiveId
             }).then(res => {
-                console.log(res)
-                if (res.code) return
                 this.imageArchiveList = res.data.imageArchiveList
                 this.videoArchiveList = res.data.videoArchiveList
                 this.fileArchiveList = res.data.fileArchiveList
                 this.permission = res.data.permission
             })
         },
+        //采美豆抵扣
+        searchArchiveByBean() {
+            this.BeautyArchive.SearchArchiveByBeans({
+                userId: this.userId,
+                archiveId: this.archiveId
+            })
+                .then(res => {
+                    uni.showToast({
+                        duration: 1500,
+                        title: res.msg
+                    })
+                    setTimeout(()=>{
+                        //刷新资料列表
+                        this.getDetail()
+                    },1500)
+                })
+                .catch(err => {
+                    uni.showToast({
+                        icon:'none',
+                        duration: 1500,
+                        title: err.msg
+                    })
+                })
+        },
         // 视频播放
         handlePlayer(id) {
             if (this.checkPermission()) {
@@ -201,6 +222,7 @@ export default {
                 return
             }
             if (this.prevVideoId === id) return
+            // this.handleFullScreen(id) // 点击播放时全屏
             this.prevVideoId = this.currentVideoId
             // 暂停上一个播放器
             this.handelPause(this.prevVideoId)
@@ -225,14 +247,24 @@ export default {
             const vContext = uni.createVideoContext(id, this)
             vContext.stop()
         },
+        // 进入全屏
+        handleFullScreen(id) {
+            if (!id) return
+            const vContext = uni.createVideoContext(id, this)
+            vContext.requestFullScreen()
+        },
         // 预览图片
         previewImage(index, previewImageList) {
             if (this.checkPermission()) return
+            const that = this
             uni.previewImage({
                 current: index,
                 indicator: 'number',
                 urls: previewImageList,
-                loop: true
+                loop: true,
+                success() {
+                    that.$emit('previewImage', true)
+                }
             })
         },
         //用户权限校验拦截
@@ -250,7 +282,7 @@ export default {
             // 点击确认按钮
             if (e.index === 1) {
                 this.showModal = false
-                this.nextAction(this.TipStatus.redirect)
+                this.nextAction(this.TipStatus.redirect) //执行下一步
             } else {
                 this.showModal = false
             }
@@ -258,7 +290,6 @@ export default {
         //图片列表处理
         imageFormat(list) {
             const imageList = []
-
             if (list.length > 2) {
                 list.forEach((item, index) => {
                     imageList.push({ url: item, style: '' })
@@ -280,14 +311,12 @@ export default {
                     }
                     imageList.push({ url: list[0], style: style })
                 } catch (e) {
-                    //TODO handle the exception
                     console.error(
-                        '图片链接格式不正确,返回未处理图片,请设置正确的链接:http://image/text.png?width=xx&height=xx  '
+                        '图片链接格式不正确,返回未处理图片,请设置正确的链接:http://image/text.png?width=xx&height=xx'
                     )
                     imageList.push({ url: list[0], style: '' })
                 }
             }
-
             if (list.length === 2) {
                 const style = 'width:300rpx;height:300rpx;'
                 imageList.push({ url: list[0], style })
@@ -300,26 +329,24 @@ export default {
             const _self = this
             if (typeof redirect == 'string') {
                 // 跳转链接
-                console.log('链接跳转')
                 this.$api.navigateTo(redirect)
             }
             if (redirect === 10) {
-                console.log('调用接口')
+                this.searchArchiveByBean()
             }
         },
         // 文件预览
         previewFile(file) {
+            if (this.checkPermission()) return
+            //先将链接缓存
+            uni.setStorageSync('openLink', file.fileUrl)
             // 获取文件后缀
             const index = file.fileName.lastIndexOf('.')
             const suffix = file.fileName.substring(index)
             if (suffix === '.doc' || suffix === '.ppt') {
-                this.$api.navigateTo(
-                    `/pages/h5/article/path?link=${file.fileUrl}`
-                )
+                this.$api.navigateTo('/pages/h5/article/path?key=openLink&type=1')
             } else if (suffix === '.pdf') {
-                this.$api.navigateTo(
-                    `/pages/h5/article/path?type=1&link=${file.fileUrl}`
-                )
+                this.$api.navigateTo('/pages/h5/article/path?key=openLink&type=2')
             } else {
                 // 不支持的文件
                 return uni.showModal({
@@ -421,6 +448,9 @@ export default {
                 width: 88rpx;
                 height: 88rpx;
             }
+            .cm-title {
+                height: 74rpx;
+            }
             .cm-desc {
                 width: 582rpx;
             }
@@ -448,7 +478,7 @@ export default {
         }
         .cm-title {
             display: -webkit-box;
-            height: 74rpx;
+            max-height: 74rpx;
             margin-top: 24rpx;
             font-size: 26rpx;
             font-weight: 400;
@@ -495,9 +525,16 @@ export default {
         }
         .cm-video-list {
             margin-top: 18rpx;
+            width: 702rpx;
+            height: 420rpx;
             video {
-                width: 702rpx;
-                height: 420rpx;
+                width: 100% !important;
+                max-width: 100%;
+                min-width: 100%;
+                display: flex;
+                max-height: 420rpx;
+                // width: 100%;
+                // height: 100%;
                 background: #000;
             }
         }

+ 1 - 7
pages.json

@@ -150,7 +150,7 @@
                         "enablePullDownRefresh": false
                     }
                 },
-                { 
+                {
                     "path": "goods-doc-detail",
                     "style": {
                         "navigationBarTitleText": "美业资料详情",
@@ -681,12 +681,6 @@
                     "style": {
                         "navigationBarTitleText": "品牌招商"
                     }
-                },
-                {
-                    "path": "other/pdf",
-                    "style": {
-                        "navigationBarTitleText": "文件预览"
-                    }
                 }
             ]
         }, {

+ 29 - 21
pages/goods/product.vue

@@ -263,7 +263,7 @@
                 </view>
                 <!-- 相关资料 -->
                 <view class="product-details recommend product-details3" v-show="tabCurrentIndex === 3">
-                    <cm-product-doc :archiveId="product.archiveId" :userId='userId'></cm-product-doc>
+                    <cm-product-doc @previewImage="changePreViewImageStatus" :archiveId="product.archiveId" :userId='userId'></cm-product-doc>
                 </view>
                 <!-- 商品参数 -->
                 <tui-bottom-popup :radius="true" :show="popupShow0" @close="hidePopup(0)">
@@ -650,6 +650,7 @@ export default {
             },
             bottomCartNumber: 0,
             navbar: [{ name: '未领取', num: 0 }, { name: '已领取', num: 0 }],
+            isPreviewImage: false
         }
     },
     computed: {
@@ -1205,6 +1206,9 @@ export default {
         ),
         getWinHeight() {
             this.winHeight = wx.getSystemInfoSync().windowHeight
+        },
+        changePreViewImageStatus(falg){
+            this.isPreviewImage = falg
         }
     },
     onPageScroll(e) {
@@ -1248,27 +1252,31 @@ export default {
         }
     },
     onShow() {
-        this.$api
-            .getStorage()
-            .then(resolve => {
-                this.userId = this.couponParam.userId = resolve.userId ? resolve.userId : ''
-                this.userIdentity = resolve.userIdentity ? resolve.userIdentity : 0
-                this.shopID = resolve.shopId ? resolve.shopId : ''
-                if (this.userIdentity == 0 || this.userIdentity == 2 || this.userIdentity == 4) {
-                    this.isShowButton = true
-                } else {
-                    this.isShowButton = false
-                }
-                if (isPreviewImg) {
-                    isPreviewImg = false
-                    return
-                } else {
+        // 是否开启图片预览 true 不刷新调用接口 false刷新调用接口
+        if(!this.isPreviewImage){
+            this.$api
+                .getStorage()
+                .then(resolve => {
+                    this.userId = this.couponParam.userId = resolve.userId ? resolve.userId : ''
+                    this.userIdentity = resolve.userIdentity ? resolve.userIdentity : 0
+                    this.shopID = resolve.shopId ? resolve.shopId : ''
+                    if (this.userIdentity == 0 || this.userIdentity == 2 || this.userIdentity == 4) {
+                        this.isShowButton = true
+                    } else {
+                        this.isShowButton = false
+                    }
+                    if (isPreviewImg) {
+                        isPreviewImg = false
+                        return
+                    } else {
+                        this.initData()
+                    }
+                })
+                .catch(error => {
                     this.initData()
-                }
-            })
-            .catch(error => {
-                this.initData()
-            })
+                })
+        }
+        this.isPreviewImage = false
     },
     created() {}
 }

+ 21 - 14
pages/h5/article/path.vue

@@ -16,29 +16,36 @@
 	            },
 				productID:'',
 				activityPath:'',
-				type : '',
 	        }
 	    },
 		onLoad(option) {
-            this.type = option.type
-            console.log(option)
-            this.initPath(option.link)
+            // 普通传参
+            if(option.link) {
+                this.activityPath = option.link
+                return
+            }
+            this.initPath(option)
 		},
 		methods:{
 			navToDetailPage() {//跳转商品详情页
 				this.$api.navigateTo(`/pages/goods/product?id=${this.productID}`)
 			},
-            initPath(path){
-                if(this.type === '1'){
-                    let URL_CONFIG = ''
-                    if(process.env.NODE_ENV === 'development'){
-                        URL_CONFIG = 'https://www-b.caimei365.com'
-                    }
-                    this.activityPath = `${URL_CONFIG}/document/pdfdetails.html?type=1&src=${path}`
-                    console.log(this.activityPath)
-                }else{
-                    this.activityPath = path
+            initPath(option){
+                if(!option.key || !option.type) return
+                const link = uni.getStorageSync(option.key)
+                const type = parseInt(option.type)
+                uni.removeStorageSync(option.key) // 清除链接缓存
+                //是word 或 ppt链接
+                if(type === 1){
+                    this.activityPath = link
+                    return
+                }
+                //是pdf链接
+                let URL_CONFIG = ''
+                if(process.env.NODE_ENV === 'development'){
+                    URL_CONFIG = 'https://www-b.caimei365.com'
                 }
+                this.activityPath = `${URL_CONFIG}/document/pdfdetails.html?type=1&src=${link}`
             }
 		}
 	}

+ 0 - 31
pages/h5/other/pdf.vue

@@ -1,31 +0,0 @@
-<template>
-    <view class="pdf-view"> <view id="demo"></view> </view>
-</template>
-
-<script>
-export default {
-    data() {
-        return {
-            pdfh5: null,
-            pdfurl: '',
-            title: ''
-        }
-    },
-    onLoad(option) {
-        console.log(option)
-        this.pdfurl = 'http://localhost:8009/document/pdfdetails.html?type=1src=' + option.url
-        this.title = option.title || ''
-        uni.setNavigationBarTitle({
-            title: this.title
-        })
-    }
-}
-</script>
-
-<style lang="scss" scoped>
-@import "pdfh5/css/pdfh5.css";    
-.pdf-view {
-    width: 100%;
-    height: 100vh;
-}
-</style>

+ 1 - 1
services/ajax.service.js

@@ -17,7 +17,7 @@ class AjaxService {
         const REV_COOKIE_ENV = uni.getStorageSync('sessionid') ? uni.getStorageSync('sessionid') : 'sessionid'
         header['Accept'] = 'application/json'
         header['Content-Type'] = 'application/x-www-form-urlencoded'
-        // header['X-Token'] = REV_TOKEN_ENV
+        header['X-Token'] = REV_TOKEN_ENV
         header['cookie'] = REV_COOKIE_ENV
         return header
     }