Browse Source

feat: 企微工具 - 剧集管理 - "列表"前端页面

zhengxy 2 years ago
parent
commit
98ac347e91

+ 21 - 0
project/src/components/assembly/screen/channel.vue

@@ -174,12 +174,33 @@ export default {
174 174
     } else if (this.type == 'adqAccount') { // adq 账号选项
175 175
       this.getAdqAccountList()
176 176
       this.placeholderVal = 'ADQ账号'
177
+    } else if (this.type == 'platform') { // 平台选项
178
+      this.getPlatformList()
179
+      this.placeholderVal = '请选择平台'
177 180
     } else {
178 181
       this.init()
179 182
     }
180 183
 
181 184
   },
182 185
   methods: {
186
+    getPlatformList() { // 平台选项
187
+      this.$axios.get(this.URL.BASEURL + this.URL.adqAccount_list, {
188
+        params: {
189
+          is_select: 1
190
+        }
191
+      }).then((res) => {
192
+        var res = res.data
193
+        if (res && res.errno == 0) {
194
+          this.options = res.rst
195
+          this.options.forEach((item) => {
196
+            item.val = item.account_id
197
+            item.key = item.account_id
198
+          });
199
+        } else if (res.errno != 4002) {
200
+        }
201
+      }).catch((err) => {
202
+      });
203
+    },
183 204
     getAdqAccountList() { // ADQ账号选项
184 205
       this.$axios.get(this.URL.BASEURL + this.URL.adqAccount_list, {
185 206
         params: {

+ 199 - 0
project/src/components/manage/playletManage/dialog/playletSendDialog.vue

@@ -0,0 +1,199 @@
1
+<template>
2
+  <el-dialog
3
+    :visible.sync="dialogVisible"
4
+    :before-close="handleCancel"
5
+    class="addMiniPro-dialog"
6
+    :title="dialogTitle"
7
+    width="450px"
8
+  >
9
+    <div class="form-wrap" v-loading="loading">
10
+      <div class="form-item">
11
+        <span class="lable"><em>*</em>小程序名称</span>
12
+        <el-input v-model="form.miniProName" size="small" placeholder="请输入小程序名称" clearable />
13
+      </div>
14
+      <div class="form-item">
15
+        <span class="lable"><em>*</em>APPID</span>
16
+        <el-input v-model="form.miniProAppid" size="small" placeholder="请输入APPID" clearable />
17
+      </div>
18
+      <div class="form-item">
19
+        <span class="lable"><em>*</em>所属平台</span>
20
+        <el-select v-model="form.platform" size="small" placeholder="请选择所属平台" clearable filterable>
21
+          <el-option v-for="item in platformOptions" :key="item.account_id" :label="item.account_id" :value="item.account_id" />
22
+        </el-select>
23
+      </div>
24
+      <div class="form-item">
25
+        <span class="lable"><em>*</em>是否启用</span>
26
+        <el-switch v-model="form.accountEnable" active-color="#43B083" :active-value="1"  inactive-color="#ccc" :inactive-value="0" />
27
+      </div>
28
+    </div>
29
+    <div slot="footer" class="dialog-footer">
30
+      <el-button size="mini" @click="handleCancel">取 消</el-button>
31
+      <el-button size="mini" type="primary" @click="handleConfirm" :disabled="loading">确 定</el-button>
32
+    </div>
33
+  </el-dialog>
34
+</template>
35
+
36
+<script>
37
+export default {
38
+  name: "addMiniProDialog",
39
+  props: {
40
+    // 控制弹框是否显示
41
+    dialogVisible: {
42
+      type: Boolean,
43
+      default: () => false
44
+    },
45
+    // 小程序信息
46
+    miniProInfo: {
47
+      type: Object,
48
+      default: () => ({})
49
+    },
50
+  },
51
+  data() {
52
+    return {
53
+      loading: false,
54
+      platformOptions: [], // 平台选项
55
+      form: {
56
+        miniProName: '', // 小程序名称
57
+        miniProAppid: '', // APPID
58
+        platform: '', // 所属平台
59
+        accountEnable: 1, // 是否启用
60
+      }
61
+    }
62
+  },
63
+  computed: {
64
+    // 当前操作是否为"编辑"
65
+    isEdit() {
66
+      return this.miniProInfo && this.miniProInfo.id
67
+    },
68
+    // 弹框标题
69
+    dialogTitle() {
70
+      return this.isEdit ? '编辑小程序' : '添加小程序'
71
+    }
72
+  },
73
+  watch: {
74
+    dialogVisible(isShow) {
75
+      // 弹框显示 => 初始化表单数据
76
+      if (isShow) {
77
+        this.handleGetPlatformOptions()
78
+        this.handleInitData()
79
+      }
80
+    },
81
+  },
82
+  methods: {
83
+    // 获取平台选项列表
84
+    async handleGetPlatformOptions() {
85
+      const { data: res = {} } = await this.$axios.get(this.URL.BASEURL + this.URL.adqAccount_list, {
86
+        params: {
87
+          is_select: 1
88
+        }
89
+      })
90
+      if (res && res.errno == 0) {
91
+        this.platformOptions = res.rst
92
+      } else if (res.errno != 4002) {
93
+        this.$message.warning(res.err)
94
+      }
95
+    },
96
+    // 获取弹框表单数据
97
+    handleInitData() {
98
+      this.loading = false
99
+      if (this.isEdit) { // 编辑
100
+        const { miniProName, miniProAppid, platform, accountEnable } = this.miniProInfo
101
+        this.form.miniProName = miniProName
102
+        this.form.miniProAppid = miniProAppid
103
+        this.form.platform = platform
104
+        this.form.accountEnable = accountEnable
105
+      } else { // 新建
106
+        this.form.miniProName = ''
107
+        this.form.miniProAppid = ''
108
+        this.form.platform = ''
109
+        this.form.accountEnable = 1
110
+      }
111
+    },
112
+    async handleConfirm() {
113
+      console.log('handleConfirm => ')
114
+      try {
115
+        // 表单校验
116
+        await this.handleFormValidate()
117
+        let url = `${this.URL.BASEURL}${this.URL.xxx}`
118
+        const params = { ...this.form }
119
+
120
+        if (this.isEdit) { // 编辑操作
121
+          url = `${this.URL.BASEURL}${this.URL.xxx}`
122
+          params.id = this.miniProInfo.id
123
+        }
124
+
125
+        console.log('url => ', url)
126
+        console.log('params => ', params)
127
+        this.$emit('confirm', { isEdit: this.isEdit }) // mock
128
+        return // mock
129
+
130
+        this.loading = true
131
+        const { data: res = {} } = await this.$axios.post(url, params)
132
+        if (res && res.errno == 0) {
133
+          this.$message.success('操作成功')
134
+          this.$emit('confirm', { isEdit: this.isEdit })
135
+        } else if (res.errno != 4002) {
136
+          this.$message.warning(res.err || '操作失败')
137
+        }
138
+      } catch (error) {
139
+        console.log('error => ', error)
140
+      } finally {
141
+        this.loading = false
142
+      }
143
+    },
144
+    handleCancel() {
145
+      this.$emit('cancel')
146
+    },
147
+    // 执行表单校验
148
+    handleFormValidate() {
149
+      return new Promise((resolve, reject) => {
150
+        const { miniProName, miniProAppid, platform } = this.form
151
+        if (!miniProName) {
152
+          this.$message.warning('请输入小程序名称')
153
+          reject('表单校验未通过')
154
+        } else if (!miniProAppid) {
155
+          this.$message.warning('请输入APPID')
156
+          reject('表单校验未通过')
157
+        } else if (!platform) {
158
+          this.$message.warning('请选择平台')
159
+          reject('表单校验未通过')
160
+        } else {
161
+          resolve('表单校验通过')
162
+        }
163
+      })
164
+    },
165
+  },
166
+};
167
+</script>
168
+
169
+<style lang="scss" scoped>
170
+.addMiniPro-dialog {
171
+  .form-wrap {
172
+    padding: 0 10px;
173
+    .form-item {
174
+      display: flex;
175
+      align-items: center;
176
+      margin-top: 16px;
177
+      &:first-child {
178
+        margin-top: 0;
179
+      }
180
+      .lable {
181
+        width: 82px;
182
+        margin-right: 16px;
183
+        font-weight: 500;
184
+        flex-shrink: 0;
185
+        text-align: right;
186
+        em {
187
+          color: red;
188
+        }
189
+      }
190
+      .el-select {
191
+        width: 100%;
192
+      }
193
+    }
194
+  }
195
+  .dialog-footer {
196
+    text-align: center;
197
+  }
198
+}
199
+</style>

+ 182 - 0
project/src/components/manage/playletManage/playletManage.vue

@@ -0,0 +1,182 @@
1
+<template>
2
+  <div v-loading="loading" class="playletManage-wrap">
3
+    <div class="screenBox flex">
4
+      <div class="flex">
5
+        <selfChannel title="平台" type="platform" labelWidth @channelDefine="onChangePlatform" />
6
+        <selfInput label_name="搜索剧集" @inputChange="onInputKeyword" />
7
+      </div>
8
+      <div class="right">
9
+        <!-- 占位 -->
10
+      </div>
11
+    </div>
12
+    <el-table :height="height" :data="playletList" tooltip-effect="dark" style="width: 100%;margin-top:10px">
13
+      <el-table-column label="剧名" prop="name" min-width="160" align="center" fixed="left">
14
+        <template slot-scope="{ row }">
15
+          <span class="playlet-name">{{ row.name }}</span>
16
+        </template>
17
+      </el-table-column>
18
+      <el-table-column label="封面" prop="name" min-width="160" align="center">
19
+        <template slot-scope="{ row }">
20
+          <el-image style="width: 60px;" src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg" :preview-src-list="['https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg']" />
21
+        </template>
22
+      </el-table-column>
23
+      <el-table-column label="平台" prop="name" min-width="160" align="center" />
24
+      <el-table-column label="账号" prop="name" min-width="160" align="center" />
25
+      <el-table-column label="分类" prop="name" min-width="160" align="center" />
26
+      <el-table-column label="集数" prop="name" min-width="160" align="center" />
27
+      <el-table-column label="发布时间" prop="created_at" min-width="160" align="center" />
28
+      <el-table-column label="状态" min-width="160" align="center">
29
+        <template slot-scope="{ row }">
30
+          <span v-if="row.enable == 1" class="status">已完结</span>
31
+          <span v-else class="status">连载中</span>
32
+        </template>
33
+      </el-table-column>
34
+      <el-table-column label="操作" min-width="100" align="center" fixed="right">
35
+        <template slot-scope="{ row }">
36
+          <span class="btn" @click="onClickCreateGroupSend(row)">创建群发</span>
37
+        </template>
38
+      </el-table-column>
39
+    </el-table>
40
+    <div class="pagination" v-show="pagination.total > 0">
41
+      <el-pagination background :current-page="pagination.page" @current-change="handleCurrentChange" layout="prev, pager, next" :page-count="Number(pagination.pages)">
42
+      </el-pagination>
43
+    </div>
44
+
45
+    <!-- S 创建群发 -->
46
+    <playletSendDialog
47
+      :dialogVisible="playletSendDialogVisible"
48
+      :playletInfo="currentPlayletInfo"
49
+      @confirm="handlePlayletSendConfirm"
50
+      @cancel="handlePlayletSendCancel"
51
+    />
52
+    <!-- E 创建群发 -->
53
+  </div>
54
+</template>
55
+<script>
56
+import selfChannel from '@/components/assembly/screen/channel.vue'
57
+import selfInput from '@/components/assembly/screen/input.vue'
58
+import playletSendDialog from './dialog/playletSendDialog.vue'
59
+export default {
60
+  name: 'playletManage',
61
+  components: {
62
+    selfChannel,
63
+    selfInput,
64
+    playletSendDialog,
65
+  },
66
+  data () {
67
+    return {
68
+      height: '',
69
+      loading: false,
70
+      pagination: {
71
+        page: 1,
72
+        page_size: 20,
73
+        pages: 0,
74
+        total: 0,
75
+      },
76
+      filter: {
77
+        platform: '',
78
+        keyword: '',
79
+      },
80
+      playletList: [],
81
+
82
+      playletSendDialogVisible: false, // 控制"添加账号"弹框显示
83
+      currentPlayletInfo: {}, // 当前编辑的账号信息
84
+    }
85
+  },
86
+  created () {
87
+    this.height = document.documentElement.clientHeight - 200 > 400 ? document.documentElement.clientHeight - 200 : 400
88
+    this.handleGetPlaylet()
89
+  },
90
+  methods: {
91
+    // 获取列表数据
92
+    async handleGetPlaylet() {
93
+      try {
94
+        this.loading = true
95
+        const url = `${this.URL.BASEURL}${this.URL.pitcher_dramaList}`
96
+        const params = {
97
+          is_select: 0,
98
+          platform: this.filter.platform,
99
+          keyword: this.filter.keyword,
100
+          page: this.pagination.page,
101
+          page_size: this.pagination.page_size,
102
+        }
103
+        const { data: res = {} } = await this.$axios.get(url, { params })
104
+        if (res && res.errno == 0 && Array.isArray(res.rst.data)) {
105
+          this.playletList = res.rst.data;
106
+          this.pagination.total = res.rst.pageInfo.total;
107
+          this.pagination.pages = res.rst.pageInfo.pages;
108
+        } else if (res.errno != 4002) {
109
+          this.$message.warning(res.err)
110
+          this.playletList = [];
111
+          this.pagination.total = 0;
112
+          this.pagination.pages = 0;
113
+        }
114
+      } catch (error) {
115
+        console.log(error)
116
+        this.playletList = [];
117
+        this.pagination.total = 0;
118
+        this.pagination.pages = 0;
119
+      } finally {
120
+        this.loading = false
121
+      }
122
+    },
123
+    // 监听当前页数变化
124
+    handleCurrentChange(currentPage) {
125
+      this.pagination.page = currentPage
126
+      this.handleGetPlaylet()
127
+    },
128
+    // 监听"平台"筛选变化
129
+    onChangePlatform(val) {
130
+      this.filter.platform = val || ''
131
+      this.pagination.page = 1
132
+      this.handleGetPlaylet()
133
+    },
134
+    // 监听"搜索小程序"变化
135
+    onInputKeyword(val) {
136
+      this.filter.keyword = val || ''
137
+      this.pagination.page = 1
138
+      this.handleGetPlaylet()
139
+    },
140
+
141
+    // S 创建群发
142
+    // 监听点击"创建群发"
143
+    onClickCreateGroupSend(playletInfo) {
144
+      this.currentPlayletInfo = playletInfo
145
+      this.playletSendDialogVisible = true
146
+    },
147
+    // 创建群发 => 确定
148
+    handlePlayletSendConfirm() {
149
+      console.log('handlePlayletSendConfirm => ')
150
+      this.playletSendDialogVisible = false
151
+      this.handleGetPlaylet()
152
+    },
153
+    // 创建群发 => 取消
154
+    handlePlayletSendCancel() {
155
+      this.playletSendDialogVisible = false
156
+    },
157
+    // E 创建群发
158
+  }
159
+}
160
+</script>
161
+<style lang="scss" scoped>
162
+.screenBox {
163
+  background: #fff;
164
+  padding: 5px 20px;
165
+}
166
+.playletManage-wrap {
167
+  .playlet-name {
168
+    color: #32B38A;
169
+    // cursor: pointer;
170
+  }
171
+  .status {
172
+    margin: 2px auto;
173
+    padding: 0 6px;
174
+    color: #32B38A;
175
+    border: 1px solid #32B38A;
176
+  }
177
+  .btn {
178
+    color: #32B38A;
179
+    cursor: pointer;
180
+  }
181
+}
182
+</style>

+ 12 - 0
project/src/router/allRouter.js

@@ -66,6 +66,8 @@ const loseUserTrends = () => import(/* webpackChunkName: 'loseUserTrends' */ '@/
66 66
 const accountManage = () => import(/* webpackChunkName: 'accountManage' */ '@/components/manage/accountManage/accountManage.vue')
67 67
 // 小程序管理
68 68
 const miniProManage = () => import(/* webpackChunkName: 'miniProManage' */ '@/components/manage/miniProManage/miniProManage.vue')
69
+// 企微助手 - 剧集管理
70
+const playletManage = () => import(/* webpackChunkName: 'playletManage' */ '@/components/manage/playletManage/playletManage.vue')
69 71
 
70 72
 // name与菜单配置的页面路由一致
71 73
 // meta下isData:true为数据看板,否则为助手
@@ -338,6 +340,16 @@ export var allRouter = [
338 340
         }
339 341
       },
340 342
       {
343
+        path: 'playletManage',
344
+        name: 'playletManage',
345
+        component: playletManage,
346
+        meta: {
347
+          keepAlive: false,
348
+          isLogin: true,
349
+          title: '助手剧集管理'
350
+        }
351
+      },
352
+      {
341 353
         path: 'memberManage',
342 354
         name: 'memberManage',
343 355
         component: memberManage,