Commit 20f2f03a authored by Davve's avatar Davve

Merge branch 'feature/face' into feature/face_image_upload

parents 2257f241 74ee15dc
...@@ -5,15 +5,28 @@ ...@@ -5,15 +5,28 @@
from utils.base import APIView from utils.base import APIView
from utils.logger import error_logger
class FaceStarEdit(APIView): class FaceStarEdit(APIView):
def get(self, request):
_id = request.GET.get('id')
try:
data = self.rpc['mercury/face/star/get'](_id=_id).unwrap()
except Exception as e:
error_logger.error(u'获取 %d 明星信息失败 %s ' % (_id, e))
raise
return {'data': data}
def post(self, request): def post(self, request):
name = request.POST.get('name') name = request.POST.get('name')
sex = request.POST.get('sex') sex = request.POST.get('sex')
ordinary_image_url = request.POST.get('ordinary_image_url') ordinary_image_url = request.POST.get('ordinary_image_url')
modeling_obj_url = request.POST.get('modeling_obj_url') modeling_obj_url = request.POST.get('modeling_obj_url')
try: try:
self.rpc['mercury/face/create_star']( self.rpc['mercury/face/create_star'](
name=name, name=name,
...@@ -23,6 +36,41 @@ class FaceStarEdit(APIView): ...@@ -23,6 +36,41 @@ class FaceStarEdit(APIView):
).unwrap() ).unwrap()
except Exception as e: except Exception as e:
raise e raise e
return { return {
'message': '创建成功' 'message': '创建成功'
} }
class StarListView(APIView):
def get(self, request):
page = int(request.GET.get('page', 1))
limit = int(request.GET.get('limit', 10))
filter = self.handle_filter(request.GET.get('filter', ""))
try:
data = self.rpc['mercury/face/star/list'](offset=(page-1) * limit, limit=limit, filters=filter).unwrap()
except Exception as e:
error_logger.error(u'获取明星列表失败 %s', e)
raise
return data
def post(self, request):
ids = request.POST.get('ids', '').split()
tp = request.POST.get('type', '')
updates = {}
if tp == 'offline':
updates['is_online'] = 0
else:
updates['is_online'] = 1
try:
self.rpc['mercury/face/star/update'](ids, **updates).unwrap()
except Exception as e:
error_logger.error(u'批量更新明星列表失败 %s', e)
raise
return {
"message": "更新成功"
}
...@@ -87,7 +87,10 @@ urlpatterns = [ ...@@ -87,7 +87,10 @@ urlpatterns = [
url(r'^tag/create$', TagUpdateOrCreateView.as_view()), url(r'^tag/create$', TagUpdateOrCreateView.as_view()),
url(r'^tag/detail$', TagUpdateOrCreateView.as_view()), url(r'^tag/detail$', TagUpdateOrCreateView.as_view()),
url(r'^face/star/create', FaceStarEdit.as_view()), url(r'^face/star/create$', FaceStarEdit.as_view()),
url(r'^face/star/list$', StarListView.as_view()),
url(r'^face/star/list/update$', StarListView.as_view()),
url(r'^face/star/detail$', FaceStarEdit.as_view()),
] ]
search_urlpatterns = [ search_urlpatterns = [
......
# sun 后台后端项目启动 # sun 后台后端项目启动
第一步: 第一步:
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
.waves-ripple{position:absolute;border-radius:100%;background-color:rgba(0,0,0,.15);background-clip:padding-box;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-transform:scale(0);transform:scale(0);opacity:1}.waves-ripple.z-active{opacity:0;-webkit-transform:scale(2);transform:scale(2);-webkit-transition:opacity 1.2s ease-out,-webkit-transform .6s ease-out;transition:opacity 1.2s ease-out,-webkit-transform .6s ease-out;transition:opacity 1.2s ease-out,transform .6s ease-out;transition:opacity 1.2s ease-out,transform .6s ease-out,-webkit-transform .6s ease-out}.edit-input[data-v-6cbe9bf6]{padding-right:100px}.cancel-btn[data-v-6cbe9bf6]{position:absolute;right:15px;top:10px} .waves-ripple{position:absolute;border-radius:100%;background-color:rgba(0,0,0,.15);background-clip:padding-box;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-transform:scale(0);transform:scale(0);opacity:1}.waves-ripple.z-active{opacity:0;-webkit-transform:scale(2);transform:scale(2);-webkit-transition:opacity 1.2s ease-out,-webkit-transform .6s ease-out;transition:opacity 1.2s ease-out,-webkit-transform .6s ease-out;transition:opacity 1.2s ease-out,transform .6s ease-out;transition:opacity 1.2s ease-out,transform .6s ease-out,-webkit-transform .6s ease-out}.edit-input[data-v-4d92cdb2]{padding-right:100px}.cancel-btn[data-v-4d92cdb2]{position:absolute;right:15px;top:10px}
\ No newline at end of file \ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -7,3 +7,28 @@ export function faceStarCreate(data) { ...@@ -7,3 +7,28 @@ export function faceStarCreate(data) {
data data
}) })
} }
export function fetchList(query) {
return request({
url: '/api/face/star/list',
method: 'get',
params: query
})
}
export function OffLineOrOnLine(data) {
console.log(data)
return request({
url: '/api/face/list/update',
method: 'post',
data
})
}
export function fetchPushDetail(id) {
return request({
url: '/api/face/star/detail',
method: 'get',
params: { id }
})
}
<template>
<div
class="preview-wrap"
@click="preview">
<img :src="silders" >
</div>
</template>
<script>
export default {
props: {
silders: ''
},
methods: {
preview() {
this.$emit('input', false)
}
}
}
</script>
<style lang="less" scoped>
.preview-wrap {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, .4);
z-index: 9999;
display: flex;
align-items: center;
justify-content: center;
}
</style>
<template lang="html"> <template lang="html">
<div class="upload-image-wrap" ref="uploadImage"> <div
ref="uploadImage"
class="upload-image-wrap">
<div v-if="multiple"> <div v-if="multiple">
<ul class="upload-image-items" v-if="currImages.length"> <ul
<li class="upload-image-item" v-for="(item, inx) in currImages" :disabled="disabled"> v-if="currImages.length"
<div class="image-inner" v-resize="item"></div> class="upload-image-items">
<div class="image-after" @click.stop="deleteImage(inx)"></div> <li
</li> v-for="(item, inx) in currImages"
<li class="upload-image-item upload-icon"> :disabled="disabled"
<upload-img class="multiple" @upload-img="onUpload" @uploaded="onUploaded" @error="onUploadError"> class="upload-image-item">
<slot></slot> <div
</upload-img> v-resize="item"
</li> class="image-inner"/>
</ul> <div class="image-after">
<div class="upload-icon" v-else> <span @click.stop="deleteImage(inx)"/>
<upload-img class="multiple" @upload-img="onUpload" @uploaded="onUploaded" @error="onUploadError"> <span @click.stop="lookImage(item)"/>
<slot></slot> </div>
</upload-img> </li>
</div> <li class="upload-image-item upload-icon">
<upload-img
class="multiple"
@upload-img="onUpload"
@uploaded="onUploaded"
@error="onUploadError">
<slot/>
</upload-img>
</li>
</ul>
<div
v-else
class="upload-icon">
<upload-img
class="multiple"
@upload-img="onUpload"
@uploaded="onUploaded"
@error="onUploadError">
<slot/>
</upload-img>
</div>
<preview-img
v-if="isflag"
v-model="isflag"
:silders="silders"/>
</div> </div>
<div v-else> <div v-else>
<div class="upload-icon single-upload"> <div class="upload-icon single-upload">
<div class="single-upload-icon" v-resize="currImages"> <div
<span v-if="currImages">修改图片</span> v-resize="currImages"
</div> class="single-upload-icon">
<div :class="{ hide: currImages != false }" class="single-upload-body"> <span v-if="currImages">修改图片</span>
<upload-img class="multiple" @upload-img="onSingleUpload" @uploaded="onUploaded" @error="onUploadError"> </div>
<slot v-if="currImages == false"></slot> <div
</upload-img> :class="{ hide: currImages != false }"
</div> class="single-upload-body">
<upload-img
class="multiple"
@upload-img="onSingleUpload"
@uploaded="onUploaded"
@error="onUploadError">
<slot v-if="currImages == false"/>
</upload-img>
</div> </div>
</div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
// import './webuploader' // import './webuploader'
import Resize from '@/components/Upload/utils/resizeImage' import Resize from '@/components/Upload/utils/resizeImage'
import UploadImg from '@/components/Upload/UploadImgBox' import UploadImg from '@/components/Upload/UploadImgBox'
import PreviewImg from '@/components/PreviewImg'
export default { export default {
data () { directives: {
return { Resize
inputValue: this.value },
} components: {
PreviewImg,
UploadImg
},
props: {
value: {
type: [Array, String]
}, },
directives: { limit: {
Resize type: Number
}, },
props: { disabled: Boolean,
value: { multiple: Boolean
type: [Array, String] },
}, data() {
limit: { return {
type: Number inputValue: this.value,
}, isflag: false,
disabled: Boolean, silders: ''
multiple: Boolean }
},
computed: {
currImages() {
if (this.multiple && Array.isArray(this.inputValue)) {
const images = [...this.inputValue]
return images.length ? images : []
} else {
return this.inputValue || ''
}
}
},
watch: {
value(newVal) {
this.inputValue = newVal
}
},
methods: {
// 上传中...
onUpload(res) {
if (!res.data.file_url) return
console.log(this.inputValue)
const content = this.inputValue.length
const limit = Number(this.limit)
if (limit && content >= limit) {
this.$emit('limit', content)
} else {
this.inputValue.push(res.data.file_url)
this.$emit('input', this.inputValue)
}
}, },
watch: { onSingleUpload(res) {
value (newVal) { if (!res.data.file_url) return
this.inputValue = newVal this.inputValue = res.data.file_url
} this.$emit('input', res.data.file_url)
}, },
computed: { // 上传完成
currImages () { onUploaded(res) {
if (this.multiple && Array.isArray(this.inputValue)) {
let images = [...this.inputValue]
return images.length ? images : []
} else {
return this.inputValue || ''
}
}
}, },
methods: {
// 上传中...
onUpload (res) {
if (!res.data.file_url) return
console.log(this.inputValue)
let content = this.inputValue.length
let limit = Number(this.limit)
if (limit && content >= limit) {
this.$emit('limit', content)
} else {
this.inputValue.push(res.data.file_url)
this.$emit('input', this.inputValue)
}
},
onSingleUpload (res) {
if (!res.data.file_url) return
this.inputValue = res.data.file_url
this.$emit('input', res.data.file_url)
},
// 上传完成
onUploaded (res) {
},
onUploadError (error) { onUploadError(error) {
console.log(error) console.log(error)
}, },
deleteImage (inx) { deleteImage(inx) {
this.inputValue.splice(inx, 1) this.inputValue.splice(inx, 1)
this.$emit('input', this.inputValue) this.$emit('input', this.inputValue)
}
}, },
components: {
UploadImg lookImage(item) {
this.isflag = true
this.silders = item
} }
}
} }
</script> </script>
...@@ -164,11 +207,42 @@ export default { ...@@ -164,11 +207,42 @@ export default {
position: absolute; position: absolute;
left: 50%; left: 50%;
top: 50%; top: 50%;
transform: translate(-50%, -50%); transform: translate(-100%, -50%);
width: 18px; width: 18px;
height: 18px; height: 18px;
background: url('../../assets/image/svg/uploadDelete.svg') 50% 50% no-repeat; background: url('../../assets/image/svg/uploadDelete.svg') 50% 50% no-repeat;
} }
&:before {
content: '';
position: absolute;
left: 50%;
top: 50%;
transform: translate(50%, -50%);
width: 18px;
height: 18px;
background: url('../../assets/image/svg/magnifier.png') no-repeat;
background-size: 18px;
}
span{
&:first-child{
position: absolute;
left: 50%;
top: 50%;
transform: translate(-80%, -50%);
width: 30px;
height: 30px;
z-index: 999;
}
&:last-child{
position: absolute;
left: 50%;
top: 50%;
transform: translate(10%, -50%);
width: 30px;
height: 30px;
z-index: 999;
}
}
} }
&[disabled]::before { &[disabled]::before {
position: absolute; position: absolute;
......
...@@ -41,12 +41,6 @@ ...@@ -41,12 +41,6 @@
</template> </template>
</el-table-column> </el-table-column>
<!--<el-table-column align="center" label="pick小组数">-->
<!--<template slot-scope="scope">-->
<!--<span>{{ scope.row.pick_group_nums }}</span>-->
<!--</template>-->
<!--</el-table-column>-->
<el-table-column align="center" label="pick属性"> <el-table-column align="center" label="pick属性">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.pick_type }}</span> <span>{{ scope.row.pick_type }}</span>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment