Browse Source

添加曲目预览

lex-xin 3 năm trước cách đây
mục cha
commit
ea6c0acaef

+ 4 - 4
src/utils/validate.js

@@ -29,11 +29,11 @@ export function vaildStudentUrl() {
   if (/online/.test(url)) { //线上
     returnUrl = 'https://mstuonline.dayaedu.com'
   } else if (/dev/.test(url)) { // dev 环境
-    returnUrl = 'http://mstudev.dayaedu.com'
+    returnUrl = 'https://mstudev.dayaedu.com'
   } else if (/test/.test(url)) { // dev 环境
     returnUrl = 'http://mstutest.dayaedu.com'
   } else { // 默认dev环境
-    returnUrl = 'http://mstudev.dayaedu.com'
+    returnUrl = 'https://mstutest.dayaedu.com'
   }
   return returnUrl
 }
@@ -49,7 +49,7 @@ export function vaildTeacherUrl() {
   } else if (/test/.test(url)) { // dev 环境
     returnUrl = 'http://mteatest.dayaedu.com'
   } else { // 默认dev环境
-    returnUrl = 'http://mteadev.dayaedu.com'
+    returnUrl = 'https://mteatest.dayaedu.com'
   }
   return returnUrl
 }
@@ -65,7 +65,7 @@ export function vaildTeachingUrl() {
   } else if (/test/.test(url)) { // dev 环境
     returnUrl = 'http://mantest.dayaedu.com'
   } else { // 默认dev环境
-    returnUrl = 'http://mandev.dayaedu.com'
+    returnUrl = 'https://mantest.dayaedu.com'
   }
   return returnUrl
 }

+ 9 - 0
src/views/accompaniment/api.js

@@ -27,6 +27,15 @@ export const Update = data => {
   })
 }
 
