placeRegister.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <template>
  2. <van-nav-bar title="智慧“和顺”" left-arrow @click-left="goback" />
  3. <div class="main">
  4. <p class="title">宗教场所录入</p>
  5. <div class="formArea">
  6. <p class="miniTitle">基础信息</p>
  7. <van-cell-group>
  8. <van-field
  9. v-model="placeActivity.place"
  10. readonly
  11. label="所属宗教:"
  12. placeholder="请选择宗教"
  13. input-align="right"
  14. right-icon="arrow-down"
  15. @click="showPlace = true"
  16. />
  17. <van-popup v-model:show="showPlace" round position="bottom">
  18. <van-picker
  19. title="宗教选择"
  20. :columns="places"
  21. @cancel="showPlace = false"
  22. @confirm="getPlace"
  23. />
  24. </van-popup>
  25. </van-cell-group>
  26. <van-cell-group>
  27. <van-field
  28. v-model="placeActivity.activityPlace"
  29. center
  30. readonly
  31. label="所属县(区):"
  32. placeholder="请填写所属县(区)"
  33. input-align="right"
  34. right-icon="arrow-down"
  35. @click="showArea = true"
  36. />
  37. <van-popup v-model:show="showArea" round position="bottom">
  38. <van-cascader
  39. v-model="cascaderValue"
  40. title="请选择所在地区"
  41. :options="options"
  42. @close="showArea = false"
  43. @finish="onFinish"
  44. />
  45. </van-popup>
  46. </van-cell-group>
  47. <van-cell-group>
  48. <van-field
  49. v-model="placeActivity.address"
  50. center
  51. label="具体地址:"
  52. placeholder="请填写具体地址"
  53. input-align="right"
  54. right-icon="location"
  55. />
  56. </van-cell-group>
  57. <van-cell-group>
  58. <van-field
  59. v-model="placeActivity.money"
  60. center
  61. label="场所名称:"
  62. placeholder="请填写场所名称"
  63. input-align="right"
  64. />
  65. </van-cell-group>
  66. <van-cell-group>
  67. <van-field
  68. v-model="placeActivity.money"
  69. center
  70. label="联络人姓名:"
  71. placeholder="请填写联络人姓名"
  72. input-align="right"
  73. />
  74. </van-cell-group>
  75. <van-cell-group>
  76. <van-field
  77. v-model="placeActivity.money"
  78. center
  79. label="联系方式:"
  80. placeholder="请填写联络人联系方式"
  81. input-align="right"
  82. />
  83. </van-cell-group>
  84. <van-cell-group>
  85. <van-field name="uploader" label="外景照片:">
  86. <template #input>
  87. <van-uploader :after-read="afterRead" />
  88. </template>
  89. </van-field>
  90. </van-cell-group>
  91. <van-cell-group>
  92. <van-field name="uploader" label="内景照片:">
  93. <template #input>
  94. <van-uploader :after-read="afterRead" />
  95. </template>
  96. </van-field>
  97. </van-cell-group>
  98. </div>
  99. <div class="subbtn">
  100. <van-button type="primary">提交</van-button>
  101. <van-button type="default" hairline>取消</van-button>
  102. </div>
  103. </div>
  104. </template>
  105. <script>
  106. import { reactive, ref } from "vue";
  107. export default {
  108. setup() {
  109. const goback = () => {
  110. history.back();
  111. };
  112. //场所录入
  113. const placeActivity = reactive({
  114. activity: "",
  115. place: "",
  116. activityTime: "",
  117. countPerson: "",
  118. list: "",
  119. portname: "",
  120. area: "",
  121. activityPlace: "",
  122. address: "",
  123. money: "",
  124. activityName: "",
  125. tel: "",
  126. file: "",
  127. into: "",
  128. });
  129. // 宗教名称
  130. const places = [
  131. { text: "基督教", value: "基督教" },
  132. { text: "佛教", value: "佛教" },
  133. { text: "伊斯兰教", value: "伊斯兰教" },
  134. ];
  135. let showPlace = ref(false);
  136. const getPlace = ({ selectedOptions }) => {
  137. showPlace.value = false;
  138. placeActivity.place = selectedOptions[0].text;
  139. };
  140. //图片上传
  141. const afterRead = (file) => {
  142. // 此时可以自行将文件上传至服务器
  143. console.log(file);
  144. };
  145. // 地区选择
  146. let showArea = ref(false);
  147. const cascaderValue = ref("");
  148. // 选项列表,children 代表子选项,支持多级嵌套
  149. const options = [
  150. {
  151. text: "浙江省",
  152. value: "330000",
  153. children: [{ text: "杭州市", value: "330100" }],
  154. },
  155. {
  156. text: "江苏省",
  157. value: "320000",
  158. children: [{ text: "南京市", value: "320100" }],
  159. },
  160. ];
  161. // 全部选项选择完毕后,会触发 finish 事件
  162. const onFinish = ({ selectedOptions }) => {
  163. showArea.value = false;
  164. placeActivity.activityPlace = selectedOptions
  165. .map((option) => option.text)
  166. .join("/");
  167. };
  168. return {
  169. placeActivity,
  170. // 活动场所
  171. showPlace,
  172. places,
  173. getPlace,
  174. //图片上传
  175. afterRead,
  176. // 返回
  177. goback,
  178. // 地区选择
  179. showArea,
  180. options,
  181. onFinish,
  182. cascaderValue,
  183. };
  184. },
  185. };
  186. </script>
  187. <style lang="less">
  188. body,
  189. html {
  190. margin: 0;
  191. padding: 0;
  192. }
  193. .van-nav-bar {
  194. background-color: #36a7f3;
  195. .van-nav-bar__title {
  196. color: #fff;
  197. }
  198. .van-badge__wrapper {
  199. color: #fff;
  200. }
  201. }
  202. .main p {
  203. height: 40px;
  204. line-height: 40px;
  205. color: #36a7f3;
  206. border-bottom: 1px solid #eee;
  207. }
  208. .title {
  209. font-size: 20px;
  210. font-weight: 700;
  211. padding-left: 20px;
  212. }
  213. .miniTitle {
  214. font-size: 16px;
  215. }
  216. .formArea {
  217. padding: 0px 20px;
  218. }
  219. .formArea .van-cell-group .van-field__label {
  220. height: 40px;
  221. }
  222. .formArea .van-cell-group .van-cell {
  223. line-height: 40px;
  224. }
  225. .van-cell__value .van-field__right-icon .van-icon-location {
  226. color: #36a7f3 !important;
  227. }
  228. .rowTextArea::v-deep .van-field__value {
  229. width: 98%;
  230. border: 2px solid #ccc;
  231. border-radius: 10px;
  232. }
  233. .rowTextArea::v-deep .van-cell {
  234. display: flow-root;
  235. }
  236. .subbtn {
  237. margin: 20px;
  238. text-align: center;
  239. }
  240. .subbtn .van-button {
  241. width: 40%;
  242. margin: 5px;
  243. }
  244. .van-uploader .van-button {
  245. border: none;
  246. color: #36a7f3;
  247. top: -4px;
  248. }
  249. .van-dialog {
  250. width: 80%;
  251. top: 50%;
  252. }
  253. </style>