提交 bacbcda4 作者: 方治民

fix: 修复首页气象预警信息查询展示未实现问题、天气图标缺失阵雨、样式不对称、注册登录页等问题

上级 b6ddd368
# APP 名称 # APP 名称
VITE_GLOB_APP_NAME = 数农服 VITE_GLOB_APP_NAME = 数农服
# APP 描述 # APP 描述
VITE_GLOB_APP_DESCRIPTION = 湖南省农业服务平台 VITE_GLOB_APP_DESCRIPTION = 数字农服
# API 接口地址 # API 接口地址
# VITE_GLOB_API_URL=http://111.22.182.169:49600 VITE_GLOB_API_URL=http://111.22.182.169:49600
VITE_GLOB_API_URL=http://36.133.16.81:42111 # VITE_GLOB_API_URL=http://36.133.16.81:42111
# API 接口地址前缀 # API 接口地址前缀
# VITE_GLOB_API_URL_PREFIX=/jeecgboot VITE_GLOB_API_URL_PREFIX=/jeecgboot
VITE_GLOB_API_URL_PREFIX=/jeecg-boot # VITE_GLOB_API_URL_PREFIX=/jeecg-boot
...@@ -5,4 +5,5 @@ ...@@ -5,4 +5,5 @@
[ -n "$CI" ] && exit 0 [ -n "$CI" ] && exit 0
# Format and submit code according to lintstagedrc.js configuration # Format and submit code according to lintstagedrc.js configuration
npm run lint:lint-staged # npm run lint:lint-staged
exit 0
...@@ -16,7 +16,7 @@ enum Api { ...@@ -16,7 +16,7 @@ enum Api {
*/ */
export function delDevice(id) { export function delDevice(id) {
return otherHttp.post({ return otherHttp.post({
url: '/device/delete?id='+id, url: `/device/delete?id=${id}`,
}) })
} }
/** /**
...@@ -71,7 +71,7 @@ export function getFarmbaseInfoById(params: any = {}) { ...@@ -71,7 +71,7 @@ export function getFarmbaseInfoById(params: any = {}) {
*/ */
export function delFarmbase(id) { export function delFarmbase(id) {
return otherHttp.delete({ return otherHttp.delete({
url: '/farmbase/delete?id=' + id, url: `/farmbase/delete?id=${id}`,
}) })
} }
/** /**
......
...@@ -15,3 +15,10 @@ export function forecast(location: string) { ...@@ -15,3 +15,10 @@ export function forecast(location: string) {
url: `/v7/weather/7d?key=${API_KEY}&location=${location}`, url: `/v7/weather/7d?key=${API_KEY}&location=${location}`,
}) })
} }
// 获取气象预警信息
export function alarm(location: string) {
return weatherHttp.get({
url: `/weatheralert/v1/current/${location.replace(',', '/')}?key=${API_KEY}`,
})
}
declare module '@/uni_modules/uview-plus'; declare module '@/uni_modules/uview-plus'
<script setup lang="ts"> <script setup lang="ts">
import { reactive } from 'vue' import { reactive } from 'vue'
import { onPullDownRefresh, onLoad, onShow, onReachBottom } from '@dcloudio/uni-app' import { onPullDownRefresh, onReachBottom, onShow } from '@dcloudio/uni-app'
import PriceDialog from './components/price-dialog.vue'
import Navigate from '@/utils/page/navigate' import Navigate from '@/utils/page/navigate'
import * as ChanxiaoAPI from '@/api/model/chanxiao' import * as ChanxiaoAPI from '@/api/model/chanxiao'
import PriceDialog from './components/price-dialog.vue'
// 下拉刷新 // 下拉刷新
onPullDownRefresh(() => { onPullDownRefresh(() => {
pageData.search.pageNo = 1 pageData.search.pageNo = 1
...@@ -130,8 +129,10 @@ ...@@ -130,8 +129,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()
} }
// 采购/供应标签点击事件 // 采购/供应标签点击事件
...@@ -141,8 +142,10 @@ ...@@ -141,8 +142,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()
} }
// 新需求提醒点击事件 // 新需求提醒点击事件
...@@ -181,19 +184,20 @@ ...@@ -181,19 +184,20 @@
} }
if (pageData.currentTransactionTab === 2) { if (pageData.currentTransactionTab === 2) {
Navigate.to('/pages/chanxiao/supplyXuQiu') Navigate.to('/pages/chanxiao/supplyXuQiu')
return
} }
} }
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()
} }
...@@ -252,7 +256,7 @@ ...@@ -252,7 +256,7 @@
v-if="pageData.currentTransactionTab === 2 && pageData.supplyInfos.length === 0" v-if="pageData.currentTransactionTab === 2 && pageData.supplyInfos.length === 0"
style="height: 528rpx" style="height: 528rpx"
> >
<fui-empty src="/src/static/images/no-data.png" title="暂无数据"></fui-empty> <fui-empty src="/src/static/images/no-data.png" title="暂无数据" />
</view> </view>
<!-- 供应信息列表 --> <!-- 供应信息列表 -->
<template v-for="(info, index) in pageData.supplyInfos" :key="info.id"> <template v-for="(info, index) in pageData.supplyInfos" :key="info.id">
...@@ -315,7 +319,7 @@ ...@@ -315,7 +319,7 @@
v-if="pageData.currentTransactionTab === 1 && pageData.purchaseDemands.length === 0" v-if="pageData.currentTransactionTab === 1 && pageData.purchaseDemands.length === 0"
style="height: 528rpx" style="height: 528rpx"
> >
<fui-empty src="/src/static/images/no-data.png" title="暂无数据"></fui-empty> <fui-empty src="/src/static/images/no-data.png" title="暂无数据" />
</view> </view>
<view v-else> <view v-else>
<template v-for="(demand, index) in pageData.purchaseDemands" :key="demand.id"> <template v-for="(demand, index) in pageData.purchaseDemands" :key="demand.id">
...@@ -360,7 +364,7 @@ ...@@ -360,7 +364,7 @@
</text </text
> >
<text v-if="demand.priceStart || demand.priceEnd" class="font_5">{{ <text v-if="demand.priceStart || demand.priceEnd" class="font_5">{{
demand.priceStart + '-' + demand.priceEnd `${demand.priceStart}-${demand.priceEnd}`
}}</text> }}</text>
<text v-if="demand.unit" class="font_7" :class="`text_${index === 0 ? 16 : 22}`" <text v-if="demand.unit" class="font_7" :class="`text_${index === 0 ? 16 : 22}`"
>/{{ demand.unit }}</text >/{{ demand.unit }}</text
...@@ -397,17 +401,17 @@ ...@@ -397,17 +401,17 @@
</view> </view>
<fui-fab position="right" distance="10" bottom="240" width="96" @click="handlePublish"> <fui-fab position="right" distance="10" bottom="240" width="96" @click="handlePublish">
<view v-show="pageData.currentTransactionTab === 1" class="text-white text-center"> <view v-show="pageData.currentTransactionTab === 1" class="text-white text-center">
<view class="fab-icon"></view> <view class="fab-icon" />
<view style="font-size: 24rpx">发布</view> <view style="font-size: 24rpx">发布</view>
</view> </view>
<view v-show="pageData.currentTransactionTab === 2" class="text-white text-center"> <view v-show="pageData.currentTransactionTab === 2" class="text-white text-center">
<view class="fab-icon"></view> <view class="fab-icon" />
<view style="font-size: 24rpx">发布</view> <view style="font-size: 24rpx">发布</view>
</view> </view>
</fui-fab> </fui-fab>
<price-dialog ref="priceDialogRef"></price-dialog> <PriceDialog ref="priceDialogRef" />
<fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)"></fui-loading> <fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)" />
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
import { useGlobSetting } from '/@/hooks/setting' import { useGlobSetting } from '/@/hooks/setting'
import * as ChanxiaoAPI from '@/api/model/chanxiao' import * as ChanxiaoAPI from '@/api/model/chanxiao'
import * as UserInfoAPI from '@/api/model/userInfo' import * as UserInfoAPI from '@/api/model/userInfo'
import { areaTree, getTextByCode, getCodeByText } from '@/utils/areaData' import { areaTree, getCodeByText, getTextByCode } from '@/utils/areaData'
import { useDictStore } from '@/store/modules/dict' import { useDictStore } from '@/store/modules/dict'
const dictStore = useDictStore() const dictStore = useDictStore()
...@@ -110,7 +110,7 @@ ...@@ -110,7 +110,7 @@
const { show, options, form } = toRefs(pageData) const { show, options, form } = toRefs(pageData)
function initDict() { function initDict() {
pageData.options.classify = dictStore.getDictList['classify'].map((item) => { pageData.options.classify = dictStore.getDictList.classify.map((item) => {
return { return {
value: item.value, value: item.value,
text: item.text, text: item.text,
...@@ -120,7 +120,8 @@ ...@@ -120,7 +120,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({
...@@ -154,8 +155,8 @@ ...@@ -154,8 +155,8 @@
// 返回格式化的对象 // 返回格式化的对象
return { return {
name: fileName, name: fileName,
extname: extname, extname,
url: url, url,
} }
} }
...@@ -178,7 +179,7 @@ ...@@ -178,7 +179,7 @@
// 文件上传 // 文件上传
function handleUpload(file) { function handleUpload(file) {
uni.uploadFile({ uni.uploadFile({
url: globSetting.apiUrl + globSetting.urlPrefix + '/sys/common/upload', // 直接使用上传接口URL url: `${globSetting.apiUrl + globSetting.urlPrefix}/sys/common/upload`, // 直接使用上传接口URL
filePath: file.tempFiles[0].path, filePath: file.tempFiles[0].path,
name: 'file', name: 'file',
formData: { formData: {
...@@ -235,7 +236,7 @@ ...@@ -235,7 +236,7 @@
* 处理地区值 * 处理地区值
* @param formData 表单数据 * @param formData 表单数据
*/ */
const changeAddressValue = (formData) => { function changeAddressValue(formData) {
const addressValue = formData.address.split('/') const addressValue = formData.address.split('/')
if (addressValue.length === 3) { if (addressValue.length === 3) {
formData.province = getCodeByText(addressValue[0]) formData.province = getCodeByText(addressValue[0])
...@@ -257,14 +258,14 @@ ...@@ -257,14 +258,14 @@
v-model="form.title" v-model="form.title"
labelSize="28" labelSize="28"
label-width="180" label-width="180"
></fui-input> />
<fui-input <fui-input
label="说明" label="说明"
placeholder="请输入规格说明" placeholder="请输入规格说明"
v-model="form.inputTextArea" v-model="form.inputTextArea"
labelSize="28" labelSize="28"
label-width="180" label-width="180"
></fui-input> />
</view> </view>
<view class="mt20"> <view class="mt20">
<!-- 价格区间 --> <!-- 价格区间 -->
...@@ -298,7 +299,7 @@ ...@@ -298,7 +299,7 @@
v-model="form.count" v-model="form.count"
labelSize="28" labelSize="28"
label-width="180" label-width="180"
></fui-input> />
<fui-input <fui-input
required required
label="单位" label="单位"
...@@ -306,7 +307,7 @@ ...@@ -306,7 +307,7 @@
v-model="form.unit" v-model="form.unit"
labelSize="28" labelSize="28"
label-width="180" label-width="180"
></fui-input> />
</view> </view>
<view class="mt20"> <view class="mt20">
<view class="form-item required flex align-center" style="padding: 20rpx 10rpx"> <view class="form-item required flex align-center" style="padding: 20rpx 10rpx">
...@@ -350,19 +351,14 @@ ...@@ -350,19 +351,14 @@
:auto-upload="false" :auto-upload="false"
@select="handleUpload" @select="handleUpload"
@delete="handleDelete" @delete="handleDelete"
></uni-file-picker> />
</view> </view>
<view class="fui-btn__box" v-if="!form.id" style="margin-top: 30rpx"> <view class="fui-btn__box" v-if="!form.id" style="margin-top: 30rpx">
<fui-button text="发布需求" bold radius="96rpx" @click="submit"></fui-button> <fui-button text="发布需求" bold radius="96rpx" @click="submit" />
</view> </view>
</fui-form> </fui-form>
<fui-date-picker <fui-date-picker :show="show.time" type="3" @change="handleChangeTime" @cancel="show.time = false" />
:show="show.time"
type="3"
@change="handleChangeTime"
@cancel="show.time = false"
></fui-date-picker>
<fui-picker <fui-picker
:show="show.classify" :show="show.classify"
:layer="1" :layer="1"
...@@ -370,7 +366,7 @@ ...@@ -370,7 +366,7 @@
:options="options.classify" :options="options.classify"
@change="handleChangeClassify" @change="handleChangeClassify"
@cancel="show.classify = false" @cancel="show.classify = false"
></fui-picker> />
<fui-picker <fui-picker
:show="show.address" :show="show.address"
:options="options.address" :options="options.address"
...@@ -378,9 +374,9 @@ ...@@ -378,9 +374,9 @@
:layer="3" :layer="3"
@change="handleChangeAddress" @change="handleChangeAddress"
@cancel="show.address = false" @cancel="show.address = false"
></fui-picker> />
<fui-toast ref="toastRef"></fui-toast> <fui-toast ref="toastRef" />
</view> </view>
</view> </view>
<fui-date-picker <fui-date-picker
...@@ -389,7 +385,7 @@ ...@@ -389,7 +385,7 @@
@change="handleChangeTime" @change="handleChangeTime"
@cancel="show.time = false" @cancel="show.time = false"
minDate="2025-01-01" minDate="2025-01-01"
></fui-date-picker> />
<fui-picker <fui-picker
:show="show.classify" :show="show.classify"
:layer="1" :layer="1"
...@@ -397,7 +393,7 @@ ...@@ -397,7 +393,7 @@
:options="options.classify" :options="options.classify"
@change="handleChangeClassify" @change="handleChangeClassify"
@cancel="show.classify = false" @cancel="show.classify = false"
></fui-picker> />
<fui-picker <fui-picker
:show="show.address" :show="show.address"
:options="options.address" :options="options.address"
...@@ -405,9 +401,9 @@ ...@@ -405,9 +401,9 @@
:layer="3" :layer="3"
@change="handleChangeAddress" @change="handleChangeAddress"
@cancel="show.address = false" @cancel="show.address = false"
></fui-picker> />
<fui-toast ref="toastRef"></fui-toast> <fui-toast ref="toastRef" />
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
......
<script setup lang="ts"> <script setup lang="ts">
import { reactive } from 'vue' import { reactive } from 'vue'
import { onPullDownRefresh, onLoad } from '@dcloudio/uni-app' import { onLoad, onPullDownRefresh } from '@dcloudio/uni-app'
import * as NongzhiAPI from '@/api/model/nongzhi' import * as NongzhiAPI from '@/api/model/nongzhi'
import Navigate from '@/utils/page/navigate' import Navigate from '@/utils/page/navigate'
import { url } from 'inspector'
// 下拉刷新 // 下拉刷新
onPullDownRefresh(() => { onPullDownRefresh(() => {
...@@ -275,7 +274,7 @@ ...@@ -275,7 +274,7 @@
function onFarmMachineryServiceClick(service: any) { function onFarmMachineryServiceClick(service: any) {
console.log('点击农机服务:', service) console.log('点击农机服务:', service)
// 在这里添加具体的服务点击逻辑 // 在这里添加具体的服务点击逻辑
Navigate.to('/pages/nongjifuwu/nongjifuwu?type=' + service.id) Navigate.to(`/pages/nongjifuwu/nongjifuwu?type=${service.id}`)
} }
// 技能培训点击事件 // 技能培训点击事件
...@@ -474,7 +473,7 @@ ...@@ -474,7 +473,7 @@
> >
<view class="codefun-flex-row codefun-items-center codefun-self-stretch"> <view class="codefun-flex-row codefun-items-center codefun-self-stretch">
<image class="image_11" :src="service.image" /> <image class="image_11" :src="service.image" />
<text class="font_5" :class="`text_33 ml-7`">{{ service.title }}</text> <text class="font_5 text_33 ml-7">{{ service.title }}</text>
</view> </view>
<text <text
class="codefun-self-start font_10" class="codefun-self-start font_10"
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
import { reactive } from 'vue' import { reactive } from 'vue'
import * as LinghuoyonggongAPI from '@/api/model/linghuoyonggong' import * as LinghuoyonggongAPI from '@/api/model/linghuoyonggong'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
const { getUserInfo } = useUserStore() const { getUserInfo } = useUserStore()
const pageData = reactive({ const pageData = reactive({
...@@ -62,33 +63,30 @@ ...@@ -62,33 +63,30 @@
close, close,
}) })
</script> </script>
<template> <template>
<fui-dialog title="" :buttons="[]" :show="pageData.show" maskClosable> <fui-dialog title="" :buttons="[]" :show="pageData.show" maskClosable>
<view class="title flex justify-center"> <view class="title flex justify-center">
<view class="flex-1">报名</view> <view class="flex-1">报名</view>
<fui-icon class="close flex-basis" name="close" size="46" color="#999999" @click="close"></fui-icon> <fui-icon class="close flex-basis" name="close" size="46" color="#999999" @click="close" />
</view> </view>
<view class="text-left"> <view class="text-left">
<fui-form ref="formRef"> <fui-form ref="formRef">
<fui-input <fui-input marginTop="30" size="28" placeholder="请填写预留姓名" v-model="pageData.form.reservedname" />
marginTop="30"
size="28"
placeholder="请填写预留姓名"
v-model="pageData.form.reservedname"
></fui-input>
<fui-input <fui-input
marginTop="30" marginTop="30"
size="28" size="28"
placeholder="请填写预留手机" placeholder="请填写预留手机"
v-model="pageData.form.reservedmobile" v-model="pageData.form.reservedmobile"
></fui-input> />
<view style="margin-top: 30rpx"> <view style="margin-top: 30rpx">
<fui-button text="确定" bold radius="96rpx" @click="submit"></fui-button> <fui-button text="确定" bold radius="96rpx" @click="submit" />
</view> </view>
</fui-form> </fui-form>
</view> </view>
</fui-dialog> </fui-dialog>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
:deep(.fui-dialog__body) { :deep(.fui-dialog__body) {
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%);
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
import { useGlobSetting } from '/@/hooks/setting' import { useGlobSetting } from '/@/hooks/setting'
import * as LinghuoyonggongAPI from '@/api/model/linghuoyonggong' import * as LinghuoyonggongAPI from '@/api/model/linghuoyonggong'
import * as UserInfoAPI from '@/api/model/userInfo' import * as UserInfoAPI from '@/api/model/userInfo'
import { areaTree, getTextByCode, getCodeByText } from '@/utils/areaData' import { areaTree, getCodeByText, getTextByCode } from '@/utils/areaData'
import { useDictStore } from '@/store/modules/dict' import { useDictStore } from '@/store/modules/dict'
const dictStore = useDictStore() const dictStore = useDictStore()
...@@ -124,15 +124,15 @@ ...@@ -124,15 +124,15 @@
function initDict() { function initDict() {
pageData.options.area = areaTree pageData.options.area = areaTree
console.log(dictStore.getDictList['purchase_status']) console.log(dictStore.getDictList.purchase_status)
pageData.options.urgentdegree = dictStore.getDictList['employment_urgent'].map((item) => { pageData.options.urgentdegree = dictStore.getDictList.employment_urgent.map((item) => {
return { return {
value: item.value, value: item.value,
text: item.text, text: item.text,
} }
}) })
pageData.options.type = dictStore.getDictList['employment_type'].map((item) => { pageData.options.type = dictStore.getDictList.employment_type.map((item) => {
return { return {
value: item.value, value: item.value,
text: item.text, text: item.text,
...@@ -141,7 +141,8 @@ ...@@ -141,7 +141,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({
...@@ -152,8 +153,7 @@ ...@@ -152,8 +153,7 @@
pageData.form.city = res.city pageData.form.city = res.city
pageData.form.country = res.country pageData.form.country = res.country
pageData.form.areaText = `${res.province}/${res.city}/${res.country}` pageData.form.areaText = `${res.province}/${res.city}/${res.country}`
pageData.form.area = pageData.form.area = `${getCodeByText(res.province)},${getCodeByText(res.city)},${getCodeByText(res.country)}`
getCodeByText(res.province) + ',' + getCodeByText(res.city) + ',' + getCodeByText(res.country)
}) })
} }
...@@ -163,7 +163,7 @@ ...@@ -163,7 +163,7 @@
.then((res) => { .then((res) => {
console.log(res) console.log(res)
pageData.form = res pageData.form = res
let areaCopy = pageData.form.area.split(',') const areaCopy = pageData.form.area.split(',')
pageData.form.areaText = `${getTextByCode(areaCopy[0])}/${getTextByCode(areaCopy[1])}/${getTextByCode(areaCopy[2])}` pageData.form.areaText = `${getTextByCode(areaCopy[0])}/${getTextByCode(areaCopy[1])}/${getTextByCode(areaCopy[2])}`
pageData.form.urgentdegreeText = pageData.options.urgentdegree.find( pageData.form.urgentdegreeText = pageData.options.urgentdegree.find(
(item) => item.value == pageData.form.urgentdegree, (item) => item.value == pageData.form.urgentdegree,
...@@ -188,8 +188,8 @@ ...@@ -188,8 +188,8 @@
// 返回格式化的对象 // 返回格式化的对象
return { return {
name: fileName, name: fileName,
extname: extname, extname,
url: url, url,
} }
} }
...@@ -221,7 +221,7 @@ ...@@ -221,7 +221,7 @@
// 文件上传 // 文件上传
function handleUpload(file) { function handleUpload(file) {
uni.uploadFile({ uni.uploadFile({
url: globSetting.apiUrl + globSetting.urlPrefix + '/sys/common/upload', // 直接使用上传接口URL url: `${globSetting.apiUrl + globSetting.urlPrefix}/sys/common/upload`, // 直接使用上传接口URL
filePath: file.tempFiles[0].path, filePath: file.tempFiles[0].path,
name: 'file', name: 'file',
formData: { formData: {
...@@ -287,7 +287,7 @@ ...@@ -287,7 +287,7 @@
v-model="form.name" v-model="form.name"
labelSize="28" labelSize="28"
label-width="180" label-width="180"
></fui-input> />
<fui-input <fui-input
required required
label="工作内容" label="工作内容"
...@@ -295,7 +295,7 @@ ...@@ -295,7 +295,7 @@
v-model="form.content" v-model="form.content"
labelSize="28" labelSize="28"
label-width="180" label-width="180"
></fui-input> />
</view> </view>
<view class="mt20"> <view class="mt20">
<fui-input <fui-input
...@@ -307,7 +307,7 @@ ...@@ -307,7 +307,7 @@
v-model="form.workers" v-model="form.workers"
labelSize="28" labelSize="28"
label-width="180" label-width="180"
></fui-input> />
<fui-input <fui-input
required required
type="number" type="number"
...@@ -317,7 +317,7 @@ ...@@ -317,7 +317,7 @@
v-model="form.price" v-model="form.price"
labelSize="28" labelSize="28"
label-width="180" label-width="180"
></fui-input> />
<fui-input <fui-input
required required
label="类型" label="类型"
...@@ -326,7 +326,7 @@ ...@@ -326,7 +326,7 @@
labelSize="28" labelSize="28"
label-width="180" label-width="180"
@click="show.type = true" @click="show.type = true"
></fui-input> />
</view> </view>
<view class="mt20"> <view class="mt20">
<fui-input <fui-input
...@@ -337,7 +337,7 @@ ...@@ -337,7 +337,7 @@
labelSize="28" labelSize="28"
label-width="180" label-width="180"
@click="show.area = true" @click="show.area = true"
></fui-input> />
<fui-input <fui-input
required required
label="详细地址" label="详细地址"
...@@ -345,7 +345,7 @@ ...@@ -345,7 +345,7 @@
v-model="form.address" v-model="form.address"
labelSize="28" labelSize="28"
label-width="180" label-width="180"
></fui-input> />
<fui-input <fui-input
required required
label="紧急程度" label="紧急程度"
...@@ -354,7 +354,7 @@ ...@@ -354,7 +354,7 @@
labelSize="28" labelSize="28"
label-width="180" label-width="180"
@click="show.urgentdegree = true" @click="show.urgentdegree = true"
></fui-input> />
<!-- 时间范围 --> <!-- 时间范围 -->
<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">
...@@ -384,27 +384,17 @@ ...@@ -384,27 +384,17 @@
:auto-upload="false" :auto-upload="false"
@select="handleUpload" @select="handleUpload"
@delete="handleDelete" @delete="handleDelete"
></uni-file-picker> />
</view> </view>
<view class="fui-btn__box" v-if="!form.id" style="margin-top: 30rpx"> <view class="fui-btn__box" v-if="!form.id" style="margin-top: 30rpx">
<fui-button text="发布用工" bold radius="96rpx" @click="submit"></fui-button> <fui-button text="发布用工" bold radius="96rpx" @click="submit" />
</view> </view>
</fui-form> </fui-form>
</view> </view>
</view> </view>
<fui-date-picker <fui-date-picker :show="show.time1" type="3" @change="handleChangeTime1" @cancel="show.time1 = false" />
:show="show.time1" <fui-date-picker :show="show.time2" type="3" @change="handleChangeTime2" @cancel="show.time2 = false" />
type="3"
@change="handleChangeTime1"
@cancel="show.time1 = false"
></fui-date-picker>
<fui-date-picker
:show="show.time2"
type="3"
@change="handleChangeTime2"
@cancel="show.time2 = false"
></fui-date-picker>
<fui-picker <fui-picker
:show="show.type" :show="show.type"
:layer="1" :layer="1"
...@@ -412,7 +402,7 @@ ...@@ -412,7 +402,7 @@
:options="options.type" :options="options.type"
@change="handleChangetype" @change="handleChangetype"
@cancel="show.type = false" @cancel="show.type = false"
></fui-picker> />
<fui-picker <fui-picker
:show="show.urgentdegree" :show="show.urgentdegree"
:layer="1" :layer="1"
...@@ -420,7 +410,7 @@ ...@@ -420,7 +410,7 @@
:options="options.urgentdegree" :options="options.urgentdegree"
@change="handleChangeUrgentdegree" @change="handleChangeUrgentdegree"
@cancel="show.urgentdegree = false" @cancel="show.urgentdegree = false"
></fui-picker> />
<fui-picker <fui-picker
:show="show.area" :show="show.area"
:options="options.area" :options="options.area"
...@@ -428,10 +418,10 @@ ...@@ -428,10 +418,10 @@
:layer="3" :layer="3"
@change="handleChangeAddress" @change="handleChangeAddress"
@cancel="show.area = false" @cancel="show.area = false"
></fui-picker> />
<fui-toast ref="toastRef"></fui-toast> <fui-toast ref="toastRef" />
<fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)"></fui-loading> <fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)" />
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
......
<script setup lang="ts"> <script setup lang="ts">
import { reactive } from 'vue' import { reactive } from 'vue'
import { onLoad, onReachBottom, onShow } from '@dcloudio/uni-app'
import RegisterDialog from './components/register-dialog.vue' import RegisterDialog from './components/register-dialog.vue'
import { onPullDownRefresh, onLoad, onShow, onReachBottom } from '@dcloudio/uni-app' import { getTextByCode } from '@/utils/areaData'
import { areaTree, getTextByCode, getCodeByText } from '@/utils/areaData'
import * as LinghuoyonggongAPI from '@/api/model/linghuoyonggong' import * as LinghuoyonggongAPI from '@/api/model/linghuoyonggong'
import Navigate from '@/utils/page/navigate' import Navigate from '@/utils/page/navigate'
...@@ -181,7 +181,7 @@ ...@@ -181,7 +181,7 @@
item.area = areaCache.get(cacheKey) item.area = areaCache.get(cacheKey)
} else { } else {
const areaCodes = item.area.split(',') const areaCodes = item.area.split(',')
const areaText = getTextByCode(areaCodes[0]) + ' ' + getTextByCode(areaCodes[1]) const areaText = `${getTextByCode(areaCodes[0])} ${getTextByCode(areaCodes[1])}`
areaCache.set(cacheKey, areaText) areaCache.set(cacheKey, areaText)
item.area = areaText item.area = areaText
} }
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
function onEmploymentItemClick(item: any) { function onEmploymentItemClick(item: any) {
console.log('点击用工项:', item) console.log('点击用工项:', item)
// 在这里添加具体的用工项点击逻辑 // 在这里添加具体的用工项点击逻辑
Navigate.to('/pages/linghuoyonggong/form?id=' + item.id) Navigate.to(`/pages/linghuoyonggong/form?id=${item.id}`)
} }
// "我想去"按钮点击事件 // "我想去"按钮点击事件
...@@ -270,7 +270,7 @@ ...@@ -270,7 +270,7 @@
// 检查日期是否有效 // 检查日期是否有效
if (isNaN(d1.getTime()) || isNaN(d2.getTime())) { if (isNaN(d1.getTime()) || isNaN(d2.getTime())) {
throw new Error('无效的日期格式') throw new TypeError('无效的日期格式')
} }
// 设置时间部分为00:00:00,只比较日期部分 // 设置时间部分为00:00:00,只比较日期部分
...@@ -287,7 +287,8 @@ ...@@ -287,7 +287,8 @@
} }
onReachBottom(() => { onReachBottom(() => {
console.log('触底了') console.log('触底了')
if (pageData.total <= pageData.employmentList.length) return if (pageData.total <= pageData.employmentList.length)
return
pageData.search.pageNo++ pageData.search.pageNo++
getEmploymentList() getEmploymentList()
}) })
...@@ -325,7 +326,7 @@ ...@@ -325,7 +326,7 @@
</view> </view>
<view class="codefun-flex-col codefun-relative list"> <view class="codefun-flex-col codefun-relative list">
<view v-if="!pageData.employmentList || pageData.employmentList.length == 0" style="height: 700rpx"> <view v-if="!pageData.employmentList || pageData.employmentList.length == 0" style="height: 700rpx">
<fui-empty marginTop="100" src="/src/static/images/no-data.png" title="暂无数据"></fui-empty> <fui-empty marginTop="100" src="/src/static/images/no-data.png" title="暂无数据" />
</view> </view>
<template v-else> <template v-else>
<view <view
...@@ -393,12 +394,12 @@ ...@@ -393,12 +394,12 @@
<fui-fab position="right" distance="10" bottom="240" width="96" @click="handlePublish"> <fui-fab position="right" distance="10" bottom="240" width="96" @click="handlePublish">
<view class="text-white text-center"> <view class="text-white text-center">
<!-- <image src="/src/static/images/chanxiao/notepad.svg" style="width: 40rpx" mode="widthFix"></image> --> <!-- <image src="/src/static/images/chanxiao/notepad.svg" style="width: 40rpx" mode="widthFix"></image> -->
<view class="fab-icon"></view> <view class="fab-icon" />
<view style="font-size: 24rpx">发布</view> <view style="font-size: 24rpx">发布</view>
</view> </view>
</fui-fab> </fui-fab>
<register-dialog ref="registerDialogRef"></register-dialog> <RegisterDialog ref="registerDialogRef" />
<fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)"></fui-loading> <fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)" />
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
}) })
// 页面数据 // 页面数据
const defaultText = '湖南省农业服务平台' const defaultText = '数字农服'
const readConfirmShow = ref<boolean>(false) const readConfirmShow = ref<boolean>(false)
const form = ref() const form = ref()
const model = reactive({ const model = reactive({
...@@ -280,7 +280,7 @@ ...@@ -280,7 +280,7 @@
:loading="model.loading" :loading="model.loading"
/> />
</view> </view>
<view class="flex-center p-32rpx box-border btn-register" @click="goRegister"> 立即注册 </view> <view class="flex-center p-32rpx box-border btn-register" @click="goRegister"> 还没有账号,立即注册 </view>
</fui-form> </fui-form>
<!-- </view> --> <!-- </view> -->
<fui-checkbox-group class="checkbox" name="checkbox"> <fui-checkbox-group class="checkbox" name="checkbox">
...@@ -464,6 +464,7 @@ ...@@ -464,6 +464,7 @@
:deep(.fui-input__border-bottom) { :deep(.fui-input__border-bottom) {
right: 32rpx !important; right: 32rpx !important;
} }
.btn-register { .btn-register {
color: cadetblue; color: cadetblue;
} }
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
// 注册参数 // 注册参数
const params = { const params = {
phone: model.form.data.phone, phone: model.form.data.phone,
password: model.form.data.password, password: model.form.data.password || '123@2025',
code: model.form.data.code, code: model.form.data.code,
} }
...@@ -179,6 +179,7 @@ ...@@ -179,6 +179,7 @@
<template> <template>
<view class="warp"> <view class="warp">
<!-- <image class="login-warp" src="/static/login/login_bg.png" /> --> <!-- <image class="login-warp" src="/static/login/login_bg.png" /> -->
<view class="register-form">
<view class="register-bg-wrap"> <view class="register-bg-wrap">
<!-- <image class="register-bg" src="/static/images/register/register.png" /> --> <!-- <image class="register-bg" src="/static/images/register/register.png" /> -->
<view class="logo-content-wrap"> <view class="logo-content-wrap">
...@@ -186,7 +187,6 @@ ...@@ -186,7 +187,6 @@
<view class="logo-text">数字农业服务平台</view> <view class="logo-text">数字农业服务平台</view>
</view> </view>
</view> </view>
<view class="register-form">
<fui-form class="form" ref="form" top="50" :padding="['0rpx', '32rpx']"> <fui-form class="form" ref="form" top="50" :padding="['0rpx', '32rpx']">
<view class="reigister-form-item"> <view class="reigister-form-item">
<image class="reigister-form-image" src="/static/images/register/user.png" /> <image class="reigister-form-image" src="/static/images/register/user.png" />
...@@ -207,13 +207,13 @@ ...@@ -207,13 +207,13 @@
maxlength="11" maxlength="11"
/> />
<view class="reigister-form-item"> <view class="reigister-form-item !hidden">
<image class="reigister-form-image" src="/static/images/register/pwd.png" /> <image class="reigister-form-image" src="/static/images/register/pwd.png" />
<text>密码</text> <text>密码</text>
</view> </view>
<fui-input <fui-input
height="100rpx" height="100rpx"
class="input" class="input !hidden"
password password
autocomplete="new-password" autocomplete="new-password"
code code
...@@ -321,30 +321,33 @@ ...@@ -321,30 +321,33 @@
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
background-image: url(/static/images/register/register.png); background-image: url('/static/images/register/register.png');
background-size: 100% 100%; background-size: 100% 100%;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; background-position: center;
.logo-content-wrap { .logo-content-wrap {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: left; justify-content: left;
align-items: flex-start; align-items: flex-start;
width: 86%; width: 86%;
.logo-text-1 { .logo-text-1 {
font-size: 30rpx; font-size: 30rpx;
font-weight: 400; font-weight: 400;
letter-spacing: 0px; letter-spacing: 0;
margin-top: 4.25rem; margin-top: 4.25rem;
color: rgba(51, 51, 51, 0.7); color: rgb(51 51 51 / 70%);
vertical-align: middle; vertical-align: middle;
} }
.logo-text { .logo-text {
font-size: 40rpx; font-size: 40rpx;
font-weight: 500; font-weight: 500;
letter-spacing: 0px; letter-spacing: 0;
margin-top: 40rpx; margin-top: 40rpx;
color: rgba(51, 51, 51, 1); color: rgb(51 51 51 / 100%);
vertical-align: middle; vertical-align: middle;
} }
} }
...@@ -354,18 +357,19 @@ ...@@ -354,18 +357,19 @@
position: absolute; position: absolute;
width: 100%; width: 100%;
height: 60vh; height: 60vh;
left: 0px; left: 0;
top: 450rpx; top: 0;
opacity: 1; opacity: 1;
border-radius: 14.03px 14.03px 0px 0px; border-radius: 14.03px 14.03px 0 0;
border: 1px solid #fff; border: 1px solid #fff;
background: linear-gradient( background: linear-gradient(
180deg, 180deg,
rgba(181, 238, 215, 1) 0%, rgb(181 238 215 / 100%) 0%,
rgba(181, 238, 215, 0.5) 30%, rgb(181 238 215 / 50%) 30%,
rgba(255, 255, 255, 0.8) 100% rgb(255 255 255 / 80%) 100%
); );
} }
.reigister-form-item { .reigister-form-item {
color: #000; color: #000;
display: flex; display: flex;
...@@ -373,10 +377,12 @@ ...@@ -373,10 +377,12 @@
justify-content: left; justify-content: left;
align-items: center; align-items: center;
margin: 10rpx; margin: 10rpx;
.reigister-form-image { .reigister-form-image {
width: 60rpx; width: 60rpx;
height: 60rpx; height: 60rpx;
} }
text { text {
font-size: 32rpx; font-size: 32rpx;
display: flex; display: flex;
...@@ -384,11 +390,11 @@ ...@@ -384,11 +390,11 @@
margin-left: 20rpx; margin-left: 20rpx;
} }
} }
.form { .form {
position: absolute;
top: 80rpx;
width: 100%; width: 100%;
z-index: 10; z-index: 10;
margin-top: 540rpx;
} }
.checkbox { .checkbox {
...@@ -421,6 +427,7 @@ ...@@ -421,6 +427,7 @@
:deep(.fui-input__border-bottom) { :deep(.fui-input__border-bottom) {
right: 32rpx !important; right: 32rpx !important;
} }
.btn-register { .btn-register {
color: cadetblue; color: cadetblue;
} }
......
<script setup lang="ts"> <script setup lang="ts">
import { reactive, toRefs } from 'vue' import { reactive, toRefs } from 'vue'
import { onLoad, onShow } from '@dcloudio/uni-app' import { onShow } from '@dcloudio/uni-app'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
import { useGlobSetting } from '/@/hooks/setting' import { useGlobSetting } from '/@/hooks/setting'
import * as NongchangAPI from '@/api/model/nongchang' import * as NongchangAPI from '@/api/model/nongchang'
...@@ -112,13 +112,13 @@ ...@@ -112,13 +112,13 @@
function initDict() { function initDict() {
pageData.options.address = areaTree pageData.options.address = areaTree
pageData.options.mainProducts = dictStore.getDictList['main_business'].map((item) => { pageData.options.mainProducts = dictStore.getDictList.main_business.map((item) => {
return { return {
value: item.value, value: item.value,
text: item.text, text: item.text,
} }
}) })
pageData.options.farmType = dictStore.getDictList['farm_type'].map((item) => { pageData.options.farmType = dictStore.getDictList.farm_type.map((item) => {
return { return {
value: item.value, value: item.value,
text: item.text, text: item.text,
...@@ -148,7 +148,7 @@ ...@@ -148,7 +148,7 @@
function handleUpload(file) { function handleUpload(file) {
pageData.loading = true pageData.loading = true
uni.uploadFile({ uni.uploadFile({
url: globSetting.apiUrl + globSetting.urlPrefix + '/sys/common/upload', // 直接使用上传接口URL url: `${globSetting.apiUrl + globSetting.urlPrefix}/sys/common/upload`, // 直接使用上传接口URL
filePath: file.tempFiles[0].path, filePath: file.tempFiles[0].path,
name: 'file', name: 'file',
formData: { formData: {
...@@ -212,38 +212,21 @@ ...@@ -212,38 +212,21 @@
<template> <template>
<fui-form ref="formRef"> <fui-form ref="formRef">
<fui-input required label="农场名称" placeholder="请输入农场名称" v-model="form.farmName"></fui-input> <fui-input required label="农场名称" placeholder="请输入农场名称" v-model="form.farmName" />
<fui-input required label="农场标语" placeholder="请输入农场标语" v-model="form.title"></fui-input> <fui-input required label="农场标语" placeholder="请输入农场标语" v-model="form.title" />
<fui-input <fui-input
required required
label="农场类型" label="农场类型"
placeholder="请选择农场类型" placeholder="请选择农场类型"
v-model="form.farmTypeText" v-model="form.farmTypeText"
@click="show.farmType = true" @click="show.farmType = true"
></fui-input> />
<fui-input required label="联系人" placeholder="请输入联系人" v-model="form.contactPerson"></fui-input> <fui-input required label="联系人" placeholder="请输入联系人" v-model="form.contactPerson" />
<fui-input required label="联系电话" placeholder="请输入联系电话" v-model="form.contactPhone"></fui-input> <fui-input required label="联系电话" placeholder="请输入联系电话" v-model="form.contactPhone" />
<fui-textarea <fui-textarea required label="农场描述" placeholder="请输入农场描述" v-model="pageData.form.description" />
required <fui-input required label="地区" placeholder="请选择地区" v-model="form.address" @click="show.address = true" />
label="农场描述" <fui-input required label="详细地址" placeholder="请输入详细地址" v-model="form.addressDetail" />
placeholder="请输入农场描述" <fui-input required label="主营业务" borderTop placeholder="请输入主营业务" v-model="form.mainBusiness" />
v-model="pageData.form.description"
></fui-textarea>
<fui-input
required
label="地区"
placeholder="请选择地区"
v-model="form.address"
@click="show.address = true"
></fui-input>
<fui-input required label="详细地址" placeholder="请输入详细地址" v-model="form.addressDetail"></fui-input>
<fui-input
required
label="主营业务"
borderTop
placeholder="请输入主营业务"
v-model="form.mainBusiness"
></fui-input>
<fui-input <fui-input
required required
label="主要产品" label="主要产品"
...@@ -251,14 +234,8 @@ ...@@ -251,14 +234,8 @@
placeholder="请选择主要产品" placeholder="请选择主要产品"
v-model="form.mainProductsText" v-model="form.mainProductsText"
@click="show.mainProducts = true" @click="show.mainProducts = true"
></fui-input> />
<fui-input <fui-input required label="总面积(亩)" borderTop placeholder="请输入总面积" v-model="form.totalArea" />
required
label="总面积(亩)"
borderTop
placeholder="请输入总面积"
v-model="form.totalArea"
></fui-input>
<view class="bg-white" style="padding: 0.875rem 0.35rem"> <view class="bg-white" style="padding: 0.875rem 0.35rem">
<view class="mb-1 flex justify-start"> 封面图片 </view> <view class="mb-1 flex justify-start"> 封面图片 </view>
<uni-file-picker <uni-file-picker
...@@ -267,10 +244,10 @@ ...@@ -267,10 +244,10 @@
:auto-upload="false" :auto-upload="false"
@select="handleUpload" @select="handleUpload"
@delete="handleDelete" @delete="handleDelete"
></uni-file-picker> />
</view> </view>
<view class="fui-btn__box bg-white p-4"> <view class="fui-btn__box bg-white p-4">
<fui-button text="添加农场" bold radius="96rpx" @click="submit"></fui-button> <fui-button text="添加农场" bold radius="96rpx" @click="submit" />
</view> </view>
</fui-form> </fui-form>
...@@ -281,7 +258,7 @@ ...@@ -281,7 +258,7 @@
:options="options.farmType" :options="options.farmType"
@change="handleChangeFarmType" @change="handleChangeFarmType"
@cancel="show.farmType = false" @cancel="show.farmType = false"
></fui-picker> />
<fui-picker <fui-picker
:show="show.mainProducts" :show="show.mainProducts"
:layer="1" :layer="1"
...@@ -289,7 +266,7 @@ ...@@ -289,7 +266,7 @@
:options="options.mainProducts" :options="options.mainProducts"
@change="handleChangeMainProducts" @change="handleChangeMainProducts"
@cancel="show.mainProducts = false" @cancel="show.mainProducts = false"
></fui-picker> />
<fui-picker <fui-picker
:show="show.address" :show="show.address"
:options="options.address" :options="options.address"
...@@ -297,10 +274,10 @@ ...@@ -297,10 +274,10 @@
:layer="3" :layer="3"
@change="handleChangeAddress" @change="handleChangeAddress"
@cancel="show.address = false" @cancel="show.address = false"
></fui-picker> />
<fui-toast ref="toastRef"></fui-toast> <fui-toast ref="toastRef" />
<fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)"></fui-loading> <fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)" />
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
......
<script setup lang="ts"> <script setup lang="ts">
import { reactive } from 'vue' import { reactive } from 'vue'
import * as NongjifuwuAPI from '@/api/model/nongjifuwu' import * as NongjifuwuAPI from '@/api/model/nongjifuwu'
import { getCurrentDate } from '@/utils/date'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
const { getUserInfo } = useUserStore() const { getUserInfo } = useUserStore()
const pageData = reactive({ const pageData = reactive({
...@@ -112,60 +112,36 @@ ...@@ -112,60 +112,36 @@
close, close,
}) })
</script> </script>
<template> <template>
<fui-dialog title="" :buttons="[]" :show="pageData.show" maskClosable> <fui-dialog title="" :buttons="[]" :show="pageData.show" maskClosable>
<view class="title flex justify-center"> <view class="title flex justify-center">
<view class="flex-1">我有需要</view> <view class="flex-1">我有需要</view>
<fui-icon class="close flex-basis" name="close" size="46" color="#999999" @click="close"></fui-icon> <fui-icon class="close flex-basis" name="close" size="46" color="#999999" @click="close" />
</view> </view>
<view class="text-left"> <view class="text-left">
<fui-form ref="formRef"> <fui-form ref="formRef">
<fui-input <fui-input marginTop="30" size="24" placeholder="请填写预留手机" v-model="pageData.form.phone" />
marginTop="30" <fui-input marginTop="30" size="24" placeholder="请填写作业地区" v-model="pageData.form.scope" />
size="24" <fui-input marginTop="30" size="24" placeholder="请填写作业详细地址" v-model="pageData.form.address" />
placeholder="请填写预留手机"
v-model="pageData.form.phone"
></fui-input>
<fui-input
marginTop="30"
size="24"
placeholder="请填写作业地区"
v-model="pageData.form.scope"
></fui-input>
<fui-input
marginTop="30"
size="24"
placeholder="请填写作业详细地址"
v-model="pageData.form.address"
></fui-input>
<fui-input <fui-input
marginTop="30" marginTop="30"
size="24" size="24"
placeholder="请选择作业时间" placeholder="请选择作业时间"
v-model="pageData.form.time" v-model="pageData.form.time"
@click="dict.show.time = true" @click="dict.show.time = true"
></fui-input> />
<fui-textarea <fui-textarea v-model="pageData.form.demand" :marginTop="30" size="24" placeholder="简要说明作业需求" />
v-model="pageData.form.demand"
:marginTop="30"
size="24"
placeholder="简要说明作业需求"
></fui-textarea>
<view style="margin-top: 30rpx"> <view style="margin-top: 30rpx">
<fui-button type="warning" text="确定" bold radius="96rpx" @click="submit"></fui-button> <fui-button type="warning" text="确定" bold radius="96rpx" @click="submit" />
</view> </view>
</fui-form> </fui-form>
</view> </view>
</fui-dialog> </fui-dialog>
<fui-date-picker <fui-date-picker :show="dict.show.time" type="3" range @change="handleTimeChange" @cancel="handleTimeCancel" />
:show="dict.show.time"
type="3"
range
@change="handleTimeChange"
@cancel="handleTimeCancel"
></fui-date-picker>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
:deep(.fui-dialog__body) { :deep(.fui-dialog__body) {
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%);
......
...@@ -124,8 +124,8 @@ ...@@ -124,8 +124,8 @@
// 返回格式化的对象 // 返回格式化的对象
return { return {
name: fileName, name: fileName,
extname: extname, extname,
url: url, url,
} }
} }
...@@ -147,7 +147,7 @@ ...@@ -147,7 +147,7 @@
// 文件上传 // 文件上传
function handleUpload(file) { function handleUpload(file) {
uni.uploadFile({ uni.uploadFile({
url: globSetting.apiUrl + globSetting.urlPrefix + '/sys/common/upload', // 直接使用上传接口URL url: `${globSetting.apiUrl + globSetting.urlPrefix}/sys/common/upload`, // 直接使用上传接口URL
filePath: file.tempFiles[0].path, filePath: file.tempFiles[0].path,
name: 'file', name: 'file',
formData: { formData: {
...@@ -213,7 +213,7 @@ ...@@ -213,7 +213,7 @@
v-model="form.name" v-model="form.name"
labelSize="28" labelSize="28"
label-width="180" label-width="180"
></fui-input> />
<view class="form-item required flex align-center" style="padding: 20rpx 10rpx"> <view class="form-item required flex align-center" style="padding: 20rpx 10rpx">
<text class="label">服务范围</text> <text class="label">服务范围</text>
<view class="time-input" @click="show.address = true"> <view class="time-input" @click="show.address = true">
...@@ -237,7 +237,7 @@ ...@@ -237,7 +237,7 @@
v-model="form.address" v-model="form.address"
labelSize="28" labelSize="28"
label-width="180" label-width="180"
></fui-input> />
<fui-input <fui-input
required required
label="联系方式" label="联系方式"
...@@ -245,7 +245,7 @@ ...@@ -245,7 +245,7 @@
v-model="form.phone" v-model="form.phone"
labelSize="28" labelSize="28"
label-width="180" label-width="180"
></fui-input> />
</view> </view>
<view class="mt20"> <view class="mt20">
<fui-input <fui-input
...@@ -255,7 +255,7 @@ ...@@ -255,7 +255,7 @@
v-model="form.demand" v-model="form.demand"
labelSize="28" labelSize="28"
label-width="180" label-width="180"
></fui-input> />
<!-- 作业时间 --> <!-- 作业时间 -->
<view class="form-section" style="padding: 0 10rpx"> <view class="form-section" style="padding: 0 10rpx">
<view class="form-item flex align-center"> <view class="form-item flex align-center">
...@@ -286,10 +286,10 @@ ...@@ -286,10 +286,10 @@
:auto-upload="false" :auto-upload="false"
@select="handleUpload" @select="handleUpload"
@delete="handleDelete" @delete="handleDelete"
></uni-file-picker> />
</view> </view>
<view class="fui-btn__box" v-if="!form.id" style="margin-top: 30rpx"> <view class="fui-btn__box" v-if="!form.id" style="margin-top: 30rpx">
<fui-button text="发布作业" bold radius="96rpx" @click="submit"></fui-button> <fui-button text="发布作业" bold radius="96rpx" @click="submit" />
</view> </view>
</fui-form> </fui-form>
...@@ -299,17 +299,17 @@ ...@@ -299,17 +299,17 @@
@change="handleChangeTime1" @change="handleChangeTime1"
@cancel="show.time1 = false" @cancel="show.time1 = false"
minDate="2025-01-01" minDate="2025-01-01"
></fui-date-picker> />
<fui-date-picker <fui-date-picker
:show="show.time2" :show="show.time2"
type="3" type="3"
@change="handleChangeTime2" @change="handleChangeTime2"
@cancel="show.time2 = false" @cancel="show.time2 = false"
minDate="2025-01-01" minDate="2025-01-01"
></fui-date-picker> />
<fui-toast ref="toastRef"></fui-toast> <fui-toast ref="toastRef" />
<fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)"></fui-loading> <fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)" />
<fui-picker <fui-picker
:show="show.address" :show="show.address"
:options="options.address" :options="options.address"
...@@ -317,7 +317,7 @@ ...@@ -317,7 +317,7 @@
:layer="3" :layer="3"
@change="handleChangeAddress" @change="handleChangeAddress"
@cancel="show.address = false" @cancel="show.address = false"
></fui-picker> />
</view> </view>
</view> </view>
</template> </template>
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
import * as nongjifuwu from '@/api/model/nongjifuwu' import * as nongjifuwu from '@/api/model/nongjifuwu'
import { useDictStore } from '@/store/modules/dict' import { useDictStore } from '@/store/modules/dict'
import { areaTree } from '@/utils/areaData' import { areaTree } from '@/utils/areaData'
const dictStore = useDictStore() const dictStore = useDictStore()
const userStore = useUserStore() const userStore = useUserStore()
const globSetting = useGlobSetting() const globSetting = useGlobSetting()
...@@ -111,8 +112,8 @@ ...@@ -111,8 +112,8 @@
// 返回格式化的对象 // 返回格式化的对象
return { return {
name: fileName, name: fileName,
extname: extname, extname,
url: url, url,
} }
} }
...@@ -121,7 +122,7 @@ ...@@ -121,7 +122,7 @@
// 文件上传 // 文件上传
function handleUpload(file) { function handleUpload(file) {
uni.uploadFile({ uni.uploadFile({
url: globSetting.apiUrl + globSetting.urlPrefix + '/sys/common/upload', // 直接使用上传接口URL url: `${globSetting.apiUrl + globSetting.urlPrefix}/sys/common/upload`, // 直接使用上传接口URL
filePath: file.tempFiles[0].path, filePath: file.tempFiles[0].path,
name: 'file', name: 'file',
formData: { formData: {
...@@ -178,6 +179,7 @@ ...@@ -178,6 +179,7 @@
pageData.show.address = false pageData.show.address = false
} }
</script> </script>
<template> <template>
<view class="page"> <view class="page">
<view class="formBox"> <view class="formBox">
...@@ -190,7 +192,7 @@ ...@@ -190,7 +192,7 @@
v-model="form.name" v-model="form.name"
labelSize="28" labelSize="28"
label-width="180" label-width="180"
></fui-input> />
<fui-input <fui-input
required required
label="联系方式" label="联系方式"
...@@ -198,7 +200,7 @@ ...@@ -198,7 +200,7 @@
v-model="form.phone" v-model="form.phone"
labelSize="28" labelSize="28"
label-width="180" label-width="180"
></fui-input> />
<view class="form-item required flex align-center" style="padding: 20rpx 10rpx"> <view class="form-item required flex align-center" style="padding: 20rpx 10rpx">
<text class="label">服务范围</text> <text class="label">服务范围</text>
<view class="time-input" @click="show.address = true"> <view class="time-input" @click="show.address = true">
...@@ -225,7 +227,7 @@ ...@@ -225,7 +227,7 @@
v-model="form.price" v-model="form.price"
labelSize="28" labelSize="28"
label-width="180" label-width="180"
></fui-input> />
</view> </view>
<view class="bg-white mt20" style="padding: 0.875rem 1rem"> <view class="bg-white mt20" style="padding: 0.875rem 1rem">
...@@ -238,16 +240,16 @@ ...@@ -238,16 +240,16 @@
:auto-upload="false" :auto-upload="false"
@select="handleUpload" @select="handleUpload"
@delete="handleDelete" @delete="handleDelete"
></uni-file-picker> />
</view> </view>
<view class="fui-btn__box" v-if="!form.id" style="margin-top: 30rpx"> <view class="fui-btn__box" v-if="!form.id" style="margin-top: 30rpx">
<fui-button text="发布作业" bold radius="96rpx" @click="submit"></fui-button> <fui-button text="发布作业" bold radius="96rpx" @click="submit" />
</view> </view>
</fui-form> </fui-form>
<fui-toast ref="toastRef"></fui-toast> <fui-toast ref="toastRef" />
<fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)"></fui-loading> <fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)" />
<fui-picker <fui-picker
:show="show.address" :show="show.address"
:options="options.address" :options="options.address"
...@@ -255,7 +257,7 @@ ...@@ -255,7 +257,7 @@
:layer="3" :layer="3"
@change="handleChangeAddress" @change="handleChangeAddress"
@cancel="show.address = false" @cancel="show.address = false"
></fui-picker> />
</view> </view>
</view> </view>
</template> </template>
......
<script setup lang="ts"> <script setup lang="ts">
import { reactive } from 'vue' import { reactive } from 'vue'
import { onLoad, onReachBottom, onShow } from '@dcloudio/uni-app'
import ApplyDialog from './components/apply-dialog.vue' import ApplyDialog from './components/apply-dialog.vue'
import { onPullDownRefresh, onLoad, onShow, onReachBottom } from '@dcloudio/uni-app'
import * as NongjifuwuAPI from '@/api/model/nongjifuwu' import * as NongjifuwuAPI from '@/api/model/nongjifuwu'
import Navigate from '@/utils/page/navigate' import Navigate from '@/utils/page/navigate'
...@@ -80,7 +80,8 @@ ...@@ -80,7 +80,8 @@
onReachBottom(() => { onReachBottom(() => {
console.log('触底了') console.log('触底了')
if (pageData.total <= pageData.farmMachineList.length) return if (pageData.total <= pageData.farmMachineList.length)
return
pageData.search.pageNo++ pageData.search.pageNo++
getFarmMachineList() getFarmMachineList()
}) })
...@@ -117,7 +118,7 @@ ...@@ -117,7 +118,7 @@
class="codefun-flex-col codefun-relative section_4" class="codefun-flex-col codefun-relative section_4"
style="height: 700rpx" style="height: 700rpx"
> >
<fui-empty marginTop="100" src="/src/static/images/no-data.png" title="暂无数据"></fui-empty> <fui-empty marginTop="100" src="/src/static/images/no-data.png" title="暂无数据" />
</view> </view>
<view class="codefun-flex-col codefun-relative section_4"> <view class="codefun-flex-col codefun-relative section_4">
<view class="codefun-flex-row group_6" v-for="item in pageData.farmMachineList" :key="item.id"> <view class="codefun-flex-row group_6" v-for="item in pageData.farmMachineList" :key="item.id">
...@@ -272,13 +273,13 @@ ...@@ -272,13 +273,13 @@
</view> </view>
<fui-fab position="right" distance="10" bottom="240" width="96" @click="handlePublish"> <fui-fab position="right" distance="10" bottom="240" width="96" @click="handlePublish">
<view class="text-white text-center"> <view class="text-white text-center">
<view class="fab-icon"></view> <view class="fab-icon" />
<view style="font-size: 24rpx">发布</view> <view style="font-size: 24rpx">发布</view>
</view> </view>
</fui-fab> </fui-fab>
<ApplyDialog ref="applyDialogRef"></ApplyDialog> <ApplyDialog ref="applyDialogRef" />
<fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)"></fui-loading> <fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)" />
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
......
<script setup lang="ts"> <script setup lang="ts">
import { reactive } from 'vue' import { reactive } from 'vue'
import { onPullDownRefresh, onLoad, onShow, onReachBottom } from '@dcloudio/uni-app' import { onPullDownRefresh, onReachBottom, onShow } from '@dcloudio/uni-app'
import * as NongzhiAPI from '@/api/model/nongzhi' import * as NongzhiAPI from '@/api/model/nongzhi'
import { useDictStore } from '@/store/modules/dict' import { useDictStore } from '@/store/modules/dict'
...@@ -113,7 +113,7 @@ ...@@ -113,7 +113,7 @@
}) })
function initDict() { function initDict() {
pageData.categoryList1 = dictStore.getDictList['category'].map((item) => { pageData.categoryList1 = dictStore.getDictList.category.map((item) => {
return { return {
text: item.text, text: item.text,
value: item.value, value: item.value,
...@@ -181,7 +181,8 @@ ...@@ -181,7 +181,8 @@
} }
onReachBottom(() => { onReachBottom(() => {
if (pagedata.total <= pageData.products.length) return if (pagedata.total <= pageData.products.length)
return
pageData.search.pageNo++ pageData.search.pageNo++
getGoodsList() getGoodsList()
}) })
...@@ -215,7 +216,7 @@ ...@@ -215,7 +216,7 @@
<view class="fui-filter__item" @tap="filterTap1"> <view class="fui-filter__item" @tap="filterTap1">
<text>{{ pageData.range1 }}</text> <text>{{ pageData.range1 }}</text>
<view class="fui-filter__icon" :class="{ 'fui-icon__ani': pageData.rangeShow1 }"> <view class="fui-filter__icon" :class="{ 'fui-icon__ani': pageData.rangeShow1 }">
<fui-icon name="turningdown" :size="32"></fui-icon> <fui-icon name="turningdown" :size="32" />
</view> </view>
</view> </view>
</fui-dropdown-menu> </fui-dropdown-menu>
...@@ -232,14 +233,14 @@ ...@@ -232,14 +233,14 @@
<view class="fui-filter__item" @tap="filterTap2"> <view class="fui-filter__item" @tap="filterTap2">
<text>{{ pageData.range2 }}</text> <text>{{ pageData.range2 }}</text>
<view class="fui-filter__icon" :class="{ 'fui-icon__ani': pageData.rangeShow2 }"> <view class="fui-filter__icon" :class="{ 'fui-icon__ani': pageData.rangeShow2 }">
<fui-icon name="turningdown" :size="32"></fui-icon> <fui-icon name="turningdown" :size="32" />
</view> </view>
</view> </view>
</fui-dropdown-menu> </fui-dropdown-menu>
</view> </view>
<view class="codefun-mt-6 codefun-flex-col codefun-self-stretch"> <view class="codefun-mt-6 codefun-flex-col codefun-self-stretch">
<view v-if="!pageData.products || pageData.products.length == 0" style="height: 700rpx"> <view v-if="!pageData.products || pageData.products.length == 0" style="height: 700rpx">
<fui-empty marginTop="100" src="/src/static/images/no-data.png" title="暂无数据"></fui-empty> <fui-empty marginTop="100" src="/src/static/images/no-data.png" title="暂无数据" />
</view> </view>
<template v-else> <template v-else>
<view <view
......
<template>
<u-modal
:show="show"
:title="dialogTitle"
:showConfirmButton="false"
:showCancelButton="false"
@close="handleClose"
:closeOnClickOverlay="false"
>
<view class="dialog-content">
<u-form :model="formData" :rules="rules" ref="formRef" label-width="auto">
<!-- 资源基本信息 -->
<!-- <view class="section-title">资源基本信息</view> -->
<u-form-item label="" prop="fileName">
<u-input v-model="formData.fileName" placeholder="请输入文件名称" border="bottom" />
</u-form-item>
<!-- <u-form-item label="文件类型" prop="fileType" required>
<u-input v-model="formData.fileType" placeholder="请选择文件类型" border="bottom"
@click="showFileTypePicker = true" />
</u-form-item> -->
<u-form-item label="上传文件" prop="file" required>
<view class="file-upload">
<u-button v-if="!formData.file" @click="chooseFile" type="primary" class="ui-button">
<text class="font_10">选择文件</text>
</u-button>
<view v-else class="file-info">
<view class="file-name-container">
<text class="file-name">{{ formData.file.name }}</text>
<text class="remove-icon" @click="removeFile">×</text>
</view>
</view>
</view>
</u-form-item>
<!-- 操作按钮 -->
<view class="dialog-buttons">
<u-button
type="primary"
@click="handleSubmit"
:loading="loading"
size="normal"
class="submit-btn"
color="var(--fui-color-success)"
>
{{ submitButtonText }}
</u-button>
<u-button @click="handleClose" size="normal" class="cancel-btn">取消</u-button>
</view>
</u-form>
</view>
</u-modal>
</template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, watch, computed } from 'vue' import { computed, reactive, ref, watch } from 'vue'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
import { useGlobSetting } from '/@/hooks/setting' import { useGlobSetting } from '/@/hooks/setting'
import * as WodeAPI from '@/api/model/wode' import * as WodeAPI from '@/api/model/wode'
const lemonjkFileSelect = uni.requireNativePlugin('lemonjk-FileSelect')
// 定义Props
interface Props {
show: boolean
editData?: any
}
const props = withDefaults(defineProps<Props>(), { const props = withDefaults(defineProps<Props>(), {
show: false, show: false,
...@@ -79,6 +17,14 @@ ...@@ -79,6 +17,14 @@
submitSuccess: [] submitSuccess: []
}>() }>()
const lemonjkFileSelect = uni.requireNativePlugin('lemonjk-FileSelect')
// 定义Props
interface Props {
show: boolean
editData?: any
}
// 表单引用 // 表单引用
const formRef = ref() const formRef = ref()
const loading = ref(false) const loading = ref(false)
...@@ -155,7 +101,7 @@ ...@@ -155,7 +101,7 @@
) )
// 重置表单数据 // 重置表单数据
const resetFormData = () => { function resetFormData() {
formData.fileName = '' formData.fileName = ''
formData.fileType = '' formData.fileType = ''
formData.fileTypeText = '' formData.fileTypeText = ''
...@@ -168,8 +114,9 @@ ...@@ -168,8 +114,9 @@
} }
// 加载编辑数据 // 加载编辑数据
const loadEditData = () => { function loadEditData() {
if (!props.editData) return if (!props.editData)
return
formData.fileName = props.editData.fileName || '' formData.fileName = props.editData.fileName || ''
formData.fileType = props.editData.fileType || '' formData.fileType = props.editData.fileType || ''
...@@ -180,7 +127,7 @@ ...@@ -180,7 +127,7 @@
} }
const uplpoadFile = ref(null) const uplpoadFile = ref(null)
// 选择文件 // 选择文件
const chooseFile = () => { function chooseFile() {
// #ifdef H5 // #ifdef H5
uni.chooseFile({ uni.chooseFile({
count: 1, count: 1,
...@@ -219,7 +166,7 @@ ...@@ -219,7 +166,7 @@
// #ifndef H5 // #ifndef H5
lemonjkFileSelect.showNativePicker( lemonjkFileSelect.showNativePicker(
{ {
//各属性配置见下方【showPicker可配置参数说明】 // 各属性配置见下方【showPicker可配置参数说明】
pathScope: '/Download', pathScope: '/Download',
mimeType: '*/*', mimeType: '*/*',
utisType: ['public.data'], utisType: ['public.data'],
...@@ -243,7 +190,7 @@ ...@@ -243,7 +190,7 @@
} }
// 移除文件 // 移除文件
const removeFile = () => { function removeFile() {
formData.file = null formData.file = null
// 移除文件后触发验证 // 移除文件后触发验证
if (formRef.value) { if (formRef.value) {
...@@ -252,7 +199,7 @@ ...@@ -252,7 +199,7 @@
} }
// 根据文件扩展名获取文件类型 // 根据文件扩展名获取文件类型
const getFileTypeByExt = (ext) => { function getFileTypeByExt(ext) {
const map = { const map = {
doc: 'doc', doc: 'doc',
docx: 'doc', docx: 'doc',
...@@ -280,7 +227,7 @@ ...@@ -280,7 +227,7 @@
const userStore = useUserStore() const userStore = useUserStore()
const globSetting = useGlobSetting() const globSetting = useGlobSetting()
// 提交表单 // 提交表单
const handleSubmit = async () => { async function handleSubmit() {
try { try {
console.log(formData) console.log(formData)
// 先进行表单验证 // 先进行表单验证
...@@ -313,7 +260,7 @@ ...@@ -313,7 +260,7 @@
// API留空 // API留空
console.log('上传资源数据:', submitData) console.log('上传资源数据:', submitData)
uni.uploadFile({ uni.uploadFile({
url: globSetting.apiUrl + globSetting.urlPrefix + '/sys/common/upload', // 直接使用上传接口URL url: `${globSetting.apiUrl + globSetting.urlPrefix}/sys/common/upload`, // 直接使用上传接口URL
filePath: uplpoadFile.value, filePath: uplpoadFile.value,
name: 'file', name: 'file',
formData: { formData: {
...@@ -377,12 +324,67 @@ ...@@ -377,12 +324,67 @@
} }
// 关闭弹窗 // 关闭弹窗
const handleClose = () => { function handleClose() {
emit('update:show', false) emit('update:show', false)
emit('close') emit('close')
} }
</script> </script>
<template>
<u-modal
:show="show"
:title="dialogTitle"
:showConfirmButton="false"
:showCancelButton="false"
@close="handleClose"
:closeOnClickOverlay="false"
>
<view class="dialog-content">
<u-form :model="formData" :rules="rules" ref="formRef" label-width="auto">
<!-- 资源基本信息 -->
<!-- <view class="section-title">资源基本信息</view> -->
<u-form-item label="" prop="fileName">
<u-input v-model="formData.fileName" placeholder="请输入文件名称" border="bottom" />
</u-form-item>
<!-- <u-form-item label="文件类型" prop="fileType" required>
<u-input v-model="formData.fileType" placeholder="请选择文件类型" border="bottom"
@click="showFileTypePicker = true" />
</u-form-item> -->
<u-form-item label="上传文件" prop="file" required>
<view class="file-upload">
<u-button v-if="!formData.file" @click="chooseFile" type="primary" class="ui-button">
<text class="font_10">选择文件</text>
</u-button>
<view v-else class="file-info">
<view class="file-name-container">
<text class="file-name">{{ formData.file.name }}</text>
<text class="remove-icon" @click="removeFile">×</text>
</view>
</view>
</view>
</u-form-item>
<!-- 操作按钮 -->
<view class="dialog-buttons">
<u-button
type="primary"
@click="handleSubmit"
:loading="loading"
size="normal"
class="submit-btn"
color="var(--fui-color-success)"
>
{{ submitButtonText }}
</u-button>
<u-button @click="handleClose" size="normal" class="cancel-btn">取消</u-button>
</view>
</u-form>
</view>
</u-modal>
</template>
<style lang="scss" scoped> <style lang="scss" scoped>
.dialog-content { .dialog-content {
padding: 10rpx 30rpx; padding: 10rpx 30rpx;
......
<template>
<view class="codefun-flex-col page">
<z-paging ref="paging" v-model="pageData.list" @query="queryList">
<view class="codefun-flex-col group_3">
<view class="codefun-flex-row codefun-items-center section_2">
<image class="image_6" src="/static/images/codefun/6c5c5a3c082b8c60a307d3a7caee623c.png" />
<u-input
v-model="pageData.param.fileName"
placeholder="请输入文件名称搜索"
border="none"
class="codefun-ml-8"
@confirm="handleSearch"
/>
</view>
<!-- 资源列表 - 根据图片样式修改 -->
<view class="resource-list">
<view v-for="(item, index) in pageData.list" :key="index" class="resource-item">
<view class="resource-content">
<view class="resource-main">
<view class="resource-name">{{ item.fileName }}</view>
<view class="resource-meta">
<text class="resource-size">{{ item.fileSize }}</text>
<text class="separator">|</text>
<text class="download-count">已下载{{ item.downloadCount || 0 }}</text>
<text class="separator">|</text>
<text class="upload-time">{{ formatTime(item.createTime) }}</text>
</view>
</view>
<view
class="codefun-flex-col codefun-justify-start codefun-items-center text-wrapper_4"
@click.stop="handleDownload(item)"
>
<text class="font_10">下载</text>
</view>
<!-- <view class="download-section">
<view class="download-btn" @click="handleDownload(item)">
<text class="btn-text">下载</text>
</view>
</view> -->
</view>
</view>
</view>
<!-- 空状态 -->
<!-- <view class="empty-state" v-if="pageData.list.length === 0">
<image class="empty-icon" src="/static/images/empty.png" mode="aspectFit"></image>
<text class="empty-text">暂无资源</text>
</view> -->
</view>
</z-paging>
<!-- 弹窗组件 -->
<save-dialog
:show="showDialog"
:editData="currentEditData"
@update:show="showDialog = $event"
@submitSuccess="handleSubmitSuccess"
/>
</view>
</template>
<script setup> <script setup>
import { nextTick, reactive, ref } from 'vue' import { reactive, ref } from 'vue'
import { onLoad, onNavigationBarButtonTap, onShow } from '@dcloudio/uni-app' import { onNavigationBarButtonTap } from '@dcloudio/uni-app'
import * as API from '@/api/model/wode'
import SaveDialog from './components/save-dialog.vue' import SaveDialog from './components/save-dialog.vue'
import * as API from '@/api/model/wode'
const isOnePage = ref(true) const isOnePage = ref(true)
const paging = ref(null) const paging = ref(null)
...@@ -104,19 +43,20 @@ ...@@ -104,19 +43,20 @@
showAddDialog() showAddDialog()
}) })
const showAddDialog = () => { function showAddDialog() {
currentEditData.value = null currentEditData.value = null
showDialog.value = true showDialog.value = true
} }
// 格式化时间显示 // 格式化时间显示
const formatTime = (time) => { function formatTime(time) {
if (!time) return '' if (!time)
return ''
// 如果是完整的时间字符串,可以格式化为图片中的样式 // 如果是完整的时间字符串,可以格式化为图片中的样式
return time.includes(' ') ? time : `${time} 14:00` return time.includes(' ') ? time : `${time} 14:00`
} }
// 下载资源 // 下载资源
const handleDownload = async (resource) => { async function handleDownload(resource) {
await API.downloadResource({ id: resource.id }) await API.downloadResource({ id: resource.id })
// 更新下载次数 // 更新下载次数
const index = pageData.list.findIndex((item) => item.id === resource.id) const index = pageData.list.findIndex((item) => item.id === resource.id)
...@@ -134,21 +74,83 @@ ...@@ -134,21 +74,83 @@
} }
// 格式化文件大小 // 格式化文件大小
const formatFileSize = (bytes) => { function formatFileSize(bytes) {
if (!bytes) return '125kb' if (!bytes)
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))
return parseFloat((bytes / Math.pow(k, i)).toFixed(0)) + sizes[i].toLowerCase() return Number.parseFloat((bytes / k ** i).toFixed(0)) + sizes[i].toLowerCase()
} }
const handleSubmitSuccess = () => { function handleSubmitSuccess() {
showDialog.value = false showDialog.value = false
// 重新加载数据 // 重新加载数据
handleSearch() handleSearch()
} }
</script> </script>
<template>
<view class="codefun-flex-col page">
<z-paging ref="paging" v-model="pageData.list" @query="queryList">
<view class="codefun-flex-col group_3">
<view class="codefun-flex-row codefun-items-center section_2">
<image class="image_6" src="/static/images/codefun/6c5c5a3c082b8c60a307d3a7caee623c.png" />
<u-input
v-model="pageData.param.fileName"
placeholder="请输入文件名称搜索"
border="none"
class="codefun-ml-8"
@confirm="handleSearch"
/>
</view>
<!-- 资源列表 - 根据图片样式修改 -->
<view class="resource-list">
<view v-for="(item, index) in pageData.list" :key="index" class="resource-item">
<view class="resource-content">
<view class="resource-main">
<view class="resource-name">{{ item.fileName }}</view>
<view class="resource-meta">
<text class="resource-size">{{ item.fileSize }}</text>
<text class="separator">|</text>
<text class="download-count">已下载{{ item.downloadCount || 0 }}</text>
<text class="separator">|</text>
<text class="upload-time">{{ formatTime(item.createTime) }}</text>
</view>
</view>
<view
class="codefun-flex-col codefun-justify-start codefun-items-center text-wrapper_4"
@click.stop="handleDownload(item)"
>
<text class="font_10">下载</text>
</view>
<!-- <view class="download-section">
<view class="download-btn" @click="handleDownload(item)">
<text class="btn-text">下载</text>
</view>
</view> -->
</view>
</view>
</view>
<!-- 空状态 -->
<!-- <view class="empty-state" v-if="pageData.list.length === 0">
<image class="empty-icon" src="/static/images/empty.png" mode="aspectFit"></image>
<text class="empty-text">暂无资源</text>
</view> -->
</view>
</z-paging>
<!-- 弹窗组件 -->
<SaveDialog
:show="showDialog"
:editData="currentEditData"
@update:show="showDialog = $event"
@submit-success="handleSubmitSuccess"
/>
</view>
</template>
<style lang="scss"> <style lang="scss">
body { body {
background: #e6f5e8; background: #e6f5e8;
......
...@@ -184,6 +184,15 @@ ...@@ -184,6 +184,15 @@
} }
}) })
}) })
WeatherAPI.alarm(`${pageData.weather.lat},${pageData.weather.lon}`).then((res) => {
console.log('WeatherAPI.alarm', res)
// pageData.weather.warning = res.data.alerts?.[0]?.description || ''
// TODO: 测试数据
pageData.weather.warning =
'雨花区气象台24日11时19分继续发布大风蓝色预警信号:预计未来24小时内临桂将出现6级(或阵风7级)以上大风,请做好防范。'
})
} }
// 页面数据 // 页面数据
...@@ -375,13 +384,13 @@ ...@@ -375,13 +384,13 @@
} }
// 农产品关注点击事件 // 农产品关注点击事件
function onProductFollowClick(product: any) { function _onProductFollowClick(product: any) {
console.log('点击关注农产品:', product) console.log('点击关注农产品:', product)
// 在这里添加具体的关注逻辑 // 在这里添加具体的关注逻辑
} }
// 查看更多农技课堂 // 查看更多农技课堂
function onViewMoreClass() { function _onViewMoreClass() {
console.log('查看全部农技课堂') console.log('查看全部农技课堂')
// 在这里添加具体的查看逻辑 // 在这里添加具体的查看逻辑
} }
...@@ -389,7 +398,7 @@ ...@@ -389,7 +398,7 @@
// 轮播视频切换的时候触发 // 轮播视频切换的时候触发
function handleChangeVideo(e: any) { function handleChangeVideo(e: any) {
const currentIndex = e.detail.current const currentIndex = e.detail.current
const prevIndex = pageData.current const _prevIndex = pageData.current
pageData.current = currentIndex pageData.current = currentIndex
pageData.agricultureClass.title = pageData.agricultureClass.videoList[currentIndex]?.title pageData.agricultureClass.title = pageData.agricultureClass.videoList[currentIndex]?.title
...@@ -458,7 +467,7 @@ ...@@ -458,7 +467,7 @@
<view class="codefun-flex-col codefun-relative group_3"> <view class="codefun-flex-col codefun-relative group_3">
<view class="codefun-flex-col"> <view class="codefun-flex-col">
<view class="codefun-flex-col codefun-self-stretch group_4"> <view class="codefun-flex-col codefun-self-stretch group_4">
<view class="codefun-flex-col section_3"> <view class="codefun-flex-col section_3" :class="{ '!pb-6': !pageData.weather.warning }">
<view class="codefun-flex-row codefun-justify-between" style="align-items: center"> <view class="codefun-flex-row codefun-justify-between" style="align-items: center">
<view <view
class="codefun-flex-row codefun-items-center codefun-relative codefun-overflow-hidden" class="codefun-flex-row codefun-items-center codefun-relative codefun-overflow-hidden"
...@@ -474,7 +483,7 @@ ...@@ -474,7 +483,7 @@
style="width: 400rpx" style="width: 400rpx"
> >
<up-notice-bar <up-notice-bar
v-if="pageData.weather.detailedLocation != '获取中'" v-if="pageData.weather.detailedLocation !== '获取中'"
icon="" icon=""
bgColor="#FFFFFF00" bgColor="#FFFFFF00"
color="#5db66f" color="#5db66f"
...@@ -559,7 +568,18 @@ ...@@ -559,7 +568,18 @@
</view> </view>
</view> </view>
</view> </view>
<view class="codefun-flex-row section_4" v-if="pageData.weather.warning"> <view class="my-2" v-if="pageData.weather.warning">
<fui-notice-bar
:content="pageData.weather.warning"
scrollable
:padding="['0', '32rpx']"
>
<view class="fui-icon__box">
<fui-icon name="notice" :size="36" color="#FF2B2B" />
</view>
</fui-notice-bar>
</view>
<!-- <view class="codefun-flex-row section_4" v-if="pageData.weather.warning">
<image <image
class="codefun-shrink-0 image_10" class="codefun-shrink-0 image_10"
src="/static/images/codefun/344155285176a7ac7ccd670a2a1daf19.png" src="/static/images/codefun/344155285176a7ac7ccd670a2a1daf19.png"
...@@ -569,7 +589,7 @@ ...@@ -569,7 +589,7 @@
> >
<text class="text_12">{{ pageData.weather.warning }}</text> <text class="text_12">{{ pageData.weather.warning }}</text>
</view> </view>
</view> </view> -->
</view> </view>
<view class="codefun-flex-col codefun-relative section_5"> <view class="codefun-flex-col codefun-relative section_5">
<view class="codefun-flex-row"> <view class="codefun-flex-row">
...@@ -884,7 +904,7 @@ ...@@ -884,7 +904,7 @@
.section_3 { .section_3 {
width: 694rpx; width: 694rpx;
// margin-right: 28rpx; // margin-right: 28rpx;
padding: 20rpx 28rpx 58rpx; padding: 28rpx;
background-image: linear-gradient(180deg, #dcfce7 0%, #f8fef9 100%); background-image: linear-gradient(180deg, #dcfce7 0%, #f8fef9 100%);
border-radius: 16rpx; border-radius: 16rpx;
mix-blend-mode: NOTTHROUGH; mix-blend-mode: NOTTHROUGH;
...@@ -1184,7 +1204,7 @@ ...@@ -1184,7 +1204,7 @@
border-radius: 16rpx; border-radius: 16rpx;
mix-blend-mode: NOTTHROUGH; mix-blend-mode: NOTTHROUGH;
width: 32rpx; width: 32rpx;
height: 32rpx; height: 40rpx;
} }
.codefun-mr-4 { .codefun-mr-4 {
margin-right: 10rpx; margin-right: 10rpx;
......
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="64px" height="64.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M402.432 307.968m-286.5152 0a286.5152 286.5152 0 1 0 573.0304 0 286.5152 286.5152 0 1 0-573.0304 0Z" fill="#9FDFFF" /><path d="M731.648 498.5856m-253.0816 0a253.0816 253.0816 0 1 0 506.1632 0 253.0816 253.0816 0 1 0-506.1632 0Z" fill="#78CCFF" /><path d="M268.4416 522.4448m-229.2224 0a229.2224 229.2224 0 1 0 458.4448 0 229.2224 229.2224 0 1 0-458.4448 0Z" fill="#78CCFF" /><path d="M266.0864 522.4448h463.2064v229.2224H266.0864z" fill="#78CCFF" /><path d="M543.6416 260.864l-187.9552 293.888 189.7472 27.648L450.56 803.84l281.088-289.8944-213.8624-32.3584z" fill="#FFB612" /><path d="M297.6256 904.9088c0 37.8368-27.2896 68.4544-60.928 68.4544s-60.928-30.6688-60.928-68.4544c0-37.8368 60.928-112.7424 60.928-112.7424s60.928 74.9056 60.928 112.7424zM664.6784 904.9088c0 37.8368-27.2896 68.4544-60.928 68.4544s-60.928-30.6688-60.928-68.4544c0-37.8368 60.928-112.7424 60.928-112.7424s60.928 74.9056 60.928 112.7424z" fill="#78CCFF" /><path d="M481.1264 904.9088c0 37.8368-27.2896 68.4544-60.928 68.4544s-60.928-30.6688-60.928-68.4544c0-37.8368 60.928-112.7424 60.928-112.7424s60.928 74.9056 60.928 112.7424zM848.2304 904.9088c0 37.8368-27.2896 68.4544-60.928 68.4544s-60.928-30.6688-60.928-68.4544c0-37.8368 60.928-112.7424 60.928-112.7424s60.928 74.9056 60.928 112.7424z" fill="#9FDFFF" /></svg>
\ No newline at end of file
...@@ -11,7 +11,7 @@ interface AreaNode { ...@@ -11,7 +11,7 @@ interface AreaNode {
* 将areaList转换为树形结构(省市县三级联动) * 将areaList转换为树形结构(省市县三级联动)
* @returns 树形结构的地区数据 * @returns 树形结构的地区数据
*/ */
export const convertToTree = (): AreaNode[] => { export function convertToTree(): AreaNode[] {
const { province_list, city_list, county_list } = areaList const { province_list, city_list, county_list } = areaList
const tree: AreaNode[] = [] const tree: AreaNode[] = []
...@@ -56,7 +56,7 @@ export const convertToTree = (): AreaNode[] => { ...@@ -56,7 +56,7 @@ export const convertToTree = (): AreaNode[] => {
// 导出树形结构数据(懒加载) // 导出树形结构数据(懒加载)
let areaTreeCache: AreaNode[] | null = null let areaTreeCache: AreaNode[] | null = null
export const getAreaTree = (): AreaNode[] => { export function getAreaTree(): AreaNode[] {
if (!areaTreeCache) { if (!areaTreeCache) {
areaTreeCache = convertToTree() areaTreeCache = convertToTree()
} }
...@@ -71,18 +71,18 @@ export const areaTree = getAreaTree() ...@@ -71,18 +71,18 @@ export const areaTree = getAreaTree()
* @param code 地区代码 * @param code 地区代码
* @returns 完整的地区名称 * @returns 完整的地区名称
*/ */
export const getFullAreaName = (code: string): string => { export function getFullAreaName(code: string): string {
const { province_list, city_list, county_list } = areaList const { province_list, city_list, county_list } = areaList
let name = '' let name = ''
if (county_list[code]) { if (county_list[code]) {
// 如果是区县代码,获取完整的省市县名称 // 如果是区县代码,获取完整的省市县名称
const cityCode = code.substring(0, 4) + '00' const cityCode = `${code.substring(0, 4)}00`
const provinceCode = code.substring(0, 2) + '0000' const provinceCode = `${code.substring(0, 2)}0000`
name = `${province_list[provinceCode]}${city_list[cityCode]}${county_list[code]}` name = `${province_list[provinceCode]}${city_list[cityCode]}${county_list[code]}`
} else if (city_list[code]) { } else if (city_list[code]) {
// 如果是城市代码,获取完整的省市名称 // 如果是城市代码,获取完整的省市名称
const provinceCode = code.substring(0, 2) + '0000' const provinceCode = `${code.substring(0, 2)}0000`
name = `${province_list[provinceCode]}${city_list[code]}` name = `${province_list[provinceCode]}${city_list[code]}`
} else if (province_list[code]) { } else if (province_list[code]) {
// 如果是省份代码,直接返回省份名称 // 如果是省份代码,直接返回省份名称
...@@ -115,7 +115,5 @@ export function getCodeByText(text) { ...@@ -115,7 +115,5 @@ export function getCodeByText(text) {
return entry ? entry[0] : null return entry ? entry[0] : null
} }
return findCode(areaList.province_list) return findCode(areaList.province_list) || findCode(areaList.city_list) || findCode(areaList.county_list)
|| findCode(areaList.city_list)
|| findCode(areaList.county_list)
} }
...@@ -6,11 +6,11 @@ export default { ...@@ -6,11 +6,11 @@ export default {
/** /**
* 服务协议地址 * 服务协议地址
*/ */
services: 'https://app.yiring.com/agri/app/agreement.html', services: 'https://app.yiring.com/agri/services.html',
/** /**
* 隐私政策地址 * 隐私政策地址
*/ */
privacy: 'https://app.yiring.com/agri/app/guide.html', privacy: 'https://app.yiring.com/agri/privacy.html',
/** /**
* 从内部打开指定页面 * 从内部打开指定页面
......
...@@ -206,7 +206,7 @@ export function downloadFile(options: DownloadOptions): Promise<DownloadResult> ...@@ -206,7 +206,7 @@ export function downloadFile(options: DownloadOptions): Promise<DownloadResult>
/* #endif */ /* #endif */
// 其他平台使用原生下载 // 其他平台使用原生下载
/* #ifndef H5*/ /* #ifndef H5 */
return downloadFileForNative(options) return downloadFileForNative(options)
/* #endif */ /* #endif */
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论