photoPreview.vue 6.6 KB

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