提交 725577fa 作者: 方治民

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

# 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
{ {
"name": "数字农服", "name": "数字农服",
"version": "1.0.25", "version": "1.0.29",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "数字农服", "name": "数字农服",
"version": "1.0.25", "version": "1.0.29",
"dependencies": { "dependencies": {
"@dcloudio/uni-app": "3.0.0-4060620250520001", "@dcloudio/uni-app": "3.0.0-4060620250520001",
"@dcloudio/uni-app-plus": "3.0.0-4060620250520001", "@dcloudio/uni-app-plus": "3.0.0-4060620250520001",
{ {
"name": "数字农服", "name": "湘农数智农服",
"version": "1.0.29", "version": "1.0.29",
"description": "数字农服", "description": "湘农数智农服",
"keywords": [ "keywords": [
"app", "app",
"basic" "basic"
......
...@@ -3,6 +3,7 @@ import { otherHttp } from '/@/utils/http/axios' ...@@ -3,6 +3,7 @@ import { otherHttp } from '/@/utils/http/axios'
enum Api { enum Api {
cascaderHn = '/region/cascader/hn', // 获取湖南省内 市/区县/乡镇级联数据 cascaderHn = '/region/cascader/hn', // 获取湖南省内 市/区县/乡镇级联数据
queryByType = '/banner/queryByType', // 获取开屏页背景图片
} }
/** /**
...@@ -14,3 +15,16 @@ export function cascaderHn() { ...@@ -14,3 +15,16 @@ export function cascaderHn() {
url: Api.cascaderHn, url: Api.cascaderHn,
}) })
} }
/**
* 获取开屏页大背景图片
* @returns 大背景图片
*/
export function getQueryByType(params = {}) {
return otherHttp.get({
url: Api.queryByType,
params,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
}
})
}
\ No newline at end of file
...@@ -7,7 +7,62 @@ enum Api { ...@@ -7,7 +7,62 @@ enum Api {
employmentDetails = '/employment/queryById', // 查看用工详情 employmentDetails = '/employment/queryById', // 查看用工详情
employmentEdit = '/employment/app/edit', // 编辑用工 employmentEdit = '/employment/app/edit', // 编辑用工
employmentRegister = '/employment/app/register', // 报名用工 employmentRegister = '/employment/app/register', // 报名用工
queryConditions = '/sys/region/queryConditions', // 组合条件查询市——村
gitListByCodeDict = '/sys/dictItem/listByCode', // 查询字典
queryByCategoryAndCode = '/sys/labelCategory/queryByCategoryAndCode', // 查询字典
postLaborAdd = '/server/labor/add', // 新增
}
/**
* @param params 请求参数
* @description: 找人干活发布 新增
*/
export function postLaborAdd(params = {}) {
return otherHttp.post({
url: Api.postLaborAdd,
params,
})
}
/**
* @param params 查询指定分类和编码下的子类
* @description: 找人干活发布 获取人员技能
*/
export function queryByCategoryAndCode(params = {}) {
return otherHttp.get({
url: Api.queryByCategoryAndCode,
params,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
})
}
/**
* @param params 请求参数
* @description: 找人干活发布 获取字典值
*/
export function gitListByCodeDict(params = {}) {
return otherHttp.get({
url: Api.gitListByCodeDict,
params,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
})
} }
/**
* @param params 请求参数
* @description: 找人干活发布 获取到村
*/
export function queryConditions(params = {}) {
return otherHttp.post({
url: Api.queryConditions,
params,
})
}
/** /**
* @param params 请求参数 * @param params 请求参数
* @description: 用工列表 * @description: 用工列表
......
...@@ -4,8 +4,10 @@ enum Api { ...@@ -4,8 +4,10 @@ enum Api {
getUserInfo = '/sys/user/login/setting/getUserData', // 查询登录用户信息 getUserInfo = '/sys/user/login/setting/getUserData', // 查询登录用户信息
logout = '/sys/logout', // 登出 logout = '/sys/logout', // 登出
sysLogin = '/sys/mLogin', // 登陆 sysLogin = '/sys/mLogin', // 登陆
/* phoneLogin = '/sys/phoneLogin',
sms = '/sys/sms', */
phoneLogin = '/sys/phoneLogin', phoneLogin = '/sys/phoneLogin',
sms = '/sys/sms', sms = '/sys/getLoginVerifyCode',
dictList = '/sys/dict/queryAllDictItems', // 获取字典数据 dictList = '/sys/dict/queryAllDictItems', // 获取字典数据
location = '/tianditu/geocode', // 根据经纬度获取地址 location = '/tianditu/geocode', // 根据经纬度获取地址
sysRegister = '/app/user/register', // 注册 sysRegister = '/app/user/register', // 注册
......
...@@ -47,3 +47,26 @@ ...@@ -47,3 +47,26 @@
.align-center{ .align-center{
align-items: center; align-items: center;
} }
.yr_person_popup{
padding-top: 36rpx;
padding-left: 26rpx;
padding-right: 24rpx;
padding-bottom: 48rpx;
.popup_top{
display:flex;
justify-content: space-between;
.add_person_text{
color: #333333;
font-size: 28rpx;
}
.del_person_btn{
font-size: 28rpx;
color: #FF8063;
}
}
.popup_content{
}
}
{ {
"name": "数字农服", "name": "湘农数智农服",
"appid": "__UNI__FD09823", "appid": "__UNI__FD09823",
"description": "数字农服 APP", "description": "湘农数智农服 APP",
"versionName": "1.0.29", "versionName": "1.0.29",
"versionCode": 10029, "versionCode": 10029,
"transformPx": false, "transformPx": false,
......
{ {
"pages": [ "pages": [
{ {
"path": "pages/splash/splash",
"style": {
"navigationStyle": "custom",
"transparentTitle": "auto",
"backgroundColor": "#FFFFFF",
"enablePullDownRefresh": false,
"app-plus": {
"titleNView": {}
}
}
},
{
"path": "pages/login/login", "path": "pages/login/login",
"style": { "style": {
"navigationStyle": "custom", "navigationStyle": "custom",
...@@ -402,6 +414,32 @@ ...@@ -402,6 +414,32 @@
} }
}, },
{ {
"path": "pages/linghuoyonggong/publishEmployment",
"style": {
"navigationBarTitleText": "发布",
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#5DB66F",
"navigationBarTextStyle": "white",
"backgroundColorBottom": "#F2F2F2",
"app-plus": {
"titleNView": {}
}
}
},
{
"path": "pages/linghuoyonggong/details",
"style": {
"navigationBarTitleText": "详情",
"enablePullDownRefresh": false,
"navigationBarBackgroundColor": "#5DB66F",
"navigationBarTextStyle": "white",
"backgroundColorBottom": "#F2F2F2",
"app-plus": {
"titleNView": {}
}
}
},
{
"path": "pages/zhunongjinrong/zhunongjinrong", "path": "pages/zhunongjinrong/zhunongjinrong",
"style": { "style": {
"navigationBarTitleText": "助农金融", "navigationBarTitleText": "助农金融",
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
const src = ref<string>() const src = ref<string>()
onLoad(({ token, userId }) => { onLoad(({ token, userId }) => {
src.value = `/hybrid/html/chat.html?token=${token}&userId=${userId}` src.value = `/static/chat.html?token=${token}&userId=${userId}`
}) })
</script> </script>
......
<script setup lang="ts">
import { reactive, toRefs } from 'vue'
import { onLoad, onShow } from '@dcloudio/uni-app'
import { useUserStore } from '@/store/modules/user'
const userStore = useUserStore()
onLoad((option) => {
console.log(option.id);
uni.setNavigationBarTitle({
title: '详情'+option.id
});
})
onShow(() => {
})
const pageData = reactive({
loading: false,
options: {
area: [],
urgentdegree: [],
type: [],
},
position: [],
})
</script>
<template>
<view class="details_page">
</view>
<fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)" />
</template>
<style lang="scss" scoped>
.details_page{
background: rgba(230, 245, 232, 1);
min-height: 100vh;
width: 750rpx;
}
</style>
...@@ -10,16 +10,16 @@ ...@@ -10,16 +10,16 @@
const userStore = useUserStore() const userStore = useUserStore()
onLoad((option) => { onLoad((option) => {
pageData.currentEmploymentId = Number(option.type) || 1 pageData.currentEmploymentId = Number(option.type) || 2
}) })
onShow(() => { onShow(() => {
pageData.search.pageNo = 1 pageData.search.pageNo = 1
if (pageData.currentEmploymentId === 1) { if (pageData.currentEmploymentId === 2) {
pageData.search.publishstatu = 1 pageData.search.publishstatu = 2
pageData.search.createBy = '' pageData.search.createBy = ''
} }
if (pageData.currentEmploymentId === 2) { if (pageData.currentEmploymentId === 1) {
pageData.search.createBy = userStore.getUserInfo.username pageData.search.createBy = userStore.getUserInfo.username
} }
pageData.employmentList = [] pageData.employmentList = []
...@@ -29,27 +29,19 @@ ...@@ -29,27 +29,19 @@
// 页面数据 // 页面数据
const pageData = reactive({ const pageData = reactive({
loading: false, loading: false,
// 分类标签
categoryTabs: [
{ id: null, name: '全部' },
{ id: 1, name: '种植' },
{ id: 2, name: '养殖' },
{ id: 3, name: '采摘' },
{ id: 4, name: '其他' },
],
search: { search: {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
publishstatu: 1, publishstatu: 2,
type: null, type: null,
createBy: '', createBy: '',
}, },
// 用工类型标签 // 用工类型标签
employmentTabs: [ employmentTabs: [
{ id: 1, name: '出工赚钱' },
{ id: 2, name: '找人干活' }, { id: 2, name: '找人干活' },
{ id: 1, name: '出工赚钱' },
], ],
currentEmploymentId: 1, currentEmploymentId: 2,
// 用工列表 // 用工列表
employmentList: [], employmentList: [],
...@@ -112,9 +104,60 @@ ...@@ -112,9 +104,60 @@
pageData.requestDebounce = setTimeout(async () => { pageData.requestDebounce = setTimeout(async () => {
try { try {
const res = await fetchWithRetry(() => LinghuoyonggongAPI.employmentList(pageData.search)) /* const res = await fetchWithRetry(() => LinghuoyonggongAPI.employmentList(pageData.search))
const { records, total } = res */
const { records, total } = res
const total = 18;
const records = [
{
"id": "1",
"updateBy": "admin",
"updateTime": "2025/12/17",
"sysOrgCode": "技术部",
"name": "名称",
"picture": "https://gips0.baidu.com/it/u=1690853528,2506870245&fm=3028&app=3028&f=JPEG&fmt=auto?w=1024&h=1024",
"type": "种值",
"content": "工作内容",
"workers": 101,
"price": 220,
"area": "张家界市",
"address": "荷花村",
"longitude": "110.465501",
"latitude": "29.114429",
"urgentdegree": 1,
"starttime": "2025-12-17",
"estimatedendtime": "2025-12-19",
"createBy": "老王",
"createTime": "2025-12-17",
"reviewstatu": "审核状态",
"reviewinfo": " 审核信息",
"publishstatu": "发布状态"
},
{
"id": "1",
"updateBy": "admin",
"updateTime": "2025/12/17",
"sysOrgCode": "技术部",
"name": "名称2",
"picture": "https://gips2.baidu.com/it/u=195724436,3554684702&fm=3028&app=3028&f=JPEG&fmt=auto?w=1280&h=960",
"type": "种值2",
"content": "工作内容",
"workers": 101,
"price": 220,
"area": "张家界市",
"address": "荷花村",
"longitude": "110.465501",
"latitude": "29.114429",
"urgentdegree": 1,
"starttime": "2025-12-17",
"estimatedendtime": "2025-12-19",
"createBy": "老王",
"createTime": "2025-12-17",
"reviewstatu": "审核状态",
"reviewinfo": " 审核信息",
"publishstatu": "发布状态"
}
];
// 批量处理数据,避免多次DOM操作 // 批量处理数据,避免多次DOM操作
const processedRecords = records.map((item) => { const processedRecords = records.map((item) => {
...@@ -151,16 +194,6 @@ ...@@ -151,16 +194,6 @@
}, 150) }, 150)
} }
// 分类标签点击事件
function onCategoryTabClick(tab: any) {
console.log('点击分类标签:', tab)
pageData.search.type = tab.id
pageData.search.pageNo = 1
pageData.employmentList = []
getEmploymentList()
// 在这里添加具体的分类标签点击逻辑
}
// 用工类型标签点击事件 // 用工类型标签点击事件
function onEmploymentTabClick(tab: any) { function onEmploymentTabClick(tab: any) {
pageData.currentEmploymentId = tab.id pageData.currentEmploymentId = tab.id
...@@ -193,8 +226,12 @@ ...@@ -193,8 +226,12 @@
} }
// 发布用工 // 发布用工
function handlePublish() { function handlePublish() {
if(pageData.currentEmploymentId === 2){
Navigate.to('/pages/linghuoyonggong/publishEmployment')
}else{
Navigate.to('/pages/linghuoyonggong/form') Navigate.to('/pages/linghuoyonggong/form')
} }
}
// 获取时间差 // 获取时间差
function getDaysDiff(date1: Date | number | string, date2: Date | number | string): number { function getDaysDiff(date1: Date | number | string, date2: Date | number | string): number {
// 将输入转换为Date对象 // 将输入转换为Date对象
...@@ -218,6 +255,12 @@ ...@@ -218,6 +255,12 @@
return diffDays return diffDays
} }
function onSearch(res:any){
uni.showToast({
title: '搜索:' + res.value,
icon: 'none'
})
}
onReachBottom(() => { onReachBottom(() => {
console.log('触底了') console.log('触底了')
if (pageData.total <= pageData.employmentList.length) { if (pageData.total <= pageData.employmentList.length) {
...@@ -230,12 +273,18 @@ ...@@ -230,12 +273,18 @@
onNavigationBarButtonTap(() => { onNavigationBarButtonTap(() => {
Navigate.to('/pages/linghuoyonggong/components/yonggongmap') Navigate.to('/pages/linghuoyonggong/components/yonggongmap')
}) })
// 查看找人干活详情
function onDetailsClick(item: any) {
Navigate.to(`/pages/linghuoyonggong/details?id=${item.id}`)
}
</script> </script>
<template> <template>
<view class="codefun-flex-col page"> <view class="codefun-flex-col page">
<view class="codefun-flex-col codefun-self-stretch"> <view class="codefun-flex-col codefun-self-stretch">
<view class="codefun-mt-14 codefun-flex-row group_2 gap-2"> <!-- <view class="codefun-mt-14 codefun-flex-row group_2 gap-2">
<view <view
v-for="tab in pageData.categoryTabs" v-for="tab in pageData.categoryTabs"
:key="tab.id" :key="tab.id"
...@@ -247,9 +296,12 @@ ...@@ -247,9 +296,12 @@
{{ tab.name }} {{ tab.name }}
</text> </text>
</view> </view>
</view> </view> -->
<view class="codefun-mt-14 codefun-flex-col group_3"> <view class="codefun-mt-14 codefun-flex-col group_3">
<view class="top-search-view">
<uni-search-bar radius="100" placeholder="请输入搜索内容" clearButton="auto" cancelButton="none" @confirm="onSearch" />
</view>
<view class="codefun-flex-row section_2"> <view class="codefun-flex-row section_2">
<view <view
v-for="tab in pageData.employmentTabs" v-for="tab in pageData.employmentTabs"
...@@ -268,6 +320,7 @@ ...@@ -268,6 +320,7 @@
<fui-empty marginTop="100" src="/static/images/no-data.png" title="暂无数据" /> <fui-empty marginTop="100" src="/static/images/no-data.png" title="暂无数据" />
</view> </view>
<template v-else> <template v-else>
<template v-if="pageData.currentEmploymentId == 1">
<view <view
class="codefun-flex-col list-item" class="codefun-flex-col list-item"
v-for="item in pageData.employmentList" v-for="item in pageData.employmentList"
...@@ -324,6 +377,30 @@ ...@@ -324,6 +377,30 @@
</view> </view>
</view> </view>
</template> </template>
<template v-else>
<view class="work_list_view" v-for="(item,index) in 10" :key="index">
<view class="d-flex j-sb">
<view class="left-width village_number_view">
<view class="village_view text_overflow_ellipsis">先锋村{{index}}</view>
<view class="d-flex align-center"><image class="avatar_icon" src="/static/images/linghuoyonggong/avatar.png" /><text class="text-color">待工人员20名</text></view>
</view>
<view class="d-flex align-center justify-center right-width village_distance">
<image class="distance_icon" src="/static/images/linghuoyonggong/distance.png" />
<text class="distance_val text-color">3.2km</text>
</view>
</view>
<view class="d-flex j-sb skill_details_view">
<view class="left-width d-flex j-sb align-center">
<image class="skill_icon" src="/static/images/linghuoyonggong/skill.png" />
<view class="skill_view text_overflow_ellipsis">技能:采摘、饲养、编织、粉刷、种植...</view>
</view>
<view class="right-width see_details_btn" @click="onDetailsClick({id:index})">查看详情</view>
</view>
</view>
</template>
</template>
</view> </view>
</view> </view>
</view> </view>
...@@ -366,6 +443,10 @@ ...@@ -366,6 +443,10 @@
overflow-y: auto; overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
height: calc(100vh - 88rpx); height: calc(100vh - 88rpx);
.top-search-view{
height: 64rpx;
}
.section { .section {
padding: 26rpx 28rpx 26rpx 36rpx; padding: 26rpx 28rpx 26rpx 36rpx;
background-color: #5db66f; background-color: #5db66f;
...@@ -455,7 +536,13 @@ ...@@ -455,7 +536,13 @@
.group_3 { .group_3 {
padding: 0 28rpx; padding: 0 28rpx;
height: 685rpx; height: 685rpx;
.top-search-view{
.uni-searchbar{
padding: 0rpx !important;
}
}
.section_2 { .section_2 {
margin-top: 48rpx;
padding-bottom: 8rpx; padding-bottom: 8rpx;
background-color: #ffffff66; background-color: #ffffff66;
border-radius: 32rpx; border-radius: 32rpx;
...@@ -582,4 +669,78 @@ ...@@ -582,4 +669,78 @@
background: linear-gradient(124.25deg, #a5d63f 0%, #5db66f 100%) !important; background: linear-gradient(124.25deg, #a5d63f 0%, #5db66f 100%) !important;
box-shadow: 0px 1px 8px #5db66f; box-shadow: 0px 1px 8px #5db66f;
} }
.work_list_view{
border-bottom: 2rpx solid #EEEEEE;
padding-top: 24rpx;
.text-color{color: #5DB66F;font-size: 24rpx;}
.d-flex{display: flex;}
.j-sb{justify-content:space-between;}
.text_overflow_ellipsis{
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.left-width{
width:440rpx;
}
.right-width{
width:140rpx;
}
.village_number_view{
.village_view{
height: 40rpx;
line-height: 40rpx;
margin-bottom: 12rpx;
font-size: 32rpx;
color: #333333;
}
.avatar_icon{
width: 24rpx;
height: 24rpx;
margin-right: 10rpx;
}
}
.village_distance{
height: 26rpx;
margin-top: 16rpx;
.distance_icon{
width: 24rpx;
height: 28rpx;
}
.distance_val{
margin-left: 6rpx;
}
}
.skill_details_view{
margin-top: 10rpx;
padding-bottom: 24rpx;
.skill_icon{
width: 24rpx;
height: 26rpx;
}
.skill_view{
width:416rpx;
font-size: 24rpx;
height: 40rpx;
line-height: 40rpx;
color: #999999;
margin-left: 10rpx;
}
.see_details_btn{
height: 48rpx;
border-radius: 200rpx;
background: #5DB66F;
display: flex;
justify-content: center;
align-items: center;
padding: 20rpx;
font-size: 24rpx;
color: #FFFFFF;
}
}
}
</style> </style>
<script setup lang="ts">
import { reactive, toRefs, ref } from 'vue'
import { onLoad, onShow } from '@dcloudio/uni-app'
import { useUserStore } from '@/store/modules/user'
import { useGlobSetting } from '/@/hooks/setting'
import * as LinghuoyonggongAPI from '@/api/model/linghuoyonggong'
import * as UserInfoAPI from '@/api/model/userInfo'
import { areaTree, getCodeByText, getTextByCode } from '@/utils/areaData'
import { useDictStore } from '@/store/modules/dict'
import { getDictData, getText } from '@/utils/dict/area'
const dictStore = useDictStore()
const userStore = useUserStore()
const globSetting = useGlobSetting()
onLoad((option) => {
// 获取数据详情
if (option.id) {
getDetails(option.id)
} else {
// 获取当前位置
getCurrentAddressInfo()
}
getProvince();
// 获取字典值
getDictVal();
})
onShow(() => {
// 数据字典赋值
initDict()
})
const skillPopupRef = ref(null);
let tempWorkersParam = reactive({
id:null,
laborId:null, //用工信息ID
name:"",// 工人姓名
mobile:"",// 手机号
gender:null,// 性别
genderZh:"",
birthday:"", // 出生日期
edu:null,// 学历
eduZh:"",
attr:"",// 人员属性
skill:"", // 人员技能
})
// 字典值
const DictData = reactive({
sexArr:[],// 性别
educationArr:[],// 学历
socialattributesArr:[],// 人员属性
dictValArr:[],// 过渡
dictType:"",
isSkillPopupShow:false,
skillValue:[],
skillOptionsVal:[]
})
const pageData = reactive({
province: [], //省数组
city: [], //市数组
district: [], //区数组
street: [], //街道数组
mulSelect: [], //四级联动显示数组,该数组的值为[[province],[city],[district],[street]]
provinceId: 0, //省的id
cityId: 0, //市的id
districtId: 0,//区的id
isActive:false,
address:'',
laborParam:{
id:null,
addr:"",
lon:29,
lat:110,
contactName:"",
contactMobile:"",
},
workersParam:[],
loading: false,
isPersonPopupShow:false,
datePickerShow:false,
attrPickerShow:false,
show: {
time1: false,
time2: false,
area: false,
urgentdegree: false,
type: false,
},
options: {
area: [],
urgentdegree: [],
type: [],
},
form: {
id: '',
name: '',
content: '',
workers: '',
price: '',
typeText: '',
type: null,
area: '',
areaText: '',
province: '',
city: '',
country: '',
address: '',
urgentdegreeText: '',
urgentdegree: null,
starttime: '',
estimatedendtime: '',
picture: null,
pictureObj: null,
longitude: '',
latitude: ''
},
position: [],
rules: [
{
name: 'type',
rule: ['required'],
msg: ['请选择用工类型'],
},{
name: 'name',
rule: ['required'],
msg: ['请输入标题'],
}, {
name: 'workers',
rule: ['required'],
msg: ['请输入工人数量'],
}, {
name: 'price',
rule: ['required'],
msg: ['请输入用工单价'],
}, {
name: 'starttime',
rule: ['required'],
msg: ['请选择开始时间'],
}, {
name: 'estimatedendtime',
rule: ['required'],
msg: ['请选择预计结束时间'],
}, {
name: 'content',
rule: ['required'],
msg: ['请输入工作内容'],
}, {
name: 'area',
rule: ['required'],
msg: ['请选择地区'],
}, {
name: 'address',
rule: ['required'],
msg: ['请输入详细地址'],
}, {
name: 'urgentdegree',
rule: ['required'],
msg: ['请选择紧急程度'],
}, {
name: 'picture',
rule: ['required'],
msg: ['请上传图片'],
},
],
})
// 获取字典值
function getDictVal(){
LinghuoyonggongAPI.gitListByCodeDict({ code : 'sex'}).then(res=>{
DictData.sexArr = res;
})
LinghuoyonggongAPI.gitListByCodeDict({ code : 'education'}).then(res=>{
DictData.educationArr = res;
})
LinghuoyonggongAPI.gitListByCodeDict({ code : 'socialattributes'}).then(res=>{
DictData.socialattributesArr = res;
})
queryByCategoryAndCode(2002,null);
}
function queryByCategoryAndCode(code,e){
LinghuoyonggongAPI.queryByCategoryAndCode({ category : 1,code : code}).then(res=>{
if(res.length){
let dataArr = [];
for(let i = 0; i < res.length; i++){
let obj = {text:"",value:""};
obj.text = res[i].name;
obj.value = res[i].code;
dataArr.push(obj);
}
console.log(dataArr);
if(!DictData.skillOptionsVal.length){
DictData.skillOptionsVal = dataArr;
}else{
skillPopupRef.value.setRequestData(dataArr, e.layer);
}
}else{
skillPopupRef.value.end();
}
})
}
// 选择技能完成
function selectCompleteSkill(e){
tempWorkersParam.skill = e.text.join('');
DictData.isSkillPopupShow = false;
}
// 技能值发生了改变
function changeSkill(e){
console.log(e)
let val = e.value;
queryByCategoryAndCode(val,e);
}
// 出生日期的选择
function attrChange(e) {
if(DictData.dictType == 'education'){
let educationArr = DictData.educationArr;
tempWorkersParam.eduZh = e.value;
for(let i = 0; i < educationArr.length; i++){
if(e.value == educationArr[i].itemText){
tempWorkersParam.edu = parseInt(educationArr[i].id);
break;
}
}
}
if(DictData.dictType == 'socialattributes'){
tempWorkersParam.attr = e.value;
}
pageData.attrPickerShow = false;
}
// 出生日期的选择
function dateBirthChange(e) {
tempWorkersParam.birthday = e.result;
pageData.datePickerShow = false;
}
// 添加人员
function addPersonData(){
let sexArr = DictData.sexArr;
for(let i = 0; i < sexArr.length; i++){
if(tempWorkersParam.genderZh == sexArr[i].itemText){
tempWorkersParam.gender = sexArr[i].id;
break;
}
}
pageData.workersParam.push(JSON.parse(JSON.stringify(tempWorkersParam)));
pageData.isPersonPopupShow = false;
}
// 选择出生日期
function onPickerTap(e) {
let dataVal = null,itemTextArr = [];
DictData.dictType = e;
if(DictData.dictType == 'education'){
dataVal = DictData.educationArr;
for(let i = 0; i < dataVal.length; i++){
itemTextArr.push(dataVal[i].itemText);
}
}
if(DictData.dictType == 'socialattributes'){
dataVal = DictData.socialattributesArr;
for(let i = 0; i < dataVal.length; i++){
itemTextArr.push(dataVal[i].itemText);
}
}
DictData.dictValArr = itemTextArr;
pageData.attrPickerShow = true
}
// 打开添加人员弹出框
function openAddPersonPopup(){
tempWorkersParam.id=null;
tempWorkersParam.laborId=null;
tempWorkersParam.name="";
tempWorkersParam.mobile="";
tempWorkersParam.gender="";
tempWorkersParam.genderZh="";
tempWorkersParam.birthday="";
tempWorkersParam.edu="";
tempWorkersParam.eduZh="";
tempWorkersParam.attr="";
tempWorkersParam.skill="";
pageData.isPersonPopupShow = true;
}
function colChange(e) {
switch (e.detail.column){
case 0://选择市
pageData.provinceId = pageData.mulSelect[0][e.detail.value].code;
// 获取对应的 区县
LinghuoyonggongAPI.queryConditions({ parentCode : pageData.provinceId}).then(res=>{
pageData.city = res;
pageData.mulSelect[1]= pageData.city;
// 获取对应的乡镇
LinghuoyonggongAPI.queryConditions({ parentCode : pageData.city[0].code}).then(res=>{
pageData.district = res;
pageData.mulSelect[2]= pageData.district;
// 获取对应的村
LinghuoyonggongAPI.queryConditions({ parentCode : pageData.district[0].code}).then(res=>{
pageData.street = res;
if(res.length){
pageData.mulSelect[3]= pageData.street;
}
})
})
})
break;
case 1://选择区县
pageData.cityId=pageData.mulSelect[1][e.detail.value].code;
// 获取对应的乡镇
LinghuoyonggongAPI.queryConditions({ parentCode :pageData.cityId}).then(res=>{
pageData.district = res;
pageData.mulSelect[2]=pageData.district;
// 获取对应的村
LinghuoyonggongAPI.queryConditions({ parentCode :pageData.district[0].code}).then(res=>{
if(res.length){
pageData.street = res;
pageData.mulSelect[3]=pageData.street;
}
})
})
break;
case 2://选择镇
pageData.districtId=pageData.mulSelect[2][e.detail.value].code;
LinghuoyonggongAPI.queryConditions({ parentCode :pageData.districtId}).then(res=>{
if(res.length){
pageData.street = res;
pageData.mulSelect[3]=pageData.street;
}
});
break;
default:
break;
}
}
function getProvince() {
LinghuoyonggongAPI.queryConditions({ parentCode : 43 }).then(res=>{
pageData.province = [];
pageData.province = res;
pageData.mulSelect.push(pageData.province);
let code = pageData.province[0].code;
LinghuoyonggongAPI.queryConditions({ parentCode : code}).then(res=>{
pageData.city = res;
pageData.mulSelect.push(pageData.city);
let code = pageData.city[0].code;
LinghuoyonggongAPI.queryConditions({ parentCode : code}).then(res=>{
pageData.district = res;
pageData.mulSelect.push(pageData.district);
let code = pageData.district[0].code;
LinghuoyonggongAPI.queryConditions({ parentCode : code}).then(res=>{
pageData.street = res;
if(res.length){
pageData.mulSelect.push(pageData.street);
}
})
})
})
})
}
function pickerChange(e) {
for(var i=0;i<e.detail.value.length;i++){
if(e.detail.value[i]===null){
e.detail.value[i]=0;
}
}
let s_province = pageData.mulSelect[0][e.detail.value[0]];
let s_city = pageData.mulSelect[1][e.detail.value[1]||0];
let s_district = pageData.mulSelect[2][e.detail.value[2]||0];
let s_street = null;
if(e.detail.value.length == 4){
s_street = pageData.mulSelect[3][e.detail.value[3]||0];
pageData.laborParam.addr=s_province.name+s_city.name+s_district.name+s_street.name;
}else{
pageData.laborParam.addr=s_province.name+s_city.name+s_district.name;
}
pageData.isActive=true;
}
/* ****************************************************** */
const { show, options, form } = toRefs(pageData);
async function initDict() {
pageData.options.area = await getDictData();
console.log("pageData.options.area =");
console.log(pageData.options.area);
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) => {
return {
value: item.value,
text: item.text,
}
})
}
function getCurrentAddressInfo() {
if (!uni.getStorageSync('location'))
return
const { lon, lat } = uni.getStorageSync('location')
pageData.position = [lon, lat]
UserInfoAPI.location({
lon,
lat,
}).then((res) => {
pageData.form.province = res.province
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)}`
})
}
function getDetails(id) {
pageData.loading = true
LinghuoyonggongAPI.employmentDetails({ id })
.then((res) => {
pageData.form = res
pageData.form.areaText = getText(pageData.form.area, '/')
pageData.form.urgentdegreeText = pageData.options.urgentdegree.find(
(item) => item.value == pageData.form.urgentdegree,
)?.text
pageData.form.typeText = pageData.options.type.find((item) => item.value == pageData.form.type)?.text
pageData.form.pictureObj = pageData.form.picture && parseUrlInfo(pageData.form.picture)
console.log(pageData.form)
})
.finally(() => {
pageData.loading = false
})
}
function parseUrlInfo(url) {
// 从URL中提取文件名
const pathParts = url.split('/')
const fileName = pathParts[pathParts.length - 1]
// 提取扩展名
const fileParts = fileName.split('.')
const extname = fileParts[fileParts.length - 1]
// 返回格式化的对象
return {
name: fileName,
extname,
url,
}
}
function handleChangeTime1(e) {
pageData.form.starttime = e.result
pageData.show.time1 = false
}
function handleChangeTime2(e) {
pageData.form.estimatedendtime = e.result
pageData.show.time2 = false
}
function handleChangetype(e) {
pageData.form.type = e.value
pageData.form.typeText = e.text
pageData.show.type = false
}
function handleChangeUrgentdegree(e) {
pageData.form.urgentdegree = e.value
pageData.form.urgentdegreeText = e.text
pageData.show.urgentdegree = false
}
function handleChangeAddress(e) {
pageData.form.areaText = e.text.join('/')
pageData.form.area = e.value.join(',')
pageData.show.area = false
}
const toastRef = ref()
const uploadRef = ref()
// 文件上传
function handleUpload(file) {
uni.uploadFile({
url: `${globSetting.apiUrl + globSetting.urlPrefix}/sys/common/upload`, // 直接使用上传接口URL
filePath: file.tempFiles[0].path,
name: 'file',
formData: {
biz: 'temp',
},
header: {
'X-Access-Token': userStore.getToken,
},
success: (res) => {
if (res.statusCode === 200) {
const data = JSON.parse(res.data)
if (data.code === 200 || data.code === 0) {
toastRef.value.show({
type: 'success',
text: '上传成功',
})
pageData.form.picture = data.message // 保存返回的图片信息
}
}
},
fail: (err) => {
toastRef.value.show({
type: 'error',
text: '上传失败',
})
uploadRef.value.clearFiles()
pageData.form.picture = null
},
})
}
// 文件删除
function handleDelete(file) {
uploadRef.value.clearFiles()
pageData.form.picture = null
}
const formRef = ref()
function submit() {
if (pageData.position.length == 0) {
toastRef.value.show({
type: 'error',
text: '无法获取位置',
})
return
}
pageData.form.longitude = pageData.position[0]
pageData.form.latitude = pageData.position[1]
formRef.value.validator(pageData.form, pageData.rules, true).then((res) => {
if (res.isPassed) {
LinghuoyonggongAPI.employmentAdd(pageData.form).then((res) => {
toastRef.value.show({
type: 'success',
text: '用工发布成功',
})
uni.switchTab({
url: '/pages/chanxiao/chanxiao',
})
})
}
})
}
// 发布灵活用工
function submitLaborAdd(){
let formData = {
laborParam:pageData.laborParam,
workersParam:pageData.workersParam
}
LinghuoyonggongAPI.postLaborAdd(formData).then((res) => {
toastRef.value.show({
type: 'success',
text: '发布成功',
})
uni.switchTab({
url: '/pages/chanxiao/chanxiao',
})
})
}
function getCurrentDate(){
const date = new Date()
const year = date.getFullYear()
const month = date.getMonth() + 1
const day = date.getDate()
return `${year}-${month}-${day}`
}
</script>
<template>
<view class="page">
<view class="bg_white formBox">
<view class="form_view">
<view class="yr-form">
<view class="yr-form-item">
<view class="yr-form-title"><text class="required-mark">*</text>村名称</view>
<picker class="yr-form-input" mode="multiSelector" :range="pageData.mulSelect" :range-key="'name'" @change="pickerChange" @columnchange="colChange">
<view class="yr-input-placeholder" v-if="!pageData.isActive">请选择</view>
<view v-else class="yr-input-style">{{pageData.laborParam.addr}}</view>
</picker>
</view>
<view class="yr-form-item">
<view class="yr-form-title"><text class="required-mark">*</text>联系人</view>
<input class="yr-form-input" v-model="pageData.laborParam.contactName" name="input" placeholder="请填写联系人姓名" />
</view>
<view class="yr-form-item border-bottom-none">
<view class="yr-form-title"><text class="required-mark">*</text>联系电话</view>
<input class="yr-form-input" v-model="pageData.laborParam.contactMobile" type="tel" :maxlength="11" placeholder="请填写联系电话" />
</view>
</view>
</view>
</view>
<!-- 待业人员 -->
<view class="bg_white formBox unemployed_person">
<view class="form_view">
<view class="yr-form">
<view class="yr-form-item border-bottom-none">
<view class="yr-form-title"><text class="required-mark">*</text>待业人员</view>
<view class="yr_add_btn" @click="openAddPersonPopup()">
<image class="add_person_icon" src="/static/images/linghuoyonggong/add_person.png" />
<view class="add_person_text">添加人员</view>
</view>
</view>
<view class="yr-person-item" v-for="(item,index) in pageData.workersParam" :key="index">
<view class="yr-person-info">
<view class="person_name_attr">{{item.name}}<text class="person_attr">{{item.attr}}</text></view>
<view class="person-info">54|{{item.gender}}{{item.edu}}</view>
<view class="person-info text_overflow_ellipsis">技能:{{item.skill}}</view>
</view>
<view class="edit_person">
<image class="edit_person_icon" src="/static/images/linghuoyonggong/edit_person.png" />
</view>
</view>
<!-- <view class="yr-person-item">
<view class="yr-person-info">
<view class="person_name_attr">何德海<text class="person_attr">低保户</text></view>
<view class="person-info">54|男|高中以下</view>
<view class="person-info text_overflow_ellipsis">技能:采摘、养殖、粉刷、种植元素通常用于创建超链接。如果你想通过CSS选择器选</view>
</view>
<view class="edit_person">
<image class="edit_person_icon" src="/static/images/linghuoyonggong/edit_person.png" />
</view>
</view> -->
</view>
</view>
</view>
<view class="yr-submit-btn">
<view class="submit-btn-view">
<fui-button text="发布" bold radius="96rpx" @click="submitLaborAdd" height="80rpx"/>
</view>
</view>
</view>
<fui-date-picker :show="show.time1" type="3" @change="handleChangeTime1" :min-date="getCurrentDate()" @cancel="show.time1 = false" />
<fui-date-picker :show="show.time2" type="3" @change="handleChangeTime2" :min-date="getCurrentDate()" @cancel="show.time2 = false" />
<fui-picker :show="show.type" :layer="1" :linkage="true" :options="options.type" @change="handleChangetype" @cancel="show.type = false" />
<fui-picker :show="show.urgentdegree" :layer="1" :linkage="true" :options="options.urgentdegree" @change="handleChangeUrgentdegree" @cancel="show.urgentdegree = false"/>
<fui-picker :show="show.area" :options="options.area" :linkage="true" :layer="3" @change="handleChangeAddress" @cancel="show.area = false" />
<fui-toast ref="toastRef" />
<fui-loading isFixed v-if="pageData.loading" backgroundColor="rgba(0, 0, 0, 0.4)" />
<!-- 普通弹窗 -->
<fui-bottom-popup :show="pageData.isPersonPopupShow" @close="pageData.isPersonPopupShow = false">
<view class="fui-custom__wrap yr_person_popup">
<view class="popup_top">
<uni-icons type="left" size="24" color="#333333" @click="pageData.isPersonPopupShow = false"></uni-icons>
<view class="add_person_text">添加人员</view>
<view class="del_person_btn" @click="pageData.isPersonPopupShow = false">删除</view>
</view>
<view class="popup_content">
<fui-form error-position="1" ref="form" top="0" :model="tempWorkersParam" :show="false">
<fui-form-item label="姓名">
<fui-input :borderBottom="false" v-model="tempWorkersParam.name" :padding="[0]" placeholder="请输入姓名"></fui-input>
</fui-form-item>
<fui-form-item label="手机号">
<fui-input :borderBottom="false" v-model="tempWorkersParam.mobile" :padding="[0]" placeholder="请输入手机号"></fui-input>
</fui-form-item>
<fui-form-item label="性别">
<fui-radio-group v-model="tempWorkersParam.genderZh">
<fui-label inline v-for="item in DictData.sexArr" :key="item.id">
<fui-radio :value="item.itemValue"></fui-radio>
<fui-text :size="28" :text="item.itemText" :padding="['0','30rpx','0','16rpx']"></fui-text>
</fui-label>
</fui-radio-group>
</fui-form-item>
<fui-form-item label="出生日期" highlight @click="pageData.datePickerShow=true;">
<fui-input :borderBottom="false" v-model="tempWorkersParam.birthday" :padding="[0]" :disabled="true" placeholder="请选择出生日期"
backgroundColor="transparent"></fui-input>
</fui-form-item>
<fui-form-item label="学历" highlight @click="onPickerTap('education')">
<fui-input v-model="tempWorkersParam.eduZh" :borderBottom="false" :padding="[0]" placeholder="请选择学历" :disabled="true"
backgroundColor="transparent"></fui-input>
</fui-form-item>
<fui-form-item label="人员属性" highlight @click="onPickerTap('socialattributes')">
<fui-input v-model="tempWorkersParam.attr" :borderBottom="false" :padding="[0]" placeholder="请选择人员属性" :disabled="true"
backgroundColor="transparent"></fui-input>
</fui-form-item>
<fui-form-item label="人员技能" highlight @click="DictData.isSkillPopupShow = true">
<fui-input v-model="tempWorkersParam.skill" :borderBottom="false" :padding="[0]" placeholder="请选择人员技能" :disabled="true"
backgroundColor="transparent"></fui-input>
</fui-form-item>
</fui-form>
</view>
<fui-button text="保存" bold radius="96rpx" @click="addPersonData" height="80rpx"/>
</view>
</fui-bottom-popup>
<fui-date-picker :show="pageData.datePickerShow" :type="3" value="1900" valueEnd="" @change="dateBirthChange" @cancel="pageData.datePickerShow=false"></fui-date-picker>
<fui-picker :show="pageData.attrPickerShow" layer="1" :options="DictData.dictValArr" :linkage="false" @change="attrChange" @cancel="pageData.attrPickerShow = false"></fui-picker>
<!-- 人员技能 -->
<fui-bottom-popup :show="DictData.isSkillPopupShow">
<view class="fui-scroll__wrap">
<view class="fui-title">请选择技能</view>
<fui-cascader ref="skillPopupRef" :value="DictData.skillValue" stepLoading @change="changeSkill" @complete="selectCompleteSkill" :options="DictData.skillOptionsVal"></fui-cascader>
<view class="fui-icon__close" @tap.stop="DictData.isSkillPopupShow=false">
<fui-icon name="close" :size="48"></fui-icon>
</view>
</view>
</fui-bottom-popup>
</template>
<style lang="scss" scoped>
body {
background-color: #e6f5e8;
}
.page {
background-color: #e6f5e8;
width: 750rpx;
overflow-x: hidden;
.mt20 {
margin-top: 30rpx;
background: #fff;
padding: 20rpx;
border-radius: 10rpx;
}
.bg_white{
background-color: #FFFFFF;
}
.required-mark{
color:#FF5733;
font-size: 28rpx;
margin-right: 4rpx;
}
.text_overflow_ellipsis{
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.formBox {
width: 690rpx;
margin: 30rpx auto;
border-radius: 16rpx;
display: flex;
justify-content: center;
flex-wrap: wrap;
.form_view{
display: flex;
justify-content: center;
.yr-form{
width: 642rpx;
}
.border-bottom-none{
border-bottom: none !important;
}
.yr-form-item{
display: flex;
justify-content: space-between;
align-content: center;
padding-top: 36rpx;
padding-bottom: 36rpx;
border-bottom: 2rpx solid #EEEEEE;
.yr-form-title{
font-size: 28rpx;
color: #333333;
width: 132rpx;
}
.yr-form-input{
width: 480rpx;
}
.yr-input-placeholder {
font-size: 28rpx !important;
color: #999999 !important;
}
.yr-input-style{
font-size: 30rpx;
color:#181818;
}
}
}
.unemployed_person{
margin-top: 24rpx;
}
.yr_add_btn{
display: flex;
align-items: center;
.add_person_icon{
width: 32rpx;
height: 32rpx;
}
.add_person_text{
color: #5DB66F;
font-size: 28rpx;
margin-left: 20rpx;
}
}
.yr-person-item{
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 2rpx solid #EEEEEE;
margin-top: 28rpx;
.yr-person-info{
.person_name_attr{
font-size: 28rpx;
font-weight: 500;
color: #333333;
.person_attr{
font-size: 24rpx;
font-weight: 400;
color: #5DB66F;
margin-left: 12rpx;
}
}
.person-info{
font-size: 24rpx;
color: #999999;
vertical-align: middle;
margin-bottom: 24rpx;
margin-top: 24rpx;
width: 512rpx;
}
}
.edit_person{
width: 68rpx;
height: 88rpx;
display: flex;
justify-content: flex-end;
align-items: center;
}
.edit_person_icon{
width: 32rpx;
height: 28rpx;
}
}
.yr-person-item:last-child{
border-bottom: none;
}
}
.yr-submit-btn{
display: flex;
justify-content: center;
margin-top: 40rpx;
.submit-btn-view{
width: 690rpx;
}
}
.form-section {
// border-bottom: 1rpx solid #f5f5f5;
}
.form-item {
padding: 30rpx 0;
border-bottom: 1rpx solid #f5f5f5;
&:last-child {
border-bottom: none;
}
&.required .label::before {
content: '*';
color: #ff4d4f;
margin-right: 8rpx;
}
}
.form-row {
display: flex;
justify-content: space-between;
}
.half-width {
width: 48%;
}
.align-center {
align-items: center;
}
.label {
display: block;
font-size: 28rpx;
color: #333333;
font-weight: 500;
width: 180rpx;
}
.input {
width: 100%;
height: 80rpx;
background: #f8f9fa;
border-radius: 8rpx;
padding: 0 20rpx;
font-size: 28rpx;
color: #333333;
&::placeholder {
color: #999999;
}
}
.time-range {
display: flex;
align-items: center;
justify-content: space-between;
}
.time-input {
width: 45%;
border-radius: 8rpx;
display: flex;
align-items: center;
}
.time-text {
font-size: 28rpx;
color: #333333;
&.placeholder {
color: #999999;
}
}
.time-separator {
color: #666666;
font-size: 28rpx;
margin: 0 10rpx;
}
.upload-area {
margin-top: 10rpx;
}
.custom-uploader {
:deep(.uni-file-picker__container) {
border: 2rpx dashed #d9d9d9;
border-radius: 8rpx;
background: #f8f9fa;
}
}
.upload-placeholder {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 200rpx;
color: #999999;
}
.upload-icon {
font-size: 48rpx;
margin-bottom: 10rpx;
}
.upload-text {
font-size: 24rpx;
}
.submit-section {
background: transparent;
padding: 40rpx 0;
}
.submit-btn {
width: 100%;
height: 88rpx;
background: #ff9800;
border-radius: 44rpx;
color: #ffffff;
font-size: 32rpx;
font-weight: 500;
border: none;
&:active {
background: #e68900;
opacity: 0.9;
}
}
}
::v-deep .uni-input-placeholder {
font-size: 28rpx !important;
color: #999999 !important;
}
// 移除fui-form的默认样式
:deep(.fui-form) {
background: transparent;
}
:deep(.fui-form__item) {
background: transparent;
border: none;
margin-bottom: 0;
padding: 0;
}
.unit-slot {
padding: 0 16rpx;
color: #333;
font-size: 28rpx;
}
.fui-scroll__wrap {
padding-top: 30rpx;
position: relative;
}
.fui-title {
font-size: 30rpx;
font-weight: bold;
text-align: center;
padding-bottom: 24rpx;
}
.fui-icon__close {
position: absolute;
top: 24rpx;
right: 24rpx;
}
</style>
...@@ -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({
...@@ -162,8 +162,11 @@ ...@@ -162,8 +162,11 @@
} }
const params = { const params = {
/* mobile: model.form.data.username,
smsmode: '0', */
mobile: model.form.data.username, mobile: model.form.data.username,
smsmode: '0', smsmode: 1,
} }
API.sysSms(params) API.sysSms(params)
.then(async (body) => { .then(async (body) => {
...@@ -205,54 +208,7 @@ ...@@ -205,54 +208,7 @@
}) })
} }
/**
* 跳转到注册页面
*/
function goRegister() {
uni.reLaunch({
url: '/pages/login/register',
})
}
// 添加欢迎登录的文字打字动态效果
let loop = null
let direction = 'right'
const count = ref(defaultText.length)
watch(
() => model.show,
(show) => {
if (show) {
loop && clearInterval(loop)
loop = setInterval(() => {
if (direction === 'right') {
count.value++
if (count.value > defaultText.length + 20) {
direction = 'left'
count.value = defaultText.length
}
} else {
count.value--
if (count.value < 0) {
direction = 'right'
}
}
if (count.value > defaultText.length) {
model.text = defaultText
} else if (count.value < 0) {
model.text = ''
} else {
model.text = defaultText.slice(0, count.value)
}
}, 200)
}
},
)
onHide(() => { onHide(() => {
loop && clearInterval(loop)
loop = null
direction = 'right'
count.value = 0
model.show = false model.show = false
}) })
...@@ -268,19 +224,26 @@ ...@@ -268,19 +224,26 @@
</script> </script>
<template> <template>
<view class="warp"> <view class="login_warp">
<!-- <image class="login-warp" src="/static/login/login_bg.png" /> --> <image class="login_top_bg" src="/static/images/login/login_top_bg.png" />
<view class="login-bg-wrap"> <view class="login_top_warp">
<image class="login-bg" src="/static/logo.png" /> <view class="login_hello">
<view class="logo-content-wrap"> <text class="text_hello">您好,欢迎使用</text>
<!-- <view class="">{{ '欢迎登录' }}</view> --> <view class="login_server_name"><text class="text_server_name">湘农数智服务平台</text></view>
<view class="logo-text mb-3">{{ model.text }}</view>
<!-- <text class="text-#999 text-24">{{ '*小程序仅供内部员工使用' }}</text> -->
</view> </view>
</view> </view>
<fui-form class="form" ref="form" top="50" :padding="['0rpx', '32rpx']" background="#e46962">
<fui-form class="form" ref="form" top="0" :padding="['0rpx', '0rpx']" background="#e46962">
<view class="login_content">
<view class="login-input-area">
<view class="user_phone">
<image class="user_phone_img" src="/static/images/register/user.png" />
<view class="user_text_view"><text class="view_text">手机号</text></view>
</view>
<view class="input-bottom-border">
<fui-input <fui-input
height="100rpx" height="94rpx"
:padding="['0rpx', '0rpx', '0rpx', '12rpx']"
class="input" class="input"
autocomplete="off" autocomplete="off"
:required="false" :required="false"
...@@ -291,32 +254,26 @@ ...@@ -291,32 +254,26 @@
v-model="model.form.data.username" v-model="model.form.data.username"
name="mobile" name="mobile"
backgroundColor="transparent" backgroundColor="transparent"
borderColor="#DDDDDD" borderColor="transparent"
maxlength="11" maxlength="11"
> >
<template #left>
<view class="fui-left__icon mr-2">
<fui-icon name="my" color="#333" :size="48" />
</view>
</template>
</fui-input> </fui-input>
</view>
<view class="user_phone mt50">
<image class="user_phone_img" src="/static/images/register/sms.png" />
<view class="user_text_view"><text class="view_text">验证码</text></view>
</view>
<view class="input-bottom-border">
<fui-input <fui-input
:padding="['20rpx', '32rpx']" height="94rpx"
:padding="['0rpx', '0rpx', '0rpx', '12rpx']"
class="input"
type="number"
placeholder="请输入验证码" placeholder="请输入验证码"
:bottomLeft="0"
marginTop="10"
v-model="model.form.data.code" v-model="model.form.data.code"
backgroundColor="transparent" backgroundColor="transparent"
borderColor="#DDDDDD" borderColor="transparent"
type="number" ><fui-button
>
<template #left>
<view class="fui-left__icon mr-2">
<fui-icon name="keyboard" color="#333" :size="48" />
</view>
</template>
<fui-button
width="200rpx" width="200rpx"
height="64rpx" height="64rpx"
:background="model.countdown > 0 ? '#CCCCCC' : '#67c17a'" :background="model.countdown > 0 ? '#CCCCCC' : '#67c17a'"
...@@ -327,20 +284,25 @@ ...@@ -327,20 +284,25 @@
:text="model.countdown > 0 ? `${model.countdown}秒后重试` : '获取验证码'" :text="model.countdown > 0 ? `${model.countdown}秒后重试` : '获取验证码'"
/> />
</fui-input> </fui-input>
<view class="btn__box flex-center p-32rpx box-border"> </view>
</view>
<view class="submit_btn_view">
<fui-button <fui-button
height="88rpx" height="72rpx"
background="#67c17a" background="#5DB66F"
size="32rpx" size="28rpx"
radius="8rpx" radius="36rpx"
text="立即登录" text="立即登录"
@click="login" @click="login"
:disabled="model.loading" :disabled="model.loading"
:loading="model.loading" :loading="model.loading"
/> />
</view> </view>
<view class="flex-center p-32rpx box-border btn-register" @click="goRegister"> 还没有账号,立即注册 </view>
</view>
</fui-form> </fui-form>
<!-- </view> --> <!-- </view> -->
<fui-checkbox-group class="checkbox" name="checkbox"> <fui-checkbox-group class="checkbox" name="checkbox">
<view class="fui-list__item fiexdText"> <view class="fui-list__item fiexdText">
...@@ -357,14 +319,14 @@ ...@@ -357,14 +319,14 @@
@change="(e) => (model.form.data.read = e.checked)" @change="(e) => (model.form.data.read = e.checked)"
style="margin-right: 10rpx; width: 32rpx; height: 32rpx; margin-top: 2rpx" style="margin-right: 10rpx; width: 32rpx; height: 32rpx; margin-top: 2rpx"
/> />
已阅读并同意 <text style="color: #999999;;font-size:28rpx;">已阅读并同意</text>
</fui-label> </fui-label>
<fui-text <fui-text
@tap="Link.to(Link.services, '服务协议')" @tap="Link.to(Link.services, '服务协议')"
size="28rpx" size="28rpx"
text="《服务协议》" text="《服务协议》"
color="#4da25b" color="#4da25b"
/> /><text style="color: #999999;;font-size:28rpx;"></text>
<fui-text <fui-text
@tap="Link.to(Link.privacy, '隐私政策')" @tap="Link.to(Link.privacy, '隐私政策')"
size="28rpx" size="28rpx"
...@@ -378,7 +340,6 @@ ...@@ -378,7 +340,6 @@
<fui-safe-area /> <fui-safe-area />
</view> </view>
</fui-checkbox-group> </fui-checkbox-group>
<fui-modal <fui-modal
:show="readConfirmShow" :show="readConfirmShow"
title="服务协议及隐私保护" title="服务协议及隐私保护"
...@@ -403,14 +364,6 @@ ...@@ -403,14 +364,6 @@
</template> </template>
<style lang="less" scoped> <style lang="less" scoped>
// .login-warp {
// width: 100%;
// height: calc(100vh);
// position: absolute;
// // border: 1px solid #000;
// z-index: 0;
// }
@keyframes blink-caret { @keyframes blink-caret {
0%, 0%,
100% { 100% {
...@@ -422,14 +375,84 @@ ...@@ -422,14 +375,84 @@
} }
} }
.warp { .login_warp {
position: relative; position: relative;
font-size: 24rpx; font-size: 24rpx;
height: calc(100vh); height: calc(100vh);
block-size: 100% 100%; block-size: 100% 100%;
// background-size: 100% 100%; background-color: #fafefc;
// border: 1px solid #000; .login_top_bg{
background-color: #fff; width:750rpx;
height:1324rpx;
position:absolute;
left:0rpx;
top:0rpx;
}
.login_top_warp{
width:750rpx;
height:482rpx;
position: relative;
.login_hello{
position: absolute;
left: 50rpx;
top: 226rpx;
color: rgba(51, 51, 51, 1);
.text_hello{
font-size: 32rpx;
font-weight: 400;
letter-spacing: 0rpx;
line-height: 40rpx;
}
.login_server_name{
margin-top:32rpx;
.text_server_name{
font-size: 40rpx;
font-weight: 500;
letter-spacing: 0rpx;
line-height: 40rpx;
}
}
}
}
.login_content{
display:flex;
justify-content: center;
flex-wrap:wrap;
position: relative;
.login-input-area{
width: 650rpx;
// border:1rpx red solid;
.user_phone{
display:flex;
align-items: center;
.user_phone_img{
width: 40rpx;
height: 40rpx;
}
}
.user_text_view{
margin-left:12rpx;
height: 40rpx;
line-height: 40rpx;
.view_text{
font-size: 30rpx;
font-weight: 500;
letter-spacing: 0rpx;
color: rgba(51, 51, 51, 1);
}
}
.input-bottom-border{
border-bottom: 2rpx #eeeeee solid;
}
.mt50{
margin-top:50rpx;
}
}
}
.submit_btn_view{
margin-top:120rpx;
width:650rpx;
} }
.fui-descr { .fui-descr {
...@@ -445,51 +468,9 @@ ...@@ -445,51 +468,9 @@
} }
} }
.login-bg-wrap {
position: absolute;
top: 260rpx;
width: 100%;
// border: 1px solid #000;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
.login-bg {
width: 124rpx;
height: 124rpx;
}
.logo-content-wrap {
// position: absolute;
// left: 40rpx;
// bottom: 40rpx;
font-size: 38rpx;
color: #474747;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
.logo-text {
margin-top: 20rpx;
font-weight: bold;
display: flex;
width: fit-content;
height: 40rpx;
line-height: 40rpx;
letter-spacing: 0.15em;
border-right: 0.2em solid transparent;
padding-right: 0.15em;
animation: blink-caret 1s infinite;
}
}
}
.form { .form {
position: absolute; position: absolute;
top: 500rpx; top: 480rpx;
width: 100%;
z-index: 10; z-index: 10;
} }
...@@ -515,7 +496,6 @@ ...@@ -515,7 +496,6 @@
} }
.fiexdText { .fiexdText {
// position: absolute;
width: 100%; width: 100%;
margin-top: 40rpx; margin-top: 40rpx;
} }
...@@ -527,4 +507,5 @@ ...@@ -527,4 +507,5 @@
.btn-register { .btn-register {
color: cadetblue; color: cadetblue;
} }
}
</style> </style>
<script setup lang="ts"> <script setup lang="ts">
import { reactive } from 'vue' import { reactive } from 'vue'
import { onShow } from '@dcloudio/uni-app' import { onShow } from '@dcloudio/uni-app'
import WeatherForecast from './components/WeatherForecast.vue' // import WeatherForecast from './components/WeatherForecast.vue'
import Navigate from '@/utils/page/navigate' import Navigate from '@/utils/page/navigate'
import dayjs from 'dayjs' import dayjs from 'dayjs'
...@@ -493,7 +493,7 @@ onHide(() => { ...@@ -493,7 +493,7 @@ onHide(() => {
<view class="codefun-flex-col group"> <view class="codefun-flex-col group">
<view class="codefun-flex-col section"> <view class="codefun-flex-col section">
<view class="codefun-flex-col"> <view class="codefun-flex-col">
<WeatherForecast /> <!-- <WeatherForecast /> -->
<!-- <text class="codefun-self-center font text">{{ pageData.header.title }}</text> --> <!-- <text class="codefun-self-center font text">{{ pageData.header.title }}</text> -->
<view class="codefun-flex-col codefun-self-stretch !hidden"> <view class="codefun-flex-col codefun-self-stretch !hidden">
<!-- <view class="codefun-flex-row codefun-items-center section_2"> <!-- <view class="codefun-flex-row codefun-items-center section_2">
...@@ -548,11 +548,10 @@ onHide(() => { ...@@ -548,11 +548,10 @@ onHide(() => {
</view> </view>
</view> </view>
<view class="codefun-flex-col mt-4"> <view class="codefun-flex-col mt-4">
<view class="codefun-flex-row codefun-justify-between codefun-items-center"> <!-- <view class="codefun-flex-row codefun-justify-between codefun-items-center">
<text class="font">我的农场</text> <text class="font">我的农场</text>
<!-- <text class="font_6 text_17">全部</text> --> </view> -->
</view> <view class="h-300rpx codefun-flex-col mr-3.5 mt-7 nongchang_box relative">
<view class="h-300rpx codefun-flex-col mr-3.5 mt-17 nongchang_box relative">
<image class="w-full h-full" src="/static/images/nongchang/mynongchang-1.png" /> <image class="w-full h-full" src="/static/images/nongchang/mynongchang-1.png" />
<view <view
v-show="pageData.hasFarm" v-show="pageData.hasFarm"
...@@ -807,8 +806,12 @@ onHide(() => { ...@@ -807,8 +806,12 @@ onHide(() => {
.group { .group {
.section { .section {
padding: 0 28rpx 98rpx; // padding: 0 28rpx 98rpx;
background-image: url('/static/images/codefun/7a5dc4ee864fe55da98b41c14ee3b931.png'); // background-image: url('/static/images/codefun/7a5dc4ee864fe55da98b41c14ee3b931.png');
padding-top: 98rpx;
height: 574rpx;
width: 750rpx;
background-image: linear-gradient(179.89deg, rgba(93, 182, 111, 1) 0%, rgba(230, 245, 232, 1) 100%);
background-size: 100% 100%; background-size: 100% 100%;
background-repeat: no-repeat; background-repeat: no-repeat;
...@@ -936,9 +939,9 @@ onHide(() => { ...@@ -936,9 +939,9 @@ onHide(() => {
} }
.group_6 { .group_6 {
margin-top: -92rpx; margin-top: -574rpx;
padding-left: 28rpx; padding-left: 28rpx;
z-index: 10;
.section_4 { .section_4 {
margin-right: 28rpx; margin-right: 28rpx;
padding: 28rpx 28rpx 24rpx; padding: 28rpx 28rpx 24rpx;
......
...@@ -11,7 +11,9 @@ import Navigate from '@/utils/page/navigate' ...@@ -11,7 +11,9 @@ import Navigate from '@/utils/page/navigate'
import * as AreaDict from '@/utils/dict/area' import * as AreaDict from '@/utils/dict/area'
import { getList } from '@/api/model/news' import { getList } from '@/api/model/news'
import { getList as getVideoList } from '@/api/model/knowledgeVideo' import { getList as getVideoList } from '@/api/model/knowledgeVideo'
import { useUserStore } from '@/store/modules/user'
const userStore = useUserStore()
const dictStore = useDictStore() const dictStore = useDictStore()
const model = reactive({ const model = reactive({
// 湖南省人民政府 // 湖南省人民政府
...@@ -86,7 +88,7 @@ onShow(() => { ...@@ -86,7 +88,7 @@ onShow(() => {
UserAPI.location({ lat: res.latitude, lon: res.longitude }) UserAPI.location({ lat: res.latitude, lon: res.longitude })
.then((res) => { .then((res) => {
console.log('UserAPI.location', res) console.log('UserAPI.location', res)
pageData.weather.detailedLocation = `${res.province}-${res.city}-${res.country}-${res.road pageData.weather.detailedLocation = `${res.country}-${res.road
}-${res.town}-${res.address}` }-${res.town}-${res.address}`
}) })
.catch(() => { .catch(() => {
...@@ -152,6 +154,14 @@ onPullDownRefresh(() => { ...@@ -152,6 +154,14 @@ onPullDownRefresh(() => {
}, 1000) }, 1000)
}) })
function openAITools() {
uni.navigateTo({
animationType: 'slide-in-bottom',
// 最新版 SDK Webview 嵌入版本,支持绑定用户 ID,支持自定义样式等
url: `/pages/common/chat/webview?token=&userId=${userStore.getUserInfo?.id}`,
})
}
function getWeatherRecommend(weather: string) { function getWeatherRecommend(weather: string) {
switch (weather) { switch (weather) {
case '晴': case '晴':
...@@ -464,14 +474,24 @@ onHide(() => { ...@@ -464,14 +474,24 @@ onHide(() => {
<image class="w-64 h-64" src="/static/images/home/icon.png" /> <image class="w-64 h-64" src="/static/images/home/icon.png" />
<text class="text">{{ pageData.header.title }}</text> <text class="text">{{ pageData.header.title }}</text>
</view> </view>
<text class="text" style="font-family: alimamashuheiti">湖南省</text> <!-- <text class="text" style="font-family: alimamashuheiti">湖南省</text> -->
</view> </view>
<!-- ai助手 --> <!-- ai助手 -->
<FuiMovableView top="650" right="10" zIndex="99999"> <!-- <FuiMovableView top="650" right="-12" zIndex="99999">
<view class="h-80rpx flex items-center" @click="openAITools"> <view class="h-80rpx flex items-center" @click="openAITools">
<image class="w-117rpx h-118rpx" src="/static/images/codefun/ai.png" alt="" /> <image class="w-117rpx h-118rpx" src="/static/images/codefun/ai.png" alt="" />
</view> </view>
</FuiMovableView> </FuiMovableView> -->
<view class="top-movable-area">
<movable-area class="movable-area">
<movable-view class="movable-view" direction="vertical" y="650rpx">
<view class="ai_icon" @click="openAITools">
<image class="ai_icon" src="/static/images/codefun/ai.png" alt="" />
</view>
</movable-view>
</movable-area>
</view>
<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">
...@@ -1604,4 +1624,22 @@ onHide(() => { ...@@ -1604,4 +1624,22 @@ onHide(() => {
text-overflow: ellipsis; text-overflow: ellipsis;
/* 可选,部分浏览器不生效 */ /* 可选,部分浏览器不生效 */
} }
.top-movable-area{
height: 100vh;
width: 122rpx;
position: fixed;
top: 0rpx;
right:0rpx;
z-index: 9999;
overflow: hidden;
.movable-area{
height: 100vh;
width: 122rpx;
.movable-view,.ai_icon{
width: 120rpx;
height: 120rpx;
}
}
}
</style> </style>
<script setup lang="ts">
// import { onMounted, onUnmounted, ref } from 'vue'
import { getQueryByType } from '/@/api/model/dict'
const mediaUrl = ref('')
const seconds = ref(4)
let timer = null
onLoad(() => {
getServiceItems()
})
onMounted(() => {
countdown()
})
onUnmounted(() => {
clearTimerInterval()
})
function clearTimerInterval() {
clearInterval(timer)
}
function getServiceItems() {
getQueryByType({ type: 2 }).then((res) => {
mediaUrl.value = res[0].mediaUrl
})
}
function countdown() {
timer = setInterval(() => {
if (seconds.value > 0) {
seconds.value -= 1
} else {
clearTimerInterval()
navigateToLogin()
}
}, 1000)
}
function navigateToLogin() {
uni.redirectTo({
url: '/pages/login/login',
})
}
</script>
<template>
<view class="container">
<image class="splash_bg" :src="mediaUrl" mode="aspectFill" />
<!-- <view class="middle_logo_content">
<view class="logo_view">
<image class="splash_logo" src="/static/images/home/icon.png" />
</view>
<image class="logo_text_bg" src="/static/images/splash/logo_text.png"></image>
<image class="server_text_bg" src="/static/images/splash/server_text.png"></image>
<image class="outline_bg" src="/static/images/splash/outline.png"></image>
</view> -->
<view class="countdown_view">
<image class="shadow_img" src="/static/images/splash/shadow.png" />
<view class="countdown_val"
><text>{{ seconds }}s</text></view
>
</view>
<view class="under_btn_view">
<fui-button
height="80rpx"
background="linear-gradient(233.81deg, rgba(92, 181, 110, 1) 0%, rgba(100, 214, 62, 1) 100%)"
size="28rpx"
radius="40rpx"
text="立即体验"
@click="navigateToLogin"
/>
</view>
</view>
</template>
<style lang="less" scoped>
.container {
height: 100vh;
width: 750rpx;
position: relative;
.splash_bg {
width: 100%;
height: 100vh;
}
.middle_logo_content {
position: absolute;
top: 250rpx;
left: 0rpx;
right: 0rpx;
display: flex;
flex-direction: column;
align-items: center;
.logo_view {
width: 136rpx;
height: 136rpx;
border-radius: 24rpx;
background-color: #fff;
display: flex;
justify-content: center;
align-items: center;
.splash_logo {
width: 110rpx;
height: 110rpx;
}
}
.logo_text_bg {
margin-top: 32rpx;
width: 192rpx;
height: 64rpx;
}
.server_text_bg {
width: 528rpx;
height: 116rpx;
}
.outline_bg {
margin-top: -36rpx;
width: 464rpx;
height: 54rpx;
}
}
.countdown_view {
position: absolute;
left: 612rpx;
top: 118rpx;
width: 108rpx;
height: 52rpx;
.shadow_img {
width: 108rpx;
height: 52rpx;
}
.countdown_val {
width: 108rpx;
height: 52rpx;
position: absolute;
left: 0rpx;
top: 0rpx;
display: flex;
justify-content: center;
align-items: center;
font-size: 26rpx;
color: #fff;
font-weight: 400;
}
}
.under_btn_view {
width: 650rpx;
position: absolute;
bottom: 52rpx;
left: 50rpx;
}
}
</style>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta
content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0,viewport-fit=cover"
name="viewport"
/>
<title>AI Chat</title>
<style>
body {
margin: 0;
padding: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
background-color: #fff;
}
#chat-bot {
position: fixed;
inset: 0;
z-index: 9999;
box-sizing: border-box;
/* 兼容 iOS < 11.2 */
padding-bottom: constant(safe-area-inset-bottom);
/* 兼容 iOS >= 11.2 */
padding-bottom: env(safe-area-inset-bottom);
/* 兼容 iOS < 11.2 */
padding-top: constant(safe-area-inset-top);
/* 兼容 iOS >= 11.2 */
padding-top: env(safe-area-inset-top);
}
.close-btn {
z-index: 99999;
position: absolute;
right: 12px;
top: calc(18px + constant(safe-area-inset-top));
top: calc(18px + env(safe-area-inset-top));
padding: 8px;
}
.android #chat-bot {
/* 兼容 iOS < 11.2 */
padding-top: calc(18px + constant(safe-area-inset-top));
/* 兼容 iOS >= 11.2 */
padding-top: calc(18px + env(safe-area-inset-top));
}
.android .close-btn {
/* 兼容 iOS < 11.2 */
top: calc(18px + 18px + constant(safe-area-inset-top));
/* 兼容 iOS >= 11.2 */
top: calc(18px + 18px + env(safe-area-inset-top));
}
</style>
</head>
<body>
<script
type="text/javascript"
src="https://hntq-res.oss-cn-shenzhen.aliyuncs.com/uni.webview.1.5.6.js"
></script>
<script type="text/javascript">
const u = navigator.userAgent
const isAndroid = u.includes('Android') || u.includes('Adr')
if (isAndroid) {
document.body.classList.add('android')
}
// 待触发 `UniAppJSBridgeReady` 事件后,即可调用 uni 的 API。
document.addEventListener('UniAppJSBridgeReady', function () {
// 添加关闭按钮
const div = document.createElement('div')
div.className = 'close-btn'
div.innerHTML =
'<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 24 24"><path fill="#666" d="m12 13.4l-4.9 4.9q-.275.275-.7.275t-.7-.275t-.275-.7t.275-.7l4.9-4.9l-4.9-4.9q-.275-.275-.275-.7t.275-.7t.7-.275t.7.275l4.9 4.9l4.9-4.9q.275-.275.7-.275t.7.275t.275.7t-.275.7L13.4 12l4.9 4.9q.275.275.275.7t-.275.7t-.7.275t-.7-.275z"/></svg>'
div.onclick = function () {
uni.navigateBack()
}
document.body.appendChild(div)
})
</script>
<div id="chat-bot"></div>
<script src="https://lf-cdn.coze.cn/obj/unpkg/flow-platform/chat-app-sdk/1.1.0-beta.0/libs/cn/index.js"></script>
<script>
function getUrlParams(url) {
const paramsObj = {}
if (!url) {
url = window.location.href
}
const questionIndex = url.indexOf('?')
if (questionIndex !== -1) {
const paramStr = url.slice(questionIndex + 1)
const paramArr = paramStr.split('&')
paramArr.forEach((param) => {
const [key, value] = param.split('=')
paramsObj[key] = decodeURIComponent(value)
})
}
return paramsObj
}
const params = getUrlParams()
const cozeWebSDK = new CozeWebSDK.WebChatClient({
config: {
bot_id: '7571349247409979402',
},
userInfo: {
id: params.userId,
url: 'https://hntq.yiring.com/minio/public/system/ai/hntq-ai-user-2.png',
// nickname: "壹润科技",
},
ui: {
base: {
layout: 'mobile',
lang: 'zh-CN',
icon: 'https://hntq.yiring.com/minio/public/system/ai/hntq-ai-logo.png',
},
header: {
isNeedClose: false,
},
footer: {
isShow: false,
},
chatBot: {
title: 'AI 农技助手',
uploadable: false,
el: document.getElementById('chat-bot'),
},
asstBtn: {
isNeed: false,
},
},
})
cozeWebSDK.showChatBot()
</script>
</body>
</html>
src/static/images/codefun/ai.png

10.4 KB | W: | H:

src/static/images/codefun/ai.png

17.6 KB | W: | H:

src/static/images/codefun/ai.png
src/static/images/codefun/ai.png
src/static/images/codefun/ai.png
src/static/images/codefun/ai.png
  • 2-up
  • Swipe
  • Onion skin
src/static/images/home/icon.png

2.7 KB | W: | H:

src/static/images/home/icon.png

102.2 KB | W: | H:

src/static/images/home/icon.png
src/static/images/home/icon.png
src/static/images/home/icon.png
src/static/images/home/icon.png
  • 2-up
  • Swipe
  • Onion skin
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论