朱鑫波 před 3 roky
rodič
revize
fc2802ad35

+ 1 - 1
.env.development

@@ -10,7 +10,7 @@ VUE_APP_BASE_REPORT_URL = http://api.tjyourong.com.cn/reportModule
 # 杨字安 http://192.168.1.43:9999
 
 #脚本视频接口
-VUE_APP_BASE_SCRIPT_URL = http://139.186.134.115:31013
+VUE_APP_BASE_SCRIPT_URL = http://192.168.0.195:31013
 
 
 #素材大盘相关接口

+ 2 - 1
.env.production

@@ -7,9 +7,10 @@ VUE_APP_BASE_REPORT_URL = http://api.tjyourong.com.cn/reportModule
 # 线上地址 http://api.tjyourong.com.cn
 
 #脚本视频接口
-VUE_APP_BASE_SCRIPT_URL = http://114.117.193.186:31013
+VUE_APP_BASE_SCRIPT_URL = http://192.168.0.195:31013
 # 线上地址 http://114.117.193.186:31013
 # 测试地址 http://139.186.134.115:31013
+# 新测试地址 http://192.168.0.195:31013
 
 
 #素材大盘相关接口

+ 489 - 0
src/views/modules/script/components/keyWord.vue

@@ -0,0 +1,489 @@
+<style>
+.select-table .ant-table-thead > tr > th,
+.select-table .ant-table-tbody > tr > td {
+    padding: 0 !important;
+}
+.select-table .ant-table {
+    font-size: 12px;
+}
+.demo-infinite-container {
+    border: 1px solid #e8e8e8;
+    border-radius: 4px;
+    overflow: auto;
+    padding: 8px 24px;
+    height: 300px;
+}
+.demo-loading-container {
+    position: absolute;
+    bottom: 40px;
+    width: 100%;
+    text-align: center;
+}
+</style>
+<style lang="scss" scoped>
+.require-check {
+    ::v-deep .ant-form-item-label {
+        label::before {
+            display: inline-block;
+            margin-right: 4px;
+            color: #f5222d;
+            font-size: 14px;
+            font-family: SimSun, sans-serif;
+            line-height: 1;
+            content: '*';
+        }
+    }
+}
+</style>
+<template>
+    <div>
+        <a-form-item
+            label="关键字"
+            v-clickoutside="handleClose"
+            style="width: 100%"
+            class="select-table"
+            :class="{ 'require-check': requireCheck }"
+        >
+            <a-input
+                @focus="
+                    topMiddle = true
+                    getData()
+                "
+                v-model="keyValue"
+                @change="getData"
+                :disabled="disabled"
+                @keyup.enter.native="okWord"
+                addon-after="选中后按回车键添加"
+            />
+            <div
+                v-show="topMiddle"
+                style="
+                background: white;
+                padding: 10px;
+                box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.15);
+                position: absolute;
+                z-index: 1000;
+                width: 100%;
+            "
+                class="demo-infinite-container"
+            >
+                <!-- <a-list :data-source="data">
+                <a-list-item slot="renderItem" slot-scope="item" @click="showProject(item)">
+                    <a-list-item-meta>
+                        <a slot="title">{{ item.word }}</a>
+                    </a-list-item-meta>
+                </a-list-item>
+                <div v-if="loading && !busy" class="demo-loading-container">
+                    <a-spin />
+                </div>
+            </a-list> -->
+
+                <a-checkbox-group
+                    v-model="selectDescriptionArr"
+                    style="width:100%;margin-top:10px"
+                    v-on:keyup.enter.native="okWord"
+                >
+                    <a-list bordered :data-source="data" style="width:100%;max-height: 450px;overflow:auto">
+                        <a-list-item slot="renderItem" slot-scope="item, index">
+                            <a-checkbox :value="item.word">
+                                {{ item.word }}
+                            </a-checkbox>
+                        </a-list-item>
+                    </a-list>
+                </a-checkbox-group>
+            </div>
+        </a-form-item>
+        <a-table
+            :columns="columns"
+            :dataSource="dataSource"
+            :pagination="false"
+            bordered
+            size="middle"
+            style="word-break: break-all;font-size:16px;font-weight:600"
+            id="outTable"
+            ref="accountTable"
+        >
+            <span slot="query_word" slot-scope="text, record">
+                {{ text }}
+            </span>
+            <span slot="recommended_word" slot-scope="text, record">
+                {{ !!text[0] ? text.join() : '-' }}
+            </span>
+            <span slot="action" slot-scope="text, record">
+                <a @click.stop="deleteScript(record)">删除</a>
+            </span>
+        </a-table>
+    </div>
+</template>
+
+<script>
+import { getAction, postAction } from '@/api/manage'
+import moment from 'moment'
+import { mapGetters } from 'vuex'
+import jq from 'jquery'
+import infiniteScroll from 'vue-infinite-scroll'
+const clickoutside = {
+    // 初始化指令
+    bind(el, binding, vnode) {
+        function documentHandler(e) {
+            // 这里判断点击的元素是否是本身,是本身,则返回
+            if (el.contains(e.target)) {
+                return false
+            }
+            // 判断指令中是否绑定了函数
+            if (binding.expression) {
+                // 如果绑定了函数 则调用那个函数,此处binding.value就是handleClose方法
+                binding.value(e)
+            }
+        }
+        // 给当前元素绑定个私有变量,方便在unbind中可以解除事件监听
+        el.__vueClickOutside__ = documentHandler
+        document.addEventListener('click', documentHandler)
+    },
+    update() {},
+    unbind(el, binding) {
+        // 解除事件监听
+        document.removeEventListener('click', el.__vueClickOutside__)
+        delete el.__vueClickOutside__
+    }
+}
+let TTcolumns = [
+    {
+        title: '关键字',
+        dataIndex: 'query_word',
+        scopedSlots: { customRender: 'query_word' },
+        align: 'center',
+        key: 'query_word'
+    },
+    {
+        title: '推荐词',
+        dataIndex: 'recommended_word',
+        scopedSlots: { customRender: 'recommended_word' },
+        align: 'center',
+        key: 'recommended_word'
+    },
+    {
+        title: '操作',
+        dataIndex: 'action',
+        scopedSlots: { customRender: 'action' },
+        align: 'center',
+        key: 'action'
+    }
+]
+export default {
+    name: 'select-pagination',
+    components: {},
+    directives: { clickoutside, infiniteScroll },
+    props: {
+        projectId: {
+            type: [String, Number, Array],
+            default() {
+                return []
+            }
+        },
+        allScript: {
+            type: [String, Number, Array],
+            default() {
+                return []
+            }
+        },
+        type: {
+            type: String,
+            default() {
+                return ''
+            }
+        },
+        labelCol: {
+            type: Object,
+            default() {
+                return {
+                    xs: { span: 24 },
+                    sm: { span: 5 }
+                }
+            }
+        },
+        disabled: {
+            type: Boolean,
+            default() {
+                return false
+            }
+        },
+        requireCheck: {
+            type: Boolean,
+            default() {
+                return false
+            }
+        }
+    },
+
+    data() {
+        return {
+            loading: false,
+            busy: false,
+            wrapperCol: {
+                xs: { span: 24 },
+                sm: { span: 12 }
+            },
+            selectedRowKeys: [],
+            selectedRowKeysValue: [],
+            topMiddle: false,
+            keyValue: '',
+            data: [],
+            selectDescriptionArr: [],
+            dataElse: [],
+            ipagination: {
+                current: 0,
+                pageSize: 20
+            },
+            columns: TTcolumns,
+            dataSource: [],
+            rowClick: (record, index) => ({
+                // 事件
+                on: {
+                    click: () => {
+                        // var str =
+                        //   record.mediaId == '1'
+                        //     ? '头条'
+                        //     : record.mediaId == '2'
+                        //     ? '快手'
+                        //     : record.mediaId == '3'
+                        //     ? '头条内广'
+                        //     : '快手内广'
+                        this.keyValue = record.productName
+                        this.topMiddle = false
+                        this.data = this.dataElse
+                        // this.$emit('update:projectId', record.id)
+                    }
+                }
+            })
+        }
+    },
+    computed: {},
+    filters: {},
+    methods: {
+        deleteScript(item) {
+            var index = this.dataSource.findIndex(i=>i==item.query_word)
+            this.dataSource.splice(index,1)
+            var indexRemove = this.projectId.findIndex(i=>i==item.query_word)
+            this.projectId.splice(indexRemove,1)
+        },
+        showProject(record) {
+            var str =
+                record.mediaId == '1'
+                    ? '头条'
+                    : record.mediaId == '2'
+                    ? '快手'
+                    : record.mediaId == '3'
+                    ? '头条内广'
+                    : '快手内广'
+            this.keyValue = record.productName
+            this.topMiddle = false
+            this.$emit('update:projectId', record.id)
+        },
+        ...mapGetters(['nickname', 'avatar', 'userInfo']),
+        onSelectChange(selectedRowKeys, selectionRows) {
+            this.selectedRowKeys = selectedRowKeys
+            this.selectedRowKeysValue = selectionRows.map(item => {
+                return { orientationId: item.orientationId, orientationName: item.orientationName }
+            })
+        },
+        getData() {
+            if (this.keyValue == '') {
+                this.$emit('update:projectId', this.projectId)
+            }
+            if (!!this.keyValue) {
+                this.topMiddle = true
+                this.ipagination.current = 1
+                postAction(process.env.VUE_APP_BASE_SCRIPT_URL + '/related_words?word=' + this.keyValue).then(res => {
+                    if (res.code == 0) {
+                        this.data = res.result.map((item, index) => {
+                            return {
+                                productId: item,
+                                key: index,
+                                word: item
+                            }
+                        })
+                        // if (this.type === 'taobao') {
+                        //     this.data = defaultList.filter(item => item.productId === 1410280)
+                        // } else {
+                        //     this.data = defaultList
+                        // }
+                        // this.dataElse = res.result.records.map((item, index) => {
+                        //   return {
+                        //     ...item,
+                        //     projectId: item.projectId + '',
+                        //     key: index,
+                        //   }
+                        // })
+                    }
+                })
+            } else {
+                this.data = []
+                this.selectDescriptionArr = []
+            }
+        },
+        okWord() {
+
+            if (this.projectId.findIndex(item => item == this.keyValue) > -1) {
+            } else {
+                this.projectId.push(this.keyValue)
+            }
+
+            var index = this.dataSource.findIndex(item => item.query_word == this.keyValue)
+            if (index > -1) {
+                this.dataSource[index].recommended_word = this.selectDescriptionArr
+            } else {
+                this.dataSource.push({ query_word: this.keyValue, recommended_word: this.selectDescriptionArr })
+            }
+            this.keyValue = ''
+            this.selectDescriptionArr = []
+            
+            this.$nextTick(()=>{
+                setTimeout(()=>{
+                    this.$emit('update:allScript', this.dataSource)
+                },100)
+                
+            })
+            
+            this.handleClose()
+        },
+        handleClose() {
+            this.topMiddle = false
+            if (!!!this.projectId) {
+                this.keyValue = ''
+            }
+        },
+        // allData() {
+        //   getAction('/ctop/product/getUserProductList', {
+        //     userId: this.userInfo().id,
+        //     pageSize: this.ipagination.pageSize,
+        //     pageNo: this.ipagination.current,
+        //   }).then((res) => {
+        //     if (res.code == 0) {
+        //       this.data = res.result.records.map((item, index) => {
+        //         return {
+        //           ...item,
+        //           projectId: item.projectId + '',
+        //           key: index,
+        //         }
+        //       })
+        //       this.dataElse = res.result.records.map((item, index) => {
+        //         return {
+        //           ...item,
+        //           projectId: item.projectId + '',
+        //           key: index,
+        //         }
+        //       })
+        //     }
+        //   })
+        // },
+        handleInfiniteOnLoad() {
+            const data = this.data
+            this.loading = true
+            this.ipagination.current++
+            // this.fetchData((res) => {
+            //   this.data = data.concat(res.results)
+            //   this.loading = false
+            // })
+            // getAction('/ctop/product/getUserProductList', {
+            //     userId: this.userInfo().id,
+            //     pageSize: this.ipagination.pageSize,
+            //     pageNo: this.ipagination.current,
+            //     productName: this.keyValue
+            // }).then(res => {
+            //     if (res.code == 0) {
+            //         this.busy = true
+            //         let defaultList = res.result.records.map((item, index) => {
+            //             return {
+            //                 ...item,
+            //                 projectId: item.projectId + ''
+            //             }
+            //         })
+            //         this.data = data.concat()
+            //         if (this.type === 'taobao') {
+            //             this.data = defaultList.filter(item => item.productId === 1410280)
+            //         } else {
+            //             this.data = data.concat(defaultList)
+            //         }
+            //         // this.data = res.result.records.map((item, index) => {
+            //         //   return {
+            //         //     ...item,
+            //         //     projectId: item.projectId + '',
+            //         //     key: index,
+            //         //   }
+            //         // })
+            //         // this.dataElse = res.result.records.map((item, index) => {
+            //         //   return {
+            //         //     ...item,
+            //         //     projectId: item.projectId + '',
+            //         //     key: index,
+            //         //   }
+            //         // })
+            //     }
+            // })
+        }
+    },
+    watch: {
+        projectId(n, o) {
+            if (n == '') {
+                this.keyValue = ''
+            } else {
+            }
+        }
+    },
+    mounted() {}
+}
+</script>
+
+<style type="text/css">
+.plug-timer-grid {
+    width: 100%;
+}
+
+.plug-timer-grid td,
+.plug-timer-grid th {
+    border: 1px solid #97b4d1;
+    text-align: center; /*cursor:pointer;*/
+    font-size: 10px;
+    line-height: 10px;
+}
+
+.Selected {
+    background-color: rgb(102, 162, 243);
+    opacity: 0.5;
+}
+
+.plug-timer-grid {
+    border-collapse: collapse;
+    z-index: 4;
+}
+
+.plug-timer-grid thead tr {
+    display: table-row;
+    vertical-align: inherit;
+    border-color: inherit;
+}
+
+.group-creat table td {
+    height: 20px;
+    max-width: 5px;
+    font-size: 12px;
+    text-align: center;
+    vertical-align: middle;
+    overflow: hidden;
+    transition: background 0.5s;
+    -webkit-transition: background 0.5s;
+}
+
+.plug-timer-grid tbody th {
+    width: 4%;
+}
+
+.plug-timer-grid tbody tr td {
+    width: 2%;
+}
+
+/*.clear{*/
+/*  margin:20px 0px 20px 0px;*/
+/*}*/
+</style>

