index.vue 7.4 KB

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