index.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. <template>
  2. <view class="container">
  3. <view class="doctor-info">
  4. <image :src="bg" class="bg"></image>
  5. <view class="user">
  6. <view class="info">
  7. <view class="name">{{user.userName}}</view>
  8. <view class="group">{{user.groupName}}</view>
  9. <view class="ocName">{{user.ocName||user.positionName}}</view>
  10. </view>
  11. <template v-if="user.type<4">
  12. <image class="avatar radius" src="/static/index/piont.png"></image>
  13. </template>
  14. <template v-else>
  15. <image :src="user.userAvatar" class="avatar" @error="avatarError" v-if="user.userAvatar"></image>
  16. <image :src="defAvatar" class="avatar" v-else></image>
  17. </template>
  18. </view>
  19. <view class="introduce" v-if="user.userIntro">{{user.userIntro}}</view>
  20. </view>
  21. <view class="app-container">
  22. <view class="app-title">常规操作</view>
  23. <view class="app-list">
  24. <view class="app-item" v-for="(item,index) in actionList" :key="index" @click="handle(item)">
  25. <image class="logo" :src="item.miniLogo" ></image>
  26. <view class="app-cont">
  27. <view class="name">{{item.miniTitle}}</view>
  28. <view class="desc" v-if="item.miniDesc">{{item.miniDesc}}</view>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. import defAvatar from '@/static/avatar.png'
  37. import {getByQr,getApps} from '@/api/system/scan.js'
  38. import {getQueryParams} from '@/utils/index.js'
  39. import {setToken} from '@/utils/auth.js';
  40. import {getUserInfo} from '@/api/system/user.js'
  41. export default {
  42. data() {
  43. return {
  44. actionList:[],
  45. defAvatar:defAvatar,
  46. bg:'',
  47. user:{
  48. userAvatar:""
  49. }
  50. }
  51. },
  52. onLoad(options){
  53. this.init(options)
  54. },
  55. methods: {
  56. async init(options){
  57. if(options && options.hasOwnProperty('q') ){
  58. let URL = decodeURIComponent(options.q);
  59. options=getQueryParams(URL)
  60. }
  61. if(options.token){
  62. setToken(options.token)
  63. }
  64. uni.getStorageSync('isLogin',true)
  65. const {data} = await getUserInfo()
  66. uni.setStorageSync('userId',data.accountId)
  67. this.getData(options)
  68. },
  69. getData({ocId, code}){
  70. if(!ocId){
  71. let qrcode=uni.getStorageSync('qrcode')
  72. if(!qrcode){return}
  73. ocId=qrcode.ocId
  74. code=qrcode.code
  75. }
  76. uni.setStorageSync('qrcode',{ocId,code})
  77. getByQr(ocId, code).then((res)=>{
  78. let type=res.data.targetType
  79. uni.setStorageSync('qrcode',{
  80. ...res.data.target,
  81. targetId:res.data.targetId,
  82. targetType:res.data.targetType,
  83. targetTitle:res.data.targetTitle,
  84. ocId,
  85. code
  86. })
  87. let desc="";
  88. if(type===1){desc=res.data.target.riskPointDesc}
  89. if(type===2){desc=res.data.target.gridDesc}
  90. if(type===3){desc=res.data.target.equipDesc;}
  91. if(type===4){desc=res.data.target.doctorDesc}
  92. if(type===5){desc=res.data.target.doctorResume}
  93. let riskPointTypeTitle=res.data.target.riskPointTypeTitle?res.data.target.riskPointTypeTitle:"";
  94. let riskPointCatTitle=res.data.target.riskPointCatTitle?`【${res.data.target.riskPointCatTitle}】`:""
  95. res.data.target.positionName=`${riskPointTypeTitle}${riskPointCatTitle}`
  96. this.user={
  97. type:res.data.targetType,
  98. userName:res.data.targetTitle,
  99. groupName:res.data.targetGroupName,
  100. userAvatar:res.data.target.doctorAvatar,
  101. positionName:res.data.target.positionName,
  102. userIntro:desc,
  103. }
  104. if(type>3){
  105. this.bg='/static/index/bg.png'
  106. }else{
  107. this.bg=type===1?'/static/index/riskBg.png':(type===2?'/static/index/areaBg.png':'/static/index/eqBg.png')
  108. }
  109. getApps(res.data.targetId).then((res)=>{
  110. this.actionList=res.data.miniList
  111. uni.setStorageSync('isAccount',res.data.isAccount)
  112. })
  113. })
  114. },
  115. avatarError(){
  116. this.user.userAvatar=defAvatar
  117. },
  118. handle(item){
  119. if(item.miniCode==='danger-submit'){ //隐患登记
  120. uni.navigateTo({url:'/pages/app_views/danger/submit/submit'})
  121. }
  122. if(item.miniCode==='checklist_point'){// 清单
  123. uni.navigateTo({url:'/pages/app_views/checkList/index/index?type=app&id='+item.checklistId})
  124. }
  125. if(item.miniCode==='checklist_score'){// 满意度
  126. uni.navigateTo({url:'/pages/app_views/satisfaction_evaluation/satisfaction_evaluation?type=app&id='+item.checklistId})
  127. }
  128. if(item.miniCode==='checklist_hazard'){// 危险源
  129. uni.navigateTo({url:'/pages/app_views/hazard/index/index?type=app&id='+item.checklistId})
  130. }
  131. if(item.miniCode==='app-snapshot'){ //问题反馈
  132. uni.navigateTo({url:'/pages/app_views/problem_feedback/problem_feedback'})
  133. }
  134. if(item.miniCode==='mini_check_in'){//打卡
  135. uni.navigateTo({url:'/pages/app_views/clockIn/index'})
  136. }
  137. },
  138. isNull(val){
  139. if(val===undefined||val==="undefined"||val===""||val===null){
  140. return true
  141. }
  142. return false
  143. }
  144. },
  145. onShareAppMessage() {
  146. }
  147. }
  148. </script>
  149. <style lang="scss" scoped>
  150. .container {
  151. min-height: 100vh;
  152. padding: 48rpx 36rpx;
  153. font-size: 14px;
  154. line-height: 24px;
  155. background-color:rgba(245,246,248,1);
  156. box-sizing: border-box;
  157. .doctor-info{
  158. background-image: url('~@/static/index/bg.png');
  159. background-repeat: no-repeat;
  160. background-size: 100% 100%;
  161. padding: 30rpx 48rpx 48rpx 48rpx;
  162. box-sizing: border-box;
  163. color: #fff;
  164. position: relative;
  165. .bg{
  166. display: block;
  167. width: 100%;
  168. height: 100%;
  169. position: absolute;
  170. left: 0;
  171. top: 0;
  172. z-index: -1;
  173. }
  174. .user{
  175. display: flex;
  176. justify-content: space-between;
  177. align-items: center;
  178. .info{
  179. position: relative;
  180. padding-left: 20rpx;
  181. .name{
  182. font-size: 32rpx;
  183. font-weight: 700;
  184. line-height: 1;
  185. }
  186. .group{
  187. font-size: 24rpx;
  188. font-weight: 400;
  189. line-height: 1;
  190. margin-top: 16rpx;
  191. }
  192. .ocName{
  193. font-size: 24rpx;
  194. font-weight: 400;
  195. line-height: 1;
  196. margin-top: 16rpx;
  197. }
  198. &::after{
  199. width: 1px;
  200. height: 100%;
  201. display: block;
  202. content: "";
  203. position: absolute;
  204. border-radius: 10px;
  205. top: 0;
  206. left: 0;
  207. background-color: #83D047;
  208. }
  209. }
  210. .avatar{
  211. display: block;
  212. width: 140rpx;
  213. height: 140rpx;
  214. border-radius: 50%;
  215. &.radius{
  216. border-radius:34rpx;
  217. }
  218. }
  219. }
  220. .introduce{
  221. padding-top: 30rpx;
  222. max-height: 318rpx;
  223. font-family: SF Pro Text;
  224. font-size: 30rpx;
  225. font-weight: 400;
  226. line-height: 44rpx;
  227. color: #fff;
  228. overflow: hidden;
  229. text-overflow: ellipsis;
  230. display: -webkit-box;
  231. -webkit-line-clamp: 7;
  232. -webkit-box-orient: vertical;
  233. text-align: justify;
  234. word-break: break-all;
  235. }
  236. }
  237. .app-container{
  238. .app-title{
  239. font-size: 34rpx;
  240. color: #000;
  241. line-height: 1;
  242. padding: 40rpx 0;
  243. font-weight: 600;
  244. }
  245. .app-list{
  246. display: flex;
  247. justify-content: space-between;
  248. flex-wrap: wrap;
  249. .app-item{
  250. display: flex;
  251. align-items: center;
  252. width: 330rpx;
  253. height: 160rpx;
  254. padding: 20rpx;
  255. box-sizing: border-box;
  256. border-left: 0;
  257. background-color: #fff;
  258. margin-bottom: 18rpx;
  259. border-radius: 20rpx;
  260. .logo{
  261. display: block;
  262. width: 66rpx;
  263. height: 66rpx;
  264. border: 1px solid #efe3e3;
  265. border-radius: 50%;
  266. overflow: hidden;
  267. }
  268. .app-cont{
  269. flex: 1;
  270. margin-left: 14rpx;
  271. .name{
  272. width: 100%;
  273. color: #222222;
  274. font-size: 32rpx;
  275. line-height: 1;
  276. margin-bottom: 20rpx;
  277. text-overflow: ellipsis;
  278. word-break: break-all;
  279. overflow: hidden;
  280. white-space: nowrap;
  281. }
  282. .desc{
  283. width: 203rpx;
  284. height: 48rpx;
  285. background: linear-gradient(128.57deg, rgba(253, 198, 48, 0.1), rgba(244, 125, 52, 0.1));
  286. color: #FFAB08;
  287. font-size: 24rpx;
  288. line-height: 48rpx;
  289. padding-left: 16rpx;
  290. box-sizing: border-box;
  291. }
  292. }
  293. }
  294. }
  295. }
  296. }
  297. </style>