第60篇一对多之学生端私有白板图片保存及学生传数组过去不再单张传周三

本文主要是介绍第60篇一对多之学生端私有白板图片保存及学生传数组过去不再单张传周三,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

关键词:学生端私有白板图片保存,学生传数组过去不再单张传

一、私有白板向老师端传图片数据

1.1 服务器运行平台

老师端:https://localhost:9101/demos/index.html?roomid=888&t=600

学生一:

https://localhost:9101/demos/student.html?studentId=1001&userAvatar=http://123.57.206.36:8003/uploadfiles/2016/11/1479740395ZMJkiF.jpg&t=600#888

学生二:                   

https://localhost:9101/demos/student.html?studentId=1002&userAvatar=http://123.57.206.36:8003/uploadfiles/2016/11/1480494624FDjMGetutor.png&t=600#888

学生三:

https://localhost:9101/demos/student.html?studentId=1003&userAvatar=http://123.57.206.36:8003/uploadfiles/2016/11/1480475198N2F0kntutor.png&t=600#888

1.2学生端同样的私有白板图片只上传一张到老师端私有白板

  1)问题描述

    现在学生端获取私有白板上图片时,学生点一次“下一张”,这张图片就上传到了老师端,并清空了白板,但没写东西,再次点的话,可能就上传了一张空页到老师端,需要控制一下。

1.3学生端私有白板图片保存

  1描述

学生端私有白板,学生要保存一份过往图片,供自己查看。

2实现代码如下:

  adiv及查看按钮如下:----------------------student.html中

        <divid="picWrap_student_private">

        </div>

<li><a id="seeStuPriWB"οnclick="getStuPriWB();">查看</a></li>

  b控制函数----------------------student.html中

    //2)获取私有白板图片数据供学生自己查看--------------------------------------2)

    function getStuPriWB() {

        var content =$("#picWrap_student_private").html();

       if(isArray(stuPriDataURLArr)&&stuPriDataURLArr.length){

            for(var i = 0; i<stuPriDataURLArr.length; i++){

                var dataURLPri= stuPriDataURLArr[i];

                varpageIndexPri = i + 1;

                varimgContentPri = ' <divclass="img_div_student_private"><img  id= "student_arr_base64_img_pri' +pageIndexPri + '" name="thumbnail_student_pri"class="tea_base64_student_pri tea_base64_select_student_pri"src="' + dataURLPri + '"><divclass="page_index_div_student_private">' + pageIndexPri +'</div> </div>';

               $(imgContentPri).appendTo($("#picWrap_student_private"));

            }

        }

    }

注:还有一个问题是,学生在查看私有白板时,允许他修改,并且能把修改的图片替换掉原来的图片上传老师端,还要在学生端私有白板主页上显示。

1.4 老师拉学生私有白板到共享白板上

1描述

  老师查看学生的私有白板上的内容,要给学生讲时,要拉到共享白板上去。

2学生传数组过去,不再单张传

  实现了代码如下:

a.学生端每次点下一张存到数组里---student.html

//3)学生端私有白板每次点下一张,图片存入一个数组中,并清空白板-----------------3)    stuPriDataURLArr = newArray();

   function studentPriDataURL(){

       designer.saveImgPrivate('image/png',studentId,function(dataURL,studentId) {

           stuPriDataURLArr.push(dataURL);

       });

       //清空学生端私有白板

       designer.undoPrivate();

    }

 

b.老师要看哪个学生的作业,先发消息请求--------index.html

  $('#btn-getDataURL_StuPri').click(function() {

             connection.send({askStudentId:1001});

   });

c.id为1001的学生接到消息后,把数组传过去----student.html

   if (event.data.askStudentId == studentId) {

       connection.send({

           studentPri: true,

           studentId:studentId,

           stuPriDataURLArr: stuPriDataURLArr

       });

    }

d.老师收到数组后,展示出来--------------------index.html

   //获取指定学生私有白板图片数组并展示

   if (event.data.studentPri) {

       //把学生id及学生传过来的私有白板图片追加到数组中,供老师查看

       var stuPriUrlIdArray = event.data.stuPriDataURLArr;

       if(isArray(stuPriUrlIdArray) && stuPriUrlIdArray.length)

       for (var i = 0; i < stuPriUrlIdArray.length; i++) {

           if(isArray(stuPriUrlIdArray)){

                              dataURL_Pri =stuPriUrlIdArray[i];

                                   var j = i+1;

                                   varpageIndexPri = i + 1;

                                   varimgContentPri = ' <span class="img_divStuPritea_base64_selectStuPri"><img id= "arr_base64_imgStuPri' + j + '"src = "'+dataURL_Pri+'" name="thumbnailStuPri" class="tea_base64StuPri"><span class="page_index_divStuPri">' + pageIndexPri +'</span> </span>';

                                   $(imgContentPri).appendTo($("#picWrapStuPriPic.picContentStuPri"));

                                   $(".tea_base64StuPri").off("click");

                                   $(".tea_base64StuPri").on("click",onImgClickPrivate);

           }

      }

        stuPriUrlIdArray = [];

       return;

    }

3)学生私有白板数组加到老师共享白板上去

二、php

2.1PHP array_search() 函数

1定义和用法

array_search() 函数在数组中搜索某个键值,并返回对应的键名。

2语法

array_search(value,array,strict)

3)看个例子一如下:

注:这个函数用于搜索一个数组中的值,返回一个键名,第三个参数(默认为false)为true,则比较值和类型,为false则只比较值。为false时,如果存在多个相同的值,则仅返回最前面的那个,如下:

2017年3月1日星期三

这篇关于第60篇一对多之学生端私有白板图片保存及学生传数组过去不再单张传周三的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/587305

相关文章

JAVA读取MongoDB中的二进制图片并显示在页面上

1:Jsp页面: <td><img src="${ctx}/mongoImg/show"></td> 2:xml配置: <?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001

代码随想录算法训练营:12/60

非科班学习算法day12 | LeetCode150:逆波兰表达式 ,Leetcode239: 滑动窗口最大值  目录 介绍 一、基础概念补充: 1.c++字符串转为数字 1. std::stoi, std::stol, std::stoll, std::stoul, std::stoull(最常用) 2. std::stringstream 3. std::atoi, std

在服务器上浏览图片

@StarSky 2018-10-26 15:09 字数 15971 阅读 28 https://www.zybuluo.com/StarSky/note/1294871 来源 2018-09-27 线上服务器安装 imgcat Tool   2018-09-27 线上服务器安装 imgcat 0. 准备文件:iterm2_shell_integration.bash1. 在有权限

剑指offer(C++)--数组中只出现一次的数字

题目 一个整型数组里除了两个数字之外,其他的数字都出现了两次。请写程序找出这两个只出现一次的数字。 class Solution {public:void FindNumsAppearOnce(vector<int> data,int* num1,int *num2) {int len = data.size();if(len<2)return;int one = 0;for(int i

设置android返回键,保存和取得最高分

1.在.h中声明一些方法 virtual void keyBackClicked();           //Android返回键 bool isHaveSaveFile(); void getHighestHistoryScore(); 在.cpp中实现这个几个方法 void WelcomeLayer::keyBackClicked(

IOS 数组去重的几种方式

本来只知道NSSet和KeyValues的。今天又新学了几种方式 还有就是和同事学的一种方式 外层循环从0开始遍历,内层从最后一个元素开始遍历 for(int i=0;i<index;i++){  for(int j=index-1;j>i;j-- ){ } }

el-upload 上传图片及回显照片和预览图片,文件流和http线上链接格式操作

<div v-for="(info, index) in zsjzqwhxqList.helicopterTourInfoList" :key="info.id" >编辑上传图片// oss返回线上地址http链接格式:<el-form-itemlabel="巡视结果照片":label-width="formLabelWidth"><el-upload:action="'http:

Java基础(二)——数组,方法,方法重载

个人简介 👀个人主页: 前端杂货铺 ⚡开源项目: rich-vue3 (基于 Vue3 + TS + Pinia + Element Plus + Spring全家桶 + MySQL) 🙋‍♂️学习方向: 主攻前端方向,正逐渐往全干发展 📃个人状态: 研发工程师,现效力于中国工业软件事业 🚀人生格言: 积跬步至千里,积小流成江海 🥇推荐学习:🍖开源 rich-vue3 🍍前端面试

【教师资格证考试综合素质——法律专项】学生伤害事故处理办法以及未成人犯罪法笔记相关练习题

目录 《学生伤害事故处理办法》 第一章 总 则 第二章 事故与责任 (谁有错,谁担责) 第三章  事故处理程序 第四章 事故损害的赔偿 第五章 事故责任者的处理 第六章 附 则 《中华人民共和国预防未成人犯罪法》 第一章 总 则 第二章 预防犯罪的教育 第三章 对不良行为的干预 第四章 对严重不良行为的矫治 第五章 对重新犯罪的预防 第六章法律责任 第七章 附 则

poj 3882(Stammering Aliens) 后缀数组 或者 hash

后缀数组:  构建后缀数组,注意要在字符串莫末尾加上一个没出现过的字符。然后可以2分或者直接扫描,直接扫描需要用单调队列来维护 VIEW CODE #include<cstdio>#include<algorithm>#include<iostream>#include<cmath>#include<queue>#include<stack>#include<string