popup.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  1. <template>
  2. <view>
  3. <!-- 弹窗 -->
  4. <view class="bgbox" @click="getClose" v-if="type"></view>
  5. <!-- 确认弹窗 -->
  6. <view class="confirmbox flexdc" v-if="type==1">
  7. <view class="tit flex0">{{confdat.tit}}</view>
  8. <view class="txt">{{confdat.txt}}</view>
  9. <view class="cfbtn flex ">
  10. <view class="cbtn btn1" @click="getClose">{{confdat.closetxt}}</view>
  11. <view class="cbtn btn2" @click="getConfirm">{{confdat.suretxt}}</view>
  12. </view>
  13. </view>
  14. <!-- 延迟弹窗 -->
  15. <view class="chec_time yc_time" v-if="type==9">
  16. <view class="f17 co16 fw">延迟放学</view>
  17. <view class="time_par">
  18. <view class="pr che_box flexc">
  19. <picker-view :indicator-style="indicatorStyle" :value="value" @change="bindChange" class="picker-view flex1">
  20. <picker-view-column>
  21. <view class="item" v-for="(item,index) in timelist" :key="index">
  22. <view :class="[valarr[0]==index?'pickerSelected':'','u-line-1']">{{item.dictLabel}}</view>
  23. </view>
  24. </picker-view-column>
  25. </picker-view>
  26. <text class="f16 co16 fw flex0">分钟</text>
  27. </view>
  28. <!-- <view class="txt"><text>*</text>提前延迟指 在选择的延迟放学时间上提前多久放学。</view> -->
  29. </view>
  30. <view class="cfbtn flex ">
  31. <view class="cbtn btn1" @click="getClose">取消</view>
  32. <view class="cbtn btn2" @click="getyanKeyFn(2)">确认延迟</view>
  33. </view>
  34. <image :src="closeimg" class="cloimg" @click="getClose"></image>
  35. </view>
  36. <!-- 完善 -->
  37. <view class="perfect" v-if="type==2">
  38. <image :src="bgimg" class="bgimg"></image>
  39. <view class="pbox flexdc">
  40. <view class="tit mb24">温馨提示</view>
  41. <view class="txt ptb10 flexc">您还未填写学校信息 请您尽快去完善</view>
  42. <view class="pbtn btn1">去完善</view>
  43. <view class="pbtn btn2">稍后完善</view>
  44. </view>
  45. <image :src="closeimg" class="cloimg" @click="getClose"></image>
  46. </view>
  47. <!-- 调整时间 延时放学-->
  48. <view class="chec_time" v-if="type==3">
  49. <view class="f17 co16 fw">放学时间</view>
  50. <view class="pr che_box flexc">
  51. <picker-view :indicator-style="indicatorStyle" :value="value" @change="bindChange" class="picker-view flex1">
  52. <picker-view-column>
  53. <view class="item" v-for="(item,index) in timelist" :key="index">
  54. <view :class="[valarr[0]==index?'pickerSelected':'','u-line-1']">{{item.dictLabel}}</view>
  55. </view>
  56. </picker-view-column>
  57. </picker-view>
  58. <text class="f16 co16 fw flex0">分钟</text>
  59. </view>
  60. <view class="pbtn btn1" @click="getKeyFn">确定</view>
  61. <view class="txt"><text>*</text>指首页准备放学按钮点击后,根据设置 的放学时间后放学,默认为5分钟。</view>
  62. <image :src="closeimg" class="cloimg" @click="getClose"></image>
  63. </view>
  64. <!-- 注册成功 -->
  65. <view class="perfect" v-if="type==4">
  66. <image :src="bgimg" class="bgimg"></image>
  67. <view class="pbox flexdc" style="padding-bottom: 80rpx;">
  68. <view class="tit mb24">{{regdat.tit}}</view>
  69. <view class="txt ptb10 flexc">{{regdat.txt}}</view>
  70. <view class="pbtn btn1" @click="getregfn(regdat.type)">{{regdat.btn}}</view>
  71. <!-- <view class="pbtn btn2">稍后完善</view> -->
  72. </view>
  73. <image :src="closeimg" class="cloimg" @click="getClose"></image>
  74. </view>
  75. <!-- 选择班级 -->
  76. <view class="chec_time" v-if="type==5" style="min-height: 416rpx;margin-top: -300rpx;">
  77. <view class="f17 co16 fw">选择班级</view>
  78. <picker @change="bindPickerChange" range-key='dictLabel' :value="classindex" :range="teacherClass">
  79. <view class="checkpick">
  80. <view class="f16 co16 fw mr10 flex0">班级</view>
  81. <view :class="className?'flex1':'coa flex1'">{{className||"请选择班级"}}</view>
  82. <image :src="upimg"></image>
  83. </view>
  84. </picker>
  85. <view class="pbtn btn1" @click="getKeyNext">下一步</view>
  86. <!-- <view class="txt"><text>*</text>指首页准备放学按钮点击后,根据设置 的放学时间后放学,默认为5分钟。</view> -->
  87. <image :src="closeimg" class="cloimg" @click="getClose"></image>
  88. </view>
  89. <!-- 审核弹窗 -->
  90. <!-- 审核意见 -->
  91. <view class="chec_shyj" v-if="type==6">
  92. <view class="f17 co16 fw">拒绝理由</view>
  93. <view class="boxs">
  94. </view>
  95. <view class="shbox ">
  96. <textarea style="height: 256rpx;" v-model="shyj" placeholder="请输入反馈意见,限200 字内…" maxlength="200" class="textar"></textarea>
  97. </view>
  98. <view class="pbtn btn1" @click="getyjSubmit">提交</view>
  99. <image :src="closeimg" class="cloimg" @click="getClose"></image>
  100. </view>
  101. <!-- 调课弹窗 -->
  102. <view class="confirmbox flexdc" v-if="type==7" style="margin-top: -40%;">
  103. <view class="tit flex0">调课信息</view>
  104. <view class="tkbox">
  105. <view>调课信息:{{formdata.subjectTime}}{{formdata.subject}}</view>
  106. <view>被调课信息:{{formdata.beSubjectTime}}{{formdata.beSubject}}</view>
  107. <view>调课内容:
  108. <textarea v-model="content" placeholder="请输入调课内容,例:5月16日星期二的英语课与 5月18日周四的语文课调换…" maxlength="200" class="textarea"></textarea>
  109. </view>
  110. </view>
  111. <view class="cfbtn flex ">
  112. <view class="cbtn btn1" @click="getClose">取消</view>
  113. <view class="cbtn btn2" @click="getConfirm">确认</view>
  114. </view>
  115. </view>
  116. <!-- 预约码 -->
  117. <view class="invbox" v-if="type==8">
  118. <view class="tit">预约码</view>
  119. <view class="img">
  120. <image :src="yycode" @click="getPreview(yycode)"></image>
  121. </view>
  122. <view class="txt">
  123. <text>*</text>此预约码为来访者预约登记码,将此码发送给来访者,即可扫码预约
  124. </view>
  125. <view class="btn" @click="getSaver">保存至手机</view>
  126. <image :src="closeimg" class="cloimg" @click="getClose"></image>
  127. </view>
  128. <!-- 9已用 延迟放学 -->
  129. <!-- 视频播放 -->
  130. <!-- <view class="videobox" v-if="type==4">
  131. <video id="myVideo" src="https://img.cdn.aliyun.dcloud.net.cn/guide/uniapp/%E7%AC%AC1%E8%AE%B2%EF%BC%88uni-app%E4%BA%A7%E5%93%81%E4%BB%8B%E7%BB%8D%EF%BC%89-%20DCloud%E5%AE%98%E6%96%B9%E8%A7%86%E9%A2%91%E6%95%99%E7%A8%8B@20200317.mp4"
  132. @fullscreenchange="fullscreenchange" controls></video>
  133. </view> -->
  134. </view>
  135. </template>
  136. <script>
  137. export default{
  138. props:{
  139. type: {
  140. type: Number,
  141. default () {
  142. return 0
  143. }
  144. },
  145. teacherClass:{
  146. type: Array,
  147. default () {
  148. return []
  149. }
  150. },
  151. timetit:{},
  152. timelist:{
  153. type: Array,
  154. default () {
  155. return []
  156. }
  157. },
  158. yycode:{
  159. type: String,
  160. default () {
  161. return ''
  162. }
  163. },
  164. shyjflag:{
  165. type: Boolean,
  166. default () {
  167. return true
  168. }
  169. },
  170. confdat:{tit:'确认放学',txt:"是否确认准备放学?",closetxt:'我点错啦',suretxt:'确认放学'},
  171. regdat:{tit:'',txt:'',btn:"",type:''},
  172. formdata:{"subjectClassId": "","subjectClass": "","subject": "","isNum":"","subjectTime":"","subjectWeek":"","beSubject": "","beIsNum": "","beSubjectTime":"","week": "","content":''},
  173. // status:{
  174. // type: String,
  175. // default () {
  176. // return 'add'
  177. // }
  178. // },
  179. // iteminfo:{},
  180. // xmjzinfo:{},
  181. },
  182. watch:{
  183. timetit(val){
  184. var newArr=this.timelist;
  185. var newsArr=[]
  186. Object.keys(newArr).some((key) => {
  187. if (newArr[key].dictLabel == ('' + val)) {
  188. newsArr[0]=Number(key)
  189. this.value=newsArr;
  190. this.valarr=newsArr;
  191. return true;
  192. }
  193. })
  194. },
  195. type(val){
  196. this.shyj='';
  197. this.content='';
  198. this.valarr=[0];
  199. if((val==3||val==9)&&this.timetit){
  200. var newArr=this.timelist;
  201. var newsArr=[]
  202. Object.keys(newArr).some((key) => {
  203. if (newArr[key].dictLabel == ('' + this.timetit)) {
  204. newsArr[0]=Number(key)
  205. this.value=newsArr;
  206. this.valarr=newsArr;
  207. return true;
  208. }
  209. })
  210. }
  211. }
  212. },
  213. data(){
  214. return{
  215. // type:0,
  216. bgimg:require("@/static/images/popbg.png"),
  217. closeimg:require("@/static/images/close.png"),
  218. upimg:require("@/static/images/upicon.png"),
  219. // confdat:{tit:'确认放学',txt:"是否确认准备放学?",closetxt:'我点错啦',suretxt:'确认放学'},
  220. videoContext:'',
  221. value:[0],
  222. valarr:[0],
  223. visible: true,
  224. indicatorStyle: `height: 90rpx;color:#4775EA;`,
  225. classindex:0,
  226. className:'',
  227. classId:'',
  228. shyj:'',
  229. content:'',
  230. }
  231. },
  232. mounted() {
  233. // this.valarr=this.timetit
  234. // #ifndef MP-ALIPAY
  235. // this.videoContext = uni.createVideoContext('myVideo')
  236. // this.videoContext.requestFullScreen();
  237. // #endif
  238. },
  239. methods:{
  240. getClose(){
  241. this.$emit("getClose")
  242. // console.log(1)
  243. // this.type=0;
  244. },
  245. getPreview(url) {
  246. var newArr=[];
  247. newArr.push(url)
  248. uni.previewImage({
  249. urls: newArr,
  250. current:0,
  251. success: function(data) {
  252. },
  253. fail: function(err) {
  254. }
  255. });
  256. },
  257. getSaver(){
  258. // #ifdef H5
  259. // 将base64格式的图片转换成Blob对象
  260. var arr = this.yycode.split(","),
  261. mime = arr[0].match(/:(.*?);/)[1],
  262. bstr = atob(arr[1]),
  263. n = bstr.length,
  264. u8arr = new Uint8Array(n);
  265. while (n--) {
  266. u8arr[n] = bstr.charCodeAt(n);
  267. }
  268. // 将Blob对象转换成文件并下载到本地
  269. var blob = new Blob([u8arr], {
  270. type: mime
  271. });
  272. var a = document.createElement('a');
  273. a.download = 'qrcode';
  274. a.href = URL.createObjectURL(blob);
  275. a.click();
  276. // #endif
  277. // #ifndef H5
  278. uni.getSetting({//获取用户的当前设置
  279. success:(res)=> {
  280. if(res.authSetting['scope.writePhotosAlbum']){//验证用户是否授权可以访问相册
  281. this.saveImageToPhotosAlbum();
  282. }else{
  283. uni.authorize({//如果没有授权,向用户发起请求
  284. scope: 'scope.writePhotosAlbum',
  285. success:()=> {
  286. this.saveImageToPhotosAlbum();
  287. },
  288. fail:()=>{
  289. uni.showToast({
  290. title:"请打开保存相册权限,再点击保存相册分享",
  291. icon:"none",
  292. duration:3000
  293. });
  294. setTimeout(()=>{
  295. uni.openSetting({//调起客户端小程序设置界面,让用户开启访问相册
  296. success:(res2)=> {
  297. // console.log(res2.authSetting)
  298. }
  299. });
  300. },3000);
  301. }
  302. })
  303. }
  304. }
  305. })
  306. // #endif
  307. },
  308. saveImageToPhotosAlbum(){
  309. let base64=this.yycode.replace(/^data:image\/\w+;base64,/, "");//去掉data:image/png;base64,
  310. let filePath=wx.env.USER_DATA_PATH + '/qrcode.png';
  311. uni.getFileSystemManager().writeFile({
  312. filePath:filePath , //创建一个临时文件名
  313. data: base64, //写入的文本或二进制数据
  314. encoding: 'base64', //写入当前文件的字符编码
  315. success: res => {
  316. uni.saveImageToPhotosAlbum({
  317. filePath: filePath,
  318. success: function(res2) {
  319. uni.showToast({
  320. title: '保存成功,请从相册选择再分享',
  321. icon:"none",
  322. duration:5000
  323. })
  324. },
  325. fail: function(err) {
  326. // console.log(err.errMsg);
  327. }
  328. })
  329. },
  330. fail: err => {
  331. //console.log(err)
  332. }
  333. })
  334. },
  335. getyjSubmit(){
  336. if(!this.shyj&&this.shyjflag){
  337. this.$toast("请输入审核意见")
  338. return
  339. }
  340. this.$emit("getyjSubmit",this.shyj)
  341. },
  342. getregfn(e){
  343. this.$emit("getregfn",e)
  344. },
  345. getConfirm(){
  346. this.$emit("getConfirm",this.content)
  347. // this.$tab.navigateTo(`/mine/pages/login/register`)
  348. // this.$tab.navigateTo(`/pages/logines`)
  349. },
  350. bindPickerChange(e){
  351. var val=e.detail.value;
  352. this.className=this.teacherClass[val].dictLabel
  353. this.classId=this.teacherClass[val].dictValue
  354. },
  355. getyanKeyFn(id){
  356. var value=this.valarr[0];
  357. var str=this.timelist[value].dictLabel;
  358. this.$emit('getyanKeyFn',str)
  359. },
  360. getKeyFn(){
  361. var value=this.valarr[0];
  362. var str=this.timelist[value].dictLabel;
  363. if(str==this.timetit){
  364. this.$emit('getClose')
  365. }else{
  366. this.$emit('getKeyFn',str)
  367. }
  368. },
  369. getKeyNext(){
  370. this.$emit('getKeyNext',this.classId)
  371. },
  372. bindChange(e){
  373. this.valarr=e.detail.value;
  374. // console.log(e)
  375. // const val = e.detail.value
  376. // this.year = this.years[val[0]]
  377. // this.month = this.months[val[1]]
  378. // this.day = this.days[val[2]]
  379. },
  380. fullscreenchange (e){
  381. if(!e.detail.fullScreen){
  382. this.videoContext.stop()
  383. }
  384. }
  385. }
  386. }
  387. </script>
  388. <style lang="scss" scoped>
  389. // 公共
  390. .pbtn{text-align: center;font-size: 30rpx;font-weight: 500;flex:0 0 auto;
  391. &.btn1{background: #1f57e6;color: #ffffff;height: 70rpx;border-radius: 35rpx;line-height: 70rpx;width: 100%;}
  392. &.btn2{color: #aaa;margin-top: 14rpx;padding:10rpx;}
  393. }
  394. .cloimg{width: 56rpx;height: 56rpx;position: absolute;bottom: -80rpx;left: 50%;margin-left: -28rpx;}
  395. // end
  396. .perfect{
  397. position: fixed;left: 82rpx;right: 82rpx;height: 550rpx;top: 50%;margin-top: -340rpx;border-radius: 24rpx;z-index: 10;
  398. .bgimg{width: 100%;height: 100%;}
  399. .pbox{position: absolute;left: 0;top: 0;right: 0;bottom: 0;padding: 32rpx 68rpx;box-sizing: border-box;z-index: 5;
  400. .tit{font-size: 34rpx;font-weight: bold;
  401. color: #FFFFFF;text-align: center;flex: 0 0 auto;}
  402. .txt{font-size: 32rpx;font-weight: 500;color: #161616;flex: 1;text-align: center;}
  403. }
  404. }
  405. .confirmbox{
  406. position: fixed;left: 82rpx;right: 82rpx;min-height: 300rpx;top: 50%;margin-top: -30%;border-radius: 24rpx;z-index: 10;background-color: #ffffff;padding-top: 30rpx;box-sizing: border-box;text-align: center;
  407. .tit{font-size: 34rpx;font-weight: bold;
  408. color: #161616;line-height: 48rpx;}
  409. .txt{font-size: 32rpx;color: #161616;flex: 1;padding: 28rpx;display: flex;align-items: center;justify-content: center;line-height: 48rpx;}
  410. .cfbtn{border-top: 2rpx solid #DDDDDD;flex: 0 0 auto;
  411. .cbtn{width: 50%;height: 88rpx;line-height: 88rpx;
  412. &.btn1{font-size: 32rpx;font-weight: 500;
  413. color: #AAAAAA;position: relative;
  414. &::after{position: absolute;right: 1rpx;top: 0;bottom: 0;content: "";width: 2rpx;background-color: #DDDDDD;;}
  415. }
  416. &.btn2{font-size: 32rpx;font-weight: 500;
  417. color: #4775EA;}
  418. }
  419. }
  420. }
  421. // 时间选择
  422. .chec_time{position: fixed;left: 126rpx;right: 126rpx;min-height: 660rpx;top: 50%;margin-top: -400rpx;border-radius: 14rpx;z-index: 10;background-color: #ffffff;padding: 48rpx 46rpx 54rpx;box-sizing: border-box;text-align: center;
  423. // .chec_over{max-height: calc(100% - 400rpx) ;overflow: auto;}
  424. .che_box{padding-left: 80rpx;
  425. .picker-view {height: 300rpx;margin: 20rpx 0rpx;width: 100%;flex: 1;
  426. .item {line-height: 90rpx;text-align: center;
  427. .pickerSelected{font-size: 40rpx;font-weight: bold;color: #4775EA;}
  428. }
  429. }
  430. }
  431. .txt{margin-top: 32rpx;
  432. font-size: 24rpx;color: #666666;
  433. text{font-size: 32rpx;color: #DF0024;margin-right: 6rpx;}
  434. }
  435. // 延迟提前
  436. &.yc_time{
  437. padding:48rpx 0 0rpx;min-height:auto;
  438. .time_par{padding:0 46rpx;
  439. .txt{text-align:left;margin:0 0 24rpx;}
  440. }
  441. .cfbtn{border-top: 2rpx solid #DDDDDD;flex: 0 0 auto;
  442. .cbtn{width: 50%;height: 88rpx;line-height: 88rpx;
  443. &.btn1{font-size: 32rpx;font-weight: 500;color: #AAAAAA;position: relative;
  444. &::after{position: absolute;right: 1rpx;top: 0;bottom: 0;content: "";width: 2rpx;background-color: #DDDDDD;;}
  445. }
  446. &.btn2{font-size: 32rpx;font-weight: 500;color: #4775EA;}
  447. }
  448. }
  449. }
  450. }
  451. .checkpick{display: flex;align-items: center;border-bottom: 2rpx solid #FFB132;flex-direction: row;margin: 40rpx auto 76rpx;width: 100%;padding: 32rpx 0;
  452. image{width: 22rpx;height: 12rpx;flex: 0 0 auto;margin-left: 16rpx;}
  453. }
  454. .chec_shyj{position: fixed;left: 82rpx;right: 82rpx;height: 560rpx;top: 50%;margin-top: -380rpx;border-radius: 14rpx;z-index: 10;background-color: #ffffff;padding: 48rpx 46rpx 54rpx;box-sizing: border-box;text-align: center;
  455. .shbox{
  456. .textar{width: 100%;border: 2rpx solid #FF6400;border-radius: 10rpx;padding: 26rpx 30rpx;font-size: 30rpx;color: #343434;height: 376rpx;margin: 40rpx 0;text-align: left;}
  457. }
  458. }
  459. //调课
  460. .tkbox{flex: 1;text-align: left;display: flex;flex-direction: column;padding:20rpx;
  461. view{font-size: 32rpx;color: #161616;padding: 6rpx 0;}
  462. }
  463. .textarea{width: 100%;border: 2rpx solid #FF6400;border-radius: 10rpx;padding: 26rpx 30rpx;font-size: 30rpx;color: #343434;height: 200rpx;margin: 20rpx 0;text-align: left;}
  464. // 预约码
  465. .invbox{
  466. position: fixed;left: 126rpx;right: 126rpx;background: #ffffff;border-radius: 14rpx;min-height: 640rpx;padding: 44rpx 46rpx 48rpx;box-sizing: border-box;top: 50%;z-index: 10;transform: translateY(-50%);margin-top: -60rpx;
  467. .tit{font-size: 34rpx;font-weight: bold;color: #161616;margin-bottom: 16rpx;text-align: center;line-height: 48rpx;}
  468. .img{width: 280rpx;height: 280rpx;margin: 0 auto 16rpx;
  469. image{width: 100%;height: 100%;}
  470. }
  471. .txt{font-size: 28rpx;color: #AAAAAA;display: flex;align-items: flex-start;line-height: 40rpx;
  472. text{color: #F7082E;flex: 0 0 auto;}
  473. }
  474. .btn{width:100%;height: 72rpx;background: #4775EA;border-radius: 36rpx;text-align: center;line-height: 72rpx;font-size: 30rpx;font-weight: 500;margin-top:36rpx;
  475. color: #FFFFFF;
  476. }
  477. }
  478. // 全屏的视频播放
  479. .videobox /deep/ uni-video{width: 100% !important;}
  480. </style>