index.vue 8.4 KB

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