zengh
2022-02-18 10ca1a362276175c0547ce977f778ce9c637579d
1、投票功能完善
27 files modified
3 files added
395 ■■■■ changed files
pages.json 14 ●●●● patch | view | raw | blame | history
pages/alarm_list/integral/integral.vue 46 ●●●● patch | view | raw | blame | history
pages/alarm_list/organ/organ.vue 7 ●●●● patch | view | raw | blame | history
pages/article/article.vue 1 ●●●● patch | view | raw | blame | history
pages/business/business.vue 22 ●●●● patch | view | raw | blame | history
pages/groupChat/groupChat.vue 6 ●●●● patch | view | raw | blame | history
pages/voting/votRanking.vue 22 ●●●●● patch | view | raw | blame | history
pages/voting/vote.vue 94 ●●●● patch | view | raw | blame | history
pages/voting/voteDetail.vue 2 ●●● patch | view | raw | blame | history
pages/voting/voteManage.vue 179 ●●●●● patch | view | raw | blame | history
static/workbench/task7.png patch | view | raw | blame | history
static/workbench/task8.png patch | view | raw | blame | history
store/state.js 2 ●●● patch | view | raw | blame | history
unpackage/res/icons/1024x1024.png patch | view | raw | blame | history
unpackage/res/icons/120x120.png patch | view | raw | blame | history
unpackage/res/icons/144x144.png patch | view | raw | blame | history
unpackage/res/icons/152x152.png patch | view | raw | blame | history
unpackage/res/icons/167x167.png patch | view | raw | blame | history
unpackage/res/icons/180x180.png patch | view | raw | blame | history
unpackage/res/icons/192x192.png patch | view | raw | blame | history
unpackage/res/icons/20x20.png patch | view | raw | blame | history
unpackage/res/icons/29x29.png patch | view | raw | blame | history
unpackage/res/icons/40x40.png patch | view | raw | blame | history
unpackage/res/icons/58x58.png patch | view | raw | blame | history
unpackage/res/icons/60x60.png patch | view | raw | blame | history
unpackage/res/icons/72x72.png patch | view | raw | blame | history
unpackage/res/icons/76x76.png patch | view | raw | blame | history
unpackage/res/icons/80x80.png patch | view | raw | blame | history
unpackage/res/icons/87x87.png patch | view | raw | blame | history
unpackage/res/icons/96x96.png patch | view | raw | blame | history
pages.json
@@ -485,7 +485,7 @@
        }, {
            "path": "pages/voting/vote",
            "style": {
                "navigationBarTitleText": "投票发起",
                "navigationBarTitleText": "参与投票",
                "navigationBarBackgroundColor": "#103289",
                "navigationBarTextStyle": "white"
            }
@@ -507,7 +507,17 @@
            }
        }
    ],
        ,{
            "path" : "pages/voting/votRanking",
            "style" :
            {
                "navigationBarTitleText": "投票排名",
                "navigationBarBackgroundColor": "#103289",
                "navigationBarTextStyle": "white"
            }
        }
    ],
    "globalStyle": { //将组件安装在项目的components目录下,并符合components/组件名称/组件名称.vue目录结构。可以不用引用、注册,直接在页面中使用。
        "autoscan": true
    },
pages/alarm_list/integral/integral.vue
@@ -9,11 +9,11 @@
            <u-row gutter="16">
                <u-col span="7">
                    <view class="bom-text">当前积分</view>
                    <view class="bom-int">483</view>
                    <view class="bom-int">{{dqjf}}</view>
                </u-col>
                <u-col span="5">
                    <view class="bom-text">累计积分</view>
                    <view class="bom-int">856</view>
                    <view class="bom-int">{{ljjf}}</view>
                </u-col>
            </u-row>
        </view>
@@ -30,10 +30,10 @@
                <view v-for="i in data" class="advisory-model" @click="goDetail(i)">
                    <view class="advisory-left">
                        <view class="advisory-title-top">
                            <view class="advisory-title">{{i.title}}</view>
                            <view class="advisory-title">{{i.access}}</view>
                        </view>
                        <view class="advisory-title-down">
                            <view class="advisory-title-time">{{i.createTime}}</view>
                            <view class="advisory-title-time">{{i.time}}</view>
                        </view>
                    </view>
                    <view class="advisory-right">
