index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  1. <template>
  2. <view class="content">
  3. <!-- banner图 -->
  4. <view class="uni-padding-wrap">
  5. <view class="page-section swiper">
  6. <view class="page-section-spacing">
  7. <swiper class="swiper" circular="true" indicator-dots="true" autoplay="true" interval="3500"
  8. duration="600">
  9. <swiper-item class="swiper-list" v-for="(item, index) in bannerList" :key="index">
  10. <view class="swiper-item uni-bg-red">
  11. <image class="swiper-img" :src="item.bannerImg" mode=""></image>
  12. </view>
  13. </swiper-item>
  14. </swiper>
  15. </view>
  16. </view>
  17. </view>
  18. <view class="message-box" @click="noticeMore">
  19. <view class="page-section swiper">
  20. <view class="page-section-spacing">
  21. <swiper style="height: 120rpx;" class="swiper" vertical="ture" circular="true"
  22. indicator-dots='false' indicator-color="rgba(0,0,0,.0)" indicator-active-color="rgba(0,0,0,.0)"
  23. autoplay="true" interval="4000">
  24. <swiper-item class="swiper-list" v-for="(item, index) in messageData" :key="index">
  25. <view class="message-tltle">{{item.noticeTitle}}</view>
  26. <view class="message-content"><span>感谢</span>{{item.noticeDesc}}</view>
  27. </swiper-item>
  28. </swiper>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="cu-bar bg-white margin-top-xs">
  33. <view class="action sub-title">
  34. <text class="text-xl text-bold text-blue text-shadow">推荐小程序</text>
  35. <text class="text-ABC text-blue">my app</text>
  36. </view>
  37. <view class="action" @click="gomoreapp"><text class="text-lg text-grey text-shadow" >更多</text></view>
  38. </view>
  39. <ad :unit-id="adlist.bannerAd"></ad>
  40. <view class="skill-sequence-panel-content-wrapper">
  41. <!--左边虚化-->
  42. <view class="hide-content-box hide-content-box-left"></view>
  43. <!--右边虚化-->
  44. <view class="hide-content-box hide-content-box-right"></view>
  45. <scroll-view scroll-x="true" class="kite-classify-scroll">
  46. <view class="kite-classify-cell shadow" v-for="(item, index) in curriculum" :key="index">
  47. <view :class="'nav-li bg-index' + (index + 1)">
  48. <view class="nav-name">{{ item.itemName }}</view>
  49. </view>
  50. <view class="nav-content">{{ item.itemDesc }}</view>
  51. <view @click="goDeatil" class="nav-btn shadow" :class="'bg-index' + (index + 1)">立即访问</view>
  52. </view>
  53. </scroll-view>
  54. </view>
  55. <view class="cu-bar bg-white margin-top-xs">
  56. <view class="action sub-title">
  57. <text class="text-xl text-bold text-blue text-shadow">开源项目推荐</text>
  58. <text class="text-ABC text-blue">curriculum</text>
  59. </view>
  60. <view class="action" @click="goMore"><text class="text-lg text-grey text-shadow">更多</text></view>
  61. </view>
  62. <ad :unit-id="adlist.videoAd" ad-type="video" ad-theme="white"></ad>
  63. <view class="cu-card case no-card">
  64. <view @click="goProject(item.id)" class="cu-item shadow" v-for="(item, index) in projectList" :key="index">
  65. <view class="image">
  66. <image :src="item.programImg" mode="widthFix"></image>
  67. <view class="cu-tag bg-gradual-orange">{{ item.programTag }}</view>
  68. <view class="cu-bar bg-shadeBottom">
  69. <text class="text-cut">{{ item.programName }}</text>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. <ad-custom :unit-id="adlist.gridAd"></ad-custom>
  75. <view class="copyright">
  76. <text>AbuCoder版权所有</text>
  77. </view>
  78. </view>
  79. </template>
  80. <script>
  81. export default {
  82. data() {
  83. return {
  84. adlist:this.myad()[0],
  85. bannerList: [{
  86. bannerImg: 'https://cdn.uviewui.com/uview/swiper/swiper2.png'
  87. },
  88. {
  89. bannerImg: 'https://cdn.uviewui.com/uview/swiper/swiper1.png'
  90. },
  91. {
  92. bannerImg: 'https://cdn.uviewui.com/uview/swiper/swiper3.png'
  93. },
  94. ],
  95. messageData: [
  96. {
  97. noticeTitle: '「AbuCoder」感谢前段铺子前段框架!',
  98. tag: '感谢',
  99. noticeContent: '感谢Uview开源框架'
  100. },
  101. {
  102. noticeTitle: '「AbuCoder」感谢若依开发框架!',
  103. tag: '感谢',
  104. noticeContent: '第一次做插件,感谢大家的支持哦~'
  105. },
  106. {
  107. noticeTitle: '「AbuCoder」感谢ColorUI前段框架!',
  108. tag: '感谢',
  109. noticeContent: '第一次做插件,感谢大家的支持哦~'
  110. }
  111. ],
  112. curriculum: [{
  113. itemName: '专业证件照',
  114. itemDesc: '基于uniapp的专业证件照制作小程序,欢迎访问...'
  115. },
  116. {
  117. itemName: '极速去水印',
  118. itemDesc: '基于uniapp的专业极速去水印助手小程序,欢迎访问...'
  119. },
  120. {
  121. itemName: '证件照(民族语言版)',
  122. itemDesc: '基于uniapp的专业证件照制作小程序民族语言版...'
  123. },
  124. ],
  125. projectList:[
  126. {
  127. programImg:'https://cdn.uviewui.com/uview/swiper/swiper2.png',
  128. programTag:'Gitee开源',
  129. programName:'若依开源框架推荐'
  130. }
  131. ]
  132. }
  133. },
  134. onLoad() {
  135. this.getBannerlist()
  136. this.getNoticelist()
  137. this.getItemslist()
  138. this.getProgrammslist()
  139. this.myAd()
  140. },
  141. methods: {
  142. //暴力插屏广告
  143. myAd(){
  144. let that = this
  145. if (that.myad()[0].plaqueAd) {
  146. setInterval(function() {
  147. // 在页面中定义插屏广告
  148. let interstitialAd = null
  149. // 在页面onLoad回调事件中创建插屏广告实例
  150. if (wx.createInterstitialAd) {
  151. interstitialAd = wx.createInterstitialAd({
  152. adUnitId: that.myad()[0].plaqueAd
  153. })
  154. interstitialAd.onLoad(() => {})
  155. interstitialAd.onError((err) => {})
  156. interstitialAd.onClose(() => {})
  157. }
  158. // 在适合的场景显示插屏广告
  159. if (interstitialAd) {
  160. interstitialAd.show().catch((err) => {
  161. console.error(err)
  162. })
  163. }
  164. }, 15000); //15000为插屏间隔时间
  165. }
  166. },
  167. getBannerlist(){
  168. this.request('loadBaneer', 'GET').then(res=>{
  169. // console.log("res:",res)
  170. if(res){
  171. let imgurl = {}
  172. for (var i = 0; i < res.data.length; i++) {
  173. imgurl[i] = {};
  174. imgurl[i]['bannerImg'] = this.myimgurl() + res.data[i].bannerImg
  175. }
  176. // console.log(imgurl)
  177. this.bannerList = imgurl
  178. }
  179. })
  180. },
  181. getNoticelist(){
  182. this.request('loadNotice', 'GET').then(res=>{
  183. console.log("res:",res)
  184. if(res){
  185. this.messageData = res.data
  186. }
  187. })
  188. },
  189. getItemslist(){
  190. this.request('loadItems', 'GET').then(res=>{
  191. console.log("res:",res)
  192. if(res){
  193. this.curriculum = res.data
  194. }
  195. })
  196. },
  197. getProgrammslist(){
  198. this.request('loadProgramms', 'GET').then(res=>{
  199. console.log("res:",res)
  200. // if(res){
  201. // this.projectList = res.data
  202. // }
  203. if(res){
  204. let mydata = {}
  205. for (var i = 0; i < res.data.length; i++) {
  206. mydata[i] = {};
  207. mydata[i]['programImg'] = this.myimgurl() + res.data[i].programImg;
  208. mydata[i]['id'] =res.data[i].id
  209. mydata[i]['programName'] = res.data[i].programName
  210. mydata[i]['programTag'] = res.data[i].programTag
  211. }
  212. // console.log(mydata)
  213. this.projectList = mydata
  214. }
  215. })
  216. },
  217. //更多
  218. goMore(){
  219. uni.navigateTo({
  220. url:'../itemlist/itemlist'
  221. })
  222. },
  223. gomoreapp(){
  224. uni.navigateTo({
  225. url:'../projectlist/projectlist'
  226. })
  227. },
  228. noticeMore(){
  229. uni.navigateTo({
  230. url:'../me/mynotice/mynotice'
  231. })
  232. }
  233. }
  234. }
  235. </script>
  236. <style lang="scss">
  237. .swiper-box {
  238. flex: 1;
  239. }
  240. .swiper-item {
  241. height: 100%;
  242. }
  243. /*通知公告*/
  244. .message-box {
  245. width: 100%;
  246. height: 120rpx;
  247. background: url(https://zhoukaiwen.com/img/icon/clock.gif) #FFFFFF;
  248. background-repeat: no-repeat;
  249. background-size: 100rpx 100rpx;
  250. background-position: 15rpx 10rpx;
  251. margin: 0rpx 0rpx 10rpx 0rpx;
  252. padding-left: 130rpx;
  253. .message-tltle {
  254. height: 65rpx;
  255. line-height: 70rpx;
  256. font-weight: 600;
  257. font-size: 28rpx;
  258. }
  259. .message-content {
  260. color: #0081ff;
  261. span {
  262. background-color: #0081ff;
  263. color: #FFFFFF;
  264. padding: 2rpx 8rpx;
  265. border-radius: 8rpx;
  266. margin-right: 8rpx;
  267. }
  268. }
  269. }
  270. /*scroll-view外层*/
  271. .skill-sequence-panel-content-wrapper {
  272. position: relative;
  273. white-space: nowrap;
  274. padding: 10rpx 0 10rpx 10rpx;
  275. }
  276. /*左右渐变遮罩*/
  277. .hide-content-box {
  278. position: absolute;
  279. top: 0;
  280. height: 100%;
  281. width: 10px;
  282. z-index: 2;
  283. }
  284. .hide-content-box-left {
  285. left: 0;
  286. background-image: linear-gradient(to left, rgba(255, 255, 255, 0), #f3f3f3 60%);
  287. }
  288. .hide-content-box-right {
  289. right: 0;
  290. background-image: linear-gradient(to right, rgba(255, 255, 255, 0), #f3f3f3 60%);
  291. }
  292. .kite-classify-scroll {
  293. width: 100%;
  294. height: 380rpx;
  295. overflow: hidden;
  296. white-space: nowrap;
  297. }
  298. .kite-classify-cell {
  299. display: inline-block;
  300. width: 266rpx;
  301. height: 370rpx;
  302. margin-right: 20rpx;
  303. background-color: #ffffff;
  304. border-radius: 10rpx;
  305. overflow: hidden;
  306. box-shadow: 2px 2px 3px rgba(26, 26, 26, 0.2);
  307. }
  308. .nav-li {
  309. padding: 40rpx 30rpx;
  310. width: 100%;
  311. background-image: url(https://s1.ax1x.com/2020/06/27/NyU04x.png);
  312. background-size: cover;
  313. background-position: center;
  314. position: relative;
  315. z-index: 1;
  316. }
  317. .nav-name {
  318. font-size: 28upx;
  319. text-transform: Capitalize;
  320. margin-top: 20upx;
  321. position: relative;
  322. }
  323. .nav-name::before {
  324. content: '';
  325. position: absolute;
  326. display: block;
  327. width: 40rpx;
  328. height: 6rpx;
  329. background: #fff;
  330. bottom: 0;
  331. right: 0;
  332. opacity: 0.5;
  333. }
  334. .nav-name::after {
  335. content: '';
  336. position: absolute;
  337. display: block;
  338. width: 100rpx;
  339. height: 1px;
  340. background: #fff;
  341. bottom: 0;
  342. right: 40rpx;
  343. opacity: 0.3;
  344. }
  345. .nav-content {
  346. width: 100%;
  347. padding: 15rpx;
  348. display: inline-block;
  349. overflow-wrap: break-word;
  350. white-space: normal;
  351. }
  352. .nav-btn {
  353. width: 200rpx;
  354. height: 60rpx;
  355. margin: 8rpx auto;
  356. text-align: center;
  357. line-height: 60rpx;
  358. border-radius: 10rpx;
  359. }
  360. .bg-index1 {
  361. background-color: #19cf8a;
  362. color: #fff;
  363. }
  364. .bg-index2 {
  365. background-color: #954ff6;
  366. color: #fff;
  367. }
  368. .bg-index3 {
  369. background-color: #5177ee;
  370. color: #fff;
  371. }
  372. .bg-index4 {
  373. background-color: #f49a02;
  374. color: #fff;
  375. }
  376. .bg-index5 {
  377. background-color: #ff4f94;
  378. color: #fff;
  379. }
  380. .bg-index6 {
  381. background-color: #7fd02b;
  382. color: #fff;
  383. }
  384. .item-name {
  385. margin-bottom: 15rpx;
  386. display: -webkit-box;
  387. -webkit-box-orient: vertical;
  388. -webkit-line-clamp: 1;
  389. overflow: hidden;
  390. }
  391. .copyright{
  392. margin: 20rpx auto;
  393. width: 80%;
  394. height: 60rpx;
  395. display: flex;
  396. justify-content: center;
  397. align-items: center;
  398. color: #9E9E9E;
  399. font-size: 26rpx;
  400. }
  401. </style>