info.html 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7. <title>{$info['title']}</title>
  8. <link rel="stylesheet" href="/static/mobile/css/weui.min.css">
  9. <link rel="stylesheet" href="/static/mobile/css/weuix.css">
  10. <style>
  11. body{
  12. background-color: #f2f2f2;
  13. }
  14. .main{
  15. margin: 0 auto;
  16. background-color: #ffffff;
  17. }
  18. .page-bd{
  19. padding-bottom: 30px;
  20. }
  21. .weui-form{
  22. padding-top: 0px;
  23. }
  24. .main-title{
  25. text-align: center;
  26. padding: 20px 0 10px 0;
  27. }
  28. .main-desc{
  29. text-indent: 30px;
  30. font-size: 15px;
  31. }
  32. @media only screen and (min-width: 750px){
  33. html {
  34. font-size: 16.6px !important;
  35. }
  36. }
  37. input, textarea {
  38. border: 1px solid #efefef !important;
  39. caret-color: #03aced !important;
  40. caret-color: var(--weui-BLUE) !important;
  41. }
  42. input:focus, textarea:focus {
  43. border: 1px solid #03aced !important;
  44. caret-color: #03aced !important;
  45. caret-color: var(--weui-BLUE) !important;
  46. }
  47. .weui-form-checkbox[type="radio"]:checked + label .weui-icon-radio {
  48. background-color: #03aced;
  49. border: 1px solid #03aced;
  50. }
  51. .weui-form-checkbox[type="checkbox"]:checked + label .weui-icon-checkbox {
  52. background-color: #03aced;
  53. border: 1px solid #03aced;
  54. }
  55. .weui-btn_primary {
  56. background-color: #03aced !important;
  57. /*background-color: var(--weui-BRAND);*/
  58. }
  59. .max-limit {
  60. color: rgba(0,0,0,.5);
  61. color: var(--weui-FG-1);
  62. font-size: 14px;
  63. line-height: 1.4;
  64. }
  65. .weui-input{
  66. padding: 5px;
  67. }
  68. </style>
  69. </head>
  70. <body>
  71. <div class="main">
  72. <div style="padding: 10px;border-bottom: 1px solid #ccc;padding-bottom: 30px;">
  73. <h2 class="main-title">基本信息</h2>
  74. <br>
  75. <div class="weui-flex">
  76. <div class="weui-flex__item"><div class="placeholder">编号ID:{$info['id']}</div></div>
  77. <div class="weui-flex__item"><div class="placeholder">昵称:{$info['nickname']}</div></div>
  78. <div class="weui-flex__item"><div class="placeholder">日期:{$info['create_time']}</div></div>
  79. </div>
  80. </div>
  81. <h2 class="main-title">{$info['title']}</h2>
  82. <div class="main-desc">
  83. {$info['description']}
  84. </div>
  85. <form id="myform">
  86. <input type="hidden" name="id" value="{$info['id']}">
  87. <div class="page-bd" id="vueapp">
  88. <div v-for="(item,index) in question" :key="index">
  89. <div v-if="item.required" class="weui-cells__title weui-start"> {{index + 1}} . {{item.title}}</div>
  90. <div v-if="!item.required" class="weui-cells__title"> {{index + 1}} . {{item.title}}</div>
  91. <div v-if="item.remark" class="weui-cells__title" style="text-indent: 30px;">{{item.remark}}</div>
  92. <div class="weui-form" v-if="item.type === 'radio'">
  93. <div v-for="(item2,index2) in item.options" :key="index" class="weui-form-li">
  94. <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">
  95. <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">
  96. <label :for="`f${item2.id}`"><i class="weui-icon-radio"></i>
  97. <div class="weui-form-text"><p>{{item2.text}}</p></div>
  98. </label>
  99. </div>
  100. </div>
  101. <div class="weui-form" v-if="item.type === 'checkbox'">
  102. <div v-for="(item2,index2) in item.options" :key="index" class="weui-form-li">
  103. <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">
  104. <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">
  105. <label :for="`f${item2.id}`"><i class="weui-icon-checkbox"></i>
  106. <div class="weui-form-text"><p>{{item2.text}}</p></div>
  107. </label>
  108. </div>
  109. </div>
  110. <div class="weui-form" v-if="item.type === 'text'">
  111. <div class="weui-form-li">
  112. <input type="text" :name="`answer[${item.id}]`" readonly :value="item.answer" class="weui-input" :placeholder="`最多填写${item.limit}字`">
  113. <!-- <span class="max-limit">最多填写{{item.limit}}字</span>-->
  114. </div>
  115. </div>
  116. <div class="weui-form" v-if="item.type === 'textarea'">
  117. <div class="weui-form-li">
  118. <textarea class="weui-form-area" readonly :name="`answer[${item.id}]`" rows="3" :placeholder="`最多填写${item.limit}字`">{{item.answer}}</textarea>
  119. <!-- <span class="max-limit">最多填写{{item.limit}}字</span>-->
  120. </div>
  121. </div>
  122. <div class="weui-form" v-if="item.type === 'star'">
  123. <div class="weui-form-li">
  124. <div>
  125. <span>{{item.star_min_text}}</span>
  126. <span style="float: right;">{{item.star_max_text}}</span>
  127. </div>
  128. <table border="0">
  129. <tr>
  130. <td v-for="n in item.star_val_max" :key="n">
  131. <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">
  132. <input class="weui-form-checkbox" v-if="n.toString() != item.answer.toString()" disabled :name="`answer[${item.id}]`" :id="`star${n}`" :value="n" type="radio">
  133. <label :for="`star${n}`">
  134. <i class="weui-icon-radio"></i>
  135. <div class="weui-form-text">
  136. <p>{{n}}</p>
  137. </div>
  138. </label>
  139. </td>
  140. </tr>
  141. </table>
  142. </div>
  143. </div>
  144. </div>
  145. <!-- <a href="javascript:" onclick="submitbtn(this)" class="weui-btn weui-btn_primary" style="margin-top: 30px;">-->
  146. <!-- 提交问卷-->
  147. <!-- </a>-->
  148. </div>
  149. </form>
  150. </div>
  151. <script src="/static/jquery-1.11.3.min.js"></script>
  152. <script src="/static/layer3.2.0/layer.js"></script>
  153. <script type="text/javascript" src="/static/vuejs/require.js"></script>
  154. <script>
  155. var question = {:json_encode($info['questions'])};
  156. console.log(question);
  157. require.config({
  158. urlArgs: "ver=1.0_0",
  159. paths:{
  160. "vue":'/static/vuejs/vue.min2'
  161. },
  162. shim:{
  163. 'vue':{
  164. exports:'vue'
  165. }
  166. }
  167. });
  168. require(['vue'],function(Vue,draggable){
  169. var vm = new Vue({
  170. el: '#vueapp',
  171. data: {
  172. question: question
  173. },
  174. computed: {
  175. resoptions: function () {
  176. return JSON.parse(JSON.stringify(this.question));
  177. }
  178. },
  179. watch: {
  180. resoptions: function (newval, oldval) {
  181. this.formatData();
  182. },
  183. },
  184. created: function () {
  185. // this.question.forEach((item) => {
  186. // const info = item;
  187. // });
  188. this.formatData();
  189. },
  190. methods: {
  191. formatData(){
  192. console.log(this.question);
  193. },
  194. }
  195. })
  196. });
  197. </script>
  198. </body>
  199. </html>