parent
aa11b320fe
commit
72f17b5dd7
|
|
@ -0,0 +1,39 @@
|
||||||
|
<template>
|
||||||
|
<div class="infinite-list-wrapper" style="overflow:auto">
|
||||||
|
<ul
|
||||||
|
class="list"
|
||||||
|
v-infinite-scroll="load"
|
||||||
|
infinite-scroll-disabled="disabled">
|
||||||
|
<li v-for="i in count" class="list-item">{{ i }}</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
<p v-if="loading">加载中...</p>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "collect",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
count: 10,
|
||||||
|
loading: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
disabled() {
|
||||||
|
return this.loading
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
load() {
|
||||||
|
this.loading = true
|
||||||
|
setTimeout(() => {
|
||||||
|
this.count += 2
|
||||||
|
this.loading = false
|
||||||
|
}, 200)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
@ -84,6 +84,21 @@
|
||||||
>导出
|
>导出
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="el-icon-star-off"
|
||||||
|
size="mini"
|
||||||
|
@click="handleCollect"
|
||||||
|
v-hasPermi="['english:word:collect']"
|
||||||
|
>
|
||||||
|
<router-link :to="'/openapi/english/collect/'" class="link-type">
|
||||||
|
收藏夹
|
||||||
|
</router-link>
|
||||||
|
</el-button>
|
||||||
|
|
||||||
|
</el-col>
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
|
|
@ -229,7 +244,7 @@
|
||||||
|
|
||||||
|
|
||||||
<div v-loading="loadingC">
|
<div v-loading="loadingC">
|
||||||
<div class="div1" >
|
<div class="div1">
|
||||||
{{ form.englishWord }}
|
{{ form.englishWord }}
|
||||||
</div>
|
</div>
|
||||||
<div class="div2">
|
<div class="div2">
|
||||||
|
|
@ -328,9 +343,9 @@ export default {
|
||||||
//根据id查询放入抽屉
|
//根据id查询放入抽屉
|
||||||
findById(id) {
|
findById(id) {
|
||||||
this.loadingC = true;
|
this.loadingC = true;
|
||||||
getWord(id).then(res =>{
|
getWord(id).then(res => {
|
||||||
this.form = res.data
|
this.form = res.data
|
||||||
this.loadingC=false
|
this.loadingC = false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -338,6 +353,7 @@ export default {
|
||||||
//关闭抽屉
|
//关闭抽屉
|
||||||
handleClose(done) {
|
handleClose(done) {
|
||||||
done();
|
done();
|
||||||
|
this.getList();
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 详细按钮操作 */
|
/** 详细按钮操作 */
|
||||||
|
|
@ -462,12 +478,17 @@ export default {
|
||||||
this.download('english/word/export', {
|
this.download('english/word/export', {
|
||||||
...this.queryParams
|
...this.queryParams
|
||||||
}, `word_${new Date().getTime()}.xlsx`)
|
}, `word_${new Date().getTime()}.xlsx`)
|
||||||
|
},
|
||||||
|
|
||||||
|
//收藏夹操作
|
||||||
|
handleCollect() {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
.div1{
|
.div1 {
|
||||||
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
||||||
height: 180px;
|
height: 180px;
|
||||||
margin: 10px;
|
margin: 10px;
|
||||||
|
|
@ -477,7 +498,8 @@ export default {
|
||||||
text-shadow: 2px 2px 2px grey;
|
text-shadow: 2px 2px 2px grey;
|
||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
}
|
}
|
||||||
.div2{
|
|
||||||
|
.div2 {
|
||||||
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
||||||
margin: 10px;
|
margin: 10px;
|
||||||
padding: 30px;
|
padding: 30px;
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,18 @@ public class EnglishWordController extends BaseController {
|
||||||
private IEnglishWordService englishWordService;
|
private IEnglishWordService englishWordService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 英语单词收藏夹
|
||||||
|
* @return TableDataInfo
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("english:word:collect")
|
||||||
|
@GetMapping("collect")
|
||||||
|
public TableDataInfo collect() {
|
||||||
|
List<EnglishWord> englishWordList=englishWordService.getEnglishWordByCollect();
|
||||||
|
return getDataTable(englishWordList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//------------------------代码自动生成-----------------------------------
|
//------------------------代码自动生成-----------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,12 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public interface IEnglishWordService {
|
public interface IEnglishWordService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询收藏的单词列表
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<EnglishWord> getEnglishWordByCollect();
|
||||||
|
|
||||||
|
|
||||||
//------------------------代码自动生成-----------------------------------
|
//------------------------代码自动生成-----------------------------------
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,11 @@ public class EnglishWordServiceImpl implements IEnglishWordService {
|
||||||
private RedisService redisService;
|
private RedisService redisService;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EnglishWord> getEnglishWordByCollect() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询英语单词、远程调用获取翻译字典
|
* 查询英语单词、远程调用获取翻译字典
|
||||||
*
|
*
|
||||||
|
|
@ -50,9 +55,11 @@ public class EnglishWordServiceImpl implements IEnglishWordService {
|
||||||
@Override
|
@Override
|
||||||
public EnglishWord selectEnglishWordById(Long id) {
|
public EnglishWord selectEnglishWordById(Long id) {
|
||||||
EnglishWord englishWord = englishWordMapper.selectById(id);
|
EnglishWord englishWord = englishWordMapper.selectById(id);
|
||||||
|
Optional.ofNullable(englishWord).orElseThrow(() -> new BusinessException("数据丢失了~~~~"));
|
||||||
//每次调用查看次数+1
|
//每次调用查看次数+1
|
||||||
Long count = englishWord.getLookCount() + 1;
|
Long count = englishWord.getLookCount() + 1;
|
||||||
englishWord.setLookCount(count);
|
englishWord.setLookCount(count);
|
||||||
|
englishWordMapper.updateById(englishWord);
|
||||||
//redis中的hsah键
|
//redis中的hsah键
|
||||||
String hkey = englishWord.getEnglishWord() + ":" + id;
|
String hkey = englishWord.getEnglishWord() + ":" + id;
|
||||||
Object value = redisService.getCacheMapValue(TRAN_DICT, hkey);
|
Object value = redisService.getCacheMapValue(TRAN_DICT, hkey);
|
||||||
|
|
@ -125,6 +132,20 @@ public class EnglishWordServiceImpl implements IEnglishWordService {
|
||||||
return englishWordMapper.updateById(englishWord);
|
return englishWordMapper.updateById(englishWord);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除英语单词 (清除redis缓存)
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的英语单词主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteEnglishWordByIds(Long[] ids) {
|
||||||
|
for (Long id : ids) {
|
||||||
|
//需要查出对象才能删除缓存,后续看需求添加
|
||||||
|
}
|
||||||
|
return englishWordMapper.deleteEnglishWordByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//------------------------代码自动生成-----------------------------------
|
//------------------------代码自动生成-----------------------------------
|
||||||
|
|
||||||
|
|
@ -139,16 +160,7 @@ public class EnglishWordServiceImpl implements IEnglishWordService {
|
||||||
return englishWordMapper.selectEnglishWordList(englishWord);
|
return englishWordMapper.selectEnglishWordList(englishWord);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除英语单词
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的英语单词主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteEnglishWordByIds(Long[] ids) {
|
|
||||||
return englishWordMapper.deleteEnglishWordByIds(ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除英语单词信息
|
* 删除英语单词信息
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue