提交 bacbcda4 作者: 方治民

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

上级 b6ddd368
# APP 名称
VITE_GLOB_APP_NAME = 数农服
VITE_GLOB_APP_NAME = 数农服
# APP 描述
VITE_GLOB_APP_DESCRIPTION = 湖南省农业服务平台
VITE_GLOB_APP_DESCRIPTION = 数字农服
# API 接口地址
# 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://111.22.182.169:49600
# VITE_GLOB_API_URL=http://36.133.16.81:42111
# API 接口地址前缀
# VITE_GLOB_API_URL_PREFIX=/jeecgboot
VITE_GLOB_API_URL_PREFIX=/jeecg-boot
VITE_GLOB_API_URL_PREFIX=/jeecgboot
# VITE_GLOB_API_URL_PREFIX=/jeecg-boot
......@@ -5,4 +5,5 @@
[ -n "$CI" ] && exit 0
# 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 {
*/
export function delDevice(id) {
return otherHttp.post({
url: '/device/delete?id='+id,
url: `/device/delete?id=${id}`,
})
}
/**
......@@ -71,7 +71,7 @@ export function getFarmbaseInfoById(params: any = {}) {
*/
export function delFarmbase(id) {
return otherHttp.delete({
url: '/farmbase/delete?id=' + id,
url: `/farmbase/delete?id=${id}`,
})
}
/**
......
......@@ -15,3 +15,10 @@ export function forecast(location: string) {
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">
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 * as ChanxiaoAPI from '@/api/model/chanxiao'
import PriceDialog from './components/price-dialog.vue'
// 下拉刷新
onPullDownRefresh(() => {
pageData.search.pageNo = 1
......@@ -130,8 +129,10 @@
pageData.search.pageNo = 1
pageData.purchaseDemands = []
pageData.supplyInfos = []
if (pageData.currentTransactionTab === 1) getPurchaseList()
if (pageData.currentTransactionTab === 2) getSupplyList()
if (pageData.currentTransactionTab === 1)
getPurchaseList()
if (pageData.currentTransactionTab === 2)
getSupplyList()
}
// 采购/供应标签点击事件
......@@ -141,8 +142,10 @@
pageData.search.pageNo = 1
pageData.purchaseDemands = []
pageData.supplyInfos = []
if (pageData.currentTransactionTab === 1) getPurchaseList()
if (pageData.currentTransactionTab === 2) getSupplyList()
if (pageData.currentTransactionTab === 1)
getPurchaseList()
if (pageData.currentTransactionTab === 2)
getSupplyList()
}
// 新需求提醒点击事件
......@@ -181,19 +184,20 @@
}
if (pageData.currentTransactionTab === 2) {
Navigate.to('/pages/chanxiao/supplyXuQiu')
return
}
}
onReachBottom(() => {
console.log('触底了')
if (pageData.currentTransactionTab === 1) {
if (pageData.total <= pageData.purchaseDemands.length) return
if (pageData.total <= pageData.purchaseDemands.length)
return
pageData.search.pageNo++
getPurchaseList()
}
if (pageData.currentTransactionTab === 2) {
if (pageData.total <= pageData.supplyInfos.length) return
if (pageData.total <= pageData.supplyInfos.length)
return
pageData.search.pageNo++
getSupplyList()
}
......@@ -252,7 +256,7 @@
v-if="pageData.currentTransactionTab === 2 && pageData.supplyInfos.length === 0"
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>
<!-- 供应信息列表 -->
<template v-for="(info, index) in pageData.supplyInfos" :key="info.id">
......@@ -315,7 +319,7 @@
v-if="pageData.currentTransactionTab === 1 && pageData.purchaseDemands.length === 0"
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 v-else>
<template v-for="(demand, index) in pageData.purchaseDemands" :key="demand.id">
......@@ -360,7 +364,7 @@
</text
>
<text v-if="demand.priceStart || demand.priceEnd" class="font_5">{{
demand.priceStart + '-' + demand.priceEnd
`${demand.priceStart}-${demand.priceEnd}`
}}</text>
<text v-if="demand.unit" class="font_7" :class="`text_${index === 0 ? 16 : 22}`"
>/{{ demand.unit }}</text
......@@ -397,17 +401,17 @@
</view>
<fui-fab position="right" distance="10" bottom="240" width="96" @click="handlePublish">
<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>
<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>
</fui-fab>
<price-dialog ref="priceDialogRef"></price-dialog>
<fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)"></fui-loading>
<PriceDialog ref="priceDialogRef" />
<fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)" />
</template>
<style scoped lang="scss">
......
......@@ -5,7 +5,7 @@
import { useGlobSetting } from '/@/hooks/setting'
import * as ChanxiaoAPI from '@/api/model/chanxiao'
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'
const dictStore = useDictStore()
......@@ -110,7 +110,7 @@
const { show, options, form } = toRefs(pageData)
function initDict() {
pageData.options.classify = dictStore.getDictList['classify'].map((item) => {
pageData.options.classify = dictStore.getDictList.classify.map((item) => {
return {
value: item.value,
text: item.text,
......@@ -120,7 +120,8 @@
}
function getCurrentAddressInfo() {
if (!uni.getStorageSync('location')) return
if (!uni.getStorageSync('location'))
return
const { lon, lat } = uni.getStorageSync('location')
UserInfoAPI.location({
......@@ -154,8 +155,8 @@
// 返回格式化的对象
return {
name: fileName,
extname: extname,
url: url,
extname,
url,
}
}
......@@ -178,7 +179,7 @@
// 文件上传
function handleUpload(file) {
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,
name: 'file',
formData: {
......@@ -235,7 +236,7 @@
* 处理地区值
* @param formData 表单数据
*/
const changeAddressValue = (formData) => {
function changeAddressValue(formData) {
const addressValue = formData.address.split('/')
if (addressValue.length === 3) {
formData.province = getCodeByText(addressValue[0])
......@@ -257,14 +258,14 @@
v-model="form.title"
labelSize="28"
label-width="180"
></fui-input>
/>
<fui-input
label="说明"
placeholder="请输入规格说明"
v-model="form.inputTextArea"
labelSize="28"
label-width="180"
></fui-input>
/>
</view>
<view class="mt20">
<!-- 价格区间 -->
......@@ -298,7 +299,7 @@
v-model="form.count"
labelSize="28"
label-width="180"
></fui-input>
/>
<fui-input
required
label="单位"
......@@ -306,7 +307,7 @@
v-model="form.unit"
labelSize="28"
label-width="180"
></fui-input>
/>
</view>
<view class="mt20">
<view class="form-item required flex align-center" style="padding: 20rpx 10rpx">
......@@ -350,19 +351,14 @@
:auto-upload="false"
@select="handleUpload"
@delete="handleDelete"
></uni-file-picker>
/>
</view>
<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>
</fui-form>
<fui-date-picker
:show="show.time"
type="3"
@change="handleChangeTime"
@cancel="show.time = false"
></fui-date-picker>
<fui-date-picker :show="show.time" type="3" @change="handleChangeTime" @cancel="show.time = false" />
<fui-picker
:show="show.classify"
:layer="1"
......@@ -370,7 +366,7 @@
:options="options.classify"
@change="handleChangeClassify"
@cancel="show.classify = false"
></fui-picker>
/>
<fui-picker
:show="show.address"
:options="options.address"
......@@ -378,9 +374,9 @@
:layer="3"
@change="handleChangeAddress"
@cancel="show.address = false"
></fui-picker>
/>
<fui-toast ref="toastRef"></fui-toast>
<fui-toast ref="toastRef" />
</view>
</view>
<fui-date-picker
......@@ -389,7 +385,7 @@
@change="handleChangeTime"
@cancel="show.time = false"
minDate="2025-01-01"
></fui-date-picker>
/>
<fui-picker
:show="show.classify"
:layer="1"
......@@ -397,7 +393,7 @@
:options="options.classify"
@change="handleChangeClassify"
@cancel="show.classify = false"
></fui-picker>
/>
<fui-picker
:show="show.address"
:options="options.address"
......@@ -405,9 +401,9 @@
:layer="3"
@change="handleChangeAddress"
@cancel="show.address = false"
></fui-picker>
/>
<fui-toast ref="toastRef"></fui-toast>
<fui-toast ref="toastRef" />
</template>
<style lang="scss" scoped>
......
<script setup lang="ts">
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 Navigate from '@/utils/page/navigate'
import { url } from 'inspector'
// 下拉刷新
onPullDownRefresh(() => {
......@@ -275,7 +274,7 @@
function onFarmMachineryServiceClick(service: any) {
console.log('点击农机服务:', service)
// 在这里添加具体的服务点击逻辑
Navigate.to('/pages/nongjifuwu/nongjifuwu?type=' + service.id)
Navigate.to(`/pages/nongjifuwu/nongjifuwu?type=${service.id}`)
}
// 技能培训点击事件
......@@ -474,7 +473,7 @@
>
<view class="codefun-flex-row codefun-items-center codefun-self-stretch">
<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>
<text
class="codefun-self-start font_10"
......
......@@ -2,6 +2,7 @@
import { reactive } from 'vue'
import * as LinghuoyonggongAPI from '@/api/model/linghuoyonggong'
import { useUserStore } from '@/store/modules/user'
const { getUserInfo } = useUserStore()
const pageData = reactive({
......@@ -62,33 +63,30 @@
close,
})
</script>
<template>
<fui-dialog title="" :buttons="[]" :show="pageData.show" maskClosable>
<view class="title flex justify-center">
<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 class="text-left">
<fui-form ref="formRef">
<fui-input
marginTop="30"
size="28"
placeholder="请填写预留姓名"
v-model="pageData.form.reservedname"
></fui-input>
<fui-input marginTop="30" size="28" placeholder="请填写预留姓名" v-model="pageData.form.reservedname" />
<fui-input
marginTop="30"
size="28"
placeholder="请填写预留手机"
v-model="pageData.form.reservedmobile"
></fui-input>
/>
<view style="margin-top: 30rpx">
<fui-button text="确定" bold radius="96rpx" @click="submit"></fui-button>
<fui-button text="确定" bold radius="96rpx" @click="submit" />
</view>
</fui-form>
</view>
</fui-dialog>
</template>
<style lang="scss" scoped>
:deep(.fui-dialog__body) {
background: linear-gradient(0deg, rgba(93, 182, 111, 0) 0%, rgba(93, 182, 111, 0.25) 100%);
......
......@@ -5,7 +5,7 @@
import { useGlobSetting } from '/@/hooks/setting'
import * as LinghuoyonggongAPI from '@/api/model/linghuoyonggong'
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'
const dictStore = useDictStore()
......@@ -124,15 +124,15 @@
function initDict() {
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 {
value: item.value,
text: item.text,
}
})
pageData.options.type = dictStore.getDictList['employment_type'].map((item) => {
pageData.options.type = dictStore.getDictList.employment_type.map((item) => {
return {
value: item.value,
text: item.text,
......@@ -141,7 +141,8 @@
}
function getCurrentAddressInfo() {
if (!uni.getStorageSync('location')) return
if (!uni.getStorageSync('location'))
return
const { lon, lat } = uni.getStorageSync('location')
UserInfoAPI.location({
......@@ -152,8 +153,7 @@
pageData.form.city = res.city
pageData.form.country = res.country
pageData.form.areaText = `${res.province}/${res.city}/${res.country}`
pageData.form.area =
getCodeByText(res.province) + ',' + getCodeByText(res.city) + ',' + getCodeByText(res.country)
pageData.form.area = `${getCodeByText(res.province)},${getCodeByText(res.city)},${getCodeByText(res.country)}`
})
}
......@@ -163,7 +163,7 @@
.then((res) => {
console.log(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.urgentdegreeText = pageData.options.urgentdegree.find(
(item) => item.value == pageData.form.urgentdegree,
......@@ -188,8 +188,8 @@
// 返回格式化的对象
return {
name: fileName,
extname: extname,
url: url,
extname,
url,
}
}
......@@ -221,7 +221,7 @@
// 文件上传
function handleUpload(file) {
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,
name: 'file',
formData: {
......@@ -287,7 +287,7 @@
v-model="form.name"
labelSize="28"
label-width="180"
></fui-input>
/>
<fui-input
required
label="工作内容"
......@@ -295,7 +295,7 @@
v-model="form.content"
labelSize="28"
label-width="180"
></fui-input>
/>
</view>
<view class="mt20">
<fui-input
......@@ -307,7 +307,7 @@
v-model="form.workers"
labelSize="28"
label-width="180"
></fui-input>
/>
<fui-input
required
type="number"
......@@ -317,7 +317,7 @@
v-model="form.price"
labelSize="28"
label-width="180"
></fui-input>
/>
<fui-input
required
label="类型"
......@@ -326,7 +326,7 @@
labelSize="28"
label-width="180"
@click="show.type = true"
></fui-input>
/>
</view>
<view class="mt20">
<fui-input
......@@ -337,7 +337,7 @@
labelSize="28"
label-width="180"
@click="show.area = true"
></fui-input>
/>
<fui-input
required
label="详细地址"
......@@ -345,7 +345,7 @@
v-model="form.address"
labelSize="28"
label-width="180"
></fui-input>
/>
<fui-input
required
label="紧急程度"
......@@ -354,7 +354,7 @@
labelSize="28"
label-width="180"
@click="show.urgentdegree = true"
></fui-input>
/>
<!-- 时间范围 -->
<view class="form-section" style="padding: 0 30rpx">
<view class="form-item flex align-center">
......@@ -384,27 +384,17 @@
:auto-upload="false"
@select="handleUpload"
@delete="handleDelete"
></uni-file-picker>
/>
</view>
<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>
</fui-form>
</view>
</view>
<fui-date-picker
:show="show.time1"
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-date-picker :show="show.time1" type="3" @change="handleChangeTime1" @cancel="show.time1 = false" />
<fui-date-picker :show="show.time2" type="3" @change="handleChangeTime2" @cancel="show.time2 = false" />
<fui-picker
:show="show.type"
:layer="1"
......@@ -412,7 +402,7 @@
:options="options.type"
@change="handleChangetype"
@cancel="show.type = false"
></fui-picker>
/>
<fui-picker
:show="show.urgentdegree"
:layer="1"
......@@ -420,7 +410,7 @@
:options="options.urgentdegree"
@change="handleChangeUrgentdegree"
@cancel="show.urgentdegree = false"
></fui-picker>
/>
<fui-picker
:show="show.area"
:options="options.area"
......@@ -428,10 +418,10 @@
:layer="3"
@change="handleChangeAddress"
@cancel="show.area = false"
></fui-picker>
/>
<fui-toast ref="toastRef"></fui-toast>
<fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)"></fui-loading>
<fui-toast ref="toastRef" />
<fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)" />
</template>
<style lang="scss" scoped>
......
<script setup lang="ts">
import { reactive } from 'vue'
import { onLoad, onReachBottom, onShow } from '@dcloudio/uni-app'
import RegisterDialog from './components/register-dialog.vue'
import { onPullDownRefresh, onLoad, onShow, onReachBottom } from '@dcloudio/uni-app'
import { areaTree, getTextByCode, getCodeByText } from '@/utils/areaData'
import { getTextByCode } from '@/utils/areaData'
import * as LinghuoyonggongAPI from '@/api/model/linghuoyonggong'
import Navigate from '@/utils/page/navigate'
......@@ -181,7 +181,7 @@
item.area = areaCache.get(cacheKey)
} else {
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)
item.area = areaText
}
......@@ -248,7 +248,7 @@
function onEmploymentItemClick(item: any) {
console.log('点击用工项:', item)
// 在这里添加具体的用工项点击逻辑
Navigate.to('/pages/linghuoyonggong/form?id=' + item.id)
Navigate.to(`/pages/linghuoyonggong/form?id=${item.id}`)
}
// "我想去"按钮点击事件
......@@ -270,7 +270,7 @@
// 检查日期是否有效
if (isNaN(d1.getTime()) || isNaN(d2.getTime())) {
throw new Error('无效的日期格式')
throw new TypeError('无效的日期格式')
}
// 设置时间部分为00:00:00,只比较日期部分
......@@ -287,7 +287,8 @@
}
onReachBottom(() => {
console.log('触底了')
if (pageData.total <= pageData.employmentList.length) return
if (pageData.total <= pageData.employmentList.length)
return
pageData.search.pageNo++
getEmploymentList()
})
......@@ -325,7 +326,7 @@
</view>
<view class="codefun-flex-col codefun-relative list">
<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>
<template v-else>
<view
......@@ -393,12 +394,12 @@
<fui-fab position="right" distance="10" bottom="240" width="96" @click="handlePublish">
<view class="text-white text-center">
<!-- <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>
</fui-fab>
<register-dialog ref="registerDialogRef"></register-dialog>
<fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)"></fui-loading>
<RegisterDialog ref="registerDialogRef" />
<fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)" />
</template>
<style scoped lang="scss">
......
......@@ -53,7 +53,7 @@
})
// 页面数据
const defaultText = '湖南省农业服务平台'
const defaultText = '数字农服'
const readConfirmShow = ref<boolean>(false)
const form = ref()
const model = reactive({
......@@ -280,7 +280,7 @@
:loading="model.loading"
/>
</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>
<!-- </view> -->
<fui-checkbox-group class="checkbox" name="checkbox">
......@@ -464,6 +464,7 @@
:deep(.fui-input__border-bottom) {
right: 32rpx !important;
}
.btn-register {
color: cadetblue;
}
......
......@@ -56,7 +56,7 @@
// 注册参数
const params = {
phone: model.form.data.phone,
password: model.form.data.password,
password: model.form.data.password || '123@2025',
code: model.form.data.code,
}
......@@ -179,6 +179,7 @@
<template>
<view class="warp">
<!-- <image class="login-warp" src="/static/login/login_bg.png" /> -->
<view class="register-form">
<view class="register-bg-wrap">
<!-- <image class="register-bg" src="/static/images/register/register.png" /> -->
<view class="logo-content-wrap">
......@@ -186,7 +187,6 @@
<view class="logo-text">数字农业服务平台</view>
</view>
</view>
<view class="register-form">
<fui-form class="form" ref="form" top="50" :padding="['0rpx', '32rpx']">
<view class="reigister-form-item">
<image class="reigister-form-image" src="/static/images/register/user.png" />
......@@ -207,13 +207,13 @@
maxlength="11"
/>
<view class="reigister-form-item">
<view class="reigister-form-item !hidden">
<image class="reigister-form-image" src="/static/images/register/pwd.png" />
<text>密码</text>
</view>
<fui-input
height="100rpx"
class="input"
class="input !hidden"
password
autocomplete="new-password"
code
......@@ -321,30 +321,33 @@
flex-direction: column;
justify-content: 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-repeat: no-repeat;
background-position: center;
.logo-content-wrap {
display: flex;
flex-direction: column;
justify-content: left;
align-items: flex-start;
width: 86%;
.logo-text-1 {
font-size: 30rpx;
font-weight: 400;
letter-spacing: 0px;
letter-spacing: 0;
margin-top: 4.25rem;
color: rgba(51, 51, 51, 0.7);
color: rgb(51 51 51 / 70%);
vertical-align: middle;
}
.logo-text {
font-size: 40rpx;
font-weight: 500;
letter-spacing: 0px;
letter-spacing: 0;
margin-top: 40rpx;
color: rgba(51, 51, 51, 1);
color: rgb(51 51 51 / 100%);
vertical-align: middle;
}
}
......@@ -354,18 +357,19 @@
position: absolute;
width: 100%;
height: 60vh;
left: 0px;
top: 450rpx;
left: 0;
top: 0;
opacity: 1;
border-radius: 14.03px 14.03px 0px 0px;
border-radius: 14.03px 14.03px 0 0;
border: 1px solid #fff;
background: linear-gradient(
180deg,
rgba(181, 238, 215, 1) 0%,
rgba(181, 238, 215, 0.5) 30%,
rgba(255, 255, 255, 0.8) 100%
rgb(181 238 215 / 100%) 0%,
rgb(181 238 215 / 50%) 30%,
rgb(255 255 255 / 80%) 100%
);
}
.reigister-form-item {
color: #000;
display: flex;
......@@ -373,10 +377,12 @@
justify-content: left;
align-items: center;
margin: 10rpx;
.reigister-form-image {
width: 60rpx;
height: 60rpx;
}
text {
font-size: 32rpx;
display: flex;
......@@ -384,11 +390,11 @@
margin-left: 20rpx;
}
}
.form {
position: absolute;
top: 80rpx;
width: 100%;
z-index: 10;
margin-top: 540rpx;
}
.checkbox {
......@@ -421,6 +427,7 @@
:deep(.fui-input__border-bottom) {
right: 32rpx !important;
}
.btn-register {
color: cadetblue;
}
......
<script setup lang="ts">
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 { useGlobSetting } from '/@/hooks/setting'
import * as NongchangAPI from '@/api/model/nongchang'
......@@ -112,13 +112,13 @@
function initDict() {
pageData.options.address = areaTree
pageData.options.mainProducts = dictStore.getDictList['main_business'].map((item) => {
pageData.options.mainProducts = dictStore.getDictList.main_business.map((item) => {
return {
value: item.value,
text: item.text,
}
})
pageData.options.farmType = dictStore.getDictList['farm_type'].map((item) => {
pageData.options.farmType = dictStore.getDictList.farm_type.map((item) => {
return {
value: item.value,
text: item.text,
......@@ -148,7 +148,7 @@
function handleUpload(file) {
pageData.loading = true
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,
name: 'file',
formData: {
......@@ -212,38 +212,21 @@
<template>
<fui-form ref="formRef">
<fui-input required label="农场名称" placeholder="请输入农场名称" v-model="form.farmName"></fui-input>
<fui-input required label="农场标语" placeholder="请输入农场标语" v-model="form.title"></fui-input>
<fui-input required label="农场名称" placeholder="请输入农场名称" v-model="form.farmName" />
<fui-input required label="农场标语" placeholder="请输入农场标语" v-model="form.title" />
<fui-input
required
label="农场类型"
placeholder="请选择农场类型"
v-model="form.farmTypeText"
@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.contactPhone"></fui-input>
<fui-textarea
required
label="农场描述"
placeholder="请输入农场描述"
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 required label="联系人" placeholder="请输入联系人" v-model="form.contactPerson" />
<fui-input required label="联系电话" placeholder="请输入联系电话" v-model="form.contactPhone" />
<fui-textarea required label="农场描述" placeholder="请输入农场描述" v-model="pageData.form.description" />
<fui-input required label="地区" placeholder="请选择地区" v-model="form.address" @click="show.address = true" />
<fui-input required label="详细地址" placeholder="请输入详细地址" v-model="form.addressDetail" />
<fui-input required label="主营业务" borderTop placeholder="请输入主营业务" v-model="form.mainBusiness" />
<fui-input
required
label="主要产品"
......@@ -251,14 +234,8 @@
placeholder="请选择主要产品"
v-model="form.mainProductsText"
@click="show.mainProducts = true"
></fui-input>
<fui-input
required
label="总面积(亩)"
borderTop
placeholder="请输入总面积"
v-model="form.totalArea"
></fui-input>
/>
<fui-input required label="总面积(亩)" borderTop placeholder="请输入总面积" v-model="form.totalArea" />
<view class="bg-white" style="padding: 0.875rem 0.35rem">
<view class="mb-1 flex justify-start"> 封面图片 </view>
<uni-file-picker
......@@ -267,10 +244,10 @@
:auto-upload="false"
@select="handleUpload"
@delete="handleDelete"
></uni-file-picker>
/>
</view>
<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>
</fui-form>
......@@ -281,7 +258,7 @@
:options="options.farmType"
@change="handleChangeFarmType"
@cancel="show.farmType = false"
></fui-picker>
/>
<fui-picker
:show="show.mainProducts"
:layer="1"
......@@ -289,7 +266,7 @@
:options="options.mainProducts"
@change="handleChangeMainProducts"
@cancel="show.mainProducts = false"
></fui-picker>
/>
<fui-picker
:show="show.address"
:options="options.address"
......@@ -297,10 +274,10 @@
:layer="3"
@change="handleChangeAddress"
@cancel="show.address = false"
></fui-picker>
/>
<fui-toast ref="toastRef"></fui-toast>
<fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)"></fui-loading>
<fui-toast ref="toastRef" />
<fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)" />
</template>
<style lang="scss" scoped>
......
<script setup lang="ts">
import { reactive } from 'vue'
import * as NongjifuwuAPI from '@/api/model/nongjifuwu'
import { getCurrentDate } from '@/utils/date'
import { useUserStore } from '@/store/modules/user'
const { getUserInfo } = useUserStore()
const pageData = reactive({
......@@ -112,60 +112,36 @@
close,
})
</script>
<template>
<fui-dialog title="" :buttons="[]" :show="pageData.show" maskClosable>
<view class="title flex justify-center">
<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 class="text-left">
<fui-form ref="formRef">
<fui-input
marginTop="30"
size="24"
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 marginTop="30" size="24" placeholder="请填写预留手机" v-model="pageData.form.phone" />
<fui-input marginTop="30" size="24" placeholder="请填写作业地区" v-model="pageData.form.scope" />
<fui-input marginTop="30" size="24" placeholder="请填写作业详细地址" v-model="pageData.form.address" />
<fui-input
marginTop="30"
size="24"
placeholder="请选择作业时间"
v-model="pageData.form.time"
@click="dict.show.time = true"
></fui-input>
<fui-textarea
v-model="pageData.form.demand"
:marginTop="30"
size="24"
placeholder="简要说明作业需求"
></fui-textarea>
/>
<fui-textarea v-model="pageData.form.demand" :marginTop="30" size="24" placeholder="简要说明作业需求" />
<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>
</fui-form>
</view>
</fui-dialog>
<fui-date-picker
:show="dict.show.time"
type="3"
range
@change="handleTimeChange"
@cancel="handleTimeCancel"
></fui-date-picker>
<fui-date-picker :show="dict.show.time" type="3" range @change="handleTimeChange" @cancel="handleTimeCancel" />
</template>
<style lang="scss" scoped>
:deep(.fui-dialog__body) {
background: linear-gradient(0deg, rgba(93, 182, 111, 0) 0%, rgba(93, 182, 111, 0.25) 100%);
......
......@@ -124,8 +124,8 @@
// 返回格式化的对象
return {
name: fileName,
extname: extname,
url: url,
extname,
url,
}
}
......@@ -147,7 +147,7 @@
// 文件上传
function handleUpload(file) {
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,
name: 'file',
formData: {
......@@ -213,7 +213,7 @@
v-model="form.name"
labelSize="28"
label-width="180"
></fui-input>
/>
<view class="form-item required flex align-center" style="padding: 20rpx 10rpx">
<text class="label">服务范围</text>
<view class="time-input" @click="show.address = true">
......@@ -237,7 +237,7 @@
v-model="form.address"
labelSize="28"
label-width="180"
></fui-input>
/>
<fui-input
required
label="联系方式"
......@@ -245,7 +245,7 @@
v-model="form.phone"
labelSize="28"
label-width="180"
></fui-input>
/>
</view>
<view class="mt20">
<fui-input
......@@ -255,7 +255,7 @@
v-model="form.demand"
labelSize="28"
label-width="180"
></fui-input>
/>
<!-- 作业时间 -->
<view class="form-section" style="padding: 0 10rpx">
<view class="form-item flex align-center">
......@@ -286,10 +286,10 @@
:auto-upload="false"
@select="handleUpload"
@delete="handleDelete"
></uni-file-picker>
/>
</view>
<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>
</fui-form>
......@@ -299,17 +299,17 @@
@change="handleChangeTime1"
@cancel="show.time1 = false"
minDate="2025-01-01"
></fui-date-picker>
/>
<fui-date-picker
:show="show.time2"
type="3"
@change="handleChangeTime2"
@cancel="show.time2 = false"
minDate="2025-01-01"
></fui-date-picker>
/>
<fui-toast ref="toastRef"></fui-toast>
<fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)"></fui-loading>
<fui-toast ref="toastRef" />
<fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)" />
<fui-picker
:show="show.address"
:options="options.address"
......@@ -317,7 +317,7 @@
:layer="3"
@change="handleChangeAddress"
@cancel="show.address = false"
></fui-picker>
/>
</view>
</view>
</template>
......
......@@ -6,6 +6,7 @@
import * as nongjifuwu from '@/api/model/nongjifuwu'
import { useDictStore } from '@/store/modules/dict'
import { areaTree } from '@/utils/areaData'
const dictStore = useDictStore()
const userStore = useUserStore()
const globSetting = useGlobSetting()
......@@ -111,8 +112,8 @@
// 返回格式化的对象
return {
name: fileName,
extname: extname,
url: url,
extname,
url,
}
}
......@@ -121,7 +122,7 @@
// 文件上传
function handleUpload(file) {
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,
name: 'file',
formData: {
......@@ -178,6 +179,7 @@
pageData.show.address = false
}
</script>
<template>
<view class="page">
<view class="formBox">
......@@ -190,7 +192,7 @@
v-model="form.name"
labelSize="28"
label-width="180"
></fui-input>
/>
<fui-input
required
label="联系方式"
......@@ -198,7 +200,7 @@
v-model="form.phone"
labelSize="28"
label-width="180"
></fui-input>
/>
<view class="form-item required flex align-center" style="padding: 20rpx 10rpx">
<text class="label">服务范围</text>
<view class="time-input" @click="show.address = true">
......@@ -225,7 +227,7 @@
v-model="form.price"
labelSize="28"
label-width="180"
></fui-input>
/>
</view>
<view class="bg-white mt20" style="padding: 0.875rem 1rem">
......@@ -238,16 +240,16 @@
:auto-upload="false"
@select="handleUpload"
@delete="handleDelete"
></uni-file-picker>
/>
</view>
<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>
</fui-form>
<fui-toast ref="toastRef"></fui-toast>
<fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)"></fui-loading>
<fui-toast ref="toastRef" />
<fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)" />
<fui-picker
:show="show.address"
:options="options.address"
......@@ -255,7 +257,7 @@
:layer="3"
@change="handleChangeAddress"
@cancel="show.address = false"
></fui-picker>
/>
</view>
</view>
</template>
......
<script setup lang="ts">
import { reactive } from 'vue'
import { onLoad, onReachBottom, onShow } from '@dcloudio/uni-app'
import ApplyDialog from './components/apply-dialog.vue'
import { onPullDownRefresh, onLoad, onShow, onReachBottom } from '@dcloudio/uni-app'
import * as NongjifuwuAPI from '@/api/model/nongjifuwu'
import Navigate from '@/utils/page/navigate'
......@@ -80,7 +80,8 @@
onReachBottom(() => {
console.log('触底了')
if (pageData.total <= pageData.farmMachineList.length) return
if (pageData.total <= pageData.farmMachineList.length)
return
pageData.search.pageNo++
getFarmMachineList()
})
......@@ -117,7 +118,7 @@
class="codefun-flex-col codefun-relative section_4"
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 class="codefun-flex-col codefun-relative section_4">
<view class="codefun-flex-row group_6" v-for="item in pageData.farmMachineList" :key="item.id">
......@@ -272,13 +273,13 @@
</view>
<fui-fab position="right" distance="10" bottom="240" width="96" @click="handlePublish">
<view class="text-white text-center">
<view class="fab-icon"></view>
<view class="fab-icon" />
<view style="font-size: 24rpx">发布</view>
</view>
</fui-fab>
<ApplyDialog ref="applyDialogRef"></ApplyDialog>
<fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)"></fui-loading>
<ApplyDialog ref="applyDialogRef" />
<fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)" />
</template>
<style scoped lang="scss">
......
<script setup lang="ts">
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 { useDictStore } from '@/store/modules/dict'
......@@ -113,7 +113,7 @@
})
function initDict() {
pageData.categoryList1 = dictStore.getDictList['category'].map((item) => {
pageData.categoryList1 = dictStore.getDictList.category.map((item) => {
return {
text: item.text,
value: item.value,
......@@ -181,7 +181,8 @@
}
onReachBottom(() => {
if (pagedata.total <= pageData.products.length) return
if (pagedata.total <= pageData.products.length)
return
pageData.search.pageNo++
getGoodsList()
})
......@@ -215,7 +216,7 @@
<view class="fui-filter__item" @tap="filterTap1">
<text>{{ pageData.range1 }}</text>
<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>
</fui-dropdown-menu>
......@@ -232,14 +233,14 @@
<view class="fui-filter__item" @tap="filterTap2">
<text>{{ pageData.range2 }}</text>
<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>
</fui-dropdown-menu>
</view>
<view class="codefun-mt-6 codefun-flex-col codefun-self-stretch">
<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>
<template v-else>
<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">
import { ref, reactive, watch, computed } from 'vue'
import { computed, reactive, ref, watch } from 'vue'
import { useUserStore } from '@/store/modules/user'
import { useGlobSetting } from '/@/hooks/setting'
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>(), {
show: false,
......@@ -79,6 +17,14 @@
submitSuccess: []
}>()
const lemonjkFileSelect = uni.requireNativePlugin('lemonjk-FileSelect')
// 定义Props
interface Props {
show: boolean
editData?: any
}
// 表单引用
const formRef = ref()
const loading = ref(false)
......@@ -155,7 +101,7 @@
)
// 重置表单数据
const resetFormData = () => {
function resetFormData() {
formData.fileName = ''
formData.fileType = ''
formData.fileTypeText = ''
......@@ -168,8 +114,9 @@
}
// 加载编辑数据
const loadEditData = () => {
if (!props.editData) return
function loadEditData() {
if (!props.editData)
return
formData.fileName = props.editData.fileName || ''
formData.fileType = props.editData.fileType || ''
......@@ -180,7 +127,7 @@
}
const uplpoadFile = ref(null)
// 选择文件
const chooseFile = () => {
function chooseFile() {
// #ifdef H5
uni.chooseFile({
count: 1,
......@@ -219,7 +166,7 @@
// #ifndef H5
lemonjkFileSelect.showNativePicker(
{
//各属性配置见下方【showPicker可配置参数说明】
// 各属性配置见下方【showPicker可配置参数说明】
pathScope: '/Download',
mimeType: '*/*',
utisType: ['public.data'],
......@@ -243,7 +190,7 @@
}
// 移除文件
const removeFile = () => {
function removeFile() {
formData.file = null
// 移除文件后触发验证
if (formRef.value) {
......@@ -252,7 +199,7 @@
}
// 根据文件扩展名获取文件类型
const getFileTypeByExt = (ext) => {
function getFileTypeByExt(ext) {
const map = {
doc: 'doc',
docx: 'doc',
......@@ -280,7 +227,7 @@
const userStore = useUserStore()
const globSetting = useGlobSetting()
// 提交表单
const handleSubmit = async () => {
async function handleSubmit() {
try {
console.log(formData)
// 先进行表单验证
......@@ -313,7 +260,7 @@
// API留空
console.log('上传资源数据:', submitData)
uni.uploadFile({
url: globSetting.apiUrl + globSetting.urlPrefix + '/sys/common/upload', // 直接使用上传接口URL
url: `${globSetting.apiUrl + globSetting.urlPrefix}/sys/common/upload`, // 直接使用上传接口URL
filePath: uplpoadFile.value,
name: 'file',
formData: {
......@@ -377,12 +324,67 @@
}
// 关闭弹窗
const handleClose = () => {
function handleClose() {
emit('update:show', false)
emit('close')
}
</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>
.dialog-content {
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>
import { nextTick, reactive, ref } from 'vue'
import { onLoad, onNavigationBarButtonTap, onShow } from '@dcloudio/uni-app'
import * as API from '@/api/model/wode'
import { reactive, ref } from 'vue'
import { onNavigationBarButtonTap } from '@dcloudio/uni-app'
import SaveDialog from './components/save-dialog.vue'
import * as API from '@/api/model/wode'
const isOnePage = ref(true)
const paging = ref(null)
......@@ -104,19 +43,20 @@
showAddDialog()
})
const showAddDialog = () => {
function showAddDialog() {
currentEditData.value = null
showDialog.value = true
}
// 格式化时间显示
const formatTime = (time) => {
if (!time) return ''
function formatTime(time) {
if (!time)
return ''
// 如果是完整的时间字符串,可以格式化为图片中的样式
return time.includes(' ') ? time : `${time} 14:00`
}
// 下载资源
const handleDownload = async (resource) => {
async function handleDownload(resource) {
await API.downloadResource({ id: resource.id })
// 更新下载次数
const index = pageData.list.findIndex((item) => item.id === resource.id)
......@@ -134,21 +74,83 @@
}
// 格式化文件大小
const formatFileSize = (bytes) => {
if (!bytes) return '125kb'
function formatFileSize(bytes) {
if (!bytes)
return '125kb'
const k = 1024
const sizes = ['B', 'KB', 'MB', 'GB']
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
// 重新加载数据
handleSearch()
}
</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">
body {
background: #e6f5e8;
......
......@@ -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 @@
}
// 农产品关注点击事件
function onProductFollowClick(product: any) {
function _onProductFollowClick(product: any) {
console.log('点击关注农产品:', product)
// 在这里添加具体的关注逻辑
}
// 查看更多农技课堂
function onViewMoreClass() {
function _onViewMoreClass() {
console.log('查看全部农技课堂')
// 在这里添加具体的查看逻辑
}
......@@ -389,7 +398,7 @@
// 轮播视频切换的时候触发
function handleChangeVideo(e: any) {
const currentIndex = e.detail.current
const prevIndex = pageData.current
const _prevIndex = pageData.current
pageData.current = currentIndex
pageData.agricultureClass.title = pageData.agricultureClass.videoList[currentIndex]?.title
......@@ -458,7 +467,7 @@
<view class="codefun-flex-col codefun-relative group_3">
<view class="codefun-flex-col">
<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-items-center codefun-relative codefun-overflow-hidden"
......@@ -474,7 +483,7 @@
style="width: 400rpx"
>
<up-notice-bar
v-if="pageData.weather.detailedLocation != '获取中'"
v-if="pageData.weather.detailedLocation !== '获取中'"
icon=""
bgColor="#FFFFFF00"
color="#5db66f"
......@@ -559,7 +568,18 @@
</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
class="codefun-shrink-0 image_10"
src="/static/images/codefun/344155285176a7ac7ccd670a2a1daf19.png"
......@@ -569,7 +589,7 @@
>
<text class="text_12">{{ pageData.weather.warning }}</text>
</view>
</view>
</view> -->
</view>
<view class="codefun-flex-col codefun-relative section_5">
<view class="codefun-flex-row">
......@@ -884,7 +904,7 @@
.section_3 {
width: 694rpx;
// margin-right: 28rpx;
padding: 20rpx 28rpx 58rpx;
padding: 28rpx;
background-image: linear-gradient(180deg, #dcfce7 0%, #f8fef9 100%);
border-radius: 16rpx;
mix-blend-mode: NOTTHROUGH;
......@@ -1184,7 +1204,7 @@
border-radius: 16rpx;
mix-blend-mode: NOTTHROUGH;
width: 32rpx;
height: 32rpx;
height: 40rpx;
}
.codefun-mr-4 {
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 {
* 将areaList转换为树形结构(省市县三级联动)
* @returns 树形结构的地区数据
*/
export const convertToTree = (): AreaNode[] => {
export function convertToTree(): AreaNode[] {
const { province_list, city_list, county_list } = areaList
const tree: AreaNode[] = []
......@@ -56,7 +56,7 @@ export const convertToTree = (): AreaNode[] => {
// 导出树形结构数据(懒加载)
let areaTreeCache: AreaNode[] | null = null
export const getAreaTree = (): AreaNode[] => {
export function getAreaTree(): AreaNode[] {
if (!areaTreeCache) {
areaTreeCache = convertToTree()
}
......@@ -71,18 +71,18 @@ export const areaTree = getAreaTree()
* @param code 地区代码
* @returns 完整的地区名称
*/
export const getFullAreaName = (code: string): string => {
export function getFullAreaName(code: string): string {
const { province_list, city_list, county_list } = areaList
let name = ''
if (county_list[code]) {
// 如果是区县代码,获取完整的省市县名称
const cityCode = code.substring(0, 4) + '00'
const provinceCode = code.substring(0, 2) + '0000'
const cityCode = `${code.substring(0, 4)}00`
const provinceCode = `${code.substring(0, 2)}0000`
name = `${province_list[provinceCode]}${city_list[cityCode]}${county_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]}`
} else if (province_list[code]) {
// 如果是省份代码,直接返回省份名称
......@@ -115,7 +115,5 @@ export function getCodeByText(text) {
return entry ? entry[0] : null
}
return findCode(areaList.province_list)
|| findCode(areaList.city_list)
|| findCode(areaList.county_list)
return findCode(areaList.province_list) || findCode(areaList.city_list) || findCode(areaList.county_list)
}
......@@ -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>
/* #endif */
// 其他平台使用原生下载
/* #ifndef H5*/
/* #ifndef H5 */
return downloadFileForNative(options)
/* #endif */
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论