index.vue 8.2 KB

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