广告条

路飞-后台home模块

两盒软妹~` 提交于 2019-12-04 06:52:21
home模块 创建home模块 """ 前提:在 luffy 虚拟环境下 1.终端从项目根目录进入apps目录 >: cd luffyapi & cd apps 2.创建app >: python ../../manage.py startapp home """ 路由分发 主路由:luffyapi/urls.py from django.urls import path, re_path, include urlpatterns = [ # ... path('user/', include('home.urls')), # ... ] 子路由:home/urls.py from django.urls import path, re_path urlpatterns = [ ] Banner数据表model设计 utils/model.py from django.db import models class BaseModel(models.Model): orders = models.IntegerField(verbose_name='显示顺序') is_show = models.BooleanField(verbose_name="是否上架", default=False) is_delete = models.BooleanField(verbose_name=

路飞-后台处理跨域问题

这一生的挚爱 提交于 2019-12-04 06:51:56
分离的前后台交互 后台处理跨域 安装插件 """ >: pip install django-cors-headers 插件参考地址:https://github.com/ottoyiu/django-cors-headers/ """ 项目配置:dev.py # 注册app INSTALLED_APPS = [ ... 'corsheaders' ] # 添加中间件 MIDDLEWARE = [ ... 'corsheaders.middleware.CorsMiddleware' ] # 允许跨域源 CORS_ORIGIN_ALLOW_ALL = True 前台请求Banner数据 修订Banner.vue <template> <el-carousel height="520px" :interval="3000" arrow="always"> <!-- 渲染后台数据 --> <el-carousel-item v-for="banner in banner_list" :key="banner.name"> <a :href="banner.link"> <img :src="banner.image" alt="" :title="banner.note"> </a> </el-carousel-item> </el-carousel> </template>

JS案例经验二

笑着哭i 提交于 2019-12-03 13:43:14
一 关键词 :鼠标事件的触发 可以在函数中指定让鼠标事件自动触发,而不是必须要鼠标滑过才触发,例如: main.onmouseover(); // 可以把该语句看做是鼠标滑过的模拟动作 main 是DOM元素 二 关键词 :for..of 的兼容性问题 旧的浏览器可能不会兼容for of方式的迭代方式,所以尽量使用常规的方式来迭代数组。 三 关键词 :function作用域问题 例子: for(var d = 0;d<10;d++){ function(){ console.log(d); //在此处,打印的d的值永远为10; `原因未知` } } 四 关键词 :元素的className 清除元素className的方法: main.className = ""; //main为获取的DOM元素 五 关键词 :元素在元素之上 若想让元素a在元素b之上,就应该先让元素a和元素b处在同一级,然后让元素a脱离标准流。 六 line-height可以控制a元素的高度。 七 关键词 :导航栏相邻元素display问题 在js导航栏的案例中,需要实现这样的功能:当从一级菜单滑出时,保证二级菜单不消失(前提:设置了滑出一级菜单时二级菜单消失)。 实现方法 :为二级菜单的设置滑过她时,他自己出现。 总结 在这个案例中,整个轮播特效的部分在一个整体的div中。 图片轮播的区域又是一个div

How to share iAd banner between views using AppDelegate

匿名 (未验证) 提交于 2019-12-03 08:54:24
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am looking to implement iAd in my app. So far I have managed to get them showing/dismissing correctly in each view using the below. App Delegate: import UIKit import iAd @UIApplicationMain class AppDelegate : UIResponder , UIApplicationDelegate { var window : UIWindow ? var adBannerView = ADBannerView () View Controller 1: import UIKit import iAd class HomeScreenViewController : UIViewController , UITableViewDelegate , UITableViewDataSource , ADBannerViewDelegate { let appDelegate = UIApplication . sharedApplication (). delegate

How to make AdView “occupy” space even while requesting an ad? (Android)

匿名 (未验证) 提交于 2019-12-03 08:36:05
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm using Google AdMob Ads SDK 4.0.4 for Android By default, The AdView will have no size until the ad is loaded. Which could cause problem if you have buttons above or below the ad. User could accidentally click on the ad if the ad returned at the exact moment they are about to click a button. In old admob SDK I solved this by using setGoneWithoutAd(false). This way, the space will be preserved even when the ad is not returned yet. In the new SDK (Google Admob Ads SDK 4.0.4) I manage to do the same by using this quick fix: reserve the space

Cancel Banner Notification in iOS8 Not Working

匿名 (未验证) 提交于 2019-12-03 03:03:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: My title might not accurately depict my question, so I apologize. I have looked for a solution to creating this level of functionality but I am unable to find it. I am creating a VoIP application for iOS 8. When a user receives a call I am displaying a notification with a 12 second ringtone. While this notification is in progress if the call disconnects I want the Incoming Call notification to disappear and display a Missed Call notification immediately. This level of functionality is possible because Viber does it. Currently, I am sending a

接口缓存

半世苍凉 提交于 2019-12-03 02:44:18
目录 接口缓存 视图模块:home/views.py 接口缓存 视图模块:home/views.py from rest_framework.generics import ListAPIView from . import models, serializers from settings.const import BANNER_COUNT # 访问量大,且数据较固定的接口,建议建立接口缓存 from django.core.cache import cache from rest_framework.response import Response class BannerListAPIView(ListAPIView): queryset = models.Banner.objects.filter(is_delete=False, is_show=True).order_by('-orders')[:BANNER_COUNT] serializer_class = serializers.BannerModelSerializer # 缓存有,走缓存,缓存没有走数据库 def list(self, request, *args, **kwargs): banner_data = cache.get('banner_list') if not banner_data:

Change language of alert in banner of Push Notification

匿名 (未验证) 提交于 2019-12-03 02:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am facing problem to change the language of alert in banner when push comes. Actually i am working on an app which works in two language. One is English and second is Norwegian. The push I am receiving from my web server end and what the string it has in alert key is displayed in banner when push comes and you are outside of the app. But as a requirement we want that if I change the language from setting from English to Norwegian then when push comes it's banner's alert string would also change to Norwegian. Will it be possible at my end

Creating an android smart app banner

匿名 (未验证) 提交于 2019-12-03 02:23:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Is there any solution for Android devices similar to the iOS 6 smart app banner? Here is the code for smart app banner 回答1: I needed that myself, so I created a jquery plugin to mimic a smart banner for Android and older iOS versions. http://jasny.github.com/jquery.smartbanner/#android 回答2: Since Chrome 44 Beta you can push your app in Chrome for Android with a native app install banner on your website. There are a couple of criteria that need to be met in order to enable it: You will need a web app manifest file You will have to serve your

Putting content/banner above the “Fixed Top Navbar”

匿名 (未验证) 提交于 2019-12-03 02:16:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I want to put an banner onto the fixed top navbar of the Bootstrap. My aim is using the navbar as the navigation for operations and putting a banner of the project above it. It will be cool if navbar is alway there in case of scrolling, but it is better for banner to disappear. How can I achieve that, any examples? 回答1: The trick is in using affix , and then you don't necessarily need to put the banner in the <header> . css: #topnavbar { margin : 0 ; } #topnavbar.affix { position : fixed ; top : 0 ; width : 100 %; } js: $ ( '