Browse Source

合并master

jwyu 3 years ago
parent
commit
5d251c77a3

+ 18 - 2
App.vue

@@ -2,13 +2,29 @@
 	import {hasUpdate} from '@/utils/common.js'
 	export default {
 		onLaunch: function(options) {
-			console.log('App Launch')
 			this.$store.dispatch('getUserInfo')
 			this.$store.dispatch('getTabBar')
 		},
 		onShow: function(options) {
-			console.log('App Show')
+			console.log('App Show:',options)
 			hasUpdate()
+			uni.getSystemInfo({
+				success: function (res) {
+					if (res.windowWidth > 700) {
+						const params=options.query//此处的query就是在pc分享钩子函数中拼接的参数
+						let paramsStr=`xcxPath=${decodeURIComponent(options.path)}`
+						for(const key in params){
+							paramsStr=`${paramsStr}&${key}=${params[key]}`
+						}
+						console.log('进入pc');
+						uni.reLaunch({
+							url: `/pages/pc?${paramsStr}`,
+						});
+					}
+				},
+				fail:function(res){
+				}
+			})
 		},
 		onHide: function() {
 			console.log('App Hide')

+ 4 - 1
api/user.js

@@ -41,9 +41,12 @@ export const apiUserLogin=params=>{
  * @param company_name 公司名
  * @param permission 选择的权限
  * @param real_name 姓名
+ * @param source 来源:我的1、活动2、图库3、研报4
+ * @param source_agent 来源平台:1:小程序、2:pc
+ * @param from_page 来源页面: '活动列表'、'活动详情'等
  */
 export const apiApplyPermission=params=>{
-	return httpPost('/user/apply',params)
+	return httpPost('/user/apply',{...params,source_agent:1})
 }
 
 /**

+ 1 - 0
manifest.json

@@ -59,6 +59,7 @@
             "postcss" : true
         },
         "usingComponents" : true,
+        "resizable" : true,
         "requiredBackgroundModes" : [ "audio" ]
     },
     "mp-alipay" : {

+ 5 - 1
pages-activity/noAuthority.vue

@@ -43,6 +43,8 @@ export default {
                apiApplyPermission({
                     company_name:this.info.customer_info.company_name,
                     real_name:this.info.customer_info.name,
+                    source:2,
+                    from_page:'活动详情'
                 }).then(res=>{
                     if(res.code===200){
                         console.log('主动申请成功');
@@ -63,12 +65,14 @@ export default {
                 }else{
                     if(!this.info.customer_info.status||this.info.customer_info.status!='流失'){
                         uni.redirectTo({
-                            url:"/pages-applyPermission/applyPermission?source=2"
+                            url:"/pages-applyPermission/applyPermission?source=2&from_page=活动详情"
                         })
                     }else{//主动调一次申请权限接口 
                         const res=await apiApplyPermission({
                             company_name:this.info.customer_info.company_name,
                             real_name:this.info.customer_info.name,
+                            source:2,
+                            from_page:'活动详情'
                         })
                         if(res.code===200){
                             this.pupData.show=true

+ 2 - 1
pages-activity/reportDetail.vue

@@ -13,7 +13,8 @@ export default {
 
         const eventChannel = this.getOpenerEventChannel()
         eventChannel.on('webUrl', (data)=> {
-            this.url=`${data.url}&token=${this.$store.state.user.token}`
+            const timestamp=new Date().getTime()
+            this.url=`${data.url}&token=${this.$store.state.user.token}&timestamp=${timestamp}`
         })
     }
 }

+ 4 - 1
pages-applyPermission/applyPermission.vue

@@ -79,10 +79,12 @@ export default {
                 permission: '',
             },
             source:"",//来源 1-我的 2-活动 3-图库
+            from_page:''
         }
     },
     onLoad(options){
         this.source=options.source
+        this.from_page=options.from_page
         this.addEventListenerPermission()
     },
     onUnload(){
@@ -127,7 +129,8 @@ export default {
                 company_name:this.form.companyName,
                 permission:this.form.permission,
                 real_name:this.form.name,
-                source:Number(this.source)
+                source:Number(this.source),
+                from_page:this.from_page
             }
             if(!params.company_name){
                 uni.showToast({

+ 1 - 1
pages-applyPermission/selectVariety.vue

@@ -36,8 +36,8 @@ export default {
         // 监听上个页面传来的已经选择的权限
         eventChannel.on('hasPermissionData', (data) =>{
             beforePagePermission=data.data
+            this.getList(beforePagePermission)
         })
-        this.getList(beforePagePermission)
     },
     methods: {
         handleSelect(index){

+ 6 - 0
pages.json

@@ -38,6 +38,12 @@
 			"style":{
 				"navigationBarTitleText":"绑定联系方式"
 			}
+		},
+		{
+			"path": "pages/pc",
+			"style":{
+				"navigationBarTitleText": ""
+			}
 		}
 	],
 	"subPackages":[

+ 15 - 1
pages/activity/activity.vue

@@ -268,6 +268,16 @@ export default {
             this.allRefresh()
         }
         this.initAudio()
+        uni.getSystemInfo({
+			success: function (res) {
+				if (res.windowWidth > 700) {
+					console.log('跳转启动页判断进入pc');
+					uni.reLaunch({
+						url: "/pages/pc",
+					});
+				}
+			},
+		})
     },
     onHide(){
         this.pupData.show=false
@@ -351,6 +361,7 @@ export default {
                                     company_name:res.data.customer_info.company_name,
                                     real_name:res.data.customer_info.name,
                                     source:2,
+                                    from_page:'活动列表'
                                 }).then(res=>{
                                     if(res.code===200){
                                         console.log('主动申请成功');
@@ -643,6 +654,7 @@ export default {
                                 company_name:res.data.customer_info.company_name,
                                 real_name:res.data.customer_info.name,
                                 source:2,
+                                from_page:'活动列表'
                             }).then(res=>{
                                 if(res.code===200){
                                     console.log('主动申请成功');
@@ -720,6 +732,7 @@ export default {
                                 company_name:res.data.customer_info.company_name,
                                 real_name:res.data.customer_info.name,
                                 source:2,
+                                from_page:'活动列表'
                             }).then(res=>{
                                 if(res.code===200){
                                     console.log('主动申请成功');
@@ -778,6 +791,7 @@ export default {
                         company_name:this.pupData.customer_info.company_name,
                         real_name:this.pupData.customer_info.name,
                         source:2,
+                        from_page:'活动列表'
                     })
                     if(res.code===200){
                         this.pupData.content=`<p>申请已提交</p><p>请等待销售人员与您联系</p>`
@@ -890,7 +904,7 @@ export default {
         border-radius: 40rpx;
         background-color: #f6f6f6;
         margin-right: 40rpx;
-        height: 60rpx;
+        // height: 60rpx;
     }
     .status-active {
         background: linear-gradient(270deg, #efc896 0%, #d9a35f 100%);

+ 2 - 1
pages/chart/component/noAuth.vue

@@ -68,12 +68,13 @@ export default {
                     company_name:this.info.customer_info.company_name,
                     real_name:this.info.customer_info.name,
                     source:3,
+                    from_page:'图库列表'
                 }).then(res=>{
                     uni.navigateTo({url:'/pages-applyPermission/applyResult'})
                 })
                 return
             }
-            uni.navigateTo({ url: '/pages-applyPermission/applyPermission?source=3' })
+            uni.navigateTo({ url: '/pages-applyPermission/applyPermission?source=3&from_page=图库列表' })
         }
     }
 }

+ 38 - 3
pages/login.vue

@@ -125,10 +125,10 @@ export default {
 
         // 获取微信绑定的手机号登录
         async getPhoneNumber({detail}){
-            if(!detail.encryptedData||!detail.iv) return
             const res=await apiGetWechatPhone({
-                encryptedData:detail.encryptedData,
-                iv:detail.iv,
+                encryptedData:detail.encryptedData||'',
+                iv:detail.iv||'',
+                code:detail.code||'',
                 isBind:true,
             })
             if(res.code===200){
@@ -247,12 +247,23 @@ export default {
 .login-page {
     padding: 34rpx;
     text-align: center;
+    @media screen and (min-width: 700px){
+        max-width: 500px;
+        margin-left: auto;
+        margin-right: auto;
+    }
 }
 .top-img {
     width: 140rpx;
     height: 140rpx;
     margin-top: 70rpx;
     margin-bottom: 100rpx;
+    @media screen and (min-width: 700px){
+        width: 70px;
+        height: 70px;
+        margin-top: 35px;
+        margin-bottom: 50px;
+    }
 }
 .van-cell {
     border-bottom: 1px solid $global-border-color;
@@ -272,6 +283,9 @@ export default {
 }
 .change-wrap{
     margin-top: 100rpx;
+    @media screen and (min-width: 700px){
+        margin-top: 50px;
+    }
     .text{
         color: #CFCFCF;
         display: flex;
@@ -284,6 +298,10 @@ export default {
             display: inline-block;
             background-color: #E1E2E6;
             margin-right: 20rpx;
+            @media screen and (min-width: 700px){
+                width: 70px;
+                margin-right: 10px;
+            }
         }
         &::after{
             content: '';
@@ -292,12 +310,21 @@ export default {
             display: inline-block;
             background-color: #E1E2E6;
             margin-left: 20rpx;
+            @media screen and (min-width: 700px){
+                width: 70px;
+                margin-left: 10px;
+            }
         }
     }
     .img{
         margin-top: 40rpx;
         width: 80rpx;
         height: 80rpx;
+        @media screen and (min-width: 700px){
+            margin-top: 20px;
+            width: 40px;
+            height: 40px;
+        }
     }
 }
 .submit-btn {
@@ -305,6 +332,11 @@ export default {
     margin-left: auto;
     margin-right: auto;
     margin-top: 100rpx;
+    @media screen and (min-width: 700px){
+        width: 245px;
+        margin-top: 50px;
+        line-height: 35px;
+    }
 }
 .bot-text{
     position: fixed;
@@ -313,5 +345,8 @@ export default {
     bottom: 100rpx;
     color: $global-text-color-999;
     width: 100%;
+    @media screen and (min-width: 700px){
+        bottom: 50px;
+    }
 }
 </style>

+ 99 - 0
pages/pc.vue

@@ -0,0 +1,99 @@
+<template>
+  <view class="pc-page">
+      <web-view :src="url" @message="handleGetMessage" v-if="url"/>
+  </view>
+</template>
+
+<script>
+import {pcBaseUrl} from '../utils/config'
+const mapObj=new Map([
+    ['pages/activity/activity','/activity/list'],
+    ['pages-activity/detail','/activity/detail']
+])//map映射小程序页面路径对应h5页面路径
+import {apiUserInfo} from '@/api/user'
+export default {
+    data () {
+        return {
+            url:'',
+            msgObj:{},//{path:小程序页面地址,params:页面参数,title:分享的标题,shareImg:分享的图片}
+
+            times:0,//检查token次数
+        }
+    },
+    onLoad(options) {
+        this.init(options)
+    },
+    onShareAppMessage({webViewUrl}) {
+        // console.log(webViewUrl);
+        let paramsStr=''
+        for(const key in this.msgObj.params){
+            if(!paramsStr){
+                paramsStr=`${key}=${this.msgObj.params[key]}`
+            }else{
+                paramsStr=`${paramsStr}&${key}=${this.msgObj.params[key]}`
+            }
+        }
+        return {
+            title: this.msgObj.title||'弘则研究',
+            path: `${this.msgObj.path}?${paramsStr}`,
+            imageUrl:this.msgObj.shareImg||''
+        }
+    },
+
+    methods: {
+        // 获取到用户点击转发时从h5页面传来的参数
+        handleGetMessage(e){
+            const data=e.detail.data[e.detail.data.length-1]
+            console.log('h5传来的数据',data);
+            this.msgObj=data
+        },
+
+        async init(options){
+            // 检查token是否有效 超过十次不在检测,提示重启小程序
+            const res=await apiUserInfo()
+            this.times++
+            if(res.code!==200){
+                console.log('pc页面检查token次:',this.times);
+                if(this.times<11){
+                    setTimeout(() => {
+                        this.init(options)
+                    }, 1000);
+                }else{
+                    uni.showToast({
+                        title: '请重启小程序',
+                        icon: 'none'
+                    })
+                }
+                return
+            }
+
+            console.log('pc页面onload数据',options);
+            let paramsObj={
+                ...options,
+                token:this.$store.state.user.token||uni.getStorageSync("token"),
+                timestamp:new Date().getTime(),//防止缓存
+            }
+            delete paramsObj.xcxPath
+            console.log('要处理的参数',paramsObj);
+            let paramsObjStr=''
+            for (const key in paramsObj) {
+                if(!paramsObjStr){
+                    paramsObjStr=`${key}=${paramsObj[key]}`
+                }else{
+                    paramsObjStr=`${paramsObjStr}&${key}=${paramsObj[key]}`
+                }
+            }
+            console.log('拼接字符串:',paramsObjStr);
+            this.url=`${pcBaseUrl}${mapObj.get(decodeURIComponent(options.xcxPath))||'/'}?${paramsObjStr}`
+        }
+    },
+
+    onShow() {
+        uni.hideHomeButton({
+            fail:(e)=>{
+                console.log(e);
+            }
+        })
+    }
+}
+</script>

+ 23 - 4
pages/user/user.vue

@@ -3,9 +3,10 @@
 		<view class="top-box">
 			<view class="flex">
 			<view class="avatar">
-				<open-data type="userAvatarUrl"></open-data>
+				<!-- <open-data type="userAvatarUrl"></open-data> -->
+				<image style="width:100%;height:100%" :src="globalImgUrls.defaultAvatar" mode="aspectFill"/>
 			</view>
-			<view>
+			<view style="padding-top:10rpx">
 				<view class="user-name">{{userInfo.real_name||'--'}}</view>
 				<view class="tel" v-if="userInfo.mobile">{{userInfo.mobile}}</view>
 				<view class="tel" v-else>{{userInfo.email}}</view>
@@ -107,8 +108,24 @@
 				const res=await apiLastApplyRecord({source:1})
 				if(res.code===200){
 					if(!res.data){
+						// 流失客户主动申请一次
+						if(this.userInfo.status=='流失'){
+							apiApplyPermission({
+								company_name:this.userInfo.company_name,
+								real_name:this.userInfo.real_name,
+								source:1,
+								from_page:'我的'
+							}).then(res=>{
+								if(res.code===200){
+									console.log('主动申请成功');
+									this.pupData.show=true
+									this.pupData.content=`<p>申请已提交</p><p>请等待销售人员与您联系</p>`
+								}
+							}) 
+							return
+						}
 						uni.navigateTo({
-							url:"/pages-applyPermission/applyPermission?source=1"
+							url:"/pages-applyPermission/applyPermission?source=1&from_page=我的"
 						})
 					}else{
 						this.pupData.show=true
@@ -129,6 +146,8 @@
 				apiApplyPermission({
                     company_name:this.userInfo.company_name,
                     real_name:this.userInfo.real_name,
+					source:1,
+                    from_page:'我的'
                 }).then(res=>{
                     if(res.code===200){
                         console.log('主动申请成功');
@@ -155,7 +174,7 @@
 		.avatar{
 			width: 154rpx;
 			height: 154rpx;
-			border-radius: 16rpx;
+			border-radius: 50%;
 			overflow: hidden;
 			margin-right: 40rpx;
 		}

+ 14 - 13
utils/config.js

@@ -1,26 +1,25 @@
 // 配置文件
 
 const env=uni.getAccountInfoSync().miniProgram
-// 请求根路径
-let baseApiUrl=''
-if(env.envVersion==='develop'){//开发
-    baseApiUrl='http://8.136.199.33:8612'
-}else if(env.envVersion==='trial'){//体验版
-    baseApiUrl='http://8.136.199.33:8612'
-}else if(env.envVersion==='release'){//正式版
-    baseApiUrl='https://yanbao.hzinsights.com'
-}
 
-// h5页面根路径
-let h5BaseUrl=''
+let baseApiUrl=''// 请求根路径
+let h5BaseUrl=''// h5页面根路径
+let pcBaseUrl=''//pc页面根路径
 if(env.envVersion==='develop'){//开发
+    baseApiUrl='http://8.136.199.33:8612/api'
     h5BaseUrl='http://advisoryadmin.brilliantstart.cn/xcx_h5'
+    pcBaseUrl='https://ybpctest.hzinsights.com'
 }else if(env.envVersion==='trial'){//体验版
+    baseApiUrl='http://8.136.199.33:8612/api'
     h5BaseUrl='http://advisoryadmin.brilliantstart.cn/xcx_h5'
+    pcBaseUrl='https://ybpctest.hzinsights.com'
 }else if(env.envVersion==='release'){//正式版
+    baseApiUrl='https://yanbao.hzinsights.com/api'
     h5BaseUrl='https://details.hzinsights.com'
+    pcBaseUrl='https://ybpc.hzinsights.com'
 }
 
+
 // 配置图片资源 https://hzstatic.hzinsights.com/static/icon/hzyb/
 const globalImgUrls={
     chartWait:'https://hzstatic.hzinsights.com/static/icon/hzyb/chart_wait.png',
@@ -28,7 +27,8 @@ const globalImgUrls={
     activityNoAuth:'https://hzstatic.hzinsights.com/static/icon/hzyb/activity_no_auth.png',
     imgSuccess:'https://hzstatic.hzinsights.com/static/icon/hzyb/success_icon.png',
     loginTop:'https://hzstatic.hzinsights.com/static/icon/hzyb/login_top_img.png',
-    idCardExp:'https://hzstatic.hzinsights.com/static/icon/hzyb/idcard_exp.jpg'
+    idCardExp:'https://hzstatic.hzinsights.com/static/icon/hzyb/idcard_exp.jpg',
+    defaultAvatar:'https://hzstatic.hzinsights.com/static/icon/hzyb/default_avatar.png',
 }
 
 // 默认tabbar数据
@@ -75,5 +75,6 @@ module.exports={
     baseApiUrl,
     globalImgUrls,
     defaultTabBarListConfig,
-    h5BaseUrl
+    h5BaseUrl,
+    pcBaseUrl
 }