Browse Source

feat: 修改小程序上传

L 3 months ago
parent
commit
fd3589a2d2

+ 2 - 2
.hbuilderx/launch.json

@@ -9,8 +9,8 @@
             "type" : "uni-app:app-android"
         },
         {
-            "customPlaygroundType" : "local",
-            "playground" : "custom",
+            "customPlaygroundType" : "device",
+            "playground" : "standard",
             "type" : "uni-app:app-ios"
         }
     ]

+ 18 - 15
package-lock.json

@@ -1,33 +1,36 @@
 {
-    "name": "switch开关,按钮可嵌套内容,支持异步关闭、滑动动画效果、禁用以及颜色配置",
-    "version": "1.5",
+    "name": "省市区街道、地址选择器、四级联动选择器(附省市区街道数据文件)",
+    "version": "1.0.0",
     "lockfileVersion": 3,
     "requires": true,
     "packages": {
         "": {
-            "name": "switch开关,按钮可嵌套内容,支持异步关闭、滑动动画效果、禁用以及颜色配置",
-            "version": "1.5",
+            "name": "省市区街道、地址选择器、四级联动选择器(附省市区街道数据文件)",
+            "version": "1.0.0",
             "dependencies": {
-                "trtc-sdk-v5": "^5.8.3"
+                "trtc-sdk-v5": "^5.16.0"
             }
         },
         "node_modules/sdp": {
-            "version": "3.2.0",
-            "resolved": "https://registry.npmmirror.com/sdp/-/sdp-3.2.0.tgz",
-            "integrity": "sha512-d7wDPgDV3DDiqulJjKiV2865wKsJ34YI+NDREbm+FySq6WuKOikwyNQcm+doLAZ1O6ltdO0SeKle2xMpN3Brgw=="
+            "version": "3.2.1",
+            "resolved": "https://registry.npmmirror.com/sdp/-/sdp-3.2.1.tgz",
+            "integrity": "sha512-lwsAIzOPlH8/7IIjjz3K0zYBk7aBVVcvjMwt3M4fLxpjMYyy7i3I97SLHebgn4YBjirkzfp3RvRDWSKsh/+WFw==",
+            "license": "MIT"
         },
         "node_modules/trtc-sdk-v5": {
-            "version": "5.8.3",
-            "resolved": "https://registry.npmmirror.com/trtc-sdk-v5/-/trtc-sdk-v5-5.8.3.tgz",
-            "integrity": "sha512-MbcFNLp0NIkWxZaNAnIt6VKmb53a0kBsNB3zn1pocXhPGlXrx/zhyzaonM+VydDU24o0fjQlrvOajUWxuIuF0Q==",
+            "version": "5.16.0",
+            "resolved": "https://registry.npmmirror.com/trtc-sdk-v5/-/trtc-sdk-v5-5.16.0.tgz",
+            "integrity": "sha512-T+D+YOFyC9PeKizKAq/vBOyrtb5RyBhDHjgKZin9D2HqDs8Of8I6BCdJW0D9zXk8piXqHahD+1Cc4HRk7fqhBQ==",
+            "license": "ISC",
             "dependencies": {
-                "webrtc-adapter": "^8.2.3"
+                "webrtc-adapter": "^9.0.4"
             }
         },
         "node_modules/webrtc-adapter": {
-            "version": "8.2.3",
-            "resolved": "https://registry.npmmirror.com/webrtc-adapter/-/webrtc-adapter-8.2.3.tgz",
-            "integrity": "sha512-gnmRz++suzmvxtp3ehQts6s2JtAGPuDPjA1F3a9ckNpG1kYdYuHWYpazoAnL9FS5/B21tKlhkorbdCXat0+4xQ==",
+            "version": "9.0.4",
+            "resolved": "https://registry.npmmirror.com/webrtc-adapter/-/webrtc-adapter-9.0.4.tgz",
+            "integrity": "sha512-5ZZY1+lGq8LEKuDlg9M2RPJHlH3R7OVwyHqMcUsLKCgd9Wvf+QrFTCItkXXYPmrJn8H6gRLXbSgxLLdexiqHxw==",
+            "license": "BSD-3-Clause",
             "dependencies": {
                 "sdp": "^3.2.0"
             },

+ 4 - 1
package.json

@@ -24,5 +24,8 @@
     "uni_modules": {
         "dependencies": [],
         "encrypt": []
+    },
+    "dependencies": {
+        "trtc-sdk-v5": "^5.16.0"
     }
-}
+}

+ 7 - 0
pages.json

@@ -383,6 +383,13 @@
 				"navigationStyle": "custom"
 			}
 		},
