index.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  1. <template>
  2. <view class="content">
  3. <statusBar :item="navBarData"></statusBar>
  4. <!-- 消息提示 -->
  5. <msgPop></msgPop>
  6. <view class="top">
  7. <image :src="adv.img" mode="aspectFill"
  8. @click="gotoHome">
  9. </image>
  10. </view>
  11. <view class="sortBlock">
  12. <!-- <view class="sortCostcon" @click="gotoCost">
  13. <view class="sortCostcontent">
  14. <view class="costTit">
  15. 收费专区
  16. </view>
  17. <view class="costbri">
  18. <text class="di">暂未开放</text>
  19. </view>
  20. </view>
  21. <view class="costimgblc">
  22. <image src="../../static/Framezzz.png" class="costImg" mode="aspectFill"></image>
  23. </view>
  24. </view> -->
  25. <view class="sortleft">
  26. <view :class="item.cla" v-for="(item,index) in sortList" @click="gotoTab" :data-index="item">
  27. <!-- <image class="sortImg" src="../../static/Rectangle 937.png" mode="aspectFill"></image> -->
  28. <view class="sortcontent">
  29. <view class="contentl">
  30. <view class="tit">
  31. {{item.tit}}
  32. </view>
  33. <view class="bri">
  34. <text :class="item.briCla">{{item.bri}}</text>
  35. </view>
  36. </view>
  37. <view class="sortleftImgBlock">
  38. <image class="sortleftImg" :src="item.img" mode="aspectFill"></image>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. <viewX-Case>
  45. <template #title>
  46. <view class="title three-font">推荐内容</view>
  47. </template>
  48. <template #lookMore>
  49. <view class="lookMore fz-font" @click="listBlock1More">查看更多</view>
  50. </template>
  51. <template #teaching>
  52. <!-- 推荐课程组件 -->
  53. <listBlock1 ref="listBlock1" :classList="classList"></listBlock1>
  54. </template>
  55. </viewX-Case>
  56. <view class="" style="height: 30rpx; width: 100%"> </view>
  57. </view>
  58. </template>
  59. <script>
  60. export default {
  61. data() {
  62. return {
  63. title: "Hello",
  64. navBarData: {
  65. title: "首页", //导航栏标题
  66. btn: 0, //是否显示返回按钮 0不显示 1 显示
  67. },
  68. isRote: false,
  69. animation: null,
  70. animationData: {},
  71. adv: {},
  72. // 推荐课程
  73. classList: [],
  74. sortList: [{
  75. tit: '活动专区',
  76. bri: '精彩纷呈',
  77. img: '../../static/Framehhh.png',
  78. cla: 'sortcon',
  79. briCla: 'di'
  80. },
  81. {
  82. tit: '课程专区',
  83. bri: '海量资源',
  84. img: '../../static/Framesss.png',
  85. cla: 'sortcon sortcon2',
  86. briCla: 'di2'
  87. }
  88. ]
  89. };
  90. },
  91. methods: {
  92. gotoTab(e) {
  93. console.log(e.currentTarget.dataset.index.tit);
  94. let aaa = e.currentTarget.dataset.index.tit
  95. if (aaa == '活动专区') {
  96. return uni.switchTab({
  97. url: '/pages/activityPageNew/activityPageNew'
  98. })
  99. } else {
  100. uni.switchTab({
  101. url: '/pages/resource/resource'
  102. })
  103. }
  104. },
  105. gotoCost() {
  106. uni.showToast({
  107. title: '功能暂未开放,敬请期待',
  108. icon: 'none'
  109. })
  110. },
  111. // 获取教研室活动list 数据
  112. getlistBlock1Data() {
  113. let data = {
  114. openid: uni.getStorageSync('oId'),
  115. ty: 3,
  116. page: 1, //下拉获取更多的备用字段
  117. lim: 12 //一次获取多少数据
  118. }
  119. this.$request('/selectActivity', "POST", data).then(res => {
  120. // console.log('推荐活动', res[0]);
  121. this.classList = res[0]
  122. // console.log('推荐课程',this.classList);
  123. })
  124. },
  125. // 跳转到推荐课程查看更多
  126. listBlock1More() {
  127. const value = this.$store.state.user.openid;
  128. if (value == '') return this.goLog()
  129. uni.navigateTo({
  130. url: "/pages/teachingList/teachingList",
  131. });
  132. },
  133. // 顶部大图跳转外部链接
  134. gotoHome() {
  135. console.log(this.adv);
  136. // const web = this.classList[this.current];
  137. const url = this.adv.href
  138. uni.navigateTo({
  139. url: "/pages/skipone/skipone?item="+encodeURIComponent(JSON.stringify(url))
  140. // url: "/pages/skipone/skipone?url=" + encodeURIComponent(JSON.stringify(url)),
  141. });
  142. },
  143. // 分享
  144. onShareAppMessage() {
  145. uni.share({
  146. provider: "weixin",
  147. scene: "WXSceneSession",
  148. type: 1,
  149. summary: "我正在使用丽湖双创小程序,赶紧跟我一起来体验!",
  150. success: function(res) {
  151. console.log("success:" + JSON.stringify(res));
  152. },
  153. fail: function(err) {
  154. console.log("fail:" + JSON.stringify(err));
  155. }
  156. });
  157. },
  158. goLog() {
  159. uni.navigateTo({
  160. url: "/pages/login_Wechat/login_Wechat",
  161. });
  162. },
  163. // 获取顶部大图
  164. getAdv() {
  165. this.$request('/selectAdvertisement', "get", {
  166. typ: 0
  167. }).then(res => {
  168. console.log(res);
  169. this.adv=res[0][0]
  170. })
  171. }
  172. },
  173. onLoad() {
  174. // this.animation = uni.createAnimation()
  175. this.getAdv()
  176. },
  177. onShow() {
  178. // 清空推荐课程
  179. // this.classList = []
  180. // console.log(this.$store.state.msgpop);
  181. // 获取数据
  182. this.getlistBlock1Data()
  183. this.getAllMessage() // 调用app.js中的方法
  184. // // 因为组件没有onshow
  185. // // 获取收藏事件
  186. this.$refs.listBlock1.getdata()
  187. }
  188. };
  189. </script>
  190. <style lang="scss" scoped>
  191. .content {
  192. // 分类区样式
  193. .sortBlock {
  194. width: 750rpx;
  195. margin: 20rpx 0;
  196. background-color: rgba(255, 255, 255, 1);
  197. display: flex;
  198. justify-content: space-between;
  199. padding: 30rpx;
  200. position: relative;
  201. // 收费区
  202. .sortCostcon {
  203. padding: 30rpx;
  204. width: 336rpx;
  205. height: 300rpx;
  206. flex-shrink: 0;
  207. background-image: url('../../static/Rectangle1922.png');
  208. background-repeat: no-repeat;
  209. background-size: 100%;
  210. .sortCostcontent {
  211. display: flex;
  212. flex-direction: column;
  213. .costTit {
  214. font-weight: 400rpx;
  215. font-size: 36rpx;
  216. height: 48rpx;
  217. line-height: 48rpx;
  218. }
  219. .costbri {
  220. color: rgba(244, 142, 143, 1);
  221. font-size: 24rpx;
  222. width: 400;
  223. margin: 10rpx 0;
  224. }
  225. }
  226. .costimgblc {
  227. display: flex;
  228. justify-content: flex-end;
  229. .costImg {
  230. width: 162rpx;
  231. height: 162rpx;
  232. }
  233. }
  234. }
  235. .sortleft {
  236. flex: 1;
  237. display: flex;
  238. // flex-direction: column;
  239. justify-content: space-between;
  240. // margin-left: 20rpx;
  241. .sortcon2 {
  242. background-image: url('https://teacherapi.cocorobo.cn/teaching-file/static/Rectangle938.png') !important;
  243. }
  244. .sortcon {
  245. width: 336rpx;
  246. height: 140rpx;
  247. background-image: url('https://teacherapi.cocorobo.cn/teaching-file/static/Rectangle937.png');
  248. background-repeat: no-repeat;
  249. background-size: 100%;
  250. display: flex;
  251. padding: 20rpx;
  252. .sortImg {
  253. position: absolute;
  254. left: 0;
  255. top: 0;
  256. width: 100%;
  257. height: 100%;
  258. }
  259. .sortcontent {
  260. display: flex;
  261. width: 100%;
  262. height: 100%;
  263. color: #000;
  264. .contentl {
  265. width: 70%;
  266. .tit {
  267. font-size: 36rpx;
  268. line-height: 48rpx;
  269. }
  270. .bri {
  271. font-size: 24rpx;
  272. height: 48rpx;
  273. width: 144rpx;
  274. line-height: 32rpx;
  275. position: relative;
  276. .di {
  277. position: absolute;
  278. bottom: 0;
  279. left: 0;
  280. color: rgba(243, 189, 91, 1);
  281. }
  282. .di2 {
  283. position: absolute;
  284. bottom: 0;
  285. left: 0;
  286. color: rgba(180, 193, 250, 1);
  287. }
  288. }
  289. }
  290. .sortleftImgBlock {
  291. position: relative;
  292. .sortleftImg {
  293. position: absolute;
  294. bottom: -10rpx;
  295. left: 0;
  296. height: 68rpx;
  297. width: 68rpx;
  298. }
  299. }
  300. }
  301. }
  302. }
  303. }
  304. // 顶部大图
  305. .top {
  306. width: 750rpx;
  307. height: 288rpx;
  308. display: flex;
  309. margin-bottom: 20rpx;
  310. align-items: center;
  311. background-color: #fff;
  312. justify-content: center;
  313. image {
  314. height: 246rpx;
  315. width: 690rpx;
  316. border-radius: 10rpx;
  317. }
  318. }
  319. .title {
  320. font-weight: bold;
  321. }
  322. .lookMore {
  323. color: #666666;
  324. // font-size: 14px;
  325. }
  326. }
  327. </style>