安卓端已经成功适配

This commit is contained in:
aiShuiJiaoDeXioShou 2024-09-19 07:17:37 +08:00
parent bdabf5e452
commit 564c3ad0a1
23 changed files with 302 additions and 136 deletions

10
env/.env vendored
View File

@ -1,16 +1,18 @@
VITE_APP_TITLE = '宠屋'
VITE_APP_PORT = 8081
VITE_UNI_APPID = 'H57F2ACE4'
VITE_UNI_APPID = '__UNI__D748B51'
VITE_WX_APPID = 'wxf2c6d4b7361366b4'
# h5部署网站的base配置到 manifest.config.ts 里的 h5.router.base
VITE_APP_PUBLIC_BASE=/acdr/
VITE_FALLBACK_LOCALE=zh-Hans
# VITE_SERVER_BASEURL = 'http://47.99.70.12:28184/api'
# VITE_UPLOAD_BASEURL = 'http://47.99.70.12:28184'
# VITE_SERVER_BASEURL = 'http://localhost:28184/api'
VITE_SERVER_BASEURL = 'http://localhost:48080/app-api'
# VITE_SERVER_BASEURL = 'http://localhost:48080/app-api'
VITE_SERVER_BASEURL = 'http://47.99.70.12:48080/app-api'
# VITE_WS_BASEURL = 'ws://47.99.70.12:28184/api'
VITE_UPLOAD_BASEURL = 'http://localhost:28184'
VITE_OSS_BASEURL = 'http://116.204.119.171:9000/linghe'
@ -26,8 +28,8 @@ SHOPRO_VERSION = v1.8.3
SHOPRO_BASE_URL = http://api-dashboard.yudao.iocoder.cn
# 后端接口 - 测试环境(通过 process.env.NODE_ENV = development
SHOPRO_DEV_BASE_URL = http://127.0.0.1:48080
# SHOPRO_DEV_BASE_URL = http://47.99.70.12:48080
# SHOPRO_DEV_BASE_URL = http://127.0.0.1:48080
SHOPRO_DEV_BASE_URL = http://47.99.70.12:48080
### SHOPRO_DEV_BASE_URL = http://yunai.natapp1.cc
# 后端接口前缀(一般不建议调整)

View File

@ -2,7 +2,7 @@
<html build-time="%BUILD_TIME%">
<head>
<meta charset="UTF-8" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="logo.png" type="image/x-icon" />
<script>
var coverSupport =
'CSS' in window &&

BIN
logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 KiB

View File

