Jelajahi Sumber

分享码宽高优化

Xiao_123 5 bulan lalu
induk
melakukan
54e3e739e6

+ 1 - 1
components/PositionList/index.vue

@@ -107,7 +107,7 @@ const toDetail = (item) =>{
 .enterAvatar{
 	width: 40px;
 	height: 40px;
-	border-radius: 50%;
+	// border-radius: 50%;
 	margin: auto;
 }
 

+ 1 - 1
pages/index/position.vue

@@ -21,7 +21,7 @@
               <view style="position: relative;">
                 <uni-search-bar
                   v-model="query.content"
-                  placeholder="输入职位/公司关键字"
+                  placeholder="输入职位/公司关键字"
                   cancelButton="none"
                   :focus="false"
                   bgColor="#fff"

+ 1 - 1
pagesA/collect/company.vue

@@ -5,7 +5,7 @@
         <view v-for="(item, index) in items" :key="index" class="ss-m-t-20" @click="toDetail(item)">
           <view style="background-color: #fff; border-radius: 12px;" class="ss-p-30">
             <view class="d-flex align-center">
-              <image :src="item.logoUrl || 'https://minio.citupro.com/dev/menduner/company-avatar.png'" class="avatar" style="width: 50px; height: 50px; object-fit: contain"></image>
+              <image :src="item.logoUrl || 'https://minio.citupro.com/dev/menduner/company-avatar.png'" style="width: 50px; height: 50px; object-fit: contain"></image>
               <view style="flex: 1;" class="ss-m-l-30">
                 <view class="enterprise-name ellipsis">{{ item.name }}</view>
                 <view class="ss-m-y-15 font-size-12">

+ 1 - 1
pagesA/seenMe/index.vue

@@ -15,7 +15,7 @@
           </view>
           <view style="background-color: #fff; border-radius: 0 0 12px 12px;" class="ss-p-30">
             <view class="d-flex align-center">
-              <image :src="item.enterprise.logoUrl" class="avatar" style="width: 50px; height: 50px;"></image>
+              <image :src="item.enterprise.logoUrl" style="width: 50px; height: 50px;"></image>
               <view style="flex: 1;" class="ss-m-l-30">
                 <view class="enterprise-name ellipsis">{{ item.enterprise.anotherName || item.enterprise.name }}</view>
                 <!-- 行业规模 -->

+ 1 - 1
pagesB/companyDetail/index.vue

@@ -2,7 +2,7 @@
   <view class="ss-p-b-30">
     <view class="mar p-tb ss-m-x-30">
       <view class="f-horizon">
-        <image class="r-avatar" style="width: 80px; height: 80px;" :src="info.logoUrl || 'https://minio.citupro.com/dev/menduner/company-avatar.png'"></image>
+        <image style="width: 80px; height: 80px;" :src="info.logoUrl || 'https://minio.citupro.com/dev/menduner/company-avatar.png'"></image>
         <view class="f-straight ss-m-l-10" style="flex: 1;position: relative;">
           <view class="title-des font-weight-bold" style="max-width: 45vw;">{{ info.anotherName }}</view>
           <view class="color-999 ellipsis font-size-14" style="max-width: 60vw;">

+ 1 - 1
pagesB/positionDetail/index.vue

@@ -46,7 +46,7 @@
           <!-- 企业信息 -->
           <view class="topLine mt-5 d-flex" @click="handleToEnterprise">
             <view class="avatarBox">
-              <image class="avatar" :src="info.enterprise?.logoUrl || 'https://minio.citupro.com/dev/menduner/company-avatar.png'"></image>
+              <image style="width: 40px; height: 40px;" :src="info.enterprise?.logoUrl || 'https://minio.citupro.com/dev/menduner/company-avatar.png'"></image>
             </view>
             <view >
               <view class="contact-name">{{ info.contact?.name }}</view>

+ 17 - 7
pagesB/sharePoster/index.vue

@@ -1,8 +1,8 @@
 <template>
   <view style="position: relative;">
-    <view v-if="shareUrl" class="d-flex align-center flex-column">
-      <image v-if="!!shareUrl" class="imgBox" @click="handlePreviewSharePoster" :src="shareUrl" :show-menu-by-longpress="true"></image>
-      <view class="color-999 ss-m-t-20 font-size-14">点击图片预览,长按图片保存</view>
+    <view v-if="shareUrl" class="d-flex align-center flex-column justify-center" style="height: 100vh;">
+      <image v-if="!!shareUrl" :style="imgStyle" @click="handlePreviewSharePoster" :src="shareUrl" :show-menu-by-longpress="true"></image>
+      <view class="color-999 ss-m-t-20 font-size-14 ss-m-b-50">点击图片预览,长按图片保存</view>
     </view>
 		<canvas canvas-id="posterCanvas" class="shareCanvas" style="width: 330px; height: 600px;"></canvas>
   </view>
@@ -11,10 +11,24 @@
 <script setup>
 import { ref, computed } from 'vue'
 import { userStore } from '@/store/user'
+import { onLoad } from '@dcloudio/uni-app'
 
 const useUserStore = userStore()
 const baseInfo = computed(() => useUserStore?.baseInfo)
 const shareUrl = ref('')
+const windowWidth = ref(0)
+
+onLoad(() => {
+  const windowInfo = wx.getWindowInfo()
+  windowWidth.value = windowInfo.windowWidth
+  console.log(windowWidth.value, '当前机型屏幕宽')
+})
+
+const imgStyle = computed(() => {
+  if (windowWidth.value <= 320) return `width: 259px; height: 460px;`
+  if (windowWidth.value > 320 && windowWidth.value <= 375) return `width: 313px; height: 560px;`
+  if (windowWidth.value > 375) return `width: 328px; height: 600px;`
+})
 
 // 图片预览
 const handlePreviewSharePoster = () => {
@@ -94,8 +108,4 @@ createPoster()
 	left: -99999upx;
 	z-index: -99999;
 }
-.imgBox {
-  width: 330px;
-  height: 600px;
-}
 </style>