index.vue 7.9 KB

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