form.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <template>
  2. <view class="wrapper" style="padding: 30px">
  3. <div class="header">
  4. <div>
  5. <h2>防疫调查登记问卷</h2>
  6. </div>
  7. <div style="position: absolute;padding: 5px 20px;font-size: 15px;color: rgba(0,0,0,0.39);
  8. right: 10px;top:10px;border: 1px solid rgba(0,0,0,0.39);border-radius: 10px">
  9. <span>{{form.orgName}}</span>
  10. </div>
  11. </div>
  12. <view class="main">
  13. <view v-for="(item,index) in queDbList">
  14. <text class="u-block__title" style="font-size: 18px;">{{index+1+"."+item.label}}</text>
  15. <view class="u-demo-block__content" style="padding: 15px;">
  16. <view class="u-page__radio-item">
  17. <u-radio-group v-model="form.queResults[index]" placement="column" activeColor="#73a6a4">
  18. <u-radio :customStyle="{marginBottom: '8px'}" v-for="item in item.resultList"
  19. :key="item.id" :label="item.value" :name="item.value" size="25">
  20. </u-radio>
  21. </u-radio-group>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. <view>
  27. <u-button type="success" @click="submit" color="#73a6a4" :disabled="disabled">提交</u-button>
  28. </view>
  29. <view class="uni-fixed-bottom">
  30. <div style="margin-bottom: 5px;">
  31. <u-row>
  32. <u-col span="5">
  33. <u-text text="技术支持:会山科技" color="#cacaca">
  34. </u-text>
  35. </u-col>
  36. <u-col span="2">
  37. <div></div>
  38. </u-col>
  39. <u-col span="5">
  40. <u-text text="hs@willalp.com" color="#cacaca">
  41. </u-text>
  42. </u-col>
  43. </u-row>
  44. </div>
  45. </view>
  46. </view>
  47. </template>
  48. <script>
  49. export default {
  50. name: "form",
  51. data() {
  52. return {
  53. queDbList: [],
  54. disabled: false,
  55. form: {
  56. userName: '',
  57. userNo: '',
  58. orgNo: '',
  59. orgName: '',
  60. queResults: ['', '', '', '', '', '', ''],
  61. ques: []
  62. },
  63. }
  64. },
  65. onLoad() {
  66. const userInfo = uni.getStorageSync('userInfo');
  67. const orgInfo = uni.getStorageSync('orgInfo');
  68. this.form.userName = userInfo.nickName
  69. this.form.userNo = userInfo.userName
  70. this.form.orgNo = orgInfo.organizationCode
  71. this.form.orgName = orgInfo.organizationName
  72. },
  73. created() {
  74. this.getList()
  75. },
  76. methods: {
  77. async getQueList() {
  78. const {
  79. data: res
  80. } = await this.$httpRequest({
  81. url: '/api/yq/list?queGroupId=' + 1,
  82. method: 'get',
  83. })
  84. if (res.code == 200) {
  85. this.queDbList = res.data
  86. this.queDbList.forEach(q => {
  87. this.form.ques.push(q.id)
  88. })
  89. } else {
  90. }
  91. },
  92. async save() {
  93. const {
  94. data: res
  95. } = await this.$httpRequest({
  96. method: 'POST',
  97. url: '/api/yq/save',
  98. data: this.form
  99. })
  100. if (res.code == 200) {
  101. uni.showToast({
  102. title: res.msg,
  103. icon: 'success'
  104. })
  105. setTimeout(() => {
  106. location.reload()
  107. }, 1000)
  108. } else {
  109. }
  110. },
  111. getList() {
  112. this.getQueList();
  113. },
  114. submit() {
  115. this.disabled = true
  116. var message = "";
  117. var isOk = false;
  118. // var myreg =
  119. // /^(((13[0-9]{1})|(14[0-9]{1})|(17[0-9]{1})|(15[0-3]{1})|(15[4-9]{1})|(18[0-9]{1})|(199))+\d{8})$/;
  120. // if (phone == '') {
  121. // // console.log("手机号码不能为空");
  122. // message = "手机号码不能为空!";
  123. // isOk = true;
  124. // } else if (phone.length !== 11) {
  125. // //console.log("请输入11位手机号码!");
  126. // message = "请输入11位手机号码!";
  127. // isOk = true;
  128. // } else if (!myreg.test(phone)) {
  129. // //console.log("请输入有效的手机号码!");
  130. // message = "请输入有效的手机号码!";
  131. // isOk = true;
  132. // }
  133. if (isOk) {
  134. uni.showToast({
  135. title: message,
  136. icon: 'error'
  137. })
  138. return;
  139. }
  140. this.save()
  141. setTimeout(() => {
  142. this.disabled = false
  143. }, 2000)
  144. }
  145. }
  146. }
  147. </script>
  148. <style lang="scss" scoped>
  149. .wrapper {
  150. display: flex;
  151. flex-direction: column;
  152. min-height: 100%;
  153. }
  154. .header {
  155. flex: 0;
  156. margin-top: 20px;
  157. }
  158. .main {
  159. flex: 1;
  160. margin: 20px 0;
  161. }
  162. .footer {
  163. flex: 0;
  164. }
  165. .uni-fixed-bottom {
  166. width: 100%;
  167. bottom: 0upx;
  168. padding: 0upx;
  169. position: fixed;
  170. background: #FFFFFF;
  171. transform: translateZ(0);
  172. bottom: env(safe-area-inset-bottom);
  173. bottom: constant(safe-area-inset-bottom);
  174. }
  175. .u-page {
  176. &__style {
  177. font-size: 16px;
  178. color: rgb(96, 98, 102);
  179. margin-bottom: 20rpx;
  180. font-weight: bold;
  181. }
  182. &__title {
  183. font-size: 16px;
  184. color: rgb(96, 98, 102);
  185. margin-bottom: 20rpx;
  186. }
  187. }
  188. </style>