+ 54 - 21
src/views/modules/script/index.vue

@@ -350,12 +350,18 @@
                         :customRow="rowClick"
                         :rowSelection="tabKey == 1 ? null : { selectedRowKeys, onChange: onSelectChange }"
                     >
-                        <span slot="query_word_lst" slot-scope="text, record">
-                            {{ text.join() }}
+                        <span slot="query_word" slot-scope="text, record">
+                            {{ Array.isArray(text) ? text.join() : text }}
+                        </span>
+                        <span slot="recommended_word" slot-scope="text, record">
+                            {{ !!text[0] ? text.join() : '-' }}
                         </span>
                         <span slot="script_num" slot-scope="text, record">
                             {{ text ? text : '-' }}
                         </span>
+                        <span slot="action" slot-scope="text, record">
+                            <a @click.stop="deleteScript(record)">删除</a>
+                        </span>
                     </a-table>
                     <a-pagination
                         size="small"
@@ -381,19 +387,8 @@
             @cancel="handleCancelAll"
             @ok="handleBudgetSure"
         >
-            <a-form-item label="关键字">
-                <a-select
-                    v-model="scriptLabel"
-                    :token-separators="[',', ' ', ',']"
-                    mode="tags"
-                    style="width: 320px"
-                    placeholder="按回车生成关键字"
-                    dropdownClassName="display-none-selset"
-                    @change="handleEnterChang"
-                >
-                </a-select>
-            </a-form-item>
-            <div class="adver-position-radio">
+            <keyWord :projectId.sync="scriptLabel" :allScript.sync="creativeTag" ref="selectTable" />
+            <!-- <div class="adver-position-radio">
                 <div class="creative-label-content">
                     <p>已选:{{ creativeTag.length || 0 }}</p>
                     <div class="label-content-select-tag">
