调研问卷实现的思路

<!DOCTYPE html>
<html lang="en" style="font-size: 20px;">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport"
        content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
    <title>问卷</title>
    <link rel="stylesheet" href="/vant/vant.css">
    <script>
        document.documentElement.style.fontSize = document.documentElement.clientWidth / 18.75 + "px";
    </script>
    <style>
        * {
            padding: 0px;
            margin: 0px;
        }

        ::-webkit-scrollbar {
            display: none;
        }


        /* 标题栏 */
        .fui-header {
            height: 2.2rem;
            width: 100%;
            box-sizing: border-box;
            font-size: .8rem;
            position: fixed;
            top: 0;
            margin: 0;
            z-index: 1;
            -webkit-backface-visibility: hidden;
            backface-visibility: hidden;
            background: #fff;
            display: -webkit-box;
            display: -ms-flexbox;
            display: -webkit-flex;
            display: flex;
            -webkit-box-pack: justify;
            -ms-flex-pack: justify;
            -webkit-justify-content: space-between;
            justify-content: space-between;
            -webkit-box-align: center;
            -ms-flex-align: center;
            -webkit-align-items: center;
        }
        .fui-header:after {
            content: "";
            position: absolute;
            left: 0;
            bottom: 0;
            width: 100%;
            height: 1px;
            /* border-bottom: 1px solid #D9D9D9; */
            -webkit-transform-origin: 0 100%;
            -ms-transform-origin: 0 100%;
            transform-origin: 0 100%;
            -webkit-transform: scaleY(0.5);
            -ms-transform: scaleY(0.5);
            transform: scaleY(0.5);
        }
        .fui-header .title {
            white-space: nowrap;
            text-overflow: ellipsis;
            overflow: hidden;
            height: 2.2rem;
            line-height: 2.2rem;
            color: #000;
            text-align: center;
            position: absolute;
            display: block;
            width: 100%;
            padding: 0;
            top: 0;
            left: 0;
            z-index: 1;
        }
        .fui-header .fui-header-left {
            position: absolute;
            left: 0;
            padding-left: .3rem;
            height: 2.2rem;
            line-height: 2.2rem;
            z-index: 2;

        }
        .fui-header .fui-header-right {
            position: absolute;
            right: 0;
            padding-right: .3rem;
            height: 2.2rem;
            line-height: 2.2rem;
            z-index: 2;
            font-size: .7rem
        }
        .fui-header a.back:before {
            content: " ";
            display: inline-block;
            -webkit-transform: rotate(45deg);
            -ms-transform: rotate(45deg);
            transform: rotate(45deg);
            height: 0.5rem;
            width: 0.5rem;
            border-width: 0 0 2px 2px;
            border-color: #666;
            border-style: solid;
            position: relative;
            top: 0;
        }
        .fui-header a {
            height: 2.2rem;
            line-height: 2.2rem;
            padding: 0;
            margin: 0;
            top: 0;
            color: #999;
            display: block;
            padding: 0 .5rem;
            font-size: .7rem;
        }
        .fui-header a i {
            font-size: 1.3rem;
        }


        .questionnaire-title {
            line-height: 1.6rem;
            font-size: 1rem;
            font-weight: bold;
            text-align: center;
            color: #0095ff;
            padding: 2rem 2rem .6rem 2rem;
        }
        .questionnaire-title h1 {
            font-size: 1rem;
        }

        .introduce {
            font-size: .75rem;
            line-height: 1.2rem;
            padding: .5rem 0rem 1.3rem 0rem;
            margin: 0px 1rem .8rem 1rem;
            border-bottom: 1px dashed #ccc;
        }

        .fieldset .field {
            clear: both;
            padding: 1rem;
            margin: .25rem 0;
            font-size: .85rem;
            border: .05rem solid transparent;
            position: relative;
        }

        .fieldset .field .req {
            position: absolute;
            top: 1.3rem;
            left: .35rem;
            color: #ff4040;
        }

        .fieldset .field .field-label {
            font-weight: 500;
            padding: 0 0 .5rem 0;
            line-height: 1.3rem;
            color: #262626;
        }

        .fieldset .field .controlgroup {
            display: flex;
            align-items: center;
            justify-content: flex-start;
            flex-wrap: wrap;
            border: 1px solid #e3e3e3;
            border-bottom: 0;
            border-right: 0;
            font-size: .8rem;
            color: #595959;
            line-height: 1.6rem;
        }

        .fieldset .field .controlgroup-single {
            line-height: 1.6rem;
            border: 1px solid #e3e3e3;
            border-bottom: 0;
            border-right: 0;
        }

        .fieldset .field .controlgroup-single .radio {
            display: flex;
            line-height: 2rem;
            border-bottom: 1px solid #e3e3e3;
            border-right: 1px solid #e3e3e3;
        }

        .fieldset .field .controlgroup .radio {
            width: 50%;
            line-height: 2rem;
            flex: 1 1 auto;
            border-bottom: 1px solid #e3e3e3;
            border-right: 1px solid #e3e3e3;
            box-sizing: border-box;
            display: flex;
        }

        .fieldset .field .controlgroup .radio input,
        .fieldset .field .controlgroup-single .radio input {
            margin: 0px .5rem;
        }

        .fieldset .field .input-text {
            height: 2rem;
            border: .05rem solid #e3e3e3;
            margin: .25rem 0;
            background-color: #fff;
            padding: 0rem.5rem;
            overflow: hidden;
        }

        .fieldset .field .input-text input {
            width: 100%;
            height: 100%;
            outline: none;
            border: none;
        }

        #ctlNext {
            text-align: center;
            font-size: 16px;
            line-height: 44px;
            font-weight: 500;
            border-radius: 2px;
            color: #fff;
            background: #0095ff;
            margin: 2rem 1rem;
        }
    </style>
