This commit is contained in:
caoqianming 2020-04-29 17:50:04 +08:00
parent 17f68ef261
commit 9462471611
6 changed files with 28 additions and 9 deletions

View File

@ -54,11 +54,11 @@ App({
}) })
}, },
globalData: { globalData: {
userInfo: null, userInfo: {},
userinfo: null, // 服务器传回的消费者信息 userinfo: {}, // 服务器传回的消费者信息
// host: 'https://apitest.ctcshe.com', host: 'https://apitest.ctcshe.com',
mediahost: 'https://apitest.ctcshe.com', mediahost: 'https://apitest.ctcshe.com',
host: 'http://127.0.0.1:8000', //host: 'http://127.0.0.1:8000',
//mediahost: 'http://127.0.0.1:8000', //mediahost: 'http://127.0.0.1:8000',
token : '', token : '',
} }

View File

@ -6,7 +6,7 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
elink_f:''
}, },
/** /**
@ -68,7 +68,16 @@ Page({
getDetail: function (id) { getDetail: function (id) {
var that = this var that = this
api.request(`/cms/article/${id}/`,'GET').then(res => { api.request(`/cms/article/${id}/`,'GET').then(res => {
if(res.data.elink){
let elink_f = getApp().globalData.host + '/redirect?url='+res.data.elink
console.log(elink_f)
that.setData({
elink_f:elink_f
})
}else{
that.setData(res.data) that.setData(res.data)
}
}) })
}, },

View File

@ -1,4 +1,4 @@
<web-view wx:if="{{elink}}" src="{{elink}}"></web-view> <web-view wx:if="{{elink_f}}" src="{{elink_f}}"></web-view>
<view class="page" wx:else> <view class="page" wx:else>
<view class="page__hd" style="padding:20px"> <view class="page__hd" style="padding:20px">
<view class="page__title" >{{title}}</view> <view class="page__title" >{{title}}</view>

View File

@ -1,3 +1,5 @@
{ {
"usingComponents": {} "usingComponents": {},
"enablePullDownRefresh": true,
"onReachBottomDistance": 50
} }

View File

@ -21,7 +21,7 @@ from rest_framework_jwt.views import obtain_jwt_token,refresh_jwt_token,verify_j
from rest_framework.documentation import include_docs_urls from rest_framework.documentation import include_docs_urls
from rbac.views.user import UserLogoutView from rbac.views.user import UserLogoutView
from utils.file import UploadFileView from utils.file import UploadFileView
from utils.view import redirect
urlpatterns = [ urlpatterns = [
path('rbac/', include('rbac.urls')), path('rbac/', include('rbac.urls')),
@ -35,6 +35,7 @@ urlpatterns = [
path('token/verify/', verify_jwt_token), path('token/verify/', verify_jwt_token),
path('token/remove/', UserLogoutView.as_view()), path('token/remove/', UserLogoutView.as_view()),
path('uploadfile/', UploadFileView.as_view()), path('uploadfile/', UploadFileView.as_view()),
path('redirect/',redirect),
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
path('docs/', include_docs_urls(title="答题平台接口文档",authentication_classes=[], permission_classes=[])), path('docs/', include_docs_urls(title="答题平台接口文档",authentication_classes=[], permission_classes=[])),
]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) ]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

View File

@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-
import requests
from django.http import HttpResponse
def redirect(request):
data = requests.get(url=request.GET.get('url'))
return HttpResponse(data.content)