add - 副本.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. <template>
  2. <view class="check" :style="'padding-top:'+nvaHeight+'px;'">
  3. <view class="navbox">
  4. <uni-nav-bar color="#ffffff" left-icon="left" title="健康档案" :background-color="backgroundColor" :border="false" statusBar='true' fixed="true" @clickLeft="getBackFn">
  5. </uni-nav-bar>
  6. </view>
  7. <uni-forms ref="form" :model="datainfo">
  8. <view class="cbox">
  9. <view class="chmain">
  10. <view class="plr6">
  11. <view class="rztit">请上传身份证照片</view>
  12. <view class="flexcj mb10">
  13. <view class="carbox" @click="getaddImage('front')">
  14. <image :src="baseUrl+datainfo.front" class="img" v-if="datainfo.front"></image>
  15. <image :src="cardz" class="img" v-else></image>
  16. <view class="tit">拍摄人像面</view>
  17. <!-- <view class="tit">身份证正面</view> -->
  18. </view>
  19. <view class="carbox" @click="getaddImage('back')">
  20. <image :src="baseUrl+datainfo.back" class="img" v-if="datainfo.back"></image>
  21. <image :src="cardf" class="img" v-else></image>
  22. <view class="tit">拍摄国徽面</view>
  23. <!-- <view class="tit">身份证反面</view> -->
  24. </view>
  25. </view>
  26. <view class="mb4">
  27. <view class="cardtip">身份信息会根据上传的证件照片自动识别,支持手动输入。</view>
  28. <view class="cardtip">如果识别错误,可尝试再次拍照。</view>
  29. </view>
  30. </view>
  31. <uni-forms-item label="身份证号" required name="phonenumber">
  32. <view class="flexc">
  33. <uni-easyinput disabled v-model="datainfo.phonenumber" :inputBorder='false' placeholder="自动识别" />
  34. </view>
  35. </uni-forms-item>
  36. <uni-forms-item label="姓名" required name="phonenumber">
  37. <view class="flexc">
  38. <uni-easyinput disabled v-model="datainfo.phonenumber" :inputBorder='false' placeholder="自动识别" />
  39. </view>
  40. </uni-forms-item>
  41. <uni-forms-item label="性别" required name="phonenumber">
  42. <view class="flexc">
  43. <uni-easyinput disabled v-model="datainfo.phonenumber" :inputBorder='false' placeholder="自动识别" />
  44. </view>
  45. </uni-forms-item>
  46. <uni-forms-item label="家庭地址" required name="phonenumber">
  47. <view class="flexc">
  48. <uni-easyinput disabled v-model="datainfo.phonenumber" :inputBorder='false' placeholder="自动识别" />
  49. </view>
  50. </uni-forms-item>
  51. <picker range-key='dictLabel' :value="syqxidx" :range="sexs" @change='bindDateChange'>
  52. <uni-forms-item label="与户主关系" required name="phonenumber">
  53. <view class="flexc ml10">
  54. <view class="flex1 txr f13" :class="datainfo.iszc?'co27':'coa'">{{datainfo.iszc?'是':'选择与户主关系'}}</view>
  55. </view>
  56. </uni-forms-item>
  57. </picker>
  58. <picker range-key='dictLabel' :value="syqxidx" :range="sexs" @change='bindDateChange'>
  59. <uni-forms-item label="是否党员" required name="phonenumber">
  60. <view class="flexc ml10">
  61. <view class="flex1 txr f13" :class="datainfo.iszc?'co27':'coa'">{{datainfo.iszc?'是':'请选择是/否'}}</view>
  62. </view>
  63. </uni-forms-item>
  64. </picker>
  65. <picker range-key='dictLabel' :value="syqxidx" :range="sexs" @change='bindDateChange'>
  66. <uni-forms-item label="特殊类型" name="phonenumber">
  67. <view class="flexc ml10">
  68. <view class="flex1 txr f13" :class="datainfo.iszc?'co27':'coa'">{{datainfo.iszc?'是':'如有五保户等特殊类型,请选择'}}</view>
  69. </view>
  70. </uni-forms-item>
  71. </picker>
  72. <uni-forms-item label="兴趣爱好" name="phonenumber">
  73. <view class="flexc ml10">
  74. <uni-easyinput type="textarea" autoHeight v-model="text" :inputBorder='false' placeholder="请输入兴趣爱好" />
  75. </view>
  76. </uni-forms-item>
  77. <uni-forms-item label="上传头像" name="phonenumber">
  78. <view class="flexe mt10">
  79. <view class="addimgs">
  80. <view class="assimg">
  81. <image :src="aphoto" class="img"></image>
  82. <image :src="rdelimg" class="delimg" @click="getDelFn"></image>
  83. </view>
  84. </view>
  85. <view class="addbox">
  86. <image :src="aphoto"></image>
  87. <view>添加头图</view>
  88. </view>
  89. </view>
  90. </uni-forms-item>
  91. </view>
  92. <view class="rhbtn mt30 bga" @click="getNext">提交</view>
  93. </view>
  94. </uni-forms>
  95. <loading></loading>
  96. </view>
  97. </template>
  98. <script>
  99. import config from '@/config'
  100. import {
  101. checkPermi,
  102. checkRole
  103. } from "@/utils/permission"; // 权限判断函数
  104. import {
  105. uploadIdentify
  106. } from '@/utils/common.js'
  107. export default {
  108. components: {},
  109. data() {
  110. return {
  111. cardz:require('@/health/static/health/cardz.png'),
  112. cardf:require('@/health/static/health/cardf.png'),
  113. aphoto: require('@/work/static/service/photo.png'),
  114. rdelimg: require('@/work/static/service/rdel.png'),
  115. baseUrl: config.baseUrl,
  116. checkflag:true,
  117. nvaHeight:44,
  118. backgroundColor: "transparent",
  119. datainfo: {
  120. sex:1,
  121. realName: '',
  122. idCard: '',
  123. address: '',
  124. expirationDate: '',
  125. phonenumber: '',
  126. front: '',
  127. back: '',
  128. },
  129. syqxidx:'',
  130. sexs: [{
  131. text: '男',
  132. value: 1
  133. }, {
  134. text: '女',
  135. value: 2
  136. }],
  137. }
  138. },
  139. onLoad: function() {
  140. uni.getSystemInfo({
  141. success: (e) => {
  142. this.nvaHeight = Number(e.statusBarHeight)+44;
  143. }
  144. })
  145. },
  146. onPageScroll(e) {
  147. var scrollTop = Number(e.scrollTop);
  148. if (scrollTop > 0) {
  149. this.backgroundColor = '#48CC9A'
  150. } else {
  151. this.backgroundColor = 'transparent'
  152. }
  153. },
  154. methods: {
  155. checkPermi,
  156. checkRole,
  157. getBackFn(){
  158. uni.navigateBack({
  159. delta:1
  160. })
  161. },
  162. bindDateChange(e){
  163. var val=e.detail.value;
  164. // this.datainfo.applicationBank=this.sdyhlist[val].value;
  165. // this.applicationBank=this.sdyhlist[val].label;
  166. },
  167. getaddImage(e) {
  168. let that = this;
  169. // var rs=['D:\\idcard.png']
  170. // if(rs&&rs.length>0){
  171. // var obj={
  172. // type:e,
  173. // // url:baseUrl+rs.join(',')
  174. // url:rs.join(',')
  175. // }
  176. // that.getOcrIdCard(obj)
  177. // }
  178. // return
  179. let file = [],
  180. count = 9
  181. uni.chooseImage({
  182. count: 1,
  183. success: function(res) {
  184. let img = res.tempFilePaths;
  185. if (img.length + file.length > count) {
  186. uni.showToast({
  187. title: '最多上传' + count + '张图片',
  188. icon: 'none',
  189. duration: 2000
  190. })
  191. } else {
  192. let imglen = res.tempFilePaths.length;
  193. var fuwufile = [];
  194. uploadIdentify('/common/upload', img, 0, 0, 0, imglen, fuwufile, function(rs) {
  195. var resurl = rs[0];
  196. if (e == 'front') {
  197. that.datainfo.front = resurl.fileName;
  198. } else {
  199. that.datainfo.back = resurl.fileName;
  200. }
  201. if (rs && rs.length > 0) {
  202. var obj = {
  203. type: e,
  204. url: resurl.urlOnline
  205. }
  206. that.getOcrIdCard(obj)
  207. }
  208. })
  209. }
  210. }
  211. });
  212. },
  213. getOcrIdCard(obj) {
  214. var params = {
  215. image: obj.url,
  216. idCardSide: obj.type
  217. }
  218. getOcrIdCard(params).then(res => {
  219. if (res.code == 200) {
  220. var datainfo = res.data;
  221. if (obj.type == 'front') {
  222. this.datainfo.realName = datainfo.realName;
  223. this.datainfo.idCard = datainfo.idCard;
  224. this.datainfo.address = datainfo.address;
  225. } else {
  226. this.datainfo.expirationDate = datainfo.expirationDate
  227. }
  228. }
  229. })
  230. }
  231. }
  232. }
  233. </script>
  234. <style>
  235. page{background: #F3F3F0;}
  236. </style>
  237. <style lang="scss" scoped>
  238. .bga{background-color: #46CB99;}
  239. .check /deep/ .uni-forms-item{min-height: 106rpx;box-sizing: border-box;display: flex;align-items: center;margin-bottom: 0;border-bottom: 2rpx solid #E6E6E6;padding:10rpx 0;}
  240. // .check .cbox /deep/ .uni-forms-item:last-child{border: none;}
  241. .check /deep/ .uni-forms-item__label{font-weight: bold;font-size: 26rpx;color: #222327;flex: 0 0 auto;width: auto !important;}
  242. .check /deep/ .uni-easyinput{flex: 1;text-align: right;font-size: 26rpx;color: #222327;}
  243. .check /deep/ .uni-easyinput__content-textarea{min-height: 40rpx;font-size: 26rpx;}
  244. .check /deep/ .uni-easyinput__placeholder-class{font-size: 26rpx;color: #AAAAAA;}
  245. .check /deep/ .uni-input-input{font-size: 26rpx;}
  246. .check /deep/ .uni-textarea-textarea{font-size: 26rpx;}
  247. .check /deep/ .is-disabled{color: #222327;background-color: #ffffff !important;}
  248. .check /deep/ .uni-data-checklist .checklist-group .checklist-box{margin:10rpx 8rpx 10rpx 16rpx;}
  249. .check /deep/ .uni-data-checklist{flex: 0 0 auto;}
  250. .check /deep/ .is-required{font-size: 26rpx;color: #F40027;margin-right: 4rpx;}
  251. .check{background: linear-gradient(180deg, #45CB99 0%, rgba(238,227,197,0) 100%) no-repeat;background-size: 100% 782rpx;min-height: 100vh;box-sizing: border-box;padding: 0 18rpx 22rpx;}
  252. .cbox{background: #FFFFFF;border-radius: 20rpx;flex: 1;padding: 30rpx 24rpx 46rpx;
  253. .chmain{
  254. padding: 0 8rpx;
  255. .upbox{height: 224rpx;background: #EFF4FF;border-radius: 20rpx;display: flex;align-items: center;justify-content: center;flex-direction: column;margin-bottom: 8rpx;overflow: auto;
  256. .img{width: 100%;height: 100%;}
  257. .addimg{width: 70rpx;height: 70rpx;margin-bottom: 16rpx;}
  258. view{font-weight: bold;font-size: 26rpx;color: #4C6686;}
  259. }
  260. .rimg{width: 16rpx;height: 28rpx;flex: 0 0 auto;margin-left: 20rpx;
  261. image{width: 100%;height: 100%;}
  262. }
  263. .checkimg{width: 80rpx;height: 40rpx;margin-right: 8rpx;}
  264. .aphoto{padding: 0 24rpx;border-left: 2rpx solid #e6e6e6;margin-left: 26rpx;
  265. image{width: 40rpx;height: 38rpx;}
  266. }
  267. }
  268. }
  269. .navbox{position: fixed;left: 0;right: 0;top: 0;z-index: 4; }
  270. .rztit{font-weight: bold;font-size: 30rpx;color: #222327;margin-bottom: 30rpx;}
  271. .carbox{width: 300rpx;border-radius: 14rpx;overflow: hidden;
  272. .img{width: 300rpx;height: 208rpx;}
  273. .tit{width: 100%;height: 56rpx;background: #7CC2A8;text-align: center;font-weight: 500;
  274. font-size: 26rpx;line-height: 56rpx;
  275. color: #FFFFFF;}
  276. }
  277. .cardtip{font-weight: 500;font-size: 24rpx;color: #999999;line-height: 40rpx;}
  278. .addimgs{display: flex;align-items: center;flex-wrap: wrap;justify-content: flex-end;
  279. .assimg{width: 128rpx;height: 128rpx;position: relative;overflow: hidden;margin: 0 0 20rpx 24rpx;
  280. .img{width: 100%;height: 100%;}
  281. .delimg{width: 24rpx;height: 24rpx;position: absolute;right: 0;top: 0;}
  282. }
  283. }
  284. .addbox{width: 160rpx;height: 128rpx;background: #F0F0F0;border-radius: 20rpx;display: flex;flex-direction: column;align-items: center;justify-content: center;margin-left: 24rpx;margin-bottom: 20rpx;flex: 0 0 auto;
  285. image{width: 48rpx;height: 42rpx;margin-bottom: 12rpx;}
  286. view{font-weight: 500;font-size: 24rpx;color: #666666;}
  287. }
  288. .tips{font-weight: bold;color: #272727;font-size: 26rpx;margin-left: 8rpx;}
  289. </style>