Pārlūkot izejas kodu

feat: 更新代码

yezhihao 4 mēneši atpakaļ
vecāks
revīzija
5b630169f1

+ 14 - 27
App.vue

@@ -42,8 +42,6 @@ export default {
 		uni.reLaunch({
 			url: '/pages/index/index',
 		})
-	} else if (!token) {
-		return
 	}
     // #endif
 
@@ -613,46 +611,35 @@ export default {
 					return;
 				}
 				
-				console.log('---------- jpushModule ------------', jpushModule)
-				
 				jpushModule.initJPushService()
 				
-				// 打开通知界面
-				// jpushModule.openSettingsForNotification((result)=>{
-				// 	this.showToast(result)
-				// })
-				
 				// 监听:点击通知(用户点击通知栏的通知)
 				jpushModule.addNotificationListener((res) => {
-					console.log('点击了通知:', res)
+					// console.log('点击了通知:', res)
 					// setTimeout(() => {
 					// 	// jpushModule.setBadge(0)
 					// 	// jpushModule.setBadgeNumber({ badge: 0 })
 					// 	console.log('设置了Badge')
 					// }, 500)
 					// 可在这里跳转到指定页面(比如根据通知的extra参数跳转)
-					if (res.extras && res.extras.page) {
-						// tab页面
-						// /pages/index/index
-						// /pages/talentSearch/index
-						// /pages/msg/index
-						// /pages/my/index
-						setTimeout(() => {
-							uni.switchTab({
-								url: res.extras.page // 例如:/pages/detail/detail?id=123
-							})							
-						}, 500)
-					}
+					// if (res.extras && res.extras.page) {
+					// 	// tab页面
+					// 	// /pages/index/index
+					// 	// /pages/talentSearch/index
+					// 	// /pages/msg/index
+					// 	// /pages/my/index
+					// 	setTimeout(() => {
+					// 		uni.switchTab({
+					// 			url: res.extras.page // 例如:/pages/detail/detail?id=123
+					// 		})							
+					// 	}, 500)
+					// }
 				})
 				
 				jpushModule.getRegistrationID((res) => {
 					if (res.code === 0) {
 						console.log('获取设备ID', res)
-						
-						// 1. 将设备ID上传到你的后台
-						
-						// 2. 监听推送事件
-						// this.listenJPushEvent(jpushModule)
+						this.$queue.setData('registerID', res?.registerID || '')
 					} else {
 						console.error('获取RegistrationID失败:', res)
 					}

+ 3 - 3
components/resume/preview-resume.vue

@@ -14,7 +14,7 @@
 			</view>
 			<view class="flex sub-info">
 				<image src="@/static/images/svg/gray-briefcase.svg" class="icon"></image>
-				<template v-if="currentCompanyName && currentPositionName">{{ currentCompanyName }} · {{ currentPositionName }}</template>
+				<template v-if="currentCompanyName">{{ currentCompanyName }} <template v-if="currentPositionName">· {{ currentPositionName }}</template></template>
 				<template v-else>--</template>
 			</view>
 			<view class="sub-info">{{ jobStatusName }}</view>
@@ -281,8 +281,8 @@
 				this.sex = data.resumesListDtoList?.userSex
 				this.avatarUrl = data.resumesListDtoList?.userAvatar
 				this.jobStatus = data.resumesStatus
-				if (data.workExpList.length) {
-					this.currentCompanyName = data.workExpList[0].companyName
+				if (data.workExpList?.length) {
+					this.currentCompanyName = data.workExpList[0]?.companyName
 				}
 				this.currentPositionName = data.industryName
 				// 添加工作年限

+ 13 - 13
my/jilu/bossMianshiDetail.vue

@@ -63,7 +63,7 @@
           </view>
           <view class="msg-item">
             <view class="msg-label">职位</view>
-            <view class="msg-value">{{info.postPush&&info.postPush.ruleClassifyName}} {{info.postPush&&info.postPush.salaryRange}} · {{info.postPush&&info.postPush.salaryTimes||12}}</view>
+            <view class="msg-value">{{info.postPush&&info.postPush.ruleClassifyName}} {{info.postPush&&info.postPush.salaryRange}} · {{info.postPush&&info.postPush.salaryTimes||'12薪'}}</view>
           </view>
           <view class="msg-item">
             <view class="msg-label">联系人</view>
@@ -79,13 +79,13 @@
           </view>
         </view>
       </view>
-      <view class="detail-item">
+      <view class="detail-item" v-if="currentStep == 4">
         <view class="txt-content">
           <view class="txt-desc">求职者不错?向他发起录用吧~</view>
           <view @click="showResult = true;resultType=0" class="txt-btn">录用邀约</view>
         </view>
       </view>
-      <view class="detail-item">
+      <view class="detail-item" v-if="currentStep == 4">
         <view class="user-title-second" style="padding-bottom: 28rpx">
           将面试结果发送给对方
         </view>
@@ -120,12 +120,12 @@
             <image
               :src="`/static/images/my/${info.interviewResultType == 0 
                 ? 'mianshitongguo' 
-                : info.interviewResultType == 1 
+                : info.interviewResultType == 2 
                   ? 'butongguo' 
                   : 'kaolvyixia'}.svg`"
               mode="scaleToFill"
             />
-			{{info.interviewResultType==0?'面试通过':(info.interviewResultType==1?'不通过':'考虑一下')}}
+			{{info.interviewResultType==0?'面试通过':(info.interviewResultType==2?'不通过':'考虑一下')}}
           </view></view
         >
         <view class="mianshi-result-txt">
@@ -134,14 +134,14 @@
       </view>
     </view>
     <view class="btn-bottom">
-		<block v-if="info.restHour>3">
-      <view class="btn-item" @click="cancelInterview = true">取消面试</view>
-      <view class="btn-item" @click="onEdit">修改面试</view>
-	  </block>
-	  <block v-else>
-		 <view class="btn-item" @click="onEdit">重新邀约</view> 
-		 <view v-if="currentStep==4" class="btn-item" @click="showRecord=true">编辑面试记录</view> 
-	  </block>
+		<template v-if="info.restHour>3 && info.status !== 3">
+			<view class="btn-item" @click="cancelInterview = true">取消面试</view>
+			<view class="btn-item" @click="onEdit">修改面试</view>
+		</template>
+		<template v-else>
+			<view class="btn-item" @click="onEdit">重新邀约</view> 
+			<view v-if="currentStep==4" class="btn-item" @click="showRecord=true">编辑面试记录</view> 
+		</template>
     </view>
     <u-popup v-model="showRecord" mode="bottom" border-radius="40">
       <view class="mianshi-record">

+ 7 - 0
my/jilu/mianshiDetail.vue

@@ -190,6 +190,13 @@
 	    >
 	      开始面试
 	    </button>
+      <button
+	      class="action-btn"
+	      v-if="currentStep === 3"
+	      @click="updateRecord(4, 2)"
+	    >
+	      面试已完成
+	    </button>
 	    <button
 	      class="action-btn"
 	      v-if="currentStep === 4"

+ 4 - 0
package/jobIntention/addExpectation.vue

@@ -318,6 +318,10 @@ export default {
 			  uni.showToast({ title: "最低薪酬不能大于最高薪酬", icon: "none" });
 			  return;
 		  }
+		  if (this.minSalary?.indexOf('.') > -1 || this.maxSalary?.indexOf('.') > -1) {
+			  uni.showToast({ title: "期望薪酬请输入整数", icon: "none" });
+			  return
+		  }
 		  if (!this.industry) {
 		    uni.showToast({ title: "请选择跨境标签", icon: "none" });
 		    return;

+ 86 - 2
package/records/records.vue

@@ -124,6 +124,10 @@
 					  <text>{{ item.detailTime }}</text>
 				  </view>
 				  <view class="main-tip-text">{{ item.address }}</view>
+				  <view class="buttons flex" v-if="item.status == 1">
+					  <view class="button primary" @click.stop="setAccept(item)">接受</view>
+					  <view class="button" @click.stop="setReject(item)">拒绝</view>
+				  </view>
                  <!-- <view class="gwList-box-item-box-label flex align-center flex-wrap">
                     <view class="gw-tag" v-if="item.company && item.company.workRestTime">{{ item.company.workRestTime
                     }}
@@ -387,8 +391,9 @@ export default {
 	},
     gotoInfo(item) {
       if (this.title == "面试记录") {
-        if (item.status != 2)
-          return this.$queue.showToast('已同意方可查看详情')
+        if (item.status == 1) {
+			return this.$queue.showToast('已同意方可查看详情')
+		}
         uni.navigateTo({
           url: "/my/jilu/mianshiDetail?recordId=" + item.recordId,
         });
@@ -478,6 +483,66 @@ export default {
         }
       });
     },
+	//拒绝邀请
+	setReject(item) {
+		uni.showModal({
+			title: '提示',
+			content: '确定拒绝来自' + item.company.companyName + '的面试邀请吗?',
+			confirmColor: '#016BF6',
+			complete: ret => {
+				if (ret.confirm) {
+					let data = {
+						recordId: item.recordId,
+						type: 2
+					}
+					this.$Request.getT("/app/interviewRecord/userUpdateInter", data).then(res => {
+						if (res.code == 0) {
+							uni.showToast({
+								title: '已拒绝来自' + item.company.companyName + '的面试邀请'
+							})
+							this.page == 1
+							this.getDataLists(3)
+						} else {
+							uni.showToast({
+								title: res.msg,
+								icon: 'none'
+							})
+						}
+					})
+				}
+			}
+		})
+	},
+	//接受邀请
+	setAccept(item) {
+		uni.showModal({
+			title: '提示',
+			content: '确定接受来自' + item.company.companyName + '的面试邀请吗?',
+			confirmColor: '#016BF6',
+			complete: ret => {
+				if (ret.confirm) {
+					let data = {
+						recordId: item.recordId,
+						type: 1
+					}
+					this.$Request.getT("/app/interviewRecord/userUpdateInter", data).then(res => {
+						if (res.code == 0) {
+							uni.showToast({
+								title: '已接受面试邀请'
+							})
+							this.page == 1
+							this.getDataLists(3)
+						} else {
+							uni.showToast({
+								title: res.msg,
+								icon: 'none'
+							})
+						}
+					})
+				}
+			}
+		})
+	},
   },
 };
 </script>
@@ -714,4 +779,23 @@ page {
     margin-top: 20rpx;
   }
 }
+
+.buttons {
+	padding-top: 10px;
+	.button {
+		width: 86px;
+		height: 30px;
+		border: 1px solid #016bf6;
+		border-radius: 40px;
+		line-height: 28px;
+		text-align: center;
+		font-size: 14px;
+		color: #016bf6;
+		margin-right: 10px;
+	}
+	.primary {
+		border-color: rgba(1, 107, 246, 0.1);
+		background: rgba(1, 107, 246, 0.1);
+	}
+}
 </style>

+ 6 - 2
pages/index/index.vue

@@ -659,7 +659,6 @@ export default {
 	},
 	watch: {
 		current(newData, oldData) {
-			console.log(this.current)
 			uni.showLoading({
 				title: '加载中'
 			})
@@ -1051,6 +1050,7 @@ export default {
 			this.currentRuleClassifyId = job.ruleClassifyId
 			this.positionTag = this.positionTagMap[job.ruleClassifyId] || [{ id: '不限', name: '不限' }]
 			this.currentPostionCity = job.city
+			this.city = job.city
 			this.getDomWidth()
 		},
 		//下拉过程
@@ -1811,7 +1811,7 @@ export default {
 												} */
 					]
 					let industry = this.directionList
-					arr.forEach(function (item,index) {
+					arr.forEach((item,index) => {
 						var tmp = {}
 						tmp.id = item.ruleClassifyId
 						tmp.name = item.ruleClassifyName
@@ -1830,6 +1830,10 @@ export default {
 									industry.push(tm)
 							})
 						}
+						
+						if (this.current == index) {
+							this.city = item.citys
+						}
 					})
 					classRule.push({
 						id: '',

+ 30 - 3
pages/msg/im.vue

@@ -650,7 +650,7 @@
 			<view class="tis" :class="willStop?'change':''">{{recordTis}}</view>
 		</view>
 
-		<u-select v-model="showChangYong" title="常用词语" mode="single-column" :list="changYongList" @confirm="selConfirm">
+		<u-select v-model="showChangYong" title="常用词语" mode="single-column" :list="defaultMessageList" @confirm="selConfirm">
 		</u-select>
 
 		<u-action-sheet :list="list" @click="click" v-model="show"></u-action-sheet>
@@ -872,6 +872,7 @@
 	import permision from '@/js_sdk/wa-permission/permission.js'
 	import positionCard from '@/components/resume/position-card.vue'
 	import resumeCard from '@/components/resume/resume-card.vue'
+	import { logoutJP } from '@/utils/login.js';
 	export default {
 		components: {
 			attachment,
@@ -1051,7 +1052,19 @@
 		    isHtmlContent() {
 		      const str = this.postPushInfo?.positionDetails || '';
 		      return /<[^>]+>/.test(str);
-		    }
+		    },
+			defaultMessageList() {
+				const types = {
+					userName: this.resumesInfo?.userName, // 对方昵称
+					welfareTag: this.postPushInfo?.welfareTag, // 福利标签
+					ruleClassifyName: this.postPushInfo?.ruleClassifyName, // 岗位
+					companyName: this.postPushInfo?.company?.companyAllName, // 公司名称
+				}
+				return this.changYongList.map(item => {
+					item.label = this.replaceTemplate(item.label, types)
+					return item
+				})
+			}
 		},
 		onLoad(d) {
 			// #ifdef APP-PLUS
@@ -1175,6 +1188,9 @@
 			// uni.closeSocket()
 			// clearInterval(this.recordsInter)
 			// this.recordsInter = null
+			if (this.recordsInter) {
+				clearInterval(this.recordsInter)
+			}
 		},
 		methods: {
 			// 预览简历
@@ -1210,8 +1226,10 @@
 			},
 			goToInterviewDetail(item){
 				if(item.recordId){
+					// 判断是否是招聘端,如果是招聘端,则跳转到招聘端面试详情页
+					let prevUrl = this.userType == 2 ? '/my/jilu/bossMianshiDetail' : '/my/jilu/mianshiDetail'
 					uni.navigateTo({
-						url: `/my/jilu/bossMianshiDetail?recordId=${item.recordId}`
+						url: `${prevUrl}?recordId=${item.recordId}`
 					})
 				}
 			},
@@ -1515,6 +1533,7 @@
 			},
 			//拒绝邀请
 			setJuJue(item) {
+				console.log(item)
 				let that = this
 				uni.showModal({
 					title: '提示',
@@ -2135,6 +2154,12 @@
 					}
 				});
 			},
+			// 替换常用语中的公司信息,个人信息等
+			replaceTemplate(template, data) {
+				return template.replace(/\[(\w+)\]/g, (match, key) => {
+					return data[key] !== undefined ? data[key] : match;
+				});
+			},
 			goGuanZhu() {
 				if(this.userType == 1){
 					this.gotoInfo(this.postPushInfo.postPushId)
@@ -2580,6 +2605,8 @@
 					    content: msg.content,
 					    showCancel: false,
 					    success() {
+						  // 退出极光推送
+						  logoutJP()
 					      that.$queue.logout();
 					      uni.reLaunch({ url: '/pages/public/loginphone?type=1' })
 					    }

+ 14 - 1
pages/msg/index.vue

@@ -45,7 +45,10 @@
 					:key="tab.type + index"
 					@click="changeTab(tab.type, 'fixed')">
 						{{ tab.name }}
-						<template v-if="userType == 1 && unreadCount && tab.type == 'unread'">({{ unreadCount }})</template>
+						<template v-if="userType == 1 && unreadCount && tab.type == 'unread'">
+							({{ unreadCount }})
+							<view class="red-dot"></view>
+						</template>
 					</view>
 				<view
 					class="tab"
@@ -976,6 +979,7 @@
 			padding: 8rpx 32rpx;
 			margin-bottom: 16rpx;
 			.tab {
+				position: relative;
 				padding: 8rpx 24rpx;
 				border-radius: 50rpx;
 				background: rgba(0, 0, 0, 0.04);
@@ -988,6 +992,15 @@
 					color: rgba(1, 107, 246, 1);
 					background: rgba(1, 107, 246, 0.1);
 				}
+				.red-dot {
+					position: absolute;
+					top: 2px;
+					right: 2px;
+					width: 8px;
+					height: 8px;
+					border-radius: 8px;
+					background: #f53f3f;
+				}
 			}
 			.icon-wrapper {
 				position: relative;

+ 7 - 7
pages/msg/interviewInvitation.vue

@@ -209,7 +209,7 @@
 				meridiem: ['AM', 'PM'],
 				methodList: ['腾讯会议', '钉钉', '微信视频', '电话面试'],
 				methodActiveIndex: 0,
-				selecteMethodText: '',
+				selecteMethodText: '腾讯会议',
 				rules: false,
 				isCancel: true,
 				postPushId: "",
@@ -361,7 +361,7 @@
 							callback: (data) => {
 								console.log(data)
 								if (type === 'address') {
-									this.selectedAddress = data.address + data.floor
+									this.selectedAddress = data.address + (data.floor || '')
 									this.detailedAddress = data.floor
 									this.address = data.address
 									this.latitude=data.latitude
@@ -471,11 +471,12 @@
 					  this.selectedDate=[{date:this.interviewDateTime,info:'已预约'}]
 					  this.address=res.data.address
 					  this.detailedAddress=res.data.detailedAddress
-					  this.selectedAddress = this.address + this.detailedAddress
+					  this.selectedAddress = this.address + (this.detailedAddress || '')
 					  this.hrPhone=res.data.hrPhone
 					  this.personText=res.data.hrName
 					  
 					this.selectedTime=res.data.detailTime
+					
 					if(this.selectedTime){
 						var timeLimit=res.data.detailTime.split(' ')
 						var hourMinute=timeLimit[0].split(':')
@@ -502,18 +503,17 @@
 					remarks: this.textareaValue,
 					detailedAddress: this.detailedAddress,
 					type: this.radioValue,
-					address: this.address,
+					address: this.radioValue == 0 ? this.address : '',
 					lat:this.latitude,
 					lng:this.longitude,
 					detailTime: this.selectedTime,
-					onlineType: this.selecteMethodText,
-					onlineMsg: this.onlineMsg,
+					onlineType: this.radioValue == 1 ? this.methodActiveIndex : '',
+					onlineMsg: this.radioValue == 1 ? this.onlineMsg : '',
 					interviewerId: this.interviewerId,
 					hrPhone: this.hrPhone,
 					hrName: this.personText,
 				}
 				
-				
 				if(!data.hrPhone || !data.hrName){
 					uni.showToast({
 						title: '请选择联系人',

+ 3 - 0
pages/my/myCompany.vue

@@ -141,6 +141,7 @@
 <script>
 import navBar from '@/components/nav-bar/index.vue'
 import cModal from '@/components/c-modal.vue'
+import { logoutJP } from '@/utils/login'
 	
 export default {
 	components: {
@@ -436,6 +437,8 @@ export default {
 				icon: 'none',
 			})
 			setTimeout(() => {
+				// 退出极光推送
+				logoutJP()
 				this.$queue.toLogin()
 				this.$queue.logout()
 			}, 1500)

+ 9 - 17
pages/my/searchCompanys.vue

@@ -12,20 +12,10 @@
 			<scroll-view :scroll-y="true" class="scroll-view">
 				<view class="scroll-wrapper">
 					<u-radio-group v-model="companyId" @change="handleChangeSelect">
-						<u-radio
-							shape="circle"
-							v-for="company in companys"
-							:key="company.companyId"
-							:name="company.companyId"
-						>{{ company.companyName }}</u-radio>
+						<view v-for="company in companys" :key="company.companyId" style="width: 100%">
+							<u-radio shape="circle" :name="company.companyId">{{ company.companyAllName }}</u-radio>							
+						</view>
 					</u-radio-group>
-					<!-- <view class="company-item" v-for="company in companys" :key="company.companyId">
-						<u-radio 
-							v-model="company.checked" 
-							:name="company.companyId"
-							@change="checkboxChange"
-						>{{company.companyName}}</u-radio>						
-					</view> -->
 				</view>
 			</scroll-view>			
 		</view>
@@ -63,14 +53,16 @@
 				})
 				this.$Request
 					.getT('/app/company/getVerifiedCompany', {
-						companyName: this.searchValue
+						page: 1,
+						limit: 20,
+						companyAllName: this.searchValue
 					})
 					.then(res => {
 						if (res.code === 0) {
 							this.companyId = ''
 							this.companyName = ''
-							if (res.data && res.data.length) {
-								this.companys = res.data								
+							if (res.data && res.data?.records?.length) {
+								this.companys = res.data.records
 							} else {
 								this.$queue.showToast('没有搜索到对应公司')
 							}
@@ -84,7 +76,7 @@
 			handleChangeSelect(e) {
 				this.companys.forEach(c => {
 					if (c.companyId == e) {
-						this.companyName = c.companyName
+						this.companyName = c.companyAllName
 					}
 				})
 			},

+ 5 - 0
pages/my/setup.vue

@@ -69,6 +69,7 @@
 <script>
 import configdata from '../../common/config.js';
 import navBar from "@/components/nav-bar/index.vue";
+import { logoutJP } from '@/utils/login.js';
 export default {
 	components: {
 		navBar
@@ -365,6 +366,8 @@ export default {
 				success: (res) => {
 					if (res.confirm) {
 						console.log("用户点击确定");
+						// 退出极光推送
+						logoutJP()
 						that.$queue.logout()
 						uni.$emit('offLogin')
 						uni.showToast({
@@ -421,6 +424,8 @@ export default {
 			this.$Request.postJson("/app/user/logout").then((res) => {
 				//订单状态通知
 				if (res.code == 0) {
+					// 退出极光推送
+					logoutJP()
 					that.$queue.logout()
 					uni.$emit('offLogin')
 					uni.showToast({

+ 14 - 2
pages/public/loginV2.vue

@@ -55,7 +55,7 @@
 
 <script>
 	import { jVerificationLogin, closeVerifyView } from '@/utils/jVerificationLogin'
-	import { membershipExpirationReminder } from '@/utils/login'
+	import { membershipExpirationReminder, getJPLoginParams } from '@/utils/login'
 	export default {
 		data() {
 			return {
@@ -105,6 +105,9 @@
 			let systemInfo = uni.getSystemInfoSync();
 			this.statusBarHeight = systemInfo.statusBarHeight || 0;
 		},
+		onUnload() {
+			this.clearCountdownTimer()
+		},
 		methods: {
 			// 获取验证码
 			getVerifyCode() {
@@ -200,11 +203,20 @@
 				// #ifdef H5
 					platform = 'h5'
 				// #endif
+				// 获取极光推送登录信息
+				let JPLoginParams = getJPLoginParams()
+				console.log('登录信息', {
+					phone: this.phoneNum,
+					msg: this.verifyCode,
+					platform,
+					...JPLoginParams
+				})
 				this.$Request
 					.post('/app/Login/registerAndLogin', {
 						phone: this.phoneNum,
 						msg: this.verifyCode,
-						platform
+						platform,
+						...JPLoginParams
 					})
 					.then((res) => {
 						this.loginFinished(res)

+ 2 - 1
pages/public/loginphone.vue

@@ -47,7 +47,7 @@
 
 <script>
 	import navBar from "@/components/nav-bar/index.vue";
-	import { membershipExpirationReminder } from '@/utils/login'
+	import { membershipExpirationReminder, getJPLoginParams } from '@/utils/login'
 	export default {
 		data() {
 			return {
@@ -166,6 +166,7 @@
 					let params = {
 						phone: phone,
 						wxOpenId: this.$queue.getData("openId") || '',
+						...getJPLoginParams()
 					}
 					let url = ''
 					if (this.type == 1) {

+ 2 - 2
pages/recruitmentData/communicationRecords.vue

@@ -191,7 +191,7 @@
 						<view class="qyList-box">
 							<view class="qyList-box-item flex justify-center" v-for="(item, index) in favoriteRecords"
 								:key="index"
-								@click="goNav(`/pages/talentSearch/resumeDetail?resumesId=${item.resumesId}&postPushId=${item.postPushId}`)">
+								@click="goNav(`/pages/talentSearch/resumeDetail?resumesId=${item.resumesId}&postPushId=${item.postPushId || ''}`)">
 								<view class="qyList-box-item-box">
 									<view class="qyList-box-item-info flex justify-between align-center" v-if="item.resumesListDto[0]">
 										<view class="qyList-box-item-info-l">
@@ -501,7 +501,7 @@
 			goToResumeDetail(record) {
 				console.log('查看简历详情:', record)
 				uni.navigateTo({
-					url: `/pages/talentSearch/resumeDetail?resumeId=${record.id}`
+					url: `/pages/talentSearch/resumeDetail?resumesId=${record.resumesId}`
 				})
 			},
 			selectDate(date) {

+ 3 - 1
utils/jVerificationLogin.js

@@ -4,6 +4,7 @@
  */
 import { isProduction } from '@/common/config'
 import HttpRequest from '@/common/httpRequest'
+import { getJPLoginParams } from './login'
 
 // 1. 引入极光插件
 const jv = uni.requireNativePlugin('JG-JVerification');
@@ -148,7 +149,8 @@ function doJVerificationLogin(callback) {
 					// 请求后端接口进行登录
 					const params = {
 						...loginRes,
-						platform: 'app'
+						...getJPLoginParams(),
+						platform: 'app',
 					}
 					HttpRequest
 						.postJson('/app/Login/jpushLogin', params)

+ 61 - 12
utils/login.js

@@ -1,5 +1,4 @@
 import HttpRequest from '@/common/httpRequest'
-import queue from '@/common/queue'
 
 /**
  * 处理微信登录
@@ -11,8 +10,8 @@ export function wxLogin(callback) {
 	uni.login({
 		provider: 'weixin',
 		success: (wxRes) => {
-			queue.setData('openId', wxRes.authResult.openid)
-			queue.setData('unionId', wxRes.authResult.unionId)
+			setData('openId', wxRes.authResult.openid)
+			setData('unionId', wxRes.authResult.unionId)
 			let data = {
 				wxOpenId: loginRes.authResult.openid,
 				token: loginRes.authResult.access_token
@@ -65,17 +64,17 @@ export function phoneLogin(params) {
  */
 export function login(res) {
 	if (res.code == 0) {
-		queue.setData("userId", res.user.userId)
-		queue.setData("token", res.token)
-		queue.setData("phone", res.user.phone)
-		queue.setData("userName", res.user.userName)
-		queue.setData("avatar", res.user.avatar)
-		queue.setData("invitationCode", res.user.invitationCode)
-		queue.setData("inviterCode", res.user.inviterCode)
+		setData("userId", res.user.userId)
+		setData("token", res.token)
+		setData("phone", res.user.phone)
+		setData("userName", res.user.userName)
+		setData("avatar", res.user.avatar)
+		setData("invitationCode", res.user.invitationCode)
+		setData("inviterCode", res.user.inviterCode)
 		getIsVip()
 		uni.hideLoading()
 		if (res.user.userType) {
-			queue.setData("userType", res.user.userType)
+			setData("userType", res.user.userType)
 			uni.reLaunch({
 				url: '/pages/my/index',
 			})
@@ -95,7 +94,7 @@ export function login(res) {
 function getIsVip() {
 	HttpRequest.get("/app/UserVip/isUserVip").then((res) => {
 		if (res.code == 0) {
-			queue.setData("isVip", res.data);
+			setData("isVip", res.data);
 		}
 	});
 }
@@ -113,3 +112,53 @@ export function membershipExpirationReminder(data) {
 		}, 1000)
 	}
 }
+
+/**
+ * 获取极光推送相关登录信息
+ */
+export function getJPLoginParams() {
+	// 极光推送SDK初始化注册ID
+	let registrationId = getData('registerID') || ''
+	// 设备类型:0 安卓、1 iOS、2 鸿蒙
+	let deviceType = 0
+	if (uni.getSystemInfoSync().platform == "ios") {
+		deviceType = 1
+	}
+	return {
+		registrationId,
+		deviceType
+	}
+}
+
+/**
+ * 退出登录,断开极光推送连接
+ */
+export function logoutJP() {
+	// 退出登录,断开极光推送连接
+	// #ifdef APP-PLUS
+	HttpRequest
+		.getT('/app/Login/out')
+		.then(res => {
+			console.log('退出登录成功', res)
+		})
+	// #endif
+}
+
+function setData(key, value) {
+	try {
+		uni.setStorageSync(key, value);
+	} catch (e) {
+		console.log(e)
+	}
+}
+
+function getData(key) {
+	try {
+		const value = uni.getStorageSync(key);
+		if (value) {
+			return value;
+		}
+	} catch (e) {
+		console.log(e)
+	}
+}