修改上传图片路径参数
This commit is contained in:
3
env/.env
vendored
3
env/.env
vendored
@ -22,4 +22,5 @@ VITE_APP_PROXY_PREFIX = '/storeapi'
|
|||||||
VITE_SERVER_BASEURL = 'https://cz.stnav.com'
|
VITE_SERVER_BASEURL = 'https://cz.stnav.com'
|
||||||
|
|
||||||
# 上传图片请求地址
|
# 上传图片请求地址
|
||||||
VITE_UPLOAD_BASEURL = 'https://cz.stnav.com/storeapi/upload/image'
|
VITE_UPLOAD_BASEURL = 'https://cz.stnav.com/storeapi/upload/image'
|
||||||
|
VITE_UPLOAD_IMAGE_URL = 'https://cz.stnav.com/'
|
||||||
@ -206,7 +206,7 @@
|
|||||||
try {
|
try {
|
||||||
const response = JSON.parse(e.file.response)
|
const response = JSON.parse(e.file.response)
|
||||||
if (response.code) {
|
if (response.code) {
|
||||||
const avatarUrl = response.data.uri
|
const avatarUrl = response.data.url
|
||||||
await updateUserInfo({ avatar: avatarUrl })
|
await updateUserInfo({ avatar: avatarUrl })
|
||||||
user.value.avatar = avatarUrl
|
user.value.avatar = avatarUrl
|
||||||
toast.info('头像上传成功')
|
toast.info('头像上传成功')
|
||||||
|
|||||||
@ -473,7 +473,7 @@
|
|||||||
status: res.status, // 状态 0下架1上架
|
status: res.status, // 状态 0下架1上架
|
||||||
}
|
}
|
||||||
|
|
||||||
fileList.value = res.img.split(',').map((item: string) => ({
|
fileList.value = res.img_list.map((item: string) => ({
|
||||||
name: item,
|
name: item,
|
||||||
url: item
|
url: item
|
||||||
}))
|
}))
|
||||||
@ -510,7 +510,7 @@
|
|||||||
const res = files.map(item => {
|
const res = files.map(item => {
|
||||||
if (item.response) {
|
if (item.response) {
|
||||||
response = JSON.parse(item.response)
|
response = JSON.parse(item.response)
|
||||||
url = response.data.uri
|
url = response.data.url
|
||||||
name = response.data.name
|
name = response.data.name
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
@ -651,8 +651,14 @@
|
|||||||
toast.info('请输入退改说明')
|
toast.info('请输入退改说明')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
formData.img = Add.fileList.map(item => item.url).join(',')
|
// 将图片URL中的 https://cz.stnav.com/ 替换为空
|
||||||
|
formData.img = Add.fileList.map(item => {
|
||||||
|
if (typeof item.url === 'string') {
|
||||||
|
return item.url.replace(import.meta.env.VITE_UPLOAD_IMAGE_URL, '')
|
||||||
|
}
|
||||||
|
return item.url
|
||||||
|
}).join(',')
|
||||||
|
|
||||||
if (roomId.value.includes(0)) {
|
if (roomId.value.includes(0)) {
|
||||||
formData.room_id = '0'
|
formData.room_id = '0'
|
||||||
@ -678,6 +684,7 @@
|
|||||||
await editTeaSpecialistOrderPackage(formData)
|
await editTeaSpecialistOrderPackage(formData)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uni.$emit('refreshOrderList')
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
toast.info(type.value == 'add' ? '发布成功' : '编辑成功')
|
toast.info(type.value == 'add' ? '发布成功' : '编辑成功')
|
||||||
router.navigateBack(1, 500)
|
router.navigateBack(1, 500)
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
<view class="rounded-4rpx w-60rpx text-center text-[#FF5951] border-2rpx border-solid border-[#FF5951] text-22rpx pb-4rpx mx-14rpx">{{ detail.discount }}折</view>
|
<view class="rounded-4rpx w-60rpx text-center text-[#FF5951] border-2rpx border-solid border-[#FF5951] text-22rpx pb-4rpx mx-14rpx">{{ detail.discount }}折</view>
|
||||||
<price-format color="#BFC2CC" :first-size="22" :second-size="22" :subscript-size="22" :price="detail.price" lineThrough></price-format>
|
<price-format color="#BFC2CC" :first-size="22" :second-size="22" :subscript-size="22" :price="detail.price" lineThrough></price-format>
|
||||||
</view>
|
</view>
|
||||||
<view class="text-[#6A6363] flex-1 text-22rpx leading-32rpx text-right">已售 10+</view>
|
<view class="text-[#6A6363] flex-1 text-22rpx leading-32rpx text-right">已售 {{ detail.sold > 10 ? '10+' : detail.sold }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="font-bold text-36rpx text-[#303133] leading-50rpx mt-26rpx">{{ detail.title }}</view>
|
<view class="font-bold text-36rpx text-[#303133] leading-50rpx mt-26rpx">{{ detail.title }}</view>
|
||||||
<view class="font-500 text-26rpx leading-48rpx text-[#303133] mt-24rpx">{{ detail.description }}</view>
|
<view class="font-500 text-26rpx leading-48rpx text-[#303133] mt-24rpx">{{ detail.description }}</view>
|
||||||
@ -170,38 +170,11 @@
|
|||||||
id.value = Number(args.id)
|
id.value = Number(args.id)
|
||||||
teaRoomPrice.value = Number(args.price) || 0
|
teaRoomPrice.value = Number(args.price) || 0
|
||||||
|
|
||||||
// if (args.type == ReserveServiceCategory.GroupBuying) {
|
Detail.handleInitGroupBuying()
|
||||||
// isGroupBuying.value = true
|
|
||||||
// pay.value = 3
|
|
||||||
Detail.handleInitGroupBuying()
|
|
||||||
// }
|
|
||||||
// Detail.handleInitReserveRoom()
|
|
||||||
|
|
||||||
// 获取用户需求详
|
|
||||||
// getUserInfo().then(res => {
|
|
||||||
// user.value = res
|
|
||||||
// })
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const Detail = {
|
const Detail = {
|
||||||
/**
|
|
||||||
* 初始包间详情
|
|
||||||
*/
|
|
||||||
handleInitReserveRoom: async () => {
|
|
||||||
// 包间详情
|
|
||||||
const userStore = useUserStore()
|
|
||||||
userInfo.value = userStore.userInfo
|
|
||||||
|
|
||||||
const res = await getTeaRoomDetail({
|
|
||||||
id: storeId.value,
|
|
||||||
latitude: uni.getStorageSync('latitude'),
|
|
||||||
longitude: uni.getStorageSync('longitude'),
|
|
||||||
user_id: userInfo.value.id || 0
|
|
||||||
})
|
|
||||||
teaRoom.value = res.details
|
|
||||||
swiperList.value = teaRoom.value.img_arr
|
|
||||||
},
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 初始化套餐详情
|
* 初始化套餐详情
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -51,6 +51,9 @@
|
|||||||
import useMescroll from "@/uni_modules/mescroll-uni/hooks/useMescroll.js"
|
import useMescroll from "@/uni_modules/mescroll-uni/hooks/useMescroll.js"
|
||||||
import { getTeaSpecialistOrderPackageList } from '@/api/order'
|
import { getTeaSpecialistOrderPackageList } from '@/api/order'
|
||||||
import { router } from '@/utils/tools'
|
import { router } from '@/utils/tools'
|
||||||
|
import { useStoreStore } from '@/store'
|
||||||
|
|
||||||
|
const useStore = useStoreStore()
|
||||||
|
|
||||||
// mescroll
|
// mescroll
|
||||||
const { mescrollInit, downCallback, getMescroll } = useMescroll(onPageScroll, onReachBottom) // 调用mescroll的hook
|
const { mescrollInit, downCallback, getMescroll } = useMescroll(onPageScroll, onReachBottom) // 调用mescroll的hook
|
||||||
@ -63,7 +66,7 @@
|
|||||||
}
|
}
|
||||||
const list = ref<Array<any>>([]) // 茶室列表
|
const list = ref<Array<any>>([]) // 茶室列表
|
||||||
const keywords = ref<string>('') // 搜索关键词
|
const keywords = ref<string>('') // 搜索关键词
|
||||||
|
|
||||||
// tab
|
// tab
|
||||||
const tab = ref<number>(1)
|
const tab = ref<number>(1)
|
||||||
const tabList = ref<Array<{title: string, num: number, name: number}>>([
|
const tabList = ref<Array<{title: string, num: number, name: number}>>([
|
||||||
@ -95,6 +98,7 @@
|
|||||||
size: mescroll.size,
|
size: mescroll.size,
|
||||||
status: tab.value,
|
status: tab.value,
|
||||||
search: keywords.value,
|
search: keywords.value,
|
||||||
|
store_id: useStore.defaultStore.id,
|
||||||
}
|
}
|
||||||
|
|
||||||
getTeaSpecialistOrderPackageList(filter).then((res) => {
|
getTeaSpecialistOrderPackageList(filter).then((res) => {
|
||||||
|
|||||||
@ -244,7 +244,7 @@
|
|||||||
const res = files.map(item => {
|
const res = files.map(item => {
|
||||||
if (item.response) {
|
if (item.response) {
|
||||||
response = JSON.parse(item.response)
|
response = JSON.parse(item.response)
|
||||||
url = response.data.uri
|
url = response.data.url
|
||||||
name = response.data.name
|
name = response.data.name
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
@ -290,8 +290,14 @@
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
form.value.image_arr = EditStore.fileList.map(item => item.url)
|
form.value.image_arr = EditStore.fileList.map(item => {
|
||||||
form.value.image = EditStore.fileList[0].url
|
if (typeof item.url === 'string') {
|
||||||
|
return item.url.replace(import.meta.env.VITE_UPLOAD_IMAGE_URL, '')
|
||||||
|
}
|
||||||
|
return item.url
|
||||||
|
})
|
||||||
|
|
||||||
|
form.value.image = form.value.image_arr[0]
|
||||||
form.value.id = useStore.defaultStore.id
|
form.value.id = useStore.defaultStore.id
|
||||||
|
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
|
|||||||
@ -29,8 +29,8 @@
|
|||||||
<template v-for="(label, labelIndex) in teaRoom.label" :key="labelIndex">
|
<template v-for="(label, labelIndex) in teaRoom.label" :key="labelIndex">
|
||||||
<view class="mr-20rpx flex items-start">
|
<view class="mr-20rpx flex items-start">
|
||||||
<wd-tag
|
<wd-tag
|
||||||
:color="Detail.handleRandomColor(labelIndex)"
|
:color="randomLabelColor(labelIndex)"
|
||||||
:bg-color="Detail.handleRandomColor(labelIndex)"
|
:bg-color="randomLabelColor(labelIndex)"
|
||||||
plain
|
plain
|
||||||
custom-class="!rounded-4rpx"
|
custom-class="!rounded-4rpx"
|
||||||
>{{ label.label_name }}</wd-tag>
|
>{{ label.label_name }}</wd-tag>
|
||||||
@ -55,6 +55,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { getStoreOrderDetails } from '@/api/store'
|
import { getStoreOrderDetails } from '@/api/store'
|
||||||
import PriceFormat from '@/components/PriceFormat.vue'
|
import PriceFormat from '@/components/PriceFormat.vue'
|
||||||
|
import { randomLabelColor } from '@/utils/tools'
|
||||||
|
|
||||||
const swiperList = ref<string[]>([])
|
const swiperList = ref<string[]>([])
|
||||||
const html: string = '<p>这里是富文本内容,需要后台传递</p>'
|
const html: string = '<p>这里是富文本内容,需要后台传递</p>'
|
||||||
@ -63,9 +64,6 @@
|
|||||||
const roomId = ref<number>(0) // 门店ID
|
const roomId = ref<number>(0) // 门店ID
|
||||||
const teaRoom = ref<any>({})
|
const teaRoom = ref<any>({})
|
||||||
|
|
||||||
// 随机颜色列表
|
|
||||||
const tagColors = ['#40AE36', '#F55726']
|
|
||||||
|
|
||||||
onLoad((args) => {
|
onLoad((args) => {
|
||||||
roomId.value = Number(args.id)
|
roomId.value = Number(args.id)
|
||||||
Detail.handleInitReserveRoom()
|
Detail.handleInitReserveRoom()
|
||||||
@ -80,16 +78,6 @@
|
|||||||
console.log("🚀 ~ res:", res)
|
console.log("🚀 ~ res:", res)
|
||||||
teaRoom.value = res.details
|
teaRoom.value = res.details
|
||||||
swiperList.value = teaRoom.value.img_arr
|
swiperList.value = teaRoom.value.img_arr
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据索引返回伪随机颜色
|
|
||||||
* @param index 索引
|
|
||||||
* @returns 颜色值
|
|
||||||
*/
|
|
||||||
handleRandomColor: (index: number) => {
|
|
||||||
// 可根据index做伪随机,保证每次渲染一致
|
|
||||||
return tagColors[index % tagColors.length]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -100,7 +100,7 @@ const alovaInstance = createAlova({
|
|||||||
|
|
||||||
if (config.meta?.toast !== false) {
|
if (config.meta?.toast !== false) {
|
||||||
toast.info(msg)
|
toast.info(msg)
|
||||||
router.switchTab(import.meta.env.VITE_LOGIN_URL, 1000)
|
router.navigateTo(import.meta.env.VITE_LOGIN_URL, 1000)
|
||||||
}
|
}
|
||||||
throw new Error(`登录超时[${code}]:${msg}`)
|
throw new Error(`登录超时[${code}]:${msg}`)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<!-- 使用 type="home" 属性设置首页,其他页面不需要设置,默认为page -->
|
<!-- 使用 type="home" 属性设置首页,其他页面不需要设置,默认为page -->
|
||||||
<route lang="jsonc" type="home">{
|
<route lang="jsonc" type="page">{
|
||||||
"needLogin": true,
|
"needLogin": true,
|
||||||
"layout": "tabbar",
|
"layout": "tabbar",
|
||||||
"style": {
|
"style": {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
<route lang="jsonc" type="page">{
|
<route lang="jsonc" type="home">{
|
||||||
"layout": "default",
|
"layout": "default",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
|
|||||||
@ -521,7 +521,7 @@
|
|||||||
try {
|
try {
|
||||||
const response = JSON.parse(e.file.response)
|
const response = JSON.parse(e.file.response)
|
||||||
if (response.code) {
|
if (response.code) {
|
||||||
const avatarUrl = response.data.uri
|
const avatarUrl = response.data.url
|
||||||
await updateUserInfo({ avatar: avatarUrl })
|
await updateUserInfo({ avatar: avatarUrl })
|
||||||
form.image = avatarUrl
|
form.image = avatarUrl
|
||||||
toast.info('头像上传成功')
|
toast.info('头像上传成功')
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 23 KiB |
@ -135,4 +135,15 @@ export function copy(data: any) {
|
|||||||
toast.info('已复制到剪贴板')
|
toast.info('已复制到剪贴板')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 随机标签颜色
|
||||||
|
* @param index 索引
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function randomLabelColor (index: number) {
|
||||||
|
const tagColors = ['#40AE36', '#F55726']
|
||||||
|
return tagColors[index % tagColors.length]
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user