浏览代码

添加供应商链接获取功能

yuwenjun1997 2 年之前
父节点
当前提交
8ad5daa4f4

+ 2 - 2
.env.development

@@ -25,8 +25,8 @@ VUE_APP_SOCKET_SERVER = 'wss://zplma-b.caimei365.com/websocket?sessionSource=zpl
 VUE_APP_LOCAL = 'https://zplm-b.caimei365.com'
 
 # 认证通页面
-VUE_APP_WWW_HOST = 'https://192.168.2.92:8888'
-# VUE_APP_WWW_HOST = 'https://zp-b.caimei365.com'
+# VUE_APP_WWW_HOST = 'https://192.168.2.92:8888'
+VUE_APP_WWW_HOST = 'https://zp-b.caimei365.com'
 
 # 支付
 # VUE_APP_PAY_LOCAL = 'http://192.168.2.67:18014'

+ 9 - 0
src/api/activity.js

@@ -97,3 +97,12 @@ export function getShareVideo(params) {
     params
   })
 }
+
+// 解绑已关联抖音
+export function clearDouyinTokenRedis(params) {
+  return request({
+    url: '/auth/clean/douyin/redis',
+    method: 'get',
+    params
+  })
+}

+ 2 - 2
src/views/admin/supplier/edit.vue

@@ -4,10 +4,10 @@
       <el-form-item label="供应商名称:" prop="shopName">
         <el-input v-model="formData.shopName" placeholder="请输入供应商名称" maxlength="50" show-word-limit />
       </el-form-item>
-      <el-form-item label="子账号标识:" prop="prefix">
+      <el-form-item label="子账号前缀:" prop="prefix">
         <el-input
           v-model="formData.prefix"
-          placeholder="供应商唯一标识符(不可更改)"
+          placeholder="用于避免供应商子账号重复"
           maxlength="10"
           show-word-limit
           :disabled="prefixDisabled"

+ 9 - 1
src/views/admin/supplier/index.vue

@@ -89,8 +89,9 @@
       </el-table-column>
       <el-table-column label="创建人" width="120px" align="center" prop="createBy" />
       <!-- <el-table-column label="创建人" class-name="status-col" width="100px" prop="createBy" /> -->
-      <el-table-column label="操作" align="center" width="280" class-name="small-padding fixed-width">
+      <el-table-column label="操作" align="center" width="360" class-name="small-padding fixed-width">
         <template slot-scope="{ row }">
+          <el-button size="mini" type="primary" @click="onGetLink(row, $event)"> 首页链接 </el-button>
           <el-button size="mini" type="primary" @click="navigationTo(`supplier-edit?id=${row.authUserId}&type=edit`)">
             编辑
           </el-button>
@@ -116,6 +117,7 @@
 <script>
 import { fetchSupplierList, supplierStatusChange } from '@/api/supplier'
 import { generateProxyToken, resetPassword } from '@/api/user'
+import handleClipboard from '@/utils/clipboard'
 
 export default {
   name: 'ComplexTable',
@@ -236,6 +238,12 @@ export default {
     },
     indexMethod(index) {
       return index + this.listQuery.pageSize * (this.listQuery.pageNum - 1) + 1
+    },
+
+    // 获取供应商链接
+    onGetLink(row, $event) {
+      const link = process.env.VUE_APP_WWW_HOST + '/' + row.authUserId + '/' + (row.prefix || 'app')
+      handleClipboard(link, '已复制到剪切板', $event)
     }
   }
 }

+ 45 - 2
src/views/normal/activity/video/index.vue

@@ -39,9 +39,22 @@
         <span>登录账号:</span>
         <el-input v-model="listQuery.userName" placeholder="登录账号" @keyup.enter.native="getList" />
       </div>
+      <div class="filter-control">
+        <span>上传时间:</span>
+        <el-date-picker
+          v-model="filterTime"
+          format="yyyy-MM-dd HH:mm:ss"
+          value-format="yyyy-MM-dd HH:mm:ss"
+          type="datetimerange"
+          range-separator="至"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+        />
+      </div>
       <div class="filter-control">
         <el-button type="primary" @click="getList">查询</el-button>
         <el-button type="primary" :disabled="selectionList.length === 0" @click="onDownload('select')">下载</el-button>
+        <el-button v-if="tokenFlag" type="primary" @click="onUnBindDouyin">解绑已关联抖音号</el-button>
       </div>
     </div>
     <!-- 列表 -->
@@ -135,6 +148,7 @@
 <script>
 import {
   checkDouyinAccessToken,
+  clearDouyinTokenRedis,
   fetchClubList,
   fetchDouyinActivityStatus,
   fetchDouyinVideoList,
@@ -156,11 +170,14 @@ export default {
       // 视频播放
       videoDialog: false,
       videoUrl: '',
+      filterTime: [],
       listQuery: {
         status: '',
         authId: '',
         userName: '',
         authParty: '',
+        startTime: '',
+        endTime: '',
         pageNum: 1,
         pageSize: 10
       },
@@ -183,7 +200,8 @@ export default {
         content: [{ required: true, message: '口令不能为空', trigger: ['blur'] }]
       },
       clubList: [],
-      selectionList: []
+      selectionList: [],
+      tokenFlag: false
     }
   },
   computed: {
@@ -193,6 +211,7 @@ export default {
     this.getList()
     this.getClubList()
     this.fetchActivityStatus()
+    this.fetchAccessTokenFlag()
   },
   methods: {
     // 获取活动状态
@@ -286,6 +305,10 @@ export default {
     getList() {
       this.list = []
       this.listQuery.pageNum = 1
+      if (this.filterTime.length > 0) {
+        this.listQuery.startTime = this.filterTime[0]
+        this.listQuery.endTime = this.filterTime[1]
+      }
       this.fetchDouyinVideoList()
     },
 
@@ -360,7 +383,7 @@ export default {
         const url = generateQueryUrl('https://open.douyin.com/platform/oauth/connect', {
           client_key: 'awwwvh9tsnvo54w1',
           response_type: 'code',
-          scope: 'video.data,video.list,trial.whitelist,data.external.item,h5.share',
+          scope: 'video.data,video.list,data.external.item,h5.share', // trial.whitelist,
           redirect_uri: process.env.VUE_APP_LOCAL + '#/douyin',
           state: '/challenge/video'
         })
@@ -499,6 +522,26 @@ export default {
       } catch (error) {
         console.log(error)
       }
+    },
+
+    // 解绑已关联抖音
+    async onUnBindDouyin() {
+      try {
+        await clearDouyinTokenRedis()
+        this.fetchAccessTokenFlag()
+        this.$message.success('解绑成功')
+      } catch (error) {
+        console.log(error)
+      }
+    },
+
+    async fetchAccessTokenFlag() {
+      try {
+        const { data: tokenFlag } = await checkDouyinAccessToken()
+        this.tokenFlag = tokenFlag
+      } catch (error) {
+        console.log(error)
+      }
     }
   }
 }