上传图组修改

parent 3c82be3c
...@@ -26,10 +26,11 @@ const dataList = ref([]) ...@@ -26,10 +26,11 @@ const dataList = ref([])
const getList = async () => { const getList = async () => {
const res = await selectSourceList(2) const res = await selectSourceList(2)
dataList.value = res.data dataList.value = res.data
emits('confirm', dataList.value[selectItemIndex.value])
} }
getList() getList()
const selectItemIndex = ref(null) const selectItemIndex = ref(0)
const handleConfirm = () => { const handleConfirm = () => {
emits('confirm', dataList.value[selectItemIndex.value]) emits('confirm', dataList.value[selectItemIndex.value])
show.value = false show.value = false
......
...@@ -20,16 +20,17 @@ ...@@ -20,16 +20,17 @@
import { selectSourceList } from '@/api/publish'; import { selectSourceList } from '@/api/publish';
const emits = defineEmits(["confirm", "close"]) const emits = defineEmits(["confirm", "close", "init"])
const dataList = ref([]) const dataList = ref([])
const getList = async () => { const getList = async () => {
const res = await selectSourceList(1) const res = await selectSourceList(1)
dataList.value = res.data dataList.value = res.data
emits('confirm', dataList.value[selectItemIndex.value])
} }
getList() getList()
const selectItemIndex = ref(null) const selectItemIndex = ref(0)
const handleConfirm = () => { const handleConfirm = () => {
emits('confirm', dataList.value[selectItemIndex.value]) emits('confirm', dataList.value[selectItemIndex.value])
show.value = false show.value = false
...@@ -48,9 +49,15 @@ const open = () => { ...@@ -48,9 +49,15 @@ const open = () => {
const close = () => { const close = () => {
show.value = false show.value = false
} }
const init = () => {
console.log('init')
console.log(dataList.value)
// return dataList.value[selectItemIndex.value]
}
defineExpose({ defineExpose({
open, open,
close close,
init
}) })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -44,9 +44,19 @@ ...@@ -44,9 +44,19 @@
<script setup> <script setup>
import { areaList } from '@vant/area-data' import { areaList } from '@vant/area-data'
import dayjs from 'dayjs' import dayjs from 'dayjs'
const props = defineProps({
enclosureLists: String
});
const emits = defineEmits(["confirm"]) const emits = defineEmits(["confirm"])
const footerRef = ref() 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 showArea = ref(false)
const showShoottimeCalendar = ref(false) const showShoottimeCalendar = ref(false)
const showMaterialtimeCalendar = ref(false) const showMaterialtimeCalendar = ref(false)
...@@ -57,6 +67,8 @@ const handlePre = () => { ...@@ -57,6 +67,8 @@ const handlePre = () => {
} }
const handleSubmit = () => { 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 // formData.value.shootLocation = formData.value.area + formData.value.address
emits('confirm', { code: 'submit', catalog: formData.value }) emits('confirm', { code: 'submit', catalog: formData.value })
} }
...@@ -86,6 +98,38 @@ const handleRegionPicker = () => { ...@@ -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> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.container { .container {
......
...@@ -48,7 +48,7 @@ const userStore = useUserStore() ...@@ -48,7 +48,7 @@ const userStore = useUserStore()
const formData = ref({ const formData = ref({
createBy: userStore.userinfo?.user?.name, createBy: userStore.userinfo?.user?.name,
author: userStore.userinfo?.user?.name, author: userStore.userinfo?.user?.name,
userId: userStore.userinfo?.user?.id userId: userStore.userinfo?.user?.id,
}) })
const handlePre = () => { const handlePre = () => {
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
</div> </div>
</div> </div>
<keep-alive> <keep-alive>
<component :is="componentName" @confirm="handleConfirm"></component> <component :is="componentName" @confirm="handleConfirm" :enclosureLists="enclosureLists"></component>
</keep-alive> </keep-alive>
</div> </div>
</template> </template>
......
...@@ -64,7 +64,12 @@ export default defineConfig(({ mode }) => { ...@@ -64,7 +64,12 @@ export default defineConfig(({ mode }) => {
target: VITE_APP_ENV === 'production' ? 'https://info.gyntv.com.cn/' : 'https://info.gyntv.com.cn/', target: VITE_APP_ENV === 'production' ? 'https://info.gyntv.com.cn/' : 'https://info.gyntv.com.cn/',
changeOrigin: true, changeOrigin: true,
bypass: (req, res, options) => res.setHeader("x-req-proxyUr1", options.target + req.url) 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: { // 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