doum
8 小时以前 28db820caf0ed90f4326d29cb0fa7a19cba92775
admin/src/views/business/banner.vue
@@ -37,7 +37,7 @@
    <template v-slot:table-wrap>
      <ul class="toolbar" v-permissions="['business:banner:create', 'business:banner:delete']">
        <li><el-button type="primary" @click="$refs.operaBannerWindow.open('新建轮播图')" icon="el-icon-plus" v-permissions="['business:banner:create']">新建</el-button></li>
        <li><el-button @click="deleteByIdInBatch" icon="el-icon-delete" v-permissions="['business:banner:delete']">删除</el-button></li>
        <li><el-button  type="danger"  @click="deleteByIdInBatch" icon="el-icon-delete" v-permissions="['business:banner:delete']">删除</el-button></li>
      </ul>
      <el-table
        v-loading="isWorking.search"
@@ -52,10 +52,21 @@
        </el-table-column>
        <el-table-column prop="imgurlfull" label="展示图" align="center" min-width="100px">
          <template slot-scope="{row}">
            <el-image :scr="row.imgFullUrl" :preview-src-list="[row.imgFullUrl]"></el-image>
            <el-image :src="row.imgFullUrl" :preview-src-list="[row.imgFullUrl]"></el-image>
          </template>
        </el-table-column>
        <el-table-column prop="cityName" label="展示城市" align="center" min-width="100px"></el-table-column>
        <el-table-column prop="status" label="状态" align="center" min-width="100px">
          <template slot-scope="{row}">
            <el-switch
                v-model="row.status"
                active-color="#13ce66"
                inactive-color="#999"
                :active-value="0"
                :inactive-value="1"
                @change="statusChange(row)"
            ></el-switch>
          </template>
        </el-table-column>
        <el-table-column prop="type" label="跳转功能" align="center" min-width="100px">
           <template slot-scope="{row}">
            {{ typeToStr(row.type) }}
@@ -64,9 +75,10 @@
        <el-table-column prop="content" label="内容" align="center" min-width="100px">
          <template slot-scope="{row}">
            <el-button v-if="row.type==0" type="text" @click="$refs.showRich.open('详情',row)">查看详情</el-button>
            <template v-else>
            <el-button v-if="row.type==1 && row.content" type="text"  @click="goLink(row)" :title="row.content">跳转外链</el-button>
<!--            <template v-else>
              {{ row.content }}
            </template>
            </template>-->
          </template>
        </el-table-column>
        <el-table-column prop="sortnum" label="排序码" align="center" min-width="100px"></el-table-column>
@@ -80,7 +92,7 @@
        >
          <template slot-scope="{row}">
            <el-button type="text" @click="$refs.operaBannerWindow.open('编辑轮播图', row)" icon="el-icon-edit" v-permissions="['business:banner:update']">编辑</el-button>
            <el-button type="text" @click="deleteById(row)" icon="el-icon-delete" v-permissions="['business:banner:delete']">删除</el-button>
            <el-button type="text"  style="color: red;" @click="deleteById(row)" icon="el-icon-delete" v-permissions="['business:banner:delete']">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
@@ -94,7 +106,7 @@
    <!-- 新建/修改 -->
    <OperaBannerWindow ref="operaBannerWindow" @success="handlePageChange"/>
    <ShowRich ref="showRich"/>
  </TableLayout>
</template>
@@ -113,27 +125,27 @@
      // 搜索
      searchForm: {
        position: '',
        type: '',
        type: ''
      },
      postions: [
        // 0首页 1推荐店铺 2商城首页
        { label: '首页', id: 0 },
        { label: '推荐店铺', id: 1 },
        { label: '商城首页', id: 2 },
        { label: '商城首页', id: 2 }
      ],
      types: [
        //  0富文本 1外链 2活动 3商家
        { label: '富文本', id: 0 },
        { label: '外链', id: 1 },
        { label: '活动', id: 2 },
        { label: '商家', id: 3 },
        { label: '外链', id: 1 }
      /*  { label: '活动', id: 2 },
        { label: '商家', id: 3 }, */
      ]
    }
  },
  provide() {
  provide () {
    return {
      postions: () => this.postions,
      types: () => this.types,
      types: () => this.types
    }
  },
  created () {
@@ -146,15 +158,30 @@
    this.search()
  },
  methods: {
    postionToStr(postion) {
    statusChange (row) {
      this.api.updateStatus(row)
        .then(() => {
          this.$tip.success('操作成功')
        })
        .catch(e => {
          this.$tip.error(e)
        })
        .finally(() => {
          this.handlePageChange()
        })
    },
    goLink(row){
      window.open(row.content)
    },
    postionToStr (postion) {
      // console.log(postion);
      let temp = this.postions.find(item => item.id == postion)
      const temp = this.postions.find(item => item.id == postion)
      return temp ? temp.label : '-'
    },
    typeToStr(type) {
      let temp = this.types.find(item => item.id == type)
    typeToStr (type) {
      const temp = this.types.find(item => item.id == type)
      return temp ? temp.label : '-'
    },
  },
    }
  }
}
</script>