home.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <template>
  2. <view class="container">
  3. <view class="name" @click="add()">请选择进入</view>
  4. <view class="image" @click="ToRegister(1)" v-if="userInfo.type != 2">
  5. <image src="../../static/img/img030.png"></image>
  6. <view class="identity">咨询预约</view>
  7. <view class="info">一对一医生咨询预约</view>
  8. </view>
  9. <view class="image" @click="ToRegister(2)">
  10. <image src="../../static/img/img031.png"></image>
  11. <view class="identity">科普学习</view>
  12. <view class="info">医疗知识课程直播详解</view>
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. import {
  18. getUserInfo
  19. } from '@/api/login.js';
  20. export default {
  21. data() {
  22. return {
  23. userInfo: ''
  24. };
  25. },
  26. onLoad(option) {
  27. if (option.spread) {
  28. // 存储邀请人
  29. this.spread = option.spread;
  30. uni.setStorageSync('spread', option.spread);
  31. }
  32. },
  33. onShow() {
  34. let obj = this;
  35. getUserInfo({})
  36. .then(function(e) {
  37. obj.userInfo = e.data;
  38. uni.setStorageSync('userInfo', e.data);
  39. if (obj.userInfo.type == 2) {
  40. uni.setTabBarItem({
  41. index: 0,
  42. text: '首页',
  43. iconPath: 'static/tabBar/tab-home.png',
  44. selectedIconPath: 'static/tabBar/tab-home-current.png'
  45. });
  46. uni.setTabBarItem({
  47. index: 1,
  48. text: '我的病人',
  49. iconPath: 'static/tabBar/tab-cate.png',
  50. selectedIconPath: 'static/tabBar/tab-cate-current.png',
  51. visible: true
  52. });
  53. uni.setTabBarItem({
  54. index: 2,
  55. text: '科普学习',
  56. iconPath: 'static/tabBar/tab-study.png',
  57. selectedIconPath: 'static/tabBar/tab-study-current.png',
  58. visible: false
  59. });
  60. uni.setTabBarItem({
  61. index: 3,
  62. text: '接单',
  63. iconPath: 'static/tabBar/jd.png',
  64. selectedIconPath: 'static/tabBar/jd-act.png',
  65. visible: true
  66. })
  67. uni.setTabBarItem({
  68. index: 4,
  69. text: '我的',
  70. iconPath: 'static/tabBar/tab-my.png',
  71. selectedIconPath: 'static/tabBar/tab-my-current.png'
  72. });
  73. }
  74. if (obj.userInfo.type == 3) {
  75. uni.setTabBarItem({
  76. index: 0,
  77. text: '首页',
  78. iconPath: 'static/tabBar/tab-home.png',
  79. selectedIconPath: 'static/tabBar/tab-home-current.png'
  80. });
  81. uni.setTabBarItem({
  82. index: 1,
  83. text: '咨询记录',
  84. iconPath: 'static/tabBar/tab-cate.png',
  85. selectedIconPath: 'static/tabBar/tab-cate-current.png',
  86. visible: true
  87. });
  88. uni.setTabBarItem({
  89. index: 2,
  90. text: '科普学习',
  91. iconPath: 'static/tabBar/tab-study.png',
  92. selectedIconPath: 'static/tabBar/tab-study-current.png',
  93. visible: false
  94. });
  95. uni.setTabBarItem({
  96. index: 3,
  97. text: '发布订单',
  98. iconPath: 'static/tabBar/jd.png',
  99. selectedIconPath: 'static/tabBar/jd-act.png',
  100. pagePath: '/pages/dd/dd',
  101. visible: true
  102. })
  103. uni.setTabBarItem({
  104. index: 4,
  105. text: '我的',
  106. iconPath: 'static/tabBar/tab-my.png',
  107. selectedIconPath: 'static/tabBar/tab-my-current.png'
  108. });
  109. }
  110. if (obj.userInfo.type == 1) {
  111. uni.setTabBarItem({
  112. index: 0,
  113. text: '首页',
  114. iconPath: 'static/tabBar/tab-home.png',
  115. selectedIconPath: 'static/tabBar/tab-home-current.png'
  116. });
  117. uni.setTabBarItem({
  118. index: 1,
  119. text: '咨询记录',
  120. iconPath: 'static/tabBar/tab-cate.png',
  121. selectedIconPath: 'static/tabBar/tab-cate-current.png',
  122. visible: true
  123. });
  124. uni.setTabBarItem({
  125. index: 2,
  126. text: '科普学习',
  127. iconPath: 'static/tabBar/tab-study.png',
  128. selectedIconPath: 'static/tabBar/tab-study-current.png',
  129. visible: true
  130. });
  131. uni.setTabBarItem({
  132. index: 3,
  133. text: '接单',
  134. iconPath: 'static/tabBar/jd.png',
  135. selectedIconPath: 'static/tabBar/jd-act.png',
  136. visible: false
  137. })
  138. uni.setTabBarItem({
  139. index: 4,
  140. text: '我的',
  141. iconPath: 'static/tabBar/tab-my.png',
  142. selectedIconPath: 'static/tabBar/tab-my-current.png'
  143. });
  144. }
  145. })
  146. .catch(function(e) {
  147. console.log(e);
  148. });
  149. },
  150. methods: {
  151. ToRegister(item) {
  152. if (item == 1) {
  153. uni.navigateTo({
  154. url: '/pages/doctor/doclist'
  155. });
  156. } else {
  157. uni.switchTab({
  158. url: '/pages/index/index'
  159. });
  160. }
  161. },
  162. add() {
  163. let log = this.$log.getLog();
  164. // uni.showModal({
  165. // title: '日志',
  166. // content: JSON.stringify(log),
  167. // showCancel: false,
  168. // });
  169. this.$log.showLog();
  170. }
  171. }
  172. };
  173. </script>
  174. <style lang="scss">
  175. page {
  176. background: #ffffff;
  177. height: 100%;
  178. }
  179. .container {
  180. width: 100%;
  181. padding: 90rpx 60rpx;
  182. }
  183. .name {
  184. padding: 60rpx 0rpx;
  185. color: #323232;
  186. font-size: 50rpx;
  187. font-weight: bold;
  188. }
  189. .image {
  190. width: 100%;
  191. height: 250rpx;
  192. position: relative;
  193. margin-bottom: 65rpx;
  194. image {
  195. width: 100%;
  196. height: 100%;
  197. }
  198. .identity {
  199. position: absolute;
  200. top: 60rpx;
  201. left: 50rpx;
  202. color: #ffffff;
  203. font-size: 40rpx;
  204. }
  205. .info {
  206. position: absolute;
  207. left: 50rpx;
  208. top: 125rpx;
  209. color: #ffffff;
  210. font-size: 24rpx;
  211. opacity: 0.5;
  212. }
  213. }
  214. </style>