index.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  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){
  116. desc=res.data.target.gridDesc
  117. res.data.target.positionName=res.data.target.gridCatTitle
  118. }
  119. if(type===3){
  120. desc=res.data.target.equipDesc;
  121. res.data.target.positionName=res.data.target.equipCatTitle
  122. }
  123. if(type===4){desc=res.data.target.doctorDesc}
  124. if(type===5){desc=res.data.target.doctorResume}
  125. this.user={
  126. type:res.data.targetType,
  127. userName:res.data.targetTitle,
  128. groupName:res.data.targetGroupName,
  129. userAvatar:res.data.target.doctorAvatar,
  130. positionName:res.data.target.positionName,
  131. userIntro:desc,
  132. }
  133. if(type>3){
  134. this.bg='/static/index/bg.png'
  135. }else{
  136. this.bg=type===1?'/static/index/riskBg.png':(type===2?'/static/index/areaBg.png':'/static/index/eqBg.png')
  137. }
  138. getApps(res.data.targetId).then((res)=>{
  139. this.actionList=res.data.miniList
  140. uni.setStorageSync('isAccount',res.data.isAccount)
  141. })
  142. })
  143. },
  144. avatarError(){
  145. this.user.userAvatar=defAvatar
  146. },
  147. handle(item){
  148. if(item.miniCode==='danger-submit'){ //隐患登记
  149. uni.navigateTo({url:'/pages/app_views/danger/submit/submit'})
  150. }
  151. if(item.miniCode==='checklist_point'){// 清单
  152. uni.navigateTo({url:'/pages/app_views/checkList/index/index?type=app&id='+item.checklistId})
  153. }
  154. if(item.miniCode==='checklist_score'){// 满意度
  155. uni.navigateTo({url:'/pages/app_views/satisfaction_evaluation/satisfaction_evaluation?type=app&id='+item.checklistId})
  156. }
  157. if(item.miniCode==='checklist_hazard'){// 危险源
  158. uni.navigateTo({url:'/pages/app_views/hazard/index/index?type=app&id='+item.checklistId})
  159. }
  160. if(item.miniCode==='app-snapshot'){ //问题反馈
  161. uni.navigateTo({url:'/pages/app_views/problem_feedback/problem_feedback'})
  162. }
  163. },
  164. isNull(val){
  165. if(val===undefined||val==="undefined"||val===""||val===null){
  166. return true
  167. }
  168. return false
  169. }
  170. },
  171. onShareAppMessage() {
  172. }
  173. }
  174. </script>
  175. <style lang="scss" scoped>
  176. .container {
  177. min-height: 100vh;
  178. padding: 48rpx 36rpx;
  179. font-size: 14px;
  180. line-height: 24px;
  181. background-color:rgba(245,246,248,1);
  182. box-sizing: border-box;
  183. .doctor-info{
  184. background-image: url('/static/index/bg.png');
  185. background-repeat: no-repeat;
  186. background-size: 100% 100%;
  187. padding: 30rpx 48rpx 48rpx 48rpx;
  188. box-sizing: border-box;
  189. color: #fff;
  190. position: relative;
  191. .bg{
  192. display: block;
  193. width: 100%;
  194. height: 100%;
  195. position: absolute;
  196. left: 0;
  197. top: 0;
  198. z-index: -1;
  199. }
  200. .user{
  201. display: flex;
  202. justify-content: space-between;
  203. align-items: center;
  204. .info{
  205. position: relative;
  206. padding-left: 20rpx;
  207. .name{
  208. font-size: 32rpx;
  209. font-weight: 700;
  210. line-height: 1;
  211. }
  212. .group{
  213. font-size: 24rpx;
  214. font-weight: 400;
  215. line-height: 1;
  216. margin-top: 16rpx;
  217. }
  218. .ocName{
  219. font-size: 24rpx;
  220. font-weight: 400;
  221. line-height: 1;
  222. margin-top: 16rpx;
  223. }
  224. &::after{
  225. width: 1px;
  226. height: 100%;
  227. display: block;
  228. content: "";
  229. position: absolute;
  230. border-radius: 10px;
  231. top: 0;
  232. left: 0;
  233. background-color: #83D047;
  234. }
  235. }
  236. .avatar{
  237. display: block;
  238. width: 140rpx;
  239. height: 140rpx;
  240. border-radius: 50%;
  241. &.radius{
  242. border-radius:34rpx;
  243. }
  244. }
  245. }
  246. .introduce{
  247. padding-top: 30rpx;
  248. max-height: 318rpx;
  249. font-family: SF Pro Text;
  250. font-size: 30rpx;
  251. font-weight: 400;
  252. line-height: 44rpx;
  253. color: #fff;
  254. overflow: hidden;
  255. text-overflow: ellipsis;
  256. display: -webkit-box;
  257. -webkit-line-clamp: 7;
  258. -webkit-box-orient: vertical;
  259. text-align: justify;
  260. word-break: break-all;
  261. }
  262. }
  263. .app-container{
  264. .app-title{
  265. font-size: 34rpx;
  266. color: #000;
  267. line-height: 1;
  268. padding: 40rpx 0;
  269. font-weight: 600;
  270. }
  271. .app-list{
  272. display: flex;
  273. justify-content: space-between;
  274. flex-wrap: wrap;
  275. .app-item{
  276. display: flex;
  277. align-items: center;
  278. width: 330rpx;
  279. height: 160rpx;
  280. padding: 20rpx;
  281. box-sizing: border-box;
  282. border-left: 0;
  283. background-color: #fff;
  284. margin-bottom: 18rpx;
  285. border-radius: 20rpx;
  286. .logo{
  287. display: block;
  288. width: 66rpx;
  289. height: 66rpx;
  290. border: 1px solid #efe3e3;
  291. border-radius: 50%;
  292. overflow: hidden;
  293. }
  294. .app-cont{
  295. flex: 1;
  296. margin-left: 14rpx;
  297. .name{
  298. width: 100%;
  299. color: #222222;
  300. font-size: 32rpx;
  301. line-height: 1;
  302. margin-bottom: 20rpx;
  303. text-overflow: ellipsis;
  304. word-break: break-all;
  305. overflow: hidden;
  306. white-space: nowrap;
  307. }
  308. .desc{
  309. width: 203rpx;
  310. height: 48rpx;
  311. background: linear-gradient(128.57deg, rgba(253, 198, 48, 0.1), rgba(244, 125, 52, 0.1));
  312. color: #FFAB08;
  313. font-size: 24rpx;
  314. line-height: 48rpx;
  315. padding-left: 16rpx;
  316. box-sizing: border-box;
  317. }
  318. }
  319. }
  320. }
  321. }
  322. }
  323. </style>