@@ -51,6 +51,8 @@
    export default {
        data() {
            return {
                dqjf:"暂无",
                ljjf:"暂无",
                list: [{
                    name: '积分明细'
                }, {
@@ -72,31 +74,31 @@
                    }
                ],
                value1: 1,
                data: [{
                    title: "义务巡逻",
                    integral: "2",
                    type:"1",
                    createTime: "2021-02-03"
                }, {
                    title: "商品兑换",
                    integral: "3",
                    type:"2",
                    createTime: "2021-02-03"
                }, {
                    title: "视频浏览",
                    integral: "4",
                    type:"1",
                    createTime: "2021-02-03"
                }, ],
                data: [],
                swiperHeight: 0
            }
        },
        methods: {
            onLoad() {
                this.getData(1);
            },
            getData(e){
                var that = this;
                uni.request({
                    url:that.$store.state.piAPI + '/integral/selectCount?uid='+this.$store.state.puserID+"&type="+e,
                    method:'POST',
                    success(res) {
                        that.dqjf = res.data.data.sjf;
                        that.ljjf = res.data.data.zjf.integral;
                        that.data = res.data.data.list;
                    }
                });
            },
            goDetail() {
                
            },
            change(e){
                alert(e)
                this.getData(e);
            },
            onReady() {
                let that = this;
@@ -112,9 +114,7 @@
                        query
                            .select('#articleBox')
                            .boundingClientRect(data => {
                                that.swiperHeight = (safeArea.bottom - data.top - 50);
                            })
                            .exec();
                    }
pages/alarm_list/organ/organ.vue
@@ -12,7 +12,7 @@
        <scroll-view id="articleBox" :style="{ height: swiperHeight + 'px' }" class="article-content" scroll-y
            style="width: 100%; margin-top: 15rpx;">
            <view v-for="(i, index) in data" class="advisory-model">
                <u-cell-group>
                <u-cell-group >
                    <u-cell-item :arrow='false' icon="man-add" @click="goDetail(index)" :title="i.organization"
                        :label="i.time.substring(0,11)"
                        :value="i.type=='0'?'审核中':i.type=='1'?'通过':i.type=='2'?'未通过':'未通过'">
@@ -101,6 +101,11 @@
</script>
<style lang="scss" scoped>
    .article-content{
        margin-top: 40rpx !important;
    }
    /* 搜索框 */
    .search-ico,
    .search-ico-1 {
pages/article/article.vue
@@ -173,7 +173,6 @@
                    query
                        .select('#articleBox')
                        .boundingClientRect(data => {
                            that.swiperHeight = (safeArea.bottom - data.top - 50);
                        })
pages/business/business.vue
@@ -11,7 +11,7 @@
                <view class="list">
                    <u-grid :col="4" :border="false">
                        <u-grid-item bg-color="transparent">
                            <navigator url="/pages/alarm_list/alarm_list" hover-class="none" class="nav-item">
                            <navigator url="" hover-class="none" class="nav-item">
                                <image src="../../static/workbench/task1.png" mode="widthFix" class="nav-item-img"></image>
                                <view class="nav-item-name">群防任务</view>
                            </navigator>
@@ -29,7 +29,15 @@
                            </navigator>
                        </u-grid-item>
                        <u-grid-item bg-color="transparent">
                            <navigator url="/pages/groupChat/groupChat?txlType=2" hover-class="none" class="nav-item">
                            <!-- url="/pages/groupChat/groupChat?txlType=2" -->
                            <navigator  hover-class="none" class="nav-item">
                                <image src="../../static/workbench/task8.png" mode="widthFix" class="nav-item-img"></image>
                                <view class="nav-item-name">积分商城</view>
                            </navigator>
                        </u-grid-item>
                        <u-grid-item bg-color="transparent">
                            <!-- url="/pages/groupChat/groupChat?txlType=2" -->
                            <navigator  hover-class="none" class="nav-item">
                                <image src="../../static/workbench/task4.png" mode="widthFix" class="nav-item-img"></image>
                                <view class="nav-item-name">通讯录</view>
                            </navigator>
@@ -46,15 +54,21 @@
                        <u-grid-item bg-color="transparent">
                            <navigator url="/pages/voting/voteManage" hover-class="none" class="nav-item">
                                <image src="../../static/workbench/task5.png" mode="widthFix" class="nav-item-img"></image>
                                <view class="nav-item-name">我的投票</view>
                                <view class="nav-item-name">参与投票</view>
                            </navigator>
                        </u-grid-item>
                        <u-grid-item bg-color="transparent">
                            <navigator url="/pages/voting/vote" hover-class="none" class="nav-item">
                                <image src="../../static/workbench/task6.png" mode="widthFix" class="nav-item-img"></image>
                                <image src="../../static/workbench/task7.png" mode="widthFix" class="nav-item-img"></image>
                                <view class="nav-item-name">投票发起</view>
                            </navigator>
                        </u-grid-item>
                        <u-grid-item bg-color="transparent">
                            <navigator url="/pages/voting/votRanking" hover-class="none" class="nav-item">
                                <image src="../../static/workbench/task6.png" mode="widthFix" class="nav-item-img"></image>
                                <view class="nav-item-name">投票排行</view>
                            </navigator>
                        </u-grid-item>
                    </u-grid>
                </view>
            </view>
pages/groupChat/groupChat.vue
@@ -65,9 +65,9 @@
                    {
                        name: '群组'
                    },
                    {
                        name: '通讯录'
                    }
                    // {
                    //     name: '通讯录'
                    // }
                ],
                swiperHeight: 0,
                zhanwei: '', //因为小程序中底部和顶部栏占位置,uniapp中不占位置
pages/voting/votRanking.vue
New file
@@ -0,0 +1,22 @@
<template>
    <view>
    </view>
</template>
<script>
    export default {
        data() {
            return {
            }
        },
        methods: {
        }
    }
</script>
<style>
</style>
pages/voting/vote.vue
@@ -7,13 +7,14 @@
                    label="活动标题" :label-style="{ fontSize: '16px', fontWeight: 'bold' }">
                    <u-input v-model="obj.activityTitle" maxlength="5000" placeholder="请输入活动标题" />
                </u-form-item>
                <u-form-item :border-bottom="false" left-icon="edit-pen-fill" :left-icon-style="{ fontSize: '16px', color: '#103289' }"
                    label="投票介绍" :label-style="{ fontSize: '16px', fontWeight: 'bold' }">
                <u-form-item :border-bottom="false" left-icon="edit-pen-fill"
                    :left-icon-style="{ fontSize: '16px', color: '#103289' }" label="投票介绍"
                    :label-style="{ fontSize: '16px', fontWeight: 'bold' }">
                    <u-input v-model="obj.voteIntroduce" maxlength="5000" placeholder="请输入投票介绍" />
                </u-form-item>
            </u-form>
        </view>
        <view class="content_1 voteOptionContent">
            <view class="titleOption">选项管理</view>
            <u-form label-position="top">
@@ -46,15 +47,16 @@
                        <text>{{ obj.endTime }}</text>
                    </view>
                </u-form-item>
                <u-form-item left-icon="grid-fill" :left-icon-style="{ fontSize: '16px', color: '#103289' }"
                <!-- <u-form-item left-icon="grid-fill" :left-icon-style="{ fontSize: '16px', color: '#103289' }"
                    label="投票次数" :label-style="{ fontSize: '16px', fontWeight: 'bold' }">
                    <view style="width:100%;text-align: end;" @click="ShowNun()">
                        <text>{{ obj.voteMoreTxt }}</text>
                        <u-icon name="arrow-right" color="#103289" size="32"></u-icon>
                    </view>
                </u-form-item>
                <u-form-item :border-bottom="false" left-icon="home-fill" :left-icon-style="{ fontSize: '16px', color: '#103289' }"
                    label="是否置顶展示" :label-style="{ fontSize: '16px', fontWeight: 'bold' }">
                </u-form-item> -->
                <u-form-item :border-bottom="false" left-icon="home-fill"
                    :left-icon-style="{ fontSize: '16px', color: '#103289' }" label="是否置顶展示"
                    :label-style="{ fontSize: '16px', fontWeight: 'bold' }">
                    <u-switch slot="right" v-model="obj.switchVal"></u-switch>
                </u-form-item>
            </u-form>
@@ -64,7 +66,7 @@
        </view> -->
        <view class="but">
            <u-button class="custom-style" type="primary"  @click="submitData" :ripple="true">发布投票</u-button>
            <u-button class="custom-style" type="primary" @click="submitData" :ripple="true">发布投票</u-button>
        </view>
        <!-- 弹窗 -->
@@ -330,6 +332,7 @@
                this.obj.voteMore = obj[1].value;
            },
            submitData() {
                var that = this;
                uni.showLoading({
                    title: '发布中'
                });
@@ -341,22 +344,37 @@
                        this.obj.status = 2;
                    }
                    let app = this;
                    uniCloud.callFunction({
                        name: 'add_vote',
                        data: this.obj,
                    var optionList = this.obj.voteItemlist;
                    var option = [];
                    for (var i = 0; i < optionList.length; i++) {
                        option.push(optionList[i].content)
                    }
                    uni.request({
                        url: this.$store.state.piAPI + "/vote/vote/sav?",
                        method: 'POST',
                        data: {
                            "votename": this.obj.activityTitle,
                            "introduce": this.obj.voteIntroduce,
                            "uid": that.$store.state.UserData.user_id,
                            "starttime": this.obj.startTime,
                            "endtime": this.obj.endTime,
                            "istopping": this.obj.switchVal,
                            "type": "1",
                            "G": option
                        },
                        success(res) {
                            uni.hideLoading();
                            if (res.result.code == 200) {
                            if (res.data.code == 200) {
                                uni.showToast({
                                    title: res.result.msg,
                                    title: "发起成功",
                                    duration: 2000
                                });
                                setTimeout(() => {
                                    app.clearData();
                                    uni.switchTab({
                                        url: '/pages/index/index'
                                        url: '/pages/business/business'
                                    });
                                }, 500);
                                }, 2000);
                            } else {
                                app.$refs.uToast.show({
                                    title: res.result.msg,
@@ -364,16 +382,41 @@
                                    position: 'top'
                                });
                            }
                        },
                        fail(error) {
                            uni.hideLoading();
                            app.$refs.uToast.show({
                                title: '发布失败,请稍后重试!',
                                type: 'error',
                                position: 'top'
                            });
                        }
                    });
                    // uniCloud.callFunction({
                    //     name: 'add_vote',
                    //     data: this.obj,
                    //     success(res) {
                    //         uni.hideLoading();
                    //         if (res.result.code == 200) {
                    //             uni.showToast({
                    //                 title: res.result.msg,
                    //                 duration: 2000
                    //             });
                    //             setTimeout(() => {
                    //                 app.clearData();
                    //                 uni.switchTab({
                    //                     url: '/pages/index/index'
                    //                 });
                    //             }, 500);
                    //         } else {
                    //             app.$refs.uToast.show({
                    //                 title: res.result.msg,
                    //                 type: 'error',
                    //                 position: 'top'
                    //             });
                    //         }
                    //     },
                    //     fail(error) {
                    //         uni.hideLoading();
                    //         app.$refs.uToast.show({
                    //             title: '发布失败,请稍后重试!',
                    //             type: 'error',
                    //             position: 'top'
                    //         });
                    //     }
                    // });
                } else {
                    uni.hideLoading();
                }
@@ -522,10 +565,9 @@
        font-family: Source Han Sans CN;
        font-weight: 500;
        color: #000000;
        &::before {
            content
            : "";
            content: "";
            display: block;
            width: 5rpx;
            height: 36rpx;
pages/voting/voteDetail.vue
@@ -392,7 +392,7 @@
        line-height: 86rpx;
        box-sizing: border-box;
        border-radius: 15rpx;
        background-color: #103289;
        background-color: #103289 !important;
        color: #ffffff;
    }
pages/voting/voteManage.vue
@@ -1,6 +1,29 @@
<template>
    <view>
    <view class="vote-bg">
        <u-tabs :list="list" bg-color="#f7f7f7" :is-scroll="false" :current="current" @change="change"></u-tabs>
        <view style="padding: 20rpx 30rpx 0rpx 30rpx;">
            <u-search height="80" placeholder="请输入关键字" shape="square" :show-action="false" v-model="keyword"></u-search>
        </view>
        <scroll-view id="articleBox" :style="{ height: swiperHeight + 'px' }" class="article-content" scroll-y
            style="width: 100%; margin-top: 100rpx;">
            <view v-for="i in data" class="advisory-model" @click="goDetail(i)">
                <view class="advisory-left">
                    <view class="advisory-title-top">
                        <view class="advisory-title">{{i.votename}}</view>
                    </view>
                    <view class="advisory-title-down">
                        <view class="advisory-title-name">{{i.introduce}}</view>
                        <view class="advisory-title-time">截止{{i.endtime.substring(0,11)}}</view>
                    </view>
                </view>
                <view class="advisory-right">
                    <image src="../../static/workbench/task7.png"></image>
                </view>
            </view>
        </scroll-view>
    </view>
</template>
@@ -8,15 +31,161 @@
    export default {
        data() {
            return {
                list: [{
                    name: '正在进行'
                }, {
                    name: '已投票'
                }],
                current: 0,
                swiperHeight: 0,
                data: [],
                keyword: '',
            }
        },
        onReady() {
            let that = this;
            uni.getSystemInfo({
                success(e) {
                    console.log(e);
                    let {
                        windowWidth,
                        windowHeight,
                        safeArea
                    } = e;
                    const query = uni.createSelectorQuery().in(that);
                    query
                        .select('#articleBox')
                        .boundingClientRect(data => {
                            that.swiperHeight = (safeArea.bottom - data.top - 50);
                        })
                        .exec();
                }
            });
        },
        onLoad() {
            this.getVoteData();
        },
        methods: {
            change(index) {
                this.current = index;
            },
            getVoteData(){
                var that = this;
                uni.request({
                    url: this.$store.state.piAPI + "/vote/vote/page?",
                    method: 'GET',
                    data: {
                    },
                    success(res) {
                        that.data = res.data.data.records;
                    }
                });
            },
            goDetail(e){
                uni.navigateTo({
                    url: './voteDetail?detailData=' + (JSON.stringify(e))
                });
            }
        }
    }
</script>
<style>
<style lang="scss" scoped>
    .vote-bg {
        width: 100%;
        height: 100%;
        background-color: #f7f7f7;
        .article-content {
            margin-top: 0.5rem !important;
            width: 100%;
            // background-color: #00FF00;
            .advisory-model {
                width: 94%;
                margin: 0 auto;
                height: 4.5rem;
                background-color: #FFF;
                border-radius: 8px;
                margin-top: 0.5rem;
                .advisory-left {
                    width: 64%;
                    height: 80%;
                    float: left;
                    position: relative;
                    // background-color: #00FFFF;
                    position: relative;
                    left: 3%;
                    top: 10%;
                    .advisory-title-top {
                        // background-color: #2692FD;
                        width: 100%;
                        height: 75%;
                        .advisory-title {
                            width: 92%;
                            font-size: 15px;
                            font-weight: 550;
                            overflow: hidden;
                            text-overflow: ellipsis;
                            display: -webkit-box;
                            -webkit-line-clamp: 2;
                            -webkit-box-orient: vertical;
                        }
                    }
                    .advisory-title-down {
                        // background-color: #0078A8;
                        width: 100%;
                        height: 25%;
                        font-size: 12px;
                        font-weight: 550;
                        color: #808080;
                        .advisory-title-name {
                            width: 240rpx;
                            float: left;
                            letter-spacing: 1px;
                            overflow: hidden;
                            text-overflow: ellipsis;
                            display: -webkit-box;
                            -webkit-line-clamp: 1;
                            -webkit-box-orient: vertical;
                            // background-color:#0078A8;
                        }
                        .advisory-title-time {
                            position: relative;
                            left: 30rpx;
                        }
                    }
                }
                .advisory-right {
                    // background-color: #222222;
                    width: 33%;
                    height: 80%;
                    left: 65%;
                    position: relative;
                    top: 10%;
                    image {
                        position: relative;
                        left: 120rpx;
                        top: -90%;
                        width: 90rpx;
                        height: 90rpx;
                    }
                }
            }
        }
    }
</style>
static/workbench/task7.png
static/workbench/task8.png
store/state.js
@@ -5,7 +5,7 @@
    },
    logPath: '',
    piAPI: 'http://223.82.109.183:2082/api/',
    //piAPI: 'http://192.168.0.110:83/',
    //piAPI: 'http://192.168.1.100:83/',
    puserName: '',
    puserID: '',
    puserIphone: '',
unpackage/res/icons/1024x1024.png

unpackage/res/icons/120x120.png

unpackage/res/icons/144x144.png

unpackage/res/icons/152x152.png

unpackage/res/icons/167x167.png

unpackage/res/icons/180x180.png

unpackage/res/icons/192x192.png

unpackage/res/icons/20x20.png

unpackage/res/icons/29x29.png

unpackage/res/icons/40x40.png

unpackage/res/icons/58x58.png

unpackage/res/icons/60x60.png

unpackage/res/icons/72x72.png

unpackage/res/icons/76x76.png

unpackage/res/icons/80x80.png

unpackage/res/icons/87x87.png

unpackage/res/icons/96x96.png