落日与鲸
2025-02-24 018225985d7b82ad8b6cd92f1c83e6564563fcfe
接口
3个文件已修改
118 ■■■■ 已修改文件
H5/pages/Appeal/Appeal.vue 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
H5/pages/index/index.vue 64 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
H5/pages/location/location.vue 41 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
H5/pages/Appeal/Appeal.vue
@@ -116,6 +116,8 @@
                detailedAddress: '',
                descriptionTitle: '',
                descriptionContent: '',
                latitude:'',
                longitude:'',
                images: [],
                videos: [],
            };
@@ -154,10 +156,13 @@
            getproblem() {
                getproblem().then((resp => {
                    console.log(resp, '问题类型')
                    this.columns =[resp.data.map(item=>{
                        return item.name
                    })]
                }))
            },
            submit() {
                const preciseRegex = '/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/';
                const preciseRegex = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/;
                if(!this.time){
                    uni.showToast({
                        title:'请选择时间',
@@ -179,7 +184,7 @@
                        title:'请输入联系电话',
                        icon:'none'
                    })
                }else if(!preciseRegex.test(phoneNumber)){
                }else if(!preciseRegex.test(this.contactNumber)){
                    uni.showToast({
                        title:'请输入正确的手机号',
                        icon:'none'
@@ -221,13 +226,15 @@
                    name: this.name,
                    contactNumber: this.contactNumber,
                    location: this.location,
                    latitude:this.latitude,
                    longitude:this.longitude,
                    detailedAddress: this.detailedAddress,
                    descriptionTitle: this.descriptionTitle,
                    descriptionContent: this.descriptionContent,
                    images: this.images.join(','),
                    videos: this.videos.join(','),
                }
                save().then(resp => {
                save(data).then(resp => {
                    console.log(resp, '保存');
                    if(resp.code==200){
                        uni.showToast({
H5/pages/index/index.vue
@@ -10,9 +10,10 @@
                </view>
                <swiper class="swiper " :indicator-dots="false" :autoplay="true" :interval="3000">
                    <swiper-item v-for="item,index in bannerlist" :key="index">
                        <image style="height: 270rpx;width: 688rpx;border-radius: 19rpx;" :src="item.url" mode=""></image>
                        <image style="height: 270rpx;width: 688rpx;border-radius: 19rpx;" :src="item.url" mode="">
                        </image>
                    </swiper-item>
                </swiper>
            </view>
        </view>
@@ -66,18 +67,18 @@
                    <view class="flex a-center mb-27" v-for="item in msgList" :key="item.id">
                        <view class="avater pb-33">
                            <image class="w-85 h-85 br50" src="/static/home/img9.png" mode=""></image>
                            <view class="tips">
                            <view class="tips" v-if="item.readStatus==2">
                            </view>
                        </view>
                        <view class="border-b flex1 ml-18 pb-33" >
                        <view class="border-b flex1 ml-18 pb-33">
                            <view class="fs-31  font-w500 flex  flex1 j-between">
                                <text>{{item.title}}</text>
                                <text class="fs-23 font-w400">{{item.responseTime}}分钟前</text>
                                <text class="fs-23 font-w400">{{item.time}}分钟前</text>
                            </view>
                            <view class="fs-27 flex j-between mt-8">
                                <text>{{item.title}}</text>
                                <text></text>
                                <view class="read" v-if="item.readStatus==1">已读</view>
                                <view class="noread" v-else>未读</view>
@@ -95,6 +96,7 @@
</template>
<script>
    import dayjs from '../../uni_modules/uview-ui/libs/util/dayjs'
    import popupCertificate from '../components/certificate/certificate.vue'
    import {
        getBanner,
@@ -110,10 +112,10 @@
                list1: [],
                showData: false,
                isClick: false,
                pageNum:1,
                bannerlist:[],
                msgList:[],
                msgListTotal:[],
                pageNum: 1,
                bannerlist: [],
                msgList: [],
                msgListTotal: [],
            }
        },
        onLoad() {
@@ -124,7 +126,7 @@
            getBanner() {
                getBanner().then(resp => {
                    console.log(resp, '获取banner');
                    this.bannerlist =resp.data
                    this.bannerlist = resp.data
                })
            },
            getMessagelist() {
@@ -134,13 +136,42 @@
                }
                getMessagelist(data).then(resp => {
                    console.log(resp, '获取消息列表');
                    this.msgListTotal=resp.data.records
                    this.msgList =resp.data.records.filter(item=> item.promptType==2)
                    this.msgListTotal = resp.data.records.map(item => {
                        const timeDifference = new Date().getTime() - new Date(item.createTime).getTime()
                        // 使用 dayjs 的 duration 来处理时间差
                          // 计算总秒数
                            const totalSeconds = Math.floor(timeDifference / 1000);
                            // 计算天数
                            const days = Math.floor(totalSeconds / (3600 * 24));
                            // 计算剩余的秒数
                            const remainingSecondsAfterDays = totalSeconds % (3600 * 24);
                            // 计算小时数
                            const hours = Math.floor(remainingSecondsAfterDays / 3600);
                            // 计算剩余的秒数
                            const remainingSecondsAfterHours = remainingSecondsAfterDays % 3600;
                            // 计算分钟数
                            const minutes = Math.floor(remainingSecondsAfterHours / 60);
                        item.time = days&&hours?`${days} 天 ${hours}小时 ${minutes} `:!days&&hours?`${hours}小时 ${minutes}`:`${minutes}`
                        return item
                    })
                    this.msgList = JSON.parse(JSON.stringify(this.msgListTotal)).filter(item => item.promptType ==
                        2)
                    console.log(this.msgListTotal, 'this.msgListTotal');
                })
            },
            changeActive(value){
                this.isactive =value
                this.msgList =this.msgListTotal.filter(item=> item.promptType==1)
            changeActive(value) {
                this.isactive = value
                if (value == 1) {
                    this.msgList = JSON.parse(JSON.stringify(this.msgListTotal)).filter(item => item.promptType == 2)
                } else {
                    this.msgList = JSON.parse(JSON.stringify(this.msgListTotal)).filter(item => item.promptType == 1)
                }
            },
            change() {
                console.log('1111');
@@ -286,6 +317,7 @@
        border-radius: 19rpx;
    }
    // swiper-item{
    //     border-radius: 19rpx;
    // }
H5/pages/location/location.vue
@@ -5,7 +5,7 @@
                <image src="/static/location/back.png" class="w-19 h-35" mode=""></image>
            </view>
        </u-navbar>
        <view class="" id="container" @regionchange="onRegionChange">
        <view class="" id="container">
        </view>
        <view class=" main">
@@ -46,24 +46,22 @@
            };
        },
        methods: {
            back() {
                uni.navigateBack()
            },
            onRegionChange(e) {
                if (e.type === 'end') {
                    // 地图移动结束时执行操作
                    console.log('地图移动结束,新的中心点经度:', e.longitude, '新的中心点纬度:', e.latitude);
                }
            },
            changeAdr(value, addr) {
                console.log(value, addr, 'asdasdada');
                this.uid = value
                const pages = getCurrentPages()
                let prevPage = pages[pages.length - 2];
                prevPage.location = addr.address
                prevPage.latitude = addr.point.lat
                prevPage.longitude = addr.point.lng
                setTimeout(() => {
                    uni.navigateBack()
                }, 500)
                }, 200)
            },
            // 搜索地点
            searchLocation() {
@@ -73,7 +71,7 @@
                    method: 'GET',
                    data: {
                        query: this.keyword,
                        location: `${30.39},${104.04}`,
                        location: `${this.latitude},${this.longitude }`,
                        radius: 10000, // 搜索半径,单位:米
                        output: 'json',
                        ak: '3mHKIXMArjgIkgADzOlTYp4XssNSNkwr' // 替换为你自己的 AK
@@ -103,7 +101,7 @@
        },
        onReady() {
            this.map = new BMapGL.Map("container"); // 创建地图实例 
            uni.getLocation({
                type: 'wgs84',
                success: (res) => {
@@ -111,7 +109,10 @@
                    this.longitude = res.longitude;
                    this.latitude = res.latitude;
                    var point = new BMapGL.Point(res.longitude, res.latitude); // 创建点坐标
                    this.map.enableScrollWheelZoom(true);
                    this.map.centerAndZoom(point, 12);
                    var marker = new BMapGL.Marker(point);
                    this.map.addOverlay(marker);
                    var myGeo = new BMapGL.Geocoder();
                    // 根据坐标得到地址描述    
                    myGeo.getLocation(new BMapGL.Point(res.longitude, res.latitude), (result) => {
@@ -122,8 +123,28 @@
                        })
                    })
                    this.map.addEventListener('click', (e) => {
                        var mercator = this.map.lnglatToMercator(e.latlng.lng, e.latlng.lat);
                        this.latitude = e.latlng.lat
                        this.longitude = e.latlng.lng
                        var point = new BMapGL.Point(e.latlng.lng, e.latlng.lat);
                        this.map.centerAndZoom(point, 12);
                        var myGeo = new BMapGL.Geocoder();
                        // 根据坐标得到地址描述
                        myGeo.getLocation(new BMapGL.Point(e.latlng.lng, e.latlng.lat), (result) => {
                            console.log(result, 'result');
                            this.locationList = result.surroundingPois.map((item, index) => {
                                item.id = index + 1
                                return item
                            })
                        })
                        var marker = new BMapGL.Marker(point);
                        this.map.addOverlay(marker);
                    });
                }
            });
        }
    }
</script>