乡村相册

This commit is contained in:
yanran200730
2022-05-24 13:49:03 +08:00
parent d89ee74993
commit e7c61c8293
8 changed files with 111 additions and 60 deletions

View File

@@ -87,7 +87,8 @@
albumName: '',
watermarkList: [],
isShowAlbum: false,
albumList: []
albumList: [],
address: {}
}
},
@@ -116,12 +117,7 @@
this.height = uni.getSystemInfoSync().windowHeight
this.getWatermarkList()
this.getLocation()
this.$http.post('/api/appdvcpconfig/apiForward', 'https://apis.map.qq.com/ws/geocoder/v1/?location=39.984154,116.307490&key=3RZBZ-LZUCF-CT6J5-NWKZH-FCWOQ-UUFKY&get_poi=1').then(res => {
console.log(res)
})
},
methods: {
@@ -170,18 +166,46 @@
})
},
getWeather (code) {
this.$http.post(`/api/bdweather/wdata?districtId=${code}`).then(res => {
console.log(res)
if (res.code === 0) {
const data = res.data.result.now
uni.setStorageSync('address', {
...uni.getStorageSync('address'),
weather: data.text || ''
})
this.address = {
...uni.getStorageSync('address'),
weather: data.text || ''
}
}
})
},
getLocation () {
this.injectJWeixin(['getLocation']).then(res => {
console.log(res)
wx.getLocation({
type: 'wgs84',
success: function (res) {
success: res => {
var lat = res.latitude
var lng = res.longitude
console.log(lat, lng)
this.$http.post('/api/appdvcpconfig/apiForward',
`https://apis.map.qq.com/ws/geocoder/v1/?location=${lat},${lng}&key=3RZBZ-LZUCF-CT6J5-NWKZH-FCWOQ-UUFKY&get_poi=1`).then(res => {
console.log(res)
if (res.code === 0) {
const data = res.data.result
uni.setStorageSync('address', {
lat,
lng,
address: data.address,
cityCode: `${data.ad_info.adcode}`
})
this.getWeather(`${data.ad_info.adcode}`)
}
})
},
error: res => {

View File

@@ -14,7 +14,6 @@
</template>
<script>
import { mapActions } from 'vuex'
export default {
props: ['config'],
@@ -68,6 +67,8 @@
this.isShowWeather = weather.status === '1'
this.isShowRemark = remark.status === '1'
this.remark = remark.defaultValue || ''
this.address = uni.getStorageSync('address').address || ''
this.weather = uni.getStorageSync('address').weather || ''
}
},
deep: true
@@ -75,7 +76,23 @@
},
created () {
this.configList = JSON.parse(JSON.stringify(this.config))
this.configList = JSON.parse(JSON.stringify(this.config)).map(v => {
if (v.fieldType === '3') {
v.defaultValue = uni.getStorageSync('address').address || ''
}
if (v.fieldType === '2') {
v.defaultValue = uni.getStorageSync('address').weather || ''
}
if (v.fieldType === '7') {
v.defaultValue = this.$dayjs().format('YYYY-MM-DD')
this.week = new Date().getDay()
}
if (v.fieldType === '6') {
v.defaultValue = this.$dayjs().format('HH:mm')
}
return v
})
this.date = this.$dayjs(new Date).format('YYYY-MM-DD')
this.time = this.$dayjs().format('HH:mm')
@@ -85,8 +102,6 @@
this.week = new Date().getDay()
}, 1000)
// this.getLocation()
uni.$on('change', e => {
this.configList = e
})
@@ -97,24 +112,6 @@
},
methods: {
...mapActions(['injectJWeixin']),
getLocation () {
this.injectJWeixin(['getLocation']).then(res => {
wx.getLocation({
type: 'wgs84',
success: function (res) {
var lat = res.latitude
var lng = res.longitude
console.log(lat, lng)
},
error: res => {
console.log(res)
}
})
})
},
linkTo (url) {
uni.setStorageSync('waterConfig', this.configList)
uni.navigateTo({

View File

@@ -27,7 +27,7 @@
week: '',
timer: null,
name: '',
weather: '晴转多云',
weather: '',
title: '巡检水印',
configList: [],
matters: '',
@@ -87,6 +87,7 @@
this.name = name.defaultValue || ''
this.date = date.defaultValue || this.$dayjs(new Date).format('YYYY-MM-DD')
this.time = time.defaultValue || this.$dayjs().format('HH:mm')
this.weather = uni.getStorageSync('address').weather || ''
this.matters = matters.defaultValue || ''
this.week = date.defaultValue ? this.$dayjs(date.defaultValue).day() : new Date().getDay()
}
@@ -104,16 +105,13 @@
if (v.fieldType === '6') {
v.defaultValue = this.$dayjs().format('HH:mm')
}
if (v.fieldType === '2') {
v.defaultValue = uni.getStorageSync('address').weather || ''
}
return v
})
// this.timer = setInterval(() => {
// this.date = this.$dayjs().format('YYYY-MM-DD')
// this.time = this.$dayjs().format('HH:mm')
// this.week = new Date().getDay()
// }, 1000)
uni.$on('change', e => {
this.configList = e
})

View File

@@ -66,6 +66,7 @@
const remark = v.filter(v => v.type === '4')[0]
this.isShowRemark = remark.status === '1'
this.remark = remark.defaultValue || ''
this.address = uni.getStorageSync('address').address || ''
}
},
deep: true
@@ -74,10 +75,15 @@
created () {
this.configList = JSON.parse(JSON.stringify(this.config)).map(v => {
if (v.fieldType === '3') {
v.defaultValue = uni.getStorageSync('address').address || ''
}
if (v.fieldType === '7') {
v.defaultValue = this.$dayjs().format('YYYY-MM-DD')
this.week = new Date().getDay()
}
if (v.fieldType === '6') {
v.defaultValue = this.$dayjs().format('HH:mm')
}

View File

@@ -62,6 +62,14 @@
configList: {
handler: function (v) {
if (v.length) {
const date = v.filter(v => v.type === '1')[0]
const time = v.filter(v => v.type === '0')[0]
const title = v.filter(v => v.type === '5')[0]
this.title = title.defaultValue || ''
this.date = date.defaultValue || this.$dayjs(new Date).format('YYYY-MM-DD')
this.time = time.defaultValue || this.$dayjs().format('HH:mm')
this.week = date.defaultValue ? this.$dayjs(date.defaultValue).day() : new Date().getDay()
this.address = uni.getStorageSync('address').address || ''
}
},
deep: true
@@ -70,24 +78,26 @@
created () {
this.configList = JSON.parse(JSON.stringify(this.config)).map(v => {
if (v.fieldType === '3') {
v.defaultValue = uni.getStorageSync('address').address || ''
}
if (v.fieldType === '7') {
v.defaultValue = this.$dayjs().format('YYYY-MM-DD')
this.week = new Date().getDay()
}
if (v.fieldType === '6') {
v.defaultValue = this.$dayjs().format('HH:mm')
}
return v
})
this.date = this.$dayjs(new Date).format('YYYY-MM-DD')
this.time = this.$dayjs().format('HH:mm')
this.week = new Date().getDay()
this.timer = setInterval(() => {
this.time = this.$dayjs().format('HH:mm')
}, 1000)
uni.$on('change', e => {
this.configList = e
})

View File

@@ -74,7 +74,11 @@
this.isShowAddress = address.status === '1'
this.isShowDate = date.status === '1'
this.isShowTime = time.status === '1'
this.title = title.title || ''
this.title = title.defaultValue || ''
this.date = date.defaultValue || this.$dayjs(new Date).format('YYYY-MM-DD')
this.time = time.defaultValue || this.$dayjs().format('HH:mm')
this.week = date.defaultValue ? this.$dayjs(date.defaultValue).day() : new Date().getDay()
this.address = uni.getStorageSync('address').address || ''
}
},
deep: true
@@ -83,6 +87,10 @@
created () {
this.configList = JSON.parse(JSON.stringify(this.config)).map(v => {
if (v.fieldType === '3') {
v.defaultValue = uni.getStorageSync('address').address || ''
}
if (v.fieldType === '7') {
v.defaultValue = this.$dayjs().format('YYYY-MM-DD')
this.week = new Date().getDay()
@@ -93,14 +101,10 @@
return v
})
this.date = this.$dayjs(new Date).format('YYYY-MM-DD')
this.time = this.$dayjs().format('HH:mm')
this.timer = setInterval(() => {
this.date = this.$dayjs().format('YYYY-MM-DD')
this.time = this.$dayjs().format('HH:mm')
this.week = new Date().getDay()
}, 1000)
this.week = new Date().getDay()
uni.$on('change', e => {
this.configList = e

View File

@@ -109,6 +109,7 @@
this.gridName = gridName.defaultValue || ''
this.serviceName = serviceName.defaultValue || ''
this.text = text.defaultValue || ''
this.address = uni.getStorageSync('address').address || ''
}
},
deep: true
@@ -116,7 +117,13 @@
},
created () {
this.configList = JSON.parse(JSON.stringify(this.config))
this.configList = JSON.parse(JSON.stringify(this.config)).map(v => {
if (v.fieldType === '3') {
v.defaultValue = uni.getStorageSync('address').address || ''
}
return v
})
this.date = this.$dayjs(new Date).format('YYYY-MM-DD')
this.time = this.$dayjs().format('HH:mm')

View File

@@ -1,7 +1,7 @@
<template>
<div class="Watermark7" @click="linkTo('./WatermarkConfig')">
<image src="../../images/hjws.png" />
<h2>{{ title }}</h2>
<h2 v-if="isShowTitle">{{ title }}</h2>
<div class="middle">
<div class="top">
<h2>{{ time }}</h2>
@@ -9,7 +9,7 @@
</div>
<div class="bottom">{{ date }} {{ weekCn }}</div>
</div>
<div class="bottom" v-if="isShowAddress">{{ address }}</div>
<div class="bottom" v-show="isShowAddress">{{ address }}</div>
</div>
</template>
@@ -24,9 +24,10 @@
time: '',
title: '',
week: '',
weather: '晴转多云',
address: '武汉市·绿地蓝海国际A座',
weather: '',
address: '',
timer: null,
isShowTitle: true,
isShowAddress: true,
configList: []
}
@@ -65,7 +66,10 @@
const address = v.filter(v => v.type === '3')[0]
const title = v.filter(v => v.type === '5')[0]
this.isShowAddress = address.status === '1'
this.isShowTitle = title.status === '1'
this.title = title.defaultValue || ''
this.address = uni.getStorageSync('address').address || ''
this.weather = uni.getStorageSync('address').weather || ''
}
},
deep: true
@@ -74,6 +78,12 @@
created () {
this.configList = JSON.parse(JSON.stringify(this.config)).map(v => {
if (v.fieldType === '3') {
v.defaultValue = uni.getStorageSync('address').address || ''
}
if (v.fieldType === '2') {
v.defaultValue = uni.getStorageSync('address').weather || ''
}
if (v.fieldType === '7') {
v.defaultValue = this.$dayjs().format('YYYY-MM-DD')
this.week = new Date().getDay()
@@ -86,12 +96,7 @@
})
this.date = this.$dayjs(new Date).format('YYYY-MM-DD')
this.time = this.$dayjs().format('HH:mm')
this.timer = setInterval(() => {
this.date = this.$dayjs().format('YYYY-MM-DD')
this.time = this.$dayjs().format('HH:mm')
this.week = new Date().getDay()
}, 1000)
this.week = new Date().getDay()
uni.$on('change', e => {
this.configList = e