健康随访表单提交
This commit is contained in:
parent
5726688c2e
commit
3691d5d90f
@ -1,11 +0,0 @@
|
|||||||
import { http } from '@/utils/http';
|
|
||||||
|
|
||||||
|
|
||||||
/*新增打卡记录*/
|
|
||||||
export function addApi(config : Object) {
|
|
||||||
return http({
|
|
||||||
url: '/cxc_rlzy.wbxm.wbdk/cxcRlzyWbdk/add',
|
|
||||||
method: 'POST',
|
|
||||||
data: config
|
|
||||||
})
|
|
||||||
}
|
|
@ -112,4 +112,13 @@ export function cxcRyDatAstatisticsDetails(parm) { // 员工信息统计
|
|||||||
method: 'GET',
|
method: 'GET',
|
||||||
data: parm
|
data: parm
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/*新增打卡记录*/
|
||||||
|
export function clockInApi(data : object) {
|
||||||
|
return http({
|
||||||
|
url: '/cxc_rlzy.wbxm.wbdk/cxcRlzyWbdk/add',
|
||||||
|
method: 'POST',
|
||||||
|
data
|
||||||
|
})
|
||||||
}
|
}
|
@ -18,4 +18,21 @@ export function queryIf3rdGxyApi(ldhth : string) { // 根据username获取职位
|
|||||||
ldhth
|
ldhth
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//查询登录人本月随访问题
|
||||||
|
export function querySfwtApi() {
|
||||||
|
return http({
|
||||||
|
url: '/jksf.tbb/cxcGwjktbTbb/querySfwtByMonthLdhth',
|
||||||
|
method: 'GET'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 提交随访问题
|
||||||
|
export function editApi(data : object) {
|
||||||
|
return http({
|
||||||
|
url: '/jksf.tbb/cxcGwjktbTbb/editCxcGwjktbTbbZb',
|
||||||
|
method: 'PUT',
|
||||||
|
data
|
||||||
|
})
|
||||||
}
|
}
|
@ -90,10 +90,34 @@ export function getDictItemsApi(dictCode : string) { // 字典标签专用
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function deleteFile(config : object){//删除文件 by 闵
|
export function deleteFile(config : object) {//删除文件 by 闵
|
||||||
return http({
|
return http({
|
||||||
url: `/sys/common/deleteFileAndCache`,
|
url: `/sys/common/deleteFileAndCache`,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
data: config
|
data: config
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*根据经纬度获取地理位置*/
|
||||||
|
export function getLocationApi(longitude : number, latitude : number) {
|
||||||
|
return http({
|
||||||
|
url: `/sys/common/getLocation`,
|
||||||
|
method: 'GET',
|
||||||
|
data: {
|
||||||
|
longitude,
|
||||||
|
latitude
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/*根据经纬度或城市名称获取天气信息*/
|
||||||
|
export function getWeatherApi(longitude : number, latitude : number) {
|
||||||
|
return http({
|
||||||
|
url: `/sys/common/getWeather`,
|
||||||
|
method: 'GET',
|
||||||
|
data: {
|
||||||
|
longitude,
|
||||||
|
latitude
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
@ -27,7 +27,7 @@
|
|||||||
:rules="[{ required: true, message: '请选择结束时间' }]" :min-date="minEndtime" />
|
:rules="[{ required: true, message: '请选择结束时间' }]" :min-date="minEndtime" />
|
||||||
<wd-picker label="审批领导" prop="examineleader" v-model="model.examineleader" v-if="zwmc == '0'"
|
<wd-picker label="审批领导" prop="examineleader" v-model="model.examineleader" v-if="zwmc == '0'"
|
||||||
:columns="examineleaderData" :rules="[{ required: true, message: '请选择审批领导'}]" />
|
:columns="examineleaderData" :rules="[{ required: true, message: '请选择审批领导'}]" />
|
||||||
<wd-picker label="单位劳资员" prop="hr" v-model="model.hr" :columns="hrData" v-if="zwmc == '0'"/>
|
<wd-picker label="单位劳资员" prop="hr" v-model="model.hr" :columns="hrData" v-if="zwmc == '0'" />
|
||||||
<SelectUser label="班组长" v-model="model.teamleader" isRadioSelection v-if="zwmc == '0'"></SelectUser>
|
<SelectUser label="班组长" v-model="model.teamleader" isRadioSelection v-if="zwmc == '0'"></SelectUser>
|
||||||
<wd-input label="出发地" prop="departure" v-model="model.departure"
|
<wd-input label="出发地" prop="departure" v-model="model.departure"
|
||||||
:rules="[{ required: true, message: '请输入出发地' }]" />
|
:rules="[{ required: true, message: '请输入出发地' }]" />
|
||||||
@ -251,8 +251,8 @@
|
|||||||
} else {
|
} else {
|
||||||
toast.warning(res.message)
|
toast.warning(res.message)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
handleClickLeft()
|
uni.navigateBack()
|
||||||
}, 1000)
|
}, 2000)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -333,13 +333,20 @@
|
|||||||
roleId: '1554379432313397250',
|
roleId: '1554379432313397250',
|
||||||
orgCode: userStore.userInfo.orgCode
|
orgCode: userStore.userInfo.orgCode
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
model.hr = res.result[0].username
|
if (res.result.length == 0) {
|
||||||
hrData.value = res.result.map(item => {
|
toast.warning('请切换工作单位!')
|
||||||
return {
|
setTimeout(() => {
|
||||||
label: item.realname,
|
uni.navigateBack()
|
||||||
value: item.username
|
}, 2000)
|
||||||
}
|
} else {
|
||||||
})
|
model.hr = res.result[0].username
|
||||||
|
hrData.value = res.result.map(item => {
|
||||||
|
return {
|
||||||
|
label: item.realname,
|
||||||
|
value: item.username
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
145
src/pages-politics/health/followup.vue
Normal file
145
src/pages-politics/health/followup.vue
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
<route lang="json5" type="page">
|
||||||
|
{
|
||||||
|
layout: 'default',
|
||||||
|
style: {
|
||||||
|
navigationStyle: 'custom',
|
||||||
|
navigationBarTitleText: '健康随访',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</route>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<PageLayout navTitle="健康随访">
|
||||||
|
<wd-form ref="form" :model="model">
|
||||||
|
<wd-cell-group border>
|
||||||
|
<view v-for="(item, index) in list" :key="index" class="question-item">
|
||||||
|
<view class="question-text">{{ index + 1 }}. {{ item.tbnr }}</view>
|
||||||
|
<wd-radio-group v-model="answers[item.id]" class="radio-group">
|
||||||
|
<wd-radio value="是" class="radio-item">是</wd-radio>
|
||||||
|
<wd-radio value="否" class="radio-item">否</wd-radio>
|
||||||
|
</wd-radio-group>
|
||||||
|
</view>
|
||||||
|
</wd-cell-group>
|
||||||
|
|
||||||
|
<view class="footer" v-if="list.length">
|
||||||
|
<wd-button type="primary" size="large" block round @click="submitForm">提交问卷</wd-button>
|
||||||
|
</view>
|
||||||
|
</wd-form>
|
||||||
|
</PageLayout>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {
|
||||||
|
useToast
|
||||||
|
} from 'wot-design-uni'
|
||||||
|
import {
|
||||||
|
querySfwtApi,
|
||||||
|
editApi
|
||||||
|
} from '@/api/politics/health'
|
||||||
|
const toast = useToast()
|
||||||
|
const model = ref({})
|
||||||
|
const list = ref([])
|
||||||
|
const answers = ref({}) // 用于存储所有问题的答案
|
||||||
|
const allAnswered = computed(() => {
|
||||||
|
return list.value.every(item => answers.value[item.id])
|
||||||
|
})
|
||||||
|
|
||||||
|
const getList = () => {
|
||||||
|
querySfwtApi().then(res => {
|
||||||
|
list.value = res.result
|
||||||
|
if (res.result.length > 0) {
|
||||||
|
// 检查是否已填写
|
||||||
|
if (res.result.every(item => item.sf)) {
|
||||||
|
toast.warning('本月问卷已提交!')
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.navigateBack()
|
||||||
|
}, 2000)
|
||||||
|
}
|
||||||
|
// 初始化答案对象
|
||||||
|
answers.value = res.result.reduce((acc, item) => {
|
||||||
|
acc[item.id] = ''
|
||||||
|
return acc
|
||||||
|
}, {})
|
||||||
|
|
||||||
|
} else {
|
||||||
|
toast.warning('未查询到本月随访问题!')
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.navigateBack()
|
||||||
|
}, 2000)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const submitForm = () => {
|
||||||
|
if (!allAnswered.value) {
|
||||||
|
toast.warning('请回答所有问题!')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
editApi({
|
||||||
|
answers: answers.value
|
||||||
|
}).then(res => {
|
||||||
|
if (res.success) {
|
||||||
|
toast.success(res.message)
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.navigateBack()
|
||||||
|
}, 2000)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
onLoad(() => {
|
||||||
|
/*获取随访问题*/
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.question-item {
|
||||||
|
padding: 20rpx 24rpx;
|
||||||
|
border-bottom: 1rpx solid #f5f5f5;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.question-text {
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #333;
|
||||||
|
font-weight: 500;
|
||||||
|
margin-bottom: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.radio-group {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.radio-item {
|
||||||
|
flex: 1;
|
||||||
|
|
||||||
|
:deep(.wd-radio__label) {
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.wd-radio__button) {
|
||||||
|
border-radius: 12rpx;
|
||||||
|
padding: 16rpx 0;
|
||||||
|
text-align: center;
|
||||||
|
background: #f7f7f7;
|
||||||
|
border: none;
|
||||||
|
transition: all 0.3s;
|
||||||
|
|
||||||
|
&.is-checked {
|
||||||
|
background: #4b8df8;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
padding: 12px;
|
||||||
|
|
||||||
|
}
|
||||||
|
</style>
|
@ -479,6 +479,15 @@
|
|||||||
"navigationStyle": "custom",
|
"navigationStyle": "custom",
|
||||||
"navigationBarTitleText": "健康填报"
|
"navigationBarTitleText": "健康填报"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "health/followup",
|
||||||
|
"type": "page",
|
||||||
|
"layout": "default",
|
||||||
|
"style": {
|
||||||
|
"navigationStyle": "custom",
|
||||||
|
"navigationBarTitleText": "健康随访"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -61,8 +61,8 @@
|
|||||||
import { getEnvBaseUrl } from '@/utils/index'
|
import { getEnvBaseUrl } from '@/utils/index'
|
||||||
import { queryPostByUserIdApi, editUserApi } from '@/api/system/user'
|
import { queryPostByUserIdApi, editUserApi } from '@/api/system/user'
|
||||||
import { useAppStore } from '@/store'
|
import { useAppStore } from '@/store'
|
||||||
import { addApi } from '@/api/humanResource/clockin'
|
import { clockInApi } from '@/api/humanResource/personnel'
|
||||||
|
|
||||||
const appStore = useAppStore();
|
const appStore = useAppStore();
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
const toast = useToast()
|
const toast = useToast()
|
||||||
@ -156,19 +156,30 @@
|
|||||||
toast.warning('H5暂不支持')
|
toast.warning('H5暂不支持')
|
||||||
// #endif
|
// #endif
|
||||||
}
|
}
|
||||||
|
|
||||||
const clockin = () => {
|
const clockin = () => {
|
||||||
if (loading.value) return
|
if (loading.value) return
|
||||||
addApi({
|
loading.value = true;
|
||||||
weizhi: appStore.clockin
|
uni.getLocation({
|
||||||
}).then((res : any) => {
|
type: 'wgs84',
|
||||||
if(res.success){
|
success: function (position) {
|
||||||
toast.success(res.message)
|
clockInApi({
|
||||||
}else{
|
longitude: position.longitude,
|
||||||
toast.warning(res.message)
|
latitude: position.latitude
|
||||||
|
}).then((res : any) => {
|
||||||
|
if (res.success) {
|
||||||
|
toast.success(res.message)
|
||||||
|
} else {
|
||||||
|
toast.warning(res.message)
|
||||||
|
}
|
||||||
|
loading.value = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
fail: function (err) {
|
||||||
|
toast.warning('请打开系统定位再打卡!')
|
||||||
|
loading.value = false
|
||||||
}
|
}
|
||||||
loading.value = true
|
});
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BIN
src/static/index/index/followup.png
Normal file
BIN
src/static/index/index/followup.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.6 KiB |
@ -15,7 +15,6 @@ export const useAppStore = defineStore('app', {
|
|||||||
isGray: 0 as 0 | 1, // 0=正常,1=灰化
|
isGray: 0 as 0 | 1, // 0=正常,1=灰化
|
||||||
position: null, //市
|
position: null, //市
|
||||||
location: null, //省市区
|
location: null, //省市区
|
||||||
clockin: null, //详细位置 精确到街道
|
|
||||||
temperature: null, //温度
|
temperature: null, //温度
|
||||||
weather: null //天气
|
weather: null //天气
|
||||||
}),
|
}),
|
||||||
@ -29,9 +28,6 @@ export const useAppStore = defineStore('app', {
|
|||||||
setLocation(value : string) {
|
setLocation(value : string) {
|
||||||
this.location = value
|
this.location = value
|
||||||
},
|
},
|
||||||
setClockin(value : string) {
|
|
||||||
this.clockin = value
|
|
||||||
},
|
|
||||||
setTemperature(value : number) {
|
setTemperature(value : number) {
|
||||||
this.temperature = value
|
this.temperature = value
|
||||||
},
|
},
|
||||||
|
1
src/types/uni-pages.d.ts
vendored
1
src/types/uni-pages.d.ts
vendored
@ -53,6 +53,7 @@ interface NavigateToOptions {
|
|||||||
"/pages-humanResource/personnel/standingbook" |
|
"/pages-humanResource/personnel/standingbook" |
|
||||||
"/pages-integrated/duty/index" |
|
"/pages-integrated/duty/index" |
|
||||||
"/pages-politics/health/add" |
|
"/pages-politics/health/add" |
|
||||||
|
"/pages-politics/health/followup" |
|
||||||
"/pages-process/approvalTabbar" |
|
"/pages-process/approvalTabbar" |
|
||||||
"/pages-process/myApplyProcess" |
|
"/pages-process/myApplyProcess" |
|
||||||
"/pages-process/taskHandle" |
|
"/pages-process/taskHandle" |
|
||||||
|
@ -2,7 +2,7 @@ import { defineStore } from 'pinia'
|
|||||||
import { pages, subPackages, tabBar } from '@/pages.json'
|
import { pages, subPackages, tabBar } from '@/pages.json'
|
||||||
import { isMpWeixin } from './platform'
|
import { isMpWeixin } from './platform'
|
||||||
import { useAppStore } from '@/store'
|
import { useAppStore } from '@/store'
|
||||||
import { upDateAppApi } from '@/api/system'
|
import { upDateAppApi, getLocationApi, getWeatherApi } from '@/api/system'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -232,11 +232,9 @@ export const useUpdateApp = defineStore('updateApp', () => {
|
|||||||
try {
|
try {
|
||||||
let path = ''
|
let path = ''
|
||||||
let webApp = import.meta.env.VITE_WEBAPP
|
let webApp = import.meta.env.VITE_WEBAPP
|
||||||
console.log(webApp)
|
if (webApp) {//如果是测试环境 ,upDateAppApi 传递参数 by min
|
||||||
if(webApp){//如果是测试环境 ,upDateAppApi 传递参数 by min
|
|
||||||
path = webApp
|
path = webApp
|
||||||
}
|
}
|
||||||
console.log(path)
|
|
||||||
upDateAppApi(path).then(async (res : any) => {
|
upDateAppApi(path).then(async (res : any) => {
|
||||||
let {
|
let {
|
||||||
result
|
result
|
||||||
@ -285,19 +283,19 @@ export const useUpdateApp = defineStore('updateApp', () => {
|
|||||||
* @param isWgt 是否是热资源更新 默认不是
|
* @param isWgt 是否是热资源更新 默认不是
|
||||||
*/
|
*/
|
||||||
export const hasNewVersion = (version, isWgt = false) => {
|
export const hasNewVersion = (version, isWgt = false) => {
|
||||||
// #ifdef APP_PLUS
|
// #ifdef APP_PLUS
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
if (isWgt) {
|
if (isWgt) {
|
||||||
plus.runtime.getProperty(plus.runtime.appid, (widgetInfo) => {
|
plus.runtime.getProperty(plus.runtime.appid, (widgetInfo) => {
|
||||||
const currentVersion = widgetInfo.versionCode
|
const currentVersion = widgetInfo.versionCode
|
||||||
resolve(Number(version) > Number(currentVersion))
|
resolve(Number(version) > Number(currentVersion))
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
const currentVersion = plus.runtime.versionCode
|
const currentVersion = plus.runtime.versionCode
|
||||||
resolve(Number(version) > Number(currentVersion))
|
resolve(Number(version) > Number(currentVersion))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// #endif
|
// #endif
|
||||||
}
|
}
|
||||||
|
|
||||||
export function onClickUpdate(updateType : string, url) {
|
export function onClickUpdate(updateType : string, url) {
|
||||||
@ -389,108 +387,38 @@ export const getLocation = () => {
|
|||||||
type: 'wgs84',
|
type: 'wgs84',
|
||||||
success: function (position) {
|
success: function (position) {
|
||||||
// 成功获取位置后请求地理编码
|
// 成功获取位置后请求地理编码
|
||||||
uni.request({
|
getLocationApi(position.longitude, position.latitude).then((res : any) => {
|
||||||
url: 'https://api.tianditu.gov.cn/geocoder',
|
if (res) {
|
||||||
method: 'GET',
|
const obj = res.addressComponent
|
||||||
data: {
|
store.setPosition(obj.city ? obj.city : obj.province) //市
|
||||||
postStr: JSON.stringify({
|
store.setLocation(obj.city ? obj.province + obj.city + obj.county : obj.province + obj.county) //省市区
|
||||||
lon: position.longitude,
|
getWeather(position.longitude, position.latitude)
|
||||||
lat: position.latitude,
|
} else {
|
||||||
ver: 1
|
|
||||||
}),
|
|
||||||
type: 'geocode',
|
|
||||||
tk: '30fe0f0c1b2320e112bde797f3ddaff4'
|
|
||||||
},
|
|
||||||
success: function (res : any) {
|
|
||||||
let data = res.data;
|
|
||||||
if (data.status == 0) {
|
|
||||||
const obj = data.result.addressComponent
|
|
||||||
store.setPosition(obj.city ? obj.city : obj.province) //市
|
|
||||||
store.setLocation(obj.city ? obj.province + obj.city + obj.county : obj.province + obj.county) //省市区
|
|
||||||
store.setClockin(data.result.formatted_address)
|
|
||||||
getWeather(position.latitude, position.longitude)
|
|
||||||
} else {
|
|
||||||
handleDefaultLocation()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
fail: function (err) {
|
|
||||||
// uni.showToast({
|
|
||||||
// title: '位置解析失败',
|
|
||||||
// icon: 'error'
|
|
||||||
// })
|
|
||||||
handleDefaultLocation()
|
handleDefaultLocation()
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
fail: function (err) {
|
fail: function () {
|
||||||
// 根据不同错误码处理
|
|
||||||
// if (err.errCode === 2 || err.errCode === 12) {
|
|
||||||
// // 2: 位置服务不可用, 12: 定位权限未开启
|
|
||||||
// uni.showToast({
|
|
||||||
// title: '请开启定位服务',
|
|
||||||
// icon: 'error'
|
|
||||||
// })
|
|
||||||
|
|
||||||
// } else {
|
|
||||||
// uni.showToast({
|
|
||||||
// title: '定位获取失败',
|
|
||||||
// icon: 'error'
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
handleDefaultLocation()
|
handleDefaultLocation()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const getWeather = (lat : number, lon : number) => {
|
|
||||||
let params = {
|
|
||||||
lat: lat,
|
|
||||||
lon: lon
|
|
||||||
}
|
|
||||||
weatherRequest(params)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理默认位置和天气
|
// 处理默认位置和天气
|
||||||
function handleDefaultLocation() {
|
function handleDefaultLocation() {
|
||||||
useAppStore().setPosition('濮阳市')
|
useAppStore().setPosition('濮阳市')
|
||||||
weatherRequest({
|
getWeather(115.08784, 35.773116) // //油田总部经纬度
|
||||||
q: '濮阳市'
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function weatherRequest(params : { lat ?: number; lon ?: number; q ?: string }) {
|
function getWeather(lon : number, lat : number) {
|
||||||
const store = useAppStore()
|
const store = useAppStore()
|
||||||
uni.request({
|
getWeatherApi(lon, lat).then((res : any) => {
|
||||||
url: 'https://api.openweathermap.org/data/2.5/weather',
|
if (res) {
|
||||||
method: 'GET',
|
store.setTemperature(Math.round(res.main.temp - 273.15))
|
||||||
data: {
|
store.setWeather(res.weather[0].icon)
|
||||||
...params,
|
}
|
||||||
appid: '600a60694b0e453dfbaafa862f1d1482',
|
})
|
||||||
lang: 'zh_cn'
|
|
||||||
},
|
|
||||||
success: function (res : any) {
|
|
||||||
if (res.data && res.data.main && res.data.weather) {
|
|
||||||
store.setTemperature(
|
|
||||||
Math.round(res.data.main.temp - 273.15)
|
|
||||||
)
|
|
||||||
store.setWeather(
|
|
||||||
res.data.weather[0].icon
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
// uni.showToast({
|
|
||||||
// title: '天气数据格式错误',
|
|
||||||
// icon: 'error'
|
|
||||||
// })
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// fail: function () {
|
|
||||||
// uni.showToast({
|
|
||||||
// title: '天气获取失败',
|
|
||||||
// icon: 'error'
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const imgUrl = (url : string) => {
|
export const imgUrl = (url : string) => {
|
||||||
@ -518,7 +446,7 @@ export function getFileAccessHttpUrl(avatar, subStr) {
|
|||||||
/* 获取文件名 */
|
/* 获取文件名 */
|
||||||
export function getFilename(text : string) {
|
export function getFilename(text : string) {
|
||||||
if (!text) {
|
if (!text) {
|
||||||
return text === null ? null : "";
|
return text === null ? null : "";
|
||||||
}
|
}
|
||||||
if (text.indexOf(',') > 0) {
|
if (text.indexOf(',') > 0) {
|
||||||
let arr = text.split(",")
|
let arr = text.split(",")
|
||||||
|
Loading…
Reference in New Issue
Block a user