index.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  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. window.location.href = app.globalData.host+'/ph/#/pages/index/add';
  141. // uni.navigateTo({
  142. // url: '/pages/index/add'
  143. // });
  144. },
  145. goWorker(){
  146. uni.navigateTo({
  147. url: '/pages/index/worker'
  148. });
  149. },
  150. getOrg(){
  151. app.ajax({
  152. url: app.globalData.serverUrl + 'common/getOrg',
  153. type: 'POST',
  154. apiname: 'org',
  155. });
  156. },
  157. getConfig(){
  158. app.ajax({
  159. url: app.globalData.serverUrl + 'common/getConfig',
  160. type: 'POST',
  161. apiname: 'config',
  162. data: {
  163. name: 'org_phone'
  164. }
  165. });
  166. },
  167. getBanner(){
  168. app.ajax({
  169. url: app.globalData.serverUrl + 'common/banner',
  170. type: 'POST',
  171. apiname: 'banner',
  172. });
  173. },
  174. getWorkerHot(){
  175. app.ajax({
  176. url: app.globalData.serverUrl + 'worker/hot',
  177. type: 'POST',
  178. apiname: 'worker',
  179. });
  180. },
  181. getUrlCode (name) {
  182. return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.href) || [, ''])[1].replace(/\+/g, '%20')) || null
  183. },
  184. }
  185. }
  186. </script>
  187. <style lang="scss" scoped>
  188. page{
  189. // background-color: #FFFFFF;
  190. }
  191. .org-title{
  192. position: fixed;
  193. z-index: 1000;
  194. left: 0;
  195. top: 0;
  196. width: 100%;
  197. height: 90rpx;
  198. line-height: 90rpx;
  199. padding: 20rpx;
  200. font-size: 34rpx;
  201. font-weight: 500;
  202. color: #FFFFFF;
  203. }
  204. .swiper{
  205. width: 100%;
  206. height: 510rpx;
  207. }
  208. .slide-image{
  209. width: 750rpx;
  210. height: 510rpx;
  211. }
  212. .book-btn{
  213. width: 100%;
  214. height: 180rpx;
  215. margin-bottom: 20rpx;
  216. }
  217. .book-phone{
  218. width: 100%;
  219. height: 90rpx;
  220. line-height: 90rpx;
  221. border-radius: 45rpx;
  222. color: #FF7576;
  223. font-size: 34rpx;
  224. border: 1rpx solid #FF7576;
  225. text-align: center;
  226. font-weight: bold;
  227. }
  228. .book-phone image{
  229. width: 30rpx;
  230. height: 30rpx;
  231. margin-right: 20rpx;
  232. }
  233. .worker-title{
  234. width: 100%;
  235. // height: 90rpx;
  236. line-height: 90rpx;
  237. color: #333333;
  238. font-size: 32rpx;
  239. font-weight: bold;
  240. }
  241. .worker-title-more{
  242. color: #999999;
  243. font-size: 28rpx;
  244. font-weight: 400;
  245. }
  246. .worker-title-more image{
  247. width: 26rpx;
  248. height: 26rpx;
  249. }
  250. .book-box{
  251. width: 100%;
  252. height: 228rpx;
  253. // position: absolute;
  254. // top:490rpx;
  255. // left:0;
  256. // right:0;
  257. // bottom:0;
  258. }
  259. .book-box .left-box{
  260. width: 334rpx;
  261. height: 228rpx;
  262. background-image: url(../../images/on-line-bg.png);
  263. background-size: 100% 100%;
  264. background-repeat: no-repeat;
  265. padding-top: 57rpx;
  266. display: inline-block;
  267. float: left;
  268. }
  269. .book-box .left-box .left-title{
  270. width: 100%;
  271. height: 60rpx;
  272. display: flex;
  273. justify-content: center;
  274. align-items: center;
  275. }
  276. .book-box .left-box .left-title img{
  277. width: 44rpx;
  278. height: 44rpx;
  279. }
  280. .book-box .left-box .left-title .name{
  281. margin-left: 24rpx;
  282. color: #fff;
  283. font-size: 38rpx;
  284. font-weight: bold;
  285. }
  286. .book-box .left-box .left-title2{
  287. width: 224rpx;
  288. height: 35rpx;
  289. font-size: 26rpx;
  290. font-family: PingFang SC;
  291. font-weight: 500;
  292. color: #FFFFFF;
  293. padding-left: 110rpx;
  294. }
  295. .book-box .right-box{
  296. width: 334rpx;
  297. height: 228rpx;
  298. background-image: url(../../images/phone-book-bg.png);
  299. background-size: 100% 100%;
  300. background-repeat: no-repeat;
  301. padding-top: 57rpx;
  302. margin-left: 22rpx;
  303. display: inline-block;
  304. float: right;
  305. }
  306. .book-box .right-box .left-title{
  307. width: 100%;
  308. height: 60rpx;
  309. display: flex;
  310. justify-content: center;
  311. align-items: center;
  312. }
  313. .book-box .right-box .left-title img{
  314. width: 44rpx;
  315. height: 44rpx;
  316. }
  317. .book-box .right-box .left-title .name{
  318. margin-left: 24rpx;
  319. color: #fff;
  320. font-size: 38rpx;
  321. font-weight: bold;
  322. }
  323. .book-box .right-box .left-title2{
  324. width: 224rpx;
  325. height: 35rpx;
  326. font-size: 26rpx;
  327. font-family: PingFang SC;
  328. font-weight: 500;
  329. color: #FFFFFF;
  330. padding-left: 110rpx;
  331. }
  332. .container{
  333. position: absolute;
  334. top:460rpx;
  335. }
  336. </style>