123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353 |
- <template>
- <el-dialog title="提醒" :visible="show" :append-to-body="true" width="560px"
- :before-close="handleClose" class="dialog_diy">
- <div class="share_box">
- <div class="info_box" ref="info">
- <div class="info">
- <span>表单名称:</span>
- <span>{{ testJson?testJson.title:'-' }}</span>
- </div>
- <div class="info" >
- <!-- {{ reversedMessage }} -->
- <span>表单范围:</span>
- <span>{{ reversedMessage }}</span>
- </div>
- <div class="info" v-if="testJson && testJson.overtime">
- <span>截止时间:</span>
- <span>{{ testJson.overtime }}</span>
- </div>
- <div class="info" v-if="testJson">
- <span>未完成人数:</span>
- <span>{{ noCount }}</span>
- </div>
- <div class="info" v-if="testJson">
- <span>已完成人数:</span>
- <span v-html="testJson.worksPerson"></span>
- </div>
- <div class="info" v-if="pname.length">
- <span>未完成名单:</span>
- <span>{{ pname.length > 20 ? isSuo ? pname.slice(0,20).join(',')+'...' : pname.join(',') : pname.join(',') }}</span>
- <span class="more" v-if="pname.length > 20" @click="isSuo = !isSuo">{{ isSuo ? '查看更多' : '收起'}}</span>
- </div>
- </div>
- <div class="url_box">
- <div class="title">
- 链接提醒
- </div>
- <div class="url">
- <el-tooltip :content="origin" placement="top" effect="dark">
- <!-- content to trigger tooltip here -->
- <span>{{ origin }}</span>
- </el-tooltip>
- <span @click="copy" :data-clipboard-text="copyText" class="tag-read">复制链接</span>
- </div>
- </div>
- <div class="qrcode_box">
- <div class="title">
- 二维码提醒
- </div>
- <div class="qrcode">
- <span class="qrcodeUrl" ref="qrCodeUrl"></span>
- <span @click="downQr">下载二维码</span>
- </div>
- </div>
- <div class="btn_box">
- <button class="c_pub_button_confirm tag-read2" @click="copy2" :data-clipboard-text="copyText2">复制信息</button>
- </div>
- </div>
- <!-- <span slot="footer" class="dialog-footer">
- <el-button @click="close()">关 闭</el-button>
- </span> -->
- </el-dialog>
- </template>
- <script>
- import Clipboard from "clipboard";
- import QRCode from "qrcodejs2";
- export default {
- props: {
- TeachingValue: {
- type: String,
- default: ''
- },
- TeachName: {
- type: Array,
- default: ()=>[]
- }
- },
- data() {
- return {
- origin: '',
- copyText: "",
- copyText2: "",
- noCount: 0,
- pname:[],
- isSuo: true,
- testJson:null,
- show:false,
- };
- },
- computed: {
- reversedMessage() {
- if(!this.testJson)return '-'
- if (this.TeachingValue == '') {
- return this.testJson.juriP ? this.testJson.juriP : '所有人'
- }else{
- // return this.testJson.juriP ? this.testJson.juriP : '所有人'
- return this.TeachName.length>0 ? this.TeachName[0].name : this.testJson.juriP ? this.testJson.juriP : '所有人'
- }
- }
- },
- methods: {
- handleClose(done) {
- this.close();
- done();
- },
- open({testJson}){
- this.testJson = testJson;
- this.isSuo = true
- this.setQr()
- this.getData()
- this.show = true;
- },
- close() {
- this.show = false;
- this.testJson = null;
- },
- setQr() {
- setTimeout(() => {
- let url = "https://beta.cloud.cocorobo.cn/#/testDetail?testid=" + this.testJson.courseId
- this.origin = url
- this.$refs.qrCodeUrl.innerHTML = "";
- var qrcode = new QRCode(this.$refs.qrCodeUrl, {
- text: url, // 需要转换为二维码的内容
- width: 100,
- height: 100,
- colorDark: "#000000",
- colorLight: "#ffffff",
- correctLevel: QRCode.CorrectLevel.H,
- });
- }, 500);
- },
- downQr() {
- // 创建一个虚拟链接,并将 canvas 转换为图片文件
- const link = document.createElement('a');
- link.href = this.$refs.qrCodeUrl.querySelector('img').src;
- link.download = 'qrcode.png';
- // 模拟点击链接进行下载
- link.click();
- },
- copy() {
- this.copyText = "https://beta.cloud.cocorobo.cn/#/testDetail?testid=" + this.testJson.courseId;
- var clipboard = new Clipboard(".tag-read");
- clipboard.on("success", (e) => {
- this.$message.success("复制成功");
- console.log("复制成功");
- clipboard.destroy(); // 释放内存
- });
- clipboard.on("error", (e) => {
- console.log("不支持复制,该浏览器不支持自动复制");
- clipboard.destroy(); // 释放内存
- });
- },
- copy2(){
- let url = "https://beta.cloud.cocorobo.cn/#/testDetail?testid=" + this.testJson.courseId
- this.copyText2 =
- `表单名称:${this.testJson.title}\n表单范围:${this.testJson.juriP ? this.testJson.juriP : '所有人'}\n${this.testJson.overtime ? '截止时间:'+this.testJson.overtime +'\n' : ''}${'未完成人数:'+this.noCount +'\n'}${this.testJson ? '已完成人数:'+this.testJson.worksPerson +'\n' : ''}${this.pname.length ? '未完成名单:'+this.pname.join(',') +'\n' : ''}链接提醒:${url}`;
- var clipboard = new Clipboard(".tag-read2");
- clipboard.on("success", (e) => {
- this.$message.success("复制成功");
- console.log("复制成功");
- clipboard.destroy(); // 释放内存
- });
- clipboard.on("error", (e) => {
- console.log("不支持复制,该浏览器不支持自动复制");
- clipboard.destroy(); // 释放内存
- });
- },
- getData() {
- // if(!this.testJson.juriP){
- // return;
- // }
- let params = {
- id: this.testJson.courseId,
- tea: this.TeachingValue
- };
- this.ajax
- .get(this.$store.state.api + "getTestWorkShareCopy", params)
- .then((res) => {
- console.log('res.datares.datares.datares.datares.datares.data',res.data);
- let parray = res.data[0]
- let is = res.data[1]
- this.noCount = parray.length - is.length
- let isA = []
- for(var i=0;i<is.length;i++){
- isA.push(is[i].userid)
- }
- let pname = []
- for(var i=0;i<parray.length;i++){
- if(isA.indexOf(parray[i].userid) == -1){
- pname.push(parray[i].username)
- }
- }
- this.pname = pname
- })
- .catch((err) => {
- console.error(err);
- });
- }
- },
- mounted(){
- },
- };
- </script>
- <style scoped>
- .dialog_diy>>>.el-dialog {
- /* height: 100%; */
- /* margin: 0 auto !important; */
- }
- .dialog_diy>>>.el-dialog__header {
- background: #fff !important;
- padding: 15px 20px;
- }
- .dialog_diy>>>.el-dialog__body {
- height: calc(100% - 124px);
- box-sizing: border-box;
- padding: 0px;
- }
- .dialog_diy>>>.el-dialog__title {
- color: #000;
- }
- .dialog_diy>>>.el-dialog__headerbtn {
- top: 19px;
- }
- .dialog_diy>>>.el-dialog__headerbtn .el-dialog__close {
- color: #000;
- }
- .dialog_diy>>>.el-dialog__headerbtn .el-dialog__close:hover {
- color: #000;
- }
- .dialog_diy>>>.el-dialog__body,
- .dialog_diy>>>.el-dialog__footer {
- background: #fff;
- }
- .share_box {
- width: 100%;
- height: 100%;
- padding: 0 20px 15px;
- box-sizing: border-box;
- }
- .info_box {
- margin: 0 0 20px;
- }
- .info_box>.info {
- line-height: 18px;
- }
- .info_box>.info>span:nth-child(1) {
- color: #00000099;
- }
- .info_box>.info>span:nth-child(2) {
- color: #000000;
- }
- .info_box>.info+.info {
- margin-top: 10px;
- }
- .url_box {
- margin-bottom: 20px;
- }
- .qrcode_box {
- margin-bottom: 20px;
- }
- .url_box>.url {
- width: 100%;
- display: flex;
- align-items: center;
- border: 1px solid #e7e7e7;
- border-radius: 4px;
- height: 35px;
- padding: 0 7px;
- box-sizing: border-box;
- }
- .url_box>.url>span {
- font-size: 16px;
- color: #000000;
- }
- .url_box>.url>span:nth-child(1) {
- width: 100%;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- .url_box>.url>span:nth-child(2) {
- margin-left: auto;
- border-left: 1px solid #e7e7e7;
- padding-left: 7px;
- cursor: pointer;
- min-width: fit-content;
- }
- .url_box>.title,
- .qrcode_box>.title {
- font-size: 16px;
- font-weight: 700;
- margin-bottom: 10px;
- }
- .qrcode_box>.qrcode {
- padding: 7px;
- border: 1px solid #e7e7e7;
- width: fit-content;
- border-radius: 4px;
- display: flex;
- align-items: flex-end;
- }
- .qrcode_box>.qrcode>span:nth-child(1) {
- width: 100px;
- display: block;
- height: 100px;
- }
- .qrcode_box>.qrcode>span:nth-child(2) {
- background: #f0f2f5;
- padding: 7px 15px;
- font-size: 16px;
- border-radius: 4px;
- cursor: pointer;
- color: #000;
- margin-left: 7px;
- }
- .btn_box{
- display: flex;
- justify-content: flex-end;
- }
- .more{
- cursor: pointer;
- color: #0061ff;
- }
- </style>
|