|
|
@@ -12,11 +12,7 @@
|
|
|
<view class="content-index">
|
|
|
<!-- Logo上传区域 -->
|
|
|
<view class="upload-section">
|
|
|
- <view
|
|
|
- class="upload-box"
|
|
|
- :class="{ 'has-image': logoImage }"
|
|
|
- @click="chooseImage"
|
|
|
- >
|
|
|
+ <view class="upload-box" :class="{ 'has-image': logoImage }" @click="chooseImage">
|
|
|
<view v-if="!logoImage" class="upload-placeholder">
|
|
|
<u-icon name="plus" color="#999" size="40"></u-icon>
|
|
|
<text class="upload-text">添加照片</text>
|
|
|
@@ -35,10 +31,7 @@
|
|
|
<!-- 上传进度 -->
|
|
|
<view v-if="uploading" class="upload-progress">
|
|
|
<view class="progress-bar">
|
|
|
- <view
|
|
|
- class="progress-inner"
|
|
|
- :style="{ width: uploadProgress + '%' }"
|
|
|
- ></view>
|
|
|
+ <view class="progress-inner" :style="{ width: uploadProgress + '%' }"></view>
|
|
|
</view>
|
|
|
<text class="progress-text">{{ uploadProgress }}%</text>
|
|
|
</view>
|
|
|
@@ -49,22 +42,22 @@
|
|
|
<view class="warning-title">注意事项:</view>
|
|
|
<view class="warning-list">
|
|
|
<view class="warning-item">1. 请上传清晰且完整的图片</view>
|
|
|
- <view class="warning-item"
|
|
|
- >2.
|
|
|
- 请上传品牌相关的图片,含有其他内容将无法通过审核(包括但不限于含有水印、招聘信息、联系方式、二维码等相关内容)</view
|
|
|
- >
|
|
|
- <view class="warning-item"
|
|
|
- >3. 上传图片须符合中国相关法律法规,不得含有违法内容或不良信息</view
|
|
|
- >
|
|
|
+ <view class="warning-item">2.
|
|
|
+ 请上传品牌相关的图片,含有其他内容将无法通过审核(包括但不限于含有水印、招聘信息、联系方式、二维码等相关内容)</view>
|
|
|
+ <view class="warning-item">3. 上传图片须符合中国相关法律法规,不得含有违法内容或不良信息</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
- <view class="submit-btn" :class="{ disabled: !logoImage }" @click="goJobPostingSecond"
|
|
|
- >下一步</view
|
|
|
- >
|
|
|
+ <view class="submit-btn" :class="{ disabled: !logoImage }" @click="goJobPostingSecond">下一步</view>
|
|
|
+ <!-- 权限说明弹窗 -->
|
|
|
+ <u-popup mode="top" ref="permission">
|
|
|
+ <view class="popup-content">
|
|
|
+ <view class="popup-text-permission">选择/拍摄照片需要相机/相册权限,用于上传用户头像</view>
|
|
|
+ </view>
|
|
|
+ </u-popup>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
@@ -85,32 +78,25 @@ export default {
|
|
|
onLoad(options) {
|
|
|
if (options.companyData) {
|
|
|
this.companyData = JSON.parse(options.companyData);
|
|
|
- console.log(this.companyData);
|
|
|
+ console.log(this.companyData);
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
// 选择图片
|
|
|
async chooseImage() {
|
|
|
const that = this;
|
|
|
- // 1. 先判断系统类型,区分Android/iOS权限
|
|
|
- const systemInfo = uni.getSystemInfoSync();
|
|
|
- const isAndroid = systemInfo.system.includes('Android');
|
|
|
- const permissionType = isAndroid ? 'storage' : 'photos'; // Android=存储,iOS=相册
|
|
|
-
|
|
|
- // 2. 权限检查(复用之前封装的 checkPermission 函数)
|
|
|
- const hasPermission = this.$queue.checkPermission(
|
|
|
- permissionType,
|
|
|
- isAndroid
|
|
|
- ? '选择/拍摄照片需要相机/相册权限,用于上传企业logo/企业资料' // Android 专属提示
|
|
|
- : '选择/拍摄照片需要相机/相册权限,用于上传企业logo/企业资料'
|
|
|
- );
|
|
|
-
|
|
|
- if (!hasPermission) {
|
|
|
- uni.showToast({ title: '未获取权限,无法选择照片', icon: 'none' });
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
+ // 1. 检查权限状态
|
|
|
+ const hasPermission = await this.$queue.checkPermission(
|
|
|
+ 'camera',
|
|
|
+ '选择/拍摄照片需要相机/相册权限,用于上传用户头像',
|
|
|
+ this
|
|
|
+ );
|
|
|
+
|
|
|
+ // 2. 如果未授权或者用户拒绝,显示提示
|
|
|
+ if (!hasPermission) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
uni.chooseImage({
|
|
|
count: 1,
|
|
|
sizeType: ["compressed"], // 可以指定是原图还是压缩图,默认二者都有
|
|
|
@@ -118,7 +104,7 @@ export default {
|
|
|
success: (res) => {
|
|
|
// 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
|
|
|
const tempFilePaths = res.tempFilePaths;
|
|
|
-
|
|
|
+
|
|
|
// 这里可以添加图片验证
|
|
|
that.validateAndUploadImage(tempFilePaths[0]);
|
|
|
},
|
|
|
@@ -177,27 +163,27 @@ export default {
|
|
|
clearInterval(progressTimer);
|
|
|
}
|
|
|
}, 100);
|
|
|
-
|
|
|
- this.$queue.uploadFile(filePath,(path)=>{
|
|
|
- if(path) {
|
|
|
- clearInterval(progressTimer);
|
|
|
- that.uploadProgress = 100;
|
|
|
- that.logoImage = path
|
|
|
- uni.showToast({
|
|
|
- title: '上传成功',
|
|
|
- icon: 'success'
|
|
|
- });
|
|
|
- }
|
|
|
- else {
|
|
|
- uni.showToast({
|
|
|
- title: data.message || '上传失败',
|
|
|
- icon: 'none'
|
|
|
- });
|
|
|
- }
|
|
|
- setTimeout(() => {
|
|
|
- that.uploading = false;
|
|
|
- }, 500);
|
|
|
- })
|
|
|
+
|
|
|
+ this.$queue.uploadFile(filePath, (path) => {
|
|
|
+ if (path) {
|
|
|
+ clearInterval(progressTimer);
|
|
|
+ that.uploadProgress = 100;
|
|
|
+ that.logoImage = path
|
|
|
+ uni.showToast({
|
|
|
+ title: '上传成功',
|
|
|
+ icon: 'success'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ uni.showToast({
|
|
|
+ title: data.message || '上传失败',
|
|
|
+ icon: 'none'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ setTimeout(() => {
|
|
|
+ that.uploading = false;
|
|
|
+ }, 500);
|
|
|
+ })
|
|
|
// 这里替换为你的实际上传接口
|
|
|
// uni.uploadFile({
|
|
|
// url: '你的上传接口地址',
|
|
|
@@ -286,8 +272,8 @@ export default {
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
- const companyData = this.companyData
|
|
|
- companyData.companyLogo = this.logoImage
|
|
|
+ const companyData = this.companyData
|
|
|
+ companyData.companyLogo = this.logoImage
|
|
|
uni.navigateTo({
|
|
|
url: "/my/renzheng/companyImg?companyData=" + encodeURIComponent(JSON.stringify(companyData)),
|
|
|
});
|
|
|
@@ -329,6 +315,7 @@ export default {
|
|
|
width: 100%;
|
|
|
padding-bottom: 20rpx;
|
|
|
box-sizing: border-box;
|
|
|
+
|
|
|
text {
|
|
|
font-size: 48rpx;
|
|
|
font-weight: 700;
|
|
|
@@ -365,6 +352,7 @@ export default {
|
|
|
|
|
|
.upload-section {
|
|
|
margin-bottom: 20rpx;
|
|
|
+
|
|
|
.upload-box {
|
|
|
width: 142rpx;
|
|
|
height: 142rpx;
|
|
|
@@ -483,6 +471,7 @@ export default {
|
|
|
font-size: 24rpx;
|
|
|
font-weight: 400;
|
|
|
line-height: 32rpx;
|
|
|
+
|
|
|
.warning-item {
|
|
|
margin-top: 8rpx;
|
|
|
}
|