index.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  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. if(item.miniCode==='mini_check_in'){//打卡
  164. uni.navigateTo({url:'/pages/app_views/clockIn/index'})
  165. }
  166. },
  167. isNull(val){
  168. if(val===undefined||val==="undefined"||val===""||val===null){
  169. return true
  170. }
  171. return false
  172. }
  173. },
  174. onShareAppMessage() {
  175. }
  176. }
  177. </script>
  178. <style lang="scss" scoped>
  179. .container {
  180. min-height: 100vh;
  181. padding: 48rpx 36rpx;
  182. font-size: 14px;
  183. line-height: 24px;
  184. background-color:rgba(245,246,248,1);
  185. box-sizing: border-box;
  186. .doctor-info{
  187. background-image: url('/static/index/bg.png');
  188. background-repeat: no-repeat;
  189. background-size: 100% 100%;
  190. padding: 30rpx 48rpx 48rpx 48rpx;
  191. box-sizing: border-box;
  192. color: #fff;
  193. position: relative;
  194. .bg{
  195. display: block;
  196. width: 100%;
  197. height: 100%;
  198. position: absolute;
  199. left: 0;
  200. top: 0;
  201. z-index: -1;
  202. }
  203. .user{
  204. display: flex;
  205. justify-content: space-between;
  206. align-items: center;
  207. .info{
  208. position: relative;
  209. padding-left: 20rpx;
  210. .name{
  211. font-size: 32rpx;
  212. font-weight: 700;
  213. line-height: 1;
  214. }
  215. .group{
  216. font-size: 24rpx;
  217. font-weight: 400;
  218. line-height: 1;
  219. margin-top: 16rpx;
  220. }
  221. .ocName{
  222. font-size: 24rpx;
  223. font-weight: 400;
  224. line-height: 1;
  225. margin-top: 16rpx;
  226. }
  227. &::after{
  228. width: 1px;
  229. height: 100%;
  230. display: block;
  231. content: "";
  232. position: absolute;
  233. border-radius: 10px;
  234. top: 0;
  235. left: 0;
  236. background-color: #83D047;
  237. }
  238. }
  239. .avatar{
  240. display: block;
  241. width: 140rpx;
  242. height: 140rpx;
  243. border-radius: 50%;
  244. &.radius{
  245. border-radius:34rpx;
  246. }
  247. }
  248. }
  249. .introduce{
  250. padding-top: 30rpx;
  251. max-height: 318rpx;
  252. font-family: SF Pro Text;
  253. font-size: 30rpx;
  254. font-weight: 400;
  255. line-height: 44rpx;
  256. color: #fff;
  257. overflow: hidden;
  258. text-overflow: ellipsis;
  259. display: -webkit-box;
  260. -webkit-line-clamp: 7;
  261. -webkit-box-orient: vertical;
  262. text-align: justify;
  263. word-break: break-all;
  264. }
  265. }
  266. .app-container{
  267. .app-title{
  268. font-size: 34rpx;
  269. color: #000;
  270. line-height: 1;
  271. padding: 40rpx 0;
  272. font-weight: 600;
  273. }
  274. .app-list{
  275. display: flex;
  276. justify-content: space-between;
  277. flex-wrap: wrap;
  278. .app-item{
  279. display: flex;
  280. align-items: center;
  281. width: 330rpx;
  282. height: 160rpx;
  283. padding: 20rpx;
  284. box-sizing: border-box;
  285. border-left: 0;
  286. background-color: #fff;
  287. margin-bottom: 18rpx;
  288. border-radius: 20rpx;
  289. .logo{
  290. display: block;
  291. width: 66rpx;
  292. height: 66rpx;
  293. border: 1px solid #efe3e3;
  294. border-radius: 50%;
  295. overflow: hidden;
  296. }
  297. .app-cont{
  298. flex: 1;
  299. margin-left: 14rpx;
  300. .name{
  301. width: 100%;
  302. color: #222222;
  303. font-size: 32rpx;
  304. line-height: 1;
  305. margin-bottom: 20rpx;
  306. text-overflow: ellipsis;
  307. word-break: break-all;
  308. overflow: hidden;
  309. white-space: nowrap;
  310. }
  311. .desc{
  312. width: 203rpx;
  313. height: 48rpx;
  314. background: linear-gradient(128.57deg, rgba(253, 198, 48, 0.1), rgba(244, 125, 52, 0.1));
  315. color: #FFAB08;
  316. font-size: 24rpx;
  317. line-height: 48rpx;
  318. padding-left: 16rpx;
  319. box-sizing: border-box;
  320. }
  321. }
  322. }
  323. }
  324. }
  325. }
  326. </style>