gpt.js 1.12 KB
/*
 * @Author: yangming yangming@didihu.com.cn
 * @Date: 2023-05-19 13:46:20
 * @LastEditors: yangming yangming@didihu.com.cn
 * @LastEditTime: 2023-05-30 16:21:24
 * @FilePath: \scrm-micro-home\src\mixins\gpt.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { mapState, mapActions } from 'vuex'
export default {
  data() {
    return {
      t1: 0, // 主标题下标
      t2: 0 // 副标题下标
    }
  },
  computed: {
    ...mapState('marketing', ['keywords', 'GPTList'])
  },
  watch: {
    GPTList: {
      handler() {
        this.t1 = 0
        this.t2 = 0
      },
      deep: true
    }
  },
  methods: {
    getGPTitle(type) {
      const len = this.GPTList.mainTitles.length
      console.log(len)
      if (type == 1) {
        this.editForm.marketingTitle = this.GPTList.mainTitles[this.t1 % len].title
        this.t1++
      }
      if (type == 2) {
        this.editForm.marketingSubtitle = this.GPTList.subTitles[this.t2 % len].title
        this.t2++
      }
    }
  },
  mounted() {}
}