forked from github/dataease
Merge pull request #1419 from dataease/pr@dev@mobile_star_status
feat: 移动端收藏状态
This commit is contained in:
commit
5fafcd610b
@ -32,7 +32,12 @@ public interface StoreApi {
|
|||||||
|
|
||||||
|
|
||||||
@ApiOperation("移除收藏")
|
@ApiOperation("移除收藏")
|
||||||
@PostMapping("/remove/{storeId}")
|
@PostMapping("/remove/{panelId}")
|
||||||
void remove(@PathVariable("storeId") String storeId);
|
void remove(@PathVariable("panelId") String panelId);
|
||||||
|
|
||||||
|
@ApiOperation("收藏状态")
|
||||||
|
@PostMapping("/status/{id}")
|
||||||
|
Boolean hasStar(@PathVariable("id") String id);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -29,4 +29,9 @@ public class StoreServer implements StoreApi {
|
|||||||
public void remove(String panelId) {
|
public void remove(String panelId) {
|
||||||
storeService.removeByPanelId(panelId);
|
storeService.removeByPanelId(panelId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean hasStar(String id) {
|
||||||
|
return storeService.count(id) > 0L;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,4 +53,11 @@ public class StoreService {
|
|||||||
return extPanelStoreMapper.query(example);
|
return extPanelStoreMapper.query(example);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long count(String panelId) {
|
||||||
|
PanelStoreExample example = new PanelStoreExample();
|
||||||
|
example.createCriteria().andUserIdEqualTo(AuthUtils.getUser().getUserId()).andPanelGroupIdEqualTo(panelId);
|
||||||
|
return panelStoreMapper.countByExample(example);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,3 +25,10 @@ export function enshrineList(data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function starStatus(panelId) {
|
||||||
|
return request({
|
||||||
|
url: '/api/store/status/' + panelId,
|
||||||
|
method: 'post',
|
||||||
|
loading: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@ -125,7 +125,7 @@ import SaveToTemplate from '@/views/panel/list/SaveToTemplate'
|
|||||||
import { mapState } from 'vuex'
|
import { mapState } from 'vuex'
|
||||||
import html2canvas from 'html2canvasde'
|
import html2canvas from 'html2canvasde'
|
||||||
import FileSaver from 'file-saver'
|
import FileSaver from 'file-saver'
|
||||||
import { enshrineList, saveEnshrine, deleteEnshrine } from '@/api/panel/enshrine'
|
import { starStatus, saveEnshrine, deleteEnshrine } from '@/api/panel/enshrine'
|
||||||
import bus from '@/utils/bus'
|
import bus from '@/utils/bus'
|
||||||
import { queryAll } from '@/api/panel/pdfTemplate'
|
import { queryAll } from '@/api/panel/pdfTemplate'
|
||||||
import ShareHead from '@/views/panel/GrantAuth/ShareHead'
|
import ShareHead from '@/views/panel/GrantAuth/ShareHead'
|
||||||
@ -294,9 +294,8 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
initHasStar() {
|
initHasStar() {
|
||||||
const param = {}
|
starStatus(this.panelInfo.id).then(res => {
|
||||||
enshrineList(param).then(res => {
|
this.hasStar = res.data
|
||||||
this.hasStar = res.data && res.data.some(item => item.panelGroupId === this.panelInfo.id)
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
refreshStarList(isStar) {
|
refreshStarList(isStar) {
|
||||||
|
Loading…
Reference in New Issue
Block a user