+		{
+			"path": "pages/my/resumeUpload",
+			"style": {
+				"navigationBarTitleText": "附件简历",
+				"navigationStyle": "custom"
+			}
+		},
 		{
 			"path": "pages/my/ad",
 			"style": {

+ 11 - 10
pages/my/attachment.vue

@@ -32,16 +32,15 @@
 				<empty :isShow="false" v-if="content.length == 0" />
 			</scroll-view>
 		</view>
-		<!-- #ifdef APP-PLUS -->
-		<view class="white-btn" @click="handleWeChatUpload">微信上传</view>
-		<!-- #endif -->
+
 		<view class="buttons flex align-center">
 			<view class="button pain" @click="showTipPopup = true">Ai一键解析简历</view>
-			<view class="button primary">
+			<view class="button primary" @click="goResumeUpload">简历上传</view>
+			<!-- <view class="button primary">
 				简历上传
 				<fileSelector title="" allowType=".doc,.docx,.xls,.xlsx,.pdf" @fileSelected="uploadResumes"
 					@filesChanged="onFilesChanged" />
-			</view>
+			</view> -->
 		</view>
 		<!-- 简历解析确认弹窗 -->
 		<view class="popup-container" v-if="showTipPopup" @click="showTipPopup = false">
@@ -215,11 +214,13 @@ export default {
 			});
 
 		},
