提交 0fb18627 作者: 廖在望

feat: 功能修改

上级 083562c2
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -25,6 +25,6 @@ export function getQueryByType(params = {}) { ...@@ -25,6 +25,6 @@ export function getQueryByType(params = {}) {
params, params,
headers: { headers: {
'Content-Type': 'application/x-www-form-urlencoded', 'Content-Type': 'application/x-www-form-urlencoded',
} },
}) })
} }
...@@ -10,7 +10,6 @@ enum Api { ...@@ -10,7 +10,6 @@ enum Api {
postConsultRecordAdd = '/server/consultRecord/add', // 添加咨询信息 postConsultRecordAdd = '/server/consultRecord/add', // 添加咨询信息
getNewsList = '/news/list', // 分页列表查询 getNewsList = '/news/list', // 分页列表查询
} }
/** /**
...@@ -20,7 +19,7 @@ enum Api { ...@@ -20,7 +19,7 @@ enum Api {
export function postConsultRecordAdd(params = {}) { export function postConsultRecordAdd(params = {}) {
return otherHttp.post({ return otherHttp.post({
url: Api.postConsultRecordAdd, url: Api.postConsultRecordAdd,
params params,
}) })
} }
......
...@@ -29,7 +29,7 @@ export function addViewCount(params) { ...@@ -29,7 +29,7 @@ export function addViewCount(params) {
url: Api.viewCount, url: Api.viewCount,
params, params,
headers: { headers: {
'Content-Type': 'application/x-www-form-urlencoded' 'Content-Type': 'application/x-www-form-urlencoded',
} },
}) })
} }
...@@ -27,7 +27,7 @@ export function getLaborAppDel(params = {}) { ...@@ -27,7 +27,7 @@ export function getLaborAppDel(params = {}) {
params, params,
headers: { headers: {
'Content-Type': 'application/x-www-form-urlencoded', 'Content-Type': 'application/x-www-form-urlencoded',
} },
}) })
} }
......
...@@ -29,7 +29,7 @@ export function addViewCount(params) { ...@@ -29,7 +29,7 @@ export function addViewCount(params) {
url: Api.viewCount, url: Api.viewCount,
params, params,
headers: { headers: {
'Content-Type': 'application/x-www-form-urlencoded' 'Content-Type': 'application/x-www-form-urlencoded',
} },
}) })
} }
...@@ -11,7 +11,6 @@ enum Api { ...@@ -11,7 +11,6 @@ enum Api {
postMachineryAdd = '/server/machinery/add', // 农机商品管理-添加 postMachineryAdd = '/server/machinery/add', // 农机商品管理-添加
postMachineryQueryById = '/server/machinery/listByEnterpriseId', // 按企业ID查询未删除农机 postMachineryQueryById = '/server/machinery/listByEnterpriseId', // 按企业ID查询未删除农机
} }
/** /**
* @param params 请求参数 * @param params 请求参数
......
...@@ -4,7 +4,7 @@ enum Api { ...@@ -4,7 +4,7 @@ enum Api {
goodsList = '/trade/goods/list', // 农资列表 goodsList = '/trade/goods/list', // 农资列表
getEnterpriseList = '/server/enterprise/list', // 可信农资列表 getEnterpriseList = '/server/enterprise/list', // 可信农资列表
postEnterpriseAdd = '/server/enterprise/add', // 入驻申请 postEnterpriseAdd = '/server/enterprise/add', // 入驻申请
getEnterpriseDetail= '/server/enterprise/detail', // 企业详情 getEnterpriseDetail = '/server/enterprise/detail', // 企业详情
postGoodsAdd = '/trade/goods/add', // 农资商品管理-添加 postGoodsAdd = '/trade/goods/add', // 农资商品管理-添加
getGoodsQueryById = '/trade/goods/listByEnterpriseId', // 农资商品管理-通过id查询 getGoodsQueryById = '/trade/goods/listByEnterpriseId', // 农资商品管理-通过id查询
} }
......
...@@ -17,12 +17,15 @@ enum Api { ...@@ -17,12 +17,15 @@ enum Api {
* @description: 查询登录用户信息 * @description: 查询登录用户信息
*/ */
export function getUserInfo(params = {}) { export function getUserInfo(params = {}) {
return otherHttp.get({ return otherHttp.get(
{
url: Api.getUserInfo, url: Api.getUserInfo,
data: params, data: params,
}, { },
errorMessageMode: null {
}) errorMessageMode: null,
},
)
} }
/** /**
...@@ -43,7 +46,7 @@ export function sysLogin(params = {}) { ...@@ -43,7 +46,7 @@ export function sysLogin(params = {}) {
export function phoneLogin(params = {}) { export function phoneLogin(params = {}) {
return otherHttp.post({ return otherHttp.post({
url: Api.phoneLogin, url: Api.phoneLogin,
data: params data: params,
}) })
} }
...@@ -54,7 +57,7 @@ export function phoneLogin(params = {}) { ...@@ -54,7 +57,7 @@ export function phoneLogin(params = {}) {
export function sysSms(params = {}) { export function sysSms(params = {}) {
return otherHttp.post({ return otherHttp.post({
url: Api.sms, url: Api.sms,
data: params data: params,
}) })
} }
......
<script setup lang="ts">
interface Props {
show?: boolean
title?: string
content?: string
cancelText?: string
confirmText?: string
}
const props = withDefaults(defineProps<Props>(), {
show: false,
title: '提示',
content: '',
cancelText: '取消',
confirmText: '确认',
})
const emit = defineEmits<{
(e: 'update:show', value: boolean): void
(e: 'cancel'): void
(e: 'confirm'): void
}>()
function handleCancel() {
emit('update:show', false)
emit('cancel')
}
function handleConfirm() {
emit('update:show', false)
emit('confirm')
}
</script>
<template> <template>
<view v-if="show" class="confirm-dialog-overlay" @click="handleCancel"> <view v-if="show" class="confirm-dialog-overlay" @click="handleCancel">
<view class="confirm-dialog-container" @click.stop> <view class="confirm-dialog-container" @click.stop>
...@@ -25,42 +59,8 @@ ...@@ -25,42 +59,8 @@
</view> </view>
</template> </template>
<script setup lang="ts">
interface Props {
show?: boolean
title?: string
content?: string
cancelText?: string
confirmText?: string
}
const props = withDefaults(defineProps<Props>(), {
show: false,
title: '提示',
content: '',
cancelText: '取消',
confirmText: '确认',
})
const emit = defineEmits<{
(e: 'update:show', value: boolean): void
(e: 'cancel'): void
(e: 'confirm'): void
}>()
function handleCancel() {
emit('update:show', false)
emit('cancel')
}
function handleConfirm() {
emit('update:show', false)
emit('confirm')
}
</script>
<style lang="scss" scoped> <style lang="scss" scoped>
.confirm-dialog-overlay { .confirm-dialog-overlay {
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
...@@ -71,18 +71,18 @@ function handleConfirm() { ...@@ -71,18 +71,18 @@ function handleConfirm() {
align-items: center; align-items: center;
justify-content: center; justify-content: center;
z-index: 99999; z-index: 99999;
} }
.confirm-dialog-container { .confirm-dialog-container {
position: relative; position: relative;
width: 600rpx; width: 600rpx;
background: linear-gradient(180deg, #E8F5E9 0%, #FFFFFF 30%); background: linear-gradient(180deg, #e8f5e9 0%, #ffffff 30%);
border-radius: 32rpx; border-radius: 32rpx;
padding: 60rpx 48rpx 48rpx; padding: 60rpx 48rpx 48rpx;
box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.1); box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.1);
} }
.close-btn { .close-btn {
position: absolute; position: absolute;
top: 24rpx; top: 24rpx;
right: 24rpx; right: 24rpx;
...@@ -92,37 +92,37 @@ function handleConfirm() { ...@@ -92,37 +92,37 @@ function handleConfirm() {
align-items: center; align-items: center;
justify-content: center; justify-content: center;
cursor: pointer; cursor: pointer;
} }
.close-icon { .close-icon {
font-size: 36rpx; font-size: 36rpx;
color: #999999; color: #999999;
font-weight: 300; font-weight: 300;
} }
.dialog-title { .dialog-title {
font-size: 36rpx; font-size: 36rpx;
font-weight: 600; font-weight: 600;
color: #333333; color: #333333;
text-align: center; text-align: center;
margin-bottom: 32rpx; margin-bottom: 32rpx;
} }
.dialog-content { .dialog-content {
font-size: 28rpx; font-size: 28rpx;
color: #666666; color: #666666;
text-align: center; text-align: center;
line-height: 40rpx; line-height: 40rpx;
margin-bottom: 48rpx; margin-bottom: 48rpx;
} }
.dialog-buttons { .dialog-buttons {
display: flex; display: flex;
gap: 24rpx; gap: 24rpx;
} }
.cancel-btn, .cancel-btn,
.confirm-btn { .confirm-btn {
flex: 1; flex: 1;
height: 80rpx; height: 80rpx;
border-radius: 40rpx; border-radius: 40rpx;
...@@ -130,36 +130,36 @@ function handleConfirm() { ...@@ -130,36 +130,36 @@ function handleConfirm() {
align-items: center; align-items: center;
justify-content: center; justify-content: center;
cursor: pointer; cursor: pointer;
} }
.cancel-btn { .cancel-btn {
background-color: #FFFFFF; background-color: #ffffff;
border: 2rpx solid #5DB66F; border: 2rpx solid #5db66f;
} }
.cancel-text { .cancel-text {
font-size: 28rpx; font-size: 28rpx;
color: #5DB66F; color: #5db66f;
font-weight: 500; font-weight: 500;
} }
.confirm-btn { .confirm-btn {
background: linear-gradient(135deg, #5DB66F 0%, #4CAF50 100%); background: linear-gradient(135deg, #5db66f 0%, #4caf50 100%);
box-shadow: 0 4rpx 12rpx rgba(93, 182, 111, 0.3); box-shadow: 0 4rpx 12rpx rgba(93, 182, 111, 0.3);
} }
.confirm-text { .confirm-text {
font-size: 28rpx; font-size: 28rpx;
color: #FFFFFF; color: #ffffff;
font-weight: 500; font-weight: 500;
} }
.cancel-btn:active { .cancel-btn:active {
opacity: 0.8; opacity: 0.8;
} }
.confirm-btn:active { .confirm-btn:active {
opacity: 0.9; opacity: 0.9;
transform: scale(0.98); transform: scale(0.98);
} }
</style> </style>
<script setup lang="ts">
interface Props {
show?: boolean
title?: string
content?: string
cancelText?: string
confirmText?: string
}
const props = withDefaults(defineProps<Props>(), {
show: false,
title: '提示',
content: '',
cancelText: '取消',
confirmText: '确认',
})
const emit = defineEmits<{
(e: 'update:show', value: boolean): void
(e: 'cancel'): void
(e: 'confirm'): void
}>()
function handleCancel() {
emit('update:show', false)
emit('cancel')
}
function handleConfirm() {
emit('confirm')
}
</script>
<template> <template>
<view v-if="show" class="confirm-dialog-overlay" @click="handleCancel"> <view v-if="show" class="confirm-dialog-overlay" @click="handleCancel">
<view class="confirm-dialog-container" @click.stop> <view class="confirm-dialog-container" @click.stop>
...@@ -24,41 +57,8 @@ ...@@ -24,41 +57,8 @@
</view> </view>
</template> </template>
<script setup lang="ts">
interface Props {
show?: boolean
title?: string
content?: string
cancelText?: string
confirmText?: string
}
const props = withDefaults(defineProps<Props>(), {
show: false,
title: '提示',
content: '',
cancelText: '取消',
confirmText: '确认',
})
const emit = defineEmits<{
(e: 'update:show', value: boolean): void
(e: 'cancel'): void
(e: 'confirm'): void
}>()
function handleCancel() {
emit('update:show', false)
emit('cancel')
}
function handleConfirm() {
emit('confirm')
}
</script>
<style lang="scss" scoped> <style lang="scss" scoped>
.confirm-dialog-overlay { .confirm-dialog-overlay {
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
...@@ -69,18 +69,18 @@ function handleConfirm() { ...@@ -69,18 +69,18 @@ function handleConfirm() {
align-items: center; align-items: center;
justify-content: center; justify-content: center;
z-index: 9999; z-index: 9999;
} }
.confirm-dialog-container { .confirm-dialog-container {
position: relative; position: relative;
width: 600rpx; width: 600rpx;
background: #FFFFFF; background: #ffffff;
border-radius: 32rpx; border-radius: 32rpx;
box-sizing: border-box; box-sizing: border-box;
box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.1); box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.1);
padding-bottom: 28rpx; padding-bottom: 28rpx;
} }
.confirm-dialog-content{ .confirm-dialog-content {
width: 600rpx; width: 600rpx;
height: 240rpx; height: 240rpx;
border-radius: 32rpx; border-radius: 32rpx;
...@@ -89,14 +89,14 @@ function handleConfirm() { ...@@ -89,14 +89,14 @@ function handleConfirm() {
position: relative; position: relative;
display: flex; display: flex;
justify-content: center; justify-content: center;
.apply_success_icon{ .apply_success_icon {
width: 240rpx; width: 240rpx;
height: 162rpx; height: 162rpx;
margin-top: 54rpx; margin-top: 54rpx;
} }
} }
.close-btn { .close-btn {
position: absolute; position: absolute;
top: 24rpx; top: 24rpx;
right: 24rpx; right: 24rpx;
...@@ -106,40 +106,40 @@ function handleConfirm() { ...@@ -106,40 +106,40 @@ function handleConfirm() {
align-items: center; align-items: center;
justify-content: center; justify-content: center;
cursor: pointer; cursor: pointer;
} }
.close-icon { .close-icon {
font-size: 36rpx; font-size: 36rpx;
color: #999999; color: #999999;
font-weight: 300; font-weight: 300;
} }
.dialog-title { .dialog-title {
margin-top: -32rpx; margin-top: -32rpx;
font-size: 36rpx; font-size: 36rpx;
font-weight: 600; font-weight: 600;
color: #333333; color: #333333;
text-align: center; text-align: center;
margin-bottom: 32rpx; margin-bottom: 32rpx;
} }
.dialog-content { .dialog-content {
font-size: 28rpx; font-size: 28rpx;
color: #666666; color: #666666;
text-align: center; text-align: center;
line-height: 40rpx; line-height: 40rpx;
margin-bottom: 48rpx; margin-bottom: 48rpx;
} }
.dialog-buttons { .dialog-buttons {
display: flex; display: flex;
gap: 24rpx; gap: 24rpx;
padding-left: 30rpx; padding-left: 30rpx;
padding-right: 30rpx; padding-right: 30rpx;
} }
.cancel-btn, .cancel-btn,
.confirm-btn { .confirm-btn {
flex: 1; flex: 1;
height: 80rpx; height: 80rpx;
border-radius: 40rpx; border-radius: 40rpx;
...@@ -147,36 +147,36 @@ function handleConfirm() { ...@@ -147,36 +147,36 @@ function handleConfirm() {
align-items: center; align-items: center;
justify-content: center; justify-content: center;
cursor: pointer; cursor: pointer;
} }
.cancel-btn { .cancel-btn {
background-color: #FFFFFF; background-color: #ffffff;
border: 2rpx solid #5DB66F; border: 2rpx solid #5db66f;
} }
.cancel-text { .cancel-text {
font-size: 28rpx; font-size: 28rpx;
color: #5DB66F; color: #5db66f;
font-weight: 500; font-weight: 500;
} }
.confirm-btn { .confirm-btn {
background: linear-gradient(135deg, #5DB66F 0%, #4CAF50 100%); background: linear-gradient(135deg, #5db66f 0%, #4caf50 100%);
box-shadow: 0 4rpx 12rpx rgba(93, 182, 111, 0.3); box-shadow: 0 4rpx 12rpx rgba(93, 182, 111, 0.3);
} }
.confirm-text { .confirm-text {
font-size: 28rpx; font-size: 28rpx;
color: #FFFFFF; color: #ffffff;
font-weight: 500; font-weight: 500;
} }
.cancel-btn:active { .cancel-btn:active {
opacity: 0.8; opacity: 0.8;
} }
.confirm-btn:active { .confirm-btn:active {
opacity: 0.9; opacity: 0.9;
transform: scale(0.98); transform: scale(0.98);
} }
</style> </style>
<template>
<iframe :onload="onloadCode" style="width: 100%; height: 100%; border: 1px solid #fff; background: #000"></iframe>
</template>
<script> <script>
export default { export default {
props: { props: {
...@@ -16,4 +13,9 @@ ...@@ -16,4 +13,9 @@
}, },
} }
</script> </script>
<template>
<iframe :onload="onloadCode" style="width: 100%; height: 100%; border: 1px solid #fff; background: #000"></iframe>
</template>
<style lang="scss"></style> <style lang="scss"></style>
...@@ -80,8 +80,14 @@ export function useMapbox<T extends MapboxInstance, P extends MapboxConfig>( ...@@ -80,8 +80,14 @@ export function useMapbox<T extends MapboxInstance, P extends MapboxConfig>(
getInstance()?.setLayoutProperty(layerId, name, value), getInstance()?.setLayoutProperty(layerId, name, value),
setFilter: (layerId: string, filter: any[]) => getInstance()?.setFilter(layerId, filter), setFilter: (layerId: string, filter: any[]) => getInstance()?.setFilter(layerId, filter),
flyTo: (options: mapboxgl.FlyToOptions) => getInstance()?.flyTo(options), flyTo: (options: mapboxgl.FlyToOptions) => getInstance()?.flyTo(options),
addMarker: (id: string, lnglat: [number, number], popup?: string, popupDefaultOpen?: boolean, imageUrl?: string, iconSize?: [number, number]) => addMarker: (
getInstance()?.addMarker(id, lnglat, popup, popupDefaultOpen, imageUrl, iconSize), id: string,
lnglat: [number, number],
popup?: string,
popupDefaultOpen?: boolean,
imageUrl?: string,
iconSize?: [number, number],
) => getInstance()?.addMarker(id, lnglat, popup, popupDefaultOpen, imageUrl, iconSize),
removeMarker: (id: string) => getInstance()?.removeMarker(id), removeMarker: (id: string) => getInstance()?.removeMarker(id),
removePopup: () => getInstance()?.removePopup(), removePopup: () => getInstance()?.removePopup(),
loadImage: (url: string, callback: (error: Error | null, image: HTMLImageElement) => void) => loadImage: (url: string, callback: (error: Error | null, image: HTMLImageElement) => void) =>
......
...@@ -16,7 +16,7 @@ export const tk = 'aa0ccd36f2dbb86dbb16cbf63f0034a6' ...@@ -16,7 +16,7 @@ export const tk = 'aa0ccd36f2dbb86dbb16cbf63f0034a6'
const host = 'https://foxgis.app.yiring.com' const host = 'https://foxgis.app.yiring.com'
// 构建天地图图层地址 // 构建天地图图层地址
export function buildTdtTileUrl(id: string,layer:string) { export function buildTdtTileUrl(id: string, layer: string) {
return `http://t0.tianditu.gov.cn/${id}/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=${layer}&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${tk}` return `http://t0.tianditu.gov.cn/${id}/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=${layer}&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${tk}`
return `${host}/api/tdt/cache/${id}/{z}/{y}/{x}/${tk}?v=2022` return `${host}/api/tdt/cache/${id}/{z}/{y}/{x}/${tk}?v=2022`
} }
...@@ -41,13 +41,13 @@ export const defaultStyle: mapboxgl.Style = { ...@@ -41,13 +41,13 @@ export const defaultStyle: mapboxgl.Style = {
sources: { sources: {
'wms-vec_w-source': { 'wms-vec_w-source': {
type: 'raster', type: 'raster',
tiles: [buildTdtTileUrl('vec_w','vec')], tiles: [buildTdtTileUrl('vec_w', 'vec')],
tileSize: 256, tileSize: 256,
maxzoom: 18, maxzoom: 18,
}, },
'wms-cva_w-source': { 'wms-cva_w-source': {
type: 'raster', type: 'raster',
tiles: [buildTdtTileUrl('cva_w','cva')], tiles: [buildTdtTileUrl('cva_w', 'cva')],
tileSize: 256, tileSize: 256,
maxzoom: 18, maxzoom: 18,
}, },
...@@ -59,7 +59,7 @@ export const defaultStyle: mapboxgl.Style = { ...@@ -59,7 +59,7 @@ export const defaultStyle: mapboxgl.Style = {
// }, // },
'wms-img_w-source': { 'wms-img_w-source': {
type: 'raster', type: 'raster',
tiles: [buildTdtTileUrl('img_w','img')], tiles: [buildTdtTileUrl('img_w', 'img')],
tileSize: 256, tileSize: 256,
maxzoom: 18, maxzoom: 18,
}, },
...@@ -850,7 +850,14 @@ export interface MapboxInstance { ...@@ -850,7 +850,14 @@ export interface MapboxInstance {
* @param iconSize 图标大小 [width, height] * @param iconSize 图标大小 [width, height]
* @link https://docs.mapbox.com/mapbox-gl-js/api/markers/#marker * @link https://docs.mapbox.com/mapbox-gl-js/api/markers/#marker
*/ */
addMarker(id: string, lngLat: number[], popup?: string, popupDefaultOpen?: boolean, imageUrl?: string, iconSize?: [number, number]): void addMarker(
id: string,
lngLat: number[],
popup?: string,
popupDefaultOpen?: boolean,
imageUrl?: string,
iconSize?: [number, number],
): void
/** /**
* 移除 Marker * 移除 Marker
* @param id Marker ID * @param id Marker ID
...@@ -986,7 +993,8 @@ export const HandlerUtil = { ...@@ -986,7 +993,8 @@ export const HandlerUtil = {
popup: HandlerUtil.createDefaultPopupHtml( popup: HandlerUtil.createDefaultPopupHtml(
station, station,
{ {
'{key}': `${(additional?.valueName ? station[additional.valueName] : station.value) || '-' '{key}': `${
(additional?.valueName ? station[additional.valueName] : station.value) || '-'
}{suffix}`, }{suffix}`,
...map, ...map,
}, },
...@@ -1008,7 +1016,8 @@ export const HandlerUtil = { ...@@ -1008,7 +1016,8 @@ export const HandlerUtil = {
if (isPlainObject(station) && isStation) { if (isPlainObject(station) && isStation) {
htmls.push( htmls.push(
`<div class="popup-row"><span class="popup-title">地点:</span>${station.city || ''} ${station.cnty || '' `<div class="popup-row"><span class="popup-title">地点:</span>${station.city || ''} ${
station.cnty || ''
} ${station.town || ''}</div>`, } ${station.town || ''}</div>`,
) )
htmls.push(`<div class="popup-row"><span class="popup-title">发生时间:</span>${station.occurTime}</div>`) htmls.push(`<div class="popup-row"><span class="popup-title">发生时间:</span>${station.occurTime}</div>`)
...@@ -1024,7 +1033,8 @@ export const HandlerUtil = { ...@@ -1024,7 +1033,8 @@ export const HandlerUtil = {
for (const key in map) { for (const key in map) {
const len = String(key === '{key}' ? station.key : key).length const len = String(key === '{key}' ? station.key : key).length
htmls.push( htmls.push(
`<div class="popup-row"><span class="popup-title" style="min-width: ${len + 1}em">${key}: </span>${wrap ? '</br>' : '' `<div class="popup-row"><span class="popup-title" style="min-width: ${len + 1}em">${key}: </span>${
wrap ? '</br>' : ''
} ${map[key] || '-'}</div>`, } ${map[key] || '-'}</div>`,
) )
} }
...@@ -1039,7 +1049,8 @@ export const HandlerUtil = { ...@@ -1039,7 +1049,8 @@ export const HandlerUtil = {
if (isPlainObject(station) && isStation) { if (isPlainObject(station) && isStation) {
htmls.push(`<div class="popup-row"><span class="popup-title">站号:</span>${station.stationCode}</div>`) htmls.push(`<div class="popup-row"><span class="popup-title">站号:</span>${station.stationCode}</div>`)
htmls.push( htmls.push(
`<div class="popup-row"><span class="popup-title">站名:</span>${station.city || ''} ${station.cnty || '' `<div class="popup-row"><span class="popup-title">站名:</span>${station.city || ''} ${
station.cnty || ''
} ${station.stationName || ''}</div>`, } ${station.stationName || ''}</div>`,
) )
} }
...@@ -1068,7 +1079,8 @@ export const HandlerUtil = { ...@@ -1068,7 +1079,8 @@ export const HandlerUtil = {
const len = String(key === '{key}' ? station.key : key).length const len = String(key === '{key}' ? station.key : key).length
if (key !== '{key}') { if (key !== '{key}') {
htmls.push( htmls.push(
`<div class="popup-row"><span class="popup-title" style="min-width: ${len + 1}em">${key} </span>${wrap ? '</br>' : '' `<div class="popup-row"><span class="popup-title" style="min-width: ${len + 1}em">${key} </span>${
wrap ? '</br>' : ''
} ${map[key] || '-'}</div>`, } ${map[key] || '-'}</div>`,
) )
} }
......
<template>
</template>
<script> <script>
export default { export default {}
}
</script> </script>
<style> <template></template>
</style> <style></style>
<script setup lang="ts"> <script setup lang="ts">
import successfulDialog from '@/components/ConfirmDialog/successfulDialog.vue'; import successfulDialog from '@/components/ConfirmDialog/successfulDialog.vue'
import { getCurrentDateTime } from '@/utils/date' import { getCurrentDateTime } from '@/utils/date'
import * as HomeAPI from '@/api/model/home' import * as HomeAPI from '@/api/model/home'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
const userStore = useUserStore();
const userStore = useUserStore()
const consultRecord = reactive({ const consultRecord = reactive({
id: "", id: '',
mobile: '',// 咨询人号码 mobile: '', // 咨询人号码
consultTime:"" ,// 咨询时间 consultTime: '', // 咨询时间
bizType:5, // 业务类型(1代理记账,2农资,3农机,4金融) bizType: 5, // 业务类型(1代理记账,2农资,3农机,4金融)
enterpriseId:"2004840258270433254", // 意向企业 enterpriseId: '2004840258270433254', // 意向企业
feedbackRemark:"" // 反馈备注 feedbackRemark: '', // 反馈备注
}) })
const pageData = reactive({ const pageData = reactive({
showLogoutDialog: false, showLogoutDialog: false,
allpyMessageTitle:"", allpyMessageTitle: '',
applyMessageText:"", applyMessageText: '',
}) })
onShow(() => { onShow(() => {
const { id, realname, phone } = userStore.getUserInfo; const { id, realname, phone } = userStore.getUserInfo
consultRecord.id = id; consultRecord.id = id
consultRecord.mobile = phone; consultRecord.mobile = phone
consultRecord.feedbackRemark = realname; consultRecord.feedbackRemark = realname
}) })
// 洽谈合作 // 洽谈合作
function onCooperationClick() { function onCooperationClick() {
// Message.alert('洽谈合作功能暂不可用,敬请期待~', '温馨提示') // Message.alert('洽谈合作功能暂不可用,敬请期待~', '温馨提示')
consultRecord.consultTime = getCurrentDateTime(); consultRecord.consultTime = getCurrentDateTime()
HomeAPI.postConsultRecordAdd(consultRecord).then((res) => { HomeAPI.postConsultRecordAdd(consultRecord).then((res) => {
pageData.allpyMessageTitle = "申请成功"; pageData.allpyMessageTitle = '申请成功'
pageData.applyMessageText = "平台已收到申请,将尽快与您取得联系!"; pageData.applyMessageText = '平台已收到申请,将尽快与您取得联系!'
pageData.showLogoutDialog = true; pageData.showLogoutDialog = true
}) })
} }
</script> </script>
......
...@@ -188,8 +188,10 @@ ...@@ -188,8 +188,10 @@
pageData.search.pageNo = 1 pageData.search.pageNo = 1
pageData.purchaseDemands = [] pageData.purchaseDemands = []
pageData.supplyInfos = [] pageData.supplyInfos = []
if (pageData.currentTransactionTab === 1) getPurchaseList() if (pageData.currentTransactionTab === 1)
if (pageData.currentTransactionTab === 2) getSupplyList() getPurchaseList()
if (pageData.currentTransactionTab === 2)
getSupplyList()
} }
// 采购/供应标签点击事件 // 采购/供应标签点击事件
...@@ -199,8 +201,10 @@ ...@@ -199,8 +201,10 @@
pageData.search.pageNo = 1 pageData.search.pageNo = 1
pageData.purchaseDemands = [] pageData.purchaseDemands = []
pageData.supplyInfos = [] pageData.supplyInfos = []
if (pageData.currentTransactionTab === 1) getPurchaseList() if (pageData.currentTransactionTab === 1)
if (pageData.currentTransactionTab === 2) getSupplyList() getPurchaseList()
if (pageData.currentTransactionTab === 2)
getSupplyList()
} }
// 新需求提醒点击事件 // 新需求提醒点击事件
...@@ -245,12 +249,14 @@ ...@@ -245,12 +249,14 @@
onReachBottom(() => { onReachBottom(() => {
console.log('触底了') console.log('触底了')
if (pageData.currentTransactionTab === 1) { if (pageData.currentTransactionTab === 1) {
if (pageData.total <= pageData.purchaseDemands.length) return if (pageData.total <= pageData.purchaseDemands.length)
return
pageData.search.pageNo++ pageData.search.pageNo++
getPurchaseList() getPurchaseList()
} }
if (pageData.currentTransactionTab === 2) { if (pageData.currentTransactionTab === 2) {
if (pageData.total <= pageData.supplyInfos.length) return if (pageData.total <= pageData.supplyInfos.length)
return
pageData.search.pageNo++ pageData.search.pageNo++
getSupplyList() getSupplyList()
} }
......
<script setup lang="ts"> <script setup lang="ts">
import successfulDialog from '@/components/ConfirmDialog/successfulDialog.vue'; import successfulDialog from '@/components/ConfirmDialog/successfulDialog.vue'
import { getCurrentDateTime } from '@/utils/date' import { getCurrentDateTime } from '@/utils/date'
import * as HomeAPI from '@/api/model/home' import * as HomeAPI from '@/api/model/home'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
const userStore = useUserStore();
const userStore = useUserStore()
const consultRecord = reactive({ const consultRecord = reactive({
id: "", id: '',
mobile: '',// 咨询人号码 mobile: '', // 咨询人号码
consultTime:"" ,// 咨询时间 consultTime: '', // 咨询时间
bizType:5, // 业务类型(1代理记账,2农资,3农机,4金融) bizType: 5, // 业务类型(1代理记账,2农资,3农机,4金融)
enterpriseId:"2004840258270488953", // 意向企业 enterpriseId: '2004840258270488953', // 意向企业
feedbackRemark:"" // 反馈备注 feedbackRemark: '', // 反馈备注
}) })
const pageData = reactive({ const pageData = reactive({
showLogoutDialog: false, showLogoutDialog: false,
allpyMessageTitle:"", allpyMessageTitle: '',
applyMessageText:"", applyMessageText: '',
}) })
onShow(() => { onShow(() => {
const { id, realname, phone } = userStore.getUserInfo; const { id, realname, phone } = userStore.getUserInfo
consultRecord.id = id; consultRecord.id = id
consultRecord.mobile = phone; consultRecord.mobile = phone
consultRecord.feedbackRemark = realname; consultRecord.feedbackRemark = realname
}) })
// 洽谈合作 // 洽谈合作
function onCooperationClick() { function onCooperationClick() {
// Message.alert('洽谈合作功能暂不可用,敬请期待~', '温馨提示') // Message.alert('洽谈合作功能暂不可用,敬请期待~', '温馨提示')
consultRecord.consultTime = getCurrentDateTime(); consultRecord.consultTime = getCurrentDateTime()
HomeAPI.postConsultRecordAdd(consultRecord).then((res) => { HomeAPI.postConsultRecordAdd(consultRecord).then((res) => {
pageData.allpyMessageTitle = "申请成功"; pageData.allpyMessageTitle = '申请成功'
pageData.applyMessageText = "平台已收到申请,将尽快与您取得联系!"; pageData.applyMessageText = '平台已收到申请,将尽快与您取得联系!'
pageData.showLogoutDialog = true; pageData.showLogoutDialog = true
}) })
} }
</script> </script>
......
<script setup lang="ts"> <script setup lang="ts">
import successfulDialog from '@/components/ConfirmDialog/successfulDialog.vue'; import successfulDialog from '@/components/ConfirmDialog/successfulDialog.vue'
import { getCurrentDateTime } from '@/utils/date' import { getCurrentDateTime } from '@/utils/date'
import * as HomeAPI from '@/api/model/home' import * as HomeAPI from '@/api/model/home'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
const userStore = useUserStore();
const userStore = useUserStore()
const consultRecord = reactive({ const consultRecord = reactive({
id: "", id: '',
mobile: '',// 咨询人号码 mobile: '', // 咨询人号码
consultTime:"" ,// 咨询时间 consultTime: '', // 咨询时间
bizType:5, // 业务类型(1代理记账,2农资,3农机,4金融) bizType: 5, // 业务类型(1代理记账,2农资,3农机,4金融)
enterpriseId:"2004840258270471548", // 意向企业 enterpriseId: '2004840258270471548', // 意向企业
feedbackRemark:"" // 反馈备注 feedbackRemark: '', // 反馈备注
}) })
const pageData = reactive({ const pageData = reactive({
showLogoutDialog: false, showLogoutDialog: false,
allpyMessageTitle:"", allpyMessageTitle: '',
applyMessageText:"", applyMessageText: '',
}) })
onShow(() => { onShow(() => {
const { id, realname, phone } = userStore.getUserInfo; const { id, realname, phone } = userStore.getUserInfo
consultRecord.id = id; consultRecord.id = id
consultRecord.mobile = phone; consultRecord.mobile = phone
consultRecord.feedbackRemark = realname; consultRecord.feedbackRemark = realname
}) })
// 洽谈合作 // 洽谈合作
function onCooperationClick() { function onCooperationClick() {
// Message.alert('洽谈合作功能暂不可用,敬请期待~', '温馨提示') // Message.alert('洽谈合作功能暂不可用,敬请期待~', '温馨提示')
consultRecord.consultTime = getCurrentDateTime(); consultRecord.consultTime = getCurrentDateTime()
HomeAPI.postConsultRecordAdd(consultRecord).then((res) => { HomeAPI.postConsultRecordAdd(consultRecord).then((res) => {
pageData.allpyMessageTitle = "申请成功"; pageData.allpyMessageTitle = '申请成功'
pageData.applyMessageText = "平台已收到申请,将尽快与您取得联系!"; pageData.applyMessageText = '平台已收到申请,将尽快与您取得联系!'
pageData.showLogoutDialog = true; pageData.showLogoutDialog = true
}) })
} }
</script> </script>
......
...@@ -291,8 +291,10 @@ return ...@@ -291,8 +291,10 @@ return
<view class="price-range"> <view class="price-range">
<input :disabled="!isSave" type="number" class="price-input" v-model="form.priceStart" placeholder="最低价" :min="0" maxlength="6" /> <input :disabled="!isSave" type="number" class="price-input" v-model="form.priceStart" placeholder="最低价" :min="0" maxlength="6" />
<text class="price-separator"></text> <text class="price-separator"></text>
<input :disabled="!isSave" type="number" class="price-input" v-model="form.priceEnd" placeholder="最高价" :min="0" maxlength="6" > <input :disabled="!isSave" type="number" class="price-input" v-model="form.priceEnd" placeholder="最高价" :min="0" maxlength="6" />
<view slot="suffix" class="unit-slot" style="font-size: 28rpx;"></view> <template #suffix>
<view class="unit-slot" style="font-size: 28rpx;"></view>
</template>
</input> </input>
</view> </view>
</view> </view>
......
<script setup lang="ts"> <script setup lang="ts">
import successfulDialog from '@/components/ConfirmDialog/successfulDialog.vue'; import successfulDialog from '@/components/ConfirmDialog/successfulDialog.vue'
import { getCurrentDateTime } from '@/utils/date' import { getCurrentDateTime } from '@/utils/date'
import * as HomeAPI from '@/api/model/home' import * as HomeAPI from '@/api/model/home'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
const userStore = useUserStore();
const userStore = useUserStore()
const consultRecord = reactive({ const consultRecord = reactive({
id: "", id: '',
mobile: '',// 咨询人号码 mobile: '', // 咨询人号码
consultTime:"" ,// 咨询时间 consultTime: '', // 咨询时间
bizType:5, // 业务类型(1代理记账,2农资,3农机,4金融) bizType: 5, // 业务类型(1代理记账,2农资,3农机,4金融)
enterpriseId:"2004840258270471581", // 意向企业 enterpriseId: '2004840258270471581', // 意向企业
feedbackRemark:"" // 反馈备注 feedbackRemark: '', // 反馈备注
}) })
const pageData = reactive({ const pageData = reactive({
showLogoutDialog: false, showLogoutDialog: false,
allpyMessageTitle:"", allpyMessageTitle: '',
applyMessageText:"", applyMessageText: '',
}) })
onShow(() => { onShow(() => {
const { id, realname, phone } = userStore.getUserInfo; const { id, realname, phone } = userStore.getUserInfo
consultRecord.id = id; consultRecord.id = id
consultRecord.mobile = phone; consultRecord.mobile = phone
consultRecord.feedbackRemark = realname; consultRecord.feedbackRemark = realname
}) })
// 洽谈合作 // 洽谈合作
function onCooperationClick() { function onCooperationClick() {
// Message.alert('洽谈合作功能暂不可用,敬请期待~', '温馨提示') // Message.alert('洽谈合作功能暂不可用,敬请期待~', '温馨提示')
consultRecord.consultTime = getCurrentDateTime(); consultRecord.consultTime = getCurrentDateTime()
HomeAPI.postConsultRecordAdd(consultRecord).then((res) => { HomeAPI.postConsultRecordAdd(consultRecord).then((res) => {
pageData.allpyMessageTitle = "申请成功"; pageData.allpyMessageTitle = '申请成功'
pageData.applyMessageText = "平台已收到申请,将尽快与您取得联系!"; pageData.applyMessageText = '平台已收到申请,将尽快与您取得联系!'
pageData.showLogoutDialog = true; pageData.showLogoutDialog = true
}) })
} }
</script> </script>
......
...@@ -150,7 +150,8 @@ ...@@ -150,7 +150,8 @@
} }
function getCurrentAddressInfo() { function getCurrentAddressInfo() {
if (!uni.getStorageSync('location')) return if (!uni.getStorageSync('location'))
return
const { lon, lat } = uni.getStorageSync('location') const { lon, lat } = uni.getStorageSync('location')
UserInfoAPI.location({ UserInfoAPI.location({
...@@ -416,7 +417,7 @@ ...@@ -416,7 +417,7 @@
<!-- 供应时间 --> <!-- 供应时间 -->
<view class="form-section" style="padding: 0 30rpx"> <view class="form-section" style="padding: 0 30rpx">
<view class="form-item flex align-center"> <view class="form-item flex align-center">
<text class="label" style="font-size: 28rpx">{{pageText}}时间</text> <text class="label" style="font-size: 28rpx">{{ pageText }}时间</text>
<view class="time-range"> <view class="time-range">
<view <view
class="time-input" class="time-input"
......
<script setup lang="ts"> <script setup lang="ts">
import successfulDialog from '@/components/ConfirmDialog/successfulDialog.vue'; import successfulDialog from '@/components/ConfirmDialog/successfulDialog.vue'
import { getCurrentDateTime } from '@/utils/date' import { getCurrentDateTime } from '@/utils/date'
import * as HomeAPI from '@/api/model/home' import * as HomeAPI from '@/api/model/home'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
const userStore = useUserStore();
const userStore = useUserStore()
const consultRecord = reactive({ const consultRecord = reactive({
id: "", id: '',
mobile: '',// 咨询人号码 mobile: '', // 咨询人号码
consultTime:"" ,// 咨询时间 consultTime: '', // 咨询时间
bizType:5, // 业务类型(1代理记账,2农资,3农机,4金融) bizType: 5, // 业务类型(1代理记账,2农资,3农机,4金融)
enterpriseId:"2004840258270437514", // 意向企业 enterpriseId: '2004840258270437514', // 意向企业
feedbackRemark:"" // 反馈备注 feedbackRemark: '', // 反馈备注
}) })
const pageData = reactive({ const pageData = reactive({
showLogoutDialog: false, showLogoutDialog: false,
allpyMessageTitle:"", allpyMessageTitle: '',
applyMessageText:"", applyMessageText: '',
}) })
onShow(() => { onShow(() => {
const { id, realname, phone } = userStore.getUserInfo; const { id, realname, phone } = userStore.getUserInfo
consultRecord.id = id; consultRecord.id = id
consultRecord.mobile = phone; consultRecord.mobile = phone
consultRecord.feedbackRemark = realname; consultRecord.feedbackRemark = realname
}) })
// 洽谈合作 // 洽谈合作
function onCooperationClick() { function onCooperationClick() {
// Message.alert('洽谈合作功能暂不可用,敬请期待~', '温馨提示') // Message.alert('洽谈合作功能暂不可用,敬请期待~', '温馨提示')
consultRecord.consultTime = getCurrentDateTime(); consultRecord.consultTime = getCurrentDateTime()
HomeAPI.postConsultRecordAdd(consultRecord).then((res) => { HomeAPI.postConsultRecordAdd(consultRecord).then((res) => {
pageData.allpyMessageTitle = "申请成功"; pageData.allpyMessageTitle = '申请成功'
pageData.applyMessageText = "平台已收到申请,将尽快与您取得联系!"; pageData.applyMessageText = '平台已收到申请,将尽快与您取得联系!'
pageData.showLogoutDialog = true; pageData.showLogoutDialog = true
}) })
} }
</script> </script>
...@@ -104,7 +105,10 @@ ...@@ -104,7 +105,10 @@
src="/static/images/codefun/ca51ef39a15d5c8414c9a427b3c4434b.png" src="/static/images/codefun/ca51ef39a15d5c8414c9a427b3c4434b.png"
/> />
</view> </view>
<view class="codefun-flex-row codefun-justify-between codefun-relative group_6" @click="onCooperationClick"> <view
class="codefun-flex-row codefun-justify-between codefun-relative group_6"
@click="onCooperationClick"
>
<image class="image_8" src="/static/images/codefun/979b55187f885f1b302dd29760bb516b.png" /> <image class="image_8" src="/static/images/codefun/979b55187f885f1b302dd29760bb516b.png" />
<image class="image_8" src="/static/images/codefun/ecb55b953a8e07a17301bcd12aec591f.png" /> <image class="image_8" src="/static/images/codefun/ecb55b953a8e07a17301bcd12aec591f.png" />
<view class="codefun-flex-row codefun-justify-center codefun-items-center section_6 pos"> <view class="codefun-flex-row codefun-justify-center codefun-items-center section_6 pos">
......
<script setup lang="ts"> <script setup lang="ts">
import successfulDialog from '@/components/ConfirmDialog/successfulDialog.vue'; import successfulDialog from '@/components/ConfirmDialog/successfulDialog.vue'
import { getCurrentDateTime } from '@/utils/date' import { getCurrentDateTime } from '@/utils/date'
import * as HomeAPI from '@/api/model/home' import * as HomeAPI from '@/api/model/home'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
const userStore = useUserStore();
const userStore = useUserStore()
const consultRecord = reactive({ const consultRecord = reactive({
id: "", id: '',
mobile: '',// 咨询人号码 mobile: '', // 咨询人号码
consultTime:"" ,// 咨询时间 consultTime: '', // 咨询时间
bizType:5, // 业务类型(1代理记账,2农资,3农机,4金融) bizType: 5, // 业务类型(1代理记账,2农资,3农机,4金融)
enterpriseId:"2004840258270474551", // 意向企业 enterpriseId: '2004840258270474551', // 意向企业
feedbackRemark:"" // 反馈备注 feedbackRemark: '', // 反馈备注
}) })
const pageData = reactive({ const pageData = reactive({
showLogoutDialog: false, showLogoutDialog: false,
allpyMessageTitle:"", allpyMessageTitle: '',
applyMessageText:"", applyMessageText: '',
}) })
onShow(() => { onShow(() => {
const { id, realname, phone } = userStore.getUserInfo; const { id, realname, phone } = userStore.getUserInfo
consultRecord.id = id; consultRecord.id = id
consultRecord.mobile = phone; consultRecord.mobile = phone
consultRecord.feedbackRemark = realname; consultRecord.feedbackRemark = realname
}) })
// 洽谈合作 // 洽谈合作
function onCooperationClick() { function onCooperationClick() {
// Message.alert('洽谈合作功能暂不可用,敬请期待~', '温馨提示') // Message.alert('洽谈合作功能暂不可用,敬请期待~', '温馨提示')
consultRecord.consultTime = getCurrentDateTime(); consultRecord.consultTime = getCurrentDateTime()
HomeAPI.postConsultRecordAdd(consultRecord).then((res) => { HomeAPI.postConsultRecordAdd(consultRecord).then((res) => {
pageData.allpyMessageTitle = "申请成功"; pageData.allpyMessageTitle = '申请成功'
pageData.applyMessageText = "平台已收到申请,将尽快与您取得联系!"; pageData.applyMessageText = '平台已收到申请,将尽快与您取得联系!'
pageData.showLogoutDialog = true; pageData.showLogoutDialog = true
}) })
} }
</script> </script>
<template> <template>
<view class="codefun-flex-col page"> <view class="codefun-flex-col page">
<view class="codefun-flex-col section"> <view class="codefun-flex-col section">
......
<script setup lang="ts"> <script setup lang="ts">
import { computed, reactive, ref, watch } from 'vue' import { computed, reactive, ref, watch } from 'vue'
import { useDictStore } from '@/store/modules/dict' import { useDictStore } from '@/store/modules/dict'
import * as NongchangAPI from '@/api/model/nongchang' import * as NongchangAPI from '@/api/model/nongchang'
// 定义Props // 定义Props
interface Props { interface Props {
show: boolean show: boolean
editData?: any editData?: any
farmId: any farmId: any
farmBaseId: any farmBaseId: any
} }
const props = withDefaults(defineProps<Props>(), { const props = withDefaults(defineProps<Props>(), {
show: false, show: false,
editData: null, editData: null,
farmId: 0, farmId: 0,
farmBaseId: 0, farmBaseId: 0,
}) })
// 定义Emits // 定义Emits
const emit = defineEmits<{ const emit = defineEmits<{
'update:show': [value: boolean] 'update:show': [value: boolean]
submit: [data: any] submit: [data: any]
close: [] close: []
}>() }>()
// 表单引用 // 表单引用
const formRef = ref() const formRef = ref()
const loading = ref(false) const loading = ref(false)
const showDeviceTypePicker = ref(false) const showDeviceTypePicker = ref(false)
// 字典存储 // 字典存储
const dictStore = useDictStore() const dictStore = useDictStore()
// 表单数据 // 表单数据
const formData = reactive({ const formData = reactive({
deviceName: '', deviceName: '',
deviceType: '', deviceType: '',
deviceTypeText: '', deviceTypeText: '',
deviceIdentifier: '', deviceIdentifier: '',
}) })
// 设备类型选项 - 使用字典数据 // 设备类型选项 - 使用字典数据
const deviceTypeOptions = computed(() => { const deviceTypeOptions = computed(() => {
return ( return (
dictStore.getDictList.deviceType?.map((item: any) => ({ dictStore.getDictList.deviceType?.map((item: any) => ({
value: item.value, value: item.value,
text: item.text, text: item.text,
})) || [] })) || []
) )
}) })
// 设备类型选择器数据 (不再需要,因为fui-picker使用options属性) // 设备类型选择器数据 (不再需要,因为fui-picker使用options属性)
// 计算属性 // 计算属性
const dialogTitle = computed(() => { const dialogTitle = computed(() => {
return props.editData ? '编辑设备' : '添加设备' return props.editData ? '编辑设备' : '添加设备'
}) })
const submitButtonText = computed(() => { const submitButtonText = computed(() => {
return props.editData ? '保存' : '确认' return props.editData ? '保存' : '确认'
}) })
// 表单验证规则 // 表单验证规则
const rules = { const rules = {
deviceName: [ deviceName: [
{ required: true, message: '请输入设备名称', trigger: 'blur' }, { required: true, message: '请输入设备名称', trigger: 'blur' },
{ min: 2, max: 50, message: '设备名称长度在2-50个字符之间', trigger: 'blur' }, { min: 2, max: 50, message: '设备名称长度在2-50个字符之间', trigger: 'blur' },
...@@ -83,10 +83,10 @@ const rules = { ...@@ -83,10 +83,10 @@ const rules = {
trigger: 'blur', trigger: 'blur',
}, },
], ],
} }
// 监听显示状态 // 监听显示状态
watch( watch(
() => props.show, () => props.show,
(newVal) => { (newVal) => {
if (newVal && props.editData) { if (newVal && props.editData) {
...@@ -98,10 +98,10 @@ watch( ...@@ -98,10 +98,10 @@ watch(
resetFormData() resetFormData()
} }
}, },
) )
// 重置表单数据 // 重置表单数据
function resetFormData() { function resetFormData() {
formData.deviceName = '' formData.deviceName = ''
formData.deviceType = '' formData.deviceType = ''
formData.deviceTypeText = '' formData.deviceTypeText = ''
...@@ -111,11 +111,12 @@ function resetFormData() { ...@@ -111,11 +111,12 @@ function resetFormData() {
if (formRef.value) { if (formRef.value) {
formRef.value.resetFields() formRef.value.resetFields()
} }
} }
// 加载编辑数据 // 加载编辑数据
function loadEditData() { function loadEditData() {
if (!props.editData) return if (!props.editData)
return
formData.deviceName = props.editData.deviceName || '' formData.deviceName = props.editData.deviceName || ''
formData.deviceType = props.editData.deviceType || '' formData.deviceType = props.editData.deviceType || ''
...@@ -133,17 +134,17 @@ function loadEditData() { ...@@ -133,17 +134,17 @@ function loadEditData() {
} else { } else {
formData.deviceTypeText = '' formData.deviceTypeText = ''
} }
} }
// 设备类型选择确认 // 设备类型选择确认
function handleDeviceTypeConfirm(e: any) { function handleDeviceTypeConfirm(e: any) {
formData.deviceType = e.value formData.deviceType = e.value
formData.deviceTypeText = e.text formData.deviceTypeText = e.text
showDeviceTypePicker.value = false showDeviceTypePicker.value = false
} }
// 提交表单 // 提交表单
async function handleSubmit() { async function handleSubmit() {
try { try {
console.log(formData) console.log(formData)
// 先进行表单验证 // 先进行表单验证
...@@ -190,21 +191,21 @@ async function handleSubmit() { ...@@ -190,21 +191,21 @@ async function handleSubmit() {
} finally { } finally {
loading.value = false loading.value = false
} }
} }
// 关闭弹窗 // 关闭弹窗
function handleClose() { function handleClose() {
emit('update:show', false) emit('update:show', false)
emit('close') emit('close')
} }
// 暴露方法给父组件 // 暴露方法给父组件
defineExpose({ defineExpose({
resetFormData, resetFormData,
setLoading: (value: boolean) => { setLoading: (value: boolean) => {
loading.value = value loading.value = value
}, },
}) })
</script> </script>
<template> <template>
...@@ -269,23 +270,23 @@ defineExpose({ ...@@ -269,23 +270,23 @@ defineExpose({
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.dialog-content { .dialog-content {
padding: 10rpx 30rpx; padding: 10rpx 30rpx;
width: 90%; width: 90%;
max-height: 80vh; max-height: 80vh;
overflow-y: auto; overflow-y: auto;
} }
.section-title { .section-title {
font-size: 32rpx; font-size: 32rpx;
font-weight: 600; font-weight: 600;
color: #333; color: #333;
margin: 20rpx 0 30rpx 0; margin: 20rpx 0 30rpx 0;
padding-left: 20rpx; padding-left: 20rpx;
border-left: 6rpx solid #5db66f; border-left: 6rpx solid #5db66f;
} }
.dialog-buttons { .dialog-buttons {
display: flex; display: flex;
gap: 20rpx; gap: 20rpx;
margin-top: 40rpx; margin-top: 40rpx;
...@@ -308,10 +309,10 @@ defineExpose({ ...@@ -308,10 +309,10 @@ defineExpose({
border: 2rpx solid #dcdfe6; border: 2rpx solid #dcdfe6;
} }
} }
} }
// uview-plus 表单样式调整 // uview-plus 表单样式调整
::v-deep .u-form-item { ::v-deep .u-form-item {
margin-bottom: 40rpx; margin-bottom: 40rpx;
.u-form-item__body { .u-form-item__body {
...@@ -334,8 +335,8 @@ defineExpose({ ...@@ -334,8 +335,8 @@ defineExpose({
flex: 1; flex: 1;
min-width: 0; min-width: 0;
} }
} }
.address-display { .address-display {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
...@@ -355,15 +356,15 @@ defineExpose({ ...@@ -355,15 +356,15 @@ defineExpose({
.placeholder-text { .placeholder-text {
color: #c0c4cc; color: #c0c4cc;
} }
} }
::v-deep .u-form-item__body__left__content__required { ::v-deep .u-form-item__body__left__content__required {
position: static; position: static;
padding-right: 10rpx; padding-right: 10rpx;
} }
// 输入框样式优化 // 输入框样式优化
::v-deep .u-input { ::v-deep .u-input {
.u-input__content { .u-input__content {
padding: 0; padding: 0;
...@@ -388,10 +389,10 @@ defineExpose({ ...@@ -388,10 +389,10 @@ defineExpose({
} }
} }
} }
} }
// 模态框样式调整 // 模态框样式调整
::v-deep .u-modal { ::v-deep .u-modal {
.u-modal__content { .u-modal__content {
border-radius: 20rpx; border-radius: 20rpx;
padding: 20rpx 0rpx; padding: 20rpx 0rpx;
...@@ -407,5 +408,5 @@ defineExpose({ ...@@ -407,5 +408,5 @@ defineExpose({
color: #333; color: #333;
} }
} }
} }
</style> </style>
<script setup> <script setup>
import { reactive, ref, computed } from 'vue' import { computed, reactive, ref } from 'vue'
import { onLoad, onNavigationBarButtonTap } from '@dcloudio/uni-app' import { onLoad, onNavigationBarButtonTap } from '@dcloudio/uni-app'
import SaveDialog from './components/save-dialog.vue' import SaveDialog from './components/save-dialog.vue'
import * as NongchangAPI from '@/api/model/nongchang' import * as NongchangAPI from '@/api/model/nongchang'
import { useDictStore } from '@/store/modules/dict' import { useDictStore } from '@/store/modules/dict'
import { merge } from 'lodash-es'
const dictStore = useDictStore()
const dictStore = useDictStore() const deviceType = ref('') // 设备类型参数
const deviceType = ref('') // 设备类型参数 const pageData = reactive({
const pageData = reactive({
param: { param: {
deviceName: '', deviceName: '',
deviceType: '', // 添加设备类型筛选 deviceType: '', // 添加设备类型筛选
farmBaseId: '', //基地id farmBaseId: '', // 基地id
}, },
list: [], list: [],
selectedCategory: 'all', selectedCategory: 'all',
selectedDevice: {}, selectedDevice: {},
}) })
// 摄像头设备的分类标签 // 摄像头设备的分类标签
const cameraCategories = computed(() => { const cameraCategories = computed(() => {
const dictList = const dictList =
dictStore.getDictList.deviceType?.map((item) => ({ dictStore.getDictList.deviceType?.map((item) => ({
id: item.value, id: item.value,
name: item.text, name: item.text,
})) || [] })) || []
return [{ id: 'all', name: '全部' }, ...dictList] return [{ id: 'all', name: '全部' }, ...dictList]
}) })
onLoad((options) => { onLoad((options) => {
// 获取设备类型参数 // 获取设备类型参数
if (options.deviceType) { if (options.deviceType) {
deviceType.value = options.deviceType deviceType.value = options.deviceType
...@@ -38,14 +37,14 @@ onLoad((options) => { ...@@ -38,14 +37,14 @@ onLoad((options) => {
pageData.param.farmBaseId = options.farmBaseId pageData.param.farmBaseId = options.farmBaseId
} }
getList() getList()
}) })
// 判断是否为摄像头设备 // 判断是否为摄像头设备
const isCameraDevice = computed(() => { const isCameraDevice = computed(() => {
return deviceType.value == '1' return deviceType.value == '1'
}) })
// 获取设备列表 // 获取设备列表
function getList() { function getList() {
const formData = { const formData = {
deviceName: pageData.param.deviceName, deviceName: pageData.param.deviceName,
deviceType: pageData.param.deviceType, deviceType: pageData.param.deviceType,
...@@ -55,48 +54,51 @@ function getList() { ...@@ -55,48 +54,51 @@ function getList() {
NongchangAPI.queryByType(formData) NongchangAPI.queryByType(formData)
.then((res) => { .then((res) => {
pageData.list = res.result || [] pageData.list = res.result || []
if (res.result.length > 0) handleDeviceClick(res.result[0]) if (res.result.length > 0)
handleDeviceClick(res.result[0])
}) })
.catch(() => { .catch(() => {
pageData.list = [] pageData.list = []
}) })
} }
function handleSearch() { function handleSearch() {
// 搜索时重新获取列表 // 搜索时重新获取列表
getList() getList()
} }
const showDialog = ref(false) const showDialog = ref(false)
const currentEditData = ref(null) const currentEditData = ref(null)
onNavigationBarButtonTap((_) => { onNavigationBarButtonTap((_) => {
showAddDialog() showAddDialog()
}) })
function showAddDialog() { function showAddDialog() {
currentEditData.value = null currentEditData.value = null
showDialog.value = true showDialog.value = true
} }
function handleSubmitSuccess() { function handleSubmitSuccess() {
// 提交成功后刷新列表 // 提交成功后刷新列表
getList() getList()
} }
function handleDialogClose() { function handleDialogClose() {
// 弹窗关闭后的处理逻辑 // 弹窗关闭后的处理逻辑
} }
// 获取状态样式类 // 获取状态样式类
function getStatusClass(status) { function getStatusClass(status) {
if (status === '已连接') return 'status-connected' if (status === '已连接')
if (status === '未连接') return 'status-disconnected' return 'status-connected'
if (status === '未连接')
return 'status-disconnected'
return 'status-unknown' return 'status-unknown'
} }
// 分类标签点击 // 分类标签点击
function handleCategoryClick(category) { function handleCategoryClick(category) {
pageData.selectedCategory = category.id pageData.selectedCategory = category.id
if (category.id === 'all') { if (category.id === 'all') {
pageData.param.deviceType = '' pageData.param.deviceType = ''
...@@ -104,13 +106,13 @@ function handleCategoryClick(category) { ...@@ -104,13 +106,13 @@ function handleCategoryClick(category) {
pageData.param.deviceType = category.id pageData.param.deviceType = category.id
} }
getList() getList()
} }
// 设备卡片点击 // 设备卡片点击
function handleDeviceClick(device) { function handleDeviceClick(device) {
pageData.selectedDevice = device pageData.selectedDevice = device
deviceType.value = device.deviceType deviceType.value = device.deviceType
} }
</script> </script>
<template> <template>
...@@ -139,11 +141,11 @@ function handleDeviceClick(device) { ...@@ -139,11 +141,11 @@ function handleDeviceClick(device) {
<!-- <text class="badge badge-green" v-if="pageData.selectedDevice.isOnline == 1">在线</text> <!-- <text class="badge badge-green" v-if="pageData.selectedDevice.isOnline == 1">在线</text>
<text class="badge badge-gray" v-else>离线</text> --> <text class="badge badge-gray" v-else>离线</text> -->
<view class="online-status online-green"> <view class="online-status online-green">
<view class="status-point"></view> <view class="status-point" />
<text>在线</text> <text>在线</text>
</view> </view>
<view class="online-status"> <view class="online-status">
<view class="status-point"></view> <view class="status-point" />
<text>离线</text> <text>离线</text>
</view> </view>
</view> </view>
...@@ -251,31 +253,31 @@ function handleDeviceClick(device) { ...@@ -251,31 +253,31 @@ function handleDeviceClick(device) {
</template> </template>
<style lang="scss"> <style lang="scss">
body { body {
background-color: #e6f5e8; background-color: #e6f5e8;
} }
.mt-5 { .mt-5 {
margin-top: 10rpx; margin-top: 10rpx;
} }
.mt-11 { .mt-11 {
margin-top: 22rpx; margin-top: 22rpx;
} }
.ml-5 { .ml-5 {
margin-left: 10rpx; margin-left: 10rpx;
} }
.ml-13 { .ml-13 {
margin-left: 26rpx; margin-left: 26rpx;
} }
.ml-9 { .ml-9 {
margin-left: 18rpx; margin-left: 18rpx;
} }
.page { .page {
background-color: #e6f5e8; background-color: #e6f5e8;
mix-blend-mode: NOTTHROUGH; mix-blend-mode: NOTTHROUGH;
width: 100%; width: 100%;
...@@ -738,14 +740,14 @@ body { ...@@ -738,14 +740,14 @@ body {
line-height: 25.76rpx; line-height: 25.76rpx;
color: #ffffff; color: #ffffff;
} }
} }
/* 设备列表样式 */ /* 设备列表样式 */
.device-list { .device-list {
margin-top: 20rpx; margin-top: 20rpx;
} }
.device-item { .device-item {
background-color: #ffffff; background-color: #ffffff;
border-radius: 16rpx; border-radius: 16rpx;
padding: 24rpx; padding: 24rpx;
...@@ -753,93 +755,93 @@ body { ...@@ -753,93 +755,93 @@ body {
// justify-content: space-between; // justify-content: space-between;
align-items: center; align-items: center;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.1); box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.1);
} }
::v-deep .uni-swipe { ::v-deep .uni-swipe {
border-radius: 16rpx; border-radius: 16rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
} }
.device-info { .device-info {
flex: 1; flex: 1;
} }
.device-name { .device-name {
font-size: 28rpx; font-size: 28rpx;
font-weight: 400; font-weight: 400;
letter-spacing: 0px; letter-spacing: 0px;
text-align: center; text-align: center;
} }
.device-details { .device-details {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 6rpx; gap: 6rpx;
margin-bottom: 8rpx; margin-bottom: 8rpx;
} }
.device-type, .device-type,
.device-identifier { .device-identifier {
font-size: 24rpx; font-size: 24rpx;
color: #666666; color: #666666;
} }
.device-status-time { .device-status-time {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: flex-end; align-items: flex-end;
gap: 6rpx; gap: 6rpx;
min-width: 180rpx; min-width: 180rpx;
} }
.device-status { .device-status {
font-size: 24rpx; font-size: 24rpx;
font-weight: bold; font-weight: bold;
} }
.device-time { .device-time {
font-size: 22rpx; font-size: 22rpx;
color: #999999; color: #999999;
} }
.device-actions { .device-actions {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 12rpx; gap: 12rpx;
} }
.status-connected { .status-connected {
color: #5db66f !important; color: #5db66f !important;
font-weight: bold; font-weight: bold;
} }
.status-disconnected { .status-disconnected {
color: #f44336 !important; color: #f44336 !important;
font-weight: bold; font-weight: bold;
} }
.status-unknown { .status-unknown {
color: #ff9800 !important; color: #ff9800 !important;
font-weight: bold; font-weight: bold;
} }
.empty-state { .empty-state {
text-align: center; text-align: center;
padding: 100rpx 0; padding: 100rpx 0;
color: #999999; color: #999999;
font-size: 28rpx; font-size: 28rpx;
} }
/* 分类标签样式 */ /* 分类标签样式 */
.category-tabs { .category-tabs {
display: flex; display: flex;
gap: 16rpx; gap: 16rpx;
padding: 24rpx 0; padding: 24rpx 0;
overflow-x: auto; overflow-x: auto;
white-space: nowrap; white-space: nowrap;
} }
.category-tab { .category-tab {
padding: 12rpx 32rpx; padding: 12rpx 32rpx;
background-color: #ffffff; background-color: #ffffff;
border-radius: 40rpx; border-radius: 40rpx;
...@@ -855,11 +857,11 @@ body { ...@@ -855,11 +857,11 @@ body {
color: #ffffff; color: #ffffff;
font-weight: bold; font-weight: bold;
} }
} }
/* 摄像头设备样式 */ /* 摄像头设备样式 */
/* 顶部视频占位区域 */ /* 顶部视频占位区域 */
.video-placeholder-top { .video-placeholder-top {
position: relative; position: relative;
width: 100%; width: 100%;
height: 400rpx; height: 400rpx;
...@@ -867,9 +869,9 @@ body { ...@@ -867,9 +869,9 @@ body {
background-size: cover; background-size: cover;
background-position: center; background-position: center;
flex-shrink: 0; flex-shrink: 0;
} }
.video-overlay { .video-overlay {
position: absolute; position: absolute;
bottom: 0; bottom: 0;
left: 0; left: 0;
...@@ -879,51 +881,51 @@ body { ...@@ -879,51 +881,51 @@ body {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: flex-end; align-items: flex-end;
} }
.video-info { .video-info {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 8rpx; gap: 8rpx;
} }
.video-location { .video-location {
color: #ffffff; color: #ffffff;
font-size: 32rpx; font-size: 32rpx;
font-weight: bold; font-weight: bold;
text-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.3); text-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.3);
} }
.video-time { .video-time {
color: #ffffff; color: #ffffff;
font-size: 24rpx; font-size: 24rpx;
opacity: 0.9; opacity: 0.9;
text-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.3); text-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.3);
} }
.fullscreen-icon { .fullscreen-icon {
width: 48rpx; width: 48rpx;
height: 48rpx; height: 48rpx;
opacity: 0.9; opacity: 0.9;
} }
/* 设备信息卡片样式 */ /* 设备信息卡片样式 */
.device-info-card { .device-info-card {
margin: 24rpx 24rpx 0rpx 24rpx; margin: 24rpx 24rpx 0rpx 24rpx;
padding: 32rpx 24rpx; padding: 32rpx 24rpx;
background-color: #ffffff; background-color: #ffffff;
border-radius: 16rpx; border-radius: 16rpx;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08); box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
} }
.device-header { .device-header {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 20rpx; gap: 20rpx;
margin-bottom: 24rpx; margin-bottom: 24rpx;
} }
.device-icon { .device-icon {
width: 80rpx; width: 80rpx;
height: 80rpx; height: 80rpx;
background-color: #e8f5e9; background-color: #e8f5e9;
...@@ -932,30 +934,30 @@ body { ...@@ -932,30 +934,30 @@ body {
align-items: center; align-items: center;
justify-content: center; justify-content: center;
flex-shrink: 0; flex-shrink: 0;
} }
.icon-img { .icon-img {
width: 48rpx; width: 48rpx;
height: 48rpx; height: 48rpx;
} }
.device-title-group { .device-title-group {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.device-title { .device-title {
font-size: 32rpx; font-size: 32rpx;
font-weight: bold; font-weight: bold;
color: #333333; color: #333333;
margin-bottom: 12rpx; margin-bottom: 12rpx;
} }
.device-badges { .device-badges {
display: flex; display: flex;
align-items: center; align-items: center;
margin-left: 16rpx; margin-left: 16rpx;
.online-status{ .online-status {
width: 84rpx; width: 84rpx;
height: 36rpx; height: 36rpx;
opacity: 1; opacity: 1;
...@@ -965,45 +967,45 @@ body { ...@@ -965,45 +967,45 @@ body {
font-size: 24rpx; font-size: 24rpx;
font-weight: 400; font-weight: 400;
letter-spacing: 0px; letter-spacing: 0px;
color: #9FAEB5; color: #9faeb5;
text-align: center; text-align: center;
margin-right: 30rpx; margin-right: 30rpx;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
.status-point{ .status-point {
width: 12rpx; width: 12rpx;
height: 12rpx; height: 12rpx;
background: #9FAEB5; background: #9faeb5;
border-radius: 12rpx; border-radius: 12rpx;
margin-right: 8rpx; margin-right: 8rpx;
} }
} }
.online-green{ .online-green {
color: #43CF7C; color: #43cf7c;
.status-point{ .status-point {
background: #43CF7C; background: #43cf7c;
}
} }
} }
}
.badge { .badge {
padding: 6rpx 16rpx; padding: 6rpx 16rpx;
border-radius: 20rpx; border-radius: 20rpx;
font-size: 24rpx; font-size: 24rpx;
} }
.badge-green { .badge-green {
background-color: #5db66f; background-color: #5db66f;
color: #ffffff; color: #ffffff;
} }
.badge-gray { .badge-gray {
background-color: #e0e0e0; background-color: #e0e0e0;
color: #666666; color: #666666;
} }
.device-stats { .device-stats {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
margin-bottom: 16rpx; margin-bottom: 16rpx;
...@@ -1011,32 +1013,32 @@ body { ...@@ -1011,32 +1013,32 @@ body {
&:last-child { &:last-child {
margin-bottom: 0; margin-bottom: 0;
} }
} }
.stat-item { .stat-item {
flex: 1; flex: 1;
display: flex; display: flex;
align-items: center; align-items: center;
} }
.stat-label { .stat-label {
font-size: 24rpx; font-size: 24rpx;
color: #999999; color: #999999;
} }
.stat-value { .stat-value {
font-size: 24rpx; font-size: 24rpx;
color: #666666; color: #666666;
} }
.device-grid { .device-grid {
display: grid; display: grid;
grid-template-columns: repeat(3, 1fr); grid-template-columns: repeat(3, 1fr);
gap: 20rpx; gap: 20rpx;
margin-top: 20rpx; margin-top: 20rpx;
} }
.device-card { .device-card {
background-color: #ffffff; background-color: #ffffff;
border-radius: 16rpx; border-radius: 16rpx;
padding: 24rpx; padding: 24rpx;
...@@ -1048,12 +1050,12 @@ body { ...@@ -1048,12 +1050,12 @@ body {
&.selected { &.selected {
border-color: #5db66f; border-color: #5db66f;
box-shadow: 0 4rpx 12rpx rgba(93, 182, 111, 0.3); box-shadow: 0 4rpx 12rpx rgba(93, 182, 111, 0.3);
background: #5DB66F; background: #5db66f;
color: #FFFFFF !important; color: #ffffff !important;
}
} }
}
.device-card-header { .device-card-header {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 8rpx; gap: 8rpx;
...@@ -1074,9 +1076,9 @@ body { ...@@ -1074,9 +1076,9 @@ body {
font-size: 22rpx; font-size: 22rpx;
font-weight: bold; font-weight: bold;
} }
} }
.device-card-body { .device-card-body {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 12rpx; gap: 12rpx;
...@@ -1098,5 +1100,5 @@ body { ...@@ -1098,5 +1100,5 @@ body {
white-space: nowrap; white-space: nowrap;
} }
} }
} }
</style> </style>
<script setup lang="ts"> <script setup lang="ts">
import successfulDialog from '@/components/ConfirmDialog/successfulDialog.vue'; import successfulDialog from '@/components/ConfirmDialog/successfulDialog.vue'
import { getCurrentDateTime } from '@/utils/date' import { getCurrentDateTime } from '@/utils/date'
import * as HomeAPI from '@/api/model/home' import * as HomeAPI from '@/api/model/home'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
const userStore = useUserStore();
const userStore = useUserStore()
const consultRecord = reactive({ const consultRecord = reactive({
id: '', id: '',
mobile: '',// 咨询人号码 mobile: '', // 咨询人号码
consultTime:"" ,// 咨询时间 consultTime: '', // 咨询时间
bizType:1, // 业务类型(1代理记账,2农资,3农机,4金融) bizType: 1, // 业务类型(1代理记账,2农资,3农机,4金融)
enterpriseId:1324324324, // 意向企业 enterpriseId: 1324324324, // 意向企业
feedbackRemark:"" // 反馈备注 feedbackRemark: '', // 反馈备注
}) })
const pageData = reactive({ const pageData = reactive({
showLogoutDialog: false, showLogoutDialog: false,
}) })
onShow(() => { onShow(() => {
const { id, realname, phone } = userStore.getUserInfo; const { id, realname, phone } = userStore.getUserInfo
consultRecord.id = id; consultRecord.id = id
consultRecord.mobile = phone; consultRecord.mobile = phone
consultRecord.feedbackRemark = realname; consultRecord.feedbackRemark = realname
}) })
// 立即申请 // 立即申请
function onApplyClick() { function onApplyClick() {
consultRecord.consultTime = getCurrentDateTime(); consultRecord.consultTime = getCurrentDateTime()
HomeAPI.postConsultRecordAdd(consultRecord).then((res) => { HomeAPI.postConsultRecordAdd(consultRecord).then((res) => {
pageData.showLogoutDialog = true; pageData.showLogoutDialog = true
}) })
} }
// 提交申请 // 提交申请
function handleConfirmLogout(){ function handleConfirmLogout() {
pageData.showLogoutDialog = false; pageData.showLogoutDialog = false
} }
// 查看大图 // 查看大图
function onViewImage(imageUrl) { function onViewImage(imageUrl) {
uni.previewImage({ uni.previewImage({
urls: [imageUrl] urls: [imageUrl],
}) })
} }
</script> </script>
......
...@@ -5,7 +5,8 @@ ...@@ -5,7 +5,8 @@
import * as HomeAPI from '@/api/model/home' import * as HomeAPI from '@/api/model/home'
import Navigate from '@/utils/page/navigate' import Navigate from '@/utils/page/navigate'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
const userStore = useUserStore();
const userStore = useUserStore()
// 下拉刷新 // 下拉刷新
onPullDownRefresh(() => { onPullDownRefresh(() => {
getGoodsList() getGoodsList()
...@@ -227,23 +228,31 @@ ...@@ -227,23 +228,31 @@
// 查询服务列表 // 查询服务列表
function getServiceItems() { function getServiceItems() {
// '灵活用工','农机租赁','惠农金融','助农保险' // '灵活用工','农机租赁','惠农金融','助农保险'
const testLimitContent = ['1983075690694692866','1983077495298183170','1983077763284848642','1983077932298522625','1985038053803876354','1985038211056721921','1985038680680357889']; const testLimitContent = [
'1983075690694692866',
'1983077495298183170',
'1983077763284848642',
'1983077932298522625',
'1985038053803876354',
'1985038211056721921',
'1985038680680357889',
]
HomeAPI.zoneList({ HomeAPI.zoneList({
pageNo: 1, pageNo: 1,
pageSize: 5, pageSize: 5,
status: 1, status: 1,
type: 3, type: 3,
}).then((res) => { }).then((res) => {
const { records } = res; const { records } = res
if(userStore.isAuditMode){ if (userStore.isAuditMode) {
let arrData = []; const arrData = []
for(let i = 0; i < records.length; i++){ for (let i = 0; i < records.length; i++) {
if(!testLimitContent.includes(records[i].id)){ if (!testLimitContent.includes(records[i].id)) {
arrData.push(records[i]); arrData.push(records[i])
} }
} }
pageData.menuItems = arrData; pageData.menuItems = arrData
}else{ } else {
pageData.menuItems = [...records] pageData.menuItems = [...records]
} }
}) })
...@@ -403,7 +412,10 @@ ...@@ -403,7 +412,10 @@
</view> </view>
</view> </view>
</view> </view>
<view v-if="!userStore.isAuditMode" class="codefun-flex-row codefun-justify-between codefun-items-baseline codefun-mt-24"> <view
v-if="!userStore.isAuditMode"
class="codefun-flex-row codefun-justify-between codefun-items-baseline codefun-mt-24"
>
<text class="font_5 text_8">灵活用工</text> <text class="font_5 text_8">灵活用工</text>
<text class="font_6 text_9" @click="onViewMoreFlexibleEmployment">更多</text> <text class="font_6 text_9" @click="onViewMoreFlexibleEmployment">更多</text>
</view> </view>
...@@ -485,9 +497,7 @@ ...@@ -485,9 +497,7 @@
</view> </view>
</view> </view>
<view class="codefun-flex-col codefun-mt-24"> <view class="codefun-flex-col codefun-mt-24">
<view <view class="codefun-flex-row codefun-justify-between codefun-items-center codefun-self-stretch">
class="codefun-flex-row codefun-justify-between codefun-items-center codefun-self-stretch"
>
<text class="font_5">农资交易</text> <text class="font_5">农资交易</text>
<text class="text-28 font-extralight color-#5DB66F" @click="onViewMoreKexinnongzi"> <text class="text-28 font-extralight color-#5DB66F" @click="onViewMoreKexinnongzi">
更多<fui-icon name="right" size="30" color="#5DB66F" /> 更多<fui-icon name="right" size="30" color="#5DB66F" />
...@@ -521,7 +531,10 @@ ...@@ -521,7 +531,10 @@
>{{ product.name }}</text >{{ product.name }}</text
> >
<text class="codefun-self-start font_1 text_27 codefun-mt-10" style="font-size: 32rpx" <text class="codefun-self-start font_1 text_27 codefun-mt-10" style="font-size: 32rpx"
>¥{{ product.minSellPrice }}<text v-if="product.unit" style="font-size: 24rpx;color:#999999;">/{{ product.unit }}</text></text >¥{{ product.minSellPrice
}}<text v-if="product.unit" style="font-size: 24rpx; color: #999999"
>/{{ product.unit }}</text
></text
> >
</view> </view>
</view> </view>
......
<script setup lang="ts"> <script setup lang="ts">
import { reactive, toRefs } from 'vue' import { reactive } from 'vue'
import { onShow } from '@dcloudio/uni-app' import { onShow } from '@dcloudio/uni-app'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
import { useGlobSetting } from '/@/hooks/setting' import { useGlobSetting } from '/@/hooks/setting'
import * as NongchangAPI from '@/api/model/nongchang' import * as NongchangAPI from '@/api/model/nongchang'
import { areaTree } from '@/utils/areaData' import { areaTree } from '@/utils/areaData'
import { useDictStore } from '@/store/modules/dict' import { useDictStore } from '@/store/modules/dict'
import { useFarmStore } from '@/store/modules/farm' import { useFarmStore } from '@/store/modules/farm'
const dictStore = useDictStore() const dictStore = useDictStore()
const userStore = useUserStore() const userStore = useUserStore()
const globSetting = useGlobSetting() const globSetting = useGlobSetting()
const farmStore = useFarmStore() const farmStore = useFarmStore()
onLoad((pageOptions) => { onLoad((pageOptions) => {
// 页面加载时的初始化操作 // 页面加载时的初始化操作
const farmInfo = farmStore.getFarm const farmInfo = farmStore.getFarm
if (farmInfo) { if (farmInfo) {
pageData.form.farmId = farmInfo.id pageData.form.farmId = farmInfo.id
} }
pageData.form.farmId = pageOptions.farmId pageData.form.farmId = pageOptions.farmId
}) })
onShow(() => { onShow(() => {
// 数据字典赋值 // 数据字典赋值
initDict() initDict()
pageData.form.userId = userStore.getUserInfo.id pageData.form.userId = userStore.getUserInfo.id
}) })
const pageData = reactive({ const pageData = reactive({
loading: false, loading: false,
show: { show: {
growCrops: false, growCrops: false,
...@@ -75,9 +75,9 @@ const pageData = reactive({ ...@@ -75,9 +75,9 @@ const pageData = reactive({
msg: ['请选择种植作物'], msg: ['请选择种植作物'],
}, },
], ],
}) })
function initDict() { function initDict() {
pageData.options.address = areaTree pageData.options.address = areaTree
pageData.options.growCrops = dictStore.getDictList.crops_type.map((item) => { pageData.options.growCrops = dictStore.getDictList.crops_type.map((item) => {
return { return {
...@@ -85,16 +85,16 @@ function initDict() { ...@@ -85,16 +85,16 @@ function initDict() {
text: item.text, text: item.text,
} }
}) })
} }
function handleChangeGrowCrops(e) { function handleChangeGrowCrops(e) {
pageData.form.growCrops = e.value pageData.form.growCrops = e.value
pageData.form.growCropsText = e.text pageData.form.growCropsText = e.text
pageData.show.growCrops = false pageData.show.growCrops = false
} }
const toastRef = ref() const toastRef = ref()
const formRef = ref() const formRef = ref()
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 pageData.loading = true
...@@ -118,7 +118,7 @@ function submit() { ...@@ -118,7 +118,7 @@ function submit() {
}) })
} }
}) })
} }
</script> </script>
<template> <template>
...@@ -209,113 +209,113 @@ function submit() { ...@@ -209,113 +209,113 @@ function submit() {
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.page { .page {
background: #e8f5e9; background: #e8f5e9;
min-height: 100vh; min-height: 100vh;
} }
.page-container { .page-container {
padding: 28rpx; padding: 28rpx;
} }
.form-card { .form-card {
background-color: #ffffff; background-color: #ffffff;
border-radius: 20rpx; border-radius: 20rpx;
margin-bottom: 20rpx; margin-bottom: 20rpx;
padding: 0; padding: 0;
overflow: hidden; overflow: hidden;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
} }
.upload-title { .upload-title {
padding: 28rpx; padding: 28rpx;
font-size: 28rpx; font-size: 28rpx;
color: #333333; color: #333333;
font-weight: 400; font-weight: 400;
} }
.upload-content { .upload-content {
padding: 0 32rpx 32rpx; padding: 0 32rpx 32rpx;
} }
.submit-btn-box { .submit-btn-box {
padding: 32rpx 0; padding: 32rpx 0;
} }
:deep(.fui-button) { :deep(.fui-button) {
border-color: #ff9800 !important; border-color: #ff9800 !important;
background: #ff9800 !important; background: #ff9800 !important;
} }
:deep(.fui-input__wrap), :deep(.fui-input__wrap),
:deep(.fui-textarea__wrap) { :deep(.fui-textarea__wrap) {
padding: 28rpx 32rpx; padding: 28rpx 32rpx;
// border-bottom: 1px solid #e5e5e5; // border-bottom: 1px solid #e5e5e5;
} }
:deep(.fui-input__label), :deep(.fui-input__label),
:deep(.fui-textarea__label) { :deep(.fui-textarea__label) {
font-size: 28rpx; font-size: 28rpx;
color: #333333; color: #333333;
min-width: 160rpx; min-width: 160rpx;
font-weight: 400; font-weight: 400;
} }
:deep(.fui-input__self), :deep(.fui-input__self),
:deep(.fui-textarea__self) { :deep(.fui-textarea__self) {
font-size: 28rpx; font-size: 28rpx;
color: #333333; color: #333333;
} }
:deep(.fui-input__placeholder), :deep(.fui-input__placeholder),
:deep(.fui-textarea__placeholder) { :deep(.fui-textarea__placeholder) {
color: #d0d0d0; color: #d0d0d0;
font-size: 28rpx; font-size: 28rpx;
} }
.form-card :deep(.fui-input__wrap:last-child), .form-card :deep(.fui-input__wrap:last-child),
.form-card :deep(.fui-textarea__wrap:last-child) { .form-card :deep(.fui-textarea__wrap:last-child) {
border-bottom: none; border-bottom: none;
} }
::v-deep .uni-input-placeholder { ::v-deep .uni-input-placeholder {
font-size: 28rpx !important; font-size: 28rpx !important;
color: #999999 !important; color: #999999 !important;
} }
:deep(.uni-textarea-placeholder) { :deep(.uni-textarea-placeholder) {
font-size: 28rpx !important; font-size: 28rpx !important;
color: #999999 !important; color: #999999 !important;
} }
:deep(.fui-button) { :deep(.fui-button) {
width: 690rpx; width: 690rpx;
border-color: #5db66f !important; border-color: #5db66f !important;
background: #5db66f !important; background: #5db66f !important;
} }
// 移除fui-form的默认样式 // 移除fui-form的默认样式
:deep(.fui-form) { :deep(.fui-form) {
background: transparent; background: transparent;
} }
:deep(.fui-form__item) { :deep(.fui-form__item) {
background: transparent; background: transparent;
border: none; border: none;
margin-bottom: 0; margin-bottom: 0;
padding: 0; padding: 0;
} }
:deep(.fui-input__border-bottom) { :deep(.fui-input__border-bottom) {
right: 32rpx !important; right: 32rpx !important;
} }
.form-item-block { .form-item-block {
padding: 24rpx 12rpx; padding: 24rpx 12rpx;
// border-bottom: 1px solid #e5e5e5; // border-bottom: 1px solid #e5e5e5;
&:last-child { &:last-child {
border-bottom: none; border-bottom: none;
} }
} }
.form-item-label { .form-item-label {
font-size: 28rpx; font-size: 28rpx;
color: #333333; color: #333333;
font-weight: 400; font-weight: 400;
...@@ -326,14 +326,14 @@ function submit() { ...@@ -326,14 +326,14 @@ function submit() {
color: #ff4d4f; color: #ff4d4f;
margin-right: 8rpx; margin-right: 8rpx;
} }
} }
.block-textarea { .block-textarea {
width: 100%; width: 100%;
padding: 0rpx 12rpx !important; padding: 0rpx 12rpx !important;
} }
.block-upload { .block-upload {
width: 100%; width: 100%;
padding: 0 20rpx; padding: 0 20rpx;
:deep(.uni-file-picker__container) { :deep(.uni-file-picker__container) {
...@@ -344,17 +344,17 @@ function submit() { ...@@ -344,17 +344,17 @@ function submit() {
display: flex; display: flex;
justify-content: left !important; justify-content: left !important;
} }
} }
.select-text { .select-text {
font-size: 28rpx; font-size: 28rpx;
color: #333333; color: #333333;
padding: 0 20rpx; padding: 0 20rpx;
&.placeholder { &.placeholder {
color: #999999; color: #999999;
} }
} }
.fui-input-wrapper { .fui-input-wrapper {
cursor: pointer; cursor: pointer;
} }
</style> </style>
<script setup lang="ts"> <script setup lang="ts">
import { onLoad } from '@dcloudio/uni-app' import { onLoad } from '@dcloudio/uni-app'
import Navigate from '@/utils/page/navigate'
import { reactive, ref } from 'vue' import { reactive, ref } from 'vue'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
import { useGlobSetting } from '/@/hooks/setting' import { useGlobSetting } from '/@/hooks/setting'
import * as NongzhiAPI from '@/api/model/nongzhi' import * as NongzhiAPI from '@/api/model/nongzhi'
import * as LinghuoyonggongAPI from '@/api/model/linghuoyonggong' import * as LinghuoyonggongAPI from '@/api/model/linghuoyonggong'
import ConfirmDialog from '@/components/ConfirmDialog/index.vue' import ConfirmDialog from '@/components/ConfirmDialog/index.vue'
const userStore = useUserStore() const userStore = useUserStore()
const globSetting = useGlobSetting() const globSetting = useGlobSetting()
let enterpriseId = null; let enterpriseId = null
onLoad((options) => { onLoad((options) => {
let param = JSON.parse(decodeURIComponent(options.param)); const param = JSON.parse(decodeURIComponent(options.param))
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: param.name title: param.name,
}); })
enterpriseId = param.id; enterpriseId = param.id
getDetailData(enterpriseId); getDetailData(enterpriseId)
queryByCategoryAndCode(0,null); queryByCategoryAndCode(0, null)
queryByCategory(); queryByCategory()
getGoodsQueryById(); getGoodsQueryById()
}) })
const toastRef = ref() const toastRef = ref()
const unitPopupRef = ref(null); const unitPopupRef = ref(null)
const uploadRef = ref() const uploadRef = ref()
const bgColorData = ["#EEFAEB","#EFF1FF","#FFF3F1","#E8F7F7","#FFF3E7","#FAF8EA"]; const bgColorData = ['#EEFAEB', '#EFF1FF', '#FFF3F1', '#E8F7F7', '#FFF3E7', '#FAF8EA']
const pageData = reactive({ const pageData = reactive({
data:null, data: null,
enterpriseCers:[], enterpriseCers: [],
isPopupShow:false, isPopupShow: false,
unitPopup:false, unitPopup: false,
unitOptions:[], unitOptions: [],
unitVal:[], unitVal: [],
productImageArr:[], productImageArr: [],
categoryPopup:false, categoryPopup: false,
categoryOptions:[], categoryOptions: [],
categoryText:[], categoryText: [],
categoryVal:[], categoryVal: [],
enterpriseProduct:[], enterpriseProduct: [],
contactName:"", contactName: '',
showConfirmDialog:false, showConfirmDialog: false,
rules: [ rules: [
{ {
...@@ -60,11 +60,13 @@ ...@@ -60,11 +60,13 @@
name: 'category', name: 'category',
rule: ['required'], rule: ['required'],
msg: ['请选择商品分类'], msg: ['请选择商品分类'],
},{ },
{
name: 'minSellPrice', name: 'minSellPrice',
rule: ['required'], rule: ['required'],
msg: ['请输入最小销售价'], msg: ['请输入最小销售价'],
},{ },
{
name: 'maxSellPrice', name: 'maxSellPrice',
rule: ['required'], rule: ['required'],
msg: ['请输入最大销售价'], msg: ['请输入最大销售价'],
...@@ -79,30 +81,30 @@ ...@@ -79,30 +81,30 @@
rule: ['required'], rule: ['required'],
msg: ['请选择商品图片'], msg: ['请选择商品图片'],
}, },
] ],
}) })
let productInfo = reactive({ const productInfo = reactive({
id:"", id: '',
name:"",// 商品名称 name: '', // 商品名称
// mobile:"", // 联系方式 // mobile:"", // 联系方式
category:"", // 分类 category: '', // 分类
minSellPrice:"", // 最小销售价 minSellPrice: '', // 最小销售价
maxSellPrice: "", // 最大销售价 maxSellPrice: '', // 最大销售价
unit: "", // 单位 unit: '', // 单位
unitCode:"", // 单位编码 unitCode: '', // 单位编码
enterpriseId:"", // 企业ID enterpriseId: '', // 企业ID
image:"" image: '',
}) })
function getGoodsQueryById(){ function getGoodsQueryById() {
NongzhiAPI.getGoodsQueryById({enterpriseId:enterpriseId}).then((res) => { NongzhiAPI.getGoodsQueryById({ enterpriseId }).then((res) => {
pageData.enterpriseProduct = res; pageData.enterpriseProduct = res
}) })
} }
// 文件上传 // 文件上传
function handleUpload(file) { function handleUpload(file) {
const tempFilePaths = file.tempFilePaths; const tempFilePaths = file.tempFilePaths
// 处理每张选中的图片 // 处理每张选中的图片
for(let i = 0; i < tempFilePaths.length; i++){ for (let i = 0; i < tempFilePaths.length; i++) {
uni.uploadFile({ uni.uploadFile({
url: `${globSetting.apiUrl + globSetting.urlPrefix}/sys/common/upload`, // 直接使用上传接口URL url: `${globSetting.apiUrl + globSetting.urlPrefix}/sys/common/upload`, // 直接使用上传接口URL
filePath: tempFilePaths[i], filePath: tempFilePaths[i],
...@@ -132,71 +134,70 @@ ...@@ -132,71 +134,70 @@
}) })
uploadRef.value.clearFiles() uploadRef.value.clearFiles()
pageData.productImageArr[0] = null pageData.productImageArr[0] = null
}, },
}) })
} }
} }
// 文件删除 // 文件删除
function handleDelete(file,type) { function handleDelete(file, type) {
uploadRef.value.clearFiles() uploadRef.value.clearFiles()
pageData.productImageArr[0] = null pageData.productImageArr[0] = null
} }
function changeCategory(e){ function changeCategory(e) {
productInfo.category = e.value; productInfo.category = e.value
pageData.categoryPopup = false; pageData.categoryPopup = false
} }
function selectCompleteUnit(e){ function selectCompleteUnit(e) {
productInfo.unit = e.text[e.text.length-1]; productInfo.unit = e.text[e.text.length - 1]
pageData.unitPopup = false; pageData.unitPopup = false
} }
function changeUnit(e){ function changeUnit(e) {
let val = e.value; const val = e.value
queryByCategoryAndCode(val,e); queryByCategoryAndCode(val, e)
} }
function handleSelectCategory(){ function handleSelectCategory() {
pageData.categoryPopup = true; pageData.categoryPopup = true
} }
function handleSelectUnit(){ function handleSelectUnit() {
pageData.unitPopup = true; pageData.unitPopup = true
} }
// 查询商品分类 // 查询商品分类
function queryByCategory(){ function queryByCategory() {
LinghuoyonggongAPI.gitListByCodeDict({ code : 'category'}).then(res=>{ LinghuoyonggongAPI.gitListByCodeDict({ code: 'category' }).then((res) => {
pageData.categoryOptions = res; pageData.categoryOptions = res
let textArr = []; const textArr = []
for(let i = 0; i < res.length; i++){ for (let i = 0; i < res.length; i++) {
textArr.push(res[i].itemText); textArr.push(res[i].itemText)
} }
pageData.categoryText = textArr; pageData.categoryText = textArr
}) })
} }
// 查询单位字典 // 查询单位字典
function queryByCategoryAndCode(code,e){ function queryByCategoryAndCode(code, e) {
LinghuoyonggongAPI.queryByCategoryAndCode({ category : 2,code : code}).then(res=>{ LinghuoyonggongAPI.queryByCategoryAndCode({ category: 2, code }).then((res) => {
if(res.length){ if (res.length) {
let dataArr = []; const dataArr = []
for(let i = 0; i < res.length; i++){ for (let i = 0; i < res.length; i++) {
let obj = {text:"",value:""}; const obj = { text: '', value: '' }
obj.text = res[i].name; obj.text = res[i].name
obj.value = res[i].code; obj.value = res[i].code
dataArr.push(obj); dataArr.push(obj)
} }
if(!pageData.unitOptions.length){ if (!pageData.unitOptions.length) {
pageData.unitOptions = dataArr; pageData.unitOptions = dataArr
}else{ } else {
unitPopupRef.value.setRequestData(dataArr, e.layer); unitPopupRef.value.setRequestData(dataArr, e.layer)
} }
}else{ } else {
unitPopupRef.value.end(); unitPopupRef.value.end()
} }
}) })
} }
// 发布 // 发布
const formRef = ref() const formRef = ref()
function addData(){ function addData() {
productInfo.image = pageData.productImageArr[0]; productInfo.image = pageData.productImageArr[0]
formRef.value.validator(productInfo, pageData.rules, true).then((res) => { formRef.value.validator(productInfo, pageData.rules, true).then((res) => {
if (res.isPassed) { if (res.isPassed) {
NongzhiAPI.postGoodsAdd(productInfo).then((res) => { NongzhiAPI.postGoodsAdd(productInfo).then((res) => {
...@@ -204,61 +205,69 @@ ...@@ -204,61 +205,69 @@
type: 'success', type: 'success',
text: '发布成功', text: '发布成功',
}) })
pageData.isPopupShow = false; pageData.isPopupShow = false
setTimeout(()=>{ setTimeout(() => {
getGoodsQueryById(); getGoodsQueryById()
},500) }, 500)
}) })
} }
}) })
} }
function getDetailData(id){ function getDetailData(id) {
NongzhiAPI.getEnterpriseDetail({ id }).then((res) => { NongzhiAPI.getEnterpriseDetail({ id }).then((res) => {
pageData.enterpriseCers = res.enterpriseCers.split(","); pageData.enterpriseCers = res.enterpriseCers.split(',')
pageData.data = res; pageData.data = res
pageData.contactName = res.contactPerson.substring(0,1) + new Array(res.contactPerson.length).join('*'); pageData.contactName =
productInfo.unitCode = res.enterpriseCode; res.contactPerson.substring(0, 1) + Array.from({ length: res.contactPerson.length }).join('*')
productInfo.enterpriseId = res.id; productInfo.unitCode = res.enterpriseCode
productInfo.enterpriseId = res.id
}) })
} }
function getBgColor(index:any){ function getBgColor(index: any) {
if(index < 6){ if (index < 6) {
return bgColorData[index]; return bgColorData[index]
}else{ } else {
return bgColorData[Math.floor(Math.random() * 5)]; return bgColorData[Math.floor(Math.random() * 5)]
} }
} }
function handlePublish() { function handlePublish() {
productInfo.id = ""; productInfo.id = ''
productInfo.name = ""; productInfo.name = ''
// productInfo.mobile = ""; // productInfo.mobile = "";
productInfo.category = ""; productInfo.category = ''
productInfo.minSellPrice = ""; productInfo.minSellPrice = ''
productInfo.maxSellPrice = ""; productInfo.maxSellPrice = ''
productInfo.unit = ""; productInfo.unit = ''
productInfo.image = ""; productInfo.image = ''
pageData.productImageArr = []; pageData.productImageArr = []
pageData.isPopupShow = true; pageData.isPopupShow = true
} }
function makePhoneCall(){ function makePhoneCall() {
uni.makePhoneCall({ uni.makePhoneCall({
phoneNumber: pageData.data.contactMobile phoneNumber: pageData.data.contactMobile,
}); })
} }
</script> </script>
<template> <template>
<view class="w-full bg-#E6F5E8 detail_page"> <view class="w-full bg-#E6F5E8 detail_page">
<view class="module_width top_content"> <view class="module_width top_content">
<view class="enterprise_logo_view"><image class="enterprise_logo" mode="heightFix" :src="pageData.data.enterpriseLogoUrl" /></view> <view class="enterprise_logo_view"
<view class="enterprise_business">主营:{{pageData.data.businessScope}}</view> ><image class="enterprise_logo" mode="heightFix" :src="pageData.data.enterpriseLogoUrl"
<view class="enterprise_description">{{pageData.data.profile}}</view> /></view>
<view class="enterprise_business">主营:{{ pageData.data.businessScope }}</view>
<view class="enterprise_description">{{ pageData.data.profile }}</view>
</view> </view>
<view class="module_width middle_content"> <view class="module_width middle_content">
<view class="module_title">资质证书</view> <view class="module_title">资质证书</view>
<view class="module_separate"></view> <view class="module_separate" />
<view class="module_qualification"> <view class="module_qualification">
<view class="qualification_item" :style="`height:126rpx;background:${getBgColor(index)}`" v-for="(item,index) in pageData.enterpriseCers" :key="index"> <view
class="qualification_item"
:style="`height:126rpx;background:${getBgColor(index)}`"
v-for="(item, index) in pageData.enterpriseCers"
:key="index"
>
<image class="enterprise_logo" mode="heightFix" :src="item" /> <image class="enterprise_logo" mode="heightFix" :src="item" />
<!-- <view class="qualification_name ellipsis">{{item}}</view> --> <!-- <view class="qualification_name ellipsis">{{item}}</view> -->
</view> </view>
...@@ -266,20 +275,22 @@ ...@@ -266,20 +275,22 @@
</view> </view>
<view class="module_width footer_content"> <view class="module_width footer_content">
<view class="module_title">主营产品</view> <view class="module_title">主营产品</view>
<view class="module_separate"></view> <view class="module_separate" />
<view class="module_business"> <view class="module_business">
<view class="business_item" v-for="item in pageData.enterpriseProduct" :key="item.id"> <view class="business_item" v-for="item in pageData.enterpriseProduct" :key="item.id">
<image class="business_img" mode="heightFix" :src="item.image" /> <image class="business_img" mode="heightFix" :src="item.image" />
<view class="qualification_name ellipsis">{{item.name}}</view> <view class="qualification_name ellipsis">{{ item.name }}</view>
<view class="qualification_price ellipsis">¥{{item.minSellPrice}}<text> ~ </text> {{item.maxSellPrice}}<text class="qualification_text">/{{item.unit}}</text></view> <view class="qualification_price ellipsis"
>¥{{ item.minSellPrice }}<text> ~ </text> {{ item.maxSellPrice
}}<text class="qualification_text">/{{ item.unit }}</text></view
>
</view> </view>
</view> </view>
</view> </view>
<view class="make-phone-view"> <view class="make-phone-view">
<fui-button text="我要购买" bold radius="96rpx" @click="pageData.showConfirmDialog=true;" height="80rpx"/> <fui-button text="我要购买" bold radius="96rpx" @click="pageData.showConfirmDialog = true" height="80rpx" />
</view> </view>
</view> </view>
<!-- 确认对话框 --> <!-- 确认对话框 -->
<ConfirmDialog <ConfirmDialog
...@@ -301,56 +312,114 @@ ...@@ -301,56 +312,114 @@
<fui-bottom-popup :show="pageData.isPopupShow" @close="pageData.isPopupShow = false"> <fui-bottom-popup :show="pageData.isPopupShow" @close="pageData.isPopupShow = false">
<view class="fui-custom__wrap yr_person_popup"> <view class="fui-custom__wrap yr_person_popup">
<view class="popup_top"> <view class="popup_top">
<uni-icons type="left" size="24" color="#333333" @click="pageData.isPopupShow = false"></uni-icons> <uni-icons type="left" size="24" color="#333333" @click="pageData.isPopupShow = false" />
<view class="add_person_text" style="font-size:36rpx;">产品信息</view> <view class="add_person_text" style="font-size: 36rpx">产品信息</view>
<view class="del_person_btn"></view> <view class="del_person_btn" />
</view> </view>
<view class="popup_content"> <view class="popup_content">
<fui-form label-weight="auto" ref="formRef" top="10"> <fui-form label-weight="auto" ref="formRef" top="10">
<fui-input required label="商品名称" placeholder="请输入商品名称" v-model="productInfo.name" label-width="212" size="28"></fui-input> <fui-input
required
label="商品名称"
placeholder="请输入商品名称"
v-model="productInfo.name"
label-width="212"
size="28"
/>
<fui-input @click="handleSelectCategory" required label="商品分类" placeholder="请选择商品分类" disabled :value="productInfo.category" label-width="212" size="28"></fui-input> <fui-input
@click="handleSelectCategory"
required
label="商品分类"
placeholder="请选择商品分类"
disabled
:value="productInfo.category"
label-width="212"
size="28"
/>
<!-- <fui-input required maxlength="11" label="联系电话" placeholder="请输入联系电话" v-model="productInfo.mobile" label-width="212" size="28"></fui-input> --> <!-- <fui-input required maxlength="11" label="联系电话" placeholder="请输入联系电话" v-model="productInfo.mobile" label-width="212" size="28"></fui-input> -->
<fui-form-item asterisk label="价格(元)" label-width="212" size="28"> <fui-form-item asterisk label="价格(元)" label-width="212" size="28">
<fui-input type="number" v-model="productInfo.minSellPrice" style="width: 120rpx !important" :borderBottom="false" :padding="[0]" placeholder="最低价" size="28"></fui-input> <fui-input
<template v-slot:right> type="number"
<view style="color: #CCCCCC;margin-right: 40rpx;"></view> v-model="productInfo.minSellPrice"
<fui-input v-model="productInfo.maxSellPrice" type="number" style="width: 120rpx !important;" :borderBottom="false" :padding="[0]" placeholder="最高价" size="28"></fui-input> style="width: 120rpx !important"
<fui-text v-if="productInfo.unit==''" size="28" text="单位" color="#cccccc" @click="handleSelectUnit()"></fui-text> :borderBottom="false"
<fui-text v-else :text="productInfo.unit" size="28" @click="handleSelectUnit()"></fui-text> :padding="[0]"
placeholder="最低价"
size="28"
/>
<template #right>
<view style="color: #cccccc; margin-right: 40rpx"></view>
<fui-input
v-model="productInfo.maxSellPrice"
type="number"
style="width: 120rpx !important"
:borderBottom="false"
:padding="[0]"
placeholder="最高价"
size="28"
/>
<fui-text
v-if="productInfo.unit == ''"
size="28"
text="单位"
color="#cccccc"
@click="handleSelectUnit()"
/>
<fui-text v-else :text="productInfo.unit" size="28" @click="handleSelectUnit()" />
</template> </template>
</fui-form-item> </fui-form-item>
<fui-form-item asterisk label="商品图片" :bottomBorder="false"> <fui-form-item asterisk label="商品图片" :bottomBorder="false">
<template v-slot:vertical> <template #vertical>
<uni-file-picker :value="pageData.productImageArr" ref="uploadRef" limit="1" :auto-upload="false" @select="handleUpload" @delete="handleDelete"/> <uni-file-picker
:value="pageData.productImageArr"
ref="uploadRef"
limit="1"
:auto-upload="false"
@select="handleUpload"
@delete="handleDelete"
/>
</template> </template>
</fui-form-item> </fui-form-item>
</fui-form> </fui-form>
</view> </view>
<fui-button style="margin-top:36rpx;" text="保存" bold radius="96rpx" @click="addData" height="80rpx"/> <fui-button style="margin-top: 36rpx" text="保存" bold radius="96rpx" @click="addData" height="80rpx" />
</view> </view>
</fui-bottom-popup> </fui-bottom-popup>
<fui-bottom-popup :show="pageData.unitPopup"> <fui-bottom-popup :show="pageData.unitPopup">
<view class="fui-scroll__wrap"> <view class="fui-scroll__wrap">
<view class="fui-title">请选择</view> <view class="fui-title">请选择</view>
<fui-cascader ref="unitPopupRef" :value="pageData.unitVal" stepLoading @change="changeUnit" @complete="selectCompleteUnit" :options="pageData.unitOptions"></fui-cascader> <fui-cascader
<view class="fui-icon__close" @tap.stop="pageData.unitPopup=false"> ref="unitPopupRef"
<fui-icon name="close" :size="48"></fui-icon> :value="pageData.unitVal"
stepLoading
@change="changeUnit"
@complete="selectCompleteUnit"
:options="pageData.unitOptions"
/>
<view class="fui-icon__close" @tap.stop="pageData.unitPopup = false">
<fui-icon name="close" :size="48" />
</view> </view>
</view> </view>
</fui-bottom-popup> </fui-bottom-popup>
<fui-picker :options="pageData.categoryText" layer="1" :show="pageData.categoryPopup" @change="changeCategory" @cancel="pageData.categoryPopup = false" zIndex="9999"></fui-picker> <fui-picker
:options="pageData.categoryText"
layer="1"
:show="pageData.categoryPopup"
@change="changeCategory"
@cancel="pageData.categoryPopup = false"
zIndex="9999"
/>
<fui-toast ref="toastRef" /> <fui-toast ref="toastRef" />
</template> </template>
<style lang="less" scoped> <style lang="less" scoped>
.detail_page{ .detail_page {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: center; justify-content: center;
...@@ -358,40 +427,40 @@ ...@@ -358,40 +427,40 @@
align-content: flex-start; align-content: flex-start;
padding-bottom: 40rpx; padding-bottom: 40rpx;
min-height: calc(100vh - 88rpx); min-height: calc(100vh - 88rpx);
.module_width{ .module_width {
width: 690rpx; width: 690rpx;
margin-top: 24rpx; margin-top: 24rpx;
background: #FFFFFF; background: #ffffff;
border-radius: 20rpx; border-radius: 20rpx;
padding:28rpx; padding: 28rpx;
box-sizing: border-box; box-sizing: border-box;
} }
.ellipsis{ .ellipsis {
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.top_content{ .top_content {
.enterprise_logo_view{ .enterprise_logo_view {
width: 630rpx; width: 630rpx;
display:flex; display: flex;
align-items: flex-start; align-items: flex-start;
.enterprise_logo{ .enterprise_logo {
height: 80rpx; height: 80rpx;
} }
} }
.enterprise_business{ .enterprise_business {
width: 636rpx; width: 636rpx;
padding:8rpx 20rpx; padding: 8rpx 20rpx;
border-radius: 8rpx; border-radius: 8rpx;
background: linear-gradient(233.81deg, rgba(92, 181, 110, 1) 0%, rgba(100, 214, 62, 1) 100%); background: linear-gradient(233.81deg, rgba(92, 181, 110, 1) 0%, rgba(100, 214, 62, 1) 100%);
font-size: 24rpx; font-size: 24rpx;
font-weight: 500; font-weight: 500;
line-height: 40rpx; line-height: 40rpx;
color: #FFFFFF; color: #ffffff;
margin-top: 32rpx; margin-top: 32rpx;
} }
.enterprise_description{ .enterprise_description {
margin-top: 20rpx; margin-top: 20rpx;
font-size: 24rpx; font-size: 24rpx;
font-weight: 400; font-weight: 400;
...@@ -403,10 +472,9 @@ ...@@ -403,10 +472,9 @@
text-indent: 2em; text-indent: 2em;
} }
} }
.middle_content{ .middle_content {
} }
.module_title{ .module_title {
font-size: 32rpx; font-size: 32rpx;
font-weight: 500; font-weight: 500;
line-height: 40rpx; line-height: 40rpx;
...@@ -414,20 +482,20 @@ ...@@ -414,20 +482,20 @@
text-align: justify; text-align: justify;
vertical-align: middle; vertical-align: middle;
} }
.module_separate{ .module_separate {
margin-top: 20rpx; margin-top: 20rpx;
width: 128rpx; width: 128rpx;
height: 6rpx; height: 6rpx;
opacity: 1; opacity: 1;
background: linear-gradient(233.81deg, #5CB56E 0%, #64D63E 100%); background: linear-gradient(233.81deg, #5cb56e 0%, #64d63e 100%);
} }
.module_qualification{ .module_qualification {
margin-top: 6rpx; margin-top: 6rpx;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
align-items: flex-start; align-items: flex-start;
align-content: flex-start; align-content: flex-start;
.qualification_item{ .qualification_item {
width: 198rpx; width: 198rpx;
height: 166rpx; height: 166rpx;
margin-left: 20rpx; margin-left: 20rpx;
...@@ -438,11 +506,11 @@ ...@@ -438,11 +506,11 @@
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: center; justify-content: center;
.enterprise_logo{ .enterprise_logo {
height: 114rpx; height: 114rpx;
max-width: 160rpx; max-width: 160rpx;
} }
.qualification_name{ .qualification_name {
height: 40rpx; height: 40rpx;
line-height: 40rpx; line-height: 40rpx;
font-size: 20rpx; font-size: 20rpx;
...@@ -450,21 +518,21 @@ ...@@ -450,21 +518,21 @@
max-width: 160rpx; max-width: 160rpx;
} }
} }
.qualification_item:nth-child(3n+1){ .qualification_item:nth-child(3n + 1) {
margin-left: 0rpx; margin-left: 0rpx;
} }
} }
.footer_content{ .footer_content {
margin-bottom: 100rpx; margin-bottom: 100rpx;
} }
.module_business{ .module_business {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
align-items: flex-start; align-items: flex-start;
align-content: flex-start; align-content: flex-start;
justify-content: space-between; justify-content: space-between;
.business_item{ .business_item {
width: 310rpx; width: 310rpx;
height: 292rpx; height: 292rpx;
margin-top: 24rpx; margin-top: 24rpx;
...@@ -474,14 +542,14 @@ ...@@ -474,14 +542,14 @@
justify-content: center; justify-content: center;
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
background: #F9FAFB; background: #f9fafb;
.business_img{ .business_img {
width: 310rpx; width: 310rpx;
height: 180rpx; height: 180rpx;
opacity: 1; opacity: 1;
border-radius: 16rpx 16rpx 0rpx 0rpx; border-radius: 16rpx 16rpx 0rpx 0rpx;
} }
.qualification_name{ .qualification_name {
height: 48rpx; height: 48rpx;
line-height: 48rpx; line-height: 48rpx;
font-size: 32rpx; font-size: 32rpx;
...@@ -489,7 +557,7 @@ ...@@ -489,7 +557,7 @@
max-width: 280rpx; max-width: 280rpx;
margin-top: 6rpx; margin-top: 6rpx;
} }
.qualification_price{ .qualification_price {
height: 48rpx; height: 48rpx;
width: 280rpx; width: 280rpx;
opacity: 1; opacity: 1;
...@@ -498,45 +566,45 @@ ...@@ -498,45 +566,45 @@
letter-spacing: 0px; letter-spacing: 0px;
line-height: 48rpx; line-height: 48rpx;
text-align: center; text-align: center;
color: #5DB66F; color: #5db66f;
.qualification_text{ .qualification_text {
font-size: 12px; font-size: 12px;
} }
} }
} }
.business_item:nth-child(odd){ .business_item:nth-child(odd) {
margin-left: 0rpx; margin-left: 0rpx;
} }
} }
} }
::v-deep .fui-fab__btn-main { ::v-deep .fui-fab__btn-main {
background: linear-gradient(124.25deg, #a5d63f 0%, #5db66f 100%) !important; background: linear-gradient(124.25deg, #a5d63f 0%, #5db66f 100%) !important;
box-shadow: 0px 1px 8px #5db66f; box-shadow: 0px 1px 8px #5db66f;
} }
.fui-scroll__wrap { .fui-scroll__wrap {
padding-top: 30rpx; padding-top: 30rpx;
position: relative; position: relative;
} }
.fui-title { .fui-title {
font-size: 30rpx; font-size: 30rpx;
font-weight: bold; font-weight: bold;
text-align: center; text-align: center;
padding-bottom: 24rpx; padding-bottom: 24rpx;
} }
.fui-icon__close { .fui-icon__close {
position: absolute; position: absolute;
top: 24rpx; top: 24rpx;
right: 24rpx; right: 24rpx;
} }
.make-phone-view{ .make-phone-view {
width: 690rpx; width: 690rpx;
height: 80rpx; height: 80rpx;
position: fixed; position: fixed;
left: 30rpx; left: 30rpx;
bottom: 20rpx; bottom: 20rpx;
} }
</style> </style>
<script setup lang="ts"> <script setup lang="ts">
import { onLoad, onPullDownRefresh, onShow } from '@dcloudio/uni-app' import { onPullDownRefresh, onShow } from '@dcloudio/uni-app'
import { reactive } from 'vue'
import Navigate from '@/utils/page/navigate' import Navigate from '@/utils/page/navigate'
import { reactive, ref } from 'vue'
import * as NongzhiAPI from '@/api/model/nongzhi' import * as NongzhiAPI from '@/api/model/nongzhi'
onPullDownRefresh(() => { onPullDownRefresh(() => {
resetData() resetData()
getList(pageData.params) getList(pageData.params)
...@@ -20,16 +21,17 @@ ...@@ -20,16 +21,17 @@
params: { params: {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
bizCategory:2, bizCategory: 2,
reviewStatus:1 reviewStatus: 1,
}, // 分页参数 }, // 分页参数
hasMore: true, // 是否还有更多数据 hasMore: true, // 是否还有更多数据
loading: false, // 是否正在加载 loading: false, // 是否正在加载
dataList:[] dataList: [],
}) })
async function getList(params) { async function getList(params) {
if (pageData.loading) return if (pageData.loading)
return
pageData.loading = true pageData.loading = true
await NongzhiAPI.getEnterpriseList(params).then((res) => { await NongzhiAPI.getEnterpriseList(params).then((res) => {
if (res.records.length > 0) { if (res.records.length > 0) {
...@@ -48,9 +50,8 @@ ...@@ -48,9 +50,8 @@
pageData.loading = false pageData.loading = false
} }
function toDetail(item) { function toDetail(item) {
let param = encodeURIComponent(JSON.stringify({id:item.id,name:item.enterpriseName})); const param = encodeURIComponent(JSON.stringify({ id: item.id, name: item.enterpriseName }))
Navigate.to(`/pages/kexinnongzi/detail?param=${param}`) Navigate.to(`/pages/kexinnongzi/detail?param=${param}`)
} }
...@@ -81,14 +82,13 @@ ...@@ -81,14 +82,13 @@
<image class="enterprise_logo" mode="aspectFit" :src="item.enterpriseLogoUrl" /> <image class="enterprise_logo" mode="aspectFit" :src="item.enterpriseLogoUrl" />
</view> </view>
<view class="item_right"> <view class="item_right">
<view class="item_name ellipsis">{{item.enterpriseName}}</view> <view class="item_name ellipsis">{{ item.enterpriseName }}</view>
<view class="item_description ellipsis">{{item.businessScope}}</view> <view class="item_description ellipsis">{{ item.businessScope }}</view>
<view class="item_details"> <view class="item_details">
<view class="detail_btn" @click="toDetail(item)">查看详情</view> <view class="detail_btn" @click="toDetail(item)">查看详情</view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<!-- 加载状态 --> <!-- 加载状态 -->
<view class="loading-status"> <view class="loading-status">
...@@ -101,60 +101,62 @@ ...@@ -101,60 +101,62 @@
</template> </template>
<style lang="less" scoped> <style lang="less" scoped>
.yr_page_view{ .yr_page_view {
padding: 28rpx; padding: 28rpx;
.top_img,.agr_sup_img{ .top_img,
.agr_sup_img {
height: 280rpx; height: 280rpx;
width: 690rpx; width: 690rpx;
} }
.top_img{ .top_img {
margin-bottom: 24rpx; margin-bottom: 24rpx;
} }
.page_content{ .page_content {
border-radius: 16rpx; border-radius: 16rpx;
background: #FFFFFF; background: #ffffff;
} }
.ellipsis{ .ellipsis {
width: 200px; width: 200px;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.item_list{ .item_list {
display: flex; display: flex;
align-items:flex-start; align-items: flex-start;
justify-content: space-between; justify-content: space-between;
padding-left: 24rpx; padding-left: 24rpx;
padding-right: 30rpx; padding-right: 30rpx;
padding-bottom: 24rpx; padding-bottom: 24rpx;
padding-top: 24rpx; padding-top: 24rpx;
border-bottom: 2rpx solid #EEEEEE; border-bottom: 2rpx solid #eeeeee;
.item_left,.enterprise_logo{ .item_left,
.enterprise_logo {
width: 192rpx; width: 192rpx;
max-height: 160rpx; max-height: 160rpx;
} }
.item_right{ .item_right {
width: 436rpx; width: 436rpx;
.item_name{ .item_name {
font-size: 32rpx; font-size: 32rpx;
font-weight: 500; font-weight: 500;
color: #333333; color: #333333;
} }
.item_description{ .item_description {
font-size: 24rpx; font-size: 24rpx;
font-weight: 400; font-weight: 400;
color: #999999; color: #999999;
margin-top: 16rpx; margin-top: 16rpx;
margin-bottom: 12rpx; margin-bottom: 12rpx;
} }
.item_details{ .item_details {
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
} }
.detail_btn{ .detail_btn {
border-radius: 100rpx; border-radius: 100rpx;
background: #5DB66F; background: #5db66f;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
...@@ -163,18 +165,15 @@ ...@@ -163,18 +165,15 @@
height: 48rpx; height: 48rpx;
font-size: 24rpx; font-size: 24rpx;
font-weight: 400; font-weight: 400;
color: #FFFFFF; color: #ffffff;
} }
} }
} }
.item_list:last-child{ .item_list:last-child {
border-bottom: none; border-bottom: none;
} }
} }
.loading-status { .loading-status {
text-align: center; text-align: center;
padding: 20rpx; padding: 20rpx;
......
<script setup lang="ts"> <script setup lang="ts">
import { reactive, toRefs,ref } from 'vue' import { reactive, ref, toRefs } from 'vue'
import { onLoad, onShow } from '@dcloudio/uni-app' import { onLoad } from '@dcloudio/uni-app'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
import { useGlobSetting } from '/@/hooks/setting' import { useGlobSetting } from '/@/hooks/setting'
import * as LinghuoyonggongAPI from '@/api/model/linghuoyonggong' import * as LinghuoyonggongAPI from '@/api/model/linghuoyonggong'
import * as UserInfoAPI from '@/api/model/userInfo'
import * as NongzhiAPI from '@/api/model/nongzhi' import * as NongzhiAPI from '@/api/model/nongzhi'
import { useDictStore } from '@/store/modules/dict' import { useDictStore } from '@/store/modules/dict'
...@@ -14,15 +13,14 @@ ...@@ -14,15 +13,14 @@
const globSetting = useGlobSetting() const globSetting = useGlobSetting()
onLoad((option) => { onLoad((option) => {
// 获取数据详情 // 获取数据详情
getProvince(0,null); getProvince(0, null)
}) })
// 勾选协议校验
//勾选协议校验
function checkAgree(agree) { function checkAgree(agree) {
return agree return agree
} }
const areaPopupRef = ref(null); const areaPopupRef = ref(null)
const pageData = reactive({ const pageData = reactive({
loading: false, loading: false,
show: { show: {
...@@ -34,48 +32,46 @@ ...@@ -34,48 +32,46 @@
}, },
options: { options: {
area: [], area: [],
areaVal:[], areaVal: [],
urgentdegree: [], urgentdegree: [],
type: [], type: [],
}, },
cersImageIndex:0, cersImageIndex: 0,
cersImageArr:[], cersImageArr: [],
enterpriseLogoArr:[], enterpriseLogoArr: [],
selectAreaVal:[], selectAreaVal: [],
form: { form: {
id: '', id: '',
enterpriseName:"",// 企业名称 enterpriseName: '', // 企业名称
enterpriseCode:"",// 企业编码 enterpriseCode: '', // 企业编码
businessScope:"", // 企业经营范围 businessScope: '', // 企业经营范围
contactPerson:"", // 联系人 contactPerson: '', // 联系人
contactMobile:"", // 联系人手机号 contactMobile: '', // 联系人手机号
profile:"", // 企业简介 profile: '', // 企业简介
provinceName:"", // 省 provinceName: '', // 省
cityName:"", // 市 cityName: '', // 市
districtName:"", // 区县 districtName: '', // 区县
townName:"", // 乡镇 townName: '', // 乡镇
provinceCode:"", // 省 provinceCode: '', // 省
cityCode:"", // 市 cityCode: '', // 市
districtCode:"", // 区县 districtCode: '', // 区县
townCode:"", // 乡镇 townCode: '', // 乡镇
addr: '', // 详细地址
addr:"", // 详细地址 lon: '', // 经度
lon:"", // 经度 lat: '', // 纬度
lat:'', // 纬度
bizCategory: 2, // 业务分类【1:代理记账、2:农资、3:农机、4:金融】 bizCategory: 2, // 业务分类【1:代理记账、2:农资、3:农机、4:金融】
enterpriseLogoUrl:null, // 企业logo url enterpriseLogoUrl: null, // 企业logo url
enterpriseCers:null, // 企业资质url enterpriseCers: null, // 企业资质url
areaText: '', areaText: '',
agree:false, agree: false,
}, },
position: [], position: [],
rules: [ rules: [
...@@ -83,92 +79,103 @@ ...@@ -83,92 +79,103 @@
name: 'enterpriseName', name: 'enterpriseName',
rule: ['required'], rule: ['required'],
msg: ['请输入公司名称'], msg: ['请输入公司名称'],
}, { },
{
name: 'enterpriseCode', name: 'enterpriseCode',
rule: ['required'], rule: ['required'],
msg: ['请输入企业编码'], msg: ['请输入企业编码'],
}, { },
{
name: 'businessScope', name: 'businessScope',
rule: ['required'], rule: ['required'],
msg: ['请输入经营业务'], msg: ['请输入经营业务'],
},{ },
{
name: 'profile', name: 'profile',
rule: ['required'], rule: ['required'],
msg: ['请输入平台介绍'], msg: ['请输入平台介绍'],
},{ },
{
name: 'areaText', name: 'areaText',
rule: ['required'], rule: ['required'],
msg: ['请选择地区'], msg: ['请选择地区'],
},{ },
{
name: 'addr', name: 'addr',
rule: ['required'], rule: ['required'],
msg: ['请输入详细地址'], msg: ['请输入详细地址'],
},{ },
{
name: 'contactPerson', name: 'contactPerson',
rule: ['required'], rule: ['required'],
msg: ['请输入联系人'], msg: ['请输入联系人'],
},{ },
name: "contactMobile", {
rule: ["required", "isMobile"], name: 'contactMobile',
msg: ["请输入联系电话", "请输入正确的联系电话"] rule: ['required', 'isMobile'],
},{ msg: ['请输入联系电话', '请输入正确的联系电话'],
},
{
name: 'enterpriseLogoUrl', name: 'enterpriseLogoUrl',
rule: ['required'], rule: ['required'],
msg: ['请上传公司logo'], msg: ['请上传公司logo'],
},{ },
{
name: 'enterpriseCers', name: 'enterpriseCers',
rule: ['required'], rule: ['required'],
msg: ['请上传公司资质证件'], msg: ['请上传公司资质证件'],
},{ },
name: "agree", {
validator: [{ name: 'agree',
msg: "请勾选并同意《入驻协议》与《服务条款》", validator: [
method: checkAgree {
}] msg: '请勾选并同意《入驻协议》与《服务条款》',
} method: checkAgree,
},
],
},
], ],
}) })
function agreeChange(e) { function agreeChange(e) {
pageData.form.agree = e.checked; pageData.form.agree = e.checked
} }
// 选择地区完成 // 选择地区完成
function selectCompleteArea(e){ function selectCompleteArea(e) {
let areaAttr = ['province','city','district','town']; const areaAttr = ['province', 'city', 'district', 'town']
let text = e.text; const text = e.text
let value = e.value; const value = e.value
let formData = pageData.form; const formData = pageData.form
for(let i = 0; i < text.length;i++){ for (let i = 0; i < text.length; i++) {
formData[areaAttr[i]+'Name'] = text[i]; formData[`${areaAttr[i]}Name`] = text[i]
formData[areaAttr[i]+'Code'] = value[i]; formData[`${areaAttr[i]}Code`] = value[i]
} }
pageData.form.areaText= text.join(''); pageData.form.areaText = text.join('')
pageData.show.area = false; pageData.show.area = false
} }
// 在选择地区 // 在选择地区
function changeArea(e){ function changeArea(e) {
let val = e.value; const val = e.value
getProvince(val,e); getProvince(val, e)
} }
// 获取下一级地区 // 获取下一级地区
function getProvince(code,e) { function getProvince(code, e) {
LinghuoyonggongAPI.queryConditions({ parentCode : code}).then(res=>{ LinghuoyonggongAPI.queryConditions({ parentCode: code }).then((res) => {
if(res.length){ if (res.length) {
let dataArr = []; const dataArr = []
for(let i = 0; i < res.length; i++){ for (let i = 0; i < res.length; i++) {
let obj = {text:"",value:""}; const obj = { text: '', value: '' }
obj.text = res[i].name; obj.text = res[i].name
obj.value = res[i].code; obj.value = res[i].code
dataArr.push(obj); dataArr.push(obj)
} }
if(!pageData.options.area.length){ if (!pageData.options.area.length) {
pageData.options.area = dataArr; pageData.options.area = dataArr
}else{ } else {
areaPopupRef.value.setRequestData(dataArr, e.layer); areaPopupRef.value.setRequestData(dataArr, e.layer)
} }
}else{ } else {
areaPopupRef.value.end(); areaPopupRef.value.end()
} }
}) })
} }
...@@ -178,10 +185,10 @@ ...@@ -178,10 +185,10 @@
const uploadLogoRef = ref() const uploadLogoRef = ref()
const uploadCersRef = ref() const uploadCersRef = ref()
// 文件上传 // 文件上传
function handleUpload(file,type) { function handleUpload(file, type) {
const tempFilePaths = file.tempFilePaths; const tempFilePaths = file.tempFilePaths
// 处理每张选中的图片 // 处理每张选中的图片
for(let i = 0; i < tempFilePaths.length; i++){ for (let i = 0; i < tempFilePaths.length; i++) {
uni.uploadFile({ uni.uploadFile({
url: `${globSetting.apiUrl + globSetting.urlPrefix}/sys/common/upload`, // 直接使用上传接口URL url: `${globSetting.apiUrl + globSetting.urlPrefix}/sys/common/upload`, // 直接使用上传接口URL
filePath: tempFilePaths[i], filePath: tempFilePaths[i],
...@@ -200,13 +207,12 @@ ...@@ -200,13 +207,12 @@
type: 'success', type: 'success',
text: '上传成功', text: '上传成功',
}) })
if(type == 'logo'){ if (type == 'logo') {
pageData.enterpriseLogoArr[0] = data.message // 保存返回的图片信息 pageData.enterpriseLogoArr[0] = data.message // 保存返回的图片信息
}else{ } else {
pageData.cersImageIndex++; pageData.cersImageIndex++
pageData.cersImageArr.push(data.message); pageData.cersImageArr.push(data.message)
} }
} }
} }
}, },
...@@ -215,34 +221,33 @@ ...@@ -215,34 +221,33 @@
type: 'error', type: 'error',
text: '上传失败', text: '上传失败',
}) })
if(type == 'logo'){ if (type == 'logo') {
uploadLogoRef.value.clearFiles() uploadLogoRef.value.clearFiles()
pageData.enterpriseLogoArr[0] = null pageData.enterpriseLogoArr[0] = null
}else{ } else {
uploadCersRef.value.clearFiles(pageData.cersImageIndex) uploadCersRef.value.clearFiles(pageData.cersImageIndex)
pageData.form.enterpriseCers = null pageData.form.enterpriseCers = null
} }
}, },
}) })
} }
} }
// 文件删除 // 文件删除
function handleDelete(file,type) { function handleDelete(file, type) {
if(type="logo"){ if ((type = 'logo')) {
uploadLogoRef.value.clearFiles() uploadLogoRef.value.clearFiles()
pageData.enterpriseLogoArr[0] = null pageData.enterpriseLogoArr[0] = null
}else{ } else {
const num = pageData.cersImageArr.findIndex(v => v.url === file.tempFilePath); const num = pageData.cersImageArr.findIndex((v) => v.url === file.tempFilePath)
pageData.cersImageArr.splice(num, 1); pageData.cersImageArr.splice(num, 1)
} }
} }
const formRef = ref() const formRef = ref()
function submit() { function submit() {
const { lon, lat } = uni.getStorageSync('location') const { lon, lat } = uni.getStorageSync('location')
pageData.position = [lon, lat]; pageData.position = [lon, lat]
pageData.form.enterpriseLogoUrl = pageData.enterpriseLogoArr.join(''); pageData.form.enterpriseLogoUrl = pageData.enterpriseLogoArr.join('')
pageData.form.enterpriseCers = pageData.cersImageArr.join(','); pageData.form.enterpriseCers = pageData.cersImageArr.join(',')
if (pageData.position.length == 0) { if (pageData.position.length == 0) {
toastRef.value.show({ toastRef.value.show({
type: 'error', type: 'error',
...@@ -259,17 +264,17 @@ ...@@ -259,17 +264,17 @@
type: 'success', type: 'success',
text: '发布成功', text: '发布成功',
}) })
setTimeout(()=>{ setTimeout(() => {
uni.navigateBack({ uni.navigateBack({
delta: 1 // 返回的页面数 delta: 1, // 返回的页面数
}) })
},1000) }, 1000)
}) })
} }
}) })
} }
function getCurrentDate(){ function getCurrentDate() {
const date = new Date() const date = new Date()
const year = date.getFullYear() const year = date.getFullYear()
const month = date.getMonth() + 1 const month = date.getMonth() + 1
...@@ -283,35 +288,122 @@ ...@@ -283,35 +288,122 @@
<view class="formBox"> <view class="formBox">
<fui-form ref="formRef" label-weight="auto" top="60" :disabled="form.id ? true : false"> <fui-form ref="formRef" label-weight="auto" top="60" :disabled="form.id ? true : false">
<view class="mt20"> <view class="mt20">
<fui-input required label="公司名称" placeholder="请输入公司名称" v-model="form.enterpriseName" labelSize="28" label-width="180" size="28"/> <fui-input
<fui-input required label="企业编码" placeholder="请输入企业编码" v-model="form.enterpriseCode" labelSize="28" label-width="180" size="28"/> required
<fui-input required label="经营业务" placeholder="请输入经营业务" v-model="form.businessScope" labelSize="28" label-width="180" size="28"/> label="公司名称"
placeholder="请输入公司名称"
v-model="form.enterpriseName"
labelSize="28"
label-width="180"
size="28"
/>
<fui-input
required
label="企业编码"
placeholder="请输入企业编码"
v-model="form.enterpriseCode"
labelSize="28"
label-width="180"
size="28"
/>
<fui-input
required
label="经营业务"
placeholder="请输入经营业务"
v-model="form.businessScope"
labelSize="28"
label-width="180"
size="28"
/>
<fui-form-item asterisk label="平台介绍" :bottomBorder="false" prop="descr" error-align="left"> <fui-form-item asterisk label="平台介绍" :bottomBorder="false" prop="descr" error-align="left">
<template v-slot:vertical> <template #vertical>
<fui-textarea isCounter maxlength="-1" :padding="['0','32rpx','32rpx']" :border-bottom="false" :border-top="false" size="28" <fui-textarea
placeholder="请输入平台介绍..." v-model="form.profile"></fui-textarea> isCounter
maxlength="-1"
:padding="['0', '32rpx', '32rpx']"
:border-bottom="false"
:border-top="false"
size="28"
placeholder="请输入平台介绍..."
v-model="form.profile"
/>
</template> </template>
</fui-form-item> </fui-form-item>
</view> </view>
<view class="mt20"> <view class="mt20">
<fui-input required label="地区" placeholder="请选择地区" v-model="form.areaText" labelSize="28" label-width="180" @click="show.area = true" size="28" disabled/> <fui-input
<fui-input required label="详细地址" placeholder="请输入详细地址" v-model="form.addr" labelSize="28" label-width="180" size="28"/> required
<fui-input required label="联系人" placeholder="请输入联系人" v-model="form.contactPerson" labelSize="28" label-width="180" size="28"/> label="地区"
<fui-input type="tel" required label="联系电话" placeholder="请输入联系电话" v-model="form.contactMobile" labelSize="28" label-width="180" size="28"></fui-input> placeholder="请选择地区"
v-model="form.areaText"
labelSize="28"
label-width="180"
@click="show.area = true"
size="28"
disabled
/>
<fui-input
required
label="详细地址"
placeholder="请输入详细地址"
v-model="form.addr"
labelSize="28"
label-width="180"
size="28"
/>
<fui-input
required
label="联系人"
placeholder="请输入联系人"
v-model="form.contactPerson"
labelSize="28"
label-width="180"
size="28"
/>
<fui-input
type="tel"
required
label="联系电话"
placeholder="请输入联系电话"
v-model="form.contactMobile"
labelSize="28"
label-width="180"
size="28"
/>
</view> </view>
<view class="bg-white mt20" style="padding: 0.875rem 1rem"> <view class="bg-white mt20" style="padding: 0.875rem 1rem">
<view class="mb-1 flex justify-start" style="font-size: 28rpx;"><span style="color: red;">*&nbsp;</span> 公司logo </view> <view class="mb-1 flex justify-start" style="font-size: 28rpx"
<uni-file-picker :value="pageData.enterpriseLogoArr" ref="uploadLogoRef" limit="1" :auto-upload="false" @select="handleUpload($event,'logo')" @delete="handleDelete($event,'logo')"/> ><span style="color: red">*&nbsp;</span> 公司logo
</view>
<uni-file-picker
:value="pageData.enterpriseLogoArr"
ref="uploadLogoRef"
limit="1"
:auto-upload="false"
@select="handleUpload($event, 'logo')"
@delete="handleDelete($event, 'logo')"
/>
</view> </view>
<view class="bg-white mt20" style="padding: 0.875rem 1rem"> <view class="bg-white mt20" style="padding: 0.875rem 1rem">
<view class="mb-1 flex justify-start" style="font-size: 28rpx;"><span style="color: red;">*&nbsp;</span> 公司资质证件 </view> <view class="mb-1 flex justify-start" style="font-size: 28rpx"
<view class="mb-1 flex justify-start" style="font-size: 24rpx;color: #CCCCCC;">前6张资质证件将展示在详情页,拖拽图片可自定义排序。</view> ><span style="color: red">*&nbsp;</span> 公司资质证件
<uni-file-picker limit="9" :value="pageData.cersImageArr" ref="uploadCersRef" :auto-upload="false" @select="handleUpload($event,'cers')" @delete="handleDelete($event,'cers')"/> </view>
<view class="mb-1 flex justify-start" style="font-size: 24rpx; color: #cccccc"
>前6张资质证件将展示在详情页,拖拽图片可自定义排序。</view
>
<uni-file-picker
limit="9"
:value="pageData.cersImageArr"
ref="uploadCersRef"
:auto-upload="false"
@select="handleUpload($event, 'cers')"
@delete="handleDelete($event, 'cers')"
/>
</view> </view>
<view class="fui-clause--cell fui-clause--wrap"> <view class="fui-clause--cell fui-clause--wrap">
<fui-label> <fui-label>
<view class="fui-clause--cell"> <view class="fui-clause--cell">
<fui-checkbox :scaleRatio="0.8" @change="agreeChange"></fui-checkbox> <fui-checkbox :scaleRatio="0.8" @change="agreeChange" />
<text class="fui-clause--text">我已阅读并同意</text> <text class="fui-clause--text">我已阅读并同意</text>
</view> </view>
</fui-label> </fui-label>
...@@ -335,14 +427,20 @@ ...@@ -335,14 +427,20 @@
<fui-bottom-popup :show="show.area"> <fui-bottom-popup :show="show.area">
<view class="fui-scroll__wrap"> <view class="fui-scroll__wrap">
<view class="fui-title">请选择</view> <view class="fui-title">请选择</view>
<fui-cascader ref="areaPopupRef" :value="pageData.options.areaVal" stepLoading @change="changeArea" @complete="selectCompleteArea" :options="pageData.options.area"></fui-cascader> <fui-cascader
<view class="fui-icon__close" @tap.stop="pageData.show.area=false"> ref="areaPopupRef"
<fui-icon name="close" :size="48"></fui-icon> :value="pageData.options.areaVal"
stepLoading
@change="changeArea"
@complete="selectCompleteArea"
:options="pageData.options.area"
/>
<view class="fui-icon__close" @tap.stop="pageData.show.area = false">
<fui-icon name="close" :size="48" />
</view> </view>
</view> </view>
</fui-bottom-popup> </fui-bottom-popup>
<fui-toast ref="toastRef" /> <fui-toast ref="toastRef" />
<fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)" /> <fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)" />
</template> </template>
...@@ -523,14 +621,12 @@ ...@@ -523,14 +621,12 @@
font-size: 28rpx; font-size: 28rpx;
} }
.fui-clause--cell { .fui-clause--cell {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
font-size: 24rpx; font-size: 24rpx;
color:#999999; color: #999999;
} }
.fui-clause--wrap { .fui-clause--wrap {
width: 100%; width: 100%;
...@@ -543,14 +639,14 @@ ...@@ -543,14 +639,14 @@
/* #endif */ /* #endif */
} }
.fui-color__link { .fui-color__link {
color: #5FB771; color: #5fb771;
/* #ifdef H5 */ /* #ifdef H5 */
cursor: pointer; cursor: pointer;
/* #endif */ /* #endif */
} }
.fui-color__link:active { .fui-color__link:active {
opacity: .5; opacity: 0.5;
} }
.fui-scroll__wrap { .fui-scroll__wrap {
padding-top: 30rpx; padding-top: 30rpx;
......
...@@ -15,21 +15,22 @@ ...@@ -15,21 +15,22 @@
const videoList = ref([]) const videoList = ref([])
function getVideoList(params) { function getVideoList(params) {
if (model.loading) return if (model.loading)
return
model.loading = true model.loading = true
videoApi.getList(params).then((res) => { videoApi.getList(params).then((res) => {
if (res.records.length > 0) { if (res.records.length > 0) {
const { records } = res; const { records } = res
let scale:any = 0; let scale: any = 0
for(let i = 0; i < records.length;i++){ for (let i = 0; i < records.length; i++) {
if(records[i].width){ if (records[i].width) {
scale = (340 / records[i].width).toFixed(1); scale = (340 / records[i].width).toFixed(1)
records[i].videoWidth = 340; records[i].videoWidth = 340
records[i].videoHeight = Math.floor(records[i].height * scale); records[i].videoHeight = Math.floor(records[i].height * scale)
}else{ } else {
records[i].videoWidth = 0; records[i].videoWidth = 0
records[i].videoHeight = 0; records[i].videoHeight = 0
} }
} }
......
...@@ -73,8 +73,25 @@ ...@@ -73,8 +73,25 @@
</view> </view>
<view class="text-left"> <view class="text-left">
<fui-form ref="formRef"> <fui-form ref="formRef">
<fui-input marginTop="30" size="28" placeholder="请填写姓名" v-model="pageData.form.reservedname" required maxlength="16" placeholderStyle="margin-left: 10rpx"/> <fui-input
<fui-input marginTop="30" size="28" placeholder="请填写预留手机" v-model="pageData.form.reservedmobile" required type="number" maxlength="11" placeholderStyle="margin-left: 10rpx"/> marginTop="30"
size="28"
placeholder="请填写姓名"
v-model="pageData.form.reservedname"
required
maxlength="16"
placeholderStyle="margin-left: 10rpx"
/>
<fui-input
marginTop="30"
size="28"
placeholder="请填写预留手机"
v-model="pageData.form.reservedmobile"
required
type="number"
maxlength="11"
placeholderStyle="margin-left: 10rpx"
/>
<view style="margin-top: 30rpx"> <view style="margin-top: 30rpx">
<fui-button text="提交" bold radius="96rpx" @click="submit" /> <fui-button text="提交" bold radius="96rpx" @click="submit" />
</view> </view>
......
<!-- 农场详情 --> <!-- 农场详情 -->
<script setup lang="ts"> <script setup lang="ts">
import RegisterDialog from './register-dialog.vue' import * as turf from '@turf/turf'
import * as turf from '@turf/turf' import RegisterDialog from './register-dialog.vue'
import type { Page } from './config' import type { Page } from './config'
import Navigate from '@/utils/page/navigate' import Navigate from '@/utils/page/navigate'
import { import { flyTo, useMapbox } from '@/components/Map/Mapbox/hook'
addDefaultGeoJSONSource, import { getText } from '@/utils/dict/area'
addDefaultSplotLayer, import * as LinghuoyonggongAPI from '@/api/model/linghuoyonggong'
addDefaultSymbolLayer,
useMapbox, // 页面参数
flyTo, const page = reactive<Page>({
} from '@/components/Map/Mapbox/hook'
import { getText } from '@/utils/dict/area'
import * as LinghuoyonggongAPI from '@/api/model/linghuoyonggong'
// 页面参数
const page = reactive<Page>({
id: 'example-mapbox', id: 'example-mapbox',
init: false, init: false,
requests: 0, requests: 0,
latest: null, latest: null,
query: {}, query: {},
}) })
const model = reactive({ const model = reactive({
id: '', id: '',
name: '', name: '',
lonlat: `${uni.getStorageSync('location').lon},${uni.getStorageSync('location').lat}`, lonlat: `${uni.getStorageSync('location').lon},${uni.getStorageSync('location').lat}`,
...@@ -34,10 +28,10 @@ const model = reactive({ ...@@ -34,10 +28,10 @@ const model = reactive({
// 设备信息 // 设备信息
devices: [], devices: [],
employmentId:null, employmentId: null,
showConfirmDialog:false, showConfirmDialog: false,
contactName:"", contactName: '',
contactMobile:"", contactMobile: '',
// 分类标签 // 分类标签
categoryTabs: [ categoryTabs: [
...@@ -70,24 +64,24 @@ const model = reactive({ ...@@ -70,24 +64,24 @@ const model = reactive({
// 标记点击事件是否已绑定 // 标记点击事件是否已绑定
clickEventBound: false, clickEventBound: false,
// 用于区分是哪个模块进的 // 用于区分是哪个模块进的
currentEmploymentId:1, currentEmploymentId: 1,
}) })
onLoad((options) => { onLoad((options) => {
model.id = options.id; model.id = options.id
model.currentEmploymentId = options.currentEmploymentId; model.currentEmploymentId = options.currentEmploymentId
model.name = decodeURIComponent(options.name) model.name = decodeURIComponent(options.name)
model.search.pageNo = 1 model.search.pageNo = 1
model.search.publishstatu = 1 model.search.publishstatu = 1
model.search.createBy = '' model.search.createBy = ''
model.employmentList = [] model.employmentList = []
getEmploymentList() getEmploymentList()
}) })
// 地图组件 // 地图组件
const center: [number, number] = [uni.getStorageSync('location').lon, uni.getStorageSync('location').lat] const center: [number, number] = [uni.getStorageSync('location').lon, uni.getStorageSync('location').lat]
const registerDialogRef = ref() const registerDialogRef = ref()
const [registerMap, map] = useMapbox({ const [registerMap, map] = useMapbox({
style: { center, zoom: 10 }, style: { center, zoom: 10 },
onLoaded: (data) => { onLoaded: (data) => {
// 渲染用户当前位置 // 渲染用户当前位置
...@@ -107,33 +101,35 @@ const [registerMap, map] = useMapbox({ ...@@ -107,33 +101,35 @@ const [registerMap, map] = useMapbox({
if (event.type === 'custom' && event.name === 'navigateToDetail') { if (event.type === 'custom' && event.name === 'navigateToDetail') {
console.log('接收到导航事件,id:', event) console.log('接收到导航事件,id:', event)
// Navigate.to(`/pages/linghuoyonggong/detail/index?id=${event.data}`) // Navigate.to(`/pages/linghuoyonggong/detail/index?id=${event.data}`)
if(model.currentEmploymentId == 2){ if (model.currentEmploymentId == 2) {
model.employmentId = event.data; model.employmentId = event.data
getLaborAppDetail(); getLaborAppDetail()
}else{ } else {
registerDialogRef.value.open({ id: event.data }) registerDialogRef.value.open({ id: event.data })
} }
} }
} },
}) })
async function getLaborAppDetail() { async function getLaborAppDetail() {
await LinghuoyonggongAPI.getLaborAppDetail({ id: model.employmentId }).then((res) => { await LinghuoyonggongAPI.getLaborAppDetail({ id: model.employmentId }).then((res) => {
model.contactMobile = res.contactMobile; model.contactMobile = res.contactMobile
model.contactName = res.contactName.substring(0,1) + new Array(res.contactName.length).join('*'); model.contactName =
model.showConfirmDialog = true; res.contactName.substring(0, 1) + Array.from({ length: res.contactName.length }).join('*')
model.showConfirmDialog = true
}) })
} }
function makePhoneCall(){ function makePhoneCall() {
uni.makePhoneCall({ uni.makePhoneCall({
phoneNumber: model.contactMobile phoneNumber: model.contactMobile,
}); })
} }
// 创建弹框HTML内容 // 创建弹框HTML内容
function createPopupHTML(employment) { function createPopupHTML(employment) {
if (!employment) return '' if (!employment)
return ''
if(model.currentEmploymentId == 2){ if (model.currentEmploymentId == 2) {
return ` return `
<div style="width: 220px;background:#FFFFFF;padding: 12px;display: flex;flex-direction: column;"> <div style="width: 220px;background:#FFFFFF;padding: 12px;display: flex;flex-direction: column;">
<div style="display: flex;justify-content: space-between;line-height: 20px;"> <div style="display: flex;justify-content: space-between;line-height: 20px;">
...@@ -149,7 +145,7 @@ function createPopupHTML(employment) { ...@@ -149,7 +145,7 @@ function createPopupHTML(employment) {
</div> </div>
<div style="color: #999999;margin-top: 4px;line-height: 18px;font-size: 12px;display: flex;align-items: center;"> <div style="color: #999999;margin-top: 4px;line-height: 18px;font-size: 12px;display: flex;align-items: center;">
<image style="width:11px;height:13px;margin-right:7px;" src="./static/images/linghuoyonggong/skill.png" /> <image style="width:11px;height:13px;margin-right:7px;" src="./static/images/linghuoyonggong/skill.png" />
<div>技能:${employment.skills.length ? employment.skills.join("、") : '未填写'}</div> <div>技能:${employment.skills.length ? employment.skills.join('、') : '未填写'}</div>
</div> </div>
<div style="color: #999999;margin-top: 4px;line-height: 18px;font-size: 12px;display: flex;align-items: center;"> <div style="color: #999999;margin-top: 4px;line-height: 18px;font-size: 12px;display: flex;align-items: center;">
<image style="width:11px;height:13px;margin-right:7px;" src="./static/images/linghuoyonggong/address.png" /> <image style="width:11px;height:13px;margin-right:7px;" src="./static/images/linghuoyonggong/address.png" />
...@@ -157,8 +153,8 @@ function createPopupHTML(employment) { ...@@ -157,8 +153,8 @@ function createPopupHTML(employment) {
</div> </div>
<a href="#" onclick="window.navigateToDetail('${employment.id}'); return false;" style="margin-top:8px;background: #5DB66F;text-decoration: none;border-radius: 200px;padding: 10px;text-align: center;color: #FFFFFF;font-size: 12px;display: flex;justify-content: center;align-items: center;">电话沟通</a> <a href="#" onclick="window.navigateToDetail('${employment.id}'); return false;" style="margin-top:8px;background: #5DB66F;text-decoration: none;border-radius: 200px;padding: 10px;text-align: center;color: #FFFFFF;font-size: 12px;display: flex;justify-content: center;align-items: center;">电话沟通</a>
</div> </div>
`; `
}else{ } else {
const distance = getDistanceText(employment) const distance = getDistanceText(employment)
const stars = getStarsHTML(employment) const stars = getStarsHTML(employment)
return ` return `
...@@ -236,11 +232,10 @@ function createPopupHTML(employment) { ...@@ -236,11 +232,10 @@ function createPopupHTML(employment) {
</div> </div>
` `
} }
}
} // 渲染用户位置
function renderUserLocation() {
// 渲染用户位置
function renderUserLocation() {
const markerId = `my-local` const markerId = `my-local`
// 修复 App 端图片路径问题 // 修复 App 端图片路径问题
const imageUrl = '/static/images/local-map.png' const imageUrl = '/static/images/local-map.png'
...@@ -262,10 +257,10 @@ function renderUserLocation() { ...@@ -262,10 +257,10 @@ function renderUserLocation() {
finalImageUrl, // 自定义图标图片URL finalImageUrl, // 自定义图标图片URL
iconSize, // 图标大小 iconSize, // 图标大小
) )
} }
// 渲染用工标记 // 渲染用工标记
function renderEmploymentMarkers() { function renderEmploymentMarkers() {
if (!map) { if (!map) {
console.warn('地图未初始化') console.warn('地图未初始化')
return return
...@@ -274,15 +269,16 @@ function renderEmploymentMarkers() { ...@@ -274,15 +269,16 @@ function renderEmploymentMarkers() {
console.log('渲染用工标记数量:', model.employmentList.length) console.log('渲染用工标记数量:', model.employmentList.length)
console.log('用工数据:', model.employmentList) console.log('用工数据:', model.employmentList)
let longitude = null,latitude = null; let longitude = null
let latitude = null
// 使用 Marker 方式渲染带自定义图标的标记 // 使用 Marker 方式渲染带自定义图标的标记
model.employmentList.forEach((item) => { model.employmentList.forEach((item) => {
if(model.currentEmploymentId == 2){ if (model.currentEmploymentId == 2) {
longitude = item.lon; longitude = item.lon
latitude = item.lat; latitude = item.lat
}else{ } else {
longitude = item.longitude; longitude = item.longitude
latitude = item.latitude; latitude = item.latitude
} }
if (longitude && latitude) { if (longitude && latitude) {
const markerId = `employment-marker-${item.id}` const markerId = `employment-marker-${item.id}`
...@@ -314,24 +310,24 @@ function renderEmploymentMarkers() { ...@@ -314,24 +310,24 @@ function renderEmploymentMarkers() {
console.log('标记点击事件已绑定') console.log('标记点击事件已绑定')
model.clickEventBound = true model.clickEventBound = true
} }
} }
// 分类标签点击事件 // 分类标签点击事件
function onCategoryTabClick(tab: any) { function onCategoryTabClick(tab: any) {
model.search.type = tab.id model.search.type = tab.id
model.search.pageNo = 1 model.search.pageNo = 1
model.employmentList = [] model.employmentList = []
getEmploymentList() getEmploymentList()
// 在这里添加具体的分类标签点击逻辑 // 在这里添加具体的分类标签点击逻辑
} }
async function getEmploymentList() { async function getEmploymentList() {
// 如果正在加载或没有更多数据,直接返回 // 如果正在加载或没有更多数据,直接返回
if (model.loading || (model.total > 0 && model.employmentList.length >= model.total)) { if (model.loading || (model.total > 0 && model.employmentList.length >= model.total)) {
return return
} }
model.loading = true model.loading = true
try { try {
if(model.currentEmploymentId == 2){ if (model.currentEmploymentId == 2) {
await LinghuoyonggongAPI.getLaborAppList(model.search).then(async (res) => { await LinghuoyonggongAPI.getLaborAppList(model.search).then(async (res) => {
const { records, total } = res const { records, total } = res
// 批量处理数据,避免多次DOM操作 // 批量处理数据,避免多次DOM操作
...@@ -359,14 +355,14 @@ async function getEmploymentList() { ...@@ -359,14 +355,14 @@ async function getEmploymentList() {
model.total = total model.total = total
// 数据加载完成后渲染地图标记 // 数据加载完成后渲染地图标记
setTimeout(()=>{ setTimeout(() => {
renderEmploymentMarkers(); renderEmploymentMarkers()
},600) }, 600)
/* nextTick(() => { /* nextTick(() => {
renderEmploymentMarkers() renderEmploymentMarkers()
}) */ }) */
}) })
}else{ } else {
await LinghuoyonggongAPI.employmentList(model.search).then(async (res) => { await LinghuoyonggongAPI.employmentList(model.search).then(async (res) => {
const { records, total } = res const { records, total } = res
// 批量处理数据,避免多次DOM操作 // 批量处理数据,避免多次DOM操作
...@@ -394,9 +390,9 @@ async function getEmploymentList() { ...@@ -394,9 +390,9 @@ async function getEmploymentList() {
model.total = total model.total = total
// 数据加载完成后渲染地图标记 // 数据加载完成后渲染地图标记
setTimeout(()=>{ setTimeout(() => {
renderEmploymentMarkers(); renderEmploymentMarkers()
},600) }, 600)
/* nextTick(() => { /* nextTick(() => {
renderEmploymentMarkers() renderEmploymentMarkers()
}) */ }) */
...@@ -410,10 +406,10 @@ async function getEmploymentList() { ...@@ -410,10 +406,10 @@ async function getEmploymentList() {
model.loading = false model.loading = false
model.requestDebounce = null model.requestDebounce = null
} }
} }
// 获取时间差 // 获取时间差
function getDaysDiff(date1: Date | number | string, date2: Date | number | string): number { function getDaysDiff(date1: Date | number | string, date2: Date | number | string): number {
// 将输入转换为Date对象 // 将输入转换为Date对象
const d1 = new Date(date1) const d1 = new Date(date1)
const d2 = new Date(date2) const d2 = new Date(date2)
...@@ -434,10 +430,10 @@ function getDaysDiff(date1: Date | number | string, date2: Date | number | strin ...@@ -434,10 +430,10 @@ function getDaysDiff(date1: Date | number | string, date2: Date | number | strin
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)) const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24))
return diffDays return diffDays
} }
// 回到当前位置 // 回到当前位置
function backToUserLocation() { function backToUserLocation() {
if (map && model.userLocation.longitude && model.userLocation.latitude) { if (map && model.userLocation.longitude && model.userLocation.latitude) {
flyTo(map, [model.userLocation.longitude, model.userLocation.latitude], 15, 0.5) flyTo(map, [model.userLocation.longitude, model.userLocation.latitude], 15, 0.5)
uni.showToast({ uni.showToast({
...@@ -480,15 +476,15 @@ function backToUserLocation() { ...@@ -480,15 +476,15 @@ function backToUserLocation() {
}, },
}) })
} }
} }
// 关闭弹框 // 关闭弹框
function closeEmploymentPopup() { function closeEmploymentPopup() {
model.showEmploymentPopup = false model.showEmploymentPopup = false
model.selectedEmployment = null model.selectedEmployment = null
} }
// 计算距离显示 // 计算距离显示
function getDistanceText2(item) { function getDistanceText2(item) {
if (!item || !item.lon || !model.userLocation.longitude) { if (!item || !item.lon || !model.userLocation.longitude) {
return '未知' return '未知'
} }
...@@ -498,12 +494,12 @@ function getDistanceText2(item) { ...@@ -498,12 +494,12 @@ function getDistanceText2(item) {
const distance = turf.distance(from, to, { units: 'kilometers' }) const distance = turf.distance(from, to, { units: 'kilometers' })
if (distance < 1) { if (distance < 1) {
return `${Math.round(distance * 1000)}m`; return `${Math.round(distance * 1000)}m`
}
return `${distance.toFixed(1)}km`
} }
return `${distance.toFixed(1)}km`; // 计算距离显示
} function getDistanceText(employment) {
// 计算距离显示
function getDistanceText(employment) {
if (!employment || !employment.longitude || !employment.latitude) { if (!employment || !employment.longitude || !employment.latitude) {
return '未知' return '未知'
} }
...@@ -516,10 +512,10 @@ function getDistanceText(employment) { ...@@ -516,10 +512,10 @@ function getDistanceText(employment) {
return `${Math.round(distance * 1000)}m` return `${Math.round(distance * 1000)}m`
} }
return `${distance.toFixed(1)}km` return `${distance.toFixed(1)}km`
} }
// 生成星级HTML // 生成星级HTML
function getStarsHTML(employment) { function getStarsHTML(employment) {
// 获取紧急程度,默认为0 // 获取紧急程度,默认为0
const urgentdegree = Number(employment.urgentdegree) || 0 const urgentdegree = Number(employment.urgentdegree) || 0
// 确保评级在0-5之间 // 确保评级在0-5之间
...@@ -536,23 +532,23 @@ function getStarsHTML(employment) { ...@@ -536,23 +532,23 @@ function getStarsHTML(employment) {
return { return {
html, html,
rating rating,
}
} }
} // 发布用工
// 发布用工 function handlePublish() {
function handlePublish() { if (model.currentEmploymentId == 2) {
if(model.currentEmploymentId == 2){
Navigate.to('/pages/linghuoyonggong/publishEmployment') Navigate.to('/pages/linghuoyonggong/publishEmployment')
}else{ } else {
Navigate.to('/pages/linghuoyonggong/form') Navigate.to('/pages/linghuoyonggong/form')
} }
} }
onNavigationBarButtonTap((e) => { onNavigationBarButtonTap((e) => {
console.log(e) console.log(e)
if (e.index === 0) { if (e.index === 0) {
Navigate.to('/pages/linghuoyonggong/linghuoyonggong') Navigate.to('/pages/linghuoyonggong/linghuoyonggong')
} }
}) })
</script> </script>
<template> <template>
...@@ -596,7 +592,7 @@ onNavigationBarButtonTap((e) => { ...@@ -596,7 +592,7 @@ onNavigationBarButtonTap((e) => {
<!-- 回到当前位置按钮 --> <!-- 回到当前位置按钮 -->
<view class="location-control" @click="backToUserLocation"> <view class="location-control" @click="backToUserLocation">
<view class="location-button"> <view class="location-button">
<image src="/static/images/toLocal.png" style="width: 58rpx; height: 58rpx"></image> <image src="/static/images/toLocal.png" style="width: 58rpx; height: 58rpx" />
<!-- <fui-icon name="location" color="#5DB66F" :size="36" /> --> <!-- <fui-icon name="location" color="#5DB66F" :size="36" /> -->
</view> </view>
</view> </view>
...@@ -621,8 +617,8 @@ onNavigationBarButtonTap((e) => { ...@@ -621,8 +617,8 @@ onNavigationBarButtonTap((e) => {
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
// //
.page { .page {
min-height: 100vh; min-height: 100vh;
background: #e6f5e8; background: #e6f5e8;
...@@ -714,17 +710,17 @@ onNavigationBarButtonTap((e) => { ...@@ -714,17 +710,17 @@ onNavigationBarButtonTap((e) => {
} }
} }
} }
} }
::v-deep .mapboxgl-popup { ::v-deep .mapboxgl-popup {
max-width: 568rpx !important; max-width: 568rpx !important;
} }
::v-deep .fui-fab__btn-main { ::v-deep .fui-fab__btn-main {
background: linear-gradient(124.25deg, #a5d63f 0%, #5db66f 100%) !important; background: linear-gradient(124.25deg, #a5d63f 0%, #5db66f 100%) !important;
box-shadow: 0px 1px 8px #5db66f; box-shadow: 0px 1px 8px #5db66f;
} }
::v-deep .mapboxgl-popup a { ::v-deep .mapboxgl-popup a {
outline: none !important; outline: none !important;
-webkit-tap-highlight-color: transparent !important; -webkit-tap-highlight-color: transparent !important;
-webkit-touch-callout: none !important; -webkit-touch-callout: none !important;
} }
</style> </style>
<script setup lang="ts"> <script setup lang="ts">
import { reactive, toRefs } from 'vue' import { reactive } from 'vue'
import { onLoad, onShow } from '@dcloudio/uni-app' import { onLoad } from '@dcloudio/uni-app'
import { getCalculateAge } from '@/utils/date' import { getCalculateAge } from '@/utils/date'
import * as LinghuoyonggongAPI from '@/api/model/linghuoyonggong'; import * as LinghuoyonggongAPI from '@/api/model/linghuoyonggong'
import ConfirmDialog from '@/components/ConfirmDialog/index.vue' import ConfirmDialog from '@/components/ConfirmDialog/index.vue'
const pageData = reactive({ const pageData = reactive({
loading: false, loading: false,
workersParam:[], workersParam: [],
contactMobile:"", contactMobile: '',
contactName:"", contactName: '',
showConfirmDialog:false, showConfirmDialog: false,
}) })
// 字典值 // 字典值
const DictData = reactive({ const DictData = reactive({
sexArr:[],// 性别 sexArr: [], // 性别
educationArr:[]// 学历 educationArr: [], // 学历
}) })
onLoad((options) => { onLoad((options) => {
let param = JSON.parse(decodeURIComponent(options.param)); const param = JSON.parse(decodeURIComponent(options.param))
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: param.villageName title: param.villageName,
}); })
getLaborAppDetail(param.id); getLaborAppDetail(param.id)
}) })
async function getLaborAppDetail(id: string) { async function getLaborAppDetail(id: string) {
await LinghuoyonggongAPI.gitListByCodeDict({ code : 'sex'}).then(res=>{ await LinghuoyonggongAPI.gitListByCodeDict({ code: 'sex' }).then((res) => {
DictData.sexArr = res; DictData.sexArr = res
}) })
await LinghuoyonggongAPI.gitListByCodeDict({ code : 'education'}).then(res=>{ await LinghuoyonggongAPI.gitListByCodeDict({ code: 'education' }).then((res) => {
DictData.educationArr = res; DictData.educationArr = res
}) })
await LinghuoyonggongAPI.getLaborAppDetail({ id }).then((res) => { await LinghuoyonggongAPI.getLaborAppDetail({ id }).then((res) => {
pageData.workersParam = res.workers; pageData.workersParam = res.workers
pageData.contactMobile = res.contactMobile; pageData.contactMobile = res.contactMobile
pageData.contactName = res.contactName.substring(0,1) + new Array(res.contactName.length).join('*'); pageData.contactName =
res.contactName.substring(0, 1) + Array.from({ length: res.contactName.length }).join('*')
}) })
} }
// 返回字典中的中文值 // 返回字典中的中文值
function returnDictZhVel(type:any,val:any){ function returnDictZhVel(type: any, val: any) {
let valText = ""; let valText = ''
if(type == 'gender'){ if (type == 'gender') {
let arr = DictData.sexArr; const arr = DictData.sexArr
for(let i = 0; i < arr.length;i++){ for (let i = 0; i < arr.length; i++) {
if(val == parseInt(arr[i].itemValue)){ if (val == Number.parseInt(arr[i].itemValue)) {
valText = arr[i].itemText; valText = arr[i].itemText
break; break
} }
} }
} }
if(type == 'edu'){ if (type == 'edu') {
let arr = DictData.educationArr; const arr = DictData.educationArr
for(let i = 0; i < arr.length;i++){ for (let i = 0; i < arr.length; i++) {
if(val == parseInt(arr[i].itemValue)){ if (val == Number.parseInt(arr[i].itemValue)) {
valText = arr[i].itemText; valText = arr[i].itemText
break; break
} }
} }
} }
return valText; return valText
} }
function makePhoneCall(){ function makePhoneCall() {
uni.makePhoneCall({ uni.makePhoneCall({
phoneNumber: pageData.contactMobile phoneNumber: pageData.contactMobile,
}); })
} }
</script> </script>
...@@ -73,16 +74,22 @@ ...@@ -73,16 +74,22 @@
<view v-if="!pageData.workersParam || pageData.workersParam.length == 0" style="height: 700rpx"> <view v-if="!pageData.workersParam || pageData.workersParam.length == 0" style="height: 700rpx">
<fui-empty marginTop="100" src="/static/images/no-data.png" title="暂无数据" /> <fui-empty marginTop="100" src="/static/images/no-data.png" title="暂无数据" />
</view> </view>
<view class="yr-person-item" v-for="(item,index) in pageData.workersParam" :key="index"> <view class="yr-person-item" v-for="(item, index) in pageData.workersParam" :key="index">
<view class="yr-person-info"> <view class="yr-person-info">
<view class="person_name_attr">{{item.name}}<text class="person_attr">{{item.attr}}</text></view> <view class="person_name_attr"
<view class="person-info">{{getCalculateAge(item.birthday)}}{{ returnDictZhVel('gender',item.gender) }}{{ returnDictZhVel('edu',item.edu)}}</view> >{{ item.name }}<text class="person_attr">{{ item.attr }}</text></view
<view class="person-info text_overflow_ellipsis">技能:{{item.skill}}</view> >
<view class="person-info"
>{{ getCalculateAge(item.birthday) }}{{ returnDictZhVel('gender', item.gender) }}{{
returnDictZhVel('edu', item.edu)
}}</view
>
<view class="person-info text_overflow_ellipsis">技能:{{ item.skill }}</view>
</view> </view>
</view> </view>
</view> </view>
<view v-if="pageData.workersParam.length" class="make-phone-view"> <view v-if="pageData.workersParam.length" class="make-phone-view">
<fui-button text="电话沟通" bold radius="96rpx" @click="pageData.showConfirmDialog = true" height="80rpx"/> <fui-button text="电话沟通" bold radius="96rpx" @click="pageData.showConfirmDialog = true" height="80rpx" />
</view> </view>
<!-- 确认对话框 --> <!-- 确认对话框 -->
<ConfirmDialog <ConfirmDialog
...@@ -98,35 +105,35 @@ ...@@ -98,35 +105,35 @@
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.details_page{ .details_page {
background: rgba(230, 245, 232, 1); background: rgba(230, 245, 232, 1);
min-height: 100vh; min-height: 100vh;
width: 750rpx; width: 750rpx;
padding-top: 24rpx; padding-top: 24rpx;
position: relative; position: relative;
.details-content{ .details-content {
width: 694rpx; width: 694rpx;
background-color: #FFFFFF; background-color: #ffffff;
margin-left: 28rpx; margin-left: 28rpx;
border-radius: 12rpx; border-radius: 12rpx;
padding: 24rpx; padding: 24rpx;
.yr-person-item{ .yr-person-item {
border-bottom: 2rpx solid #EEEEEE; border-bottom: 2rpx solid #eeeeee;
margin-bottom: 24rpx; margin-bottom: 24rpx;
.yr-person-info{ .yr-person-info {
.person_name_attr{ .person_name_attr {
font-size: 28rpx; font-size: 28rpx;
font-weight: 500; font-weight: 500;
color: #333333; color: #333333;
.person_attr{ .person_attr {
font-size: 24rpx; font-size: 24rpx;
font-weight: 400; font-weight: 400;
color: #5DB66F; color: #5db66f;
margin-left: 12rpx; margin-left: 12rpx;
} }
} }
.person-info{ .person-info {
font-size: 24rpx; font-size: 24rpx;
color: #999999; color: #999999;
vertical-align: middle; vertical-align: middle;
...@@ -135,17 +142,17 @@ ...@@ -135,17 +142,17 @@
} }
} }
} }
.yr-person-item:last-child{ .yr-person-item:last-child {
border-bottom: none; border-bottom: none;
} }
} }
.make-phone-view{ .make-phone-view {
width: 690rpx; width: 690rpx;
height: 80rpx; height: 80rpx;
position: fixed; position: fixed;
left: 30rpx; left: 30rpx;
bottom: 62rpx; bottom: 62rpx;
} }
} }
</style> </style>
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
import { useGlobSetting } from '/@/hooks/setting' import { useGlobSetting } from '/@/hooks/setting'
import * as LinghuoyonggongAPI from '@/api/model/linghuoyonggong' import * as LinghuoyonggongAPI from '@/api/model/linghuoyonggong'
import * as UserInfoAPI from '@/api/model/userInfo' import * as UserInfoAPI from '@/api/model/userInfo'
import { areaTree, getCodeByText, getTextByCode } from '@/utils/areaData' import { getCodeByText } from '@/utils/areaData'
import { useDictStore } from '@/store/modules/dict' import { useDictStore } from '@/store/modules/dict'
import { getDictData, getText } from '@/utils/dict/area' import { getDictData, getText } from '@/utils/dict/area'
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
picture: null, picture: null,
pictureObj: null, pictureObj: null,
longitude: '', longitude: '',
latitude: '' latitude: '',
}, },
position: [], position: [],
rules: [ rules: [
...@@ -70,43 +70,53 @@ ...@@ -70,43 +70,53 @@
name: 'type', name: 'type',
rule: ['required'], rule: ['required'],
msg: ['请选择用工类型'], msg: ['请选择用工类型'],
},{ },
{
name: 'name', name: 'name',
rule: ['required'], rule: ['required'],
msg: ['请输入标题'], msg: ['请输入标题'],
}, { },
{
name: 'workers', name: 'workers',
rule: ['required'], rule: ['required'],
msg: ['请输入工人数量'], msg: ['请输入工人数量'],
}, { },
{
name: 'price', name: 'price',
rule: ['required'], rule: ['required'],
msg: ['请输入用工单价'], msg: ['请输入用工单价'],
}, { },
{
name: 'starttime', name: 'starttime',
rule: ['required'], rule: ['required'],
msg: ['请选择开始时间'], msg: ['请选择开始时间'],
}, { },
{
name: 'estimatedendtime', name: 'estimatedendtime',
rule: ['required'], rule: ['required'],
msg: ['请选择预计结束时间'], msg: ['请选择预计结束时间'],
}, { },
{
name: 'content', name: 'content',
rule: ['required'], rule: ['required'],
msg: ['请输入工作内容'], msg: ['请输入工作内容'],
}, { },
{
name: 'area', name: 'area',
rule: ['required'], rule: ['required'],
msg: ['请选择地区'], msg: ['请选择地区'],
}, { },
{
name: 'address', name: 'address',
rule: ['required'], rule: ['required'],
msg: ['请输入详细地址'], msg: ['请输入详细地址'],
}, { },
{
name: 'urgentdegree', name: 'urgentdegree',
rule: ['required'], rule: ['required'],
msg: ['请选择紧急程度'], msg: ['请选择紧急程度'],
}, { },
{
name: 'picture', name: 'picture',
rule: ['required'], rule: ['required'],
msg: ['请上传图片'], msg: ['请上传图片'],
...@@ -134,7 +144,7 @@ ...@@ -134,7 +144,7 @@
function getCurrentAddressInfo() { function getCurrentAddressInfo() {
if (!uni.getStorageSync('location')) if (!uni.getStorageSync('location'))
return return
const { lon, lat } = uni.getStorageSync('location') const { lon, lat } = uni.getStorageSync('location')
pageData.position = [lon, lat] pageData.position = [lon, lat]
...@@ -276,7 +286,7 @@ ...@@ -276,7 +286,7 @@
}) })
} }
function getCurrentDate(){ function getCurrentDate() {
const date = new Date() const date = new Date()
const year = date.getFullYear() const year = date.getFullYear()
const month = date.getMonth() + 1 const month = date.getMonth() + 1
...@@ -290,15 +300,60 @@ ...@@ -290,15 +300,60 @@
<view class="formBox"> <view class="formBox">
<fui-form ref="formRef" label-weight="auto" top="60" :disabled="form.id ? true : false"> <fui-form ref="formRef" label-weight="auto" top="60" :disabled="form.id ? true : false">
<view class="mt20"> <view class="mt20">
<fui-input disabled required label="用工类型" placeholder="请选择用工类型" v-model="form.typeText" labelSize="28" size="28" label-width="180" @click="show.type = true" /> <fui-input
<fui-input required label="标题" placeholder="请输入标题" v-model="form.name" labelSize="28" label-width="180" maxlength="16" size="28"/> disabled
required
label="用工类型"
placeholder="请选择用工类型"
v-model="form.typeText"
labelSize="28"
size="28"
label-width="180"
@click="show.type = true"
/>
<fui-input
required
label="标题"
placeholder="请输入标题"
v-model="form.name"
labelSize="28"
label-width="180"
maxlength="16"
size="28"
/>
</view> </view>
<view class="mt20"> <view class="mt20">
<fui-input required type="number" :min="0" label="工人数量" placeholder="请输入工人数量" v-model="form.workers" labelSize="28" label-width="180" maxlength="4" size="28"> <fui-input
<view slot="suffix" class="unit-slot"></view> required
type="number"
:min="0"
label="工人数量"
placeholder="请输入工人数量"
v-model="form.workers"
labelSize="28"
label-width="180"
maxlength="4"
size="28"
>
<template #suffix>
<view class="unit-slot"></view>
</template>
</fui-input> </fui-input>
<fui-input required type="number" label="用工单价" :min="0" placeholder="请输入用工单价" v-model="form.price" labelSize="28" label-width="180" maxlength="6" size="28"> <fui-input
<view slot="suffix" class="unit-slot">元/人</view> required
type="number"
label="用工单价"
:min="0"
placeholder="请输入用工单价"
v-model="form.price"
labelSize="28"
label-width="180"
maxlength="6"
size="28"
>
<template #suffix>
<view class="unit-slot">元/人</view>
</template>
</fui-input> </fui-input>
<!-- 时间范围 --> <!-- 时间范围 -->
<view class="form-section" style="padding: 0 30rpx"> <view class="form-section" style="padding: 0 30rpx">
...@@ -319,16 +374,62 @@ ...@@ -319,16 +374,62 @@
</view> </view>
</view> </view>
</view> </view>
<fui-input required label="工作内容" placeholder="请输入工作内容" v-model="form.content" labelSize="28" label-width="180" maxlength="32" size="28" /> <fui-input
required
label="工作内容"
placeholder="请输入工作内容"
v-model="form.content"
labelSize="28"
label-width="180"
maxlength="32"
size="28"
/>
</view> </view>
<view class="mt20"> <view class="mt20">
<fui-input disabled required label="地区" placeholder="请选择地区" v-model="form.areaText" labelSize="28" label-width="180" @click="show.area = true" size="28"/> <fui-input
<fui-input required label="详细地址" placeholder="请输入详细地址" v-model="form.address" labelSize="28" label-width="180" size="28"/> disabled
<fui-input disabled required label="紧急程度" placeholder="请选择紧急程度" v-model="form.urgentdegreeText" labelSize="28" label-width="180" size="28" @click="show.urgentdegree = true" /> required
label="地区"
placeholder="请选择地区"
v-model="form.areaText"
labelSize="28"
label-width="180"
@click="show.area = true"
size="28"
/>
<fui-input
required
label="详细地址"
placeholder="请输入详细地址"
v-model="form.address"
labelSize="28"
label-width="180"
size="28"
/>
<fui-input
disabled
required
label="紧急程度"
placeholder="请选择紧急程度"
v-model="form.urgentdegreeText"
labelSize="28"
label-width="180"
size="28"
@click="show.urgentdegree = true"
/>
</view> </view>
<view class="bg-white mt20" style="padding: 0.875rem 1rem"> <view class="bg-white mt20" style="padding: 0.875rem 1rem">
<view class="mb-1 flex justify-start" style="font-size: 28rpx;"><span style="color: red;">*&nbsp;</span> 图片 </view> <view class="mb-1 flex justify-start" style="font-size: 28rpx"
<uni-file-picker :value="form.pictureObj" ref="uploadRef" limit="1" :auto-upload="false" @select="handleUpload" @delete="handleDelete"/> ><span style="color: red">*&nbsp;</span> 图片
</view>
<uni-file-picker
:value="form.pictureObj"
ref="uploadRef"
limit="1"
:auto-upload="false"
@select="handleUpload"
@delete="handleDelete"
/>
</view> </view>
<view class="fui-btn__box" v-if="!form.id" style="margin-top: 30rpx"> <view class="fui-btn__box" v-if="!form.id" style="margin-top: 30rpx">
<fui-button text="发布用工" bold radius="96rpx" @click="submit" /> <fui-button text="发布用工" bold radius="96rpx" @click="submit" />
...@@ -337,11 +438,44 @@ ...@@ -337,11 +438,44 @@
</view> </view>
</view> </view>
<fui-date-picker :show="show.time1" type="3" @change="handleChangeTime1" :min-date="getCurrentDate()" @cancel="show.time1 = false" /> <fui-date-picker
<fui-date-picker :show="show.time2" type="3" @change="handleChangeTime2" :min-date="getCurrentDate()" @cancel="show.time2 = false" /> :show="show.time1"
<fui-picker :show="show.type" :layer="1" :linkage="true" :options="options.type" @change="handleChangetype" @cancel="show.type = false" /> type="3"
<fui-picker :show="show.urgentdegree" :layer="1" :linkage="true" :options="options.urgentdegree" @change="handleChangeUrgentdegree" @cancel="show.urgentdegree = false"/> @change="handleChangeTime1"
<fui-picker :show="show.area" :options="options.area" :linkage="true" :layer="3" @change="handleChangeAddress" @cancel="show.area = false" /> :min-date="getCurrentDate()"
@cancel="show.time1 = false"
/>
<fui-date-picker
:show="show.time2"
type="3"
@change="handleChangeTime2"
:min-date="getCurrentDate()"
@cancel="show.time2 = false"
/>
<fui-picker
:show="show.type"
:layer="1"
:linkage="true"
:options="options.type"
@change="handleChangetype"
@cancel="show.type = false"
/>
<fui-picker
:show="show.urgentdegree"
:layer="1"
:linkage="true"
:options="options.urgentdegree"
@change="handleChangeUrgentdegree"
@cancel="show.urgentdegree = false"
/>
<fui-picker
:show="show.area"
:options="options.area"
:linkage="true"
:layer="3"
@change="handleChangeAddress"
@cancel="show.area = false"
/>
<fui-toast ref="toastRef" /> <fui-toast ref="toastRef" />
<fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)" /> <fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)" />
</template> </template>
......
<script setup lang="ts"> <script setup lang="ts">
import { reactive } from 'vue' import { reactive } from 'vue'
import { onLoad, onReachBottom, onShow } from '@dcloudio/uni-app' import { onLoad, onShow } from '@dcloudio/uni-app'
import * as turf from '@turf/turf'
import RegisterDialog from './components/register-dialog.vue' import RegisterDialog from './components/register-dialog.vue'
import ConfirmDialog from '@/components/ConfirmDialog/index.vue' import ConfirmDialog from '@/components/ConfirmDialog/index.vue'
import { getTextByCode } from '@/utils/areaData'
import * as LinghuoyonggongAPI from '@/api/model/linghuoyonggong' import * as LinghuoyonggongAPI from '@/api/model/linghuoyonggong'
import Navigate from '@/utils/page/navigate' import Navigate from '@/utils/page/navigate'
import { getText } from '@/utils/dict/area' import { getText } from '@/utils/dict/area'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
import * as turf from '@turf/turf'
const userStore = useUserStore() const userStore = useUserStore()
onLoad((option) => { onLoad((option) => {
pageData.currentEmploymentId = Number(option.type) || 2; pageData.currentEmploymentId = Number(option.type) || 2
}) })
onShow(() => { onShow(() => {
getUserLocation(); getUserLocation()
resetGetEmploymentList(); resetGetEmploymentList()
}) })
// 页面数据 // 页面数据
const pageData = reactive({ const pageData = reactive({
loading: false, loading: false,
requestDebounce:null, requestDebounce: null,
searchValue:"", searchValue: '',
search: { search: {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
publishstatu: 1, publishstatu: 1,
type: null, type: null,
createBy: '', createBy: '',
keyword:"" keyword: '',
}, },
hasMore:'more', hasMore: 'more',
// 用工类型标签 // 用工类型标签
employmentTabs: [ employmentTabs: [
{ id: 2, name: '找人干活(找人)' }, { id: 2, name: '找人干活(找人)' },
...@@ -45,19 +44,22 @@ ...@@ -45,19 +44,22 @@
employmentList: [], employmentList: [],
total: 0, total: 0,
dataTotal: 0, dataTotal: 0,
longitude:null, longitude: null,
latitude:null, latitude: null,
swipeActionButtons: [{ swipeActionButtons: [
{
text: '编辑', text: '编辑',
background: '#465CFF' background: '#465CFF',
}, { },
{
text: '删除', text: '删除',
background: '#FF2B2B' background: '#FF2B2B',
}], },
isShowConfirmDialog:false, ],
dialogContent:"确认要删除吗", isShowConfirmDialog: false,
delLaborId:null dialogContent: '确认要删除吗',
delLaborId: null,
}) })
// 缓存已处理的区域数据,避免重复计算 // 缓存已处理的区域数据,避免重复计算
...@@ -68,28 +70,30 @@ ...@@ -68,28 +70,30 @@
maxRetries: 2, maxRetries: 2,
retryDelay: 1000, retryDelay: 1000,
} }
function handleConfirmDialog(){ function handleConfirmDialog() {
pageData.loading = true; pageData.loading = true
LinghuoyonggongAPI.getLaborAppDel({ LinghuoyonggongAPI.getLaborAppDel({
id: pageData.delLaborId, id: pageData.delLaborId,
}).then((res) => { })
resetGetEmploymentList(); .then((res) => {
}).finally(()=>{ resetGetEmploymentList()
setTimeout(()=>{ })
pageData.loading = false; .finally(() => {
},200) setTimeout(() => {
pageData.loading = false
}, 200)
}) })
} }
// 左滑点击 // 左滑点击
function swipeActionOnClick(e,item){ function swipeActionOnClick(e, item) {
pageData.delLaborId = item.id; pageData.delLaborId = item.id
if(e.item.text == '删除'){ if (e.item.text == '删除') {
pageData.dialogContent = `确认要删除【${item.villageName}】吗`; pageData.dialogContent = `确认要删除【${item.villageName}】吗`
setTimeout(()=>{ setTimeout(() => {
pageData.isShowConfirmDialog = true; pageData.isShowConfirmDialog = true
},100) }, 100)
}else{ } else {
Navigate.to('/pages/linghuoyonggong/publishEmployment?id='+item.id); Navigate.to(`/pages/linghuoyonggong/publishEmployment?id=${item.id}`)
} }
} }
// 带重试机制的API调用 // 带重试机制的API调用
...@@ -127,23 +131,23 @@ ...@@ -127,23 +131,23 @@
function getEmploymentList() { function getEmploymentList() {
// 如果正在加载或没有更多数据,直接返回 // 如果正在加载或没有更多数据,直接返回
if (pageData.loading || pageData.hasMore == 'noMore') { if (pageData.loading || pageData.hasMore == 'noMore') {
return; return
} }
pageData.loading = true; pageData.loading = true
// 添加请求防抖,避免快速连续请求 // 添加请求防抖,避免快速连续请求
if (pageData.requestDebounce) { if (pageData.requestDebounce) {
clearTimeout(pageData.requestDebounce) clearTimeout(pageData.requestDebounce)
} }
pageData.requestDebounce = setTimeout(async () => { pageData.requestDebounce = setTimeout(async () => {
try { try {
let res = null; let res = null
if(pageData.currentEmploymentId == 2){ if (pageData.currentEmploymentId == 2) {
res = await fetchWithRetry(() => LinghuoyonggongAPI.getLaborAppList(pageData.search)) res = await fetchWithRetry(() => LinghuoyonggongAPI.getLaborAppList(pageData.search))
}else{ } else {
res = await fetchWithRetry(() => LinghuoyonggongAPI.employmentList(pageData.search)) res = await fetchWithRetry(() => LinghuoyonggongAPI.employmentList(pageData.search))
} }
const { records, total } = res; const { records, total } = res
// 批量处理数据,避免多次DOM操作 // 批量处理数据,避免多次DOM操作
const processedRecords = records.map((item) => { const processedRecords = records.map((item) => {
// 缓存区域处理结果 // 缓存区域处理结果
...@@ -154,21 +158,20 @@ ...@@ -154,21 +158,20 @@
} }
return item return item
}) })
pageData.dataTotal += processedRecords.length; pageData.dataTotal += processedRecords.length
// 一次性更新数据,避免多次响应式更新 // 一次性更新数据,避免多次响应式更新
if (pageData.search.pageNo === 1) { if (pageData.search.pageNo === 1) {
pageData.employmentList = processedRecords; pageData.employmentList = processedRecords
} else { } else {
// 避免重复数据加载 感觉有坑 // 避免重复数据加载 感觉有坑
/* const existingIds = new Set(pageData.employmentList.map((item) => item.id)) /* const existingIds = new Set(pageData.employmentList.map((item) => item.id))
const newRecords = processedRecords.filter((item) => !existingIds.has(item.id)) */ const newRecords = processedRecords.filter((item) => !existingIds.has(item.id)) */
pageData.employmentList = [...pageData.employmentList, ...processedRecords] pageData.employmentList = [...pageData.employmentList, ...processedRecords]
} }
pageData.total = total; pageData.total = total
if (pageData.dataTotal >= total) { if (pageData.dataTotal >= total) {
pageData.hasMore = 'noMore' pageData.hasMore = 'noMore'
} }
} catch (error) { } catch (error) {
console.error('获取用工列表失败:', error) console.error('获取用工列表失败:', error)
// 这里可以添加用户友好的错误提示 // 这里可以添加用户友好的错误提示
...@@ -202,9 +205,9 @@ ...@@ -202,9 +205,9 @@
} }
// 发布用工 // 发布用工
function handlePublish() { function handlePublish() {
if(pageData.currentEmploymentId === 2){ if (pageData.currentEmploymentId === 2) {
Navigate.to('/pages/linghuoyonggong/publishEmployment') Navigate.to('/pages/linghuoyonggong/publishEmployment')
}else{ } else {
Navigate.to('/pages/linghuoyonggong/form') Navigate.to('/pages/linghuoyonggong/form')
} }
} }
...@@ -231,42 +234,42 @@ ...@@ -231,42 +234,42 @@
return diffDays return diffDays
} }
function onSearch(res:any){ function onSearch(res: any) {
pageData.employmentList = []; pageData.employmentList = []
pageData.search.pageNo = 1; pageData.search.pageNo = 1
pageData.dataTotal = 0; pageData.dataTotal = 0
pageData.hasMore = 'more'; pageData.hasMore = 'more'
if (pageData.currentEmploymentId === 1) { if (pageData.currentEmploymentId === 1) {
pageData.search.publishstatu = 1 pageData.search.publishstatu = 1
pageData.search.createBy = res.value pageData.search.createBy = res.value
} }
if (pageData.currentEmploymentId === 2) { if (pageData.currentEmploymentId === 2) {
pageData.search.keyword = res.value; pageData.search.keyword = res.value
} }
getEmploymentList() getEmploymentList()
} }
// 取消搜索了 // 取消搜索了
function onSearchCancel(){ function onSearchCancel() {
resetGetEmploymentList(); resetGetEmploymentList()
} }
function resetGetEmploymentList(){ function resetGetEmploymentList() {
pageData.employmentList = [] pageData.employmentList = []
pageData.searchValue = ""; pageData.searchValue = ''
pageData.search.pageNo = 1; pageData.search.pageNo = 1
pageData.dataTotal = 0; pageData.dataTotal = 0
pageData.hasMore = 'more'; pageData.hasMore = 'more'
if (pageData.currentEmploymentId === 1) { if (pageData.currentEmploymentId === 1) {
pageData.search.publishstatu = 1 pageData.search.publishstatu = 1
pageData.search.createBy = '' pageData.search.createBy = ''
} }
pageData.search.keyword = ""; pageData.search.keyword = ''
getEmploymentList() getEmploymentList()
} }
function loadMoreData(){ function loadMoreData() {
pageData.search.pageNo++ pageData.search.pageNo++
getEmploymentList() getEmploymentList()
} }
/* onReachBottom(() => { /* onReachBottom(() => {
console.log('触底了') console.log('触底了')
if (pageData.total <= pageData.employmentList.length) { if (pageData.total <= pageData.employmentList.length) {
return return
...@@ -276,16 +279,16 @@ ...@@ -276,16 +279,16 @@
}) */ }) */
onNavigationBarButtonTap(() => { onNavigationBarButtonTap(() => {
Navigate.to('/pages/linghuoyonggong/components/yonggongmap?currentEmploymentId='+pageData.currentEmploymentId); Navigate.to(`/pages/linghuoyonggong/components/yonggongmap?currentEmploymentId=${pageData.currentEmploymentId}`)
}) })
// 查看找人干活详情 // 查看找人干活详情
function onDetailsClick(item: any) { function onDetailsClick(item: any) {
let param = encodeURIComponent(JSON.stringify({id:item.id,villageName:item.villageName})); const param = encodeURIComponent(JSON.stringify({ id: item.id, villageName: item.villageName }))
Navigate.to('/pages/linghuoyonggong/details?param='+param); Navigate.to(`/pages/linghuoyonggong/details?param=${param}`)
} }
// 获取用户位置 // 获取用户位置
function getUserLocation(){ function getUserLocation() {
uni.getLocation({ uni.getLocation({
type: 'wgs84', type: 'wgs84',
success: (res) => { success: (res) => {
...@@ -315,15 +318,15 @@ ...@@ -315,15 +318,15 @@
const distance = turf.distance(from, to, { units: 'kilometers' }) const distance = turf.distance(from, to, { units: 'kilometers' })
if (distance < 1) { if (distance < 1) {
return `${Math.round(distance * 1000)}m`; return `${Math.round(distance * 1000)}m`
} }
return `${distance.toFixed(1)}km`; return `${distance.toFixed(1)}km`
} }
</script> </script>
<template> <template>
<view class="page"> <view class="page">
<scroll-view scroll-y="true" style="height: 100%;" class="codefun-flex-col" @scrolltolower="loadMoreData"> <scroll-view scroll-y="true" style="height: 100%" class="codefun-flex-col" @scrolltolower="loadMoreData">
<!-- <view class="codefun-mt-14 codefun-flex-row group_2 gap-2"> <!-- <view class="codefun-mt-14 codefun-flex-row group_2 gap-2">
<view <view
v-for="tab in pageData.categoryTabs" v-for="tab in pageData.categoryTabs"
...@@ -340,7 +343,16 @@ ...@@ -340,7 +343,16 @@
<view class="codefun-mt-14 codefun-flex-col group_3"> <view class="codefun-mt-14 codefun-flex-col group_3">
<view class="top-search-view"> <view class="top-search-view">
<uni-search-bar radius="100" v-model="pageData.searchValue" placeholder="请输入搜索内容" clearButton="auto" cancelButton="none" @confirm="onSearch" @cancel="onSearchCancel" @clear="onSearchCancel"/> <uni-search-bar
radius="100"
v-model="pageData.searchValue"
placeholder="请输入搜索内容"
clearButton="auto"
cancelButton="none"
@confirm="onSearch"
@cancel="onSearchCancel"
@clear="onSearchCancel"
/>
</view> </view>
<view class="codefun-flex-row section_2"> <view class="codefun-flex-row section_2">
<view <view
...@@ -387,7 +399,8 @@ ...@@ -387,7 +399,8 @@
<image class="image_9" src="/static/images/time.svg" /> <image class="image_9" src="/static/images/time.svg" />
<text class="font_4" <text class="font_4"
>预计{{ >预计{{
item.daysDiff || getDaysDiff(item.starttime, item.estimatedendtime) item.daysDiff ||
getDaysDiff(item.starttime, item.estimatedendtime)
}}</text }}</text
> >
</view> </view>
...@@ -402,7 +415,9 @@ ...@@ -402,7 +415,9 @@
</view> </view>
</view> </view>
</view> </view>
<view class="codefun-mt-8 codefun-flex-row codefun-justify-between codefun-items-center"> <view
class="codefun-mt-8 codefun-flex-row codefun-justify-between codefun-items-center"
>
<view class="flex-center"> <view class="flex-center">
<fui-rate :score="item.urgentdegree" :size="36" /> <fui-rate :score="item.urgentdegree" :size="36" />
<text class="font_5 ml-1">{{ item.urgentdegree }}</text> <text class="font_5 ml-1">{{ item.urgentdegree }}</text>
...@@ -419,31 +434,67 @@ ...@@ -419,31 +434,67 @@
</template> </template>
<template v-else> <template v-else>
<fui-swipeaction-group> <fui-swipeaction-group>
<fui-swipe-action class="yr-list-swipe" v-for="item in pageData.employmentList" :key="item.id" :buttons="pageData.swipeActionButtons" @click="swipeActionOnClick($event,item)"> <fui-swipe-action
<fui-list-cell class="yr-list-cell" :padding="['0rpx','0rpx']" :highlight="false"> class="yr-list-swipe"
v-for="item in pageData.employmentList"
:key="item.id"
:buttons="pageData.swipeActionButtons"
@click="swipeActionOnClick($event, item)"
>
<fui-list-cell class="yr-list-cell" :padding="['0rpx', '0rpx']" :highlight="false">
<view class="work_list_view"> <view class="work_list_view">
<view class="d-flex j-sb"> <view class="d-flex j-sb">
<view class="left-width village_number_view"> <view class="left-width village_number_view">
<view class="village_view text_overflow_ellipsis">{{ item.villageName }}</view> <view class="village_view text_overflow_ellipsis">{{
<view class="d-flex align-center"><image class="avatar_icon" src="/static/images/linghuoyonggong/avatar.png" /><text class="text-color">待工人数{{item.workers}}</text></view> item.villageName
}}</view>
<view class="d-flex align-center"
><image
class="avatar_icon"
src="/static/images/linghuoyonggong/avatar.png"
/><text class="text-color"
>待工人数{{ item.workers }}</text
></view
>
</view> </view>
<view class="d-flex align-center justify-center right-width village_distance"> <view
<image class="distance_icon" src="/static/images/linghuoyonggong/distance.png" /> class="d-flex align-center justify-center right-width village_distance"
<text class="distance_val text-color">{{getDistanceText(item)}}</text> >
<image
class="distance_icon"
src="/static/images/linghuoyonggong/distance.png"
/>
<text class="distance_val text-color">{{
getDistanceText(item)
}}</text>
</view> </view>
</view> </view>
<view class="d-flex j-sb skill_details_view" style="padding-bottom: 0px;"> <view class="d-flex j-sb skill_details_view" style="padding-bottom: 0px">
<view class="left-width d-flex j-sb align-center"> <view class="left-width d-flex j-sb align-center">
<image class="skill_icon" src="/static/images/linghuoyonggong/skill.png" /> <image
<view class="skill_view text_overflow_ellipsis">技能:{{item.skills.length ? item.skills.join("、") : '未填写'}}</view> class="skill_icon"
src="/static/images/linghuoyonggong/skill.png"
/>
<view class="skill_view text_overflow_ellipsis"
>技能:{{
item.skills.length ? item.skills.join('、') : '未填写'
}}</view
>
</view> </view>
</view> </view>
<view class="d-flex j-sb skill_details_view"> <view class="d-flex j-sb skill_details_view">
<view class="left-width d-flex j-sb align-center"> <view class="left-width d-flex j-sb align-center">
<image class="skill_icon" src="/static/images/linghuoyonggong/address.png" /> <image
<view class="skill_view text_overflow_ellipsis">地址:{{item.villageFullName}}</view> class="skill_icon"
src="/static/images/linghuoyonggong/address.png"
/>
<view class="skill_view text_overflow_ellipsis"
>地址:{{ item.villageFullName }}</view
>
</view> </view>
<view class="right-width see_details_btn" @click="onDetailsClick(item)">查看详情</view> <view class="right-width see_details_btn" @click="onDetailsClick(item)"
>查看详情</view
>
</view> </view>
</view> </view>
</fui-list-cell> </fui-list-cell>
...@@ -529,9 +580,8 @@ ...@@ -529,9 +580,8 @@
overflow-y: auto; overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
height: calc(100vh - 88rpx); height: calc(100vh - 88rpx);
.top-search-view{ .top-search-view {
height: 64rpx; height: 64rpx;
} }
.section { .section {
padding: 26rpx 28rpx 26rpx 36rpx; padding: 26rpx 28rpx 26rpx 36rpx;
...@@ -622,8 +672,8 @@ ...@@ -622,8 +672,8 @@
.group_3 { .group_3 {
padding: 0 28rpx; padding: 0 28rpx;
// height: 685rpx; // height: 685rpx;
.top-search-view{ .top-search-view {
.uni-searchbar{ .uni-searchbar {
padding: 0rpx !important; padding: 0rpx !important;
} }
} }
...@@ -762,84 +812,91 @@ ...@@ -762,84 +812,91 @@
width: 680rpx; width: 680rpx;
} }
} */ } */
.work_list_view{ .work_list_view {
// border-bottom: 2rpx solid #EEEEEE; // border-bottom: 2rpx solid #EEEEEE;
width: 100%; width: 100%;
padding-top: 24rpx; padding-top: 24rpx;
.text-color{color: #5DB66F;font-size: 24rpx;} .text-color {
.d-flex{display: flex;} color: #5db66f;
.j-sb{justify-content:space-between;} font-size: 24rpx;
.text_overflow_ellipsis{ }
.d-flex {
display: flex;
}
.j-sb {
justify-content: space-between;
}
.text_overflow_ellipsis {
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.left-width{ .left-width {
width:440rpx; width: 440rpx;
} }
.right-width{ .right-width {
width:140rpx; width: 140rpx;
} }
.village_number_view{ .village_number_view {
.village_view{ .village_view {
height: 40rpx; height: 40rpx;
line-height: 40rpx; line-height: 40rpx;
margin-bottom: 12rpx; margin-bottom: 12rpx;
font-size: 32rpx; font-size: 32rpx;
color: #333333; color: #333333;
} }
.avatar_icon{ .avatar_icon {
width: 24rpx; width: 24rpx;
height: 24rpx; height: 24rpx;
margin-right: 10rpx; margin-right: 10rpx;
} }
} }
.village_distance{ .village_distance {
height: 26rpx; height: 26rpx;
margin-top: 16rpx; margin-top: 16rpx;
.distance_icon{ .distance_icon {
width: 24rpx; width: 24rpx;
height: 28rpx; height: 28rpx;
} }
.distance_val{ .distance_val {
margin-left: 6rpx; margin-left: 6rpx;
} }
} }
.skill_details_view{ .skill_details_view {
margin-top: 10rpx; margin-top: 10rpx;
padding-bottom: 24rpx; padding-bottom: 24rpx;
.skill_icon{ .skill_icon {
width: 24rpx; width: 24rpx;
height: 26rpx; height: 26rpx;
} }
.skill_view{ .skill_view {
width:440rpx; width: 440rpx;
font-size: 24rpx; font-size: 24rpx;
height: 40rpx; height: 40rpx;
line-height: 40rpx; line-height: 40rpx;
color: #999999; color: #999999;
margin-left: 10rpx; margin-left: 10rpx;
} }
.see_details_btn{ .see_details_btn {
height: 48rpx; height: 48rpx;
border-radius: 200rpx; border-radius: 200rpx;
background: #5DB66F; background: #5db66f;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
padding: 20rpx; padding: 20rpx;
font-size: 24rpx; font-size: 24rpx;
color: #FFFFFF; color: #ffffff;
} }
} }
} }
.no-more{ .no-more {
padding-top: 40rpx; padding-top: 40rpx;
padding-bottom: 60rpx; padding-bottom: 60rpx;
width: 750rpx; width: 750rpx;
text-align: center; text-align: center;
font-size: 28rpx; font-size: 28rpx;
color:#999999; color: #999999;
} }
</style> </style>
<script setup lang="ts"> <script setup lang="ts">
import { reactive, toRefs, ref, computed } from 'vue' import { reactive, ref, toRefs } from 'vue'
import { onLoad, onShow } from '@dcloudio/uni-app' import { onLoad, onShow } from '@dcloudio/uni-app'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
import { useGlobSetting } from '/@/hooks/setting' import { useGlobSetting } from '/@/hooks/setting'
import * as LinghuoyonggongAPI from '@/api/model/linghuoyonggong' import * as LinghuoyonggongAPI from '@/api/model/linghuoyonggong'
import { getCalculateAge } from '@/utils/date' import { getCalculateAge } from '@/utils/date'
import * as UserInfoAPI from '@/api/model/userInfo' import * as UserInfoAPI from '@/api/model/userInfo'
import { areaTree, getCodeByText, getTextByCode } from '@/utils/areaData' import { getCodeByText } from '@/utils/areaData'
import { useDictStore } from '@/store/modules/dict' import { useDictStore } from '@/store/modules/dict'
import { getDictData, getText } from '@/utils/dict/area' import { getDictData } from '@/utils/dict/area'
const dictStore = useDictStore() const dictStore = useDictStore()
const userStore = useUserStore() const userStore = useUserStore()
const globSetting = useGlobSetting() const globSetting = useGlobSetting()
let pageType= 'add'; let pageType = 'add'
onLoad((option) => { onLoad((option) => {
// 获取数据详情 // 获取数据详情
if (option && option.id) { if (option && option.id) {
pageType = 'edit'; pageType = 'edit'
uni.setNavigationBarTitle({title: '编辑'}); uni.setNavigationBarTitle({ title: '编辑' })
getDetails(option.id) getDetails(option.id)
} else { } else {
// 获取当前位置 // 获取当前位置
getCurrentAddressInfo() getCurrentAddressInfo()
} }
getProvince(); getProvince()
// 获取字典值 // 获取字典值
getDictVal(); getDictVal()
}) })
onShow(() => { onShow(() => {
...@@ -36,91 +35,90 @@ ...@@ -36,91 +35,90 @@
initDict() initDict()
}) })
const VerificationInfo1 = { const VerificationInfo1 = {
addr:'请选择村', addr: '请选择村',
contactName:'请输入联系人', contactName: '请输入联系人',
contactMobile:'请输入联系电话' contactMobile: '请输入联系电话',
} }
const VerificationInfo2 = { const VerificationInfo2 = {
name:'请输入姓名', name: '请输入姓名',
mobile:'请输入手机号', mobile: '请输入手机号',
genderZh:'请选择性别', genderZh: '请选择性别',
birthday:'请选择出生日期', birthday: '请选择出生日期',
eduZh:"请选择学历", eduZh: '请选择学历',
attr:"请选择人员属性", attr: '请选择人员属性',
skill:"请选择人员技能" skill: '请选择人员技能',
} }
const skillPopupRef = ref(null); const skillPopupRef = ref(null)
let tempWorkersParam = reactive({ const tempWorkersParam = reactive({
id:null, id: null,
laborId:null, //用工信息ID laborId: null, // 用工信息ID
name:"",// 工人姓名 name: '', // 工人姓名
mobile:"",// 手机号 mobile: '', // 手机号
gender:null,// 性别 gender: null, // 性别
genderZh:"", genderZh: '',
birthday:"", // 出生日期 birthday: '', // 出生日期
edu:null,// 学历 edu: null, // 学历
eduZh:"", eduZh: '',
attr:"",// 人员属性 attr: '', // 人员属性
skill:"", // 人员技能 skill: '', // 人员技能
}) })
let startDate = getDate('start'); let startDate = getDate('start')
const endDate = getDate('end'); const endDate = getDate('end')
// 字典值 // 字典值
const DictData = reactive({ const DictData = reactive({
sexArr:[],// 性别 sexArr: [], // 性别
educationArr:[],// 学历 educationArr: [], // 学历
socialattributesArr:[],// 人员属性 socialattributesArr: [], // 人员属性
dictValArr:[],// 过渡
dictType:"",
isSkillPopupShow:false, dictValArr: [], // 过渡
skillValue:[], dictType: '',
skillOptionsVal:[],
isSkillPopupShow: false,
skillValue: [],
skillOptionsVal: [],
}) })
const pageData = reactive({ const pageData = reactive({
province: [], //省数组 province: [], // 省数组
city: [], //市数组 city: [], // 市数组
district: [], //区数组 district: [], // 区数组
street: [], //街道数组 street: [], // 街道数组
mulSelect: [], //四级联动显示数组,该数组的值为[[province],[city],[district],[street]] mulSelect: [], // 四级联动显示数组,该数组的值为[[province],[city],[district],[street]]
provinceId: 0, //省的id provinceId: 0, // 省的id
cityId: 0, //市的id cityId: 0, // 市的id
districtId: 0,//区的id districtId: 0, // 区的id
isActive:false, isActive: false,
address:'', address: '',
birthdayPickerIsShow:false, birthdayPickerIsShow: false,
laborParam:{ laborParam: {
id:null, id: null,
lon:"", // 经度 lon: '', // 经度
lat:"", // 纬度 lat: '', // 纬度
contactName:"", // 联系人姓名 contactName: '', // 联系人姓名
contactMobile:"", // 联系人电话 contactMobile: '', // 联系人电话
provinceName:"湖南省", // 所属省名称 provinceName: '湖南省', // 所属省名称
provinceCode:"43", // 所属省编码 provinceCode: '43', // 所属省编码
cityName:"", // 所属市名称 cityName: '', // 所属市名称
cityCode:"", // 所属市编码 cityCode: '', // 所属市编码
districtName:"", // 所属区县名称 districtName: '', // 所属区县名称
districtCode:"", // 所属区县编码 districtCode: '', // 所属区县编码
townName:"", // 所属乡镇名称 townName: '', // 所属乡镇名称
townCode:"", // 所属乡镇编码 townCode: '', // 所属乡镇编码
villageName:"", // 村名称 villageName: '', // 村名称
villageCode:"", // 村编码 villageCode: '', // 村编码
addr:"", addr: '',
}, },
workersParam:[], workersParam: [],
actionType:'add', actionType: 'add',
editWorkersIndex:0, editWorkersIndex: 0,
loading: false, loading: false,
isPersonPopupShow:false, isPersonPopupShow: false,
datePickerShow:false, datePickerShow: false,
attrPickerShow:false, attrPickerShow: false,
show: { show: {
time1: false, time1: false,
time2: false, time2: false,
...@@ -153,7 +151,7 @@ ...@@ -153,7 +151,7 @@
picture: null, picture: null,
pictureObj: null, pictureObj: null,
longitude: '', longitude: '',
latitude: '' latitude: '',
}, },
position: [], position: [],
rules: [ rules: [
...@@ -161,43 +159,53 @@ ...@@ -161,43 +159,53 @@
name: 'type', name: 'type',
rule: ['required'], rule: ['required'],
msg: ['请选择用工类型'], msg: ['请选择用工类型'],
},{ },
{
name: 'name', name: 'name',
rule: ['required'], rule: ['required'],
msg: ['请输入标题'], msg: ['请输入标题'],
}, { },
{
name: 'workers', name: 'workers',
rule: ['required'], rule: ['required'],
msg: ['请输入工人数量'], msg: ['请输入工人数量'],
}, { },
{
name: 'price', name: 'price',
rule: ['required'], rule: ['required'],
msg: ['请输入用工单价'], msg: ['请输入用工单价'],
}, { },
{
name: 'starttime', name: 'starttime',
rule: ['required'], rule: ['required'],
msg: ['请选择开始时间'], msg: ['请选择开始时间'],
}, { },
{
name: 'estimatedendtime', name: 'estimatedendtime',
rule: ['required'], rule: ['required'],
msg: ['请选择预计结束时间'], msg: ['请选择预计结束时间'],
}, { },
{
name: 'content', name: 'content',
rule: ['required'], rule: ['required'],
msg: ['请输入工作内容'], msg: ['请输入工作内容'],
}, { },
{
name: 'area', name: 'area',
rule: ['required'], rule: ['required'],
msg: ['请选择地区'], msg: ['请选择地区'],
}, { },
{
name: 'address', name: 'address',
rule: ['required'], rule: ['required'],
msg: ['请输入详细地址'], msg: ['请输入详细地址'],
}, { },
{
name: 'urgentdegree', name: 'urgentdegree',
rule: ['required'], rule: ['required'],
msg: ['请选择紧急程度'], msg: ['请选择紧急程度'],
}, { },
{
name: 'picture', name: 'picture',
rule: ['required'], rule: ['required'],
msg: ['请上传图片'], msg: ['请上传图片'],
...@@ -205,278 +213,278 @@ ...@@ -205,278 +213,278 @@
], ],
}) })
// 获取字典值 // 获取字典值
function getDictVal(){ function getDictVal() {
LinghuoyonggongAPI.gitListByCodeDict({ code : 'sex'}).then(res=>{ LinghuoyonggongAPI.gitListByCodeDict({ code: 'sex' }).then((res) => {
DictData.sexArr = res; DictData.sexArr = res
}) })
LinghuoyonggongAPI.gitListByCodeDict({ code : 'education'}).then(res=>{ LinghuoyonggongAPI.gitListByCodeDict({ code: 'education' }).then((res) => {
DictData.educationArr = res; DictData.educationArr = res
}) })
LinghuoyonggongAPI.gitListByCodeDict({ code : 'socialattributes'}).then(res=>{ LinghuoyonggongAPI.gitListByCodeDict({ code: 'socialattributes' }).then((res) => {
DictData.socialattributesArr = res; DictData.socialattributesArr = res
}) })
queryByCategoryAndCode(0,null); queryByCategoryAndCode(0, null)
} }
function queryByCategoryAndCode(code,e){ function queryByCategoryAndCode(code, e) {
LinghuoyonggongAPI.queryByCategoryAndCode({ category : 1,code : code}).then(res=>{ LinghuoyonggongAPI.queryByCategoryAndCode({ category: 1, code }).then((res) => {
if(res.length){ if (res.length) {
let dataArr = []; const dataArr = []
for(let i = 0; i < res.length; i++){ for (let i = 0; i < res.length; i++) {
let obj = {text:"",value:""}; const obj = { text: '', value: '' }
obj.text = res[i].name; obj.text = res[i].name
obj.value = res[i].code; obj.value = res[i].code
dataArr.push(obj); dataArr.push(obj)
} }
if(!DictData.skillOptionsVal.length){ if (!DictData.skillOptionsVal.length) {
DictData.skillOptionsVal = dataArr; DictData.skillOptionsVal = dataArr
}else{ } else {
skillPopupRef.value.setRequestData(dataArr, e.layer); skillPopupRef.value.setRequestData(dataArr, e.layer)
} }
}else{ } else {
skillPopupRef.value.end(); skillPopupRef.value.end()
} }
}) })
} }
// 选择技能完成 // 选择技能完成
function selectCompleteSkill(e){ function selectCompleteSkill(e) {
// tempWorkersParam.skill = e.text.join(''); // tempWorkersParam.skill = e.text.join('');
let valText = e.text[e.text.length-1]; const valText = e.text[e.text.length - 1]
if(tempWorkersParam.skill.length){ if (tempWorkersParam.skill.length) {
let skillArray = tempWorkersParam.skill.split("、"); const skillArray = tempWorkersParam.skill.split('、')
if(skillArray.length < 3){ if (skillArray.length < 3) {
tempWorkersParam.skill = tempWorkersParam.skill+'、'+valText; tempWorkersParam.skill = `${tempWorkersParam.skill}${valText}`
}else{ } else {
toastRef.value.show({ toastRef.value.show({
type: 'error', type: 'error',
text: '最多只能选择3项技能!', text: '最多只能选择3项技能!',
}) })
} }
}else{ } else {
tempWorkersParam.skill = valText; tempWorkersParam.skill = valText
} }
DictData.isSkillPopupShow = false; DictData.isSkillPopupShow = false
} }
// 技能值发生了改变 // 技能值发生了改变
function changeSkill(e){ function changeSkill(e) {
let val = e.value; const val = e.value
queryByCategoryAndCode(val,e); queryByCategoryAndCode(val, e)
} }
// 学历和属性的选择 // 学历和属性的选择
function attrChange(e) { function attrChange(e) {
if(DictData.dictType == 'education'){ if (DictData.dictType == 'education') {
let educationArr = DictData.educationArr; const educationArr = DictData.educationArr
tempWorkersParam.eduZh = e.value; tempWorkersParam.eduZh = e.value
for(let i = 0; i < educationArr.length; i++){ for (let i = 0; i < educationArr.length; i++) {
if(e.value == educationArr[i].itemText){ if (e.value == educationArr[i].itemText) {
tempWorkersParam.edu = parseInt(educationArr[i].itemValue); tempWorkersParam.edu = Number.parseInt(educationArr[i].itemValue)
break; break
} }
} }
} }
if(DictData.dictType == 'socialattributes'){ if (DictData.dictType == 'socialattributes') {
tempWorkersParam.attr = e.value; tempWorkersParam.attr = e.value
} }
pageData.attrPickerShow = false; pageData.attrPickerShow = false
} }
// 出生日期的选择 // 出生日期的选择
function dateBirthChange(e) { function dateBirthChange(e) {
tempWorkersParam.birthday = e.result; tempWorkersParam.birthday = e.result
pageData.datePickerShow = false; pageData.datePickerShow = false
} }
function getDate(type) { function getDate(type) {
const date = new Date(); const date = new Date()
let year = date.getFullYear(); let year = date.getFullYear()
let month:any = date.getMonth() + 1; let month: any = date.getMonth() + 1
let day:any = date.getDate(); let day: any = date.getDate()
if (type === 'start') { if (type === 'start') {
year = year - 18; year = year - 18
} else if (type === 'end') { } else if (type === 'end') {
year = year + 10; year = year + 10
} }
month = month > 9 ? month : '0' + month; month = month > 9 ? month : `0${month}`
day = day > 9 ? day : '0' + day; day = day > 9 ? day : `0${day}`
return `${year}-${month}-${day}`; return `${year}-${month}-${day}`
} }
// 删除人员 // 删除人员
function delPersonData(name){ function delPersonData(name) {
Message.confirm('你真的要删除【'+name+'】吗?', '温馨提示').then(async (confirm) => { Message.confirm(`你真的要删除【${name}】吗?`, '温馨提示').then(async (confirm) => {
if(confirm){ if (confirm) {
pageData.workersParam.splice(pageData.editWorkersIndex, 1); pageData.workersParam.splice(pageData.editWorkersIndex, 1)
pageData.isPersonPopupShow = false pageData.isPersonPopupShow = false
} }
}) })
} }
// 添加人员 // 添加人员
function addPersonData(){ function addPersonData() {
tempWorkersParam.gender = parseInt(tempWorkersParam.genderZh); tempWorkersParam.gender = Number.parseInt(tempWorkersParam.genderZh)
let entries = Object.entries(VerificationInfo2); const entries = Object.entries(VerificationInfo2)
for (let [key, value] of entries) { for (const [key, value] of entries) {
if(tempWorkersParam[key].trim().length === 0){ if (tempWorkersParam[key].trim().length === 0) {
toastRef.value.show({ toastRef.value.show({
type: 'error', type: 'error',
text: value, text: value,
}) })
return; return
} }
} }
if(pageData.actionType == 'edit'){ if (pageData.actionType == 'edit') {
let editObj = pageData.workersParam[pageData.editWorkersIndex]; const editObj = pageData.workersParam[pageData.editWorkersIndex]
Object.keys(tempWorkersParam).forEach((item) => { Object.keys(tempWorkersParam).forEach((item) => {
editObj[item] = tempWorkersParam[item]; editObj[item] = tempWorkersParam[item]
}); })
}else{ } else {
pageData.workersParam.push(JSON.parse(JSON.stringify(tempWorkersParam))); pageData.workersParam.push(JSON.parse(JSON.stringify(tempWorkersParam)))
} }
pageData.isPersonPopupShow = false; pageData.isPersonPopupShow = false
} }
// 返回字典中的中文值 // 返回字典中的中文值
function returnDictZhVel(type:any,val:any){ function returnDictZhVel(type: any, val: any) {
let valText = ""; let valText = ''
if(type == 'gender'){ if (type == 'gender') {
let arr = DictData.sexArr; const arr = DictData.sexArr
for(let i = 0; i < arr.length;i++){ for (let i = 0; i < arr.length; i++) {
if(val == parseInt(arr[i].itemValue)){ if (val == Number.parseInt(arr[i].itemValue)) {
valText = arr[i].itemText; valText = arr[i].itemText
break; break
} }
} }
} }
if(type == 'edu'){ if (type == 'edu') {
let arr = DictData.educationArr; const arr = DictData.educationArr
for(let i = 0; i < arr.length;i++){ for (let i = 0; i < arr.length; i++) {
if(val == parseInt(arr[i].itemValue)){ if (val == Number.parseInt(arr[i].itemValue)) {
valText = arr[i].itemText; valText = arr[i].itemText
break; break
} }
} }
} }
return valText; return valText
} }
// 选择出生日期 // 选择出生日期
function onPickerTap(e) { function onPickerTap(e) {
let dataVal = null,itemTextArr = []; let dataVal = null
DictData.dictType = e; const itemTextArr = []
if(DictData.dictType == 'education'){ DictData.dictType = e
dataVal = DictData.educationArr; if (DictData.dictType == 'education') {
for(let i = 0; i < dataVal.length; i++){ dataVal = DictData.educationArr
itemTextArr.push(dataVal[i].itemText); for (let i = 0; i < dataVal.length; i++) {
itemTextArr.push(dataVal[i].itemText)
} }
} }
if(DictData.dictType == 'socialattributes'){ if (DictData.dictType == 'socialattributes') {
dataVal = DictData.socialattributesArr; dataVal = DictData.socialattributesArr
for(let i = 0; i < dataVal.length; i++){ for (let i = 0; i < dataVal.length; i++) {
itemTextArr.push(dataVal[i].itemText); itemTextArr.push(dataVal[i].itemText)
} }
} }
DictData.dictValArr = itemTextArr; DictData.dictValArr = itemTextArr
pageData.attrPickerShow = true pageData.attrPickerShow = true
} }
// 打开添加人员弹出框 // 打开添加人员弹出框
function openAddPersonPopup(){ function openAddPersonPopup() {
tempWorkersParam.id=null; tempWorkersParam.id = null
tempWorkersParam.laborId=null; tempWorkersParam.laborId = null
tempWorkersParam.name=""; tempWorkersParam.name = ''
tempWorkersParam.mobile=""; tempWorkersParam.mobile = ''
tempWorkersParam.gender=""; tempWorkersParam.gender = ''
tempWorkersParam.genderZh=""; tempWorkersParam.genderZh = ''
tempWorkersParam.birthday=""; tempWorkersParam.birthday = ''
tempWorkersParam.edu=""; tempWorkersParam.edu = ''
tempWorkersParam.eduZh=""; tempWorkersParam.eduZh = ''
tempWorkersParam.attr=""; tempWorkersParam.attr = ''
tempWorkersParam.skill=""; tempWorkersParam.skill = ''
pageData.actionType = "add"; pageData.actionType = 'add'
pageData.isPersonPopupShow = true; pageData.isPersonPopupShow = true
} }
// 编辑找人干活待业人员 // 编辑找人干活待业人员
function editPersonPopup(index){ function editPersonPopup(index) {
let workersParamObj = pageData.workersParam[index]; const workersParamObj = pageData.workersParam[index]
workersParamObj.eduZh = returnDictZhVel('edu',workersParamObj.edu); workersParamObj.eduZh = returnDictZhVel('edu', workersParamObj.edu)
if(pageType == 'edit'){ if (pageType == 'edit') {
workersParamObj.genderZh = workersParamObj.gender+''; workersParamObj.genderZh = `${workersParamObj.gender}`
startDate = workersParamObj.birthday; startDate = workersParamObj.birthday
} }
// workersParamObj.skill.split("、"); // workersParamObj.skill.split("、");
Object.keys(workersParamObj).forEach((item) => { Object.keys(workersParamObj).forEach((item) => {
tempWorkersParam[item] = workersParamObj[item]; tempWorkersParam[item] = workersParamObj[item]
}); })
pageData.actionType = "edit"; pageData.actionType = 'edit'
pageData.editWorkersIndex = index; pageData.editWorkersIndex = index
pageData.isPersonPopupShow = true; pageData.isPersonPopupShow = true
} }
function colChange(e) { function colChange(e) {
switch (e.detail.column){ switch (e.detail.column) {
case 0://选择市 case 0: // 选择市
pageData.provinceId = pageData.mulSelect[0][e.detail.value].code; pageData.provinceId = pageData.mulSelect[0][e.detail.value].code
// 获取对应的 区县 // 获取对应的 区县
LinghuoyonggongAPI.queryConditions({ parentCode : pageData.provinceId}).then(res=>{ LinghuoyonggongAPI.queryConditions({ parentCode: pageData.provinceId }).then((res) => {
pageData.city = res; pageData.city = res
pageData.mulSelect[1]= pageData.city; pageData.mulSelect[1] = pageData.city
// 获取对应的乡镇 // 获取对应的乡镇
LinghuoyonggongAPI.queryConditions({ parentCode : pageData.city[0].code}).then(res=>{ LinghuoyonggongAPI.queryConditions({ parentCode: pageData.city[0].code }).then((res) => {
pageData.district = res; pageData.district = res
pageData.mulSelect[2]= pageData.district; pageData.mulSelect[2] = pageData.district
// 获取对应的村 // 获取对应的村
LinghuoyonggongAPI.queryConditions({ parentCode : pageData.district[0].code}).then(res=>{ LinghuoyonggongAPI.queryConditions({ parentCode: pageData.district[0].code }).then((res) => {
pageData.street = res; pageData.street = res
if(res.length){ if (res.length) {
pageData.mulSelect[3]= pageData.street; pageData.mulSelect[3] = pageData.street
} }
}) })
}) })
}) })
break; break
case 1://选择区县 case 1: // 选择区县
pageData.cityId=pageData.mulSelect[1][e.detail.value].code; pageData.cityId = pageData.mulSelect[1][e.detail.value].code
// 获取对应的乡镇 // 获取对应的乡镇
LinghuoyonggongAPI.queryConditions({ parentCode :pageData.cityId}).then(res=>{ LinghuoyonggongAPI.queryConditions({ parentCode: pageData.cityId }).then((res) => {
pageData.district = res; pageData.district = res
pageData.mulSelect[2]=pageData.district; pageData.mulSelect[2] = pageData.district
// 获取对应的村 // 获取对应的村
LinghuoyonggongAPI.queryConditions({ parentCode :pageData.district[0].code}).then(res=>{ LinghuoyonggongAPI.queryConditions({ parentCode: pageData.district[0].code }).then((res) => {
if(res.length){ if (res.length) {
pageData.street = res; pageData.street = res
pageData.mulSelect[3]=pageData.street; pageData.mulSelect[3] = pageData.street
} }
}) })
}) })
break; break
case 2://选择镇 case 2: // 选择镇
pageData.districtId=pageData.mulSelect[2][e.detail.value].code; pageData.districtId = pageData.mulSelect[2][e.detail.value].code
LinghuoyonggongAPI.queryConditions({ parentCode :pageData.districtId}).then(res=>{ LinghuoyonggongAPI.queryConditions({ parentCode: pageData.districtId }).then((res) => {
if(res.length){ if (res.length) {
pageData.street = res; pageData.street = res
pageData.mulSelect[3]=pageData.street; pageData.mulSelect[3] = pageData.street
} }
}); })
break; break
default: default:
break; break
} }
} }
function getProvince() { function getProvince() {
LinghuoyonggongAPI.queryConditions({ parentCode : 43 }).then(res=>{ LinghuoyonggongAPI.queryConditions({ parentCode: 43 }).then((res) => {
pageData.province = []; pageData.province = []
pageData.province = res; pageData.province = res
pageData.mulSelect.push(pageData.province); pageData.mulSelect.push(pageData.province)
let code = pageData.province[0].code; const code = pageData.province[0].code
LinghuoyonggongAPI.queryConditions({ parentCode : code}).then(res=>{ LinghuoyonggongAPI.queryConditions({ parentCode: code }).then((res) => {
pageData.city = res; pageData.city = res
pageData.mulSelect.push(pageData.city); pageData.mulSelect.push(pageData.city)
let code = pageData.city[0].code; const code = pageData.city[0].code
LinghuoyonggongAPI.queryConditions({ parentCode : code}).then(res=>{ LinghuoyonggongAPI.queryConditions({ parentCode: code }).then((res) => {
pageData.district = res; pageData.district = res
pageData.mulSelect.push(pageData.district); pageData.mulSelect.push(pageData.district)
let code = pageData.district[0].code; const code = pageData.district[0].code
LinghuoyonggongAPI.queryConditions({ parentCode : code}).then(res=>{ LinghuoyonggongAPI.queryConditions({ parentCode: code }).then((res) => {
pageData.street = res; pageData.street = res
if(res.length){ if (res.length) {
pageData.mulSelect.push(pageData.street); pageData.mulSelect.push(pageData.street)
} }
}) })
}) })
...@@ -485,46 +493,45 @@ ...@@ -485,46 +493,45 @@
} }
function pickerChange(e) { function pickerChange(e) {
for(var i=0;i<e.detail.value.length;i++){ for (let i = 0; i < e.detail.value.length; i++) {
if(e.detail.value[i]===null){ if (e.detail.value[i] === null) {
e.detail.value[i]=0; e.detail.value[i] = 0
} }
} }
let s_province = pageData.mulSelect[0][e.detail.value[0]]; const s_province = pageData.mulSelect[0][e.detail.value[0]]
let s_city = pageData.mulSelect[1][e.detail.value[1]||0]; const s_city = pageData.mulSelect[1][e.detail.value[1] || 0]
let s_district = pageData.mulSelect[2][e.detail.value[2]||0]; const s_district = pageData.mulSelect[2][e.detail.value[2] || 0]
let s_street = null; let s_street = null
if(e.detail.value.length == 4){ if (e.detail.value.length == 4) {
s_street = pageData.mulSelect[3][e.detail.value[3]||0]; s_street = pageData.mulSelect[3][e.detail.value[3] || 0]
pageData.laborParam.addr = s_province.name+s_city.name+s_district.name+s_street.name; pageData.laborParam.addr = s_province.name + s_city.name + s_district.name + s_street.name
pageData.laborParam.cityName = s_province.name; pageData.laborParam.cityName = s_province.name
pageData.laborParam.districtName = s_city.name; pageData.laborParam.districtName = s_city.name
pageData.laborParam.townName = s_district.name; pageData.laborParam.townName = s_district.name
pageData.laborParam.villageName = s_street.name; pageData.laborParam.villageName = s_street.name
pageData.laborParam.cityCode = s_province.code; pageData.laborParam.cityCode = s_province.code
pageData.laborParam.districtCode = s_city.code; pageData.laborParam.districtCode = s_city.code
pageData.laborParam.townCode = s_district.code; pageData.laborParam.townCode = s_district.code
pageData.laborParam.villageCode = s_street.code; pageData.laborParam.villageCode = s_street.code
}else{ } else {
pageData.laborParam.addr = s_province.name+s_city.name+s_district.name; pageData.laborParam.addr = s_province.name + s_city.name + s_district.name
pageData.laborParam.cityName = s_province.name; pageData.laborParam.cityName = s_province.name
pageData.laborParam.districtName = s_city.name; pageData.laborParam.districtName = s_city.name
pageData.laborParam.townName = s_district.name; pageData.laborParam.townName = s_district.name
pageData.laborParam.cityCode = s_province.code; pageData.laborParam.cityCode = s_province.code
pageData.laborParam.districtCode = s_city.code; pageData.laborParam.districtCode = s_city.code
pageData.laborParam.townCode = s_district.code; pageData.laborParam.townCode = s_district.code
} }
pageData.isActive=true; pageData.isActive = true
} }
/* ****************************************************** */ /* ****************************************************** */
const { show, options, form } = toRefs(pageData); const { show, options, form } = toRefs(pageData)
async function initDict() { async function initDict() {
pageData.options.area = await getDictData(); pageData.options.area = await getDictData()
pageData.options.urgentdegree = dictStore.getDictList.employment_urgent.map((item) => { pageData.options.urgentdegree = dictStore.getDictList.employment_urgent.map((item) => {
return { return {
value: item.value, value: item.value,
...@@ -541,7 +548,7 @@ ...@@ -541,7 +548,7 @@
function getCurrentAddressInfo() { function getCurrentAddressInfo() {
if (!uni.getStorageSync('location')) if (!uni.getStorageSync('location'))
return return
const { lon, lat } = uni.getStorageSync('location') const { lon, lat } = uni.getStorageSync('location')
pageData.position = [lon, lat] pageData.position = [lon, lat]
...@@ -561,11 +568,11 @@ ...@@ -561,11 +568,11 @@
pageData.loading = true pageData.loading = true
LinghuoyonggongAPI.getLaborAppDetail({ id }) LinghuoyonggongAPI.getLaborAppDetail({ id })
.then((res) => { .then((res) => {
pageData.laborParam.addr = res.villageName; pageData.laborParam.addr = res.villageName
pageData.laborParam.contactName = res.contactName; pageData.laborParam.contactName = res.contactName
pageData.laborParam.contactMobile = res.contactMobile; pageData.laborParam.contactMobile = res.contactMobile
pageData.workersParam = res.workers; pageData.workersParam = res.workers
pageData.isActive = true; pageData.isActive = true
}) })
.finally(() => { .finally(() => {
pageData.loading = false pageData.loading = false
...@@ -678,8 +685,8 @@ ...@@ -678,8 +685,8 @@
}) })
} }
// 发布灵活用工 // 发布灵活用工
function submitLaborAdd(){ function submitLaborAdd() {
let laborParam = pageData.laborParam; const laborParam = pageData.laborParam
if (pageData.position.length == 0) { if (pageData.position.length == 0) {
toastRef.value.show({ toastRef.value.show({
type: 'error', type: 'error',
...@@ -687,42 +694,42 @@ ...@@ -687,42 +694,42 @@
}) })
return return
} }
laborParam.lon = pageData.position[0]; laborParam.lon = pageData.position[0]
laborParam.lat = pageData.position[1]; laborParam.lat = pageData.position[1]
let entries = Object.entries(VerificationInfo1); const entries = Object.entries(VerificationInfo1)
for (let [key, value] of entries) { for (const [key, value] of entries) {
if(laborParam[key].trim().length === 0){ if (laborParam[key].trim().length === 0) {
toastRef.value.show({ toastRef.value.show({
type: 'error', type: 'error',
text: value, text: value,
}) })
return; return
} }
} }
if(!pageData.workersParam.length){ if (!pageData.workersParam.length) {
toastRef.value.show({ toastRef.value.show({
type: 'error', type: 'error',
text: '请选择待业人员', text: '请选择待业人员',
}) })
return; return
} }
let formData = { const formData = {
laborParam:laborParam, laborParam,
workersParam:pageData.workersParam workersParam: pageData.workersParam,
} }
LinghuoyonggongAPI.postLaborAdd(formData).then((res) => { LinghuoyonggongAPI.postLaborAdd(formData).then((res) => {
toastRef.value.show({ toastRef.value.show({
type: 'success', type: 'success',
text: '发布成功', text: '发布成功',
}) })
setTimeout(()=>{ setTimeout(() => {
uni.navigateBack({ uni.navigateBack({
delta: 1 delta: 1,
}); })
},1000) }, 1000)
}) })
} }
function getCurrentDate(){ function getCurrentDate() {
const date = new Date() const date = new Date()
const year = date.getFullYear() const year = date.getFullYear()
const month = date.getMonth() + 1 const month = date.getMonth() + 1
...@@ -738,18 +745,37 @@ ...@@ -738,18 +745,37 @@
<view class="yr-form"> <view class="yr-form">
<view class="yr-form-item"> <view class="yr-form-item">
<view class="yr-form-title"><text class="required-mark">*</text>村名称</view> <view class="yr-form-title"><text class="required-mark">*</text>村名称</view>
<picker class="yr-form-input" indicator-class="yr-form-village" mode="multiSelector" :range="pageData.mulSelect" :range-key="'name'" @change="pickerChange" @columnchange="colChange"> <picker
class="yr-form-input"
indicator-class="yr-form-village"
mode="multiSelector"
:range="pageData.mulSelect"
range-key="name"
@change="pickerChange"
@columnchange="colChange"
>
<view class="yr-input-placeholder" v-if="!pageData.isActive">请选择</view> <view class="yr-input-placeholder" v-if="!pageData.isActive">请选择</view>
<view v-else class="yr-input-style">{{pageData.laborParam.addr}}</view> <view v-else class="yr-input-style">{{ pageData.laborParam.addr }}</view>
</picker> </picker>
</view> </view>
<view class="yr-form-item"> <view class="yr-form-item">
<view class="yr-form-title"><text class="required-mark">*</text>联系人</view> <view class="yr-form-title"><text class="required-mark">*</text>联系人</view>
<input class="yr-form-input" v-model="pageData.laborParam.contactName" name="input" placeholder="请填写联系人姓名" /> <input
class="yr-form-input"
v-model="pageData.laborParam.contactName"
name="input"
placeholder="请填写联系人姓名"
/>
</view> </view>
<view class="yr-form-item border-bottom-none"> <view class="yr-form-item border-bottom-none">
<view class="yr-form-title"><text class="required-mark">*</text>联系电话</view> <view class="yr-form-title"><text class="required-mark">*</text>联系电话</view>
<input class="yr-form-input" v-model="pageData.laborParam.contactMobile" type="tel" :maxlength="11" placeholder="请填写联系电话" /> <input
class="yr-form-input"
v-model="pageData.laborParam.contactMobile"
type="tel"
:maxlength="11"
placeholder="请填写联系电话"
/>
</view> </view>
</view> </view>
</view> </view>
...@@ -767,34 +793,71 @@ ...@@ -767,34 +793,71 @@
</view> </view>
</view> </view>
<view class="yr-person-item" v-for="(item,index) in pageData.workersParam" :key="index"> <view class="yr-person-item" v-for="(item, index) in pageData.workersParam" :key="index">
<view class="yr-person-info"> <view class="yr-person-info">
<view class="person_name_attr">{{item.name}}<text class="person_attr">{{item.attr}}</text></view> <view class="person_name_attr"
<view class="person-info">{{getCalculateAge(item.birthday)}}{{ returnDictZhVel('gender',item.gender) }}{{ returnDictZhVel('edu',item.edu)}}</view> >{{ item.name }}<text class="person_attr">{{ item.attr }}</text></view
<view class="person-info text_overflow_ellipsis">技能:{{item.skill}}</view> >
<view class="person-info"
>{{ getCalculateAge(item.birthday) }}{{ returnDictZhVel('gender', item.gender) }}{{
returnDictZhVel('edu', item.edu)
}}</view
>
<view class="person-info text_overflow_ellipsis">技能:{{ item.skill }}</view>
</view> </view>
<view class="edit_person" @click="editPersonPopup(index)"> <view class="edit_person" @click="editPersonPopup(index)">
<image class="edit_person_icon" src="/static/images/linghuoyonggong/edit_person.png" /> <image class="edit_person_icon" src="/static/images/linghuoyonggong/edit_person.png" />
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view class="yr-submit-btn"> <view class="yr-submit-btn">
<view class="submit-btn-view"> <view class="submit-btn-view">
<fui-button text="发布" bold radius="96rpx" @click="submitLaborAdd" height="80rpx"/> <fui-button text="发布" bold radius="96rpx" @click="submitLaborAdd" height="80rpx" />
</view> </view>
</view> </view>
</view> </view>
<fui-date-picker :show="show.time1" type="3" @change="handleChangeTime1" :min-date="getCurrentDate()" @cancel="show.time1 = false" /> <fui-date-picker
<fui-date-picker :show="show.time2" type="3" @change="handleChangeTime2" :min-date="getCurrentDate()" @cancel="show.time2 = false" /> :show="show.time1"
<fui-picker :show="show.type" :layer="1" :linkage="true" :options="options.type" @change="handleChangetype" @cancel="show.type = false" /> type="3"
<fui-picker :show="show.urgentdegree" :layer="1" :linkage="true" :options="options.urgentdegree" @change="handleChangeUrgentdegree" @cancel="show.urgentdegree = false"/> @change="handleChangeTime1"
<fui-picker :show="show.area" :options="options.area" :linkage="true" :layer="3" @change="handleChangeAddress" @cancel="show.area = false" /> :min-date="getCurrentDate()"
@cancel="show.time1 = false"
/>
<fui-date-picker
:show="show.time2"
type="3"
@change="handleChangeTime2"
:min-date="getCurrentDate()"
@cancel="show.time2 = false"
/>
<fui-picker
:show="show.type"
:layer="1"
:linkage="true"
:options="options.type"
@change="handleChangetype"
@cancel="show.type = false"
/>
<fui-picker
:show="show.urgentdegree"
:layer="1"
:linkage="true"
:options="options.urgentdegree"
@change="handleChangeUrgentdegree"
@cancel="show.urgentdegree = false"
/>
<fui-picker
:show="show.area"
:options="options.area"
:linkage="true"
:layer="3"
@change="handleChangeAddress"
@cancel="show.area = false"
/>
<fui-toast ref="toastRef" /> <fui-toast ref="toastRef" />
<fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)" /> <fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)" />
...@@ -802,72 +865,140 @@ ...@@ -802,72 +865,140 @@
<fui-bottom-popup :show="pageData.isPersonPopupShow" @close="pageData.isPersonPopupShow = false"> <fui-bottom-popup :show="pageData.isPersonPopupShow" @close="pageData.isPersonPopupShow = false">
<view class="fui-custom__wrap yr_person_popup"> <view class="fui-custom__wrap yr_person_popup">
<view class="popup_top"> <view class="popup_top">
<uni-icons type="left" size="24" color="#333333" @click="pageData.isPersonPopupShow = false"></uni-icons> <uni-icons type="left" size="24" color="#333333" @click="pageData.isPersonPopupShow = false" />
<view class="add_person_text">{{pageData.actionType == 'edit'?'编辑':'添加'}}人员</view> <view class="add_person_text">{{ pageData.actionType == 'edit' ? '编辑' : '添加' }}人员</view>
<view class="del_person_btn" v-if="pageData.actionType == 'edit'" @click="delPersonData(tempWorkersParam.name)">删除</view> <view
<view class="del_person_btn" v-else></view> class="del_person_btn"
v-if="pageData.actionType == 'edit'"
@click="delPersonData(tempWorkersParam.name)"
>删除</view
>
<view class="del_person_btn" v-else />
</view> </view>
<view class="popup_content"> <view class="popup_content">
<fui-form error-position="1" ref="form" top="0" :model="tempWorkersParam" :show="false"> <fui-form error-position="1" ref="form" top="0" :model="tempWorkersParam" :show="false">
<fui-form-item label="姓名"> <fui-form-item label="姓名">
<fui-input :borderBottom="false" v-model="tempWorkersParam.name" :padding="[0]" placeholder="请输入姓名"></fui-input> <fui-input
:borderBottom="false"
v-model="tempWorkersParam.name"
:padding="[0]"
placeholder="请输入姓名"
/>
</fui-form-item> </fui-form-item>
<fui-form-item label="手机号"> <fui-form-item label="手机号">
<fui-input type="tel" :borderBottom="false" v-model="tempWorkersParam.mobile" :padding="[0]" placeholder="请输入手机号"></fui-input> <fui-input
type="tel"
:borderBottom="false"
v-model="tempWorkersParam.mobile"
:padding="[0]"
placeholder="请输入手机号"
/>
</fui-form-item> </fui-form-item>
<fui-form-item label="性别"> <fui-form-item label="性别">
<fui-radio-group v-model="tempWorkersParam.genderZh"> <fui-radio-group v-model="tempWorkersParam.genderZh">
<fui-label inline v-for="item in DictData.sexArr" :key="item.id"> <fui-label inline v-for="item in DictData.sexArr" :key="item.id">
<fui-radio :value="item.itemValue"></fui-radio> <fui-radio :value="item.itemValue" />
<fui-text :size="28" :text="item.itemText" :padding="['0','30rpx','0','16rpx']"></fui-text> <fui-text :size="28" :text="item.itemText" :padding="['0', '30rpx', '0', '16rpx']" />
</fui-label> </fui-label>
</fui-radio-group> </fui-radio-group>
</fui-form-item> </fui-form-item>
<fui-form-item label="出生日期" highlight> <fui-form-item label="出生日期" highlight>
<fui-input :borderBottom="false" @click="pageData.datePickerShow = true" v-model="tempWorkersParam.birthday" :padding="[0]" :disabled="true" placeholder="请选择出生日期" <fui-input
backgroundColor="transparent"></fui-input> :borderBottom="false"
@click="pageData.datePickerShow = true"
v-model="tempWorkersParam.birthday"
:padding="[0]"
:disabled="true"
placeholder="请选择出生日期"
backgroundColor="transparent"
/>
<!-- <picker class="publish_empl_picker" mode="date" :value="startDate" :end="endDate" @change="dateBirthChange"> <!-- <picker class="publish_empl_picker" mode="date" :value="startDate" :end="endDate" @change="dateBirthChange">
<fui-input :borderBottom="false" v-model="tempWorkersParam.birthday" :padding="[0]" :disabled="true" placeholder="请选择出生日期" <fui-input :borderBottom="false" v-model="tempWorkersParam.birthday" :padding="[0]" :disabled="true" placeholder="请选择出生日期"
backgroundColor="transparent"></fui-input> backgroundColor="transparent"></fui-input>
</picker> --> </picker> -->
</fui-form-item> </fui-form-item>
<fui-form-item label="学历" highlight @click="onPickerTap('education')"> <fui-form-item label="学历" highlight @click="onPickerTap('education')">
<fui-input v-model="tempWorkersParam.eduZh" :borderBottom="false" :padding="[0]" placeholder="请选择学历" :disabled="true" <fui-input
backgroundColor="transparent"></fui-input> v-model="tempWorkersParam.eduZh"
:borderBottom="false"
:padding="[0]"
placeholder="请选择学历"
:disabled="true"
backgroundColor="transparent"
/>
</fui-form-item> </fui-form-item>
<fui-form-item label="人员属性" highlight @click="onPickerTap('socialattributes')"> <fui-form-item label="人员属性" highlight @click="onPickerTap('socialattributes')">
<fui-input v-model="tempWorkersParam.attr" :borderBottom="false" :padding="[0]" placeholder="请选择人员属性" :disabled="true" <fui-input
backgroundColor="transparent"></fui-input> v-model="tempWorkersParam.attr"
:borderBottom="false"
:padding="[0]"
placeholder="请选择人员属性"
:disabled="true"
backgroundColor="transparent"
/>
</fui-form-item> </fui-form-item>
<fui-form-item label="人员技能" highlight @click="DictData.isSkillPopupShow = true"> <fui-form-item label="人员技能" highlight @click="DictData.isSkillPopupShow = true">
<fui-input v-model="tempWorkersParam.skill" :borderBottom="false" :padding="[0]" placeholder="请选择人员技能" :disabled="true" <fui-input
backgroundColor="transparent"></fui-input> v-model="tempWorkersParam.skill"
:borderBottom="false"
:padding="[0]"
placeholder="请选择人员技能"
:disabled="true"
backgroundColor="transparent"
/>
</fui-form-item> </fui-form-item>
</fui-form> </fui-form>
</view> </view>
<fui-button text="保存" bold radius="96rpx" @click="addPersonData" height="80rpx"/> <fui-button text="保存" bold radius="96rpx" @click="addPersonData" height="80rpx" />
</view> </view>
</fui-bottom-popup> </fui-bottom-popup>
<!-- <picker mode="date" :value="currentDate" :start="startDate" :end="endDate" @change="dateBirthChange"></picker> --> <!-- <picker mode="date" :value="currentDate" :start="startDate" :end="endDate" @change="dateBirthChange"></picker> -->
<fui-picker :show="pageData.attrPickerShow" :zIndex="9999" layer="1" :options="DictData.dictValArr" :linkage="false" @change="attrChange" @cancel="pageData.attrPickerShow = false"></fui-picker> <fui-picker
:show="pageData.attrPickerShow"
:zIndex="9999"
layer="1"
:options="DictData.dictValArr"
:linkage="false"
@change="attrChange"
@cancel="pageData.attrPickerShow = false"
/>
<!-- 人员技能 --> <!-- 人员技能 -->
<fui-bottom-popup :show="DictData.isSkillPopupShow"> <fui-bottom-popup :show="DictData.isSkillPopupShow">
<view class="fui-scroll__wrap"> <view class="fui-scroll__wrap">
<view class="fui-title">请选择技能</view> <view class="fui-title">请选择技能</view>
<fui-cascader ref="skillPopupRef" :value="DictData.skillValue" textSize="32" size="32" stepLoading @change="changeSkill" @complete="selectCompleteSkill" :options="DictData.skillOptionsVal"></fui-cascader> <fui-cascader
<view class="fui-icon__close" @tap.stop="DictData.isSkillPopupShow=false"> ref="skillPopupRef"
<fui-icon name="close" :size="48"></fui-icon> :value="DictData.skillValue"
textSize="32"
size="32"
stepLoading
@change="changeSkill"
@complete="selectCompleteSkill"
:options="DictData.skillOptionsVal"
/>
<view class="fui-icon__close" @tap.stop="DictData.isSkillPopupShow = false">
<fui-icon name="close" :size="48" />
</view> </view>
</view> </view>
</fui-bottom-popup> </fui-bottom-popup>
<fui-date-picker :isShow="true" :zIndex="9999" :show="pageData.datePickerShow" type="3" :range="false" minDate="1940-01-01" :valueEnd="getCurrentDate()" :value="startDate" :maxDate="getCurrentDate()" @change="dateBirthChange" @cancel="pageData.datePickerShow=false"></fui-date-picker> <fui-date-picker
:isShow="true"
<!-- <fui-date-picker :show="pageData.birthdayPickerIsShow" :type="type" :range="range" :value="value" :valueEnd="valueEnd" @change="change" :zIndex="9999"
:show="pageData.datePickerShow"
type="3"
:range="false"
minDate="1940-01-01"
:valueEnd="getCurrentDate()"
:value="startDate"
:maxDate="getCurrentDate()"
@change="dateBirthChange"
@cancel="pageData.datePickerShow = false"
/>
<!-- <fui-date-picker :show="pageData.birthdayPickerIsShow" :type="type" :range="range" :value="value" :valueEnd="valueEnd" @change="change"
@cancel="cancel"> @cancel="cancel">
</fui-date-picker> --> </fui-date-picker> -->
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
...@@ -885,15 +1016,15 @@ ...@@ -885,15 +1016,15 @@
padding: 20rpx; padding: 20rpx;
border-radius: 10rpx; border-radius: 10rpx;
} }
.bg_white{ .bg_white {
background-color: #FFFFFF; background-color: #ffffff;
} }
.required-mark{ .required-mark {
color:#FF5733; color: #ff5733;
font-size: 28rpx; font-size: 28rpx;
margin-right: 4rpx; margin-right: 4rpx;
} }
.text_overflow_ellipsis{ .text_overflow_ellipsis {
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
...@@ -905,77 +1036,77 @@ ...@@ -905,77 +1036,77 @@
display: flex; display: flex;
justify-content: center; justify-content: center;
flex-wrap: wrap; flex-wrap: wrap;
.form_view{ .form_view {
display: flex; display: flex;
justify-content: center; justify-content: center;
.yr-form{ .yr-form {
width: 642rpx; width: 642rpx;
} }
.border-bottom-none{ .border-bottom-none {
border-bottom: none !important; border-bottom: none !important;
} }
.yr-form-item{ .yr-form-item {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-content: center; align-content: center;
padding-top: 36rpx; padding-top: 36rpx;
padding-bottom: 36rpx; padding-bottom: 36rpx;
border-bottom: 2rpx solid #EEEEEE; border-bottom: 2rpx solid #eeeeee;
.yr-form-title{ .yr-form-title {
font-size: 28rpx; font-size: 28rpx;
color: #333333; color: #333333;
width: 132rpx; width: 132rpx;
} }
.yr-form-input{ .yr-form-input {
width: 480rpx; width: 480rpx;
} }
.yr-input-placeholder { .yr-input-placeholder {
font-size: 28rpx !important; font-size: 28rpx !important;
color: #999999 !important; color: #999999 !important;
} }
.yr-input-style{ .yr-input-style {
font-size: 30rpx; font-size: 30rpx;
color:#181818; color: #181818;
} }
} }
} }
.unemployed_person{ .unemployed_person {
margin-top: 24rpx; margin-top: 24rpx;
} }
.yr_add_btn{ .yr_add_btn {
display: flex; display: flex;
align-items: center; align-items: center;
.add_person_icon{ .add_person_icon {
width: 32rpx; width: 32rpx;
height: 32rpx; height: 32rpx;
} }
.add_person_text{ .add_person_text {
color: #5DB66F; color: #5db66f;
font-size: 28rpx; font-size: 28rpx;
margin-left: 20rpx; margin-left: 20rpx;
} }
} }
.yr-person-item{ .yr-person-item {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
border-bottom: 2rpx solid #EEEEEE; border-bottom: 2rpx solid #eeeeee;
margin-top: 28rpx; margin-top: 28rpx;
.yr-person-info{ .yr-person-info {
.person_name_attr{ .person_name_attr {
font-size: 28rpx; font-size: 28rpx;
font-weight: 500; font-weight: 500;
color: #333333; color: #333333;
.person_attr{ .person_attr {
font-size: 24rpx; font-size: 24rpx;
font-weight: 400; font-weight: 400;
color: #5DB66F; color: #5db66f;
margin-left: 12rpx; margin-left: 12rpx;
} }
} }
.person-info{ .person-info {
font-size: 24rpx; font-size: 24rpx;
color: #999999; color: #999999;
vertical-align: middle; vertical-align: middle;
...@@ -985,33 +1116,32 @@ ...@@ -985,33 +1116,32 @@
} }
} }
.edit_person{ .edit_person {
width: 68rpx; width: 68rpx;
height: 88rpx; height: 88rpx;
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
align-items: center; align-items: center;
} }
.edit_person_icon{ .edit_person_icon {
width: 32rpx; width: 32rpx;
height: 28rpx; height: 28rpx;
} }
} }
.yr-person-item:last-child{ .yr-person-item:last-child {
border-bottom: none; border-bottom: none;
} }
} }
.yr-submit-btn{ .yr-submit-btn {
display: flex; display: flex;
justify-content: center; justify-content: center;
margin-top: 40rpx; margin-top: 40rpx;
.submit-btn-view{ .submit-btn-view {
width: 690rpx; width: 690rpx;
} }
} }
.form-section { .form-section {
// border-bottom: 1rpx solid #f5f5f5; // border-bottom: 1rpx solid #f5f5f5;
} }
......
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
], ],
data: { data: {
username: '', username: '',
password:'', password: '',
// code: '', // code: '',
read: false, read: false,
deviceId: '', deviceId: '',
...@@ -274,8 +274,7 @@ ...@@ -274,8 +274,7 @@
v-model="model.form.data.password" v-model="model.form.data.password"
backgroundColor="transparent" backgroundColor="transparent"
borderColor="transparent" borderColor="transparent"
> />
</fui-input>
</view> </view>
</view> </view>
<!-- <view class="login-input-area"> <!-- <view class="login-input-area">
......
<script setup lang="ts"> <script setup lang="ts">
import { reactive, ref } from 'vue' import { reactive, ref } from 'vue'
import * as NewsApi from '@/api/model/news'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import * as NewsApi from '@/api/model/news'
interface News { interface News {
id: number id: number
...@@ -34,7 +34,8 @@ ...@@ -34,7 +34,8 @@
const navigateName = ref(['热点新闻', '农业政策']) const navigateName = ref(['热点新闻', '农业政策'])
async function getNewsList(params) { async function getNewsList(params) {
if (model.loading) return if (model.loading)
return
model.loading = true model.loading = true
NewsApi.getList(params).then((res) => { NewsApi.getList(params).then((res) => {
if (res.records.length > 0) { if (res.records.length > 0) {
...@@ -129,7 +130,7 @@ ...@@ -129,7 +130,7 @@
<image class="mt-0.5 mr-1 w-30 h-26" src="/static/images/news/views.png" /> <image class="mt-0.5 mr-1 w-30 h-26" src="/static/images/news/views.png" />
<view class="flex-center text-24 lh-24rpx">{{ news.viewCount }}</view> <view class="flex-center text-24 lh-24rpx">{{ news.viewCount }}</view>
</view> </view>
<view v-show="!news.posterUrl" class="w-4%"></view> <view v-show="!news.posterUrl" class="w-4%" />
</view> </view>
</view> </view>
<view v-show="news.posterUrl" class="w-30% h-130"> <view v-show="news.posterUrl" class="w-30% h-130">
......
<script setup lang="ts"> <script setup lang="ts">
import dayjs from 'dayjs' import dayjs from 'dayjs'
import * as WeatherAPI from '@/api/model/weather' import * as WeatherAPI from '@/api/model/weather'
import { Echarts, useEcharts } from '@/components/Echarts' import { Echarts, useEcharts } from '@/components/Echarts'
import { getDayLabelValue, getWeatherIcon } from '@/utils/weather' import { getDayLabelValue, getWeatherIcon } from '@/utils/weather'
// 逐 7 天预报图表 // 逐 7 天预报图表
const [register7Forecast, Forecast7Chart] = useEcharts() const [register7Forecast, Forecast7Chart] = useEcharts()
const model = reactive({ const model = reactive({
days: 15, days: 15,
updateTime: '-', updateTime: '-',
}) })
onLoad(async () => { onLoad(async () => {
const location = uni.getStorageSync('location') const location = uni.getStorageSync('location')
const forecasts = await WeatherAPI.forecast(`${location.lon},${location.lat}`, model.days).then((res) => { const forecasts = await WeatherAPI.forecast(`${location.lon},${location.lat}`, model.days).then((res) => {
model.updateTime = dayjs(res.data.updateTime).format('YYYY-MM-DD HH:mm') model.updateTime = dayjs(res.data.updateTime).format('YYYY-MM-DD HH:mm')
...@@ -44,22 +44,24 @@ onLoad(async () => { ...@@ -44,22 +44,24 @@ onLoad(async () => {
}, },
formatter: (params) => { formatter: (params) => {
// 过滤掉星期标签、日期标签和天气图标 // 过滤掉星期标签、日期标签和天气图标
const filteredParams = params.filter(param => { const filteredParams = params.filter((param) => {
return param.seriesName !== '星期标签' && return (
param.seriesName !== '星期标签' &&
param.seriesName !== '日期标签' && param.seriesName !== '日期标签' &&
param.seriesName !== '天气图标'; param.seriesName !== '天气图标'
}); )
if (filteredParams.length === 0) return ''; })
if (filteredParams.length === 0) return ''
let result = ''; let result = ''
filteredParams.forEach(param => { filteredParams.forEach((param) => {
// 只显示有意义的数值信息 // 只显示有意义的数值信息
if (param.seriesName === '最高温度' || param.seriesName === '最低温度') { if (param.seriesName === '最高温度' || param.seriesName === '最低温度') {
result += `${param.seriesName}: ${param.value}°<br/>`; result += `${param.seriesName}: ${param.value}°<br/>`
}
});
return result;
} }
})
return result
},
}, },
grid: { grid: {
top: '5%', top: '5%',
...@@ -194,7 +196,7 @@ onLoad(async () => { ...@@ -194,7 +196,7 @@ onLoad(async () => {
}, },
], ],
}) })
}) })
</script> </script>
<template> <template>
...@@ -213,5 +215,5 @@ onLoad(async () => { ...@@ -213,5 +215,5 @@ onLoad(async () => {
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
// //
</style> </style>
<script setup lang="ts"> <script setup lang="ts">
import { reactive, toRefs } from 'vue'
import { onShow } from '@dcloudio/uni-app' import { onShow } from '@dcloudio/uni-app'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
import { useGlobSetting } from '/@/hooks/setting' import { useGlobSetting } from '/@/hooks/setting'
...@@ -23,7 +22,13 @@ onLoad((pageOptions) => { ...@@ -23,7 +22,13 @@ onLoad((pageOptions) => {
pageData.form[key] = res[key] pageData.form[key] = res[key]
} }
}) })
// 回显省市区名称
if (res.provinceName && res.cityName && res.districtName) {
pageData.form.provinceName = res.provinceName
pageData.form.cityName = res.cityName
pageData.form.districtName = res.districtName
pageData.form.provinceText = res.provinceName + '/' + res.cityName + '/' + res.districtName pageData.form.provinceText = res.provinceName + '/' + res.cityName + '/' + res.districtName
}
// 编辑模式下,如果已有示例图片,需要设置到上传组件中 // 编辑模式下,如果已有示例图片,需要设置到上传组件中
if (res.coverImage) { if (res.coverImage) {
...@@ -99,6 +104,7 @@ const pageData = reactive({ ...@@ -99,6 +104,7 @@ const pageData = reactive({
districtName: '', districtName: '',
addressDetail: '', addressDetail: '',
coverImage: '', coverImage: '',
slogan: '',
}, },
rules: [ rules: [
{ {
...@@ -139,7 +145,17 @@ const pageData = reactive({ ...@@ -139,7 +145,17 @@ const pageData = reactive({
{ {
name: 'provinceName', name: 'provinceName',
rule: ['required'], rule: ['required'],
msg: ['请选择归属省份'], msg: ['请填写省市区信息!'],
},
{
name: 'cityName',
rule: ['required'],
msg: ['请填写省市区信息!'],
},
{
name: 'districtName',
rule: ['required'],
msg: ['请填写省市区信息!'],
}, },
{ {
name: 'addressDetail', name: 'addressDetail',
...@@ -231,15 +247,43 @@ function submit() { ...@@ -231,15 +247,43 @@ 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 pageData.loading = true
// 提交前处理:通过对provinceText值按/分隔,分别赋值给provinceName、cityName和districtName
if (pageData.form.provinceText) {
const addressParts = pageData.form.provinceText.split('/')
if (addressParts.length >= 3) {
pageData.form.provinceName = addressParts[0]
pageData.form.cityName = addressParts[1]
pageData.form.districtName = addressParts[2]
}
}
const apiCall = pageData.form.id ? NongchangAPI.farmsEdit : NongchangAPI.farmsAdd const apiCall = pageData.form.id ? NongchangAPI.farmsEdit : NongchangAPI.farmsAdd
apiCall(pageData.form) apiCall(pageData.form)
.then(() => { .then((res) => {
toastRef.value.show({ toastRef.value.show({
type: 'success', type: 'success',
text: pageData.form.id ? '保存修改成功' : '添加农场成功', text: pageData.form.id ? '保存修改成功' : '添加农场成功',
}) })
// 获取农场ID:编辑时使用当前ID,新增时从返回值获取(假设返回的是ID或包含ID的对象)
// 根据后端接口惯例,如果返回的是ID字符串直接使用,如果是对象则取id字段
// 暂时假设res为ID或者不影响跳转,优先使用pageData.form.id,如果是新增则尝试从res获取
// 如果res不是id,则需要确认接口返回值结构。通常新增接口返回ID比较合理。
// 鉴于不确定接口返回值,这里先假设编辑时id已知,新增时尝试从res获取,如果获取不到则回退到列表页
const targetId = pageData.form.id || (typeof res === 'string' ? res : res?.id);
setTimeout(() => { setTimeout(() => {
if (targetId) {
// 跳转到农场详情页,注意路径需要是绝对路径
uni.redirectTo({
url: `/pages/nongchang/detail/index?id=${targetId}`
})
} else {
// 如果没有ID,回退上一页
uni.navigateBack() uni.navigateBack()
}
}, 500); }, 500);
}) })
.finally(() => { .finally(() => {
...@@ -326,6 +370,19 @@ function submit() { ...@@ -326,6 +370,19 @@ function submit() {
class="block-textarea" class="block-textarea"
/> />
</view> </view>
<!-- 农场标语 -->
<view class="form-item-block">
<view class="form-item-label">农场标语</view>
<fui-textarea
height="100rpx"
size="28"
:borderTop="false"
:borderBottom="false"
placeholder="请输入农场标语"
v-model="pageData.form.slogan"
class="block-textarea"
/>
</view>
</view> </view>
<!-- 第二组表单 --> <!-- 第二组表单 -->
...@@ -333,14 +390,14 @@ function submit() { ...@@ -333,14 +390,14 @@ function submit() {
<fui-form-item <fui-form-item
required required
asterisk asterisk
label="归属省份" label="归属地区"
labelSize="28" labelSize="28"
:labelWeight="400" :labelWeight="400"
labelWidth="auto" labelWidth="auto"
> >
<view class="time-input" @click="pageData.show.address = true"> <view class="time-input" @click="pageData.show.address = true">
<text class="select-text" :class="{ placeholder: !pageData.form.provinceText }"> <text class="select-text" :class="{ placeholder: !pageData.form.provinceText }">
{{ pageData.form.provinceText || '请选择归属省份' }} {{ pageData.form.provinceText || '请选择归属地区' }}
</text> </text>
</view> </view>
</fui-form-item> </fui-form-item>
...@@ -351,8 +408,8 @@ function submit() { ...@@ -351,8 +408,8 @@ function submit() {
labelWidth="auto" labelWidth="auto"
labelSize="28" labelSize="28"
:labelWeight="400" :labelWeight="400"
label="归属省份" label="归属地区"
placeholder="请选择归属省份" placeholder="请选择归属地区"
:value="pageData.form.provinceText" :value="pageData.form.provinceText"
/> />
</view> --> </view> -->
......
<!-- 农场详情 --> <!-- 农场详情 -->
<script setup lang="ts"> <script setup lang="ts">
import * as turf from '@turf/turf' import * as turf from '@turf/turf'
import type { Page } from './config' import dayjs from 'dayjs'
import PlayWidget from './components/PlayWidget.vue' import SaveDialog from '../../device/components/save-dialog.vue'
import SaveDialog from '../../device/components/save-dialog.vue' import type { Page } from './config'
import Navigate from '@/utils/page/navigate' import PlayWidget from './components/PlayWidget.vue'
import { import Navigate from '@/utils/page/navigate'
import {
addDefaultGeoJSONSource, addDefaultGeoJSONSource,
addDefaultSplotLayer, addDefaultSplotLayer,
addDefaultSymbolLayer, addDefaultSymbolLayer,
useMapbox, useMapbox,
} from '@/components/Map/Mapbox/hook' } from '@/components/Map/Mapbox/hook'
import type { ToolBoxButtonHandleEvent } from '@/components/Map/Widgets/ToolBox' import type { ToolBoxButtonHandleEvent } from '@/components/Map/Widgets/ToolBox'
import { ToolBoxWidget, useToolBoxWidget } from '@/components/Map/Widgets/ToolBox' import { ToolBoxWidget, useToolBoxWidget } from '@/components/Map/Widgets/ToolBox'
import * as NongchangAPI from '@/api/model/nongchang' import * as NongchangAPI from '@/api/model/nongchang'
import * as farmbaseApi from '@/api/model/farmbase' import * as farmbaseApi from '@/api/model/farmbase'
import navigate from '@/utils/page/navigate'
import dayjs from 'dayjs' // 页面参数
const page = reactive<Page>({
// 页面参数
const page = reactive<Page>({
id: 'example-mapbox', id: 'example-mapbox',
init: false, init: false,
requests: 0, requests: 0,
latest: null, latest: null,
query: {}, query: {},
}) })
const showDialog = ref(false) const showDialog = ref(false)
onShow(() => { onShow(() => {
getFarmbaseInfoList() getFarmbaseInfoList()
}) })
const model = reactive({ const model = reactive({
id: '', id: '',
name: '', name: '',
lonlat: '', lonlat: '',
...@@ -65,15 +64,15 @@ const model = reactive({ ...@@ -65,15 +64,15 @@ const model = reactive({
farmbaseInfo: {}, farmbaseInfo: {},
farmbaseInfoList: [], farmbaseInfoList: [],
deviceTypeCount: [], deviceTypeCount: [],
}) })
onLoad(()=>{ onLoad(() => {
var today = dayjs(); const today = dayjs()
for (var i = 0; i < 5; i++) { for (let i = 0; i < 5; i++) {
var futureDate = today.add(i, 'day'); const futureDate = today.add(i, 'day')
model.forecasts.push(futureDate.format('DD')+'日'); model.forecasts.push(`${futureDate.format('DD')}日`)
} }
}) })
async function getFarmbaseInfoList() { async function getFarmbaseInfoList() {
farmbaseApi farmbaseApi
.list({ .list({
farmId: model.id, farmId: model.id,
...@@ -86,23 +85,23 @@ async function getFarmbaseInfoList() { ...@@ -86,23 +85,23 @@ async function getFarmbaseInfoList() {
getFarmbaseInfoById(records[0].id) getFarmbaseInfoById(records[0].id)
} }
}) })
} }
async function getFarmbaseInfoById(id) { async function getFarmbaseInfoById(id) {
farmbaseApi.getFarmbaseInfoById({ id }).then((res) => { farmbaseApi.getFarmbaseInfoById({ id }).then((res) => {
model.farmbaseInfo = res model.farmbaseInfo = res
getDeviceTypeCount() getDeviceTypeCount()
}) })
} }
async function getDeviceTypeCount() { async function getDeviceTypeCount() {
farmbaseApi.getDeviceTypeCount({ farmId: model.id, farmBaseId: model.farmbaseInfo?.id }).then((res) => { farmbaseApi.getDeviceTypeCount({ farmId: model.id, farmBaseId: model.farmbaseInfo?.id }).then((res) => {
model.deviceTypeCount = res model.deviceTypeCount = res
}) })
} }
// 地图组件 // 地图组件
const [registerMap, map] = useMapbox({ const [registerMap, map] = useMapbox({
style: { zoom: 15, isImg: true }, style: { zoom: 15, isImg: true },
onLoaded: async (data) => { onLoaded: async (data) => {
console.log('✨✨✨ Map Loaded', data) console.log('✨✨✨ Map Loaded', data)
...@@ -247,9 +246,9 @@ const [registerMap, map] = useMapbox({ ...@@ -247,9 +246,9 @@ const [registerMap, map] = useMapbox({
onSourceRequestErrorHandle: () => { onSourceRequestErrorHandle: () => {
Message.hideLoading() Message.hideLoading()
}, },
}) })
/* const mapAddImage = new Image(); /* const mapAddImage = new Image();
mapAddImage.src = '/static/images/test/mapLayer.png'; mapAddImage.src = '/static/images/test/mapLayer.png';
// 添加自定义图像图层 // 添加自定义图像图层
map.on('load','custom-image',()=>{ map.on('load','custom-image',()=>{
...@@ -271,8 +270,8 @@ map.on('load','custom-image',()=>{ ...@@ -271,8 +270,8 @@ map.on('load','custom-image',()=>{
} }
}); });
}) */ }) */
// 左侧工具栏小部件 // 左侧工具栏小部件
const [registerToolBoxWidget] = useToolBoxWidget({ const [registerToolBoxWidget] = useToolBoxWidget({
show: true, show: true,
expand: true, expand: true,
showExpandButton: false, showExpandButton: false,
...@@ -350,44 +349,44 @@ const [registerToolBoxWidget] = useToolBoxWidget({ ...@@ -350,44 +349,44 @@ const [registerToolBoxWidget] = useToolBoxWidget({
], ],
}, },
], ],
}) })
// 自定义导航栏回调函数 // 自定义导航栏回调函数
function onBackClick() { function onBackClick() {
uni.navigateBack({ uni.navigateBack({
delta: 1, delta: 1,
}) })
} }
function onTitleIconClick() { function onTitleIconClick() {
Navigate.to(`/pages/nongchang/create-nongchang-form?id=${model.id}`) Navigate.to(`/pages/nongchang/create-nongchang-form?id=${model.id}`)
} }
function onAddBaseClick() { function onAddBaseClick() {
// 点击添加基地按钮的回调函数 // 点击添加基地按钮的回调函数
Navigate.to(`/pages/jidiguanli/add?farmId=${model.id}`) Navigate.to(`/pages/jidiguanli/add?farmId=${model.id}`)
} }
function makePhoneCall(contactPhone){ function makePhoneCall(contactPhone) {
uni.makePhoneCall({ uni.makePhoneCall({
phoneNumber: contactPhone, phoneNumber: contactPhone,
success: function () { success() {
console.log('拨打电话成功!'); console.log('拨打电话成功!')
},
fail() {
console.log('拨打电话失败!')
}, },
fail: function () { })
console.log('拨打电话失败!');
} }
}); // 保留原有的导航栏按钮点击回调(如果有需要的话)
} onNavigationBarButtonTap((e) => {
// 保留原有的导航栏按钮点击回调(如果有需要的话)
onNavigationBarButtonTap((e) => {
console.log(e) console.log(e)
if (e.index === 0) { if (e.index === 0) {
Navigate.to(`/pages/jidiguanli/add?farmId=${model.id}`) Navigate.to(`/pages/jidiguanli/add?farmId=${model.id}`)
} }
}) })
const toDevice = (device)=>{ function toDevice(device) {
Navigate.to(`/pages/device/device?deviceType=${device.deviceType}&farmBaseId=`+model.farmbaseInfo?.id) Navigate.to(`/pages/device/device?deviceType=${device.deviceType}&farmBaseId=${model.farmbaseInfo?.id}`)
} }
</script> </script>
<template> <template>
...@@ -396,7 +395,7 @@ const toDevice = (device)=>{ ...@@ -396,7 +395,7 @@ const toDevice = (device)=>{
<view class="custom-navbar"> <view class="custom-navbar">
<view class="navbar-content"> <view class="navbar-content">
<view class="navbar-left" @click="onBackClick"> <view class="navbar-left" @click="onBackClick">
<fui-icon name="arrowleft" color="#FFF" size="44"></fui-icon> <fui-icon name="arrowleft" color="#FFF" size="44" />
</view> </view>
<view class="navbar-center"> <view class="navbar-center">
<text class="navbar-title">{{ model.name || '农场' }}</text> <text class="navbar-title">{{ model.name || '农场' }}</text>
...@@ -411,7 +410,7 @@ const toDevice = (device)=>{ ...@@ -411,7 +410,7 @@ const toDevice = (device)=>{
</view> </view>
<!-- 为自定义导航栏预留空间 --> <!-- 为自定义导航栏预留空间 -->
<view class="navbar-placeholder"></view> <view class="navbar-placeholder" />
<!-- 地图组件 --> <!-- 地图组件 -->
<!-- <view class="h-730 overflow-hidden map-box"> --> <!-- <view class="h-730 overflow-hidden map-box"> -->
...@@ -441,9 +440,7 @@ const toDevice = (device)=>{ ...@@ -441,9 +440,7 @@ const toDevice = (device)=>{
<view class="card !top-854"> <view class="card !top-854">
<view class="box-1"> <view class="box-1">
<view class="relative w-full flex flex-row"> <view class="relative w-full flex flex-row">
<view class="box-1-left" <view class="box-1-left"><image class="image_1" src="/static/images/nongchang/play.png" /></view>
><image class="image_1" src="/static/images/nongchang/play.png"
/></view>
<view class="box-1-right"> <view class="box-1-right">
<view class="box-1-right-top"> <view class="box-1-right-top">
<view class="text_1">预报</view> <view class="text_1">预报</view>
...@@ -534,7 +531,9 @@ const toDevice = (device)=>{ ...@@ -534,7 +531,9 @@ const toDevice = (device)=>{
<view class="box-3-info-item justify-between"> <view class="box-3-info-item justify-between">
<view class="box-3-info-item-text-box"> <view class="box-3-info-item-text-box">
<text class="box-3-info-item-text1">种植: </text> <text class="box-3-info-item-text1">种植: </text>
<text class="box-3-info-item-text2">{{model.farmbaseInfo.growCrops_dictText}}</text> <text class="box-3-info-item-text2">{{
model.farmbaseInfo.growCrops_dictText
}}</text>
</view> </view>
<view class="box-3-info-item-text-box"> <view class="box-3-info-item-text-box">
<text class="box-3-info-item-text1">预计产量: </text> <text class="box-3-info-item-text1">预计产量: </text>
...@@ -548,7 +547,11 @@ const toDevice = (device)=>{ ...@@ -548,7 +547,11 @@ const toDevice = (device)=>{
</view> </view>
<view class="box-3-info-item-text-box"> <view class="box-3-info-item-text-box">
<text class="box-3-info-item-text1">联系电话: </text> <text class="box-3-info-item-text1">联系电话: </text>
<text class="box-3-info-item-text2 box-contact-phone" @click="makePhoneCall(model.farmbaseInfo.contactPhone)">{{ model.farmbaseInfo.contactPhone }}</text> <text
class="box-3-info-item-text2 box-contact-phone"
@click="makePhoneCall(model.farmbaseInfo.contactPhone)"
>{{ model.farmbaseInfo.contactPhone }}</text
>
</view> </view>
</view> </view>
</view> </view>
...@@ -585,18 +588,18 @@ const toDevice = (device)=>{ ...@@ -585,18 +588,18 @@ const toDevice = (device)=>{
:show="showDialog" :show="showDialog"
:farmId="model.id" :farmId="model.id"
:farmBaseId="model.farmbaseInfo?.id" :farmBaseId="model.farmbaseInfo?.id"
@submitSuccess="getDeviceTypeCount" @submit-success="getDeviceTypeCount"
@close="showDialog = false" @close="showDialog = false"
/> />
</view> </view>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
// //
page { page {
background-color: #e6f5e8; background-color: #e6f5e8;
} }
.page { .page {
position: relative; position: relative;
min-height: 100vh; min-height: 100vh;
background-color: #e6f5e8; background-color: #e6f5e8;
...@@ -853,12 +856,12 @@ page { ...@@ -853,12 +856,12 @@ page {
font-weight: bold; font-weight: bold;
color: #333333; color: #333333;
} }
.weather-view{ .weather-view {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
} }
.weather-icon{ .weather-icon {
height: 40rpx; height: 40rpx;
width: 54rpx; width: 54rpx;
margin-right: 8rpx; margin-right: 8rpx;
...@@ -937,8 +940,8 @@ page { ...@@ -937,8 +940,8 @@ page {
font-size: 28rpx; font-size: 28rpx;
color: #333333; color: #333333;
} }
.box-contact-phone{ .box-contact-phone {
color: #2A82E4; color: #2a82e4;
text-decoration: underline; text-decoration: underline;
} }
} }
...@@ -1022,5 +1025,5 @@ page { ...@@ -1022,5 +1025,5 @@ page {
} }
} }
} }
} }
</style> </style>
<script setup lang="ts">
import { computed, reactive, ref } from 'vue'
import dayjs from 'dayjs'
const nowText = ref('')
function tick() {
nowText.value = dayjs().format('YYYY年MM月DD日 dddd HH:mm:ss')
}
tick()
setInterval(tick, 1000)
const pageData = reactive({
banner: {
image: '/static/images/codefun/farm.jpg',
name: '西区茶油基地',
},
search: '',
categories: [
{ id: 'all', name: '全部' },
{ id: 'irrigation', name: '灌溉系统' },
{ id: 'soil', name: '土壤监测' },
{ id: 'camera', name: '摄像监控' },
{ id: 'weather', name: '气象站' },
],
currentCategory: 'all',
areas: [
{ id: 1, name: '北区灌溉系统', type: 'irrigation' },
{ id: 2, name: '南区灌溉系统', type: 'irrigation' },
{ id: 3, name: '西区灌溉系统', type: 'irrigation' },
{ id: 4, name: '东区灌溉系统', type: 'irrigation' },
{ id: 5, name: '南区土壤监测', type: 'soil' },
{ id: 6, name: '北区土壤监测', type: 'soil' },
{ id: 7, name: '北区土壤监测', type: 'soil' },
{ id: 8, name: '西区摄像监控', type: 'camera' },
{ id: 9, name: '东区摄像监控', type: 'camera' },
{ id: 10, name: '南区摄像监控', type: 'camera' },
{ id: 11, name: '北区摄像监控', type: 'camera' },
{ id: 12, name: '东区摄像监控', type: 'camera' },
{ id: 13, name: '北区气象站', type: 'weather' },
{ id: 14, name: '南区气象站', type: 'weather' },
{ id: 15, name: '西区气象站', type: 'weather' },
],
})
const filteredAreas = computed(() => {
const kw = pageData.search.trim()
return pageData.areas.filter((a) => {
const byCat = pageData.currentCategory === 'all' || a.type === pageData.currentCategory
const byKw = !kw || a.name.includes(kw)
return byCat && byKw
})
})
function selectCategory(id: string) {
pageData.currentCategory = id
}
function onSearchConfirm() {}
function openArea(item: any) {
uni.navigateTo({ url: `/pages/device/device?area=${encodeURIComponent(item.name)}` })
}
</script>
<template>
<view class="page">
<view class="banner">
<image class="banner-img" :src="pageData.banner.image" mode="aspectFill" />
<view class="banner-time">{{ nowText }}</view>
<view class="banner-label">
<text class="label-text">{{ pageData.banner.name }}</text>
<fui-icon name="share" :size="36" color="#fff" />
</view>
</view>
<view class="section">
<fui-search-bar
v-model="pageData.search"
:height="72"
:radius="80"
placeholder="请输入搜索内容"
inputBackground="#fff"
:cancel="false"
@search="onSearchConfirm"
/>
<scroll-view class="chip-row" scroll-x show-scrollbar="false">
<view class="chip-wrap">
<fui-tag
v-for="c in pageData.categories"
:key="c.id"
:text="c.name"
:theme="pageData.currentCategory === c.id ? 'dark' : 'light'"
type="success"
:padding="['16rpx', '32rpx']"
:radius="40"
:marginRight="16"
@click="selectCategory(c.id)"
/>
</view>
</scroll-view>
<view class="grid-box">
<fui-grid :columns="3" :showBorder="false" :square="false">
<fui-grid-item
v-for="(item, idx) in filteredAreas"
:key="item.id"
:index="idx"
backgroundColor="#FFFFFF"
@click="() => openArea(item)"
>
<view class="card" :class="{ active: item.name.includes('西区摄像监控') }">
<text class="card-text">{{ item.name }}</text>
</view>
</fui-grid-item>
</fui-grid>
</view>
</view>
</view>
</template>
<style lang="scss" scoped>
.page {
background: #e6f5e8;
min-height: 100vh;
}
.banner {
position: relative;
margin: 24rpx;
border-radius: 16rpx;
overflow: hidden;
height: 280rpx;
}
.banner-img {
width: 100%;
height: 100%;
}
.banner-time {
position: absolute;
left: 24rpx;
top: 20rpx;
color: #fff;
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
font-size: 24rpx;
}
.banner-label {
position: absolute;
right: 16rpx;
bottom: 16rpx;
display: flex;
align-items: center;
gap: 12rpx;
}
.label-text {
color: #fff;
font-size: 28rpx;
}
.section {
padding: 24rpx;
}
.chip-row {
width: 100%;
}
.chip-wrap {
display: flex;
flex-direction: row;
gap: 16rpx;
}
.grid-box {
margin-top: 24rpx;
}
.card {
height: 120rpx;
margin: 12rpx;
border-radius: 16rpx;
border: 1rpx solid #eaeef1;
display: flex;
align-items: center;
justify-content: center;
background: #fff;
}
.card.active {
background: #5db66f;
color: #fff;
border-color: #5db66f;
}
.card-text {
font-size: 28rpx;
color: #2a2a2a;
}
</style>
<script setup lang="ts"> <script setup lang="ts">
import { reactive } from 'vue' import { reactive } from 'vue'
import { onShow } from '@dcloudio/uni-app' import { onShow } from '@dcloudio/uni-app'
// import WeatherForecast from './components/WeatherForecast.vue'
import Navigate from '@/utils/page/navigate' // import WeatherForecast from './components/WeatherForecast.vue'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import Navigate from '@/utils/page/navigate'
import * as NongChangAPI from '@/api/model/nongchang'
import { useUserStore } from '@/store/modules/user' import * as NongChangAPI from '@/api/model/nongchang'
import { getList as getVideoList } from '@/api/model/knowledgeVideo' import { useUserStore } from '@/store/modules/user'
import { getList as getVideoList } from '@/api/model/knowledgeVideo'
const userStore = useUserStore()
onShow(() => { const userStore = useUserStore()
onShow(() => {
// 获取金刚区菜单数据 // 获取金刚区菜单数据
getZoomList() getZoomList()
// 获取农业模型数据 // 获取农业模型数据
...@@ -25,10 +26,10 @@ onShow(() => { ...@@ -25,10 +26,10 @@ onShow(() => {
// getDeviceList() // getDeviceList()
// 获取农村 // 获取农村
getFarmList() getFarmList()
}) })
// 页面数据 // 页面数据
const pageData = reactive({ const pageData = reactive({
// 顶部标题和搜索 // 顶部标题和搜索
header: { header: {
title: '农场', title: '农场',
...@@ -203,9 +204,9 @@ const pageData = reactive({ ...@@ -203,9 +204,9 @@ const pageData = reactive({
userInfo: { userInfo: {
creditScore: 0, creditScore: 0,
}, },
}) })
function getZoomList() { function getZoomList() {
NongChangAPI.zoneList({ NongChangAPI.zoneList({
pageNo: 1, pageNo: 1,
pageSize: 5, pageSize: 5,
...@@ -215,18 +216,18 @@ function getZoomList() { ...@@ -215,18 +216,18 @@ function getZoomList() {
const { records } = res const { records } = res
pageData.menuItems = records pageData.menuItems = records
}) })
} }
function getAgricultureModelsList() { function getAgricultureModelsList() {
NongChangAPI.agricultureModelsList({ NongChangAPI.agricultureModelsList({
status: 1, status: 1,
}).then((res) => { }).then((res) => {
const { records } = res const { records } = res
pageData.agricultureModels = [] pageData.agricultureModels = []
records.sort((a, b) => a.sort_order - b.sort_order); records.sort((a, b) => a.sort_order - b.sort_order)
pageData.agricultureModels = records pageData.agricultureModels = records
}) })
} }
function getBaseManagementList() { function getBaseManagementList() {
NongChangAPI.baseManagementList({ NongChangAPI.baseManagementList({
pageNo: 1, pageNo: 1,
pageSize: 5, pageSize: 5,
...@@ -234,61 +235,61 @@ function getBaseManagementList() { ...@@ -234,61 +235,61 @@ function getBaseManagementList() {
}).then((res) => { }).then((res) => {
const { records } = res const { records } = res
pageData.baseManagement = [] pageData.baseManagement = []
records.sort((a, b) => a.sort_order - b.sort_order); records.sort((a, b) => a.sort_order - b.sort_order)
pageData.baseManagement = records pageData.baseManagement = records
}) })
} }
function getCommonToolsList() { function getCommonToolsList() {
NongChangAPI.commonToolsList({ NongChangAPI.commonToolsList({
status: 1, status: 1,
}).then((res) => { }).then((res) => {
const { records } = res const { records } = res
pageData.commonTools = [] pageData.commonTools = []
records.sort((a, b) => a.sort_order - b.sort_order); records.sort((a, b) => a.sort_order - b.sort_order)
pageData.commonTools = records pageData.commonTools = records
}) })
} }
function getAgricultureClassList() { function getAgricultureClassList() {
getVideoList({ pageNo: 1, pageSize: 10, status: 1, classify: 2 }).then((res) => { getVideoList({ pageNo: 1, pageSize: 10, status: 1, classify: 2 }).then((res) => {
const { records } = res const { records } = res
let scale:any = 0; let scale: any = 0
for(let i = 0; i < records.length;i++){ for (let i = 0; i < records.length; i++) {
if(records[i].width){ if (records[i].width) {
scale = (340 / records[i].width).toFixed(1); scale = (340 / records[i].width).toFixed(1)
records[i].videoWidth = 340; records[i].videoWidth = 340
records[i].videoHeight = Math.floor(records[i].height * scale); records[i].videoHeight = Math.floor(records[i].height * scale)
}else{ } else {
records[i].videoWidth = 0; records[i].videoWidth = 0
records[i].videoHeight = 0; records[i].videoHeight = 0
} }
} }
pageData.agricultureClass.videoList = records pageData.agricultureClass.videoList = records
}) })
} }
function getDeviceList() { function getDeviceList() {
NongChangAPI.getDeviceList({}).then((res) => { NongChangAPI.getDeviceList({}).then((res) => {
pageData.smartDevices = res.records pageData.smartDevices = res.records
}) })
} }
function getFarmList() { function getFarmList() {
NongChangAPI.AllFarms().then((res) => { NongChangAPI.AllFarms().then((res) => {
if (res) { if (res) {
pageData.hasFarm = JSON.stringify(res) != '{}' pageData.hasFarm = JSON.stringify(res) != '{}'
pageData.farmInfo = res pageData.farmInfo = res
} }
}) })
} }
function toAdd() { function toAdd() {
Navigate.to('/pages/nongchang/create-nongchang-form').catch(() => { Navigate.to('/pages/nongchang/create-nongchang-form').catch(() => {
Message.alert('跳转失败', '添加基地') Message.alert('跳转失败', '添加基地')
}) })
} }
// 菜单点击事件 // 菜单点击事件
function onMenuItemClick(item: any) { function onMenuItemClick(item: any) {
console.log('点击菜单项:', item) console.log('点击菜单项:', item)
// 在这里添加具体的菜单点击逻辑+ // 在这里添加具体的菜单点击逻辑+
...@@ -329,82 +330,82 @@ function onMenuItemClick(item: any) { ...@@ -329,82 +330,82 @@ function onMenuItemClick(item: any) {
}) })
} }
} }
} }
// 农业模型点击事件 // 农业模型点击事件
function onAgricultureModelClick(model: any) { function onAgricultureModelClick(model: any) {
console.log('点击农业模型:', model) console.log('点击农业模型:', model)
// 在这里添加具体的农业模型点击逻辑 // 在这里添加具体的农业模型点击逻辑
// 打开模型详情页面 // 打开模型详情页面
Navigate.to('/pages/nongyedamoxing/nongyedamoxing') Navigate.to('/pages/nongyedamoxing/nongyedamoxing')
} }
// 基地管理点击事件 // 基地管理点击事件
function onBaseManagementClick(item: any) { function onBaseManagementClick(item: any) {
console.log('点击基地管理项:', item) console.log('点击基地管理项:', item)
// 在这里添加具体的基地管理点击逻辑 // 在这里添加具体的基地管理点击逻辑
uni.navigateTo({ uni.navigateTo({
url: '/pages/jidiguanli/jidiguanli', url: '/pages/jidiguanli/jidiguanli',
}) })
} }
// 查看更多监测预警 // 查看更多监测预警
function onViewMoreMonitoring() { function onViewMoreMonitoring() {
console.log('查看更多监测预警') console.log('查看更多监测预警')
// 在这里添加具体的查看逻辑 // 在这里添加具体的查看逻辑
} }
// 查看更多常用工具 // 查看更多常用工具
function onViewMoreTools() { function onViewMoreTools() {
console.log('查看更多常用工具') console.log('查看更多常用工具')
// 在这里添加具体的查看逻辑 // 在这里添加具体的查看逻辑
} }
// 设备管理点击事件 // 设备管理点击事件
function onDeviceManagementClick() { function onDeviceManagementClick() {
console.log('设备管理') console.log('设备管理')
// 在这里添加具体的设备管理逻辑 // 在这里添加具体的设备管理逻辑
uni.navigateTo({ uni.navigateTo({
url: '/pages/device/device', url: '/pages/device/device',
}) })
} }
// 灵活用工 // 灵活用工
function onViewMoreFlexibleEmployment(type) { function onViewMoreFlexibleEmployment(type) {
console.log('查看更多灵活用工业务') console.log('查看更多灵活用工业务')
// 在这里添加具体的查看逻辑 // 在这里添加具体的查看逻辑
// 跳转到灵活用工界面 // 跳转到灵活用工界面
Navigate.to(`/pages/linghuoyonggong/linghuoyonggong?type=${type}`) Navigate.to(`/pages/linghuoyonggong/linghuoyonggong?type=${type}`)
} }
// 查看金融服务 // 查看金融服务
function onViewFinancialServices() { function onViewFinancialServices() {
console.log('查看金融服务') console.log('查看金融服务')
// 在这里添加具体的查看逻辑 // 在这里添加具体的查看逻辑
Navigate.to('/pages/zhunongjinrong/zhunongjinrong') Navigate.to('/pages/zhunongjinrong/zhunongjinrong')
} }
// 查看更多农技课堂 // 查看更多农技课堂
function onViewMoreClass() { function onViewMoreClass() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/knowledgeVideo/index?classify=2', url: '/pages/knowledgeVideo/index?classify=2',
}) })
} }
// 点击常用工具 // 点击常用工具
function onClickTool(tool: any) { function onClickTool(tool: any) {
console.log('点击常用工具:', tool) console.log('点击常用工具:', tool)
// 在这里添加具体的常用工具点击逻辑 // 在这里添加具体的常用工具点击逻辑
uni.navigateTo({ uni.navigateTo({
url: `/pages/webview/webview?url=${encodeURIComponent(tool.addr)}`, url: `/pages/webview/webview?url=${encodeURIComponent(tool.addr)}`,
}) })
} }
// 轮播视频切换的时候触发 // 轮播视频切换的时候触发
function handleChangeVideo(e: any) { function handleChangeVideo(e: any) {
const currentIndex = e.detail.current const currentIndex = e.detail.current
pageData.current = currentIndex pageData.current = currentIndex
pageData.agricultureClass.title = pageData.agricultureClass.videoList[currentIndex]?.title pageData.agricultureClass.title = pageData.agricultureClass.videoList[currentIndex]?.title
...@@ -435,21 +436,21 @@ function handleChangeVideo(e: any) { ...@@ -435,21 +436,21 @@ function handleChangeVideo(e: any) {
// } // }
// }) // })
// }, 100) // }, 100)
} }
// 处理swiper过渡动画 // 处理swiper过渡动画
function handleTransition(e: any) { function handleTransition(e: any) {
// 过渡期间可以做一些优化处理 // 过渡期间可以做一些优化处理
console.log('swiper过渡中...') console.log('swiper过渡中...')
} }
// 获取视频时长 // 获取视频时长
function handleMetadataLoaded(e: any) { function handleMetadataLoaded(e: any) {
pageData.agricultureClass.time = e.target.duration pageData.agricultureClass.time = e.target.duration
} }
// 解决轮播视频切换时,上一个视频不停止播放的问题 // 解决轮播视频切换时,上一个视频不停止播放的问题
function handleVideoPlay(currentIndex) { function handleVideoPlay(currentIndex) {
pageData.agricultureClass.videoList.forEach((_, index) => { pageData.agricultureClass.videoList.forEach((_, index) => {
if (index !== currentIndex) { if (index !== currentIndex) {
try { try {
...@@ -460,39 +461,39 @@ function handleVideoPlay(currentIndex) { ...@@ -460,39 +461,39 @@ function handleVideoPlay(currentIndex) {
} }
} }
}) })
} }
// 视频暂停事件处理 // 视频暂停事件处理
function handleVideoPause(currentIndex) { function handleVideoPause(currentIndex) {
console.log(`视频${currentIndex}暂停`) console.log(`视频${currentIndex}暂停`)
} }
function playVideo(index) { function playVideo(index) {
const videoContext = uni.createVideoContext(`video${index}`) const videoContext = uni.createVideoContext(`video${index}`)
videoContext.requestFullScreen({ direction: 0 }) videoContext.requestFullScreen({ direction: 0 })
videoContext.play() videoContext.play()
} }
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}`)
videoContext.pause() videoContext.pause()
} }
} }
function toDetail(item: Recordable) { function toDetail(item: Recordable) {
// Navigate.to(`/pages/nongchang/detail/index?id=${item.id}&name=${encodeURIComponent(item.name)}`) // Navigate.to(`/pages/nongchang/detail/index?id=${item.id}&name=${encodeURIComponent(item.name)}`)
let id = Object.keys(item)[0] const id = Object.keys(item)[0]
let name = Object.values(item)[0] const name = Object.values(item)[0]
Navigate.to(`/pages/nongchang/detail/index?id=${id}&name=${encodeURIComponent(name)}`) Navigate.to(`/pages/nongchang/detail/index?id=${id}&name=${encodeURIComponent(name)}`)
} }
function handlePublish() { function handlePublish() {
Navigate.to('/pages/linghuoyonggong/linghuoyonggong') Navigate.to('/pages/linghuoyonggong/linghuoyonggong')
} }
onHide(() => { onHide(() => {
// 停止所有其他视频的播放(只暂停,不重置位置) // 停止所有其他视频的播放(只暂停,不重置位置)
pageData.agricultureClass.videoList.forEach((_, index) => { pageData.agricultureClass.videoList.forEach((_, index) => {
try { try {
...@@ -503,7 +504,7 @@ onHide(() => { ...@@ -503,7 +504,7 @@ onHide(() => {
console.log('停止视频失败:', error) console.log('停止视频失败:', error)
} }
}) })
}) })
</script> </script>
<template> <template>
...@@ -595,7 +596,9 @@ onHide(() => { ...@@ -595,7 +596,9 @@ onHide(() => {
@click="toAdd" @click="toAdd"
> >
<image class="mr-1 w-40 h-40" src="/static/images/nongchang/add.png" /> <image class="mr-1 w-40 h-40" src="/static/images/nongchang/add.png" />
<text class="fontsize_28" style="font-family: '思源黑体'; font-weight: 400;color: #fff;">添加我的农场</text> <text class="fontsize_28" style="font-family: '思源黑体'; font-weight: 400; color: #fff"
>添加我的农场</text
>
</view> </view>
<view class="absolute nongchang-remark">基于农场实时精细化气象数据基地设备管理</view> <view class="absolute nongchang-remark">基于农场实时精细化气象数据基地设备管理</view>
</view> </view>
...@@ -733,76 +736,86 @@ onHide(() => { ...@@ -733,76 +736,86 @@ onHide(() => {
</fui-waterfall-item> </fui-waterfall-item>
</fui-waterfall> </fui-waterfall>
<view @click="onViewMoreClass" style="text-align: center;font-size: 28rpx;padding:32rpx 0rpx;color:#999999;">点击查看更多</view> <view
@click="onViewMoreClass"
style="text-align: center; font-size: 28rpx; padding: 32rpx 0rpx; color: #999999"
>点击查看更多</view
>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<fui-fab v-if="!userStore.isAuditMode" position="right" distance="10" bottom="240" width="96" @click="handlePublish"> <fui-fab
v-if="!userStore.isAuditMode"
position="right"
distance="10"
bottom="240"
width="96"
@click="handlePublish"
>
<view class="text-white text-center"> <view class="text-white text-center">
<image style="width: 52rpx;height:52rpx;" src="/static/images/nongchang/work_icon.png" /> <image style="width: 52rpx; height: 52rpx" src="/static/images/nongchang/work_icon.png" />
<view style="font-size: 18rpx;margin-top: -16rpx;">找人干活</view> <view style="font-size: 18rpx; margin-top: -16rpx">找人干活</view>
</view> </view>
</fui-fab> </fui-fab>
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
.mt-19 { .mt-19 {
margin-top: 38rpx; margin-top: 38rpx;
} }
.ml-3 { .ml-3 {
margin-left: 6rpx; margin-left: 6rpx;
} }
.mt-7 { .mt-7 {
margin-top: 14rpx; margin-top: 14rpx;
} }
.ml-9 { .ml-9 {
margin-left: 18rpx; margin-left: 18rpx;
} }
.ml-7 { .ml-7 {
margin-left: 14rpx; margin-left: 14rpx;
} }
.ml-11 { .ml-11 {
margin-left: 22rpx; margin-left: 22rpx;
} }
.mt-17 { .mt-17 {
margin-top: 34rpx; margin-top: 34rpx;
} }
.mt-11 { .mt-11 {
margin-top: 22rpx; margin-top: 22rpx;
} }
.mt-5 { .mt-5 {
margin-top: 10rpx; margin-top: 10rpx;
} }
.mt-21 { .mt-21 {
margin-top: 42rpx; margin-top: 42rpx;
} }
.mt-13 { .mt-13 {
margin-top: 26rpx; margin-top: 26rpx;
} }
.ml-5 { .ml-5 {
margin-left: 10rpx; margin-left: 10rpx;
} }
.mt-3 { .mt-3 {
margin-top: 6rpx; margin-top: 6rpx;
} }
.page { .page {
background-color: #e6f5e8; background-color: #e6f5e8;
mix-blend-mode: NOTTHROUGH; mix-blend-mode: NOTTHROUGH;
width: 100%; width: 100%;
...@@ -1896,18 +1909,18 @@ onHide(() => { ...@@ -1896,18 +1909,18 @@ onHide(() => {
line-height: 18.3rpx; line-height: 18.3rpx;
color: #666666; color: #666666;
} }
} }
.nongchang_box { .nongchang_box {
background-image: url('/static/images/nongchang/mynongchang-2.png'); background-image: url('/static/images/nongchang/mynongchang-2.png');
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 100% 100%; background-size: 100% 100%;
} }
.font_11 { .font_11 {
color: #666666; color: #666666;
} }
.nongchang-remark { .nongchang-remark {
font-size: 24rpx; font-size: 24rpx;
font-weight: 400; font-weight: 400;
letter-spacing: 0px; letter-spacing: 0px;
...@@ -1919,25 +1932,25 @@ onHide(() => { ...@@ -1919,25 +1932,25 @@ onHide(() => {
width: 312rpx; width: 312rpx;
left: 50%; left: 50%;
transform: translateX(-50%); transform: translateX(-50%);
} }
.yr-wd-style{ .yr-wd-style {
display: flex; display: flex;
padding-top: 36rpx; padding-top: 36rpx;
padding-bottom: 20rpx; padding-bottom: 20rpx;
.yr-model-item{ .yr-model-item {
display: flex; display: flex;
padding-left: 20rpx; padding-left: 20rpx;
} }
.model_icon{ .model_icon {
width: 68rpx; width: 68rpx;
height: 68rpx; height: 68rpx;
} }
.model_content{ .model_content {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
.model-btn{ .model-btn {
width: 136rpx; width: 136rpx;
border-radius: 40rpx; border-radius: 40rpx;
background: rgba(93, 182, 111, 0.2); background: rgba(93, 182, 111, 0.2);
...@@ -1947,14 +1960,14 @@ onHide(() => { ...@@ -1947,14 +1960,14 @@ onHide(() => {
font-weight: 400; font-weight: 400;
letter-spacing: 0px; letter-spacing: 0px;
line-height: 40rpx; line-height: 40rpx;
color: #16A34A; color: #16a34a;
text-align: center; text-align: center;
margin-top: 22rpx; margin-top: 22rpx;
} }
} }
::v-deep .fui-fab__btn-main { ::v-deep .fui-fab__btn-main {
background: linear-gradient(124.25deg, #a5d63f 0%, #5db66f 100%) !important; background: linear-gradient(124.25deg, #a5d63f 0%, #5db66f 100%) !important;
box-shadow: 0px 1px 8px #5db66f; box-shadow: 0px 1px 8px #5db66f;
} }
</style> </style>
...@@ -33,23 +33,28 @@ ...@@ -33,23 +33,28 @@
name: 'phone', name: 'phone',
rule: ['required'], rule: ['required'],
msg: ['请填写手机号码'], msg: ['请填写手机号码'],
}, { },
{
name: 'scope', name: 'scope',
rule: ['required'], rule: ['required'],
msg: ['请选择作业区域'], msg: ['请选择作业区域'],
}, { },
{
name: 'startTime', name: 'startTime',
rule: ['required'], rule: ['required'],
msg: ['请选择开始时间'], msg: ['请选择开始时间'],
}, { },
{
name: 'endTime', name: 'endTime',
rule: ['required'], rule: ['required'],
msg: ['请选择结束时间'], msg: ['请选择结束时间'],
}, { },
{
name: 'address', name: 'address',
rule: ['required'], rule: ['required'],
msg: ['请填写详细地址'], msg: ['请填写详细地址'],
}, { },
{
name: 'demand', name: 'demand',
rule: ['required'], rule: ['required'],
msg: ['请填写需求'], msg: ['请填写需求'],
...@@ -135,11 +140,53 @@ ...@@ -135,11 +140,53 @@
</view> </view>
<view class="text-left"> <view class="text-left">
<fui-form ref="formRef"> <fui-form ref="formRef">
<fui-input marginTop="30" size="24" type="number" maxlength="11" placeholder="请填写手机号码" v-model="pageData.form.phone" required placeholderStyle="margin-left: 10rpx;"/> <fui-input
<fui-input marginTop="30" size="24" disabled @click="pageData.areaShow.address = true" placeholder="请选择作业区域" v-model="pageData.scopeText" required placeholderStyle="margin-left: 10rpx;"/> marginTop="30"
<fui-input marginTop="30" size="24" placeholder="请填写详细地址" v-model="pageData.form.address" required placeholderStyle="margin-left: 10rpx;"/> size="24"
<fui-input marginTop="30" size="24" placeholder="请选择作业时间" v-model="pageData.form.time" @click="dict.show.time = true" required placeholderStyle="margin-left: 10rpx;"/> type="number"
<fui-textarea v-model="pageData.form.demand" :marginTop="30" size="24" placeholder="简要说明作业要求" flexStart required placeholderStyle="margin-left: 10rpx;" height="100rpx" /> maxlength="11"
placeholder="请填写手机号码"
v-model="pageData.form.phone"
required
placeholderStyle="margin-left: 10rpx;"
/>
<fui-input
marginTop="30"
size="24"
disabled
@click="pageData.areaShow.address = true"
placeholder="请选择作业区域"
v-model="pageData.scopeText"
required
placeholderStyle="margin-left: 10rpx;"
/>
<fui-input
marginTop="30"
size="24"
placeholder="请填写详细地址"
v-model="pageData.form.address"
required
placeholderStyle="margin-left: 10rpx;"
/>
<fui-input
marginTop="30"
size="24"
placeholder="请选择作业时间"
v-model="pageData.form.time"
@click="dict.show.time = true"
required
placeholderStyle="margin-left: 10rpx;"
/>
<fui-textarea
v-model="pageData.form.demand"
:marginTop="30"
size="24"
placeholder="简要说明作业要求"
flexStart
required
placeholderStyle="margin-left: 10rpx;"
height="100rpx"
/>
<view style="margin-top: 30rpx"> <view style="margin-top: 30rpx">
<fui-button type="warning" text="提交" bold radius="96rpx" @click="submit" /> <fui-button type="warning" text="提交" bold radius="96rpx" @click="submit" />
</view> </view>
......
<script setup lang="ts"> <script setup lang="ts">
import { onLoad } from '@dcloudio/uni-app' import { onLoad } from '@dcloudio/uni-app'
import Navigate from '@/utils/page/navigate'
import { reactive, ref } from 'vue' import { reactive, ref } from 'vue'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
import { useGlobSetting } from '/@/hooks/setting' import { useGlobSetting } from '/@/hooks/setting'
import * as NongzhiAPI from '@/api/model/nongzhi' import * as NongzhiAPI from '@/api/model/nongzhi'
import * as NongjifuwuAPI from '@/api/model/nongjifuwu' import * as NongjifuwuAPI from '@/api/model/nongjifuwu'
import * as LinghuoyonggongAPI from '@/api/model/linghuoyonggong' import * as LinghuoyonggongAPI from '@/api/model/linghuoyonggong'
const userStore = useUserStore() const userStore = useUserStore()
const globSetting = useGlobSetting() const globSetting = useGlobSetting()
let enterpriseId = null; let enterpriseId = null;
onLoad((options) => { onLoad((options) => {
let param = JSON.parse(decodeURIComponent(options.param)); const param = JSON.parse(decodeURIComponent(options.param));
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: param.name title: param.name
}); });
enterpriseId = param.id; enterpriseId = param.id;
getDetailData(enterpriseId); getDetailData(enterpriseId);
getProvince(0,null); getProvince(0, null);
postMachineryQueryById(); postMachineryQueryById();
}) })
const toastRef = ref() const toastRef = ref()
const unitPopupRef = ref(null); const unitPopupRef = ref(null);
const uploadRef = ref() const uploadRef = ref()
const bgColorData = ["#EEFAEB","#EFF1FF","#FFF3F1","#E8F7F7","#FFF3E7","#FAF8EA"]; const bgColorData = ["#EEFAEB", "#EFF1FF", "#FFF3F1", "#E8F7F7", "#FFF3E7", "#FAF8EA"];
const pageData = reactive({ const pageData = reactive({
data:null, data: null,
enterpriseCers:[], enterpriseCers: [],
isPopupShow:false, isPopupShow: false,
unitPopup:false, unitPopup: false,
unitOptions:[], unitOptions: [],
unitVal:[], unitVal: [],
productImageArr:[], productImageArr: [],
categoryPopup:false, categoryPopup: false,
categoryOptions:[], categoryOptions: [],
categoryText:[], categoryText: [],
categoryVal:[], categoryVal: [],
enterpriseProduct:[], enterpriseProduct: [],
contactName:"", contactName: "",
showConfirmDialog:false, showConfirmDialog: false,
rules: [ rules: [
{ {
name: 'name', name: 'name',
rule: ['required'], rule: ['required'],
msg: ['请输入农机名称'], msg: ['请输入农机名称'],
},{ }, {
name: "mobile", name: "mobile",
rule: ["required", "isMobile"], rule: ["required", "isMobile"],
msg: ["请输入联系电话", "请输入正确的联系电话"] msg: ["请输入联系电话", "请输入正确的联系电话"]
},{ }, {
name: 'areaText', name: 'areaText',
rule: ['required'], rule: ['required'],
msg: ['请选择服务区域'], msg: ['请选择服务区域'],
},{ }, {
name: 'minPrice', name: 'minPrice',
rule: ['required'], rule: ['required'],
msg: ['请输入最低价'], msg: ['请输入最低价'],
},{ }, {
name: 'maxPrice', name: 'maxPrice',
rule: ['required'], rule: ['required'],
msg: ['请输入最高价'], msg: ['请输入最高价'],
...@@ -73,27 +73,27 @@ ...@@ -73,27 +73,27 @@
}, },
] ]
}) })
let productInfo = reactive({ const productInfo = reactive({
id:"", id: "",
name:"",// 商品名称 name: "", // 商品名称
mobile:"", // 联系方式 mobile: "", // 联系方式
province:"", // 省 province: "", // 省
city:"", // 市 city: "", // 市
districts:"", // 区县 districts: "", // 区县
minPrice:"", // 最小销售价 minPrice: "", // 最小销售价
maxPrice: "", // 最大销售价 maxPrice: "", // 最大销售价
image:"", // 农机图片 image: "", // 农机图片
enterpriseId:"", // 企业ID enterpriseId: "", // 企业ID
areaText:'', areaText: '',
}) })
function handleSelectArea(){ function handleSelectArea() {
pageData.unitPopup = true; pageData.unitPopup = true;
} }
function postMachineryQueryById(){ function postMachineryQueryById() {
NongjifuwuAPI.postMachineryQueryById({enterpriseId:enterpriseId}).then((res) => { NongjifuwuAPI.postMachineryQueryById({ enterpriseId }).then((res) => {
pageData.enterpriseProduct = res; pageData.enterpriseProduct = res;
console.log(res); console.log(res);
}) })
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
function handleUpload(file) { function handleUpload(file) {
const tempFilePaths = file.tempFilePaths; const tempFilePaths = file.tempFilePaths;
// 处理每张选中的图片 // 处理每张选中的图片
for(let i = 0; i < tempFilePaths.length; i++){ for (let i = 0; i < tempFilePaths.length; i++) {
uni.uploadFile({ uni.uploadFile({
url: `${globSetting.apiUrl + globSetting.urlPrefix}/sys/common/upload`, // 直接使用上传接口URL url: `${globSetting.apiUrl + globSetting.urlPrefix}/sys/common/upload`, // 直接使用上传接口URL
filePath: tempFilePaths[i], filePath: tempFilePaths[i],
...@@ -137,47 +137,47 @@ ...@@ -137,47 +137,47 @@
} }
} }
// 文件删除 // 文件删除
function handleDelete(file,type) { function handleDelete(file, type) {
uploadRef.value.clearFiles() uploadRef.value.clearFiles()
pageData.productImageArr[0] = null pageData.productImageArr[0] = null
} }
function selectCompleteUnit(e){ function selectCompleteUnit(e) {
const text = e.text; const text = e.text;
const areaAttr = ['province','city','districts']; const areaAttr = ['province', 'city', 'districts'];
for(let i = 0; i < text.length;i++){ for (let i = 0; i < text.length; i++) {
productInfo[areaAttr[i]] = text[i]; productInfo[areaAttr[i]] = text[i];
} }
productInfo.areaText = text.join(''); productInfo.areaText = text.join('');
pageData.unitPopup = false; pageData.unitPopup = false;
} }
function changeUnit(e){ function changeUnit(e) {
let val = e.value; const val = e.value;
getProvince(val,e); getProvince(val, e);
} }
function handleSelectUnit(){ function handleSelectUnit() {
pageData.unitPopup = true; pageData.unitPopup = true;
} }
// 获取下一级地区 // 获取下一级地区
function getProvince(code,e) { function getProvince(code, e) {
if(e && e.layer >=2){ if (e && e.layer >= 2) {
unitPopupRef.value.end(); unitPopupRef.value.end();
return; return;
} }
LinghuoyonggongAPI.queryConditions({ parentCode : code}).then(res=>{ LinghuoyonggongAPI.queryConditions({ parentCode: code }).then(res => {
if(res.length){ if (res.length) {
let dataArr = []; const dataArr = [];
for(let i = 0; i < res.length; i++){ for (let i = 0; i < res.length; i++) {
let obj = {text:"",value:""}; const obj = { text: "", value: "" };
obj.text = res[i].name; obj.text = res[i].name;
obj.value = res[i].code; obj.value = res[i].code;
dataArr.push(obj); dataArr.push(obj);
} }
if(!pageData.unitOptions.length){ if (!pageData.unitOptions.length) {
pageData.unitOptions = dataArr; pageData.unitOptions = dataArr;
}else{ } else {
unitPopupRef.value.setRequestData(dataArr, e.layer); unitPopupRef.value.setRequestData(dataArr, e.layer);
} }
}else{ } else {
unitPopupRef.value.end(); unitPopupRef.value.end();
} }
}) })
...@@ -185,7 +185,7 @@ ...@@ -185,7 +185,7 @@
// 发布 // 发布
const formRef = ref() const formRef = ref()
function addData(){ function addData() {
productInfo.image = pageData.productImageArr[0]; productInfo.image = pageData.productImageArr[0];
formRef.value.validator(productInfo, pageData.rules, true).then((res) => { formRef.value.validator(productInfo, pageData.rules, true).then((res) => {
if (res.isPassed) { if (res.isPassed) {
...@@ -195,26 +195,25 @@ ...@@ -195,26 +195,25 @@
text: '发布成功', text: '发布成功',
}) })
pageData.isPopupShow = false; pageData.isPopupShow = false;
setTimeout(()=>{ setTimeout(() => {
postMachineryQueryById(); postMachineryQueryById();
},500) }, 500)
}) })
} }
}) })
} }
function getDetailData(id){ function getDetailData(id) {
NongzhiAPI.getEnterpriseDetail({ id }).then((res) => { NongzhiAPI.getEnterpriseDetail({ id }).then((res) => {
pageData.enterpriseCers = res.enterpriseCers.split(","); pageData.enterpriseCers = res.enterpriseCers.split(",");
pageData.data = res; pageData.data = res;
pageData.contactName = res.contactPerson.substring(0,1) + new Array(res.contactPerson.length).join('*'); pageData.contactName = res.contactPerson.substring(0, 1) + Array.from({ length: res.contactPerson.length }).join('*');
productInfo.enterpriseId = res.id; productInfo.enterpriseId = res.id;
}) })
} }
function getBgColor(index:any){ function getBgColor(index: any) {
if(index < 6){ if (index < 6) {
return bgColorData[index]; return bgColorData[index];
}else{ } else {
return bgColorData[Math.floor(Math.random() * 5)]; return bgColorData[Math.floor(Math.random() * 5)];
} }
} }
...@@ -232,12 +231,13 @@ ...@@ -232,12 +231,13 @@
pageData.productImageArr = []; pageData.productImageArr = [];
pageData.isPopupShow = true; pageData.isPopupShow = true;
} }
function makePhoneCall(){ function makePhoneCall() {
uni.makePhoneCall({ uni.makePhoneCall({
phoneNumber: pageData.data.contactMobile phoneNumber: pageData.data.contactMobile
}); });
} }
</script> </script>
<template> <template>
<view class="w-full h-95vh bg-#E6F5E8 detail_page"> <view class="w-full h-95vh bg-#E6F5E8 detail_page">
<view class="module_width top_content" v-if="pageData.data"> <view class="module_width top_content" v-if="pageData.data">
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</view> </view>
<view class="module_width middle_content"> <view class="module_width middle_content">
<view class="module_title">资质证书</view> <view class="module_title">资质证书</view>
<view class="module_separate"></view> <view class="module_separate"/>
<view class="module_qualification"> <view class="module_qualification">
<view class="qualification_item" :style="`background:${getBgColor(index)}`" v-for="(item,index) in pageData.enterpriseCers" :key="index"> <view class="qualification_item" :style="`background:${getBgColor(index)}`" v-for="(item,index) in pageData.enterpriseCers" :key="index">
<image class="enterprise_logo" mode="heightFix" :src="item" /> <image class="enterprise_logo" mode="heightFix" :src="item" />
...@@ -258,7 +258,7 @@ ...@@ -258,7 +258,7 @@
</view> </view>
<view class="module_width footer_content"> <view class="module_width footer_content">
<view class="module_title">主营农机</view> <view class="module_title">主营农机</view>
<view class="module_separate"></view> <view class="module_separate"/>
<view class="business_item" v-for="item in pageData.enterpriseProduct" :key="item.id"> <view class="business_item" v-for="item in pageData.enterpriseProduct" :key="item.id">
<image class="business_img" :src="item.image" /> <image class="business_img" :src="item.image" />
...@@ -297,26 +297,26 @@ ...@@ -297,26 +297,26 @@
<fui-bottom-popup :show="pageData.isPopupShow" @close="pageData.isPopupShow = false"> <fui-bottom-popup :show="pageData.isPopupShow" @close="pageData.isPopupShow = false">
<view class="fui-custom__wrap yr_person_popup"> <view class="fui-custom__wrap yr_person_popup">
<view class="popup_top"> <view class="popup_top">
<uni-icons type="left" size="24" color="#333333" @click="pageData.isPopupShow = false"></uni-icons> <uni-icons type="left" size="24" color="#333333" @click="pageData.isPopupShow = false"/>
<view class="add_person_text">农机信息</view> <view class="add_person_text">农机信息</view>
<view class="del_person_btn"></view> <view class="del_person_btn"/>
</view> </view>
<view class="popup_content"> <view class="popup_content">
<fui-form label-weight="auto" ref="formRef" top="0"> <fui-form label-weight="auto" ref="formRef" top="0">
<fui-input required label="农机名称" borderTop placeholder="请输入农机名称" v-model="productInfo.name" label-width="220" size="28"></fui-input> <fui-input required label="农机名称" borderTop placeholder="请输入农机名称" v-model="productInfo.name" label-width="220" size="28"/>
<fui-input required maxlength="11" label="联系电话" placeholder="请输入联系方式" v-model="productInfo.mobile" label-width="220" size="28"></fui-input> <fui-input required maxlength="11" label="联系电话" placeholder="请输入联系方式" v-model="productInfo.mobile" label-width="220" size="28"/>
<fui-input @click="handleSelectArea" required label="服务区域" placeholder="请选择服务区域" disabled :value="productInfo.areaText" label-width="220" size="28"></fui-input> <fui-input @click="handleSelectArea" required label="服务区域" placeholder="请选择服务区域" disabled :value="productInfo.areaText" label-width="220" size="28"/>
<fui-form-item asterisk label="价格(元/亩)" labelSize="28" label-width="220" size="28"> <fui-form-item asterisk label="价格(元/亩)" labelSize="28" label-width="220" size="28">
<fui-input v-model="productInfo.minPrice" :borderBottom="false" :padding="[0]" placeholder="最低价"></fui-input> <fui-input v-model="productInfo.minPrice" :borderBottom="false" :padding="[0]" placeholder="最低价"/>
<template v-slot:right> <template #right>
<view style="color: #CCCCCC;margin-right: 40rpx;"></view> <view style="color: #CCCCCC;margin-right: 40rpx;"></view>
<fui-input v-model="productInfo.maxPrice" :borderBottom="false" :padding="[0]" placeholder="最高价"></fui-input> <fui-input v-model="productInfo.maxPrice" :borderBottom="false" :padding="[0]" placeholder="最高价"/>
</template> </template>
</fui-form-item> </fui-form-item>
<fui-form-item asterisk label="商品图片" :bottomBorder="false"> <fui-form-item asterisk label="商品图片" :bottomBorder="false">
<template v-slot:vertical> <template #vertical>
<uni-file-picker :value="pageData.productImageArr" ref="uploadRef" limit="1" :auto-upload="false" @select="handleUpload" @delete="handleDelete"/> <uni-file-picker :value="pageData.productImageArr" ref="uploadRef" limit="1" :auto-upload="false" @select="handleUpload" @delete="handleDelete"/>
</template> </template>
</fui-form-item> </fui-form-item>
...@@ -329,14 +329,13 @@ ...@@ -329,14 +329,13 @@
<fui-bottom-popup :show="pageData.unitPopup"> <fui-bottom-popup :show="pageData.unitPopup">
<view class="fui-scroll__wrap"> <view class="fui-scroll__wrap">
<view class="fui-title">请选择</view> <view class="fui-title">请选择</view>
<fui-cascader ref="unitPopupRef" :value="pageData.unitVal" stepLoading @change="changeUnit" @complete="selectCompleteUnit" :options="pageData.unitOptions"></fui-cascader> <fui-cascader ref="unitPopupRef" :value="pageData.unitVal" stepLoading @change="changeUnit" @complete="selectCompleteUnit" :options="pageData.unitOptions"/>
<view class="fui-icon__close" @tap.stop="pageData.unitPopup=false"> <view class="fui-icon__close" @tap.stop="pageData.unitPopup=false">
<fui-icon name="close" :size="48"></fui-icon> <fui-icon name="close" :size="48"/>
</view> </view>
</view> </view>
</fui-bottom-popup> </fui-bottom-popup>
<fui-toast ref="toastRef" /> <fui-toast ref="toastRef" />
</template> </template>
...@@ -451,8 +450,6 @@ ...@@ -451,8 +450,6 @@
} }
} }
.business_item{ .business_item{
border-bottom: 1px solid #EEEEEE; border-bottom: 1px solid #EEEEEE;
margin-top: 24rpx; margin-top: 24rpx;
......
<script setup lang="ts"> <script setup lang="ts">
import { reactive, toRefs } from 'vue' import { reactive, toRefs } from 'vue'
import { onLoad, onShow } from '@dcloudio/uni-app' import { onLoad } from '@dcloudio/uni-app'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
import { useGlobSetting } from '/@/hooks/setting' import { useGlobSetting } from '/@/hooks/setting'
import * as LinghuoyonggongAPI from '@/api/model/linghuoyonggong' import * as LinghuoyonggongAPI from '@/api/model/linghuoyonggong'
import * as nongjifuwu from '@/api/model/nongjifuwu' import * as nongjifuwu from '@/api/model/nongjifuwu'
import { getDictData, getText } from '@/utils/dict/area'
const userStore = useUserStore() const userStore = useUserStore()
const globSetting = useGlobSetting() const globSetting = useGlobSetting()
...@@ -18,13 +17,13 @@ ...@@ -18,13 +17,13 @@
} else { } else {
pageData.title = '新增农活作业' pageData.title = '新增农活作业'
} }
getProvince(43,null); getProvince(43, null)
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: pageData.title, title: pageData.title,
}) })
}) })
/* onShow(() => { /* onShow(() => {
// 数据字典赋值 // 数据字典赋值
initDict() initDict()
}) */ }) */
...@@ -38,8 +37,8 @@ ...@@ -38,8 +37,8 @@
address: false, address: false,
}, },
options: [], options: [],
optionsVal:[], optionsVal: [],
optionsValText:"", optionsValText: '',
form: { form: {
id: '', id: '',
...@@ -95,47 +94,48 @@ ...@@ -95,47 +94,48 @@
const { show, options, form } = toRefs(pageData) const { show, options, form } = toRefs(pageData)
const areaPopupRef = ref(null); const areaPopupRef = ref(null)
// 选择地区完成 // 选择地区完成
function selectCompleteArea(e){ function selectCompleteArea(e) {
let text = e.text; const text = e.text
let value = e.value; const value = e.value
let areaText = "",areaVal=""; let areaText = ''
for(let i = 0; i < (text.length-1);i++){ let areaVal = ''
areaText += text[i]+'/'; for (let i = 0; i < text.length - 1; i++) {
areaVal += value[i]+','; areaText += `${text[i]}/`
} areaVal += `${value[i]},`
pageData.form.scope = areaVal.slice(0, -1);; // code }
pageData.optionsValText = areaText.slice(0, -1);; pageData.form.scope = areaVal.slice(0, -1) // code
pageData.show.address = false; pageData.optionsValText = areaText.slice(0, -1)
pageData.show.address = false
} }
// 在选择地区 // 在选择地区
function changeArea(e){ function changeArea(e) {
let val = e.value; const val = e.value
getProvince(val,e); getProvince(val, e)
} }
// 获取下一级地区 // 获取下一级地区
function getProvince(code,e) { function getProvince(code, e) {
LinghuoyonggongAPI.queryConditions({ parentCode : code}).then(res=>{ LinghuoyonggongAPI.queryConditions({ parentCode: code }).then((res) => {
if(res.length){ if (res.length) {
let dataArr = []; const dataArr = []
for(let i = 0; i < res.length; i++){ for (let i = 0; i < res.length; i++) {
let obj = {text:"",value:""}; const obj = { text: '', value: '' }
obj.text = res[i].name; obj.text = res[i].name
obj.value = res[i].code; obj.value = res[i].code
dataArr.push(obj); dataArr.push(obj)
} }
if(!pageData.options.length){ if (!pageData.options.length) {
pageData.options = dataArr; pageData.options = dataArr
}else{ } else {
console.log("e.layer= "+ e.layer); console.log(`e.layer= ${e.layer}`)
areaPopupRef.value.setRequestData(dataArr, e.layer); areaPopupRef.value.setRequestData(dataArr, e.layer)
if(e.layer >= 2){ if (e.layer >= 2) {
areaPopupRef.value.end(); areaPopupRef.value.end()
} }
} }
}else{ } else {
areaPopupRef.value.end(); areaPopupRef.value.end()
} }
}) })
} }
...@@ -241,7 +241,7 @@ ...@@ -241,7 +241,7 @@
}) })
} }
function getCurrentDate(){ function getCurrentDate() {
const date = new Date() const date = new Date()
const year = date.getFullYear() const year = date.getFullYear()
const month = date.getMonth() + 1 const month = date.getMonth() + 1
...@@ -255,7 +255,15 @@ ...@@ -255,7 +255,15 @@
<view class="formBox"> <view class="formBox">
<fui-form ref="formRef" label-weight="auto" top="60" :disabled="form.id ? true : false"> <fui-form ref="formRef" label-weight="auto" top="60" :disabled="form.id ? true : false">
<view class="mt20"> <view class="mt20">
<fui-input required label="服务名称" placeholder="请输入服务名称" v-model="form.name" labelSize="28" label-width="180" maxlength="16" /> <fui-input
required
label="服务名称"
placeholder="请输入服务名称"
v-model="form.name"
labelSize="28"
label-width="180"
maxlength="16"
/>
<view class="form-item required flex align-center" style="padding: 20rpx 10rpx"> <view class="form-item required flex align-center" style="padding: 20rpx 10rpx">
<text class="label">服务范围</text> <text class="label">服务范围</text>
<view class="time-input" @click="show.address = true"> <view class="time-input" @click="show.address = true">
...@@ -264,11 +272,37 @@ ...@@ -264,11 +272,37 @@
</text> </text>
</view> </view>
</view> </view>
<fui-input required label="详细地址" placeholder="请输入详细地址" v-model="form.address" labelSize="28" label-width="180" size="28"/> <fui-input
<fui-input required type="number" label="联系方式" placeholder="请填写联系方式" v-model="form.phone" labelSize="28" label-width="180" :maxlength="11" /> required
label="详细地址"
placeholder="请输入详细地址"
v-model="form.address"
labelSize="28"
label-width="180"
size="28"
/>
<fui-input
required
type="number"
label="联系方式"
placeholder="请填写联系方式"
v-model="form.phone"
labelSize="28"
label-width="180"
:maxlength="11"
/>
</view> </view>
<view class="mt20"> <view class="mt20">
<fui-textarea flexStart required label="作业需求" placeholder="请输入作业需求" v-model="form.demand" labelSize="28" label-width="180" placeholder-style="font-size: 28rpx;"/> <fui-textarea
flexStart
required
label="作业需求"
placeholder="请输入作业需求"
v-model="form.demand"
labelSize="28"
label-width="180"
placeholder-style="font-size: 28rpx;"
/>
<!-- 作业时间 --> <!-- 作业时间 -->
<view class="form-section" style="padding: 0 10rpx"> <view class="form-section" style="padding: 0 10rpx">
<view class="form-item flex align-center"> <view class="form-item flex align-center">
...@@ -291,31 +325,57 @@ ...@@ -291,31 +325,57 @@
</view> </view>
<view class="bg-white mt20" style="padding: 0.875rem 1rem"> <view class="bg-white mt20" style="padding: 0.875rem 1rem">
<view class="mb-1 flex justify-start" style="font-size:28rpx;"><span class="text-red">*&nbsp;</span> 图片 </view> <view class="mb-1 flex justify-start" style="font-size: 28rpx"
<uni-file-picker :value="form.pictureObj" ref="uploadRef" limit="1" :auto-upload="false" @select="handleUpload" @delete="handleDelete" /> ><span class="text-red">*&nbsp;</span> 图片
</view>
<uni-file-picker
:value="form.pictureObj"
ref="uploadRef"
limit="1"
:auto-upload="false"
@select="handleUpload"
@delete="handleDelete"
/>
</view> </view>
<view class="fui-btn__box" v-if="!form.id" style="margin-top: 30rpx"> <view class="fui-btn__box" v-if="!form.id" style="margin-top: 30rpx">
<fui-button text="发布作业" bold radius="96rpx" @click="submit" /> <fui-button text="发布作业" bold radius="96rpx" @click="submit" />
</view> </view>
</fui-form> </fui-form>
<fui-date-picker :show="show.time1" type="3" @change="handleChangeTime1" @cancel="show.time1 = false" :minDate="getCurrentDate()" /> <fui-date-picker
<fui-date-picker :show="show.time2" type="3" @change="handleChangeTime2" @cancel="show.time2 = false" :minDate="getCurrentDate()" /> :show="show.time1"
type="3"
@change="handleChangeTime1"
@cancel="show.time1 = false"
:minDate="getCurrentDate()"
/>
<fui-date-picker
:show="show.time2"
type="3"
@change="handleChangeTime2"
@cancel="show.time2 = false"
:minDate="getCurrentDate()"
/>
<fui-toast ref="toastRef" /> <fui-toast ref="toastRef" />
<fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)" /> <fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)" />
<!-- <fui-picker :show="show.address" :options="options.address" :linkage="true" :layer="3" @change="handleChangeAddress" @cancel="show.address = false" /> <!-- <fui-picker :show="show.address" :options="options.address" :linkage="true" :layer="3" @change="handleChangeAddress" @cancel="show.address = false" />
--> -->
<fui-bottom-popup :show="pageData.show.address"> <fui-bottom-popup :show="pageData.show.address">
<view class="fui-scroll__wrap yr-select-area"> <view class="fui-scroll__wrap yr-select-area">
<view class="fui-title">请选择</view> <view class="fui-title">请选择</view>
<fui-cascader ref="areaPopupRef" :value="pageData.optionsVal" stepLoading @change="changeArea" @complete="selectCompleteArea" :options="pageData.options"></fui-cascader> <fui-cascader
ref="areaPopupRef"
:value="pageData.optionsVal"
stepLoading
@change="changeArea"
@complete="selectCompleteArea"
:options="pageData.options"
/>
<view class="fui-icon__close" @tap.stop="pageData.show.address = false"> <view class="fui-icon__close" @tap.stop="pageData.show.address = false">
<fui-icon name="close" :size="48"></fui-icon> <fui-icon name="close" :size="48" />
</view> </view>
</view> </view>
</fui-bottom-popup> </fui-bottom-popup>
</view> </view>
</view> </view>
</template> </template>
......
...@@ -222,14 +222,17 @@ ...@@ -222,14 +222,17 @@
label-width="180" label-width="180"
maxlength="6" maxlength="6"
> >
<view slot="suffix" class="unit-slot">元/亩</view> <template #suffix>
<view class="unit-slot">元/亩</view>
</template>
<!-- <slot name="right" style="font-size:28rpx;"></slot> --> <!-- <slot name="right" style="font-size:28rpx;"></slot> -->
</fui-input> </fui-input>
</view> </view>
<view class="bg-white mt20" style="padding: 0.875rem 1rem"> <view class="bg-white mt20" style="padding: 0.875rem 1rem">
<view class="mb-1 flex justify-start" style="font-size:28rpx;"><span class="text-red">*&nbsp;</span> 图片 </view> <view class="mb-1 flex justify-start" style="font-size: 28rpx"
><span class="text-red">*&nbsp;</span> 图片
</view>
<uni-file-picker <uni-file-picker
:value="form.pictureObj" :value="form.pictureObj"
:max-size="1024" :max-size="1024"
......
...@@ -6,12 +6,11 @@ ...@@ -6,12 +6,11 @@
import * as NongjifuwuAPI from '@/api/model/nongjifuwu' import * as NongjifuwuAPI from '@/api/model/nongjifuwu'
import * as NongzhiAPI from '@/api/model/nongzhi' import * as NongzhiAPI from '@/api/model/nongzhi'
import Navigate from '@/utils/page/navigate' import Navigate from '@/utils/page/navigate'
import { s } from 'vite/dist/node/types.d-aGj9QkWt'
import { getDictData, getText } from '@/utils/dict/area' import { getDictData, getText } from '@/utils/dict/area'
onLoad((option) => { onLoad((option) => {
pageData.search.serviceType = Number(option.type) || 1; pageData.search.serviceType = Number(option.type) || 1
getProvince(43,null); getProvince(43, null)
}) })
onShow(() => { onShow(() => {
...@@ -29,8 +28,8 @@ ...@@ -29,8 +28,8 @@
address: false, address: false,
}, },
options: [], options: [],
optionsVal:[], optionsVal: [],
optionsValText:"", optionsValText: '',
// 分类标签 // 分类标签
categoryTabs: [ categoryTabs: [
{ id: 1, name: '找农机' }, { id: 1, name: '找农机' },
...@@ -41,73 +40,73 @@ ...@@ -41,73 +40,73 @@
pageSize: 10, pageSize: 10,
serviceType: 1, serviceType: 1,
scope: null, scope: null,
bizCategory:3, bizCategory: 3,
reviewStatus:1 reviewStatus: 1,
}, },
farmMachineList: [], farmMachineList: [],
total: 0, total: 0,
}) })
const areaPopupRef = ref(null); const areaPopupRef = ref(null)
// 选择地区完成 // 选择地区完成
function selectCompleteArea(e){ function selectCompleteArea(e) {
let text = e.text; const text = e.text
let value = e.value; const value = e.value
let areaText = "",areaVal=""; let areaText = ''
for(let i = 0; i < (text.length-1);i++){ let areaVal = ''
areaText += text[i]+'/'; for (let i = 0; i < text.length - 1; i++) {
areaVal += value[i]+','; areaText += `${text[i]}/`
} areaVal += `${value[i]},`
pageData.search.scope = areaVal.slice(0, -1);; // code }
pageData.optionsValText= areaText.slice(0, -1);; pageData.search.scope = areaVal.slice(0, -1) // code
pageData.show.address = false; pageData.optionsValText = areaText.slice(0, -1)
pageData.show.address = false
// 触发搜索 // 触发搜索
search(); search()
} }
// 在选择地区 // 在选择地区
function changeArea(e){ function changeArea(e) {
let val = e.value; const val = e.value
getProvince(val,e); getProvince(val, e)
} }
// 获取下一级地区 // 获取下一级地区
function getProvince(code,e) { function getProvince(code, e) {
LinghuoyonggongAPI.queryConditions({ parentCode : code}).then(res=>{ LinghuoyonggongAPI.queryConditions({ parentCode: code }).then((res) => {
if(res.length){ if (res.length) {
let dataArr = []; const dataArr = []
for(let i = 0; i < res.length; i++){ for (let i = 0; i < res.length; i++) {
let obj = {text:"",value:""}; const obj = { text: '', value: '' }
obj.text = res[i].name; obj.text = res[i].name
obj.value = res[i].code; obj.value = res[i].code
dataArr.push(obj); dataArr.push(obj)
} }
if(!pageData.options.length){ if (!pageData.options.length) {
pageData.options = dataArr; pageData.options = dataArr
}else{ } else {
console.log("e.layer= "+ e.layer); console.log(`e.layer= ${e.layer}`)
areaPopupRef.value.setRequestData(dataArr, e.layer); areaPopupRef.value.setRequestData(dataArr, e.layer)
if(e.layer >= 2){ if (e.layer >= 2) {
areaPopupRef.value.end(); areaPopupRef.value.end()
} }
} }
}else{ } else {
areaPopupRef.value.end(); areaPopupRef.value.end()
} }
}) })
} }
function getFarmMachineList() { function getFarmMachineList() {
pageData.loading = true pageData.loading = true
if(pageData.search.serviceType == 1){ if (pageData.search.serviceType == 1) {
NongzhiAPI.getEnterpriseList(pageData.search) NongzhiAPI.getEnterpriseList(pageData.search)
.then((res) => { .then((res) => {
const { records, total } = res const { records, total } = res
pageData.farmMachineList = [...pageData.farmMachineList, ...records] pageData.farmMachineList = [...pageData.farmMachineList, ...records]
pageData.total = total; pageData.total = total
}) })
.finally(() => { .finally(() => {
pageData.loading = false pageData.loading = false
}) })
}else{ } else {
NongjifuwuAPI.farmMachineList(pageData.search) NongjifuwuAPI.farmMachineList(pageData.search)
.then((res) => { .then((res) => {
const { records, total } = res const { records, total } = res
...@@ -122,7 +121,7 @@ ...@@ -122,7 +121,7 @@
function search() { function search() {
pageData.loading = true pageData.loading = true
if(pageData.search.serviceType == 1){ if (pageData.search.serviceType == 1) {
NongzhiAPI.getEnterpriseList(pageData.search) NongzhiAPI.getEnterpriseList(pageData.search)
.then((res) => { .then((res) => {
const { records, total } = res const { records, total } = res
...@@ -132,7 +131,7 @@ ...@@ -132,7 +131,7 @@
.finally(() => { .finally(() => {
pageData.loading = false pageData.loading = false
}) })
}else{ } else {
NongjifuwuAPI.farmMachineList(pageData.search) NongjifuwuAPI.farmMachineList(pageData.search)
.then((res) => { .then((res) => {
const { records, total } = res const { records, total } = res
...@@ -151,37 +150,37 @@ ...@@ -151,37 +150,37 @@
// 分类标签点击事件 // 分类标签点击事件
function onCategoryTabClick(tab: any) { function onCategoryTabClick(tab: any) {
pageData.search.serviceType = tab.id; pageData.search.serviceType = tab.id
// 在这里添加具体的分类标签点击逻辑 // 在这里添加具体的分类标签点击逻辑
pageData.search.pageNo = 1 pageData.search.pageNo = 1
pageData.farmMachineList = []; pageData.farmMachineList = []
getFarmMachineList() getFarmMachineList()
let pages = getCurrentPages(); const pages = getCurrentPages()
let page = pages[pages.length - 1]; const page = pages[pages.length - 1]
if(pageData.search.serviceType == 1){ if (pageData.search.serviceType == 1) {
// #ifdef H5 // #ifdef H5
document.querySelector('.uni-page-head-ft .uni-page-head-btn .uni-btn-icon').innerHTML = '申请入驻'; document.querySelector('.uni-page-head-ft .uni-page-head-btn .uni-btn-icon').innerHTML = '申请入驻'
// #endif // #endif
// #ifdef APP-PLUS // #ifdef APP-PLUS
var currentVebview = page.$getAppWebview(); var currentVebview = page.$getAppWebview()
var tn = currentVebview.getStyle().titleNView; var tn = currentVebview.getStyle().titleNView
tn.buttons[0].text = '申请入驻'; // \ue... 字体图标 tn.buttons[0].text = '申请入驻' // \ue... 字体图标
// tn.buttons[0].fontSrc = "/static/font/iconfont.ttf" // tn.buttons[0].fontSrc = "/static/font/iconfont.ttf"
currentVebview.setStyle({ currentVebview.setStyle({
titleNView: tn titleNView: tn,
}) })
// #endif // #endif
}else{ } else {
// #ifdef H5 // #ifdef H5
document.querySelector('.uni-page-head-ft .uni-page-head-btn .uni-btn-icon').innerHTML = ''; document.querySelector('.uni-page-head-ft .uni-page-head-btn .uni-btn-icon').innerHTML = ''
// #endif // #endif
// #ifdef APP-PLUS // #ifdef APP-PLUS
var currentVebview = page.$getAppWebview(); var currentVebview = page.$getAppWebview()
var tn = currentVebview.getStyle().titleNView; var tn = currentVebview.getStyle().titleNView
tn.buttons[0].text = ''; tn.buttons[0].text = ''
currentVebview.setStyle({ currentVebview.setStyle({
titleNView: tn titleNView: tn,
}) })
// #endif // #endif
} }
...@@ -219,21 +218,21 @@ ...@@ -219,21 +218,21 @@
} }
function toDetail(item) { function toDetail(item) {
let param = encodeURIComponent(JSON.stringify({id:item.id,name:item.enterpriseName})); const param = encodeURIComponent(JSON.stringify({ id: item.id, name: item.enterpriseName }))
Navigate.to(`/pages/nongjifuwu/detail?param=${param}`) Navigate.to(`/pages/nongjifuwu/detail?param=${param}`)
} }
onNavigationBarButtonTap((e) => { onNavigationBarButtonTap((e) => {
/* pageData.search.scope = null /* pageData.search.scope = null
search() */ search() */
if(pageData.search.serviceType == 1){ if (pageData.search.serviceType == 1) {
Navigate.to('/pages/nongjifuwu/shenqingruzhu') Navigate.to('/pages/nongjifuwu/shenqingruzhu')
} }
}) })
onReachBottom(() => { onReachBottom(() => {
if (pageData.total <= pageData.farmMachineList.length) return if (pageData.total <= pageData.farmMachineList.length)
return
pageData.search.pageNo++ pageData.search.pageNo++
getFarmMachineList() getFarmMachineList()
}) })
...@@ -278,14 +277,17 @@ ...@@ -278,14 +277,17 @@
<view class="item_top"> <view class="item_top">
<image class="enterprise_logo" mode="aspectFit" :src="item.enterpriseLogoUrl" /> <image class="enterprise_logo" mode="aspectFit" :src="item.enterpriseLogoUrl" />
<view class="item_right"> <view class="item_right">
<view class="text-ellipsis yr-item-name">{{item.enterpriseName}}</view> <view class="text-ellipsis yr-item-name">{{ item.enterpriseName }}</view>
<view class="text-ellipsis yr-item-product">公司主营: {{item.businessScope}}</view> <view class="text-ellipsis yr-item-product">公司主营: {{ item.businessScope }}</view>
</view> </view>
</view> </view>
<view class="yr-item-info"> <view class="yr-item-info">
<view class="text-ellipsis yr-item-address"> <view class="text-ellipsis yr-item-address">
<image class="address_icon" src="/static/images/linghuoyonggong/address.png" /> <image class="address_icon" src="/static/images/linghuoyonggong/address.png" />
<text>{{item.provinceName}}{{item.cityName}}{{item.districtName}}{{item.townName}}</text> <text
>{{ item.provinceName }}{{ item.cityName }}{{ item.districtName
}}{{ item.townName }}</text
>
</view> </view>
<view class="yr-item-detail" @click="toDetail(item)">查看详情</view> <view class="yr-item-detail" @click="toDetail(item)">查看详情</view>
</view> </view>
...@@ -324,18 +326,23 @@ ...@@ -324,18 +326,23 @@
</view> </view>
</view> </view>
</template> </template>
</view> </view>
</view> </view>
</view> </view>
<fui-fab v-show="pageData.search.serviceType != 1" position="right" distance="10" bottom="240" width="96" @click="handlePublish"> <fui-fab
v-show="pageData.search.serviceType != 1"
position="right"
distance="10"
bottom="240"
width="96"
@click="handlePublish"
>
<view class="text-white text-center"> <view class="text-white text-center">
<view class="fab-icon" /> <view class="fab-icon" />
<view style="font-size: 24rpx">发布</view> <view style="font-size: 24rpx">发布</view>
</view> </view>
</fui-fab> </fui-fab>
<!-- <fui-picker <!-- <fui-picker
:show="pageData.show.address" :show="pageData.show.address"
:options="pageData.options" :options="pageData.options"
...@@ -347,14 +354,20 @@ ...@@ -347,14 +354,20 @@
<fui-bottom-popup :show="pageData.show.address"> <fui-bottom-popup :show="pageData.show.address">
<view class="fui-scroll__wrap yr-select-area"> <view class="fui-scroll__wrap yr-select-area">
<view class="fui-title">请选择</view> <view class="fui-title">请选择</view>
<fui-cascader ref="areaPopupRef" :value="pageData.optionsVal" stepLoading @change="changeArea" @complete="selectCompleteArea" :options="pageData.options"></fui-cascader> <fui-cascader
ref="areaPopupRef"
:value="pageData.optionsVal"
stepLoading
@change="changeArea"
@complete="selectCompleteArea"
:options="pageData.options"
/>
<view class="fui-icon__close" @tap.stop="pageData.show.address = false"> <view class="fui-icon__close" @tap.stop="pageData.show.address = false">
<fui-icon name="close" :size="48"></fui-icon> <fui-icon name="close" :size="48" />
</view> </view>
</view> </view>
</fui-bottom-popup> </fui-bottom-popup>
<ApplyDialog ref="applyDialogRef" /> <ApplyDialog ref="applyDialogRef" />
<fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)" /> <fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)" />
</template> </template>
...@@ -374,21 +387,21 @@ ...@@ -374,21 +387,21 @@
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.yr-item{ .yr-item {
margin-top: 24rpx; margin-top: 24rpx;
border-bottom: 2rpx solid #EEEEEE; border-bottom: 2rpx solid #eeeeee;
padding-left: 8rpx; padding-left: 8rpx;
padding-bottom: 20rpx; padding-bottom: 20rpx;
.item_top{ .item_top {
display: flex; display: flex;
align-items:flex-start; align-items: flex-start;
justify-content: space-between; justify-content: space-between;
} }
.enterprise_logo{ .enterprise_logo {
width: 160rpx; width: 160rpx;
max-height: 120rpx; max-height: 120rpx;
} }
.yr-item-name{ .yr-item-name {
width: 480rpx; width: 480rpx;
height: 40rpx; height: 40rpx;
font-size: 32rpx; font-size: 32rpx;
...@@ -396,7 +409,7 @@ ...@@ -396,7 +409,7 @@
font-weight: 500; font-weight: 500;
color: #333333; color: #333333;
} }
.yr-item-product{ .yr-item-product {
margin-top: 12rpx; margin-top: 12rpx;
width: 480rpx; width: 480rpx;
height: 32rpx; height: 32rpx;
...@@ -405,40 +418,40 @@ ...@@ -405,40 +418,40 @@
font-weight: 500; font-weight: 500;
color: #555555; color: #555555;
} }
.yr-item-info{ .yr-item-info {
margin-top: 18rpx; margin-top: 18rpx;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
.yr-item-address{ .yr-item-address {
font-size: 24rpx; font-size: 24rpx;
color: #999999; color: #999999;
width: 480rpx; width: 480rpx;
display: flex; display: flex;
align-items: center; align-items: center;
.address_icon{ .address_icon {
width: 24rpx; width: 24rpx;
height: 26rpx; height: 26rpx;
margin-right: 8rpx; margin-right: 8rpx;
} }
} }
.yr-item-detail{ .yr-item-detail {
width: 136rpx; width: 136rpx;
height: 48rpx; height: 48rpx;
border-radius: 200rpx; border-radius: 200rpx;
background: #5DB66F; background: #5db66f;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
padding: 20rpx; padding: 20rpx;
color: #FFFFFF; color: #ffffff;
font-size: 24rpx; font-size: 24rpx;
font-weight: 400; font-weight: 400;
} }
} }
} }
.yr-item:last-child{ .yr-item:last-child {
border-bottom:none border-bottom: none;
} }
.section { .section {
......
<script setup lang="ts"> <script setup lang="ts">
import { reactive, toRefs,ref } from 'vue' import { reactive, ref, toRefs } from 'vue'
import { onLoad, onShow } from '@dcloudio/uni-app' import { onLoad } from '@dcloudio/uni-app'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
import { useGlobSetting } from '/@/hooks/setting' import { useGlobSetting } from '/@/hooks/setting'
import * as LinghuoyonggongAPI from '@/api/model/linghuoyonggong' import * as LinghuoyonggongAPI from '@/api/model/linghuoyonggong'
import * as UserInfoAPI from '@/api/model/userInfo'
import * as NongzhiAPI from '@/api/model/nongzhi' import * as NongzhiAPI from '@/api/model/nongzhi'
import { useDictStore } from '@/store/modules/dict' import { useDictStore } from '@/store/modules/dict'
...@@ -14,15 +13,14 @@ ...@@ -14,15 +13,14 @@
const globSetting = useGlobSetting() const globSetting = useGlobSetting()
onLoad((option) => { onLoad((option) => {
// 获取数据详情 // 获取数据详情
getProvince(0,null); getProvince(0, null)
}) })
// 勾选协议校验
//勾选协议校验
function checkAgree(agree) { function checkAgree(agree) {
return agree return agree
} }
const areaPopupRef = ref(null); const areaPopupRef = ref(null)
const pageData = reactive({ const pageData = reactive({
loading: false, loading: false,
show: { show: {
...@@ -34,48 +32,46 @@ ...@@ -34,48 +32,46 @@
}, },
options: { options: {
area: [], area: [],
areaVal:[], areaVal: [],
urgentdegree: [], urgentdegree: [],
type: [], type: [],
}, },
cersImageIndex:0, cersImageIndex: 0,
cersImageArr:[], cersImageArr: [],
enterpriseLogoArr:[], enterpriseLogoArr: [],
selectAreaVal:[], selectAreaVal: [],
form: { form: {
id: '', id: '',
enterpriseName:"",// 企业名称 enterpriseName: '', // 企业名称
enterpriseCode:"",// 企业编码 enterpriseCode: '', // 企业编码
businessScope:"", // 企业经营范围 businessScope: '', // 企业经营范围
contactPerson:"", // 联系人 contactPerson: '', // 联系人
contactMobile:"", // 联系人手机号 contactMobile: '', // 联系人手机号
profile:"", // 企业简介 profile: '', // 企业简介
provinceName:"", // 省 provinceName: '', // 省
cityName:"", // 市 cityName: '', // 市
districtName:"", // 区县 districtName: '', // 区县
townName:"", // 乡镇 townName: '', // 乡镇
provinceCode:"", // 省 provinceCode: '', // 省
cityCode:"", // 市 cityCode: '', // 市
districtCode:"", // 区县 districtCode: '', // 区县
townCode:"", // 乡镇 townCode: '', // 乡镇
addr: '', // 详细地址
addr:"", // 详细地址 lon: '', // 经度
lon:"", // 经度 lat: '', // 纬度
lat:'', // 纬度
bizCategory: 3, // 业务分类【1:代理记账、2:农资、3:农机、4:金融】 bizCategory: 3, // 业务分类【1:代理记账、2:农资、3:农机、4:金融】
enterpriseLogoUrl:null, // 企业logo url enterpriseLogoUrl: null, // 企业logo url
enterpriseCers:null, // 企业资质url enterpriseCers: null, // 企业资质url
areaText: '', areaText: '',
agree:false, agree: false,
}, },
position: [], position: [],
rules: [ rules: [
...@@ -83,92 +79,103 @@ ...@@ -83,92 +79,103 @@
name: 'enterpriseName', name: 'enterpriseName',
rule: ['required'], rule: ['required'],
msg: ['请输入公司名称'], msg: ['请输入公司名称'],
}, { },
{
name: 'enterpriseCode', name: 'enterpriseCode',
rule: ['required'], rule: ['required'],
msg: ['请输入企业编码'], msg: ['请输入企业编码'],
}, { },
{
name: 'businessScope', name: 'businessScope',
rule: ['required'], rule: ['required'],
msg: ['请输入经营业务'], msg: ['请输入经营业务'],
},{ },
{
name: 'profile', name: 'profile',
rule: ['required'], rule: ['required'],
msg: ['请输入平台介绍'], msg: ['请输入平台介绍'],
},{ },
{
name: 'areaText', name: 'areaText',
rule: ['required'], rule: ['required'],
msg: ['请选择地区'], msg: ['请选择地区'],
},{ },
{
name: 'addr', name: 'addr',
rule: ['required'], rule: ['required'],
msg: ['请输入详细地址'], msg: ['请输入详细地址'],
},{ },
{
name: 'contactPerson', name: 'contactPerson',
rule: ['required'], rule: ['required'],
msg: ['请输入联系人'], msg: ['请输入联系人'],
},{ },
name: "contactMobile", {
rule: ["required", "isMobile"], name: 'contactMobile',
msg: ["请输入联系电话", "请输入正确的联系电话"] rule: ['required', 'isMobile'],
},{ msg: ['请输入联系电话', '请输入正确的联系电话'],
},
{
name: 'enterpriseLogoUrl', name: 'enterpriseLogoUrl',
rule: ['required'], rule: ['required'],
msg: ['请上传公司logo'], msg: ['请上传公司logo'],
},{ },
{
name: 'enterpriseCers', name: 'enterpriseCers',
rule: ['required'], rule: ['required'],
msg: ['请上传公司资质证件'], msg: ['请上传公司资质证件'],
},{ },
name: "agree", {
validator: [{ name: 'agree',
msg: "请勾选并同意《入驻协议》与《服务条款》", validator: [
method: checkAgree {
}] msg: '请勾选并同意《入驻协议》与《服务条款》',
} method: checkAgree,
},
],
},
], ],
}) })
function agreeChange(e) { function agreeChange(e) {
pageData.form.agree = e.checked; pageData.form.agree = e.checked
} }
// 选择地区完成 // 选择地区完成
function selectCompleteArea(e){ function selectCompleteArea(e) {
let areaAttr = ['province','city','district','town']; const areaAttr = ['province', 'city', 'district', 'town']
let text = e.text; const text = e.text
let value = e.value; const value = e.value
let formData = pageData.form; const formData = pageData.form
for(let i = 0; i < text.length;i++){ for (let i = 0; i < text.length; i++) {
formData[areaAttr[i]+'Name'] = text[i]; formData[`${areaAttr[i]}Name`] = text[i]
formData[areaAttr[i]+'Code'] = value[i]; formData[`${areaAttr[i]}Code`] = value[i]
} }
pageData.form.areaText= text.join(''); pageData.form.areaText = text.join('')
pageData.show.area = false; pageData.show.area = false
} }
// 在选择地区 // 在选择地区
function changeArea(e){ function changeArea(e) {
let val = e.value; const val = e.value
getProvince(val,e); getProvince(val, e)
} }
// 获取下一级地区 // 获取下一级地区
function getProvince(code,e) { function getProvince(code, e) {
LinghuoyonggongAPI.queryConditions({ parentCode : code}).then(res=>{ LinghuoyonggongAPI.queryConditions({ parentCode: code }).then((res) => {
if(res.length){ if (res.length) {
let dataArr = []; const dataArr = []
for(let i = 0; i < res.length; i++){ for (let i = 0; i < res.length; i++) {
let obj = {text:"",value:""}; const obj = { text: '', value: '' }
obj.text = res[i].name; obj.text = res[i].name
obj.value = res[i].code; obj.value = res[i].code
dataArr.push(obj); dataArr.push(obj)
} }
if(!pageData.options.area.length){ if (!pageData.options.area.length) {
pageData.options.area = dataArr; pageData.options.area = dataArr
}else{ } else {
areaPopupRef.value.setRequestData(dataArr, e.layer); areaPopupRef.value.setRequestData(dataArr, e.layer)
} }
}else{ } else {
areaPopupRef.value.end(); areaPopupRef.value.end()
} }
}) })
} }
...@@ -178,10 +185,10 @@ ...@@ -178,10 +185,10 @@
const uploadLogoRef = ref() const uploadLogoRef = ref()
const uploadCersRef = ref() const uploadCersRef = ref()
// 文件上传 // 文件上传
function handleUpload(file,type) { function handleUpload(file, type) {
const tempFilePaths = file.tempFilePaths; const tempFilePaths = file.tempFilePaths
// 处理每张选中的图片 // 处理每张选中的图片
for(let i = 0; i < tempFilePaths.length; i++){ for (let i = 0; i < tempFilePaths.length; i++) {
uni.uploadFile({ uni.uploadFile({
url: `${globSetting.apiUrl + globSetting.urlPrefix}/sys/common/upload`, // 直接使用上传接口URL url: `${globSetting.apiUrl + globSetting.urlPrefix}/sys/common/upload`, // 直接使用上传接口URL
filePath: tempFilePaths[i], filePath: tempFilePaths[i],
...@@ -200,13 +207,12 @@ ...@@ -200,13 +207,12 @@
type: 'success', type: 'success',
text: '上传成功', text: '上传成功',
}) })
if(type == 'logo'){ if (type == 'logo') {
pageData.enterpriseLogoArr[0] = data.message // 保存返回的图片信息 pageData.enterpriseLogoArr[0] = data.message // 保存返回的图片信息
}else{ } else {
pageData.cersImageIndex++; pageData.cersImageIndex++
pageData.cersImageArr.push(data.message); pageData.cersImageArr.push(data.message)
} }
} }
} }
}, },
...@@ -215,34 +221,33 @@ ...@@ -215,34 +221,33 @@
type: 'error', type: 'error',
text: '上传失败', text: '上传失败',
}) })
if(type == 'logo'){ if (type == 'logo') {
uploadLogoRef.value.clearFiles() uploadLogoRef.value.clearFiles()
pageData.enterpriseLogoArr[0] = null pageData.enterpriseLogoArr[0] = null
}else{ } else {
uploadCersRef.value.clearFiles(pageData.cersImageIndex) uploadCersRef.value.clearFiles(pageData.cersImageIndex)
pageData.form.enterpriseCers = null pageData.form.enterpriseCers = null
} }
}, },
}) })
} }
} }
// 文件删除 // 文件删除
function handleDelete(file,type) { function handleDelete(file, type) {
if(type="logo"){ if ((type = 'logo')) {
uploadLogoRef.value.clearFiles() uploadLogoRef.value.clearFiles()
pageData.enterpriseLogoArr[0] = null pageData.enterpriseLogoArr[0] = null
}else{ } else {
const num = pageData.cersImageArr.findIndex(v => v.url === file.tempFilePath); const num = pageData.cersImageArr.findIndex((v) => v.url === file.tempFilePath)
pageData.cersImageArr.splice(num, 1); pageData.cersImageArr.splice(num, 1)
} }
} }
const formRef = ref() const formRef = ref()
function submit() { function submit() {
const { lon, lat } = uni.getStorageSync('location') const { lon, lat } = uni.getStorageSync('location')
pageData.position = [lon, lat]; pageData.position = [lon, lat]
pageData.form.enterpriseLogoUrl = pageData.enterpriseLogoArr.join(''); pageData.form.enterpriseLogoUrl = pageData.enterpriseLogoArr.join('')
pageData.form.enterpriseCers = pageData.cersImageArr.join(','); pageData.form.enterpriseCers = pageData.cersImageArr.join(',')
if (pageData.position.length == 0) { if (pageData.position.length == 0) {
toastRef.value.show({ toastRef.value.show({
type: 'error', type: 'error',
...@@ -259,17 +264,17 @@ ...@@ -259,17 +264,17 @@
type: 'success', type: 'success',
text: '发布成功', text: '发布成功',
}) })
setTimeout(()=>{ setTimeout(() => {
uni.navigateBack({ uni.navigateBack({
delta: 1 // 返回的页面数 delta: 1, // 返回的页面数
}) })
},1000) }, 1000)
}) })
} }
}) })
} }
function getCurrentDate(){ function getCurrentDate() {
const date = new Date() const date = new Date()
const year = date.getFullYear() const year = date.getFullYear()
const month = date.getMonth() + 1 const month = date.getMonth() + 1
...@@ -283,35 +288,122 @@ ...@@ -283,35 +288,122 @@
<view class="formBox"> <view class="formBox">
<fui-form ref="formRef" label-weight="auto" top="60" :disabled="form.id ? true : false"> <fui-form ref="formRef" label-weight="auto" top="60" :disabled="form.id ? true : false">
<view class="mt20"> <view class="mt20">
<fui-input required label="公司名称" placeholder="请输入公司名称" v-model="form.enterpriseName" labelSize="28" label-width="180" size="28"/> <fui-input
<fui-input required label="企业编码" placeholder="请输入企业编码" v-model="form.enterpriseCode" labelSize="28" label-width="180" size="28"/> required
<fui-input required label="经营业务" placeholder="请输入经营业务" v-model="form.businessScope" labelSize="28" label-width="180" size="28"/> label="公司名称"
placeholder="请输入公司名称"
v-model="form.enterpriseName"
labelSize="28"
label-width="180"
size="28"
/>
<fui-input
required
label="企业编码"
placeholder="请输入企业编码"
v-model="form.enterpriseCode"
labelSize="28"
label-width="180"
size="28"
/>
<fui-input
required
label="经营业务"
placeholder="请输入经营业务"
v-model="form.businessScope"
labelSize="28"
label-width="180"
size="28"
/>
<fui-form-item asterisk label="平台介绍" :bottomBorder="false" prop="descr" error-align="left"> <fui-form-item asterisk label="平台介绍" :bottomBorder="false" prop="descr" error-align="left">
<template v-slot:vertical> <template #vertical>
<fui-textarea isCounter maxlength="-1" :padding="['0','32rpx','32rpx']" :border-bottom="false" :border-top="false" size="28" <fui-textarea
placeholder="请输入平台介绍..." v-model="form.profile"></fui-textarea> isCounter
maxlength="-1"
:padding="['0', '32rpx', '32rpx']"
:border-bottom="false"
:border-top="false"
size="28"
placeholder="请输入平台介绍..."
v-model="form.profile"
/>
</template> </template>
</fui-form-item> </fui-form-item>
</view> </view>
<view class="mt20"> <view class="mt20">
<fui-input required label="地区" placeholder="请选择地区" v-model="form.areaText" labelSize="28" label-width="180" @click="show.area = true" size="28" disabled/> <fui-input
<fui-input required label="详细地址" placeholder="请输入详细地址" v-model="form.addr" labelSize="28" label-width="180" size="28"/> required
<fui-input required label="联系人" placeholder="请输入联系人" v-model="form.contactPerson" labelSize="28" label-width="180" size="28"/> label="地区"
<fui-input type="tel" required label="联系电话" placeholder="请输入联系电话" v-model="form.contactMobile" labelSize="28" label-width="180" size="28"></fui-input> placeholder="请选择地区"
v-model="form.areaText"
labelSize="28"
label-width="180"
@click="show.area = true"
size="28"
disabled
/>
<fui-input
required
label="详细地址"
placeholder="请输入详细地址"
v-model="form.addr"
labelSize="28"
label-width="180"
size="28"
/>
<fui-input
required
label="联系人"
placeholder="请输入联系人"
v-model="form.contactPerson"
labelSize="28"
label-width="180"
size="28"
/>
<fui-input
type="tel"
required
label="联系电话"
placeholder="请输入联系电话"
v-model="form.contactMobile"
labelSize="28"
label-width="180"
size="28"
/>
</view> </view>
<view class="bg-white mt20" style="padding: 0.875rem 1rem"> <view class="bg-white mt20" style="padding: 0.875rem 1rem">
<view class="mb-1 flex justify-start" style="font-size: 28rpx;"><span style="color: red;">*&nbsp;</span> 公司logo </view> <view class="mb-1 flex justify-start" style="font-size: 28rpx"
<uni-file-picker :value="pageData.enterpriseLogoArr" ref="uploadLogoRef" limit="1" :auto-upload="false" @select="handleUpload($event,'logo')" @delete="handleDelete($event,'logo')"/> ><span style="color: red">*&nbsp;</span> 公司logo
</view>
<uni-file-picker
:value="pageData.enterpriseLogoArr"
ref="uploadLogoRef"
limit="1"
:auto-upload="false"
@select="handleUpload($event, 'logo')"
@delete="handleDelete($event, 'logo')"
/>
</view> </view>
<view class="bg-white mt20" style="padding: 0.875rem 1rem"> <view class="bg-white mt20" style="padding: 0.875rem 1rem">
<view class="mb-1 flex justify-start" style="font-size: 28rpx;"><span style="color: red;">*&nbsp;</span> 公司资质证件 </view> <view class="mb-1 flex justify-start" style="font-size: 28rpx"
<view class="mb-1 flex justify-start" style="font-size: 24rpx;color: #CCCCCC;">前6张资质证件将展示在详情页,拖拽图片可自定义排序。</view> ><span style="color: red">*&nbsp;</span> 公司资质证件
<uni-file-picker limit="9" :value="pageData.cersImageArr" ref="uploadCersRef" :auto-upload="false" @select="handleUpload($event,'cers')" @delete="handleDelete($event,'cers')"/> </view>
<view class="mb-1 flex justify-start" style="font-size: 24rpx; color: #cccccc"
>前6张资质证件将展示在详情页,拖拽图片可自定义排序。</view
>
<uni-file-picker
limit="9"
:value="pageData.cersImageArr"
ref="uploadCersRef"
:auto-upload="false"
@select="handleUpload($event, 'cers')"
@delete="handleDelete($event, 'cers')"
/>
</view> </view>
<view class="fui-clause--cell fui-clause--wrap"> <view class="fui-clause--cell fui-clause--wrap">
<fui-label> <fui-label>
<view class="fui-clause--cell"> <view class="fui-clause--cell">
<fui-checkbox :scaleRatio="0.8" @change="agreeChange"></fui-checkbox> <fui-checkbox :scaleRatio="0.8" @change="agreeChange" />
<text class="fui-clause--text">我已阅读并同意</text> <text class="fui-clause--text">我已阅读并同意</text>
</view> </view>
</fui-label> </fui-label>
...@@ -335,14 +427,20 @@ ...@@ -335,14 +427,20 @@
<fui-bottom-popup :show="show.area"> <fui-bottom-popup :show="show.area">
<view class="fui-scroll__wrap"> <view class="fui-scroll__wrap">
<view class="fui-title">请选择</view> <view class="fui-title">请选择</view>
<fui-cascader ref="areaPopupRef" :value="pageData.options.areaVal" stepLoading @change="changeArea" @complete="selectCompleteArea" :options="pageData.options.area"></fui-cascader> <fui-cascader
<view class="fui-icon__close" @tap.stop="pageData.show.area=false"> ref="areaPopupRef"
<fui-icon name="close" :size="48"></fui-icon> :value="pageData.options.areaVal"
stepLoading
@change="changeArea"
@complete="selectCompleteArea"
:options="pageData.options.area"
/>
<view class="fui-icon__close" @tap.stop="pageData.show.area = false">
<fui-icon name="close" :size="48" />
</view> </view>
</view> </view>
</fui-bottom-popup> </fui-bottom-popup>
<fui-toast ref="toastRef" /> <fui-toast ref="toastRef" />
<fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)" /> <fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)" />
</template> </template>
...@@ -523,14 +621,12 @@ ...@@ -523,14 +621,12 @@
font-size: 28rpx; font-size: 28rpx;
} }
.fui-clause--cell { .fui-clause--cell {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
font-size: 24rpx; font-size: 24rpx;
color:#999999; color: #999999;
} }
.fui-clause--wrap { .fui-clause--wrap {
width: 100%; width: 100%;
...@@ -543,14 +639,14 @@ ...@@ -543,14 +639,14 @@
/* #endif */ /* #endif */
} }
.fui-color__link { .fui-color__link {
color: #5FB771; color: #5fb771;
/* #ifdef H5 */ /* #ifdef H5 */
cursor: pointer; cursor: pointer;
/* #endif */ /* #endif */
} }
.fui-color__link:active { .fui-color__link:active {
opacity: .5; opacity: 0.5;
} }
.fui-scroll__wrap { .fui-scroll__wrap {
padding-top: 30rpx; padding-top: 30rpx;
......
<!-- src/pages/zhunongjinrong/zhunongjinrong.vue --> <!-- src/pages/zhunongjinrong/zhunongjinrong.vue -->
<script setup lang="ts"> <script setup lang="ts">
import { reactive, ref } from 'vue' import { reactive, ref } from 'vue'
import successfulDialog from '@/components/ConfirmDialog/successfulDialog.vue';
import { getCurrentDateTime } from '@/utils/date'
import * as NewsApi from '@/api/model/news'
import dayjs from 'dayjs' import dayjs from 'dayjs'
let currentTab = ref('redian'); import * as NewsApi from '@/api/model/news'
const currentTab = ref('redian')
const pageData = reactive({ const pageData = reactive({
params: { params: {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
category:1, category: 1,
/* news:{ /* news:{
category:1 category:1
} */ } */
}, // 分页参数 }, // 分页参数
hasMore: true, // 是否还有更多数据 hasMore: true, // 是否还有更多数据
loading: false, // 是否正在加载 loading: false, // 是否正在加载
dataList:[] dataList: [],
}) })
onLoad((options) => { onLoad((options) => {
if(options && options.category==1){ if (options && options.category == 1) {
pageData.params.category = options.category; pageData.params.category = options.category
currentTab.value = 'redian'; currentTab.value = 'redian'
}else{ } else {
pageData.params.category = 2; pageData.params.category = 2
currentTab.value = 'nongye'; currentTab.value = 'nongye'
} }
}) })
onShow(() => { onShow(() => {
getListData(); getListData()
}) })
async function getListData() { async function getListData() {
if (pageData.loading) return if (pageData.loading)
return
pageData.loading = true pageData.loading = true
await NewsApi.getList(pageData.params).then((res) => { await NewsApi.getList(pageData.params).then((res) => {
if (res.records.length > 0) { if (res.records.length > 0) {
...@@ -55,22 +55,22 @@ ...@@ -55,22 +55,22 @@
url: `/pages/news/detail?id=${news.id}`, url: `/pages/news/detail?id=${news.id}`,
}) })
} }
function switchTab(type){ function switchTab(type) {
pageData.dataList = []; pageData.dataList = []
pageData.hasMore = true; pageData.hasMore = true
pageData.params.pageNo = 1; pageData.params.pageNo = 1
currentTab.value = type; currentTab.value = type
if(type == 'redian'){ if (type == 'redian') {
pageData.params.category = 1; pageData.params.category = 1
getListData(); getListData()
} }
if(type == 'nongye'){ if (type == 'nongye') {
pageData.params.category = 2; pageData.params.category = 2
getListData(); getListData()
} }
if(type == 'butie'){ if (type == 'butie') {
pageData.params.category = 3; pageData.params.category = 3
pageData.dataList = []; pageData.dataList = []
} }
} }
</script> </script>
...@@ -78,18 +78,42 @@ ...@@ -78,18 +78,42 @@
<template> <template>
<view class="nongyezhengce-page"> <view class="nongyezhengce-page">
<view class="nongyezhengce-content"> <view class="nongyezhengce-content">
<scroll-view class="page-content" scroll-y @scrolltolower="getListData()" :show-scrollbar="false" > <scroll-view class="page-content" scroll-y @scrolltolower="getListData()" :show-scrollbar="false">
<view class="top-tab"> <view class="top-tab">
<view class="tab-btn" :class="currentTab == 'redian' ? 'tab-active' : ''" @click="switchTab('redian')"> <view
<image class="tab-icon" mode="heightFix" :src="`/static/images/home/${currentTab == 'redian' ?'redian_active':'redian_icon'}.png`" /> class="tab-btn"
:class="currentTab == 'redian' ? 'tab-active' : ''"
@click="switchTab('redian')"
>
<image
class="tab-icon"
mode="heightFix"
:src="`/static/images/home/${currentTab == 'redian' ? 'redian_active' : 'redian_icon'}.png`"
/>
<text class="tab-text">热点新闻</text> <text class="tab-text">热点新闻</text>
</view> </view>
<view class="tab-btn" :class="currentTab == 'nongye' ? 'tab-active' : ''" @click="switchTab('nongye')"> <view
<image class="tab-icon" mode="heightFix" :src="`/static/images/home/${currentTab == 'nongye' ?'nongye_active':'nongye_icon'}.png`" /> class="tab-btn"
:class="currentTab == 'nongye' ? 'tab-active' : ''"
@click="switchTab('nongye')"
>
<image
class="tab-icon"
mode="heightFix"
:src="`/static/images/home/${currentTab == 'nongye' ? 'nongye_active' : 'nongye_icon'}.png`"
/>
<text class="tab-text">农业政策</text> <text class="tab-text">农业政策</text>
</view> </view>
<view class="tab-btn" :class="currentTab == 'butie' ? 'tab-active' : ''" @click="switchTab('butie')"> <view
<image class="tab-icon" mode="heightFix" :src="`/static/images/home/${currentTab == 'butie' ?'butie_active':'butie_icon'}.png`" /> class="tab-btn"
:class="currentTab == 'butie' ? 'tab-active' : ''"
@click="switchTab('butie')"
>
<image
class="tab-icon"
mode="heightFix"
:src="`/static/images/home/${currentTab == 'butie' ? 'butie_active' : 'butie_icon'}.png`"
/>
<text class="tab-text">购置补贴</text> <text class="tab-text">购置补贴</text>
</view> </view>
</view> </view>
...@@ -97,11 +121,22 @@ ...@@ -97,11 +121,22 @@
<view v-if="!pageData.dataList || pageData.dataList.length == 0" style="height: 700rpx"> <view v-if="!pageData.dataList || pageData.dataList.length == 0" style="height: 700rpx">
<fui-empty marginTop="100" src="/static/images/no-data.png" title="暂无数据" /> <fui-empty marginTop="100" src="/static/images/no-data.png" title="暂无数据" />
</view> </view>
<view class="content-item" v-for="item in pageData.dataList" :key="item.id" @click="toNewsDetail(item)"> <view
<view class="item-content">{{item.title}}</view> class="content-item"
v-for="item in pageData.dataList"
:key="item.id"
@click="toNewsDetail(item)"
>
<view class="item-content">{{ item.title }}</view>
<view class="item-info"> <view class="item-info">
<view class="item-time">{{ dayjs(item.publishDate).format('YYYY-MM-DD') }}</view> <view class="item-time">{{ dayjs(item.publishDate).format('YYYY-MM-DD') }}</view>
<view class="item-views"><image class="views-icon" mode="widthFix" src="/static/images/home/views_icon.png" /><text>{{item.viewCount}}</text></view> <view class="item-views"
><image
class="views-icon"
mode="widthFix"
src="/static/images/home/views_icon.png"
/><text>{{ item.viewCount }}</text></view
>
</view> </view>
</view> </view>
</view> </view>
...@@ -116,61 +151,61 @@ ...@@ -116,61 +151,61 @@
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
.nongyezhengce-page{ .nongyezhengce-page {
background-color: #e6f5e8; background-color: #e6f5e8;
overflow-y: auto; overflow-y: auto;
} }
.nongyezhengce-content{ .nongyezhengce-content {
width: 100vw; width: 100vw;
height: calc(100vh - 88rpx); height: calc(100vh - 88rpx);
display: flex; display: flex;
justify-content: center; justify-content: center;
.page-content{ .page-content {
width: 690rpx; width: 690rpx;
padding-top: 24rpx; padding-top: 24rpx;
padding-bottom: 24rpx; padding-bottom: 24rpx;
.top-tab{ .top-tab {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
.tab-btn{ .tab-btn {
width: 220rpx; width: 220rpx;
height: 72rpx; height: 72rpx;
border-radius: 9999px; border-radius: 9999px;
background: #FFFFFF; background: #ffffff;
color: #333333; color: #333333;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
.tab-icon{ .tab-icon {
height: 36rpx; height: 36rpx;
margin-right: 8rpx; margin-right: 8rpx;
} }
.tab-text{ .tab-text {
font-size: 28rpx; font-size: 28rpx;
} }
} }
.tab-active{ .tab-active {
background: #5DB66F; background: #5db66f;
color: #FFFFFF; color: #ffffff;
} }
} }
.list-content{ .list-content {
margin-top: 4rpx; margin-top: 4rpx;
} }
.content-item{ .content-item {
width: 690rpx; width: 690rpx;
border-radius: 8rpx; border-radius: 8rpx;
background: #FFFFFF; background: #ffffff;
padding:20rpx; padding: 20rpx;
margin-top: 20rpx; margin-top: 20rpx;
.item-content{ .item-content {
font-size: 28rpx; font-size: 28rpx;
line-height: 40rpx; line-height: 40rpx;
text-align: justify; text-align: justify;
color: #333333; color: #333333;
} }
.item-info{ .item-info {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
...@@ -179,19 +214,19 @@ ...@@ -179,19 +214,19 @@
font-size: 24rpx; font-size: 24rpx;
line-height: 40rpx; line-height: 40rpx;
font-weight: 400; font-weight: 400;
.views-icon{ .views-icon {
width: 28rpx; width: 28rpx;
margin-right: 8rpx; margin-right: 8rpx;
} }
} }
} }
} }
} }
.loading-status { .loading-status {
background-color: #e6f5e8; background-color: #e6f5e8;
text-align: center; text-align: center;
padding: 20rpx; padding: 20rpx;
color: #999; color: #999;
font-size: 28rpx; font-size: 28rpx;
} }
</style> </style>
...@@ -115,8 +115,7 @@ ...@@ -115,8 +115,7 @@
// 加载编辑数据 // 加载编辑数据
function loadEditData() { function loadEditData() {
if (!props.editData) if (!props.editData) return
return
formData.fileName = props.editData.fileName || '' formData.fileName = props.editData.fileName || ''
formData.fileType = props.editData.fileType || '' formData.fileType = props.editData.fileType || ''
......
...@@ -16,7 +16,8 @@ ...@@ -16,7 +16,8 @@
}) })
function getList() { function getList() {
if (!paging.value) return if (!paging.value)
return
// API留空,使用模拟数据 - 根据图片内容调整 // API留空,使用模拟数据 - 根据图片内容调整
API.getResourceList(pageData.param).then((res) => { API.getResourceList(pageData.param).then((res) => {
paging.value.complete(res.records) paging.value.complete(res.records)
...@@ -50,8 +51,7 @@ ...@@ -50,8 +51,7 @@
// 格式化时间显示 // 格式化时间显示
function formatTime(time) { function formatTime(time) {
if (!time) if (!time) return ''
return ''
// 如果是完整的时间字符串,可以格式化为图片中的样式 // 如果是完整的时间字符串,可以格式化为图片中的样式
return time.includes(' ') ? time : `${time} 14:00` return time.includes(' ') ? time : `${time} 14:00`
} }
...@@ -75,8 +75,7 @@ return '' ...@@ -75,8 +75,7 @@ return ''
// 格式化文件大小 // 格式化文件大小
function formatFileSize(bytes) { function formatFileSize(bytes) {
if (!bytes) if (!bytes) return '125kb'
return '125kb'
const k = 1024 const k = 1024
const sizes = ['B', 'KB', 'MB', 'GB'] const sizes = ['B', 'KB', 'MB', 'GB']
const i = Math.floor(Math.log(bytes) / Math.log(k)) const i = Math.floor(Math.log(bytes) / Math.log(k))
......
<template>
<view class="webview-container">
<web-view :src="url"></web-view>
</view>
</template>
<script> <script>
export default { export default {
data() { data() {
return { return {
url: '' url: '',
} }
}, },
onLoad(options) { onLoad(options) {
...@@ -17,10 +11,16 @@ export default { ...@@ -17,10 +11,16 @@ export default {
} else { } else {
uni.showToast({ uni.showToast({
title: '网址不存在', title: '网址不存在',
icon: 'none' icon: 'none',
}) })
uni.navigateBack() uni.navigateBack()
} }
},
} }
}
</script> </script>
<template>
<view class="webview-container">
<web-view :src="url" />
</view>
</template>
...@@ -239,7 +239,8 @@ ...@@ -239,7 +239,8 @@
function onAddClick(feature: any) { function onAddClick(feature: any) {
console.log('点击功能模块:', feature) console.log('点击功能模块:', feature)
if (feature.id === 2) showAddDialog() if (feature.id === 2)
showAddDialog()
} }
// 常用资源点击事件 // 常用资源点击事件
function onResourceClick(resource: any) { function onResourceClick(resource: any) {
......
...@@ -103,7 +103,7 @@ ...@@ -103,7 +103,7 @@
} }
const policyInfoTitle = computed(() => { const policyInfoTitle = computed(() => {
return (pageData.buttons.filter((btn) => btn.active)?.[0]?.name || '惠农贷款') + '政策' return `${pageData.buttons.filter((btn) => btn.active)?.[0]?.name || '惠农贷款'}政策`
}) })
</script> </script>
......
<!-- src/pages/zhunongjinrong/zhunongjinrong.vue --> <!-- src/pages/zhunongjinrong/zhunongjinrong.vue -->
<script setup lang="ts"> <script setup lang="ts">
import { reactive, ref } from 'vue' import { reactive, ref } from 'vue'
import successfulDialog from '@/components/ConfirmDialog/successfulDialog.vue'; import successfulDialog from '@/components/ConfirmDialog/successfulDialog.vue'
import { getCurrentDateTime } from '@/utils/date' import { getCurrentDateTime } from '@/utils/date'
import * as HomeAPI from '@/api/model/home' import * as HomeAPI from '@/api/model/home'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
onShow(() => { onShow(() => {
const { id, realname, phone } = userStore.getUserInfo; const { id, realname, phone } = userStore.getUserInfo
consultRecord.id = id; consultRecord.id = id
consultRecord.mobile = phone; consultRecord.mobile = phone
consultRecord.feedbackRemark = realname; consultRecord.feedbackRemark = realname
}) })
// 定义银行类型 // 定义银行类型
type BankKey = 'nongye' | 'youzheng' | 'nongshang' type BankKey = 'nongye' | 'youzheng' | 'nongshang'
...@@ -167,33 +168,33 @@ ...@@ -167,33 +168,33 @@
currentBank.value = bank currentBank.value = bank
} }
const userStore = useUserStore(); const userStore = useUserStore()
const consultRecord = reactive({ const consultRecord = reactive({
id: "", id: '',
mobile: '',// 咨询人号码 mobile: '', // 咨询人号码
consultTime:"" ,// 咨询时间 consultTime: '', // 咨询时间
bizType:4, // 业务类型(1代理记账,2农资,3农机,4金融) bizType: 4, // 业务类型(1代理记账,2农资,3农机,4金融)
enterpriseId:1324324324, // 意向企业 enterpriseId: 1324324324, // 意向企业
feedbackRemark:"" // 反馈备注 feedbackRemark: '', // 反馈备注
}) })
const pageData = reactive({ const pageData = reactive({
showLogoutDialog: false, showLogoutDialog: false,
allpyMessageTitle:"", allpyMessageTitle: '',
applyMessageText:"", applyMessageText: '',
}) })
// 立即申请 // 立即申请
function onApplyClick() { function onApplyClick() {
consultRecord.consultTime = getCurrentDateTime(); consultRecord.consultTime = getCurrentDateTime()
HomeAPI.postConsultRecordAdd(consultRecord).then((res) => { HomeAPI.postConsultRecordAdd(consultRecord).then((res) => {
pageData.allpyMessageTitle = "申请成功"; pageData.allpyMessageTitle = '申请成功'
pageData.applyMessageText = "平台已收到申请,将尽快与您取得联系!"; pageData.applyMessageText = '平台已收到申请,将尽快与您取得联系!'
pageData.showLogoutDialog = true; pageData.showLogoutDialog = true
}) })
} }
// 提交申请 // 提交申请
function handleConfirmLogout(){ function handleConfirmLogout() {
pageData.showLogoutDialog = false; pageData.showLogoutDialog = false
} }
</script> </script>
...@@ -287,7 +288,7 @@ ...@@ -287,7 +288,7 @@
v-if="bankInfo[currentBank].processType === 'simple'" v-if="bankInfo[currentBank].processType === 'simple'"
class="codefun-flex-col codefun-justify-start codefun-items-start codefun-self-stretch text-wrapper" class="codefun-flex-col codefun-justify-start codefun-items-start codefun-self-stretch text-wrapper"
> >
<text class=" font_6 text_13 fontsize_28">线下咨询,已实际办理流程为准。</text> <text class="font_6 text_13 fontsize_28">线下咨询,已实际办理流程为准。</text>
</view> </view>
<view v-else class="codefun-flex-col codefun-self-stretch section_8"> <view v-else class="codefun-flex-col codefun-self-stretch section_8">
<view <view
...@@ -302,7 +303,7 @@ ...@@ -302,7 +303,7 @@
> >
<text class="font_8">{{ step.number }}</text> <text class="font_8">{{ step.number }}</text>
</view> </view>
<text class="font_9 text_15 ml-11 ">{{ step.title }}</text> <text class="font_9 text_15 ml-11">{{ step.title }}</text>
</view> </view>
<view v-if="step.desc" class="codefun-flex-row group_5"> <view v-if="step.desc" class="codefun-flex-row group_5">
<view class="codefun-self-center section_9" /> <view class="codefun-self-center section_9" />
......
...@@ -37,17 +37,17 @@ export function formatDate(date: Date | number | string): string { ...@@ -37,17 +37,17 @@ export function formatDate(date: Date | number | string): string {
*/ */
export function getCalculateAge(birthDate: Date | string): number { export function getCalculateAge(birthDate: Date | string): number {
// 解析出生日期字符串为Date对象 // 解析出生日期字符串为Date对象
const birthDateObj = new Date(birthDate); const birthDateObj = new Date(birthDate)
// 获取当前日期 // 获取当前日期
const currentDate = new Date(); const currentDate = new Date()
// 计算两个日期之间的年份差异 // 计算两个日期之间的年份差异
let age = currentDate.getFullYear() - birthDateObj.getFullYear(); let age = currentDate.getFullYear() - birthDateObj.getFullYear()
// 检查是否还没到生日,如果是,则年龄减1 // 检查是否还没到生日,如果是,则年龄减1
const m = currentDate.getMonth() - birthDateObj.getMonth(); const m = currentDate.getMonth() - birthDateObj.getMonth()
if (m < 0 || (m === 0 && currentDate.getDate() < birthDateObj.getDate())) { if (m < 0 || (m === 0 && currentDate.getDate() < birthDateObj.getDate())) {
age--; age--
} }
return age; return age
} }
/** /**
...@@ -62,11 +62,11 @@ export function getCurrentDateTime(): string { ...@@ -62,11 +62,11 @@ export function getCurrentDateTime(): string {
const month = String(now.getMonth() + 1).padStart(2, '0') const month = String(now.getMonth() + 1).padStart(2, '0')
// 获取日期,确保两位数格式 // 获取日期,确保两位数格式
const day = String(now.getDate()).padStart(2, '0'); const day = String(now.getDate()).padStart(2, '0')
const hour = String(now.getHours()).padStart(2, '0'); const hour = String(now.getHours()).padStart(2, '0')
const minute = String(now.getMinutes()).padStart(2, '0'); const minute = String(now.getMinutes()).padStart(2, '0')
const second = String(now.getSeconds()).padStart(2, '0'); const second = String(now.getSeconds()).padStart(2, '0')
// 返回格式化后的日期字符串 // 返回格式化后的日期字符串
return `${year}-${month}-${day} ${hour}:${minute}:${second}` return `${year}-${month}-${day} ${hour}:${minute}:${second}`
......
import { cascaderHn } from '/@/api/model/dict' import { cascaderHn } from '/@/api/model/dict'
const storageKey = 'app_dict_data_area_cascaderHn'; const storageKey = 'app_dict_data_area_cascaderHn'
let areaOptions = []; let areaOptions = []
export const getDictData = async () => { export async function getDictData() {
// 先从本地加载数据 // 先从本地加载数据
let dictData = getLocalDict(); let dictData = getLocalDict()
if (!dictData) { if (!dictData) {
// 如果本地没有数据,则从接口获取 // 如果本地没有数据,则从接口获取
const res = await cascaderHn(); const res = await cascaderHn()
const data = JSON.stringify(res[0].children).replace(/label/g, 'text'); const data = JSON.stringify(res[0].children).replace(/label/g, 'text')
uni.setStorageSync(storageKey, data); uni.setStorageSync(storageKey, data)
dictData = JSON.parse(data); dictData = JSON.parse(data)
} }
areaOptions = dictData; areaOptions = dictData
return dictData; return dictData
} }
/** /**
* 获取本地数据 * 获取本地数据
*/ */
export const getLocalDict = () => { export function getLocalDict() {
const data = uni.getStorageSync(storageKey); const data = uni.getStorageSync(storageKey)
if (data) { if (data) {
return data ? JSON.parse(data) : null; return data ? JSON.parse(data) : null
} }
return null; return null
} }
/** /**
* 刷新数据 * 刷新数据
*/ */
export const refreshDictData = () => { export function refreshDictData() {
// 删除本地数据 // 删除本地数据
uni.removeStorageSync(storageKey); uni.removeStorageSync(storageKey)
// 重新获取数据 // 重新获取数据
getDictData(); getDictData()
} }
export const getText = (scope: string, spliced: string) => { export function getText(scope: string, spliced: string) {
if (!scope || !areaOptions || areaOptions.length === 0) { if (!scope || !areaOptions || areaOptions.length === 0) {
return '' return ''
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论