index.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. <template>
  2. <view>
  3. <view v-if="orgName" class="org-title">
  4. {{orgName}}
  5. </view>
  6. <swiper
  7. v-if="banner.length > 0"
  8. class="swiper"
  9. :indicator-dots="true"
  10. indicator-color="#FF7576"
  11. :autoplay="true"
  12. :interval="3000"
  13. :duration="200"
  14. >
  15. <swiper-item v-for="(item,index) in banner" :key="index">
  16. <image class="slide-image" mode="scaleToFill" :src="item.path"></image>
  17. </swiper-item>
  18. </swiper>
  19. <view class="container">
  20. <view class="book-box">
  21. <view class="left-box" @click="goAdd">
  22. <view class="left-title">
  23. <img src="../../images/on-line-ico.png" alt="">
  24. <text class="name">线上预约</text>
  25. </view>
  26. <view class="left-title2">高效率响应</view>
  27. </view>
  28. <view class="right-box" @click="callPhone">
  29. <view class="left-title">
  30. <img src="../../images/phone-book-ico.png" alt="">
  31. <text class="name">电话预约</text>
  32. </view>
  33. <view class="left-title2">一键快捷操作</view>
  34. </view>
  35. </view>
  36. <!-- <image class="book-btn" @click="goAdd" src="../../images/book.png"></image>
  37. <view class="book-phone" @click="callPhone">
  38. <image src="../../images/dianhua@2x.png"></image>
  39. 直接电话下单
  40. </view> -->
  41. <view>
  42. <view class="worker-title">
  43. 护工推荐
  44. <span class="pull-right worker-title-more" @click="goWorker()">查看更多<image src="../../images/youjiantou-hui@2x.png"></image></span>
  45. </view>
  46. <view class="worker-box" v-for="(item,index) in list" :key="index">
  47. <view class="worker-box-info">
  48. <view class="worker-box-avator">
  49. <image :src="item.img" mode="aspectFit"></image>
  50. </view>
  51. <view class="worker-box-body">
  52. <view class="worker-box-title">
  53. <text>{{item.name}}</text>
  54. </view>
  55. <view class="worker-box-desc">
  56. <text v-if="item.gender == 1">男</text>
  57. <text v-if="item.gender == 2">女</text>
  58. | {{item.age}}岁 | {{item.worker}}年护理经验
  59. </view>
  60. <view class="worker-box-desc">
  61. <rich-text :nodes="item.content"></rich-text>
  62. </view>
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. </template>
  70. <script>
  71. var app = getApp();
  72. export default {
  73. data() {
  74. return {
  75. list: [],
  76. banner: [],
  77. phone: '',
  78. orgName: '',
  79. }
  80. },
  81. onLoad() {
  82. var orgId = this.getUrlCode('orgId');
  83. if(orgId){
  84. uni.setStorageSync(app.globalData.storagePre+'orgId',orgId);
  85. app.globalData.userinfo.orgId = orgId;
  86. }else{
  87. orgId = uni.getStorageSync(app.globalData.storagePre+'orgId');
  88. if(orgId){
  89. app.globalData.userinfo.orgId = orgId;
  90. }else{
  91. uni.showToast({
  92. title: '参数错误,未获取到orgId',
  93. icon: 'none',
  94. duration: 2000
  95. })
  96. }
  97. }
  98. },
  99. onShow() {
  100. var that = this;
  101. app.ajaxReadyCallback = res => { //各个接口统一回调方法
  102. var apiname = res.data.apiname;
  103. console.log(res);
  104. if(apiname == 'banner'){
  105. that.banner = res.data.data;
  106. }else if(apiname == 'config'){
  107. that.phone = res.data.data.val;
  108. }else if(apiname == 'worker'){
  109. that.list = res.data.data;
  110. }else if(apiname == 'org'){
  111. that.orgName = res.data.data.name;
  112. }
  113. }
  114. if(app.globalData.userinfo.orgId){
  115. this.getOrg();
  116. this.getConfig();
  117. this.getBanner();
  118. this.getWorkerHot();
  119. }
  120. },
  121. onPullDownRefresh() {
  122. },
  123. onReachBottom() { //上拉加载
  124. },
  125. methods: {
  126. callPhone(){
  127. if(this.phone){
  128. uni.makePhoneCall({
  129. phoneNumber: this.phone //仅为示例
  130. });
  131. }else{
  132. uni.showToast({
  133. title: '未设置联系电话',
  134. icon: 'none',
  135. duration: 2000
  136. })
  137. }
  138. },
  139. goAdd(){
  140. uni.navigateTo({
  141. url: '/pages/index/add'
  142. });
  143. },
  144. goWorker(){
  145. uni.navigateTo({
  146. url: '/pages/index/worker'
  147. });
  148. },
  149. getOrg(){
  150. app.ajax({
  151. url: app.globalData.serverUrl + 'common/getOrg',
  152. type: 'POST',
  153. apiname: 'org',
  154. });
  155. },
  156. getConfig(){
  157. app.ajax({
  158. url: app.globalData.serverUrl + 'common/getConfig',
  159. type: 'POST',
  160. apiname: 'config',
  161. data: {
  162. name: 'org_phone'
  163. }
  164. });
  165. },
  166. getBanner(){
  167. app.ajax({
  168. url: app.globalData.serverUrl + 'common/banner',
  169. type: 'POST',
  170. apiname: 'banner',
  171. });
  172. },
  173. getWorkerHot(){
  174. app.ajax({
  175. url: app.globalData.serverUrl + 'worker/hot',
  176. type: 'POST',
  177. apiname: 'worker',
  178. });
  179. },
  180. getUrlCode (name) {
  181. return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.href) || [, ''])[1].replace(/\+/g, '%20')) || null
  182. },
  183. }
  184. }
  185. </script>
  186. <style lang="scss" scoped>
  187. page{
  188. // background-color: #FFFFFF;
  189. }
  190. .org-title{
  191. position: fixed;
  192. z-index: 1000;
  193. left: 0;
  194. top: 0;
  195. width: 100%;
  196. height: 90rpx;
  197. line-height: 90rpx;
  198. padding: 20rpx;
  199. font-size: 34rpx;
  200. font-weight: 500;
  201. color: #FFFFFF;
  202. }
  203. .swiper{
  204. width: 100%;
  205. height: 579rpx;
  206. }
  207. .slide-image{
  208. width: 750rpx;
  209. height: 579rpx;
  210. }
  211. .book-btn{
  212. width: 100%;
  213. height: 180rpx;
  214. margin-bottom: 20rpx;
  215. }
  216. .book-phone{
  217. width: 100%;
  218. height: 90rpx;
  219. line-height: 90rpx;
  220. border-radius: 45rpx;
  221. color: #FF7576;
  222. font-size: 34rpx;
  223. border: 1rpx solid #FF7576;
  224. text-align: center;
  225. font-weight: bold;
  226. }
  227. .book-phone image{
  228. width: 30rpx;
  229. height: 30rpx;
  230. margin-right: 20rpx;
  231. }
  232. .worker-title{
  233. width: 100%;
  234. // height: 90rpx;
  235. line-height: 90rpx;
  236. color: #333333;
  237. font-size: 32rpx;
  238. font-weight: bold;
  239. }
  240. .worker-title-more{
  241. color: #999999;
  242. font-size: 28rpx;
  243. font-weight: 400;
  244. }
  245. .worker-title-more image{
  246. width: 26rpx;
  247. height: 26rpx;
  248. }
  249. .book-box{
  250. width: 100%;
  251. height: 228rpx;
  252. // position: absolute;
  253. // top:490rpx;
  254. // left:0;
  255. // right:0;
  256. // bottom:0;
  257. }
  258. .book-box .left-box{
  259. width: 334rpx;
  260. height: 228rpx;
  261. background-image: url(../../images/on-line-bg.png);
  262. background-size: 100% 100%;
  263. background-repeat: no-repeat;
  264. padding-top: 57rpx;
  265. display: inline-block;
  266. float: left;
  267. }
  268. .book-box .left-box .left-title{
  269. width: 100%;
  270. height: 60rpx;
  271. display: flex;
  272. justify-content: center;
  273. align-items: center;
  274. }
  275. .book-box .left-box .left-title img{
  276. width: 44rpx;
  277. height: 44rpx;
  278. }
  279. .book-box .left-box .left-title .name{
  280. margin-left: 24rpx;
  281. color: #fff;
  282. font-size: 38rpx;
  283. font-weight: bold;
  284. }
  285. .book-box .left-box .left-title2{
  286. width: 224rpx;
  287. height: 35rpx;
  288. font-size: 26rpx;
  289. font-family: PingFang SC;
  290. font-weight: 500;
  291. color: #FFFFFF;
  292. padding-left: 110rpx;
  293. }
  294. .book-box .right-box{
  295. width: 334rpx;
  296. height: 228rpx;
  297. background-image: url(../../images/phone-book-bg.png);
  298. background-size: 100% 100%;
  299. background-repeat: no-repeat;
  300. padding-top: 57rpx;
  301. margin-left: 22rpx;
  302. display: inline-block;
  303. float: right;
  304. }
  305. .book-box .right-box .left-title{
  306. width: 100%;
  307. height: 60rpx;
  308. display: flex;
  309. justify-content: center;
  310. align-items: center;
  311. }
  312. .book-box .right-box .left-title img{
  313. width: 44rpx;
  314. height: 44rpx;
  315. }
  316. .book-box .right-box .left-title .name{
  317. margin-left: 24rpx;
  318. color: #fff;
  319. font-size: 38rpx;
  320. font-weight: bold;
  321. }
  322. .book-box .right-box .left-title2{
  323. width: 224rpx;
  324. height: 35rpx;
  325. font-size: 26rpx;
  326. font-family: PingFang SC;
  327. font-weight: 500;
  328. color: #FFFFFF;
  329. padding-left: 110rpx;
  330. }
  331. .container{
  332. position: absolute;
  333. top:460rpx;
  334. }
  335. </style>