-		goMyAddress() {
-			uni.navigateTo({
-				url: '../jifen/myaddress'
-			});
-		},
+
+
+		goResumeUpload(){
+				uni.navigateTo({
+					url: '/pages/my/resumeUpload'
+				})
+			},
 		getUserInfo() {
 			this.$Request.get("/app/resumes/getAttachment").then(res => {
 				if (res.code == 0) {

+ 291 - 0
pages/my/resumeUpload.vue

@@ -0,0 +1,291 @@
+<template>
+	<view style="height: 100vh;" class="flex flex-direction">
+		<!-- 顶部导航栏 -->
+		<view class="navbar" :style="{ paddingTop: (12 + statusBarHeight) + 'px' }">
+			<view class="navbar-content">
+				<view class="navbar-left" @click="goBack">
+					<u-icon name="arrow-leftward" size="36" color="#333"></u-icon>
+				</view>
+				<view class="navbar-title">附件管理</view>
+				<view class="navbar-right"></view>
+			</view>
+		</view>
+
+		<!-- <nav-bar title="基本信息"></nav-bar> -->
+		<view class="contain flex flex-direction">
+		<!-- #ifdef APP-PLUS -->
+			<view 
+				class="upload-card"
+				:is-shadow="true"
+				@click="handleWeChatMiniApp"
+			>
+				<view class="card-icon"></view>
+				<view class="card-text">微信小程序上传</view>
+				<view class="card-badge"></view>
+			</view>
+		<!-- #endif -->
+			<view 
+				class="upload-card"
+				:is-shadow="true"
+			>
+				<view class="card-icon-phone"></view>
+				<view class="card-text">手机文件上传</view>
+				<fileSelector
+					class="upload-file-selector"
+					:isShowStyle="false"
+					title=""
+					allowType=".doc,.docx,.xls,.xlsx,.pdf"
+					@fileSelected="uploadResumes"
+				/>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+import fileSelector from '@/uni_modules/zhouquan-fileSelector/components/zhouquan-fileSelector/file-selector.vue';
+export default {
+	components: {
+		fileSelector
+	},
+
+	data() {
+		return {
+			statusBarHeight: 0, // 状态栏高度
+			content: [],
+			showLoadCard: false,
+			showResumesAnalysis: false,
+			validInfoCount: 0, // 有效信息数量
+
+			loading: false,
+			showTipPopup: false
+		};
+	},
+	onLoad(e) {
+		// 获取状态栏高度
+		let systemInfo = uni.getSystemInfoSync();
+		this.statusBarHeight = systemInfo.statusBarHeight || 0;
+
+		this.getUserInfo()
+		// this.avatar = uni.getStorageSync('avatar')
+	},
+	methods: {
+		// 返回上一页
+		goBack() {
+			uni.navigateBack();
+		},
+		getUserInfo() {
+			this.$Request.get("/app/resumes/getAttachment").then(res => {
+				if (res.code == 0) {
+					res.data.forEach(function (item) {
+						const ext = item.attachmentName.split('.').pop().toLowerCase();
+						item.fileType = ext
+					})
+					this.content = res.data
+				}
+				uni.hideLoading();
+			});
+		},
+
+		// 保存
+		uploadResumes(e) {
+			var that = this
+			console.log(e.path)
+			const validExtensions = ['pdf', 'doc', 'docx'];
+			const ext = e.name.split('.').pop().toLowerCase();
+			if (!validExtensions.includes(ext)) {
+				this.$queue.showToast('仅支持PDF/DOC/DOCX格式')
+				return;
+			}
+			uni.getFileInfo({
+				filePath: e.path,
+				success: (info) => {
+					let attachment_size = (info.size / 1024).toFixed(1)
+					that.$queue.uploadFile(e.path, function (path) {
+						uni.showLoading({ title: '上传中' })
+						if (path)
+							that.$Request.postJson("/app/resumes/saveAttachment", {
+								attachmentAddress: path,
+								attachmentName: e.name,
+								attachmentSize: attachment_size
+							}).then(res => {
+								uni.hideLoading()
+								if (res.code === 0) {
+									uni.showToast({
+										title: '上传成功',
+										icon: "none"
+									})
+									uni.navigateBack({
+										delta: 1
+									})
+								} else {
+									uni.showToast({
+										title: res.msg,
+										icon: "none"
+									})
+								}
+							})
+						else {
+							uni.hideLoading()
+							that.$queue.showToast('文件上传失败')
+						}
+					})
+				},
+				fail: (err) => {
+					uni.hideLoading()
+					console.error('获取失败', err);
+				}
+			});
+
+		},
+		// 微信小程序上传
+		handleWeChatUpload() {
+			plus.share.getServices(res => {
+			let weixinService = null;
+			for (let i in res) {
+				if (res[i].id === 'weixin') {
+				weixinService = res[i];
+				break;
+				}
+			}
+			const userId =  uni.getStorageSync('userId')
+			if (weixinService) {
+				weixinService.launchMiniProgram({
+				id: 'gh_854ab5288c2d', 
+				path: `/pages/index/index?userId=${userId}`,
+				type: 0 // 小程序版本类型:0-正式版;1-测试版;2-体验版
+				});
+			} else {
+				console.log('未安装微信或获取微信服务失败');
+			}
+			});
+		},
+
+		// 打开微信小程序
+		handleWeChatMiniApp() {
+			uni.showModal({
+				title: '提示',
+				content: '即将离开亿职赞打开微信小程序,请选择是否打开',
+				success: (res) => {
+					if (res.confirm) {
+						this.handleWeChatUpload()
+					}
+				}
+			})
+		}
+	},
+
+
+};
+</script>
+
+<style lang="scss" scoped>
+.navbar {
+	padding: 24rpx 32rpx 20rpx 32rpx;
+	background: #fff;
+
+	.navbar-content {
+		display: flex;
+		align-items: center;
+		justify-content: space-between;
+		height: 60rpx;
+
+		.navbar-left {
+			width: 60rpx;
+			height: 60rpx;
+			display: flex;
+			align-items: center;
+			justify-content: center;
+		}
+
+		.navbar-title {
+			color: rgba(23, 23, 37, 1);
+			font-family: DM Sans;
+			font-size: 36rpx;
+			font-weight: 700;
+			line-height: 52rpx;
+			letter-spacing: 0%;
+			text-align: center;
+		}
+
+		.navbar-right {
+			width: 60rpx;
+			height: 60rpx;
+		}
+	}
+}
+
+.contain {
+	flex: 1;
+	padding: 30rpx;
+	background: #f1f5f8;
+	.upload-card {
+		position: relative;
+		display: flex;
+		height: 100rpx;
+		padding: 0 30rpx;
+		background: #fff;
+		align-items: center;
+		line-height: 100rpx;
+		border-radius: 10rpx;
+		margin-bottom: 20rpx;
+
+		.card-icon {
+			width: 44rpx;
+			height: 44rpx;
+			background: url('@/static/images/resumeUpload/miniApp.png') no-repeat center center;
+			background-size: 100% 100%;
+			margin-right: 10rpx;
+		}
+		.card-icon-phone {
+			width: 44rpx;
+			height: 44rpx;
+			background: url('@/static/images/resumeUpload/phone.png') no-repeat center center;
+			background-size: 100% 100%;
+			margin-right: 10rpx;
+		}
+		.card-badge {
+			width: 44rpx;
+			height: 44rpx;
+			background: url('@/static/images/resumeUpload/recommendation.png') no-repeat center center;
+			background-size: 100% 100%;
+			margin-right: 10rpx;
+		}
+		.card-text {
+			margin: 0 10rpx;
+			font-size: 30rpx;
+			color: #666666;
+		}
+
+	}
+	.upload-file-selector {
+		position: absolute;
+		left: 0;
+		top: 0;
+		width: 100%;
+		height: 100%;
+		opacity: 0;
+		z-index: 5;
+	}
+
+	.upload-button {
+		width: 100%;
+		display: flex;
+		height: 100rpx;
+		position: relative;
+		background: #fff;
+		.upload-button-content {
+				display: flex;
+				z-index: 2;
+				position: absolute;
+				top: 0;
+				left: 0;
+		
+	
+			}
+
+			
+		}
+}
+
+</style>

BIN
static/images/resumeUpload/miniApp.png


BIN
static/images/resumeUpload/phone.png


BIN
static/images/resumeUpload/recommendation.png