|
@@ -3,7 +3,7 @@ import OPopup from '@/components/o-popup'
|
|
|
import request from '@/helpers/request'
|
|
|
import { router } from '@/router/routes-common'
|
|
|
import dayjs from 'dayjs'
|
|
|
-import { Button, Cell, Image, List } from 'vant'
|
|
|
+import { ActionSheet, Button, Cell, Icon, Image, List, showConfirmDialog, showToast } from 'vant'
|
|
|
import { defineComponent, onMounted, reactive } from 'vue'
|
|
|
import { useRoute, useRouter } from 'vue-router'
|
|
|
import AddInformation from './modal/add-information'
|
|
@@ -28,7 +28,10 @@ export default defineComponent({
|
|
|
clientType: 'SCHOOL',
|
|
|
page: 1,
|
|
|
rows: 20
|
|
|
- }
|
|
|
+ },
|
|
|
+ oPopover: false,
|
|
|
+ selectItem: {} as any,
|
|
|
+ selectType: 'add'
|
|
|
})
|
|
|
|
|
|
const getList = async () => {
|
|
@@ -87,12 +90,49 @@ export default defineComponent({
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ const onUpdate = async () => {
|
|
|
+ state.selectType = 'update'
|
|
|
+ state.addStatus = true
|
|
|
+ }
|
|
|
+
|
|
|
+ const onRemove = async () => {
|
|
|
+ showConfirmDialog({
|
|
|
+ message: '您确认删除该资讯吗?'
|
|
|
+ }).then(async () => {
|
|
|
+ try {
|
|
|
+ await request.post('/api-school/sysNewsInformation/remove', {
|
|
|
+ requestType: 'form',
|
|
|
+ data: {
|
|
|
+ id: state.selectItem.id
|
|
|
+ }
|
|
|
+ })
|
|
|
+ setTimeout(() => {
|
|
|
+ showToast('删除成功')
|
|
|
+ }, 100)
|
|
|
+
|
|
|
+ setTimeout(() => {
|
|
|
+ onSearch()
|
|
|
+ }, 1100)
|
|
|
+ } catch {
|
|
|
+ //
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
onMounted(() => {
|
|
|
getList()
|
|
|
})
|
|
|
return () => (
|
|
|
<div class={styles.information}>
|
|
|
- <Button icon="plus" block class={styles.addPhone} onClick={() => (state.addStatus = true)}>
|
|
|
+ <Button
|
|
|
+ icon="plus"
|
|
|
+ block
|
|
|
+ class={styles.addPhone}
|
|
|
+ onClick={() => {
|
|
|
+ state.selectType = 'add'
|
|
|
+ state.addStatus = true
|
|
|
+ }}
|
|
|
+ >
|
|
|
添加资讯
|
|
|
</Button>
|
|
|
|
|
@@ -112,8 +152,27 @@ export default defineComponent({
|
|
|
<div>
|
|
|
<div class={[styles.title, 'van-ellipsis']}>{item.title}</div>
|
|
|
<div class={[styles.content, 'van-multi-ellipsis--l2']}>{item.memo}</div>
|
|
|
- <div class={styles.time}>
|
|
|
- {dayjs(item.createTime).format('YYYY年MM月DD日')}
|
|
|
+ <div
|
|
|
+ style={{
|
|
|
+ display: 'flex',
|
|
|
+ alignItems: 'center',
|
|
|
+ justifyContent: 'space-between'
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <div class={styles.time}>
|
|
|
+ {item.createTime ? dayjs(item.createTime).format('YYYY年MM月DD日') : ''}
|
|
|
+ </div>
|
|
|
+ <Icon
|
|
|
+ name="ellipsis"
|
|
|
+ size={23}
|
|
|
+ color="#777777"
|
|
|
+ style={{ fontWeight: 'bold' }}
|
|
|
+ onClick={(e: any) => {
|
|
|
+ e.stopPropagation()
|
|
|
+ state.selectItem = item
|
|
|
+ state.oPopover = true
|
|
|
+ }}
|
|
|
+ />
|
|
|
</div>
|
|
|
</div>
|
|
|
)
|
|
@@ -125,9 +184,24 @@ export default defineComponent({
|
|
|
<OEmpty btnStatus={false} classImgSize="SMALL" tips="暂无资讯" />
|
|
|
)}
|
|
|
|
|
|
- <OPopup v-model:modelValue={state.addStatus} style={{ background: '#f8f8f8' }}>
|
|
|
- <AddInformation onClose={() => (state.addStatus = false)} onGetList={onSearch} />
|
|
|
+ <OPopup v-model:modelValue={state.addStatus} style={{ background: '#f8f8f8' }} destroy>
|
|
|
+ <AddInformation
|
|
|
+ selectType={state.selectType}
|
|
|
+ selectItem={state.selectItem}
|
|
|
+ onClose={() => (state.addStatus = false)}
|
|
|
+ onGetList={onSearch}
|
|
|
+ />
|
|
|
</OPopup>
|
|
|
+
|
|
|
+ <ActionSheet
|
|
|
+ cancelText="取消"
|
|
|
+ v-model:show={state.oPopover}
|
|
|
+ closeOnClickAction
|
|
|
+ actions={[
|
|
|
+ { name: '修改', callback: () => onUpdate() },
|
|
|
+ { name: '删除', color: '#F44541', callback: () => onRemove() }
|
|
|
+ ]}
|
|
|
+ />
|
|
|
</div>
|
|
|
)
|
|
|
}
|