123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211 |
- <!doctype html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
- <meta http-equiv="X-UA-Compatible" content="ie=edge">
- <title>{$info['title']}</title>
- <link rel="stylesheet" href="/static/mobile/css/weui.min.css">
- <link rel="stylesheet" href="/static/mobile/css/weuix.css">
- <style>
- body{
- background-color: #f2f2f2;
- }
- .main{
- margin: 0 auto;
- background-color: #ffffff;
- }
- .page-bd{
- padding-bottom: 30px;
- }
- .weui-form{
- padding-top: 0px;
- }
- .main-title{
- text-align: center;
- padding: 20px 0 10px 0;
- }
- .main-desc{
- text-indent: 30px;
- font-size: 15px;
- }
- @media only screen and (min-width: 750px){
- html {
- font-size: 16.6px !important;
- }
- }
- input, textarea {
- border: 1px solid #efefef !important;
- caret-color: #03aced !important;
- caret-color: var(--weui-BLUE) !important;
- }
- input:focus, textarea:focus {
- border: 1px solid #03aced !important;
- caret-color: #03aced !important;
- caret-color: var(--weui-BLUE) !important;
- }
- .weui-form-checkbox[type="radio"]:checked + label .weui-icon-radio {
- background-color: #03aced;
- border: 1px solid #03aced;
- }
- .weui-form-checkbox[type="checkbox"]:checked + label .weui-icon-checkbox {
- background-color: #03aced;
- border: 1px solid #03aced;
- }
- .weui-btn_primary {
- background-color: #03aced !important;
- /*background-color: var(--weui-BRAND);*/
- }
- .max-limit {
- color: rgba(0,0,0,.5);
- color: var(--weui-FG-1);
- font-size: 14px;
- line-height: 1.4;
- }
- .weui-input{
- padding: 5px;
- }
- </style>
- </head>
- <body>
- <div class="main">
- <div style="padding: 10px;border-bottom: 1px solid #ccc;padding-bottom: 30px;">
- <h2 class="main-title">基本信息</h2>
- <br>
- <div class="weui-flex">
- <div class="weui-flex__item"><div class="placeholder">编号ID:{$info['id']}</div></div>
- <div class="weui-flex__item"><div class="placeholder">昵称:{$info['nickname']}</div></div>
- <div class="weui-flex__item"><div class="placeholder">日期:{$info['create_time']}</div></div>
- </div>
- </div>
- <h2 class="main-title">{$info['title']}</h2>
- <div class="main-desc">
- {$info['description']}
- </div>
- <form id="myform">
- <input type="hidden" name="id" value="{$info['id']}">
- <div class="page-bd" id="vueapp">
- <div v-for="(item,index) in question" :key="index">
- <div v-if="item.required" class="weui-cells__title weui-start"> {{index + 1}} . {{item.title}}</div>
- <div v-if="!item.required" class="weui-cells__title"> {{index + 1}} . {{item.title}}</div>
- <div v-if="item.remark" class="weui-cells__title" style="text-indent: 30px;">{{item.remark}}</div>
- <div class="weui-form" v-if="item.type === 'radio'">
- <div v-for="(item2,index2) in item.options" :key="index" class="weui-form-li">
- <input class="weui-form-checkbox" :name="`answer[${item.id}]`" :id="`f${item2.id}`" disabled v-if="item2.id.toString() == item.answer.toString()" checked :value="item2.id" type="radio">
- <input class="weui-form-checkbox" :name="`answer[${item.id}]`" :id="`f${item2.id}`" disabled v-if="item2.id.toString() != item.answer.toString()" :value="item2.id" type="radio">
- <label :for="`f${item2.id}`"><i class="weui-icon-radio"></i>
- <div class="weui-form-text"><p>{{item2.text}}</p></div>
- </label>
- </div>
- </div>
- <div class="weui-form" v-if="item.type === 'checkbox'">
- <div v-for="(item2,index2) in item.options" :key="index" class="weui-form-li">
- <input class="weui-form-checkbox" v-if="item.answer.includes(item2.id)" disabled checked :name="`answer[${item.id}][]`" :id="`f${item2.id}`" :value="item2.id" type="checkbox">
- <input class="weui-form-checkbox" v-if="!item.answer.includes(item2.id)" disabled checked :name="`answer[${item.id}][]`" :id="`f${item2.id}`" :value="item2.id" type="checkbox">
- <label :for="`f${item2.id}`"><i class="weui-icon-checkbox"></i>
- <div class="weui-form-text"><p>{{item2.text}}</p></div>
- </label>
- </div>
- </div>
- <div class="weui-form" v-if="item.type === 'text'">
- <div class="weui-form-li">
- <input type="text" :name="`answer[${item.id}]`" readonly :value="item.answer" class="weui-input" :placeholder="`最多填写${item.limit}字`">
- <!-- <span class="max-limit">最多填写{{item.limit}}字</span>-->
- </div>
- </div>
- <div class="weui-form" v-if="item.type === 'textarea'">
- <div class="weui-form-li">
- <textarea class="weui-form-area" readonly :name="`answer[${item.id}]`" rows="3" :placeholder="`最多填写${item.limit}字`">{{item.answer}}</textarea>
- <!-- <span class="max-limit">最多填写{{item.limit}}字</span>-->
- </div>
- </div>
- <div class="weui-form" v-if="item.type === 'star'">
- <div class="weui-form-li">
- <div>
- <span>{{item.star_min_text}}</span>
- <span style="float: right;">{{item.star_max_text}}</span>
- </div>
- <table border="0">
- <tr>
- <td v-for="n in item.star_val_max" :key="n">
- <input class="weui-form-checkbox" v-if="n.toString() == item.answer.toString()" checked disabled :name="`answer[${item.id}]`" :id="`star${n}`" :value="n" type="radio">
- <input class="weui-form-checkbox" v-if="n.toString() != item.answer.toString()" disabled :name="`answer[${item.id}]`" :id="`star${n}`" :value="n" type="radio">
- <label :for="`star${n}`">
- <i class="weui-icon-radio"></i>
- <div class="weui-form-text">
- <p>{{n}}</p>
- </div>
- </label>
- </td>
- </tr>
- </table>
- </div>
- </div>
- </div>
- <!-- <a href="javascript:" onclick="submitbtn(this)" class="weui-btn weui-btn_primary" style="margin-top: 30px;">-->
- <!-- 提交问卷-->
- <!-- </a>-->
- </div>
- </form>
- </div>
- <script src="/static/jquery-1.11.3.min.js"></script>
- <script src="/static/layer3.2.0/layer.js"></script>
- <script type="text/javascript" src="/static/vuejs/require.js"></script>
- <script>
- var question = {:json_encode($info['questions'])};
- console.log(question);
- require.config({
- urlArgs: "ver=1.0_0",
- paths:{
- "vue":'/static/vuejs/vue.min2'
- },
- shim:{
- 'vue':{
- exports:'vue'
- }
- }
- });
- require(['vue'],function(Vue,draggable){
- var vm = new Vue({
- el: '#vueapp',
- data: {
- question: question
- },
- computed: {
- resoptions: function () {
- return JSON.parse(JSON.stringify(this.question));
- }
- },
- watch: {
- resoptions: function (newval, oldval) {
- this.formatData();
- },
- },
- created: function () {
- // this.question.forEach((item) => {
- // const info = item;
- // });
- this.formatData();
- },
- methods: {
- formatData(){
- console.log(this.question);
- },
- }
- })
- });
- </script>
- </body>
- </html>
|