photoPreview.vue 6.4 KB

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