提交 1f882180 作者: 方治民

Merge branches 'dev' and 'dev' of https://gitlab.yiring.com/digital-agri/agri-app into dev

...@@ -112,15 +112,15 @@ export default { ...@@ -112,15 +112,15 @@ export default {
if (this.map && this.map.remove) { if (this.map && this.map.remove) {
this.map.remove() this.map.remove()
} }
let style = merge(defaultStyle, options?.style); let style = merge({}, defaultStyle, options?.style);
//是否卫星图显示 //是否卫星图显示
if (options?.style.isImg) { if (options?.style.isImg) {
style.layers.push({ style.layers = [...style.layers, {
id: 'wms-img_w-layer', id: 'wms-img_w-layer',
type: 'raster', type: 'raster',
source: 'wms-img_w-source', source: 'wms-img_w-source',
layout: { visibility: 'visible' }, layout: { visibility: 'visible' },
}) }]
} }
// [107.570282, 19.474339], // [107.570282, 19.474339],
// [115.629717, 34.466859], // [115.629717, 34.466859],
......
...@@ -10,6 +10,10 @@ export interface BasicMapPage { ...@@ -10,6 +10,10 @@ export interface BasicMapPage {
*/ */
init: boolean init: boolean
/** /**
* 地图渲染是否完成初始化(用于区分页面数据初始化和地图 geojson 渲染初始化)
*/
mapInit?: boolean
/**
* 页面正在请求的数据源数量,由于 setGeoJSONSourceForRequest 的异步特性,需要记录当前正在请求的数据源数量,当所有数据源请求完成时,隐藏 Loading * 页面正在请求的数据源数量,由于 setGeoJSONSourceForRequest 的异步特性,需要记录当前正在请求的数据源数量,当所有数据源请求完成时,隐藏 Loading
*/ */
requests?: number requests?: number
......
...@@ -113,10 +113,11 @@ ...@@ -113,10 +113,11 @@
function submit() { function submit() {
formRef.value.validator(pageData.form, pageData.rules, true).then((res) => { formRef.value.validator(pageData.form, pageData.rules, true).then((res) => {
if (res.isPassed) { if (res.isPassed) {
pageData.loading = true
NongchangAPI.saveFarmbase(pageData.form).then(() => { NongchangAPI.saveFarmbase(pageData.form).then(() => {
toastRef.value.show({ type: 'success', text: '保存成功' }) toastRef.value.show({ type: 'success', text: '保存成功' })
setTimeout(() => uni.navigateBack(), 1500) setTimeout(() => uni.navigateBack(), 1500)
}) }).finally(() => pageData.loading = false)
} }
}) })
} }
...@@ -124,20 +125,48 @@ ...@@ -124,20 +125,48 @@
<template> <template>
<view class="page"> <view class="page">
<view class="container"> <view class="form-banner">
<text class="title">{{ isSave ? '新增基地' : '基地详情' }}</text>
<text class="subtitle">{{ isSave ? '录入生产基地信息,完善经营档案' : '查看基地详细信息' }}</text>
</view>
<view class="form-content">
<fui-form ref="formRef"> <fui-form ref="formRef">
<view class="section-card"> <view class="section-card">
<fui-input label="基地名称" placeholder="请输入" v-model="form.baseName" required /> <view class="card-header">
<fui-input disabled required label="所在地区" v-model="form.address" @click="show.address = true" /> <view class="line"></view>
<fui-input label="详细地址" placeholder="请输入" v-model="form.addressDetail" required /> <text>基地基础信息</text>
</view>
<fui-input label="基地名称" placeholder="请输入基地名称" v-model="form.baseName" required label-size="28" />
<fui-form-item required asterisk label="所在地区" labelSize="28" :labelWeight="400" labelWidth="auto">
<view class="picker-input" @click="show.address = true">
<text class="select-text" :class="{ placeholder: !form.address }">
{{ form.address || '请选择所在地区' }}
</text>
<fui-icon name="arrowright" :size="32" color="#ccc"></fui-icon>
</view>
</fui-form-item>
<fui-input label="详细地址" placeholder="请输入详细地址" v-model="form.addressDetail" required label-size="28" />
</view> </view>
<view class="section-card"> <view class="section-card">
<fui-input type="number" label="基地规模" v-model="form.scale" required> <view class="card-header">
<view class="line"></view>
<text>经营规模信息</text>
</view>
<fui-input type="number" label="基地规模" v-model="form.scale" required label-size="28">
<template #suffix><text class="unit"></text></template> <template #suffix><text class="unit"></text></template>
</fui-input> </fui-input>
<fui-input disabled required label="种植作物" v-model="form.growCropsText" @click="show.growCrops = true" /> <fui-form-item required asterisk label="种植作物" labelSize="28" :labelWeight="400" labelWidth="auto">
<view class="picker-input" @click="show.growCrops = true">
<text class="select-text" :class="{ placeholder: !form.growCropsText }">
{{ form.growCropsText || '请选择种植作物' }}
</text>
<fui-icon name="arrowright" :size="32" color="#ccc"></fui-icon>
</view>
</fui-form-item>
</view> </view>
<!-- 更多字段... -->
<view class="submit-area" v-if="isSave"> <view class="submit-area" v-if="isSave">
<fui-button text="确认保存" radius="100rpx" @click="submit" /> <fui-button text="确认保存" radius="100rpx" @click="submit" />
</view> </view>
...@@ -147,14 +176,142 @@ ...@@ -147,14 +176,142 @@
<AreaPicker v-model:show="show.address" :layer="3" title="选择所属地区" @confirm="handleAreaConfirm" /> <AreaPicker v-model:show="show.address" :layer="3" title="选择所属地区" @confirm="handleAreaConfirm" />
<fui-picker :show="show.growCrops" :options="options.growCrops" @change="handleGrowCropsChange" @cancel="show.growCrops = false" /> <fui-picker :show="show.growCrops" :options="options.growCrops" @change="handleGrowCropsChange" @cancel="show.growCrops = false" />
<fui-toast ref="toastRef" /> <fui-toast ref="toastRef" />
<fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)" />
</view> </view>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.page { background-color: #f7f8fa; min-height: 100vh; font-family: 'DingTalk Sans', sans-serif; } .page {
.container { padding: 24rpx; } min-height: 100vh;
.section-card { background: #fff; border-radius: 24rpx; padding: 10rpx 24rpx; margin-bottom: 24rpx; } background-color: #f4f7f5;
.submit-area { padding: 40rpx 20rpx; } font-family: 'DingTalk Sans', sans-serif;
.unit { font-size: 26rpx; color: #999; margin-left: 12rpx; } }
:deep(.fui-input__label) { font-family: 'DingTalk Sans' !important; }
.form-banner {
background-color: #5db66f;
padding: 60rpx 40rpx 100rpx;
color: #fff;
.title {
font-size: 48rpx;
font-weight: bold;
display: block;
letter-spacing: 2rpx;
}
.subtitle {
font-size: 26rpx;
opacity: 0.9;
margin-top: 12rpx;
display: block;
}
}
.form-content {
padding: 24rpx;
margin-top: -80rpx;
position: relative;
z-index: 10;
}
.section-card {
background-color: #fff;
border-radius: 28rpx;
padding: 32rpx;
margin-bottom: 28rpx;
box-shadow: 0 8rpx 20rpx rgba(0, 0, 0, 0.03);
.card-header {
margin-bottom: 32rpx;
display: flex;
align-items: center;
.line {
width: 8rpx;
height: 32rpx;
background-color: #5db66f;
border-radius: 4rpx;
margin-right: 16rpx;
}
text {
font-size: 32rpx;
font-weight: bold;
color: #1a1a1a;
}
}
}
.picker-input {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 20rpx;
width: 100%;
}
.select-text {
font-size: 28rpx;
color: #333333;
flex: 1;
&.placeholder {
color: #999999;
}
}
.unit {
font-size: 26rpx;
color: #999;
margin-left: 12rpx;
}
.submit-area {
padding: 60rpx 20rpx 100rpx;
:deep(.fui-button) {
background: #5db66f !important;
border-color: #5db66f !important;
box-shadow: 0 8rpx 24rpx rgba(93, 182, 111, 0.3);
}
}
:deep(.fui-form) {
background: transparent;
}
:deep(.fui-form__item) {
background: transparent;
border: none;
margin-bottom: 0;
padding: 0;
}
:deep(.fui-input__wrap) {
padding: 28rpx 0;
}
:deep(.fui-input__label) {
font-size: 28rpx;
color: #333333;
font-weight: 400;
font-family: 'DingTalk Sans', system-ui !important;
}
:deep(.fui-input__self) {
font-size: 28rpx;
color: #333333;
font-family: 'DingTalk Sans', system-ui !important;
}
:deep(.fui-input__placeholder) {
color: #d0d0d0;
font-size: 28rpx;
font-family: 'DingTalk Sans' !important;
}
::v-deep .uni-input-placeholder {
font-size: 28rpx !important;
color: #999999 !important;
font-family: 'DingTalk Sans' !important;
}
:deep(.fui-button) {
font-family: 'DingTalk Sans' !important;
font-weight: bold !important;
}
</style> </style>
\ No newline at end of file
<script setup lang="ts"> <script setup lang="ts">
import { reactive } from 'vue' import { reactive, getCurrentInstance } from 'vue'
import { onShow } from '@dcloudio/uni-app' import { onShow } from '@dcloudio/uni-app'
const instance = getCurrentInstance()
// import WeatherForecast from './components/WeatherForecast.vue' // import WeatherForecast from './components/WeatherForecast.vue'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import Navigate from '@/utils/page/navigate' import Navigate from '@/utils/page/navigate'
...@@ -454,7 +456,7 @@ ...@@ -454,7 +456,7 @@
pageData.agricultureClass.videoList.forEach((_, index) => { pageData.agricultureClass.videoList.forEach((_, index) => {
if (index !== currentIndex) { if (index !== currentIndex) {
try { try {
const videoContext = uni.createVideoContext(`video${index}`) const videoContext = uni.createVideoContext(`video${index}`, instance.proxy)
videoContext.pause() videoContext.pause()
} catch (error) { } catch (error) {
console.log('停止视频失败:', error) console.log('停止视频失败:', error)
...@@ -469,7 +471,7 @@ ...@@ -469,7 +471,7 @@
} }
function playVideo(index) { function playVideo(index) {
const videoContext = uni.createVideoContext(`video${index}`) const videoContext = uni.createVideoContext(`video${index}`, instance.proxy)
videoContext.requestFullScreen({ direction: 0 }) videoContext.requestFullScreen({ direction: 0 })
videoContext.play() videoContext.play()
} }
...@@ -477,7 +479,7 @@ ...@@ -477,7 +479,7 @@
function handleFullscreenChange(e: any, index) { function handleFullscreenChange(e: any, index) {
console.log(`视频${index}全屏状态改变`) console.log(`视频${index}全屏状态改变`)
if (!e.detail.fullScreen) { if (!e.detail.fullScreen) {
const videoContext = uni.createVideoContext(`video${index}`) const videoContext = uni.createVideoContext(`video${index}`, instance.proxy)
videoContext.pause() videoContext.pause()
} }
} }
...@@ -494,12 +496,10 @@ ...@@ -494,12 +496,10 @@
} }
onHide(() => { onHide(() => {
// 停止所有其他视频的播放(只暂停,不重置位置)
pageData.agricultureClass.videoList.forEach((_, index) => { pageData.agricultureClass.videoList.forEach((_, index) => {
try { try {
const videoContext = uni.createVideoContext(`video${index}`) const videoContext = uni.createVideoContext(`video${index}`, instance.proxy)
videoContext.pause() videoContext.pause()
// 不重置到开头,保留播放位置
} catch (error) { } catch (error) {
console.log('停止视频失败:', error) console.log('停止视频失败:', error)
} }
......
...@@ -15,6 +15,7 @@ import { useUserStore } from '@/store/modules/user' ...@@ -15,6 +15,7 @@ import { useUserStore } from '@/store/modules/user'
const userStore = useUserStore() const userStore = useUserStore()
const dictStore = useDictStore() const dictStore = useDictStore()
const instance = getCurrentInstance()
const model = reactive({ const model = reactive({
// 湖南省人民政府 // 湖南省人民政府
location: '112.982931,28.116698', location: '112.982931,28.116698',
...@@ -452,7 +453,7 @@ function handleVideoPause(currentIndex) { ...@@ -452,7 +453,7 @@ function handleVideoPause(currentIndex) {
function handleFullscreenChange(e: any, index) { function handleFullscreenChange(e: any, index) {
console.log(`视频${index}全屏状态改变`) console.log(`视频${index}全屏状态改变`)
if (!e.detail.fullScreen) { if (!e.detail.fullScreen) {
const videoContext = uni.createVideoContext(`video${index}`) const videoContext = uni.createVideoContext(`video${index}`, instance.proxy)
videoContext.pause() videoContext.pause()
} }
} }
...@@ -473,14 +474,14 @@ function handleMetadataLoaded(e: any,video:any) { ...@@ -473,14 +474,14 @@ function handleMetadataLoaded(e: any,video:any) {
function handleVideoPlay(currentIndex) { function handleVideoPlay(currentIndex) {
pageData.agricultureClass.videoList.forEach((_, index) => { pageData.agricultureClass.videoList.forEach((_, index) => {
if (index !== currentIndex) { if (index !== currentIndex) {
const videoContext = uni.createVideoContext(`video${index}`) const videoContext = uni.createVideoContext(`video${index}`, instance.proxy)
videoContext.pause() videoContext.pause()
} }
}) })
} }
function playVideo(index) { function playVideo(index) {
const videoContext = uni.createVideoContext(`video${index}`) const videoContext = uni.createVideoContext(`video${index}`, instance.proxy)
videoContext.requestFullScreen({ direction: 0 }) videoContext.requestFullScreen({ direction: 0 })
videoContext.play() videoContext.play()
} }
...@@ -508,21 +509,16 @@ function toNewsDetail(item) { ...@@ -508,21 +509,16 @@ function toNewsDetail(item) {
} }
onHide(() => { onHide(() => {
// 停止所有其他视频的播放(只暂停,不重置位置)
pageData.agricultureClass.videoList.forEach((_, index) => { pageData.agricultureClass.videoList.forEach((_, index) => {
try { try {
const videoContext = uni.createVideoContext(`video${index}`) const videoContext = uni.createVideoContext(`video${index}`, instance.proxy)
videoContext.pause() videoContext.pause()
// 不重置到开头,保留播放位置
} catch (error) { } catch (error) {
console.log('停止视频失败:', error) console.log('停止视频失败:', error)
} }
}) })
}) })
// 引入实例
const instance = getCurrentInstance();
const getDomDataSetFunc = (domName='',datasetName='index') =>{ const getDomDataSetFunc = (domName='',datasetName='index') =>{
return new Promise((resolve,reject)=>{ return new Promise((resolve,reject)=>{
const queryDataget = uni.createSelectorQuery().in(instance.proxy); const queryDataget = uni.createSelectorQuery().in(instance.proxy);
...@@ -717,9 +713,9 @@ export default { ...@@ -717,9 +713,9 @@ export default {
</view> </view>
<view class="codefun-flex-row section_5"> <view class="codefun-flex-row section_5">
<view v-show="item.status" v-for="item in pageData.serviceItems" :key="item.id" <view v-show="item.status" v-for="item in pageData.serviceItems" :key="item.id"
class="codefun-flex-col codefun-items-center group_10 mt-5" @click="onMenuItemClick(item)"> class="codefun-flex-col codefun-items-center group_10" @click="onMenuItemClick(item)">
<image class="image_11" :src="item.icon_url" /> <image class="image_11" :src="item.icon_url" />
<text class="font_2 mt-11">{{ item.name }}</text> <text class="font_2 mt-3">{{ item.name }}</text>
</view> </view>
</view> </view>
<swiper :autoplay="true" :interval="5000" :duration="500" :circular="true" :vertical="true" <swiper :autoplay="true" :interval="5000" :duration="500" :circular="true" :vertical="true"
...@@ -1164,7 +1160,8 @@ export default { ...@@ -1164,7 +1160,8 @@ export default {
} }
.group_10 { .group_10 {
margin-bottom: 15rpx; margin-top: 5rpx;
margin-bottom: 18rpx;
flex: 1 1 173.5rpx; flex: 1 1 173.5rpx;
.text_50 { .text_50 {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论