XueYuan.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. <template>
  2. <view class="box">
  3. <u-navbar :autoBack="true" title="文保学院" bgColor="rgba(255,255,255,0)" :placeholder="true" titleStyle="font-weight:bold;color:#000000"></u-navbar>
  4. <view style="width: 90%; margin: auto">
  5. <u-swiper
  6. :list="swiperList"
  7. imgMode="aspectFill"
  8. :height="160"
  9. :indicator="true"
  10. radius="0"
  11. :autoplay="true"
  12. :circular="true"
  13. indicatorStyle="bottom: 10px"
  14. indicatorMode="dot"
  15. indicatorActiveColor="#fff"
  16. indicatorInactiveColor="rgba(255, 255, 255, 0.35)"
  17. ></u-swiper>
  18. </view>
  19. <view class="box_menu">
  20. <view @click="menuBtn(index)" v-for="(item, index) in menuList" :key="item.index" class="menu_item">{{ item.title }}</view>
  21. </view>
  22. <view class="map_tit" style="margin-left: 90rpx; margin-top: 0">
  23. <image style="width: 211rpx; height: 52rpx" src="/static/img/right_img.png"></image>
  24. <view class="">专家推荐</view>
  25. <image style="width: 211rpx; height: 52rpx" src="/static/img/left_img.png"></image>
  26. </view>
  27. <scroll-view v-if="expertList.length > 0" @scrolltolower="LoadMoress" scroll-x style="display: flex; white-space: nowrap" class="">
  28. <view class="" style="display: flex; justify-content: space-between; width: 90%; margin: auto">
  29. <view @click="expertDetails(item.id)" class="zj_box" v-for="item in expertList" :key="item">
  30. <view class="tx_box">
  31. <image
  32. style="width: 148rpx; height: 152rpx; border-radius: 200rpx"
  33. :src="item.image ? item.image : 'https://huli-app.wenlvti.net/app_static/WenWuGuanJia/image/gj_wxstx.png'"
  34. ></image>
  35. </view>
  36. <view>
  37. <view style="font-size: 28rpx; color: #444444">文史专家</view>
  38. <view class="">
  39. <uni-icons v-for="item in 5" :key="item" color="#ca5642" type="star-filled" size="12"></uni-icons>
  40. </view>
  41. </view>
  42. <view class="tiwen">{{ item.title }}</view>
  43. </view>
  44. </view>
  45. </scroll-view>
  46. <u-empty v-else text="暂无专家" mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png"></u-empty>
  47. <view class="map_tit" style="margin-left: 90rpx" @click="onRedirect('course-home')">
  48. <image style="width: 211rpx; height: 52rpx" src="/static/img/right_img.png"></image>
  49. <view class="">课程推荐</view>
  50. <image style="width: 211rpx; height: 52rpx" src="/static/img/left_img.png"></image>
  51. </view>
  52. <view class="" v-if="state.course_list.length > 0">
  53. <course-item v-for="(item, index) in state.course_list" :key="index" :item="item"></course-item>
  54. </view>
  55. <u-empty v-else text="暂无课程" mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png"></u-empty>
  56. </view>
  57. </template>
  58. <script>
  59. let that;
  60. export default {
  61. data() {
  62. return {
  63. isLoading: false,
  64. page: 1,
  65. state: null,
  66. expertList: [],
  67. menuList: [
  68. {
  69. title: '政策法规',
  70. path: '/index_fenbao/fuWu/FaLv/FaLv'
  71. },
  72. {
  73. title: '专家课程',
  74. path: '/xueYuan_fenbao/keCheng/keCheng'
  75. },
  76. // {
  77. // title: '厦门文物',
  78. // path: '/xueYuan_fenbao/wenWu/wenWu'
  79. // },
  80. {
  81. title: '自我测验',
  82. path: '/pages/user/learn'
  83. }
  84. ],
  85. swiperList: ['https://huli-app.wenlvti.net/app_static/WenWuGuanJia/image/xy_lbt.jpg']
  86. };
  87. },
  88. onLoad() {
  89. that = this;
  90. this.getHomeData();
  91. this.getContentList();
  92. this.loadGlobalFont();
  93. },
  94. methods: {
  95. menuBtn(i) {
  96. uni.navigateTo({
  97. url: this.menuList[i].path
  98. });
  99. },
  100. // 专家列表
  101. getContentList() {
  102. this.isLoading = true;
  103. this.$api.getContentList({ page: this.page, pageSize: 10, main_body_id: 1, model_id: 7, main_body_column_id: 41 }, function (res) {
  104. console.log(res, '人物');
  105. let index = res.data.findIndex((item) => item.id == '235');
  106. // 只有找到匹配项时才进行删除操作
  107. if (index !== -1) {
  108. res.data.splice(index, 1);
  109. }
  110. that.isLoading = false;
  111. that.expertList = [...that.expertList, ...res.data];
  112. });
  113. },
  114. LoadMoress() {
  115. if (this.isLoading) {
  116. return;
  117. } else {
  118. this.page++;
  119. this.getContentList();
  120. }
  121. },
  122. // 专家详情
  123. expertDetails(id) {
  124. uni.navigateTo({
  125. url: '/xueYuan_fenbao/zhuangJia/zhuangJia?id=' + id
  126. });
  127. },
  128. // 课程
  129. getHomeData() {
  130. this.$api.getHomeData({}, function (res) {
  131. console.log(res, 1010);
  132. // this.hasLoad = true
  133. // this.loadingType = -1
  134. that.state = res.data;
  135. console.log(that.state, 1010);
  136. });
  137. },
  138. // 更多课程
  139. onRedirect(type) {
  140. console.log('onRedirect', type);
  141. var pages = {
  142. 'course-home': '/pages/course/index',
  143. 'schedule-home': '/pages/schedule/index'
  144. };
  145. var page = pages[type] || '';
  146. if (page) {
  147. if (type === 'course-home' || type === 'schedule-home') {
  148. uni.navigateTo({
  149. url: page
  150. });
  151. } else {
  152. uni.navigateTo({
  153. url: page
  154. });
  155. }
  156. }
  157. },
  158. // 加载字体
  159. loadGlobalFont() {
  160. try {
  161. uni.loadFontFace({
  162. family: 'MyGlobalFont', // 自定义字体名
  163. source: 'url("https://huli-app.wenlvti.net/app_static/WenWuGuanJia/image/songTi.ttf")',
  164. success() {
  165. console.log('全局字体加载成功');
  166. }
  167. });
  168. } catch (error) {
  169. console.error('全局字体加载异常', error);
  170. }
  171. }
  172. }
  173. };
  174. </script>
  175. <style>
  176. .box {
  177. height: auto;
  178. width: 100%;
  179. padding-bottom: 50rpx;
  180. background-image: url('https://huli-app.wenlvti.net/app_static/minnanhun/image/gj_bg.png');
  181. background-repeat: repeat-y;
  182. background-size: cover;
  183. font-family: 'MyGlobalFont';
  184. }
  185. /deep/.u-swiper-indicator__wrapper__dot--active {
  186. width: 5px !important;
  187. }
  188. .box_menu {
  189. width: 90%;
  190. margin: auto;
  191. margin-top: 20rpx;
  192. display: flex;
  193. justify-content: space-around;
  194. flex-flow: wrap;
  195. }
  196. .menu_item {
  197. width: 107rpx;
  198. height: 278rpx;
  199. padding-top: 35rpx;
  200. line-height: 92rpx;
  201. color: #272727;
  202. font-weight: 600;
  203. font-size: 32rpx;
  204. letter-spacing: 8rpx;
  205. background-image: url('https://huli-app.wenlvti.net/app_static/WenWuGuanJia/image/xy_menu.png');
  206. background-size: 100% 100%;
  207. writing-mode: vertical-lr;
  208. writing-mode: tb-lr;
  209. }
  210. .zj_box {
  211. /* width: 197rpx;
  212. height: 292rpx; */
  213. text-align: center;
  214. padding-top: 30rpx;
  215. }
  216. .tiwen {
  217. width: 134rpx;
  218. height: 52rpx;
  219. text-align: center;
  220. line-height: 52rpx;
  221. font-size: 24rpx;
  222. color: #ffffff;
  223. margin-left: 32rpx;
  224. margin-top: 10rpx;
  225. background-color: #c46354;
  226. }
  227. .tx_box {
  228. display: flex;
  229. align-items: center;
  230. justify-content: center;
  231. padding-right: 16rpx;
  232. width: 196rpx;
  233. height: 188rpx;
  234. background-image: url('https://huli-app.wenlvti.net/app_static/WenWuGuanJia/image/tx_bg.png');
  235. background-size: 100% 100%;
  236. }
  237. .map_tit {
  238. display: flex;
  239. align-items: center;
  240. margin-left: 60rpx;
  241. margin-top: 40rpx;
  242. font-size: 40rpx;
  243. font-family: 'MyGlobalFont';
  244. font-weight: 900;
  245. line-height: 52rpx;
  246. color: #444444;
  247. }
  248. .kc_box {
  249. padding: 30upx;
  250. display: flex;
  251. align-items: center;
  252. box-shadow: rgba(0, 0, 0, 0.1) 0px 20rpx 15px -6rpx, rgba(0, 0, 0, 0.05) 0px 8rpx 12rpx -4rpx;
  253. }
  254. .b-main {
  255. flex: 1;
  256. margin-left: 20upx;
  257. }
  258. .text_23 {
  259. color: #272727;
  260. font-size: 30rpx;
  261. margin-top: 10rpx;
  262. font-weight: 600;
  263. }
  264. .b-main .b-price {
  265. display: flex;
  266. align-items: center;
  267. }
  268. .button_6 {
  269. background-color: rgba(202, 86, 66, 1);
  270. color: rgba(248, 226, 175, 1);
  271. font-size: 24rpx;
  272. line-height: 45rpx;
  273. height: 42rpx;
  274. width: 137rpx;
  275. text-align: center;
  276. margin: 62rpx 0 0 160rpx;
  277. }
  278. .text_25 {
  279. font-size: 26rpx;
  280. color: #727070;
  281. margin-top: 10rpx;
  282. font-weight: 400;
  283. }
  284. .b-cover {
  285. width: 307rpx;
  286. height: 171rpx;
  287. }
  288. </style>