@ -16,7 +16,7 @@ const {
export default defineManifestConfig({
name: VITE_APP_TITLE,
appid: VITE_UNI_APPID,
description: '',
"description" : "宠物一站式开发平台",
versionName: '1.0.0',
versionCode: '100',
transformPx: false,
@ -25,14 +25,27 @@ export default defineManifestConfig({
router: {
base: VITE_APP_PUBLIC_BASE,
},
sdkConfigs: {
maps: {
amap: {
key: '5a270020f3c6b67887c493a416ebd3ad',
securityJsCode: '3eabbc7e073e650ae2b1f213f8357422',
serviceHost: '',
"sdkConfigs" : {
"geolocation" : {
"system" : {
"__platform__" : [ "ios", "android" ]
},
"amap" : {
"name" : "amapCIxLx5gHo",
"__platform__" : [ "android" ],
"appkey_ios" : "",
"appkey_android" : "92219e40234c2046f50cb72a1a86e4f7"
}
},
"maps" : {
"amap" : {
"name" : "amapCIxLx5gHo",
"appkey_ios" : "92219e40234c2046f50cb72a1a86e4f7",
"appkey_android" : "92219e40234c2046f50cb72a1a86e4f7"
}
},
"oauth" : {},
"share" : {}
},
},
/* 5+App特有相关 */
@ -43,14 +56,28 @@ export default defineManifestConfig({
compatible: {
ignoreVersion: true,
},
splashscreen: {
alwaysShowBeforeRender: true,
waiting: true,
autoclose: true,
delay: 0,
},
"splashscreen" : {
"androidStyle" : "default",
"android" : {
"hdpi" : "src/static/start_bg.png",
"xhdpi" : "src/static/start_bg.png",
"xxhdpi" : "src/static/start_bg.png"
},
"useOriginalMsgbox" : true,
"iosStyle" : "common"
},
/* 模块配置 */
modules: {},
"modules" : {
"Barcode" : {},
"Bluetooth" : {},
"Camera" : {},
"Contacts" : {},
"Fingerprint" : {},
"Geolocation" : {},
"Maps" : {},
"SQLite" : {},
"Payment" : {}
},
/* 应用发布信息 */
distribute: {
/* android打包配置 */
@ -79,39 +106,63 @@ export default defineManifestConfig({
/* ios打包配置 */
ios: {},
/* SDK配置 */
sdkConfigs: {},
sdkConfigs: {
"payment" : {
"alipay" : {
"__platform__" : [ "ios", "android" ]
}
},
"geolocation" : {
"amap" : {
"name" : "amapCIxLx5gHo",
"__platform__" : [ "android" ],
"appkey_ios" : "",
"appkey_android" : "92219e40234c2046f50cb72a1a86e4f7"
},
"system" : {
"__platform__" : [ "ios", "android" ]
}
},
"maps" : {
"amap" : {
"name" : "amapCIxLx5gHo",
"appkey_ios" : "92219e40234c2046f50cb72a1a86e4f7",
"appkey_android" : "92219e40234c2046f50cb72a1a86e4f7"
}
},
},
/* 图标配置 */
icons: {
android: {
hdpi: 'static/app/icons/72x72.png',
xhdpi: 'static/app/icons/96x96.png',
xxhdpi: 'static/app/icons/144x144.png',
xxxhdpi: 'static/app/icons/192x192.png',
},
ios: {
appstore: 'static/app/icons/1024x1024.png',
ipad: {
app: 'static/app/icons/76x76.png',
'app@2x': 'static/app/icons/152x152.png',
notification: 'static/app/icons/20x20.png',
'notification@2x': 'static/app/icons/40x40.png',
'proapp@2x': 'static/app/icons/167x167.png',
settings: 'static/app/icons/29x29.png',
'settings@2x': 'static/app/icons/58x58.png',
spotlight: 'static/app/icons/40x40.png',
'spotlight@2x': 'static/app/icons/80x80.png',
"icons" : {
"android" : {
"hdpi" : "unpackage/res/icons/72x72.png",
"xhdpi" : "unpackage/res/icons/96x96.png",
"xxhdpi" : "unpackage/res/icons/144x144.png",
"xxxhdpi" : "unpackage/res/icons/192x192.png"
},
iphone: {
'app@2x': 'static/app/icons/120x120.png',
'app@3x': 'static/app/icons/180x180.png',
'notification@2x': 'static/app/icons/40x40.png',
'notification@3x': 'static/app/icons/60x60.png',
'settings@2x': 'static/app/icons/58x58.png',
'settings@3x': 'static/app/icons/87x87.png',
'spotlight@2x': 'static/app/icons/80x80.png',
'spotlight@3x': 'static/app/icons/120x120.png',
},
},
"ios" : {
"appstore" : "unpackage/res/icons/1024x1024.png",
"ipad" : {
"app" : "unpackage/res/icons/76x76.png",
"app@2x" : "unpackage/res/icons/152x152.png",
"notification" : "unpackage/res/icons/20x20.png",
"notification@2x" : "unpackage/res/icons/40x40.png",
"proapp@2x" : "unpackage/res/icons/167x167.png",
"settings" : "unpackage/res/icons/29x29.png",
"settings@2x" : "unpackage/res/icons/58x58.png",
"spotlight" : "unpackage/res/icons/40x40.png",
"spotlight@2x" : "unpackage/res/icons/80x80.png"
},
"iphone" : {
"app@2x" : "unpackage/res/icons/120x120.png",
"app@3x" : "unpackage/res/icons/180x180.png",
"notification@2x" : "unpackage/res/icons/40x40.png",
"notification@3x" : "unpackage/res/icons/60x60.png",
"settings@2x" : "unpackage/res/icons/58x58.png",
"settings@3x" : "unpackage/res/icons/87x87.png",
"spotlight@2x" : "unpackage/res/icons/80x80.png",
"spotlight@3x" : "unpackage/res/icons/120x120.png"
}
}
},
},
},
@ -121,7 +172,9 @@ export default defineManifestConfig({
'mp-weixin': {
appid: VITE_WX_APPID,
setting: {
urlCheck: false,
"urlCheck" : false,
"minified" : true,
"es6" : true
},
requiredPrivateInfos: ['getLocation', 'chooseLocation'],
permission: {

View File

@ -2,17 +2,18 @@
<view
:class="[
'pos-fixed z-999 left-[1px] flex gap-[5px] items-center content-center justify-center',
isH5 ? 'top-[3vw]' : 'top-[6vw]',
isH5 ? 'top-[2%]' : 'top-[6%]',
]"
>
<image src="/static/addresscell/location.png" class="w-[30px]" mode="widthFix" />
<view>
<image src="/static/addresscell/location.png" class="w-[6vw]" mode="widthFix" />
<view v-if="loading" class="text-size-[4vw]">
{{
!addressDetail.addressComponent
? '正在加载...'
: `${addressDetail.addressComponent.city} ${addressDetail.addressComponent.district}`
}}
</view>
<view v-else>未获取</view>
</view>
</template>
@ -21,14 +22,18 @@ import { getLocation, getMapDetailAddress } from '@/service/mapService'
import { isH5 } from '@/utils/platform'
const addressDetail = ref({})
const loading = ref(true)
//
const getLocationDetail = async () => {
try {
const loction = await getLocation()
const res = await getMapDetailAddress(loction.longitude, loction.latitude)
addressDetail.value = res
if (!addressDetail.value.addressComponent)
loading.value = false
} catch (e) {
console.log(e)
loading.value = false
}
}

View File

@ -19,8 +19,11 @@
</template>
<script>
import Page from "@/modules/mall/index/page.vue";
export default {
name: 'EmptyState',
components: { Page },
props: {
type: {
type: String,

View File

@ -109,6 +109,10 @@ const getLocation = () => {
covers[0].latitude = res.latitude
//
getMapDetailAddress(res.longitude, res.latitude).then((mapDetail) => {
mapDetail.location = {
longitude: res.longitude,
latitude: res.latitude,
}
emit('doneFun', mapDetail)
})
},

View File

@ -19,6 +19,7 @@ export const pay = async (order) => {
}
}
} catch (err) {
console.log(err.message)
uni.showToast({ title: '创建订单失败', icon: 'none' })
}
// #endif

View File

@ -1,7 +1,7 @@
{
"name": "宠屋",
"appid": "__UNI__9D479DC",
"description": "",
"description": "宠物一站式开发平台",
"versionName": "1.0.0",
"versionCode": "100",
"transformPx": false,
@ -13,9 +13,27 @@
"alwaysShowBeforeRender": true,
"waiting": true,
"autoclose": true,
"delay": 0
"delay": 0,
"androidStyle": "default",
"android": {
"hdpi": "src/static/start_bg.png",
"xhdpi": "src/static/start_bg.png",
"xxhdpi": "src/static/start_bg.png"
},
"useOriginalMsgbox": true,
"iosStyle": "common"
},
"modules": {
"Barcode": {},
"Bluetooth": {},
"Camera": {},
"Contacts": {},
"Fingerprint": {},
"Geolocation": {},
"Maps": {},
"SQLite": {},
"Payment": {}
},
"modules": {},
"distribute": {
"android": {
"permissions": [
@ -43,36 +61,68 @@
]
},
"ios": {},
"sdkConfigs": {},
"sdkConfigs": {
"payment": {
"alipay": {
"__platform__": [
"ios",
"android"
]
}
},
"geolocation": {
"amap": {
"name": "amapCIxLx5gHo",
"__platform__": [
"android"
],
"appkey_ios": "",
"appkey_android": "92219e40234c2046f50cb72a1a86e4f7"
},
"system": {
"__platform__": [
"ios",
"android"
]
}
},
"maps": {
"amap": {
"name": "amapCIxLx5gHo",
"appkey_ios": "92219e40234c2046f50cb72a1a86e4f7",
"appkey_android": "92219e40234c2046f50cb72a1a86e4f7"
}
}
},
"icons": {
"android": {
"hdpi": "static/app/icons/72x72.png",
"xhdpi": "static/app/icons/96x96.png",
"xxhdpi": "static/app/icons/144x144.png",
"xxxhdpi": "static/app/icons/192x192.png"
"hdpi": "unpackage/res/icons/72x72.png",
"xhdpi": "unpackage/res/icons/96x96.png",
"xxhdpi": "unpackage/res/icons/144x144.png",
"xxxhdpi": "unpackage/res/icons/192x192.png"
},
"ios": {
"appstore": "static/app/icons/1024x1024.png",
"appstore": "unpackage/res/icons/1024x1024.png",
"ipad": {
"app": "static/app/icons/76x76.png",
"app@2x": "static/app/icons/152x152.png",
"notification": "static/app/icons/20x20.png",
"notification@2x": "static/app/icons/40x40.png",
"proapp@2x": "static/app/icons/167x167.png",
"settings": "static/app/icons/29x29.png",
"settings@2x": "static/app/icons/58x58.png",
"spotlight": "static/app/icons/40x40.png",
"spotlight@2x": "static/app/icons/80x80.png"
"app": "unpackage/res/icons/76x76.png",
"app@2x": "unpackage/res/icons/152x152.png",
"notification": "unpackage/res/icons/20x20.png",
"notification@2x": "unpackage/res/icons/40x40.png",
"proapp@2x": "unpackage/res/icons/167x167.png",
"settings": "unpackage/res/icons/29x29.png",
"settings@2x": "unpackage/res/icons/58x58.png",
"spotlight": "unpackage/res/icons/40x40.png",
"spotlight@2x": "unpackage/res/icons/80x80.png"
},
"iphone": {
"app@2x": "static/app/icons/120x120.png",
"app@3x": "static/app/icons/180x180.png",
"notification@2x": "static/app/icons/40x40.png",
"notification@3x": "static/app/icons/60x60.png",
"settings@2x": "static/app/icons/58x58.png",
"settings@3x": "static/app/icons/87x87.png",
"spotlight@2x": "static/app/icons/80x80.png",
"spotlight@3x": "static/app/icons/120x120.png"
"app@2x": "unpackage/res/icons/120x120.png",
"app@3x": "unpackage/res/icons/180x180.png",
"notification@2x": "unpackage/res/icons/40x40.png",
"notification@3x": "unpackage/res/icons/60x60.png",
"settings@2x": "unpackage/res/icons/58x58.png",
"settings@3x": "unpackage/res/icons/87x87.png",
"spotlight@2x": "unpackage/res/icons/80x80.png",
"spotlight@3x": "unpackage/res/icons/120x120.png"
}
}
}
@ -85,7 +135,9 @@
"mp-weixin": {
"appid": "wxf2c6d4b7361366b4",
"setting": {
"urlCheck": false
"urlCheck": false,
"minified": true,
"es6": true
},
"usingComponents": true,
"requiredPrivateInfos": [
@ -113,18 +165,37 @@
"enable": false
},
"vueVersion": "3",
"locale": "zh-Hans",
"h5": {
"router": {
"base": "/acdr/"
},
"sdkConfigs": {
"geolocation": {
"system": {
"__platform__": [
"ios",
"android"
]
},
"amap": {
"name": "amapCIxLx5gHo",
"__platform__": [
"android"
],
"appkey_ios": "",
"appkey_android": "92219e40234c2046f50cb72a1a86e4f7"
}
},
"maps": {
"amap": {
"key": "5a270020f3c6b67887c493a416ebd3ad",
"securityJsCode": "3eabbc7e073e650ae2b1f213f8357422",
"serviceHost": ""
"name": "amapCIxLx5gHo",
"appkey_ios": "92219e40234c2046f50cb72a1a86e4f7",
"appkey_android": "92219e40234c2046f50cb72a1a86e4f7"
}
}
},
"oauth": {},
"share": {}
}
}
}

View File

@ -24,19 +24,19 @@
<view class="text-center flex gap-5 flex-col" v-if="!user.userInfo.isPetNursery">
<text class="text-xl text-gray-700 mb-4">您还未认证加入我们成为宠托师</text>
<image
class="w-full h-[90px]"
class="h-[90px]"
:src="imgUrl('@/static/certification/wy.png')"
mode="scaleToFill"
@click="goToApplication"
/>
<image
class="w-full h-[90px]"
class="h-[90px]"
:src="imgUrl('@/static/certification/wyl.png')"
mode="scaleToFill"
@click="goToApplication"
/>
<image
class="w-full h-[90px]"
class="h-[90px]"
:src="imgUrl('@/static/certification/mr.png')"
mode="scaleToFill"
@click="goToApplication"

View File

@ -104,7 +104,7 @@ const props = defineProps<{
position: absolute;
top: -15%;
right: 12%;
z-index: 999;
z-index: 1;
}
.loading-dots {

View File

@ -34,8 +34,8 @@ const props = defineProps<{
const genderIcon = computed(
() =>
props.gender === 1
? '/static/icons/arrow-icon.png' // 使
: '/static/icons/female-icon.png', // 使
? '/static/icons/arrow-logo.png' // 使
: '/static/icons/female-logo.png', // 使
)
</script>

View File

@ -43,6 +43,8 @@ const getQuickServices = async () => {
onLoad(async () => {
loading.value = true
//
setTimeout(()=> { loading.value = false }, 3000)
await getQuickServices()
loading.value = false
})

View File

@ -12,7 +12,7 @@
<Banner />
<AddressCell />
<!-- 这里放搜索框 -->
<view :class="['w-[70vw] pos-absolute right-0', isH5 ? 'top-[1vw]' : 'top-[3vw]']">
<view :class="['w-[70vw] pos-absolute right-0', isH5 ? 'top-[1vw]' : 'top-[6vw]']">
<Search />
</view>
<loading-animation v-model="isLoading" />
@ -119,6 +119,7 @@ const toPath = (path) => {
}
onLoad(async () => {
await uni.hideTabBar()
isLoading.value = true
await getPetInfo()
isLoading.value = false
@ -127,6 +128,8 @@ onLoad(async () => {
<style lang="scss" scoped>
page {
width: 100%;
height: 100%;
background-color: #f9f9f9;
}

View File

@ -73,7 +73,7 @@
<view class="pets-title">我的宠物</view>
<view class="pets-list scroll-x overflow-x-auto" scroll-x>
<view class="pet-item" v-for="(pet, index) in pets" @click="editPet(pet)" :key="index">
<wd-img :width="60" :height="60" round :src="pet.icon" class="pet-avatar" />
<wd-img :width="60" :height="60" round :src="pet.profileUrl" class="pet-avatar" />
<view class="pet-label">{{ pet.name }}</view>
</view>
<view class="pet-item add-pet" @click="toPath('/pages/pet/pet-add-page')">

View File

@ -68,7 +68,7 @@ import { ref } from 'vue'
import { httpUploadFile } from '@/utils/http'
import { useUserStore } from '@/store'
import TopBar from '@/components/TopBar.vue'
import { toPath } from '@/utils/commUtils'
import { toast, toPath } from "@/utils/commUtils";
const frontImage = ref('/static/permission/idcard.png')
const backImage = ref('/static/permission/idcard_back.png')
@ -119,17 +119,20 @@ const submitAuth = async () => {
type: 'front',
})
console.log(uploadRes)
user.setUserInfo({ isRealName: true })
if (uploadRes.code === 200) {
user.setUserInfo({ isRealName: true })
toast("实名认证成功!")
} else {
toast(uploadRes.msg || "认证失败,请重新认证!")
}
}
// if (backImagePath.value) {
// await httpUploadFile('/auth', backImagePath.value, 'file', { type: 'back' })
// }
uni.showToast({ title: '提交认证成功', icon: 'none' })
} catch (error) {
console.error(error)
if (error.statusCode == 413) {
if (error.statusCode === 413) {
uni.showToast({ title: '图片大小不能超过 1MB', icon: 'none' })
return
}

View File

@ -297,7 +297,7 @@ const fetchPetData = async (id) => {
gender.value = petData.sex === 1 ? '男孩' : '女孩'
petBreed.value = petData.breed || ''
petColor.value = petData.hairColor || ''
imageSrc.value = baseUrl + petData.profileUrl || 'https://via.placeholder.com/150'
imageSrc.value = petData.profileUrl || 'https://via.placeholder.com/150'
userId.value = petData.userId || '-1'
} else {
uni.showToast({ title: '获取宠物信息失败', icon: '' })

View File

@ -22,7 +22,7 @@
<!-- 服务类型 -->
<view class="mb-4">
<label class="label block mb-2">选择服务类型</label>
<picker mode="selector" :range="serviceTypes">
<picker mode="selector" :range="serviceTypes" @change="serviceTypesChange">
<view class="input w-full bg-gray-100 p-2 rounded">
{{ serviceTypes[selectedServiceType] }}
</view>
@ -86,12 +86,13 @@
<label class="label block mb-2">上传服务封面</label>
<button class="btn bg-gray-200 text-black mb-2" @click="chooseImage">选择图片</button>
<view v-if="uploadedImages.length > 0" class="flex flex-wrap">
<view
<image
v-for="(image, index) in uploadedImages"
:key="index"
class="w-24 h-24 m-2 bg-cover bg-center"
:style="{ backgroundImage: 'url(' + baseUrl + image + ')' }"
></view>
class="w-full h-24 m-2 bg-cover bg-center"
mode="widthFix"
:src="image"
></image>
</view>
</view>
</view>
@ -107,8 +108,8 @@
<script lang="js" setup>
import { ref } from 'vue'
import { httpGet, httpPost, httpUploadFile } from '@/utils/http'
import { baseUrl, toast } from '@/utils/commUtils'
import { httpPost, httpUploadFile } from '@/utils/http'
import { toast, toPath } from "@/utils/commUtils";
import { getCurrentLocation, showLocationOnMap, initMap } from '@/utils/map-utils'
import config from '@/utils/config'
import Map from '@/components/Map.vue'
@ -145,6 +146,11 @@ onShow(async () => {
await auth()
})
const serviceTypesChange = (value) => {
const index = value.detail.value
selectedServiceType.value = index
}
//
const auth = async () => {
if (!userStore.userInfo.isRealName) {
@ -164,16 +170,21 @@ const auth = async () => {
uni.navigateTo({ url: '/pages/permission/real-name-auth' })
return
}
if (!userStore.userInfo.isPetNursery) {
toPath('/pages/certification/index')
return
}
}
/**
* 地图加载完后执行的方法
* @param mapDetail 返回服务器获取的详细地址
*/
const doneFun = (mapDetail) => {
const doneFun = (md) => {
loadmap.value = false
mapDetail.value = mapDetail
serviceLocation.value = mapDetail.formatted_address
mapDetail.value = md
serviceLocation.value = mapDetail.value.formatted_address
location.value = mapDetail.value.location
}
//
@ -316,22 +327,24 @@ const submitService = () => {
serviceHost: serviceLocation.value,
state: serviceState.value ? 1 : 0,
url: uploadedImages.value[0],
address: location.value.address,
address: serviceLocation.value,
latitude: `${location.value.latitude}`,
longitude: `${location.value.longitude}`,
country: mapDetail.value.country,
province: mapDetail.value.province,
city: mapDetail.value.city,
district: mapDetail.value.district,
township: mapDetail.value.township,
streetNumber: mapDetail.value.streetNumber.street + mapDetail.value.streetNumber.number,
country: mapDetail.value.addressComponent.country,
province: mapDetail.value.addressComponent.province,
city: mapDetail.value.addressComponent.city,
district: mapDetail.value.addressComponent.district,
township: mapDetail.value.addressComponent.township,
streetNumber: mapDetail.value.addressComponent.streetNumber.street + mapDetail.value.addressComponent.streetNumber.number,
}
const endpoint = isEditMode.value ? '/personal-service/update' : '/personal-service/push'
httpPost(endpoint, serviceData).then((response) => {
if (response.code === 200) {
uni.showToast({ title: isEditMode.value ? '更新成功' : '发布成功', icon: 'success' })
//
toPath(-1)
} else {
uni.showToast({ title: isEditMode.value ? '更新失败' : '发布失败', icon: 'none' })
uni.showToast({ title: isEditMode.value ? '更新失败' : '发布失败:'+response.msg, icon: 'none' })
}
})
}

View File

@ -7,7 +7,7 @@
}
</route>
<template>
<image class="background" :src="imgUrl('@/static/push/bg.png')" mode="aspectFill"></image>
<image class="background" :src="imgUrl('/static/push/bg.png',false,'local')" mode="aspectFill"></image>
<view class="container h-[100vh]">
<scroll-view class="flex mt-2 space-x-4 h-[100%] p-t[100%]" scroll-x="true">
<view @click="handleService('door')" class="flex flex-col items-center w-full relative">

View File

@ -13,13 +13,13 @@
<!-- 顶部背景和头像 -->
<view class="relative">
<image
:src="baseUrl + serviceData.bgUrl"
:src="serviceData.bgUrl"
class="w-full h-40 object-cover"
mode="widthFix"
></image>
<view class="absolute left-4 bottom-[-20px]">
<image
:src="baseUrl + serviceData.userAvatar"
:src="serviceData.userAvatar"
mode="aspectFill"
class="w-20 h-20 object-cover rounded-full border-4 border-white"
></image>
@ -114,15 +114,15 @@
<!-- 底部操作栏 -->
<view
class="fixed bottom-0 w-full bg-white flex justify-between items-center px-[10px] mt-4 py-[10px] z-10"
class="fixed bottom-0 w-full bg-white flex justify-between items-center mt-4 z-10 py-3"
>
<text class="text-red-500 text-lg">¥{{ serviceData.price }}/ </text>
<view class="flex space-x-4">
<button @click="message" class="bg-gray-200 text-gray-600 rounded-full py-[2px] px-6">
<view class="flex space-x-4 pr-10px">
<button @click="message" class="bg-gray-200 text-gray-600 rounded-full w-100px">
消息
</button>
<button
class="bg-[#ffc107] text-white rounded-full py-[2px] px-6"
class="bg-[#ffc107] text-white rounded-full"
@click="openReservationModal"
>
预约宠托师
@ -132,11 +132,8 @@
</view>
<!-- 预约弹窗 -->
<view
v-if="showReservationModal"
class="z-999 fixed inset-0 flex items-center justify-center bg-black bg-opacity-50"
>
<view class="bg-white rounded-lg p-4 w-11/12">
<wd-overlay :show="showReservationModal">
<view class="bg-white rounded-lg p-4 w-full pos-absolute top-[40%] flex flex-col gap-5px">
<view class="text-lg font-bold mb-4">选择预约信息</view>
<!-- 服务宠物选择 -->
@ -150,7 +147,7 @@
:class="selectedPetId == pet.id ? 'border-4 border-[#ffc107] color-[#ffc107]' : ''"
>
<image
:src="baseUrl + pet.profileUrl"
:src="imgUrl(pet.profileUrl)"
class="w-20 h-20 rounded-full object-cover"
></image>
<text class="text-sm">{{ pet.name }}</text>
@ -194,7 +191,7 @@
</view>
<!-- 操作按钮 -->
<view class="fixed bottom-0 left-0 w-full p-4 bg-white shadow-up">
<view class="fixed bottom-0 left-0 w-full bg-white shadow-up py-[10px]">
<view class="flex justify-between">
<button
class="flex-1 mx-2 py-2 px-6 bg-gray-200 text-gray-600 rounded-full"
@ -211,7 +208,7 @@
</view>
</view>
</view>
</view>
</wd-overlay>
<LoadingAnimation v-model="loading" />
</template>
@ -219,7 +216,7 @@
<script lang="js" setup>
import { ref } from 'vue'
import { httpGet } from '@/utils/http'
import { baseUrl, toast, toPath } from '@/utils/commUtils'
import { baseUrl, imgUrl, toast, toPath } from "@/utils/commUtils";
import { pay } from '@/logic/pay'
import TopBar from '@/components/TopBar.vue'
import Map from '@/components/Map.vue'

View File

@ -133,9 +133,11 @@ const focus = async () => {
if (res.code == 200) {
focusUser.value = res.data
} else {
console.error(res);
toast(res.message || '数据获取失败')
}
} catch (error) {
console.error(error);
toast(error.data.message || '获取关注博主数据失败')
}
}
@ -147,9 +149,11 @@ const getPosts = async () => {
if (res.code == 200) {
postsList.value = res.data
} else {
console.error(res);
toast(res.message || '数据获取失败')
}
} catch (error) {
console.error(error);
toast(error.data.message || '获取关注博主数据失败')
}
}

View File

@ -74,7 +74,7 @@ export const getLocation = async () => {
return res // 返回最新的位置信息
} catch (err) {
console.log(err)
toast('获取位置失败')
// toast('获取位置失败')
throw err // 抛出错误,供调用者处理
}
}

View File

@ -11,7 +11,8 @@ export const toast = (message) => {
}
// 解析图片
export const imgUrl = (img, isOss) => {
export const imgUrl = (img, isOss, mode) => {
if(mode === "local") return img
const placeholder = 'https://via.placeholder.com/150' // 占位符图片的URL
const isLocation = img.startsWith('@/')
if (isLocation) return img.replace('@', ossUrl)
@ -61,7 +62,11 @@ export const scanCodeAsync = () => {
// 路径导航
export const toPath = (path) => {
if (path === '/') {
if (path == -1) {
uni.navigateBack()
}
if (path == '/') {
uni.switchTab({ url: '/pages/index/index' })
return
}