+export const Show = data => {
+  return request({
+    url: '/api-web/sysMusicScore/show',
+    method: 'post',
+    data,
+    requestType: 'form'
+  })
+}
+
 export const queryPageSysExam = data => {
   return request({
     url: '/api-web/sysMusicScoreAccompaniment/queryPage',

+ 103 - 1
src/views/accompaniment/index.vue

@@ -51,6 +51,12 @@
             <el-option :value="1" label="收费"></el-option>
           </el-select>
         </el-form-item>
+        <el-form-item prop="showFlag">
+          <el-select v-model="searchForm.showFlag" clearable filterable placeholder="请选择伴奏状态">
+            <el-option :value="1" label="启用"></el-option>
+            <el-option :value="0" label="停用"></el-option>
+          </el-select>
+        </el-form-item>
         <el-button @click="submit" type="primary">搜索</el-button>
         <el-button @click="reset" type="danger">重置</el-button>
       </saveform>
@@ -112,6 +118,15 @@
         </el-table-column>
         <el-table-column
           align="center"
+          label="伴奏状态"
+          width="180px"
+        >
+          <template slot-scope="scope">
+            {{ scope.row.showFlag ? '启用' : '停用' }}
+          </template>
+        </el-table-column>
+        <el-table-column
+          align="center"
           prop="categoriesName"
           label="客户端类型"
           width="180px"
@@ -144,13 +159,24 @@
           <template slot-scope="scope">
             <el-button
               type="text"
+              @click="looker(scope.row)"
+              :disabled="!scope.row.url"
+              >预览</el-button
+            >
+            <el-button
+              type="text"
               @click="player(scope.row)"
               :disabled="!scope.row.url"
               >播放</el-button
             >
             <el-button
               type="text"
+              @click="changeStatus(scope.row)"
+              >{{ scope.row.showFlag ? '停用' : '启用' }}</el-button>
+            <el-button
+              type="text"
               @click="edit(scope.row)"
+              :disabled="scope.row.showFlag"
               v-permission="'sysMusicScore/update'"
               >修改</el-button
             >
@@ -193,14 +219,28 @@
         @close="visible = false"
       />
     </el-dialog>
+    <el-dialog
+      v-if="lookVisible"
+      width="667px"
+      class="lookForm"
+      :visible.sync="lookVisible"
+      title="预览"
+    >
+      <iframe id="iframe" v-if="lookVisible" style="width: 667px; height: 386px" ref="iframe" :src="accompanyUrl" />
+      <div class="iframe_back"></div>
+      <div class="iframe_help"></div>
+      <div class="iframe_header_back"></div>
+    </el-dialog>
   </div>
 </template>
 <script>
 import saveform from "@/components/save-form";
 import pagination from "@/components/Pagination/index";
 import { songUseType } from "@/constant";
-import { QueryPage, Del } from "./api";
+import { QueryPage, Del, Show } from "./api";
 import form from "./modals/form";
+import { vaildStudentUrl } from '@/utils/validate'
+import { getToken } from '@/utils/auth'
 export default {
   name: "accompaniment",
   components: {
@@ -213,6 +253,8 @@ export default {
       type: "",
       activeUrl: "",
       songUseType,
+      lookVisible: false,
+      accompanyUrl: null, // 预览地址
       audioVisible: false,
       tableList: [],
       searchForm: {
@@ -221,6 +263,7 @@ export default {
         subjectId: "",
         clientType:'',
         rankType: null,
+        showFlag: null
       },
       rules: {
         // 分页规则
@@ -271,10 +314,36 @@ export default {
       this.$refs.searchForm.resetFields();
       this.FetchList();
     },
+    looker(row) {
+      this.accompanyUrl = vaildStudentUrl() + '/accompany?Authorization=' + getToken() + '#/detail/' + row.id
+      this.lookVisible = true
+      // this.$nextTick(() => {
+      //   console.log(this.$refs.iframe)
+      //   let iframe = this.$refs.iframe
+      //   iframe.onload = function() {
+      //     console.log('完成', iframe)
+      //     iframe.contentWindow.document.querySelector('#tips-step-0').style.display = 'none'
+      //   }
+      // })
+    },
     player(row) {
       this.activeUrl = row.url;
       this.audioVisible = true;
     },
+    async changeStatus(row) {
+      try {
+        let status = row.showFlag ? '停用' : '启用'
+        await this.$confirm("是否确认"+ status +"此伴奏?", "提示", {
+          type: "warning",
+        });
+        await Show({
+          sysMusicScoreId: row.id,
+          showFlag: row.showFlag ? 0 : 1
+        })
+        this.$message.success(status + "成功");
+        this.FetchList();
+      } catch (error) {}
+    },
     edit(row) {
       this.detail = row;
       this.visible = true;
@@ -303,4 +372,37 @@ export default {
   overflow: hidden;
   white-space: pre;
 }
+.lookForm {
+  /deep/.el-dialog__body {
+    padding: 0;
+  }
+}
+
+.iframe_back {
+  width: 195px;
+  height: 45px;
+  position: absolute;
+  bottom: 50px;
+  background: transparent;
+  left: 50%;
+  z-index: 99;
+  margin-left: -100px;
+}
+.iframe_help {
+  position: absolute;
+  background: transparent;
+  width: 50px;
+  height: 120px;
+  top: 50%;
+  right: 0;
+  margin-top: -35px;
+}
+.iframe_header_back {
+    background: transparent;
+    width: 225px;
+    height: 50px;
+    position: absolute;
+    top: 65px;
+    left: 20px;
+}
 </style>

+ 2 - 0
src/views/accompaniment/modals/form.vue

@@ -320,6 +320,7 @@ export default {
               sysMusicScore: {
                 ...this.form.sysMusicScore,
                 type: 'COMMON',
+                showFlag: 0,
                 musicScoreCategoriesId: (this.form.sysMusicScore.musicScoreCategoriesId || []).pop(),
               }
             })
@@ -331,6 +332,7 @@ export default {
                 ...this.form.sysMusicScore,
                 type: 'COMMON',
                 id: this.detail.id,
+                showFlag: this.detail.showFlag,
                 musicScoreCategoriesId: (this.form.sysMusicScore.musicScoreCategoriesId || []).pop(),
               }
             })