123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305 |
- <template>
- <div v-loading="loading" class="cred_table">
- <Header v-if="!userID" />
- <div class="main" v-if="showPage">
- <div>
- <div class="title">字词练习卡</div>
- <div class="number_cread">
- <span class="left">文件数量:{{ data.total_count }}</span>
- <div class="right" @click="Startcread">开始创建</div>
- </div>
- <div class="table">
- <div>
- <div class="number"></div>
- <div class="dv dv1" style="font-weight: 500">名称</div>
- <div class="dv" style="font-weight: 500">卡片类型</div>
- <div class="dv" style="font-weight: 500">创建内容</div>
- <div class="dv" style="font-weight: 500">创建日期</div>
- </div>
- <div v-for="(item, i) in data.word_sentence_card_list" :key="i + 'one'">
- <div class="number">{{ item.number }}</div>
- <div
- class="dv dv1"
- @click="
- $router.push({
- path: '/wordcard/cread',
- query: {
- id: item.id,
- cachesType: 'pop',
- userID: userID,
- },
- })
- "
- >
- {{ item.name }}
- </div>
- <div class="dv">
- {{ item.type == 'WORD' ? '字卡片' : '句卡片' }}
- </div>
- <div class="dv">{{ item.text }}</div>
- <div class="dv">{{ item.create_time }}</div>
- <el-popconfirm title="确定删除这一条记录吗?" @confirm="deleteOne(item.id, i)">
- <img slot="reference" src="../../assets/teacherdev/delete-one.png" alt="" />
- </el-popconfirm>
- </div>
- <p v-if="data.total_count == 0" style="background-color: #fff; text-align: center; line-height: 200px">
- <!-- <img src="../../assets/teacherdev/nodata.png" style="width: 1200px" /> -->
- 暂无数据
- </p>
- </div>
- <div v-if="data.total_count > 0" class="page">
- <el-pagination
- background
- :page-sizes="[10, 20, 30, 40, 50]"
- layout="prev, pager, next,jumper"
- :current-page="page"
- :page-size="pageSize"
- :total="data.total_count"
- @current-change="handleCurrentChange"
- />
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- // 这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
- // 例如:import 《组件名称》from ‘《组件路径》';
- import Header from '@/components/Header';
- import { LearnWebSI, getStaticContent } from '@/api/api';
- import { getConfigInfor } from '@/utils/index';
- import { setToken, getToken } from '@/utils/auth';
- export default {
- // import引入的组件需要注入到对象中才能使用
- components: {
- Header,
- },
- props: {},
- data() {
- // 这里存放数据
- return {
- data: [],
- page: 1,
- pageSize: 10,
- loading: false,
- AccessToken: this.$route.query.AccessToken,
- AppID: this.$route.query.AppID,
- showPage: false,
- userID: this.$route.query.UserID ? this.$route.query.UserID : '',
- };
- },
- // 计算属性 类似于data概念
- computed: {},
- // 监控data中数据变化
- watch: {},
- // 生命周期 - 创建完成(可以访问当前this实例)
- async created() {
- const _this = this;
- if (this.AccessToken) {
- const Mname = 'login_control-ParseAccessToken';
- await getStaticContent(Mname, {
- access_token: _this.AccessToken,
- }).then((res) => {
- res.access_token = _this.AccessToken;
- setToken(res);
- sessionStorage.setItem('GCLS_Token_Tc', JSON.stringify(res));
- this.showPage = true;
- });
- await getConfigInfor();
- }
- this.showPage = true;
- this.getdata();
- },
- // 生命周期 - 挂载完成(可以访问DOM元素)
- mounted() {},
- // 生命周期-挂载之前
- beforeMount() {},
- // 生命周期-更新之后
- updated() {},
- // 如果页面有keep-alive缓存功能,这个函数会触发
- activated() {},
- // 方法集合
- methods: {
- // 创建
- Startcread() {
- this.$router.push({
- path: '/wordcard/cread',
- query: { cachesType: 'pop', userID: this.userID },
- });
- },
- deleteOne(id, index) {
- this.loading = true;
- let Mname = 'tr_tool-wsc_manager-DeleteMyWordSentenceCard';
- LearnWebSI(Mname, {
- id,
- })
- .then((res) => {
- this.getdata();
- })
- .catch((res) => {
- this.loading = false;
- });
- },
- handleCurrentChange(val) {
- this.page = val;
- this.getdata();
- },
- getdata() {
- this.loading = true;
- let Mname = 'page_query-PageQueryMyWordSentenceCardList';
- LearnWebSI(Mname, {
- cur_page: this.page,
- page_capacity: this.pageSize,
- app_user_id: this.userID,
- })
- .then((res) => {
- this.data = res;
- let num = this.page * this.pageSize - this.pageSize + 1;
- this.data.word_sentence_card_list.forEach((item) => {
- item.number = num;
- num++;
- });
- this.loading = false;
- })
- .catch((res) => {
- this.loading = false;
- });
- },
- },
- // 生命周期-创建之前
- beforeCreated() {},
- // 生命周期-更新之前
- beforUpdate() {},
- // 生命周期-销毁之前
- beforeDestory() {},
- // 生命周期-销毁完成
- destoryed() {},
- };
- </script>
- <style lang="scss" scoped>
- /* @import url(); 引入css类 */
- .cred_table {
- height: 100%;
- .main {
- min-height: 91%;
- background: #f7f7f7;
- padding-top: 54px;
- > div {
- width: 1200px;
- margin: 0 auto;
- }
- .title {
- font-weight: 700;
- font-size: 30px;
- line-height: 43px;
- text-transform: uppercase;
- color: #2c2c2c;
- }
- .number_cread {
- display: flex;
- justify-content: space-between;
- margin-top: 12px;
- .left {
- margin-top: 40px;
- font-weight: 400;
- font-size: 16px;
- line-height: 24px;
- color: #000000;
- }
- .right {
- width: 112px;
- height: 40px;
- background: #669aff;
- border-radius: 4px;
- font-weight: 500;
- font-size: 16px;
- line-height: 40px;
- text-align: center;
- color: #ffffff;
- cursor: pointer;
- }
- }
- .table {
- margin-top: 16px;
- > div {
- display: flex;
- align-items: center;
- height: 48px;
- background: #ffffff;
- border-bottom: 1px solid rgba(0, 0, 0, 0.08);
- font-weight: 400;
- font-size: 16px;
- color: #000000;
- padding: 0 16px;
- .number {
- width: 20px;
- text-align: right;
- flex-shrink: 0;
- }
- .dv1 {
- cursor: pointer;
- }
- .dv {
- margin-left: 24px;
- width: 250px;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- flex-shrink: 0;
- }
- img {
- width: 24px;
- height: 24px;
- cursor: pointer;
- margin-left: 24px;
- }
- }
- }
- .page {
- margin-top: 24px;
- }
- }
- }
- </style>
- <style lang="scss">
- .cred_table {
- .page {
- .el-pagination.is-background .el-pager li:not(.disabled).active {
- background: none;
- }
- .el-pagination {
- .btn-prev {
- padding: 0 !important;
- border: 1px solid #d9d9d9 !important;
- background: none;
- }
- .btn-next {
- padding: 0 !important;
- border: 1px solid #d9d9d9 !important;
- background: none;
- }
- }
- .el-pager {
- li {
- border: 1px solid #d9d9d9 !important;
- box-sizing: border-box;
- border-radius: 2px;
- margin: 0 7.5px;
- background: none;
- }
- .el-icon,
- .more,
- .btn-quicknext,
- .el-icon-more {
- border: none !important;
- }
- .active {
- color: black !important;
- border: 1px solid black !important;
- }
- }
- }
- }
- </style>
|