photoPreview.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. <template>
  2. <view class="container">
  3. <view class="photo-box" :style="{height: height + 'px'}">
  4. <image class="tongue" v-if="url!=null" :src="url"></image>
  5. </view>
  6. <view class="font-cont">
  7. <view class="chose-patient">
  8. <view class="title-box" @click="addPatient()" v-if="patient==null">
  9. <text class="title">添加就诊人,结果更精准</text>
  10. <view class="right" >
  11. <text class="value">请点击添加</text>
  12. <image src="/static/images/arrow_gray.png" mode=""></image>
  13. </view>
  14. </view>
  15. <view class="patient" @click="addPatient()" v-if="patient!=null">
  16. <view class="left">
  17. <view class="name">{{patient.patientName}}</view>
  18. <view class="info">
  19. <text class="text" v-if="patient.sex==1">男</text>
  20. <text class="text" v-if="patient.sex==2">女</text>
  21. <text class="text">{{$getAge(patient.birthday)}}岁</text>
  22. <text class="text">{{$parseIdCard(patient.idCard)}}</text>
  23. </view>
  24. </view>
  25. <view class="right" >
  26. <image src="/static/images/arrow_gray.png" mode=""></image>
  27. </view>
  28. </view>
  29. </view>
  30. <view class="footer-btn" id="photo-footer-btn">
  31. <view class="footer-btn-left" @click="back">重新拍照</view>
  32. <button class="footer-btn-right" @click="submit()">开始检测</button>
  33. </view>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. import {getCount,add} from '@/api/healthTongue.js'
  39. export default {
  40. data() {
  41. return {
  42. patient:null,
  43. height: 0,
  44. url:null,
  45. flag:true,
  46. }
  47. },
  48. onLoad(options) {
  49. console.log(options)
  50. this.url=options.url;
  51. const query = uni.createSelectorQuery().in(this);
  52. query
  53. .select("#photo-footer-btn")
  54. .boundingClientRect((data) => {
  55. console.log(data.height)
  56. this.height = uni.getSystemInfoSync().screenHeight - data.height
  57. })
  58. .exec();
  59. var that=this;
  60. uni.$on('refreshOrderPatient', (res) => {
  61. console.log(res)
  62. that.patient=res
  63. })
  64. },
  65. methods: {
  66. addPatient(){
  67. uni.navigateTo({
  68. url: '/pages_user/patient'
  69. })
  70. },
  71. back() {
  72. uni.navigateBack()
  73. },
  74. submit(){
  75. if(!this.flag){
  76. return;
  77. }
  78. // if(this.patient==null){
  79. // uni.showToast({
  80. // icon:'none',
  81. // title: "请选择就诊人",
  82. // });
  83. // return;
  84. // }
  85. this.flag=false;
  86. uni.showLoading({
  87. title:"处理中..."
  88. })
  89. uni.uploadFile({
  90. url: uni.getStorageSync('requestPath')+'/app/common/uploadOSS', //仅为示例,非真实的接口地址
  91. filePath: this.url,
  92. name: 'file',
  93. formData: {
  94. 'user': 'test' // 上传附带参数
  95. },
  96. success: (uploadFileRes) => {
  97. console.log(JSON.parse(uploadFileRes.data).url)
  98. if(this.patient!=null){
  99. var data={
  100. patientId:this.patient.patientId,
  101. sex:this.patient.sex,
  102. name:this.patient.name,
  103. age:this.$getAge(this.patient.birthday),
  104. tongueUrl:JSON.parse(uploadFileRes.data).url,
  105. }
  106. }
  107. else{
  108. var data={
  109. tongueUrl:JSON.parse(uploadFileRes.data).url,
  110. }
  111. }
  112. add(data).then(
  113. res => {
  114. if(res.code==200){
  115. // uni.setStorageSync("tongueResult",JSON.stringify(res.data))
  116. uni.redirectTo({
  117. url:"/pages_user/tongue/report?id="+res.data.id
  118. })
  119. }else{
  120. uni.showToast({
  121. icon:'none',
  122. title: res.msg,
  123. });
  124. }
  125. },
  126. rej => {}
  127. );
  128. }
  129. });
  130. },
  131. next(){
  132. uni.redirectTo({
  133. url:"/pages_user/tongue/report"
  134. })
  135. }
  136. }
  137. }
  138. </script>
  139. <style scoped lang="scss">
  140. .container {
  141. height: 100vh;
  142. background-color: rgba(66, 66, 66, 1);
  143. .photo-box {
  144. width: 100%;
  145. display: flex;
  146. flex-direction: column;
  147. align-items: center;
  148. justify-content: center;
  149. }
  150. .tongue{
  151. width: 80%;
  152. height:60%;
  153. index:1;
  154. border-radius: 10rpx;
  155. }
  156. .font-cont{
  157. width: 100%;
  158. position: fixed;
  159. left: 0;
  160. bottom: calc(var(--window-bottom) + 50rpx);
  161. .chose-patient{
  162. position: relative;
  163. margin: 30rpx 60rpx;
  164. padding: 30rpx;
  165. box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
  166. background-color: #fff;
  167. border-radius: 15rpx;
  168. .title-box{
  169. display: flex;
  170. align-items: center;
  171. justify-content: space-between;
  172. .title{
  173. font-size: 32upx;
  174. font-family: PingFang SC;
  175. font-weight: bold;
  176. color: #111111;
  177. }
  178. .right{
  179. height: 100%;
  180. display: flex;
  181. align-items: center;
  182. justify-content: center;
  183. .value{
  184. font-size: 28upx;
  185. font-family: PingFang SC;
  186. color: #999;
  187. margin-right: 10rpx;
  188. }
  189. image{
  190. width: 15upx;
  191. height: 30upx;
  192. }
  193. }
  194. }
  195. .patient{
  196. display: flex;
  197. align-items: center;
  198. justify-content: space-between;
  199. height: 110upx;
  200. .left{
  201. .name{
  202. font-size: 30upx;
  203. line-height: 1;
  204. font-family: PingFang SC;
  205. font-weight: bold;
  206. color: #111111;
  207. }
  208. .info{
  209. margin-top: 30rpx;
  210. display: flex;
  211. align-items: center;
  212. .text{
  213. font-size: 26upx;
  214. font-family: PingFang SC;
  215. line-height: 1;
  216. font-weight: 500;
  217. color: #999;
  218. margin-right: 19upx;
  219. }
  220. }
  221. }
  222. .right{
  223. display: flex;
  224. align-items: center;
  225. image{
  226. width: 15upx;
  227. height: 30upx;
  228. }
  229. }
  230. }
  231. }
  232. .footer-btn {
  233. width: 100%;
  234. padding-top: 30rpx;
  235. z-index: 99;
  236. display: flex;
  237. align-items: center;
  238. justify-content: center;
  239. font-family: SourceHanSansCN-Normal;
  240. font-weight: 400;
  241. font-size: 34rpx;
  242. color: #FFFFFF;
  243. &-left {
  244. width: 278rpx;
  245. height: 97rpx;
  246. box-sizing: border-box;
  247. border-radius: 48rpx;
  248. border: 2px solid #FFFFFF;
  249. line-height: 93rpx;
  250. text-align: center;
  251. }
  252. &-right {
  253. margin: 0;
  254. font-family: SourceHanSansCN-Normal;
  255. font-weight: 400;
  256. font-size: 34rpx;
  257. color: #FFFFFF;
  258. width: 276rpx;
  259. height: 95rpx;
  260. background: #F54D04;
  261. border-radius: 48rpx;
  262. line-height: 95rpx;
  263. margin-left: 61rpx;
  264. &::after {
  265. border: none;
  266. }
  267. }
  268. }
  269. }
  270. }
  271. </style>