123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349 |
- <template>
- <div class="TextAnalysis" v-loading="loading">
- <Header />
- <div class="main">
- <div class="title">文本分析</div>
- <div class="input_main">
- <el-input
- type="textarea"
- placeholder="请输入文本"
- :autosize="{ minRows: 9 }"
- v-model="txt"
- >
- </el-input>
- <div class="text_btn">
- <span class="left">{{ txt.length }}/1000</span>
- <span class="btn" @click="submit">分析</span>
- </div>
- </div>
- <div class="list_main" v-if="data">
- <div class="title">
- <span style="margin-right: 16px">分析记录:</span>
- <span>{{ data.total }}/20</span>
- </div>
- <div class="list">
- <div v-for="(item, i) in data.list" :key="i + 'one'">
- <div class="number">{{ item.number }}</div>
- <div class="txt" @click="goresult(item)">
- {{ item.firstSentence }}
- </div>
- <div class="time">{{ item.createDate }}</div>
- <div class="cxjx" @click="anewSubmit(item)">重新解析</div>
- <img
- @click="deleteOne(item.id, i)"
- src="../../assets/teacherdev/delete-one.png"
- alt=""
- />
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- //这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
- //例如:import 《组件名称》from ‘《组件路径》';
- import Header from "@/components/Header";
- import { postapi } from "@/api/api";
- import { getToken } from "@/utils/auth";
- export default {
- //import引入的组件需要注入到对象中才能使用
- components: {
- Header,
- },
- props: {},
- data() {
- //这里存放数据
- return {
- txt: "",
- loading: false,
- token: null,
- page: 1,
- pageSize: 20,
- data: null,
- };
- },
- //计算属性 类似于data概念
- computed: {},
- //监控data中数据变化
- watch: {},
- //方法集合
- methods: {
- // 分析结果统计
- goresult(item) {
- window.open(
- this.$router.resolve({
- path: "/textanalysis/Result",
- query: {
- partitionKey: item.partitionKey,
- subjectWords: item.subjectWords,
- wordTextCount: item.textCount,
- wordCount: item.wordCount,
- vocabularyTextCount: item.vocabularyTextCount,
- vocabularyCount: item.vocabularyCount,
- pinyinCount: item.pinyinCount,
- pinyinTextCount: item.pinyinTextCount,
- pinyinDifficulty: item.pinyinDifficulty,
- wordDifficulty: item.wordDifficulty,
- vocabularyDifficulty: item.vocabularyDifficulty,
- type: "文本分析",
- },
- }).href,
- "_blank"
- );
- },
- // 删除
- deleteOne(id, index) {
- this.loading = true;
- postapi({
- url: "/GCLSTCServer/tools/TS/analysis/record/del",
- data: {
- id,
- },
- })
- .then((res) => {
- this.data.list.splice(index, 1);
- this.data.total = this.data.total - 1;
- this.$message.success(res.msg);
- this.loading = false;
- })
- .catch((res) => {
- this.loading = false;
- });
- },
- anewSubmit(item) {
- this.loading = true;
- postapi({
- url: "/GCLSTCServer/tools/TS/reparse",
- data: {
- partitionKey: item.partitionKey,
- },
- })
- .then((res) => {
- window.open(
- this.$router.resolve({
- path: "/textanalysis/Result",
- query: {
- partitionKey: res.data.result.partitionKey,
- subjectWords: res.data.result.subjectWords,
- wordTextCount: res.data.result.textCount,
- wordCount: res.data.result.wordCount,
- vocabularyTextCount: res.data.result.vocabularyTextCount,
- vocabularyCount: res.data.result.vocabularyCount,
- pinyinCount: res.data.result.pinyinCount,
- pinyinTextCount: res.data.result.pinyinTextCount,
- pinyinDifficulty: res.data.result.pinyinDifficulty,
- wordDifficulty: res.data.result.wordDifficulty,
- vocabularyDifficulty: res.data.result.vocabularyDifficulty,
- type: "文本分析",
- },
- }).href,
- "_blank"
- );
- this.getlist(true);
- // this.loading = false;
- })
- .catch((res) => {
- this.loading = false;
- });
- },
- // 分析
- submit(msg) {
- if (this.txt == "") {
- this.$message.warning("请先输入内容");
- return;
- }
- this.loading = true;
- postapi({
- url: "/GCLSTCServer/tools/TS/analys",
- data: {
- tenantId: "",
- text: this.txt,
- },
- })
- .then((res) => {
- this.txt = "";
- window.open(
- this.$router.resolve({
- path: "/textanalysis/Result",
- query: {
- partitionKey: res.data.result.partitionKey,
- subjectWords: res.data.result.subjectWords,
- wordTextCount: res.data.result.textCount,
- wordCount: res.data.result.wordCount,
- vocabularyTextCount: res.data.result.vocabularyTextCount,
- vocabularyCount: res.data.result.vocabularyCount,
- pinyinCount: res.data.result.pinyinCount,
- pinyinTextCount: res.data.result.pinyinTextCount,
- pinyinDifficulty: res.data.result.pinyinDifficulty,
- wordDifficulty: res.data.result.wordDifficulty,
- vocabularyDifficulty: res.data.result.vocabularyDifficulty,
- type: "文本分析",
- },
- }).href,
- "_blank"
- );
- this.getlist(true);
- // this.loading = false;
- })
- .catch((res) => {
- this.loading = false;
- });
- },
- getlist(msg) {
- this.loading = true;
- postapi({
- url: "/GCLSTCServer/tools/TS/analysis/record/list",
- data: {
- pageIndex: this.page,
- pageSize: this.pageSize,
- },
- })
- .then((res) => {
- let num = this.page * this.pageSize - this.pageSize + 1;
- res.data.result.list.forEach((item) => {
- item.number = num;
- num++;
- });
- this.data = res.data.result;
- if (msg) {
- this.$message.success(res.msg);
- }
- this.loading = false;
- })
- .catch((res) => {
- this.loading = false;
- });
- },
- },
- //生命周期 - 创建完成(可以访问当前this实例)
- created() {
- let data = getToken();
- this.token = JSON.parse(data);
- this.getlist();
- },
- //生命周期 - 挂载完成(可以访问DOM元素)
- mounted() {},
- //生命周期-创建之前
- beforeCreated() {},
- //生命周期-挂载之前
- beforeMount() {},
- //生命周期-更新之前
- beforUpdate() {},
- //生命周期-更新之后
- updated() {},
- //生命周期-销毁之前
- beforeDestory() {},
- //生命周期-销毁完成
- destoryed() {},
- //如果页面有keep-alive缓存功能,这个函数会触发
- activated() {},
- };
- </script>
- <style lang="scss" scoped>
- /* @import url(); 引入css类 */
- .TextAnalysis {
- height: 100%;
- .main {
- height: 100%;
- background: #f6f6f6;
- padding-top: 54px;
- padding-bottom: 24px;
- > div {
- width: 1200px;
- margin: 0 auto;
- }
- > .title {
- font-weight: 700;
- font-size: 30px;
- line-height: 43px;
- color: #2c2c2c;
- }
- .input_main {
- width: 1168px;
- margin-top: 17px;
- padding: 16px;
- height: 295px;
- background: #ffffff;
- border-radius: 4px;
- .text_btn {
- margin-top: 16px;
- display: flex;
- justify-content: space-between;
- align-items: center;
- .left {
- font-weight: 400;
- font-size: 14px;
- line-height: 26px;
- color: #000000;
- }
- .btn {
- font-weight: 500;
- font-size: 16px;
- line-height: 40px;
- color: #000000;
- width: 124px;
- height: 40px;
- background: #ffc600;
- border: 1px solid rgba(0, 0, 0, 0.15);
- box-shadow: 0px 2px 0px rgba(0, 0, 0, 0.04);
- border-radius: 4px;
- text-align: center;
- cursor: pointer;
- }
- }
- }
- .list_main {
- margin-top: 37px;
- .title {
- font-weight: 400;
- font-size: 16px;
- line-height: 24px;
- color: #000000;
- }
- .list {
- margin-top: 16px;
- > div {
- display: flex;
- align-items: center;
- padding: 0 16px;
- height: 48px;
- background: #ffffff;
- border-bottom: 1px solid rgba(0, 0, 0, 0.08);
- font-weight: 400;
- font-size: 16px;
- color: #000000;
- .number {
- width: 20px;
- text-align: right;
- margin-right: 24px;
- }
- .txt {
- width: 774px;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- margin-right: 24px;
- cursor: pointer;
- }
- .time {
- width: 190px;
- margin-right: 24px;
- }
- .cxjx {
- margin-right: 24px;
- cursor: pointer;
- }
- img {
- width: 24px;
- height: 24px;
- cursor: pointer;
- }
- }
- }
- }
- }
- }
- </style>
|