安卓端已经成功适配

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_TITLE = '宠屋'
VITE_APP_PORT = 8081 VITE_APP_PORT = 8081
VITE_UNI_APPID = 'H57F2ACE4' VITE_UNI_APPID = '__UNI__D748B51'
VITE_WX_APPID = 'wxf2c6d4b7361366b4' VITE_WX_APPID = 'wxf2c6d4b7361366b4'
# h5部署网站的base配置到 manifest.config.ts 里的 h5.router.base # h5部署网站的base配置到 manifest.config.ts 里的 h5.router.base
VITE_APP_PUBLIC_BASE=/acdr/ VITE_APP_PUBLIC_BASE=/acdr/
VITE_FALLBACK_LOCALE=zh-Hans
# VITE_SERVER_BASEURL = 'http://47.99.70.12:28184/api' # VITE_SERVER_BASEURL = 'http://47.99.70.12:28184/api'
# VITE_UPLOAD_BASEURL = 'http://47.99.70.12:28184' # VITE_UPLOAD_BASEURL = 'http://47.99.70.12:28184'
# VITE_SERVER_BASEURL = 'http://localhost:28184/api' # 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_WS_BASEURL = 'ws://47.99.70.12:28184/api'
VITE_UPLOAD_BASEURL = 'http://localhost:28184' VITE_UPLOAD_BASEURL = 'http://localhost:28184'
VITE_OSS_BASEURL = 'http://116.204.119.171:9000/linghe' 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 SHOPRO_BASE_URL = http://api-dashboard.yudao.iocoder.cn
# 后端接口 - 测试环境(通过 process.env.NODE_ENV = development # 后端接口 - 测试环境(通过 process.env.NODE_ENV = development
SHOPRO_DEV_BASE_URL = http://127.0.0.1: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://47.99.70.12:48080
### SHOPRO_DEV_BASE_URL = http://yunai.natapp1.cc ### SHOPRO_DEV_BASE_URL = http://yunai.natapp1.cc
# 后端接口前缀(一般不建议调整) # 后端接口前缀(一般不建议调整)

View File

