xq-csg-weapp_uni-ts
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

380 lines
9.4KB

  1. <template>
  2. <view>
  3. <custom-nav-bar :left-text="option.name" left-arrow />
  4. <swiper class="people-custom-swiper" :indicator-dots="!imageList.length" :indicator-color="indicatorColor"
  5. :indicator-active-color="indicatorActiveColor">
  6. <block v-for="(item, index) in imageList" :key="index">
  7. <swiper-item>
  8. <navigator v-if="item.clickUrl" class="line-navigator" :url="util.updateQuery(item.clickUrl, item)"
  9. hover-class="none"></navigator>
  10. <image class="custom-swiper-img" :src="item.icon"></image>
  11. </swiper-item>
  12. </block>
  13. </swiper>
  14. <view class="guide-list flex" v-if="option.name === '五星党员'">
  15. <view class="guide-item flex flex-col flex-v-center" :data-id="item.id" @tap="jumpDetail"
  16. v-for="(item, index) in doctorPageList" :key="index">
  17. <image class="guide-img" :src="item.photo"></image>
  18. <text class="guide-name">{{ item.name }}</text>
  19. <van-rate readonly icon="/src/images/void-icon2.png" :size="14" void-icon="/src/images/rate-icon.png" v-model="item.star" />
  20. </view>
  21. </view>
  22. <view class="rural-list flex"
  23. v-if="option.path === 'sonGuide4' || option.path === 'sonGuide5' || option.path === 'sonGuide3'">
  24. <view class="guide-item flex flex-col flex-v-center" :data-item="item" @tap="toArea"
  25. v-for="(item, index) in agencyPageList" :key="index">
  26. <image class="guide-img" :src="item.image"></image>
  27. <text class="guide-name">{{ item.agencyName }}</text>
  28. </view>
  29. </view>
  30. <view class="second-section" v-if="option.path === 'sonGuide1'">
  31. <view class="section-item flex flex-between" :data-item="item" @tap="toArea"
  32. v-for="(item, index) in partyBranchList" :key="index">
  33. <image class="section-item-right" :src="item.image" mode="aspectFill"></image>
  34. <view class="section-item-left flex1 flex flex-col">
  35. <view class="consult-content-title text-line-2">{{ item.name }}</view>
  36. <van-rate readonly icon="/src/images/void-icon2.png" :size="14" void-icon="/src/images/rate-icon.png" v-model="item.star" />
  37. </view>
  38. </view>
  39. </view>
  40. <view class="rural-list flex" v-if="option.name === '家庭医生团队'">
  41. <view class="guide-item flex flex-col flex-v-center" :data-item="item" @tap="toArea"
  42. v-for="(item, index) in agencyPageList" :key="index">
  43. <image class="guide-img" :src="item.image"></image>
  44. <text class="guide-name">{{ item.agencyName }}</text>
  45. </view>
  46. </view>
  47. </view>
  48. </template>
  49. <!-- <script module="util" lang="wxs" src="@/wxs/util.wxs"></script> -->
  50. <script>
  51. import * as peopleApi from '@/api/peopleApi';
  52. import * as publicApi from '@/api/publicApi';
  53. export default {
  54. components: {},
  55. data() {
  56. return {
  57. indicatorColor: 'rgba(255,255,255,0.4)',
  58. indicatorActiveColor: '#FFFFFF',
  59. option: {
  60. name: '',
  61. path: ''
  62. },
  63. imageList: [],
  64. doctorPageList: [],
  65. agencyPageList: [],
  66. partyBranchList: [],
  67. pageNo: 1,
  68. pageSize: 10,
  69. total: 0
  70. };
  71. },
  72. /**
  73. * 生命周期函数--监听页面加载
  74. */
  75. onLoad(option) {
  76. this.option = option
  77. console.log(option)
  78. this.recursionApi();
  79. this.callFcuntion();
  80. },
  81. onReachBottom() {
  82. const data = {
  83. sonGuide2: () => {
  84. if (this.doctorPageList.length === this.total) {
  85. return;
  86. }
  87. this.excellentPartMemberPageApi(false);
  88. },
  89. sonGuide4: () => {
  90. console.log(2);
  91. if (this.agencyPageList.length === this.total) {
  92. return;
  93. }
  94. this.agencyPageApi(false);
  95. },
  96. sonGuide3: () => {
  97. console.log(1);
  98. if (this.agencyPageList.length === this.total) {
  99. return;
  100. }
  101. this.agencyPageApi(false);
  102. },
  103. sonGuide1: () => {
  104. if (this.partyBranchList.length === this.total) {
  105. return;
  106. }
  107. this.partyBranchApi(false);
  108. }
  109. };
  110. if (data[this.option.path]) {
  111. data[this.option.path]();
  112. }
  113. },
  114. methods: {
  115. // 获取轮播图
  116. async recursionApi() {
  117. const res = await publicApi.recursionApi({
  118. bannerType: 1,
  119. parentId: this.option.parentId
  120. });
  121. if (res.data) {
  122. this.imageList = res.data[0].children
  123. }
  124. },
  125. async excellentPartMemberPageApi(reset = true) {
  126. const params = this.generalQueryData(reset);
  127. const res = await peopleApi.excellentPartMemberPageApi(params);
  128. let _goodsList = []
  129. if (res.data) {
  130. const {
  131. list = [], total = 0
  132. } = res.data;
  133. if (reset) {
  134. _goodsList = list;
  135. } else {
  136. _goodsList = this.doctorPageList.concat(list);
  137. }
  138. this.pageNo = params.pageNo || 1;
  139. this.total = total;
  140. this.doctorPageList = _goodsList
  141. }
  142. },
  143. async agencyPageApi(reset = true) {
  144. const params = this.generalQueryData(reset);
  145. const res = await peopleApi.agencyPageApi(params);
  146. let _goodsList = []
  147. if (res.data) {
  148. const {
  149. list = [], total = 0
  150. } = res.data;
  151. if (reset) {
  152. _goodsList = list;
  153. } else {
  154. _goodsList = this.agencyPageList.concat(list);
  155. }
  156. this.pageNo = params.pageNo || 1;
  157. this.total = total;
  158. this.agencyPageList = _goodsList
  159. }
  160. },
  161. async partyBranchApi(reset = true) {
  162. const params = this.generalQueryData(reset);
  163. const res = await peopleApi.partyBranchApi(params);
  164. if (res.data) {
  165. const {
  166. list = [], total = 0
  167. } = res.data;
  168. const _goodsList = reset ? list : this.partyBranchList.concat(list);
  169. this.pageNo = params.pageNo || 1;
  170. this.total = total;
  171. this.partyBranchList = _goodsList
  172. }
  173. },
  174. // 调用函数
  175. callFcuntion() {
  176. const ApiConfig = {
  177. sonGuide1: {
  178. api: this.partyBranchApi
  179. },
  180. '五星党员': {
  181. api: this.excellentPartMemberPageApi
  182. },
  183. sonGuide3: {
  184. api: this.agencyPageApi
  185. },
  186. sonGuide4: {
  187. api: this.agencyPageApi
  188. },
  189. sonGuide5: {
  190. api: this.agencyPageApi
  191. }
  192. };
  193. const obj = ApiConfig[this.option.path || this.option.name];
  194. if (obj.api) {
  195. obj.api();
  196. }
  197. },
  198. // 分页参数处理事件
  199. generalQueryData(reset = false) {
  200. const {
  201. pageNo,
  202. pageSize
  203. } = this;
  204. const params = {
  205. pageNo: 1,
  206. pageSize: 10
  207. };
  208. if (this.option.path === 'sonGuide4') {
  209. params.agencyType = 1;
  210. }
  211. if (this.option.path === 'sonGuide5') {
  212. params.agencyType = 2;
  213. }
  214. if (this.option.path === 'sonGuide3') {
  215. params.agencyType = 3;
  216. }
  217. if (reset) {
  218. return params;
  219. }
  220. return {
  221. ...params,
  222. pageNo: pageNo + 1,
  223. pageSize
  224. };
  225. },
  226. jumpDetail(event) {
  227. const {
  228. id
  229. } = event.currentTarget.dataset;
  230. uni.navigateTo({
  231. url: `/packages/people/pages/guide-detail/guide-detail?id=${id}`
  232. });
  233. },
  234. toArea(event) {
  235. const {
  236. item
  237. } = event.currentTarget.dataset;
  238. if (this.option.path === 'sonGuide1') {
  239. item.agencyName = '支部详情';
  240. item.agencyType = '12101';
  241. }
  242. uni.navigateTo({
  243. url: `/packages/people/pages/area/area?orgId=${item.orgId}&name=${item.agencyName}&type=${item.agencyType}&id=${item.id}`
  244. });
  245. }
  246. }
  247. };
  248. </script>
  249. <style lang="less">
  250. page {
  251. --rate-icon-size: 26rpx; // 评分大小
  252. --rate-icon-full-color: var(--item-dominant-color); // 评分选中颜色
  253. --rate-icon-gutter: 3rpx; // 评分图标之前的距离
  254. }
  255. .people-custom-swiper {
  256. width: 100%;
  257. height: 330rpx;
  258. position: relative;
  259. .custom-swiper-img {
  260. width: 100%;
  261. height: 100%;
  262. display: block;
  263. }
  264. }
  265. .guide-list {
  266. margin-top: 28rpx;
  267. padding: 0 32rpx;
  268. flex-wrap: wrap;
  269. .guide-item {
  270. flex-shrink: 0;
  271. width: 218rpx;
  272. height: 100%;
  273. margin-right: 16rpx;
  274. margin-top: 27rpx;
  275. &:nth-child(3n) {
  276. margin-right: 0;
  277. }
  278. .guide-img {
  279. width: 218rpx;
  280. height: 218rpx;
  281. margin-bottom: 16rpx;
  282. }
  283. .guide-name {
  284. margin-bottom: 17rpx;
  285. font-size: 32rpx;
  286. font-weight: 400;
  287. color: #333333;
  288. line-height: 32rpx;
  289. }
  290. }
  291. }
  292. .rural-list {
  293. margin-top: 45rpx;
  294. padding: 0 40rpx;
  295. flex-wrap: wrap;
  296. .guide-item {
  297. flex-shrink: 0;
  298. width: 326rpx;
  299. height: 100%;
  300. margin-right: 16rpx;
  301. margin-bottom: 40rpx;
  302. &:nth-child(2n) {
  303. margin-right: 0;
  304. }
  305. .guide-img {
  306. width: 326rpx;
  307. height: 168rpx;
  308. margin-bottom: 24rpx;
  309. }
  310. .guide-name {
  311. font-size: 32rpx;
  312. font-weight: 400;
  313. color: #333333;
  314. line-height: 32rpx;
  315. }
  316. }
  317. }
  318. .second-section {
  319. margin-top: 55rpx;
  320. padding: 0 40rpx 0;
  321. .section-item {
  322. padding: 14rpx 0;
  323. border-bottom: 1px solid #e1e1e1;
  324. &:first-child {
  325. padding-top: 0;
  326. }
  327. .section-item-left {
  328. margin-left: 32rpx;
  329. .consult-content-title {
  330. font-size: 32rpx;
  331. font-weight: 400;
  332. color: #333333;
  333. line-height: 40rpx;
  334. margin-bottom: 24rpx;
  335. }
  336. // .consult-content-block {
  337. // font-size: 24rpx;
  338. // font-weight: 400;
  339. // color: #999999;
  340. // }
  341. }
  342. .section-item-right {
  343. width: 300rpx;
  344. height: 140rpx;
  345. border-radius: 8rpx;
  346. }
  347. }
  348. }
  349. </style>