</head>

<body>
    <div id="app" v-cloak>
        <div>
            <div class="fui-header">
                <div class="fui-header-left">
                    <a class="back" @click="window.history.go('-1')"></a>
                </div>
                <div class="title">调研问卷</div>
                <div class="fui-header-right"></div>
            </div>
            <div style="width: 100%;height: 2.2rem;"></div>

            <div class="questionnaire-title">
                <h1>Balabala积分商城整体运营调研2.0</h1>
            </div>
            <div class="introduce">
               积分商城已成功上线,伴随品牌“品牌升级、视觉升级、服务升级”的全域升级,我们渴望听到我们巴拉用户的真实反馈,我们诚邀您花费1分钟时间回答以下问卷题目,问卷中涉及到您的个人信息仅供统计分析使用,不会活露给第三方,请您放心。
            </div>
            <div class="fieldset">
                <div class="field" v-for="(item, index) in textList" :key="index" :id=`field-${index}`>
                    <div class="field-label">{{item}}</div>
                    <span class="req">*</span>
                    <div class="controlgroup">
                        <div class="radio" v-for="(items, i) in optionList" :key="index" @click="decideOn($event)">
                            <input type="radio" :name=`option-${index}` :value="items.option">
                            <div class="label">{{items.option}}.{{items.text}}</div>
                        </div>
                    </div>
                </div>

                <div class="field" id="field-5">
                    <div class="field-label">6、请问您对目前积分商城的礼品的建议是?</div>
                    <span class="req">*</span>
                    <div class="controlgroup-single">
                        <div class="radio" @click="decideOn($event)">
                            <input type="radio" name="option-5" value="A">
                            <div class="label">A.增加除外的其他品牌的价值产品</div>
                        </div>
                        <div class="radio" @click="decideOn($event)">
                            <input type="radio" name="option-5" value="B">
                            <div class="label">B、增加自主品牌的商品</div>
                        </div>
                        <div class="radio" @click="decideOn($event)">
                            <input type="radio" name="option-5" value="C">
                            <div class="label">C、不用增加品类</div>
                        </div>
                    </div>
                </div>

                <div class="field">
                    <div class="field-label">7、针对于目前积分商城整体服务,您还有什么建议?</div>
                    <div class="input-text">
                        <input type="text" autocomplete="off" v-model="proposal">
                    </div>
                </div>

                <div class="field">
                    <div style="margin-bottom: 1rem;">
                        填写下您的收件信息,有机会获得精美小礼品一份哦!
                    </div>
                    <div class="field-label">姓名</div>
                    <div class="input-text">
                        <input type="text" autocomplete="off" id="name" v-model="name">
                    </div>
                </div>
                <div class="field">
                    <div class="field-label">联系方式</div>
                    <div class="input-text">
                        <input type="text" autocomplete="off" id="mobile" v-model="mobile">
                    </div>
                </div>
                <div class="field">
                    <div class="field-label">收件地址</div>
                    <div class="input-text">
                        <input type="text" autocomplete="off" id="address" v-model="address">
                    </div>
                </div>
                <div id="ctlNext" @click="getResearch">提交</div>
            </div>
        </div>
    </div>
    <script src="/js/jquery.min.js"></script>
    <script src="/js/vue.js"></script>
    <script src="/vant/vant.min.js"></script>
    <script>
        let app = new Vue({
            el: "#app",
            data: {
                textList: [
                    "1、与旧版本的巴拉巴拉积分商城视觉相比,新版本的巴拉巴拉积分商城视觉,您是否满意?",
                    "2、针对巴拉巴拉积分商城上架的积分礼品,您是否满意?",
                    "3、请问您对目前巴拉巴拉积分商城产品丰富度是否满意呢?",
                    "4、请问您对巴拉巴拉积分商城综合服务是否满意呢?",
                    "5、请问您对目前巴拉巴拉积分商城系统操作感觉怎么样?",
                ],
                optionList: [
                    { "option": "A", "text": "非常满意" },
                    { "option": "B", "text": "满意" },
                    { "option": "C", "text": "一般" },
                    { "option": "D", "text": "不满意" },
                    { "option": "E", "text": "非常不满意" }
                ],
                answer: [],
                name: "",
                mobile: "",
                address: "",
                proposal: ""
            },
            created() {

            },
            methods: {
                getResearch() {
                    let _this = this;

                    var multiSelectList = [];
                    for (let i = 0; i < 6; i++) {
                        if ($("input[name='option-" + i + "']:checked").val() != undefined) {
                            multiSelectList.push($("input[name='option-" + i + "']:checked").val());
                        } else {
                            vant.Toast.fail("请选择选项")
                            let field = "#field-" + i;
                            document.querySelector(field).scrollIntoView({
                                behavior: "smooth",
                                block: "center",
                                inline: "nearest"
                            })
                            return
                        }
                    }
                    console.log(multiSelectList.toString())
                    $.post('{php echo mobileUrl("member/questionnaire/setQuestionnaire");}',
                        {
                            'answer': multiSelectList.toString(),
                            'name': _this.name,
                            'mobile': _this.mobile,
                            'address': _this.address,
                            'proposal': _this.proposal
                        },
                        function (res) {
                            console.log(res)
                        })
                },
                decideOn(e) {
                    e.currentTarget.firstElementChild.checked = true
                }
            }
        })

    </script>
</body>

</html>
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值