@@ -408,7 +403,7 @@
                         </a-tag>
                     </div>
                 </div>
-            </div>
+            </div> -->
         </a-modal>
     </div>
 </template>
@@ -425,6 +420,7 @@ import selectCheckAll from '@/views/modules/kuaishouapp/account/stepForm/stepMod
 import qs from 'qs'
 import { mapGetters } from 'vuex'
 import selectTreeAccount from '@/components/formComponents/selectAccount.vue'
+import keyWord from './components/keyWord.vue'
 function tqFun(qcArr1) {
     var tempArr = []
     function bbFun(qcArr) {
@@ -442,13 +438,20 @@ function tqFun(qcArr1) {
 let TTcolumns = [
     {
         title: '关键字',
-        dataIndex: 'query_word_lst',
-        scopedSlots: { customRender: 'query_word_lst' },
+        dataIndex: 'query_word',
+        scopedSlots: { customRender: 'query_word' },
         align: 'center',
-        key: 'query_word_lst',
+        key: 'query_word',
         width: 600
     },
     {
+        title: '推荐词',
+        dataIndex: 'recommended_word',
+        scopedSlots: { customRender: 'recommended_word' },
+        align: 'center',
+        key: 'recommended_word'
+    },
+    {
         title: '创建时间',
         dataIndex: 'create_time',
         scopedSlots: { customRender: 'create_time' },
@@ -461,6 +464,13 @@ let TTcolumns = [
         scopedSlots: { customRender: 'operator' },
         align: 'center',
         key: 'operator'
+    },
+    {
+        title: '操作',
+        dataIndex: 'action',
+        scopedSlots: { customRender: 'action' },
+        align: 'center',
+        key: 'action'
     }
 ]
 
@@ -508,7 +518,8 @@ export default {
         ARow,
         checkBoxGroup,
         selectCheckAll,
-        selectTreeAccount
+        selectTreeAccount,
+        keyWord
     },
 
     data() {
@@ -640,6 +651,28 @@ export default {
     methods: {
         moment,
         ...mapGetters(['userInfo']),
+        deleteScript(item) {
+            let that = this
+            this.$confirm({
+                title: '确定要删除此条脚本?',
+                content: '',
+                onOk() {
+                    var params = {}
+                    params.id = item.id
+                    params.user_id = item.user_id
+                    params.operator = item.operator
+                    that.postDataAction(process.env.VUE_APP_BASE_SCRIPT_URL + '/delete_script_config', params).then(
+                        res => {
+                            if (res.success) {
+                                const paramsData = that.form.getFieldsValue()
+                                that.handleGetTableList(paramsData)
+                            }
+                        }
+                    )
+                },
+                onCancel() {}
+            })
+        },
         handleOkDownLoad() {
             if (this.selectionRows.length > 0) {
                 this.downLoading = true
@@ -707,7 +740,7 @@ export default {
                 this.$message.error('请输入关键字')
             } else {
                 var params = {}
-                params.query_word_lst = this.creativeTag
+                params.query_word_pair = this.creativeTag
                 params.operator = this.userInfo().realname
                 params.user_id = this.userInfo().id
                 this.postDataAction(process.env.VUE_APP_BASE_SCRIPT_URL + '/add_script_config', params).then(res => {