@ -2,7 +2,7 @@
<html build-time="%BUILD_TIME%"> <html build-time="%BUILD_TIME%">
<head> <head>
<meta charset="UTF-8" /> <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> <script>
var coverSupport = var coverSupport =
'CSS' in window && '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({ export default defineManifestConfig({
name: VITE_APP_TITLE, name: VITE_APP_TITLE,
appid: VITE_UNI_APPID, appid: VITE_UNI_APPID,
description: '', "description" : "宠物一站式开发平台",
versionName: '1.0.0', versionName: '1.0.0',
versionCode: '100', versionCode: '100',
transformPx: false, transformPx: false,
@ -25,14 +25,27 @@ export default defineManifestConfig({
router: { router: {
base: VITE_APP_PUBLIC_BASE, base: VITE_APP_PUBLIC_BASE,
}, },
sdkConfigs: { "sdkConfigs" : {
maps: { "geolocation" : {
amap: { "system" : {
key: '5a270020f3c6b67887c493a416ebd3ad', "__platform__" : [ "ios", "android" ]
securityJsCode: '3eabbc7e073e650ae2b1f213f8357422',
serviceHost: '',
}, },
"amap" : {
"name" : "amapCIxLx5gHo",
"__platform__" : [ "android" ],
"appkey_ios" : "",
"appkey_android" : "92219e40234c2046f50cb72a1a86e4f7"
}
}, },
"maps" : {
"amap" : {
"name" : "amapCIxLx5gHo",
"appkey_ios" : "92219e40234c2046f50cb72a1a86e4f7",
"appkey_android" : "92219e40234c2046f50cb72a1a86e4f7"
}
},
"oauth" : {},
"share" : {}
}, },
}, },
/* 5+App特有相关 */ /* 5+App特有相关 */
@ -43,14 +56,28 @@ export default defineManifestConfig({
compatible: { compatible: {
ignoreVersion: true, ignoreVersion: true,
}, },
splashscreen: { "splashscreen" : {
alwaysShowBeforeRender: true, "androidStyle" : "default",
waiting: true, "android" : {
autoclose: true, "hdpi" : "src/static/start_bg.png",
delay: 0, "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: { distribute: {
/* android打包配置 */ /* android打包配置 */
@ -79,39 +106,63 @@ export default defineManifestConfig({
/* ios打包配置 */ /* ios打包配置 */
ios: {}, ios: {},
/* SDK配置 */ /* 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: { "icons" : {
android: { "android" : {
hdpi: 'static/app/icons/72x72.png', "hdpi" : "unpackage/res/icons/72x72.png",
xhdpi: 'static/app/icons/96x96.png', "xhdpi" : "unpackage/res/icons/96x96.png",
xxhdpi: 'static/app/icons/144x144.png', "xxhdpi" : "unpackage/res/icons/144x144.png",
xxxhdpi: 'static/app/icons/192x192.png', "xxxhdpi" : "unpackage/res/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',
},
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': { 'mp-weixin': {
appid: VITE_WX_APPID, appid: VITE_WX_APPID,
setting: { setting: {
urlCheck: false, "urlCheck" : false,
"minified" : true,
"es6" : true
}, },
requiredPrivateInfos: ['getLocation', 'chooseLocation'], requiredPrivateInfos: ['getLocation', 'chooseLocation'],
permission: { permission: {

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
{ {
"name": "宠屋", "name": "宠屋",
"appid": "__UNI__9D479DC", "appid": "__UNI__9D479DC",
"description": "", "description": "宠物一站式开发平台",
"versionName": "1.0.0", "versionName": "1.0.0",
"versionCode": "100", "versionCode": "100",
"transformPx": false, "transformPx": false,
@ -13,9 +13,27 @@
"alwaysShowBeforeRender": true, "alwaysShowBeforeRender": true,
"waiting": true, "waiting": true,
"autoclose": 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": { "distribute": {
"android": { "android": {
"permissions": [ "permissions": [
@ -43,36 +61,68 @@
] ]
}, },
"ios": {}, "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": { "icons": {
"android": { "android": {
"hdpi": "static/app/icons/72x72.png", "hdpi": "unpackage/res/icons/72x72.png",
"xhdpi": "static/app/icons/96x96.png", "xhdpi": "unpackage/res/icons/96x96.png",
"xxhdpi": "static/app/icons/144x144.png", "xxhdpi": "unpackage/res/icons/144x144.png",
"xxxhdpi": "static/app/icons/192x192.png" "xxxhdpi": "unpackage/res/icons/192x192.png"
}, },
"ios": { "ios": {
"appstore": "static/app/icons/1024x1024.png", "appstore": "unpackage/res/icons/1024x1024.png",
"ipad": { "ipad": {
"app": "static/app/icons/76x76.png", "app": "unpackage/res/icons/76x76.png",
"app@2x": "static/app/icons/152x152.png", "app@2x": "unpackage/res/icons/152x152.png",
"notification": "static/app/icons/20x20.png", "notification": "unpackage/res/icons/20x20.png",
"notification@2x": "static/app/icons/40x40.png", "notification@2x": "unpackage/res/icons/40x40.png",
"proapp@2x": "static/app/icons/167x167.png", "proapp@2x": "unpackage/res/icons/167x167.png",
"settings": "static/app/icons/29x29.png", "settings": "unpackage/res/icons/29x29.png",
"settings@2x": "static/app/icons/58x58.png", "settings@2x": "unpackage/res/icons/58x58.png",
"spotlight": "static/app/icons/40x40.png", "spotlight": "unpackage/res/icons/40x40.png",
"spotlight@2x": "static/app/icons/80x80.png" "spotlight@2x": "unpackage/res/icons/80x80.png"
}, },
"iphone": { "iphone": {
"app@2x": "static/app/icons/120x120.png", "app@2x": "unpackage/res/icons/120x120.png",
"app@3x": "static/app/icons/180x180.png", "app@3x": "unpackage/res/icons/180x180.png",
"notification@2x": "static/app/icons/40x40.png", "notification@2x": "unpackage/res/icons/40x40.png",
"notification@3x": "static/app/icons/60x60.png", "notification@3x": "unpackage/res/icons/60x60.png",
"settings@2x": "static/app/icons/58x58.png", "settings@2x": "unpackage/res/icons/58x58.png",
"settings@3x": "static/app/icons/87x87.png", "settings@3x": "unpackage/res/icons/87x87.png",
"spotlight@2x": "static/app/icons/80x80.png", "spotlight@2x": "unpackage/res/icons/80x80.png",
"spotlight@3x": "static/app/icons/120x120.png" "spotlight@3x": "unpackage/res/icons/120x120.png"
} }
} }
} }
@ -85,7 +135,9 @@
"mp-weixin": { "mp-weixin": {
"appid": "wxf2c6d4b7361366b4", "appid": "wxf2c6d4b7361366b4",
"setting": { "setting": {
"urlCheck": false "urlCheck": false,
"minified": true,
"es6": true
}, },
"usingComponents": true, "usingComponents": true,
"requiredPrivateInfos": [ "requiredPrivateInfos": [
@ -113,18 +165,37 @@
"enable": false "enable": false
}, },
"vueVersion": "3", "vueVersion": "3",
"locale": "zh-Hans",
"h5": { "h5": {
"router": { "router": {
"base": "/acdr/" "base": "/acdr/"
}, },
"sdkConfigs": { "sdkConfigs": {
"geolocation": {
"system": {
"__platform__": [
"ios",
"android"
]
},
"amap": {
"name": "amapCIxLx5gHo",
"__platform__": [
"android"
],
"appkey_ios": "",
"appkey_android": "92219e40234c2046f50cb72a1a86e4f7"
}
},
"maps": { "maps": {
"amap": { "amap": {
"key": "5a270020f3c6b67887c493a416ebd3ad", "name": "amapCIxLx5gHo",
"securityJsCode": "3eabbc7e073e650ae2b1f213f8357422", "appkey_ios": "92219e40234c2046f50cb72a1a86e4f7",
"serviceHost": "" "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"> <view class="text-center flex gap-5 flex-col" v-if="!user.userInfo.isPetNursery">
<text class="text-xl text-gray-700 mb-4">您还未认证加入我们成为宠托师</text> <text class="text-xl text-gray-700 mb-4">您还未认证加入我们成为宠托师</text>
<image <image
class="w-full h-[90px]" class="h-[90px]"
:src="imgUrl('@/static/certification/wy.png')" :src="imgUrl('@/static/certification/wy.png')"
mode="scaleToFill" mode="scaleToFill"
@click="goToApplication" @click="goToApplication"
/> />
<image <image
class="w-full h-[90px]" class="h-[90px]"
:src="imgUrl('@/static/certification/wyl.png')" :src="imgUrl('@/static/certification/wyl.png')"
mode="scaleToFill" mode="scaleToFill"
@click="goToApplication" @click="goToApplication"
/> />
<image <image
class="w-full h-[90px]" class="h-[90px]"
:src="imgUrl('@/static/certification/mr.png')" :src="imgUrl('@/static/certification/mr.png')"
mode="scaleToFill" mode="scaleToFill"
@click="goToApplication" @click="goToApplication"

View File

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

View File

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

View File

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

View File

@ -12,7 +12,7 @@
<Banner /> <Banner />
<AddressCell /> <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 /> <Search />
</view> </view>
<loading-animation v-model="isLoading" /> <loading-animation v-model="isLoading" />
@ -119,6 +119,7 @@ const toPath = (path) => {
} }
onLoad(async () => { onLoad(async () => {
await uni.hideTabBar()
isLoading.value = true isLoading.value = true
await getPetInfo() await getPetInfo()
isLoading.value = false isLoading.value = false
@ -127,6 +128,8 @@ onLoad(async () => {
<style lang="scss" scoped> <style lang="scss" scoped>
page { page {
width: 100%;
height: 100%;
background-color: #f9f9f9; background-color: #f9f9f9;
} }

View File

@ -73,7 +73,7 @@
<view class="pets-title">我的宠物</view> <view class="pets-title">我的宠物</view>
<view class="pets-list scroll-x overflow-x-auto" scroll-x> <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"> <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 class="pet-label">{{ pet.name }}</view>
</view> </view>
<view class="pet-item add-pet" @click="toPath('/pages/pet/pet-add-page')"> <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 { httpUploadFile } from '@/utils/http'
import { useUserStore } from '@/store' import { useUserStore } from '@/store'
import TopBar from '@/components/TopBar.vue' 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 frontImage = ref('/static/permission/idcard.png')
const backImage = ref('/static/permission/idcard_back.png') const backImage = ref('/static/permission/idcard_back.png')
@ -119,17 +119,20 @@ const submitAuth = async () => {
type: 'front', type: 'front',
}) })
console.log(uploadRes) console.log(uploadRes)
if (uploadRes.code === 200) {
user.setUserInfo({ isRealName: true }) user.setUserInfo({ isRealName: true })
toast("实名认证成功!")
} else {
toast(uploadRes.msg || "认证失败,请重新认证!")
}
} }
// if (backImagePath.value) { // if (backImagePath.value) {
// await httpUploadFile('/auth', backImagePath.value, 'file', { type: 'back' }) // await httpUploadFile('/auth', backImagePath.value, 'file', { type: 'back' })
// } // }
uni.showToast({ title: '提交认证成功', icon: 'none' })
} catch (error) { } catch (error) {
console.error(error) console.error(error)
if (error.statusCode == 413) { if (error.statusCode === 413) {
uni.showToast({ title: '图片大小不能超过 1MB', icon: 'none' }) uni.showToast({ title: '图片大小不能超过 1MB', icon: 'none' })
return return
} }

View File

@ -297,7 +297,7 @@ const fetchPetData = async (id) => {
gender.value = petData.sex === 1 ? '男孩' : '女孩' gender.value = petData.sex === 1 ? '男孩' : '女孩'
petBreed.value = petData.breed || '' petBreed.value = petData.breed || ''
petColor.value = petData.hairColor || '' 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' userId.value = petData.userId || '-1'
} else { } else {
uni.showToast({ title: '获取宠物信息失败', icon: '' }) uni.showToast({ title: '获取宠物信息失败', icon: '' })

View File

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

View File

@ -7,7 +7,7 @@
} }
</route> </route>
<template> <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]"> <view class="container h-[100vh]">
<scroll-view class="flex mt-2 space-x-4 h-[100%] p-t[100%]" scroll-x="true"> <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 @click="handleService('door')" class="flex flex-col items-center w-full relative">

View File

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

View File

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

View File

@ -74,7 +74,7 @@ export const getLocation = async () => {
return res // 返回最新的位置信息 return res // 返回最新的位置信息
} catch (err) { } catch (err) {
console.log(err) console.log(err)
toast('获取位置失败') // toast('获取位置失败')
throw err // 抛出错误,供调用者处理 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 placeholder = 'https://via.placeholder.com/150' // 占位符图片的URL
const isLocation = img.startsWith('@/') const isLocation = img.startsWith('@/')
if (isLocation) return img.replace('@', ossUrl) if (isLocation) return img.replace('@', ossUrl)
@ -61,7 +62,11 @@ export const scanCodeAsync = () => {
// 路径导航 // 路径导航
export const toPath = (path) => { export const toPath = (path) => {
if (path === '/') { if (path == -1) {
uni.navigateBack()
}
if (path == '/') {
uni.switchTab({ url: '/pages/index/index' }) uni.switchTab({ url: '/pages/index/index' })
return return
} }