上传图组修改

parent 3c82be3c
......@@ -26,10 +26,11 @@ const dataList = ref([])
const getList = async () => {
const res = await selectSourceList(2)
dataList.value = res.data
emits('confirm', dataList.value[selectItemIndex.value])
}
getList()
const selectItemIndex = ref(null)
const selectItemIndex = ref(0)
const handleConfirm = () => {
emits('confirm', dataList.value[selectItemIndex.value])
show.value = false
......
......@@ -20,16 +20,17 @@
import { selectSourceList } from '@/api/publish';
const emits = defineEmits(["confirm", "close"])
const emits = defineEmits(["confirm", "close", "init"])
const dataList = ref([])
const getList = async () => {
const res = await selectSourceList(1)
dataList.value = res.data
emits('confirm', dataList.value[selectItemIndex.value])
}
getList()
const selectItemIndex = ref(null)
const selectItemIndex = ref(0)
const handleConfirm = () => {
emits('confirm', dataList.value[selectItemIndex.value])
show.value = false
......@@ -48,9 +49,15 @@ const open = () => {
const close = () => {
show.value = false
}
const init = () => {
console.log('init')
console.log(dataList.value)
// return dataList.value[selectItemIndex.value]
}
defineExpose({
open,
close
close,
init
})
</script>
<style lang="scss" scoped>
......
......@@ -44,9 +44,19 @@
<script setup>
import { areaList } from '@vant/area-data'
import dayjs from 'dayjs'
const props = defineProps({
enclosureLists: String
});
const emits = defineEmits(["confirm"])
const footerRef = ref()
const formData = ref({})
let currentDate = new Date();
const formData = ref({
shoottime: dayjs(currentDate).format('YYYY-MM-DD'),
materialtime: dayjs(currentDate).format('YYYY-MM-DD'),
materialTitle: props.enclosureLists[0].enclosureDesc ?? formData.value.materialTitle,
materialIntro: props.enclosureLists[0].enclosureDesc ?? formData.value.materialIntro,
shootLocation: ''
})
const showArea = ref(false)
const showShoottimeCalendar = ref(false)
const showMaterialtimeCalendar = ref(false)
......@@ -57,6 +67,8 @@ const handlePre = () => {
}
const handleSubmit = () => {
formData.value.shoottime = formData.value.shoottime + ' 00:00:00'
formData.value.materialtime = formData.value.materialtime + ' 00:00:00'
// formData.value.shootLocation = formData.value.area + formData.value.address
emits('confirm', { code: 'submit', catalog: formData.value })
}
......@@ -86,6 +98,38 @@ const handleRegionPicker = () => {
}
});
}
// 获取定位
function getLocationFn() {
uni.getLocation({
type: 'wgs84',
isHighAccuracy: true,
success: function (res) {
// 经纬度
console.log(res);
getLocationDetail(res.latitude, res.longitude)
},
fail: function (err) {
console.log(err)
},
})
}
getLocationFn()
const getLocationDetail = (latitude, longitude) => {
uni.request({
url: '/ws/geocoder/v1/',
data: {
key: 'MN4BZ-7JXKW-2RYRD-32QGF-AHONV-PAFUN',
location: `${latitude},${longitude}`,
},
success: function (res) {
if (res.data.status === 0) {
formData.value.shootLocation = res.data.result.address ?? formData.value.shootLocation
}
}
})
}
</script>
<style lang="scss" scoped>
.container {
......
......@@ -48,7 +48,7 @@ const userStore = useUserStore()
const formData = ref({
createBy: userStore.userinfo?.user?.name,
author: userStore.userinfo?.user?.name,
userId: userStore.userinfo?.user?.id
userId: userStore.userinfo?.user?.id,
})
const handlePre = () => {
......
......@@ -13,7 +13,7 @@
</div>
</div>
<keep-alive>
<component :is="componentName" @confirm="handleConfirm"></component>
<component :is="componentName" @confirm="handleConfirm" :enclosureLists="enclosureLists"></component>
</keep-alive>
</div>
</template>
......
......@@ -64,7 +64,12 @@ export default defineConfig(({ mode }) => {
target: VITE_APP_ENV === 'production' ? 'https://info.gyntv.com.cn/' : 'https://info.gyntv.com.cn/',
changeOrigin: true,
bypass: (req, res, options) => res.setHeader("x-req-proxyUr1", options.target + req.url)
}
},
'/ws/geocoder': {
target: 'https://apis.map.qq.com',
changeOrigin: true,
bypass: (req, res, options) => res.setHeader('x-req-proxyUr1', options.target + req.url),
},
}
},
// build: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment