Commit 3c29f928 authored by Zhang Xiaojie's avatar Zhang Xiaojie

Merge branch 'dev' of gitlab.33.cn:CassiniatSaturn/fns_backend into dev

parents 80d26330 8f88f8b0
VUE_APP_MODE=live
\ No newline at end of file
tar -czf fns_backendlive.tar fns_backendlive
scp fns_backendlive.tar root@121.40.18.70:/usr/share/nginx/html/fns_backendlive.tar
rm -rf fns_backendlive.tar
ssh root@121.40.18.70 'cd /usr/share/nginx/html && rm -rf fns_backendlive && tar -xzf fns_backendlive.tar && rm -rf fns_backendlive.tar'
echo '👉 http://121.40.18.70:2050/'
\ No newline at end of file
...@@ -8,10 +8,12 @@ ...@@ -8,10 +8,12 @@
"normal": "vue-cli-service serve --mode normal", "normal": "vue-cli-service serve --mode normal",
"buildPlatform": "vue-cli-service build --mode platform", "buildPlatform": "vue-cli-service build --mode platform",
"buildNormal": "vue-cli-service build --mode normal", "buildNormal": "vue-cli-service build --mode normal",
"buildLive": "vue-cli-service build --mode live",
"bdPlatform": "npm run buildPlatform & bash deployPlatform.sh", "bdPlatform": "npm run buildPlatform & bash deployPlatform.sh",
"bdNormal": "npm run buildNormal & bash deployNormal.sh", "bdNormal": "npm run buildNormal & bash deployNormal.sh",
"bdPlatform_110": "npm run buildPlatform & bash deployPlatform_110.sh", "bdPlatform_110": "npm run buildPlatform & bash deployPlatform_110.sh",
"bdNormal_110": "npm run buildNormal & bash deployNormal_110.sh" "bdNormal_110": "npm run buildNormal & bash deployNormal_110.sh",
"bdLive": "npm run buildLive & bash deployLive.sh"
}, },
"dependencies": { "dependencies": {
"@tiptap/extension-image": "^2.0.0-beta.15", "@tiptap/extension-image": "^2.0.0-beta.15",
......
...@@ -12,6 +12,9 @@ ...@@ -12,6 +12,9 @@
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong> <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript> </noscript>
<div id="app"></div> <div id="app"></div>
<script>
console.log('v.0.1.2');
</script>
<!-- built files will be auto injected --> <!-- built files will be auto injected -->
</body> </body>
</html> </html>
import { column } from "@/types/column"
const columns:Array<column>=
[
// {
// title: '添加时间',
// align:'center',
// dataIndex: 'created_at',
// scopedSlots:{
// customRender :'created_at'
// }
// },
{
title: '姓名',
align:'center',
dataIndex: 'user_name',
},
{
title: '岗位角色',
align:'center',
dataIndex: 'role',
},
{
title: '手机号',
align:'center',
dataIndex: 'phone',
},
{
title: '用户所在机构层级',
align:'center',
dataIndex: 'level',
scopedSlots: { customRender: 'level' }
},
{
title: '开播时间',
align:'center',
dataIndex: 'liveTime',
scopedSlots: { customRender: 'liveTime' },
},
{
title: '操作',
align:'center',
dataIndex: 'action',
scopedSlots: { customRender: 'action' },
}
]
export {
columns
}
\ No newline at end of file
...@@ -123,6 +123,31 @@ export default { ...@@ -123,6 +123,31 @@ export default {
return '周一至周日' return '周一至周日'
} }
}, },
filterLiveTime(weekend_status: number){
if(weekend_status === 0){
return '';
}else if(weekend_status === 1){
return '周日'
} else if(weekend_status === 2){
return '周一'
} else if(weekend_status === 3){
return '周二'
} else if(weekend_status === 4){
return '周三'
} else if(weekend_status === 5){
return '周四'
} else if(weekend_status === 6){
return '周五'
} else if(weekend_status === 7){
return '周六'
} else if(weekend_status === 8){
return '工作日'
} else if(weekend_status === 9){
return '周末'
} else if(weekend_status === 10){
return '每天'
}
},
} as { } as {
[key: string]: (...args: any) => any [key: string]: (...args: any) => any
} }
...@@ -16,9 +16,37 @@ export default class AddressService { ...@@ -16,9 +16,37 @@ export default class AddressService {
this.max_len_gps = 10 this.max_len_gps = 10
} }
getGpses(data: { addrs: string[] }): Promise<string[]> { // getGpses(data: { addrs: string[] }): Promise<string[]> {
// return new Promise((resolve, reject) => {
// const resultList = [] as string[]
// if (data.addrs.length) {
// for (
// let i = 0;
// i < Math.ceil(data.addrs.length / this.max_len_gps);
// ++i
// ) {
// const reqList = data.addrs.slice(
// i * this.max_len_gps,
// i * this.max_len_gps + this.max_len_gps,
// )
// this.__getGpses(reqList).then((ret) => {
// if (ret.code === 200) {
// resultList.push(...ret.data.gps)
// if (resultList.length === data.addrs.length) {
// resolve(resultList)
// }
// } else {
// reject('解析错误')
// }
// })
// }
// }
// })
// }
getGpses2(data: { addrs: string[] }): Promise<{ [props: string]: string }> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const resultList = [] as string[] const theMap = {} as { [props: string]: string }
if (data.addrs.length) { if (data.addrs.length) {
for ( for (
let i = 0; let i = 0;
...@@ -31,9 +59,14 @@ export default class AddressService { ...@@ -31,9 +59,14 @@ export default class AddressService {
) )
this.__getGpses(reqList).then((ret) => { this.__getGpses(reqList).then((ret) => {
if (ret.code === 200) { if (ret.code === 200) {
resultList.push(...ret.data.gps) const locations = reqList
if (resultList.length === data.addrs.length) { const gpses = ret.data.gps
resolve(resultList)
locations.map((location, index) => {
theMap[location] = gpses[index]
})
if (Object.keys(theMap).length === data.addrs.length) {
resolve(theMap)
} }
} else { } else {
reject('解析错误') reject('解析错误')
...@@ -47,7 +80,7 @@ export default class AddressService { ...@@ -47,7 +80,7 @@ export default class AddressService {
if (addrs.length > 10) { if (addrs.length > 10) {
throw new Error('长度超过10') throw new Error('长度超过10')
} else { } else {
return baseAxios<{ gps: string[]}>({ return baseAxios<{ gps: string[] }>({
url: this.prefix + '/getGps', url: this.prefix + '/getGps',
method: 'post', method: 'post',
data: { data: {
...@@ -71,7 +104,7 @@ export default class AddressService { ...@@ -71,7 +104,7 @@ export default class AddressService {
// }) // })
// } // }
getOutlets(data: { level?: number; id?: number, branch_name?:string }) { getOutlets(data: { level?: number; id?: number; branch_name?: string }) {
return baseAxios<iOutLetDetail[]>({ return baseAxios<iOutLetDetail[]>({
url: '/address/getOutlets', url: '/address/getOutlets',
method: 'post', method: 'post',
...@@ -119,7 +152,7 @@ export default class AddressService { ...@@ -119,7 +152,7 @@ export default class AddressService {
url: '/address/add', url: '/address/add',
method: 'post', method: 'post',
data: { data: {
outlets_req: [data] outlets_req: [data],
}, },
}) })
} }
......
import baseAxios from '../index'
export default class LiveService {
static instance: LiveService
static getInstance() {
if (!LiveService.instance) {
LiveService.instance = new LiveService()
}
return LiveService.instance
}
/**
* 开启直播
* @returns
*/
startLive() {
return baseAxios<{data: any}>({
url: '/staff/enable_live',
method: 'get'
})
}
updateLive(data: {
day_type: number,
time_section: string,
uuid: string
}) {
return baseAxios<{data: any}>({
url: '/staff/live_broad',
method: 'put',
data
})
}
addLive() {
return baseAxios<{data: any}>({
url: '/staff/live_broad/add',
method: 'get'
})
}
liveList() {
return baseAxios<{data: any}>({
url: '/staff/live_broad/list',
method: 'get'
})
}
delLive(uuid: string) {
return baseAxios<{data: any}>({
url: '/staff/live_broad/' + uuid,
method: 'delete'
})
}
}
...@@ -19,7 +19,7 @@ baseAxios.interceptors.response.use( ...@@ -19,7 +19,7 @@ baseAxios.interceptors.response.use(
} }
else if (ret.code !== undefined && ret.code !== 200) { else if (ret.code !== undefined && ret.code !== 200) {
if ([504, 503].includes(ret.code)) { if ([504, 503, 1008].includes(ret.code)) {
const role = getUserMsg()?.newRole const role = getUserMsg()?.newRole
window.localStorage.clear() window.localStorage.clear()
RouterUtil.getInstance().gotoLogin(role) RouterUtil.getInstance().gotoLogin(role)
......
...@@ -33,14 +33,14 @@ function getAddressList(dataList: any[]) { ...@@ -33,14 +33,14 @@ function getAddressList(dataList: any[]) {
} }
async function getAddressLalonObj(locationList: string[]) { async function getAddressLalonObj(locationList: string[]) {
const rets = await AddressService.getInstance().getGpses({ const rets = await AddressService.getInstance().getGpses2({
addrs: locationList, addrs: locationList,
}) })
let obj = {} as any // let obj = {} as any
locationList.forEach((item, index) => { // locationList.forEach((item, index) => {
obj[item] = rets[index] // obj[item] = rets[index]
}) // })
return obj return rets
} }
function formatPositionToNumber(str: string) { function formatPositionToNumber(str: string) {
...@@ -181,9 +181,11 @@ export const handle建设银行excelFileChange = (e: Event) => { ...@@ -181,9 +181,11 @@ export const handle建设银行excelFileChange = (e: Event) => {
const list = (parseJSYHSheet( const list = (parseJSYHSheet(
Sheets[SheetsKeys[0]], Sheets[SheetsKeys[0]],
) as unknown) as any[] ) as unknown) as any[]
console.log(list, 'show list');
const locationList = getAddressList((list as unknown) as any) const locationList = getAddressList((list as unknown) as any)
console.log(JSON.stringify(locationList)) console.log(JSON.stringify(locationList))
getAddressLalonObj(locationList).then((addressLalonObj) => { getAddressLalonObj(locationList).then((addressLalonObj) => {
console.log(addressLalonObj,' show addressLalonObj');
list.forEach((data) => { list.forEach((data) => {
data.la_lon = addressLalonObj[data.location] data.la_lon = addressLalonObj[data.location]
}) })
......
interface options{
value: number;
label: string
}
export const options:Array<options> = [
{
value: 0,
label: '禁播'
},
{
value: 1,
label: '星期日'
},
{
value: 2,
label: '星期一'
},
{
value: 3,
label: '星期二'
},
{
value: 4,
label: '星期三'
},
{
value: 5,
label: '星期四'
},
{
value: 6,
label: '星期五'
},
{
value: 7,
label: '星期六'
},
{
value: 8,
label: '工作日'
},
{
value: 9,
label: '周末'
},
{
value: 10,
label: '每天'
},
]
// export enum
\ No newline at end of file
<template>
<a-form-model :model="form" :label-col="{span: 4}" :wrapper-col="{span: 18}" ref="ruleForm" :rules="rules">
<div v-if="type === 'add'" class="mb-3">
<a-input class="w-80 mr-12" placeholder="请输入请输入管理员或客户经理手机号" v-model="value"></a-input>
<a-button type="primary" @click="search">搜索</a-button>
</div>
<div v-if="(type === 'add' && Object.keys(msg).length > 0) || type === 'edit'">
<div class="flex justify-between items-center my-4">
<span class="">名称: {{ msg.user_name || '' }}</span>
<span>手机号: {{ msg.phone || '' }}</span>
</div>
<div class="flex items-center mb-2 mt-6">
<span class="mr-2 mb-5">开播时间时间段</span>
<a-form-model-item class="inline-block" label="" prop="day_type">
<a-select class="mr-2" v-model="form.day_type" default-value="lucy" style="width: 160px" placeholder="请选择时间段" :allowClear="true">
<a-select-option v-for="item in options" :key="item.value" :value="item.value">
{{ item.label }}
</a-select-option>
</a-select>
</a-form-model-item>
<a-form-model-item class="inline-block mr-2" label="" prop="start">
<a-time-picker class="w-36" format="HH:mm" valueFormat="HH:mm" v-model="form.start"/>
</a-form-model-item>
<span class="inline-block mb-5">-</span>
<a-form-model-item class="inline-block ml-2" label="" prop="end">
<a-time-picker class="w-36" format="HH:mm" valueFormat="HH:mm" v-model="form.end"/>
</a-form-model-item>
</div>
<a-form-model-item :wrapper-col="{ span: 14, offset: 4 }">
<a-button type="primary" @click="onSubmit">确定</a-button>
<a-button style="margin-left: 10px;" @click="onCancel">取消</a-button>
</a-form-model-item>
</div>
</a-form-model>
</template>
<script lang="ts">
import Vue from 'vue'
import { message, Select, TimePicker } from 'ant-design-vue'
import moment from 'moment'
import { options } from './const'
import StaffService from '@/service/StaffService'
import Live from '@/service/LiveService'
import { staff } from '@/types/staff';
const staff = new StaffService()
const live = new Live()
export default Vue.extend({
components: {
'a-select': Select,
'a-time-picker': TimePicker
},
props: {
show: {
type: Boolean,
default: false
},
type: {
type: String,
default: 'add'
},
info: {
type: Object
}
},
computed: {
options() {
return options
}
},
data() {
const checkStart = (rule: any, value: string, callback: any) => {
if (!value) {
return callback(new Error('请选择开始时间'));
}
const self = this as any
const end = self.getTime(self.form.end)
const start = self.getTime(value)
if (end < start) {
message.error('时间选择错误,结束时间不能小于开始时间')
callback(new Error('请选择正确时间'))
} else {
if (self.form.end) {
(self.$refs.ruleForm as any).validateField('end')
callback()
}
}
}
const checkEnd = (rule: any, value: string, callback: any) => {
if (!value) {
return callback(new Error('请选择结束时间'));
}
const self = this as any
const end = self.getTime(value)
const start = self.getTime(self.form.start)
if (end < start) {
message.error('时间选择错误,结束时间不能小于开始时间')
callback(new Error('请选择正确时间'))
} else {
if (self.form.start) {
(self.$refs.ruleForm as any).validateField('start')
callback()
}
}
}
const rules = {
start: [
{ trigger: 'change', required: true, validator: checkStart },
],
end: [
{ trigger: 'change', required: true, validator: checkEnd },
],
day_type: [
{ required: true, message: '请选择开播时段', trigger: 'change' },
],
}
return {
rules,
msg: {} as any,
form: {
start: undefined as undefined | number,
end: undefined as undefined | number,
day_type: undefined as undefined | number,
_start: undefined as undefined | number,
_end: undefined as undefined | number,
} as any,
title: '',
value: '',
uuid: '',
}
},
methods: {
moment,
init() {
this.msg = {}
this.form = {
start: undefined,
end: undefined,
day_type: undefined,
_start: undefined,
_end: undefined
}
this.value = ''
},
search() {
if (!this.value) return
staff.queryStaff({
phone: this.value
}).then(res => {
const list = res.data.item
if (list.length === 0) {
message.error('无此用户')
return
}
this.msg = res.data.item[0]
this.uuid = this.msg.uuid
})
},
changeHandle(v: string) {
if (new Date(this.form._end) < new Date(this.form._start)) {
message.error('请选择正确时间')
} else {
message.destroy()
}
},
onSubmit() {
(this.$refs.ruleForm as any).validate((valid: any) => {
if (valid) {
const params = {
day_type: this.form.day_type,
time_section: this.form.start + '-' + this.form.end,
uuid: this.uuid
}
// 新增检测用户数量
if (this.type === 'add') {
live.addLive().then(res => {
if (res.code === 200) {
this.$emit('updated', params)
} else {
message.error('当前数量已超过五个,添加失败,请删除后再次添加')
}
})
} else {
this.$emit('updated', params)
}
}
})
},
onCancel() {
this.$emit('updated', {})
},
getTime(v: string) {
return moment(moment(Date.now()).format('YYYY-MM-DD') + ' ' + v).format('HH:mm')
},
setValue() {
(this.$refs.ruleForm as any).resetFields()
if (Object.keys(this.info).length > 0) {
this.msg = this.info
this.uuid = this.msg.uuid
const start = this.msg.attr?.time_section.split('-')[0]
const end = this.msg.attr?.time_section.split('-')[1]
this.form = {
start: this.getTime(start),
end: this.getTime(end),
day_type: this.msg.attr?.day_type
}
}
}
},
mounted() {
this.setValue()
},
watch: {
show(n) {
if (n) {
this.setValue()
} else {
this.init()
}
}
}
})
</script>
\ No newline at end of file
<template>
<div>
<p class=" text-2xl font-bold mb-5">直播管理</p>
<a-button class="float-right mb-3" type="primary" @click="addLive">添加开播员</a-button>
<!-- 资讯列表 -->
<a-table
:columns="columns"
:data-source="list"
:loading="loading"
rowKey="columns"
style=" text-align: center; margin-top:40px;"
bordered>
<span slot="level" slot-scope="text,record">
{{ record.level | formatLevel }}
</span>
<span slot="liveTime" slot-scope="text,record">
{{ record.attr | formatLiveTime }}
</span>
<!-- 操作 -->
<span slot="action" slot-scope="text,record">
<a @click="editLive(record)">
编辑
</a>
<a-divider v-if="record.attr.day_type === 0" type="vertical" />
<a v-if="record.attr.day_type === 0"
@click="delLive(record)">
删除
</a>
</span>
</a-table>
<!-- 操作Modal -->
<a-modal
title="删除直播"
v-model="show"
:centered="true"
:closable="false"
@ok="handleOk"
@cancle="show = false"
>
<p class="text-center">确认删除该条直播信息?</p>
</a-modal>
<a-modal v-model="showModal" :title="title" :centered="true" width="60%" footer="">
<x-modal :type="type" :show="showModal" :info="info" @updated="submit" />
</a-modal>
</div>
</template>
<script lang="ts">
import Vue from 'vue'
import timerange from '@/components//TimePicker/index.vue'
import xModal from '@/views/Root/Live/components/index.vue'
import { columns } from '@/const/columns/liveBroadcast'
import Live from '@/service/LiveService/index'
import { message } from 'ant-design-vue'
import Filter from '@/filter/index'
const live = new Live()
export default Vue.extend({
components:{
timerange,
xModal
},
filters: {
format(value: string) {
return Filter.formatDate(value)
},
formatLevel(value: string) {
return Filter.filterLevel(value)
},
formatLiveTime(value: {day_type: number, time_section: string}|undefined) {
if (!value) return
if (value?.day_type === 0) {
return '00:00-00:00'
}
return Filter.filterLiveTime(value?.day_type) + ' ' + value?.time_section
}
},
computed: {
columns() {
return columns
}
},
props:{
},
data(){
return{
loading: false,
list: [] as any,
// pagination: {
// current: 1,
// defaultPageSize: 10,
// total: 0
// },
// modal
show: false,
uuid: '',
showModal: false,
title: '新增直播员',
type: 'add',
info: {} as any
}
},
created() {
this.getList()
},
methods:{
getList() {
this.loading = true
live.liveList().then((res: any) => {
this.list = res.data
this.loading = false
}).catch(() => {
this.loading = false
})
},
// tableChange(e: any) {
// this.pagination.current = e.current
// this.getList()
// },
addLive() {
this.showModal = true
this.title = '新增直播员'
this.type = 'add'
},
editLive(item: any) {
this.showModal = true
this.title = '编辑直播员'
this.type = 'edit'
this.info = item
},
submit(v: any) {
this.showModal = false
if (Object.keys(v).length === 0) {
return
}
console.log(v, 'v')
live.updateLive(v).then((res: any) => {
if (res.code === 200) {
if (this.type === 'add') {
message.success('新增成功')
} else {
message.success('更新成功')
}
this.getList()
}
})
},
delLive(record: {uuid: string}) {
this.show = true
this.uuid = record.uuid
},
handleOk() {
console.log('ok')
live.delLive(this.uuid).then(res => {
if (res.code === 200) {
message.success('删除成功')
this.getList()
}
})
this.show = false
}
},
watch: {
showModal(n) {
if (!n) {
this.info = {}
}
}
}
})
</script>
...@@ -93,6 +93,16 @@ export const menuList: iMenuConfigItem[] = [ ...@@ -93,6 +93,16 @@ export const menuList: iMenuConfigItem[] = [
], ],
}, },
{ {
getName: () => '直播管理',
onClick: (e: Event) => {},
routeName: 'LiveBroadcast',
path: '/backend/Live',
component: () => import('@/views/Root/Live/index.vue'),
roles: [
eRole.superManager,
],
},
{
getName: () => '网点管理', getName: () => '网点管理',
routeName: 'outletManagement', routeName: 'outletManagement',
path: '/backend/outletManagement', path: '/backend/outletManagement',
......
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