提交 0fb18627 作者: 廖在望

feat: 功能修改

上级 083562c2
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -3,7 +3,7 @@ import { otherHttp } from '/@/utils/http/axios' ...@@ -3,7 +3,7 @@ import { otherHttp } from '/@/utils/http/axios'
enum Api { enum Api {
cascaderHn = '/region/cascader/hn', // 获取湖南省内 市/区县/乡镇级联数据 cascaderHn = '/region/cascader/hn', // 获取湖南省内 市/区县/乡镇级联数据
queryByType = '/banner/queryByType', // 获取开屏页背景图片 queryByType = '/banner/queryByType', // 获取开屏页背景图片
} }
/** /**
...@@ -23,8 +23,8 @@ export function getQueryByType(params = {}) { ...@@ -23,8 +23,8 @@ export function getQueryByType(params = {}) {
return otherHttp.get({ return otherHttp.get({
url: Api.queryByType, url: Api.queryByType,
params, params,
headers: { headers: {
'Content-Type': 'application/x-www-form-urlencoded', 'Content-Type': 'application/x-www-form-urlencoded',
} },
}) })
} }
\ No newline at end of file
...@@ -7,10 +7,9 @@ enum Api { ...@@ -7,10 +7,9 @@ enum Api {
serviceStatsList = '/online/cgform/api/getData/491863dde351404da63a1a6e8c699c4c', // 服务展示窗 serviceStatsList = '/online/cgform/api/getData/491863dde351404da63a1a6e8c699c4c', // 服务展示窗
agricultureClassList = '/online/cgform/api/getData/311c300e05694ba69a063d04c8572e9e', // 农技课堂 agricultureClassList = '/online/cgform/api/getData/311c300e05694ba69a063d04c8572e9e', // 农技课堂
warning = '/warningInfo/list', warning = '/warningInfo/list',
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',
} },
}) })
} }
...@@ -7,14 +7,14 @@ enum Api { ...@@ -7,14 +7,14 @@ enum Api {
employmentDetails = '/employment/queryById', // 查看用工详情 employmentDetails = '/employment/queryById', // 查看用工详情
employmentEdit = '/employment/app/edit', // 编辑用工 employmentEdit = '/employment/app/edit', // 编辑用工
employmentRegister = '/employment/app/register', // 报名用工 employmentRegister = '/employment/app/register', // 报名用工
queryConditions = '/sys/region/queryConditions', // 组合条件查询市——村 queryConditions = '/sys/region/queryConditions', // 组合条件查询市——村
gitListByCodeDict = '/sys/dictItem/listByCode', // 查询字典 gitListByCodeDict = '/sys/dictItem/listByCode', // 查询字典
queryByCategoryAndCode = '/sys/labelCategory/queryByCategoryAndCode', // 查询字典 queryByCategoryAndCode = '/sys/labelCategory/queryByCategoryAndCode', // 查询字典
postLaborAdd = '/server/labor/add', // 新增 postLaborAdd = '/server/labor/add', // 新增
getLaborAppList = '/server/labor/appList', // APP用工列表查询 getLaborAppList = '/server/labor/appList', // APP用工列表查询
getLaborAppDetail = '/server/labor/appDetail', // APP用工详情查询 getLaborAppDetail = '/server/labor/appDetail', // APP用工详情查询
getLaborAppDel = '/server/labor/delete', // APP用工通过id删除 getLaborAppDel = '/server/labor/delete', // APP用工通过id删除
} }
/** /**
* 删除设备 * 删除设备
...@@ -24,10 +24,10 @@ enum Api { ...@@ -24,10 +24,10 @@ enum Api {
export function getLaborAppDel(params = {}) { export function getLaborAppDel(params = {}) {
return otherHttp.delete({ return otherHttp.delete({
url: Api.getLaborAppDel, url: Api.getLaborAppDel,
params, params,
headers: { headers: {
'Content-Type': 'application/x-www-form-urlencoded', 'Content-Type': 'application/x-www-form-urlencoded',
} },
}) })
} }
...@@ -78,9 +78,9 @@ export function queryByCategoryAndCode(params = {}) { ...@@ -78,9 +78,9 @@ export function queryByCategoryAndCode(params = {}) {
return otherHttp.get({ return otherHttp.get({
url: Api.queryByCategoryAndCode, url: Api.queryByCategoryAndCode,
params, params,
headers: { headers: {
'Content-Type': 'application/x-www-form-urlencoded', 'Content-Type': 'application/x-www-form-urlencoded',
}, },
}) })
} }
...@@ -92,9 +92,9 @@ export function gitListByCodeDict(params = {}) { ...@@ -92,9 +92,9 @@ export function gitListByCodeDict(params = {}) {
return otherHttp.get({ return otherHttp.get({
url: Api.gitListByCodeDict, url: Api.gitListByCodeDict,
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',
} },
}) })
} }
...@@ -161,9 +161,9 @@ export function farmsAdd(params = {}) { ...@@ -161,9 +161,9 @@ export function farmsAdd(params = {}) {
}) })
} }
/** /**
* @param params * @param params
* @description: 编辑农场 * @description: 编辑农场
* @returns * @returns
*/ */
export function farmsEdit(params = {}) { export function farmsEdit(params = {}) {
return otherHttp.post({ return otherHttp.post({
......
...@@ -8,10 +8,9 @@ enum Api { ...@@ -8,10 +8,9 @@ enum Api {
farmMachineAddFarm = '/farmMachine/machineWork/app/addFarm', // 发布农活服务 farmMachineAddFarm = '/farmMachine/machineWork/app/addFarm', // 发布农活服务
farmMachineEdit = '/farmMachine/machineWork/edit', // 编辑农机服务 farmMachineEdit = '/farmMachine/machineWork/edit', // 编辑农机服务
farmMachineRegister = '/farmMachine/machineWork/app/register', // 参与服务 farmMachineRegister = '/farmMachine/machineWork/app/register', // 参与服务
postMachineryAdd = '/server/machinery/add', // 农机商品管理-添加 postMachineryAdd = '/server/machinery/add', // 农机商品管理-添加
postMachineryQueryById = '/server/machinery/listByEnterpriseId', // 按企业ID查询未删除农机 postMachineryQueryById = '/server/machinery/listByEnterpriseId', // 按企业ID查询未删除农机
} }
/** /**
* @param params 请求参数 * @param params 请求参数
...@@ -107,4 +106,4 @@ export function farmMachineRegister(params = {}) { ...@@ -107,4 +106,4 @@ export function farmMachineRegister(params = {}) {
url: Api.farmMachineRegister, url: Api.farmMachineRegister,
params, params,
}) })
} }
\ No newline at end of file
...@@ -2,11 +2,11 @@ import { otherHttp } from '/@/utils/http/axios' ...@@ -2,11 +2,11 @@ import { otherHttp } from '/@/utils/http/axios'
enum Api { 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查询
} }
/** /**
* @param params 请求参数 * @param params 请求参数
...@@ -81,4 +81,4 @@ export function getEnterpriseList(params = {}) { ...@@ -81,4 +81,4 @@ export function getEnterpriseList(params = {}) {
'Content-Type': 'application/x-www-form-urlencoded', 'Content-Type': 'application/x-www-form-urlencoded',
}, },
}) })
} }
\ No newline at end of file
...@@ -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, {
data: params, url: Api.getUserInfo,
}, { 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>
...@@ -5,13 +39,13 @@ ...@@ -5,13 +39,13 @@
<view class="close-btn" @click="handleCancel"> <view class="close-btn" @click="handleCancel">
<text class="close-icon"></text> <text class="close-icon"></text>
</view> </view>
<!-- 标题 --> <!-- 标题 -->
<view class="dialog-title">{{ title }}</view> <view class="dialog-title">{{ title }}</view>
<!-- 内容 --> <!-- 内容 -->
<view class="dialog-content">{{ content }}</view> <view class="dialog-content">{{ content }}</view>
<!-- 按钮组 --> <!-- 按钮组 -->
<view class="dialog-buttons"> <view class="dialog-buttons">
<view class="cancel-btn" @click="handleCancel"> <view class="cancel-btn" @click="handleCancel">
...@@ -25,141 +59,107 @@ ...@@ -25,141 +59,107 @@
</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;
right: 0; right: 0;
bottom: 0; bottom: 0;
background-color: rgba(0, 0, 0, 0.5); background-color: rgba(0, 0, 0, 0.5);
display: flex; display: flex;
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;
width: 48rpx; width: 48rpx;
height: 48rpx; height: 48rpx;
display: flex; display: flex;
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;
display: flex; display: flex;
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>
<view class="confirm-dialog-content"> <view class="confirm-dialog-content">
<image class="apply_success_icon" src="/static/images/comm/apply_success_icon.png" /> <image class="apply_success_icon" src="/static/images/comm/apply_success_icon.png" />
</view> </view>
<!-- 标题 --> <!-- 标题 -->
<view class="dialog-title">{{ title }}</view> <view class="dialog-title">{{ title }}</view>
<!-- 内容 --> <!-- 内容 -->
<view class="dialog-content">{{ content }}</view> <view class="dialog-content">{{ content }}</view>
<!-- 按钮组 --> <!-- 按钮组 -->
<view class="dialog-buttons"> <view class="dialog-buttons">
<!-- <view class="cancel-btn" @click="handleCancel"> <!-- <view class="cancel-btn" @click="handleCancel">
...@@ -24,159 +57,126 @@ ...@@ -24,159 +57,126 @@
</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;
right: 0; right: 0;
bottom: 0; bottom: 0;
background-color: rgba(0, 0, 0, 0.5); background-color: rgba(0, 0, 0, 0.5);
display: flex; display: flex;
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;
opacity: 1; opacity: 1;
background: linear-gradient(0deg, rgba(93, 182, 111, 0) 0%, rgba(93, 182, 111, 0.25) 100%); background: linear-gradient(0deg, rgba(93, 182, 111, 0) 0%, rgba(93, 182, 111, 0.25) 100%);
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;
width: 48rpx; width: 48rpx;
height: 48rpx; height: 48rpx;
display: flex; display: flex;
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;
display: flex; display: flex;
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>
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
// 将函数转换为字符串,在视图层重新构建 // 将函数转换为字符串,在视图层重新构建
option.tooltip.formatter = option.tooltip.formatter.toString() option.tooltip.formatter = option.tooltip.formatter.toString()
} }
this.option = { this.option = {
id: this.id, id: this.id,
...option, ...option,
......
<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) =>
...@@ -194,14 +200,14 @@ export function flyTo( ...@@ -194,14 +200,14 @@ export function flyTo(
zoom, zoom,
essential: true, essential: true,
} }
// 如果提供了时长,使用 duration 参数 // 如果提供了时长,使用 duration 参数
if (duration !== undefined) { if (duration !== undefined) {
flyOptions.duration = duration * 1000 // 转换为毫秒 flyOptions.duration = duration * 1000 // 转换为毫秒
} else { } else {
flyOptions.speed = 0.2 flyOptions.speed = 0.2
} }
map.flyTo(flyOptions) map.flyTo(flyOptions)
} }
......
...@@ -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,
}, },
...@@ -405,11 +405,11 @@ export interface MapControlOptions { ...@@ -405,11 +405,11 @@ export interface MapControlOptions {
} }
// 图层控制 // 图层控制
layer?: layer?:
| boolean | boolean
| { | {
tk: string tk: string
layers: LayerOption[] layers: LayerOption[]
} }
// 重置控件 // 重置控件
reset?: boolean | mapboxgl.FlyToOptions reset?: boolean | mapboxgl.FlyToOptions
// 全屏控件 // 全屏控件
...@@ -554,17 +554,17 @@ export function toPointGeoJSON( ...@@ -554,17 +554,17 @@ export function toPointGeoJSON(
features: !data features: !data
? [] ? []
: data.map((item) => { : data.map((item) => {
return { return {
type: 'Feature', type: 'Feature',
properties: { properties: {
...item, ...item,
}, },
geometry: { geometry: {
type: 'Point', type: 'Point',
coordinates: [item.lon, item.lat], coordinates: [item.lon, item.lat],
}, },
} }
}), }),
} }
} }
...@@ -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,8 +993,9 @@ export const HandlerUtil = { ...@@ -986,8 +993,9 @@ export const HandlerUtil = {
popup: HandlerUtil.createDefaultPopupHtml( popup: HandlerUtil.createDefaultPopupHtml(
station, station,
{ {
'{key}': `${(additional?.valueName ? station[additional.valueName] : station.value) || '-' '{key}': `${
}{suffix}`, (additional?.valueName ? station[additional.valueName] : station.value) || '-'
}{suffix}`,
...map, ...map,
}, },
isStation, isStation,
...@@ -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 consultRecord = reactive({ const userStore = useUserStore()
id: "", const consultRecord = reactive({
mobile: '',// 咨询人号码 id: '',
consultTime:"" ,// 咨询时间 mobile: '', // 咨询人号码
bizType:5, // 业务类型(1代理记账,2农资,3农机,4金融) consultTime: '', // 咨询时间
enterpriseId:"2004840258270433254", // 意向企业 bizType: 5, // 业务类型(1代理记账,2农资,3农机,4金融)
feedbackRemark:"" // 反馈备注 enterpriseId: '2004840258270433254', // 意向企业
}) feedbackRemark: '', // 反馈备注
const pageData = reactive({ })
showLogoutDialog: false, const pageData = reactive({
allpyMessageTitle:"", showLogoutDialog: false,
applyMessageText:"", allpyMessageTitle: '',
}) applyMessageText: '',
onShow(() => { })
const { id, realname, phone } = userStore.getUserInfo; onShow(() => {
consultRecord.id = id; const { id, realname, phone } = userStore.getUserInfo
consultRecord.mobile = phone; consultRecord.id = id
consultRecord.feedbackRemark = realname; consultRecord.mobile = phone
}) 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>
...@@ -105,13 +106,13 @@ ...@@ -105,13 +106,13 @@
</view> </view>
</view> </view>
</view> </view>
<successfulDialog <successfulDialog
v-model:show="pageData.showLogoutDialog" v-model:show="pageData.showLogoutDialog"
:title="pageData.allpyMessageTitle" :title="pageData.allpyMessageTitle"
:content="pageData.applyMessageText" :content="pageData.applyMessageText"
confirmText="我知道了" confirmText="我知道了"
@confirm="pageData.showLogoutDialog = false" @confirm="pageData.showLogoutDialog = false"
/> />
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
......
...@@ -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()
} }
// 新需求提醒点击事件 // 新需求提醒点击事件
...@@ -234,7 +238,7 @@ ...@@ -234,7 +238,7 @@
// 发布需求 // 发布需求
function handlePublish() { function handlePublish() {
if (pageData.currentTransactionTab === 1) { if (pageData.currentTransactionTab === 1) {
Navigate.to('/pages/chanxiao/supplyXuQiu') Navigate.to('/pages/chanxiao/supplyXuQiu')
return return
} }
if (pageData.currentTransactionTab === 2) { if (pageData.currentTransactionTab === 2) {
...@@ -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 consultRecord = reactive({ const userStore = useUserStore()
id: "", const consultRecord = reactive({
mobile: '',// 咨询人号码 id: '',
consultTime:"" ,// 咨询时间 mobile: '', // 咨询人号码
bizType:5, // 业务类型(1代理记账,2农资,3农机,4金融) consultTime: '', // 咨询时间
enterpriseId:"2004840258270488953", // 意向企业 bizType: 5, // 业务类型(1代理记账,2农资,3农机,4金融)
feedbackRemark:"" // 反馈备注 enterpriseId: '2004840258270488953', // 意向企业
}) feedbackRemark: '', // 反馈备注
const pageData = reactive({ })
showLogoutDialog: false, const pageData = reactive({
allpyMessageTitle:"", showLogoutDialog: false,
applyMessageText:"", allpyMessageTitle: '',
}) applyMessageText: '',
onShow(() => { })
const { id, realname, phone } = userStore.getUserInfo; onShow(() => {
consultRecord.id = id; const { id, realname, phone } = userStore.getUserInfo
consultRecord.mobile = phone; consultRecord.id = id
consultRecord.feedbackRemark = realname; consultRecord.mobile = phone
}) 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>
...@@ -123,13 +124,13 @@ ...@@ -123,13 +124,13 @@
</view> </view>
</view> </view>
</view> </view>
<successfulDialog <successfulDialog
v-model:show="pageData.showLogoutDialog" v-model:show="pageData.showLogoutDialog"
:title="pageData.allpyMessageTitle" :title="pageData.allpyMessageTitle"
:content="pageData.applyMessageText" :content="pageData.applyMessageText"
confirmText="我知道了" confirmText="我知道了"
@confirm="pageData.showLogoutDialog = false" @confirm="pageData.showLogoutDialog = false"
/> />
</view> </view>
</template> </template>
......
<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 consultRecord = reactive({ const userStore = useUserStore()
id: "", const consultRecord = reactive({
mobile: '',// 咨询人号码 id: '',
consultTime:"" ,// 咨询时间 mobile: '', // 咨询人号码
bizType:5, // 业务类型(1代理记账,2农资,3农机,4金融) consultTime: '', // 咨询时间
enterpriseId:"2004840258270471548", // 意向企业 bizType: 5, // 业务类型(1代理记账,2农资,3农机,4金融)
feedbackRemark:"" // 反馈备注 enterpriseId: '2004840258270471548', // 意向企业
}) feedbackRemark: '', // 反馈备注
const pageData = reactive({ })
showLogoutDialog: false, const pageData = reactive({
allpyMessageTitle:"", showLogoutDialog: false,
applyMessageText:"", allpyMessageTitle: '',
}) applyMessageText: '',
onShow(() => { })
const { id, realname, phone } = userStore.getUserInfo; onShow(() => {
consultRecord.id = id; const { id, realname, phone } = userStore.getUserInfo
consultRecord.mobile = phone; consultRecord.id = id
consultRecord.feedbackRemark = realname; consultRecord.mobile = phone
}) 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>
...@@ -147,13 +148,13 @@ ...@@ -147,13 +148,13 @@
</view> </view>
</view> </view>
</view> </view>
<successfulDialog <successfulDialog
v-model:show="pageData.showLogoutDialog" v-model:show="pageData.showLogoutDialog"
:title="pageData.allpyMessageTitle" :title="pageData.allpyMessageTitle"
:content="pageData.applyMessageText" :content="pageData.applyMessageText"
confirmText="我知道了" confirmText="我知道了"
@confirm="pageData.showLogoutDialog = false" @confirm="pageData.showLogoutDialog = false"
/> />
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
......
...@@ -132,7 +132,7 @@ ...@@ -132,7 +132,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')
...@@ -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>
...@@ -321,8 +323,8 @@ return ...@@ -321,8 +323,8 @@ return
</view> </view>
</view> </view>
<view class="mb-1 flex justify-start" style="font-size: 28rpx;"> <view class="mb-1 flex justify-start" style="font-size: 28rpx;">
<span style="color: red;margin-left: 10rpx;">*&nbsp;</span> <span style="color: red;margin-left: 10rpx;">*&nbsp;</span>
<span>图片</span> <span>图片</span>
</view> </view>
<uni-file-picker :readonly="!isSave" :value="form.imageObj" ref="uploadRef" limit="1" :auto-upload="false" @select="handleUpload" @delete="handleDelete" style="margin-left:35rpx"/> <uni-file-picker :readonly="!isSave" :value="form.imageObj" ref="uploadRef" limit="1" :auto-upload="false" @select="handleUpload" @delete="handleDelete" style="margin-left:35rpx"/>
</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 consultRecord = reactive({ const userStore = useUserStore()
id: "", const consultRecord = reactive({
mobile: '',// 咨询人号码 id: '',
consultTime:"" ,// 咨询时间 mobile: '', // 咨询人号码
bizType:5, // 业务类型(1代理记账,2农资,3农机,4金融) consultTime: '', // 咨询时间
enterpriseId:"2004840258270471581", // 意向企业 bizType: 5, // 业务类型(1代理记账,2农资,3农机,4金融)
feedbackRemark:"" // 反馈备注 enterpriseId: '2004840258270471581', // 意向企业
}) feedbackRemark: '', // 反馈备注
const pageData = reactive({ })
showLogoutDialog: false, const pageData = reactive({
allpyMessageTitle:"", showLogoutDialog: false,
applyMessageText:"", allpyMessageTitle: '',
}) applyMessageText: '',
onShow(() => { })
const { id, realname, phone } = userStore.getUserInfo; onShow(() => {
consultRecord.id = id; const { id, realname, phone } = userStore.getUserInfo
consultRecord.mobile = phone; consultRecord.id = id
consultRecord.feedbackRemark = realname; consultRecord.mobile = phone
}) 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>
...@@ -107,13 +108,13 @@ ...@@ -107,13 +108,13 @@
</view> </view>
</view> </view>
</view> </view>
<successfulDialog <successfulDialog
v-model:show="pageData.showLogoutDialog" v-model:show="pageData.showLogoutDialog"
:title="pageData.allpyMessageTitle" :title="pageData.allpyMessageTitle"
:content="pageData.applyMessageText" :content="pageData.applyMessageText"
confirmText="我知道了" confirmText="我知道了"
@confirm="pageData.showLogoutDialog = false" @confirm="pageData.showLogoutDialog = false"
/> />
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
......
...@@ -12,24 +12,24 @@ ...@@ -12,24 +12,24 @@
const userStore = useUserStore() const userStore = useUserStore()
const globSetting = useGlobSetting() const globSetting = useGlobSetting()
const isSave = ref(false) const isSave = ref(false)
const pageText = ref('采购') const pageText = ref('采购')
onLoad((option) => { onLoad((option) => {
// 获取数据详情 // 获取数据详情
if (option.id) { if (option.id) {
isSave.value = false isSave.value = false
getDetails(option.id) getDetails(option.id)
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: '采购需求', title: '采购需求',
}) })
pageText.value = '采购' pageText.value = '采购'
} else { } else {
isSave.value = true isSave.value = true
// 获取当前位置 // 获取当前位置
getCurrentAddressInfo() getCurrentAddressInfo()
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: '发布供应需求', title: '发布供应需求',
}) })
pageText.value = '供应' pageText.value = '供应'
} }
}) })
...@@ -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 consultRecord = reactive({ const userStore = useUserStore()
id: "", const consultRecord = reactive({
mobile: '',// 咨询人号码 id: '',
consultTime:"" ,// 咨询时间 mobile: '', // 咨询人号码
bizType:5, // 业务类型(1代理记账,2农资,3农机,4金融) consultTime: '', // 咨询时间
enterpriseId:"2004840258270437514", // 意向企业 bizType: 5, // 业务类型(1代理记账,2农资,3农机,4金融)
feedbackRemark:"" // 反馈备注 enterpriseId: '2004840258270437514', // 意向企业
}) feedbackRemark: '', // 反馈备注
const pageData = reactive({ })
showLogoutDialog: false, const pageData = reactive({
allpyMessageTitle:"", showLogoutDialog: false,
applyMessageText:"", allpyMessageTitle: '',
}) applyMessageText: '',
onShow(() => { })
const { id, realname, phone } = userStore.getUserInfo; onShow(() => {
consultRecord.id = id; const { id, realname, phone } = userStore.getUserInfo
consultRecord.mobile = phone; consultRecord.id = id
consultRecord.feedbackRemark = realname; consultRecord.mobile = phone
}) 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">
...@@ -116,13 +120,13 @@ ...@@ -116,13 +120,13 @@
</view> </view>
</view> </view>
</view> </view>
<successfulDialog <successfulDialog
v-model:show="pageData.showLogoutDialog" v-model:show="pageData.showLogoutDialog"
:title="pageData.allpyMessageTitle" :title="pageData.allpyMessageTitle"
:content="pageData.applyMessageText" :content="pageData.applyMessageText"
confirmText="我知道了" confirmText="我知道了"
@confirm="pageData.showLogoutDialog = false" @confirm="pageData.showLogoutDialog = false"
/> />
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
......
<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 consultRecord = reactive({ const userStore = useUserStore()
id: "", const consultRecord = reactive({
mobile: '',// 咨询人号码 id: '',
consultTime:"" ,// 咨询时间 mobile: '', // 咨询人号码
bizType:5, // 业务类型(1代理记账,2农资,3农机,4金融) consultTime: '', // 咨询时间
enterpriseId:"2004840258270474551", // 意向企业 bizType: 5, // 业务类型(1代理记账,2农资,3农机,4金融)
feedbackRemark:"" // 反馈备注 enterpriseId: '2004840258270474551', // 意向企业
}) feedbackRemark: '', // 反馈备注
const pageData = reactive({ })
showLogoutDialog: false, const pageData = reactive({
allpyMessageTitle:"", showLogoutDialog: false,
applyMessageText:"", allpyMessageTitle: '',
}) applyMessageText: '',
onShow(() => { })
const { id, realname, phone } = userStore.getUserInfo; onShow(() => {
consultRecord.id = id; const { id, realname, phone } = userStore.getUserInfo
consultRecord.mobile = phone; consultRecord.id = id
consultRecord.feedbackRemark = realname; consultRecord.mobile = phone
}) 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">
...@@ -113,13 +115,13 @@ ...@@ -113,13 +115,13 @@
</view> </view>
</view> </view>
</view> </view>
<successfulDialog <successfulDialog
v-model:show="pageData.showLogoutDialog" v-model:show="pageData.showLogoutDialog"
:title="pageData.allpyMessageTitle" :title="pageData.allpyMessageTitle"
:content="pageData.applyMessageText" :content="pageData.applyMessageText"
confirmText="我知道了" confirmText="我知道了"
@confirm="pageData.showLogoutDialog = false" @confirm="pageData.showLogoutDialog = false"
/> />
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
......
<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 consultRecord = reactive({ const userStore = useUserStore()
id: '', const consultRecord = reactive({
mobile: '',// 咨询人号码 id: '',
consultTime:"" ,// 咨询时间 mobile: '', // 咨询人号码
bizType:1, // 业务类型(1代理记账,2农资,3农机,4金融) consultTime: '', // 咨询时间
enterpriseId:1324324324, // 意向企业 bizType: 1, // 业务类型(1代理记账,2农资,3农机,4金融)
feedbackRemark:"" // 反馈备注 enterpriseId: 1324324324, // 意向企业
}) feedbackRemark: '', // 反馈备注
const pageData = reactive({ })
showLogoutDialog: false, const pageData = reactive({
}) showLogoutDialog: false,
onShow(() => { })
const { id, realname, phone } = userStore.getUserInfo; onShow(() => {
consultRecord.id = id; const { id, realname, phone } = userStore.getUserInfo
consultRecord.mobile = phone; consultRecord.id = id
consultRecord.feedbackRemark = realname; consultRecord.mobile = phone
}) 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>
...@@ -222,14 +223,14 @@ ...@@ -222,14 +223,14 @@
<text class="font_8 text_32">立即申请</text> <text class="font_8 text_32">立即申请</text>
</view> </view>
</view> </view>
<successfulDialog <successfulDialog
v-model:show="pageData.showLogoutDialog" v-model:show="pageData.showLogoutDialog"
title="申请成功" title="申请成功"
content="平台已收到申请,将尽快与您取得联系!" content="平台已收到申请,将尽快与您取得联系!"
confirmText="我知道了" confirmText="我知道了"
@confirm="handleConfirmLogout" @confirm="handleConfirmLogout"
/> />
</view> </view>
</template> </template>
......
...@@ -4,8 +4,9 @@ ...@@ -4,8 +4,9 @@
import * as NongzhiAPI from '@/api/model/nongzhi' import * as NongzhiAPI from '@/api/model/nongzhi'
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,25 +228,33 @@ ...@@ -227,25 +228,33 @@
// 查询服务列表 // 查询服务列表
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]
} }
}) })
} }
...@@ -302,11 +311,11 @@ ...@@ -302,11 +311,11 @@
// 跳转到灵活用工界面 // 跳转到灵活用工界面
Navigate.to('/pages/linghuoyonggong/linghuoyonggong') Navigate.to('/pages/linghuoyonggong/linghuoyonggong')
} }
// 查看更多农资交易 // 查看更多农资交易
function onViewMoreKexinnongzi() { function onViewMoreKexinnongzi() {
Navigate.to('/pages/kexinnongzi/kexinnongzi') Navigate.to('/pages/kexinnongzi/kexinnongzi')
} }
// 助农金融产品点击事件 // 助农金融产品点击事件
function onFinancialProductClick(product: any) { function onFinancialProductClick(product: any) {
...@@ -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,14 +497,12 @@ ...@@ -485,14 +497,12 @@
</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="text-28 font-extralight color-#5DB66F" @click="onViewMoreKexinnongzi">
<text class="font_5">农资交易</text> 更多<fui-icon name="right" size="30" color="#5DB66F" />
<text class="text-28 font-extralight color-#5DB66F" @click="onViewMoreKexinnongzi"> </text>
更多<fui-icon name="right" size="30" color="#5DB66F" /> </view>
</text>
</view>
<view class="codefun-flex-col codefun-self-stretch section_6 codefun-mt-16"> <view class="codefun-flex-col codefun-self-stretch section_6 codefun-mt-16">
<view class="grid"> <view class="grid">
<view <view
...@@ -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>
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
}) })
}) })
function getList() { function getList() {
if (!paging.value) if (!paging.value)
return return
NongchangAPI.getFarmbaseList(pageData.param) NongchangAPI.getFarmbaseList(pageData.param)
.then((res) => { .then((res) => {
......
<script setup lang="ts"> <script setup lang="ts">
import { onLoad, onPullDownRefresh, onShow } from '@dcloudio/uni-app' import { onPullDownRefresh, onShow } from '@dcloudio/uni-app'
import Navigate from '@/utils/page/navigate' import { reactive } from 'vue'
import { reactive, ref } from 'vue' import Navigate from '@/utils/page/navigate'
import * as NongzhiAPI from '@/api/model/nongzhi' import * as NongzhiAPI from '@/api/model/nongzhi'
onPullDownRefresh(() => {
resetData() onPullDownRefresh(() => {
getList(pageData.params) resetData()
}) getList(pageData.params)
})
onShow(() => {
resetData() onShow(() => {
getList(pageData.params) resetData()
}) getList(pageData.params)
})
onNavigationBarButtonTap(() => {
Navigate.to('/pages/kexinnongzi/shenqingruzhu') onNavigationBarButtonTap(() => {
}) Navigate.to('/pages/kexinnongzi/shenqingruzhu')
})
const pageData = reactive({ const pageData = reactive({
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,10 +50,9 @@ ...@@ -48,10 +50,9 @@
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}`)
} }
function resetData() { function resetData() {
...@@ -71,25 +72,24 @@ ...@@ -71,25 +72,24 @@
@scrolltolower="getList(pageData.params)" @scrolltolower="getList(pageData.params)"
:show-scrollbar="false" :show-scrollbar="false"
> >
<view class="top_img"> <view class="top_img">
<image class="agr_sup_img" src="/static/images/comm/agr_sup_img.png" /> <image class="agr_sup_img" src="/static/images/comm/agr_sup_img.png" />
</view> </view>
<view class="page_content"> <view class="page_content">
<view class="item_list" v-for="item in pageData.dataList" :key="item.id"> <view class="item_list" v-for="item in pageData.dataList" :key="item.id">
<view class="item_left"> <view class="item_left">
<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">
<text v-if="pageData.loading">加载中...</text> <text v-if="pageData.loading">加载中...</text>
...@@ -101,79 +101,78 @@ ...@@ -101,79 +101,78 @@
</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,
height: 280rpx; .agr_sup_img {
width: 690rpx; height: 280rpx;
} width: 690rpx;
.top_img{ }
margin-bottom: 24rpx; .top_img {
} margin-bottom: 24rpx;
.page_content{ }
border-radius: 16rpx; .page_content {
background: #FFFFFF; border-radius: 16rpx;
} background: #ffffff;
.ellipsis{ }
width: 200px; .ellipsis {
white-space: nowrap; width: 200px;
overflow: hidden; white-space: nowrap;
text-overflow: ellipsis; overflow: hidden;
} 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,
width: 192rpx; .enterprise_logo {
max-height: 160rpx; width: 192rpx;
} max-height: 160rpx;
.item_right{ }
width: 436rpx; .item_right {
.item_name{ width: 436rpx;
font-size: 32rpx; .item_name {
font-weight: 500; font-size: 32rpx;
color: #333333; font-weight: 500;
} color: #333333;
.item_description{ }
font-size: 24rpx; .item_description {
font-weight: 400; font-size: 24rpx;
color: #999999; font-weight: 400;
margin-top: 16rpx; color: #999999;
margin-bottom: 12rpx; margin-top: 16rpx;
} margin-bottom: 12rpx;
.item_details{ }
display: flex; .item_details {
justify-content: flex-end; display: flex;
} justify-content: flex-end;
.detail_btn{ }
border-radius: 100rpx; .detail_btn {
background: #5DB66F; border-radius: 100rpx;
display: flex; background: #5db66f;
justify-content: center; display: flex;
align-items: center; justify-content: center;
padding: 20rpx; align-items: center;
width: 136rpx; padding: 20rpx;
height: 48rpx; width: 136rpx;
font-size: 24rpx; height: 48rpx;
font-weight: 400; font-size: 24rpx;
color: #FFFFFF; font-weight: 400;
} color: #ffffff;
} }
} }
.item_list:last-child{ }
border-bottom: none; .item_list:last-child {
} border-bottom: none;
}
}
}
.loading-status { .loading-status {
text-align: center; text-align: center;
......
...@@ -15,24 +15,25 @@ ...@@ -15,24 +15,25 @@
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
} }
} }
if (model.params.pageNo === 1) { if (model.params.pageNo === 1) {
videoList.value = records videoList.value = records
} else { } else {
...@@ -118,9 +119,9 @@ ...@@ -118,9 +119,9 @@
v-for="(item, index) in videoList" v-for="(item, index) in videoList"
:key="index" :key="index"
:src="item.thumbnailPath" :src="item.thumbnailPath"
:imgWidth="item.videoWidth" :imgWidth="item.videoWidth"
:imgHeight="item.videoHeight" :imgHeight="item.videoHeight"
:videoDuration="item.totalTime" :videoDuration="item.totalTime"
@click="toPlay(item.id)" @click="toPlay(item.id)"
> >
<view class="flex flex-col justify-between pl-2 pr-2 pb-2"> <view class="flex flex-col justify-between pl-2 pr-2 pb-2">
......
...@@ -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 { 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){ // 返回字典中的中文值
let valText = ""; function returnDictZhVel(type: any, val: any) {
if(type == 'gender'){ let valText = ''
let arr = DictData.sexArr; if (type == 'gender') {
for(let i = 0; i < arr.length;i++){ const arr = DictData.sexArr
if(val == parseInt(arr[i].itemValue)){ for (let i = 0; i < arr.length; i++) {
valText = arr[i].itemText; if (val == Number.parseInt(arr[i].itemValue)) {
break; valText = arr[i].itemText
} break
} }
} }
if(type == 'edu'){ }
let arr = DictData.educationArr; if (type == 'edu') {
for(let i = 0; i < arr.length;i++){ const arr = DictData.educationArr
if(val == parseInt(arr[i].itemValue)){ for (let i = 0; i < arr.length; i++) {
valText = arr[i].itemText; if (val == Number.parseInt(arr[i].itemValue)) {
break; valText = arr[i].itemText
} break
} }
} }
return valText; }
} return valText
function makePhoneCall(){ }
uni.makePhoneCall({ function makePhoneCall() {
phoneNumber: pageData.contactMobile uni.makePhoneCall({
}); phoneNumber: pageData.contactMobile,
} })
}
</script> </script>
<template> <template>
<view class="details_page"> <view class="details_page">
<view class="details-content"> <view class="details-content">
<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> <view class="person-info"
</view> >{{ getCalculateAge(item.birthday) }}{{ returnDictZhVel('gender', item.gender) }}{{
</view> returnDictZhVel('edu', item.edu)
<view v-if="pageData.workersParam.length" class="make-phone-view"> }}</view
<fui-button text="电话沟通" bold radius="96rpx" @click="pageData.showConfirmDialog = true" height="80rpx"/> >
</view> <view class="person-info text_overflow_ellipsis">技能:{{ item.skill }}</view>
<!-- 确认对话框 --> </view>
<ConfirmDialog </view>
v-model:show="pageData.showConfirmDialog" </view>
title="温馨提示" <view v-if="pageData.workersParam.length" class="make-phone-view">
:content="`你将与${pageData.contactName}进行电话沟通,若继续,请点击确认按钮!`" <fui-button text="电话沟通" bold radius="96rpx" @click="pageData.showConfirmDialog = true" height="80rpx" />
cancelText="取消" </view>
confirmText="确认" <!-- 确认对话框 -->
@confirm="makePhoneCall" <ConfirmDialog
/> v-model:show="pageData.showConfirmDialog"
title="温馨提示"
:content="`你将与${pageData.contactName}进行电话沟通,若继续,请点击确认按钮!`"
cancelText="取消"
confirmText="确认"
@confirm="makePhoneCall"
/>
</view> </view>
<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>
<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;
margin-bottom: 24rpx; margin-bottom: 24rpx;
margin-top: 24rpx; margin-top: 24rpx;
} }
} }
} }
.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>
...@@ -56,16 +56,16 @@ ...@@ -56,16 +56,16 @@
}, },
], ],
rules: [ rules: [
{ {
name: 'username', name: 'username',
rule: ['required'], rule: ['required'],
msg: ['请输入账号'], msg: ['请输入账号'],
}, },
{ {
name: 'password', name: 'password',
rule: ['required'], rule: ['required'],
msg: ['请输入密码'], msg: ['请输入密码'],
}, },
/* { /* {
name: 'username', name: 'username',
rule: ['required'], rule: ['required'],
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
], ],
data: { data: {
username: '', username: '',
password:'', password: '',
// code: '', // code: '',
read: false, read: false,
deviceId: '', deviceId: '',
...@@ -103,7 +103,7 @@ ...@@ -103,7 +103,7 @@
if (isDevMode()) { if (isDevMode()) {
model.form.data.username = '' model.form.data.username = ''
// model.form.data.code = '' // model.form.data.code = ''
model.form.data.password = '' model.form.data.password = ''
model.form.data.read = false model.form.data.read = false
} }
...@@ -118,14 +118,14 @@ ...@@ -118,14 +118,14 @@
mobile: model.form.data.username, mobile: model.form.data.username,
captcha: model.form.data.code, captcha: model.form.data.code,
} */ } */
const params = { const params = {
username: model.form.data.username, username: model.form.data.username,
password: model.form.data.password, password: model.form.data.password,
} }
// 短信登录 // 短信登录
model.loading = true model.loading = true
// API.phoneLogin(params) // API.phoneLogin(params)
API.sysLogin(params) API.sysLogin(params)
.then(async (body) => { .then(async (body) => {
console.log('body', body) console.log('body', body)
if (body) { if (body) {
...@@ -236,48 +236,47 @@ ...@@ -236,48 +236,47 @@
<fui-form class="form" ref="form" top="0" :padding="['0rpx', '0rpx']" background="#e46962"> <fui-form class="form" ref="form" top="0" :padding="['0rpx', '0rpx']" background="#e46962">
<view class="login_content"> <view class="login_content">
<view class="login-input-area"> <view class="login-input-area">
<view class="user_phone"> <view class="user_phone">
<image class="user_phone_img" src="/static/images/register/user.png" /> <image class="user_phone_img" src="/static/images/register/user.png" />
<view class="user_text_view"><text class="view_text">账号</text></view> <view class="user_text_view"><text class="view_text">账号</text></view>
</view> </view>
<view class="input-bottom-border"> <view class="input-bottom-border">
<fui-input <fui-input
height="94rpx" height="94rpx"
:padding="['0rpx', '0rpx', '0rpx', '12rpx']" :padding="['0rpx', '0rpx', '0rpx', '12rpx']"
class="input" class="input"
autocomplete="off" autocomplete="off"
:required="false" :required="false"
clearable clearable
trim trim
placeholder="请输入账号" placeholder="请输入账号"
v-model="model.form.data.username" v-model="model.form.data.username"
name="mobile" name="mobile"
backgroundColor="transparent" backgroundColor="transparent"
borderColor="transparent" borderColor="transparent"
maxlength="11" maxlength="11"
/> />
</view> </view>
<view class="user_phone mt50"> <view class="user_phone mt50">
<image class="user_phone_img" src="/static/images/register/pwd.png" /> <image class="user_phone_img" src="/static/images/register/pwd.png" />
<view class="user_text_view"><text class="view_text">密码</text></view> <view class="user_text_view"><text class="view_text">密码</text></view>
</view> </view>
<view class="input-bottom-border"> <view class="input-bottom-border">
<fui-input <fui-input
height="94rpx" height="94rpx"
:padding="['0rpx', '0rpx', '0rpx', '12rpx']" :padding="['0rpx', '0rpx', '0rpx', '12rpx']"
class="input" class="input"
password password
clearable clearable
trim trim
placeholder="请输入密码" placeholder="请输入密码"
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">
<view class="user_phone"> <view class="user_phone">
<image class="user_phone_img" src="/static/images/register/user.png" /> <image class="user_phone_img" src="/static/images/register/user.png" />
......
<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 { 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]
} }
}) })
pageData.form.provinceText = res.provinceName + '/' + res.cityName + '/' + res.districtName // 回显省市区名称
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
}
// 编辑模式下,如果已有示例图片,需要设置到上传组件中 // 编辑模式下,如果已有示例图片,需要设置到上传组件中
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(() => {
uni.navigateBack() if (targetId) {
// 跳转到农场详情页,注意路径需要是绝对路径
uni.redirectTo({
url: `/pages/nongchang/detail/index?id=${targetId}`
})
} else {
// 如果没有ID,回退上一页
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">
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>
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -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>
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
import { useGlobSetting } from '/@/hooks/setting' import { useGlobSetting } from '/@/hooks/setting'
import * as nongjifuwu from '@/api/model/nongjifuwu' import * as nongjifuwu from '@/api/model/nongjifuwu'
import { getDictData, getText } from '@/utils/dict/area' import { getDictData, getText } from '@/utils/dict/area'
const userStore = useUserStore() const userStore = useUserStore()
const globSetting = useGlobSetting() const globSetting = useGlobSetting()
onLoad((option) => { onLoad((option) => {
...@@ -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>
<!-- <slot name="right" style="font-size:28rpx;"></slot> --> <view class="unit-slot">元/亩</view>
</fui-input> </template>
<!-- <slot name="right" style="font-size:28rpx;"></slot> -->
</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"
......
...@@ -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) {
if (options.url) { if (options.url) {
this.url = decodeURIComponent(options.url) this.url = decodeURIComponent(options.url)
} else { } else {
uni.showToast({ uni.showToast({
title: '网址不存在', title: '网址不存在',
icon: 'none' icon: 'none',
}) })
uni.navigateBack() uni.navigateBack()
}
},
} }
} </script>
}
</script> <template>
\ No newline at end of file <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(() => {
const { id, realname, phone } = userStore.getUserInfo; onShow(() => {
consultRecord.id = id; const { id, realname, phone } = userStore.getUserInfo
consultRecord.mobile = phone; consultRecord.id = id
consultRecord.feedbackRemark = realname; consultRecord.mobile = phone
}) 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" />
...@@ -359,13 +360,13 @@ ...@@ -359,13 +360,13 @@
<text class="font_2 text_20">立即申请</text> <text class="font_2 text_20">立即申请</text>
</view> </view>
</view> </view>
<successfulDialog <successfulDialog
v-model:show="pageData.showLogoutDialog" v-model:show="pageData.showLogoutDialog"
:title="pageData.allpyMessageTitle" :title="pageData.allpyMessageTitle"
:content="pageData.applyMessageText" :content="pageData.applyMessageText"
confirmText="我知道了" confirmText="我知道了"
@confirm="handleConfirmLogout" @confirm="handleConfirmLogout"
/> />
</view> </view>
</template> </template>
......
...@@ -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,12 +62,12 @@ export function getCurrentDateTime(): string { ...@@ -62,12 +62,12 @@ 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}`
} }
\ No newline at end of file
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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论