正在显示
26 个修改的文件
包含
4850 行增加
和
0 行删除
.gitignore
0 → 100644
App.vue
0 → 100644
| 1 | +<script> | ||
| 2 | + import Vue from 'vue' | ||
| 3 | + import { | ||
| 4 | + mapState, | ||
| 5 | + mapMutations | ||
| 6 | + } from 'vuex' | ||
| 7 | + var that | ||
| 8 | + export default { | ||
| 9 | + onLaunch: function() { | ||
| 10 | + that=this | ||
| 11 | + console.log('App Launch') | ||
| 12 | + var token=uni.getStorageSync('token') | ||
| 13 | + // if(token){ | ||
| 14 | + // var identity=uni.getStorageSync('identity') | ||
| 15 | + // if(identity==2){ | ||
| 16 | + // uni.reLaunch({ | ||
| 17 | + // url:'/pages/tch_index/tch_index' | ||
| 18 | + // }) | ||
| 19 | + // }else if(identity==1){ | ||
| 20 | + // uni.switchTab({ | ||
| 21 | + // url:'/pages/index/index' | ||
| 22 | + // }) | ||
| 23 | + // } else { | ||
| 24 | + // uni.reLaunch({ | ||
| 25 | + // url:'/pages/admin_index/admin_index' | ||
| 26 | + // }) | ||
| 27 | + // } | ||
| 28 | + // } | ||
| 29 | + | ||
| 30 | + uni.getSystemInfo({ | ||
| 31 | + success: function(e) { | ||
| 32 | + that.$store.commit('setplatform',e.platform) | ||
| 33 | + // #ifndef MP | ||
| 34 | + Vue.prototype.StatusBar = e.statusBarHeight; | ||
| 35 | + if (e.platform == 'android') { | ||
| 36 | + Vue.prototype.CustomBar = e.statusBarHeight + 50; | ||
| 37 | + } else { | ||
| 38 | + Vue.prototype.CustomBar = e.statusBarHeight + 45; | ||
| 39 | + }; | ||
| 40 | + // #endif | ||
| 41 | + // #ifdef MP-WEIXIN | ||
| 42 | + Vue.prototype.StatusBar = e.statusBarHeight; | ||
| 43 | + let custom = wx.getMenuButtonBoundingClientRect(); | ||
| 44 | + Vue.prototype.Custom = custom; | ||
| 45 | + Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight; | ||
| 46 | + // #endif | ||
| 47 | + // #ifdef MP-ALIPAY | ||
| 48 | + Vue.prototype.StatusBar = e.statusBarHeight; | ||
| 49 | + Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight; | ||
| 50 | + // #endif | ||
| 51 | + } | ||
| 52 | + }) | ||
| 53 | + }, | ||
| 54 | + onShow: function() { | ||
| 55 | + console.log('App Show') | ||
| 56 | + }, | ||
| 57 | + onHide: function() { | ||
| 58 | + console.log('App Hide') | ||
| 59 | + } | ||
| 60 | + } | ||
| 61 | +</script> | ||
| 62 | + | ||
| 63 | +<style> | ||
| 64 | + /* @import "@/uni_modules/uview-ui/index.scss"; */ | ||
| 65 | + @import "./static/iconfont.css"; | ||
| 66 | + | ||
| 67 | + /* @font-face { | ||
| 68 | + font-style: normal; | ||
| 69 | + font-family: DINCond-Bold; | ||
| 70 | + src: url("/static/font/DINCond-Bold.otf"); | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + @font-face { | ||
| 74 | + font-style: normal; | ||
| 75 | + font-family: PingFang SC; | ||
| 76 | + src: url("/static/font/PingFang Medium.ttf"); | ||
| 77 | + } */ | ||
| 78 | + | ||
| 79 | + /*每个页面公共css */ | ||
| 80 | + uni-page-body, | ||
| 81 | + html, | ||
| 82 | + body { | ||
| 83 | + margin: 0; | ||
| 84 | + font-family: PingFang SC, DINCond-Bold, '微软雅黑'; | ||
| 85 | + background-color: #F8F8F8; | ||
| 86 | + box-sizing: border-box; | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + * { | ||
| 90 | + margin: 0; | ||
| 91 | + padding: 0; | ||
| 92 | + box-sizing: border-box; | ||
| 93 | + -webkit-box-sizing: border-box; | ||
| 94 | + -moz-box-sizing: border-box; | ||
| 95 | + letter-spacing: 2rpx; | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + view, | ||
| 99 | + text, | ||
| 100 | + input { | ||
| 101 | + box-sizing: border-box; | ||
| 102 | + -webkit-box-sizing: border-box; | ||
| 103 | + -moz-box-sizing: border-box; | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + button { | ||
| 107 | + margin: 0; | ||
| 108 | + padding: 0; | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + button::after { | ||
| 112 | + border: none; | ||
| 113 | + margin: 0; | ||
| 114 | + padding: 0; | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + .flex { | ||
| 118 | + display: flex; | ||
| 119 | + display: -webkit-box; | ||
| 120 | + display: -moz-box; | ||
| 121 | + display: -webkit-flex; | ||
| 122 | + display: -moz-flex; | ||
| 123 | + display: -ms-flexbox; | ||
| 124 | + } | ||
| 125 | + | ||
| 126 | + .area { | ||
| 127 | + width: 694rpx !important; | ||
| 128 | + box-sizing: border-box; | ||
| 129 | + margin: 0 auto; | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + .bottom-of-page { | ||
| 133 | + position: relative; | ||
| 134 | + padding-bottom: 160rpx; | ||
| 135 | + padding-bottom: calc(160rpx + constant(safe-area-inset-bottom)); | ||
| 136 | + padding-bottom: calc(160rpx + env(safe-area-inset-bottom)); | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + .spot { | ||
| 140 | + width: 14rpx; | ||
| 141 | + height: 14rpx; | ||
| 142 | + background: #2D81FF; | ||
| 143 | + border-radius: 50%; | ||
| 144 | + } | ||
| 145 | + | ||
| 146 | + .bottom-button { | ||
| 147 | + /* 底部按钮 */ | ||
| 148 | + box-shadow: 0rpx 4rpx 21rpx 3rpx rgba(153, 153, 153, 0.12); | ||
| 149 | + position: fixed; | ||
| 150 | + bottom: 0; | ||
| 151 | + left: 0; | ||
| 152 | + justify-content: center; | ||
| 153 | + align-items: center; | ||
| 154 | + padding-bottom: constant(safe-area-inset-bottom); | ||
| 155 | + padding-bottom: env(safe-area-inset-bottom); | ||
| 156 | + } | ||
| 157 | + | ||
| 158 | + .uni-input { | ||
| 159 | + color: #333333; | ||
| 160 | + font-size: 26rpx; | ||
| 161 | + } | ||
| 162 | + | ||
| 163 | + .header-wrap { | ||
| 164 | + /* 头部背景色 */ | ||
| 165 | + width: 100%; | ||
| 166 | + min-height: 260rpx; | ||
| 167 | + background: linear-gradient(0deg, #f8f8f8 0%, #ffffff 25%, #5D9DFD 60%, #428EFE 70%, #2D81FF 100%); | ||
| 168 | + position: relative; | ||
| 169 | + padding-top: 20rpx; | ||
| 170 | + } | ||
| 171 | + | ||
| 172 | + .content-wrap { | ||
| 173 | + position: absolute; | ||
| 174 | + top: 28rpx; | ||
| 175 | + left: 50%; | ||
| 176 | + transform: translate(-50%, 0); | ||
| 177 | + } | ||
| 178 | + | ||
| 179 | + .text-single { | ||
| 180 | + /* 单行文本显示省略号*/ | ||
| 181 | + overflow: hidden; | ||
| 182 | + text-overflow: ellipsis; | ||
| 183 | + white-space: nowrap; | ||
| 184 | + } | ||
| 185 | + | ||
| 186 | + .text-retain { | ||
| 187 | + /* 多行文本保留两行 */ | ||
| 188 | + overflow: hidden; | ||
| 189 | + text-overflow: ellipsis; | ||
| 190 | + display: -webkit-box; | ||
| 191 | + -webkit-line-clamp: 2; | ||
| 192 | + -webkit-box-orient: vertical; | ||
| 193 | + } | ||
| 194 | + *{ | ||
| 195 | + box-sizing:border-box; | ||
| 196 | + } | ||
| 197 | + view,text{ | ||
| 198 | + box-sizing:border-box; | ||
| 199 | + letter-spacing: 0; | ||
| 200 | + } | ||
| 201 | + .fwb{ | ||
| 202 | + font-weight: bold; | ||
| 203 | + font-family: PingFang SC, '微软雅黑'; | ||
| 204 | + } | ||
| 205 | + /*每个页面公共css */ | ||
| 206 | + .content { | ||
| 207 | + background: #f8f8f8; | ||
| 208 | + font-family: "微软雅黑"; | ||
| 209 | + } | ||
| 210 | + | ||
| 211 | + .dis_flex { | ||
| 212 | + /* #ifndef APP-PLUS-NVUE */ | ||
| 213 | + display: flex; | ||
| 214 | + /* #endif */ | ||
| 215 | + flex-direction: row; | ||
| 216 | + } | ||
| 217 | + | ||
| 218 | + .dis_flex_c { | ||
| 219 | + /* #ifndef APP-PLUS-NVUE */ | ||
| 220 | + display: flex; | ||
| 221 | + /* #endif */ | ||
| 222 | + flex-direction: column; | ||
| 223 | + } | ||
| 224 | + | ||
| 225 | + .fww { | ||
| 226 | + flex-wrap: wrap; | ||
| 227 | + } | ||
| 228 | + | ||
| 229 | + .aic { | ||
| 230 | + align-items: center; | ||
| 231 | + } | ||
| 232 | + | ||
| 233 | + .ais { | ||
| 234 | + align-items: stretch !important; | ||
| 235 | + } | ||
| 236 | + | ||
| 237 | + .aift { | ||
| 238 | + align-items: flex-start; | ||
| 239 | + } | ||
| 240 | + | ||
| 241 | + .aife { | ||
| 242 | + align-items: flex-end; | ||
| 243 | + } | ||
| 244 | + | ||
| 245 | + .ju_a { | ||
| 246 | + justify-content: space-around; | ||
| 247 | + } | ||
| 248 | + | ||
| 249 | + .ju_b { | ||
| 250 | + justify-content: space-between; | ||
| 251 | + } | ||
| 252 | + | ||
| 253 | + .ju_c { | ||
| 254 | + justify-content: center; | ||
| 255 | + } | ||
| 256 | + | ||
| 257 | + .flex_1 { | ||
| 258 | + flex: 1; | ||
| 259 | + } | ||
| 260 | + | ||
| 261 | + .flex_0 { | ||
| 262 | + flex: none; | ||
| 263 | + } | ||
| 264 | + | ||
| 265 | + .oh1 { | ||
| 266 | + overflow: hidden; | ||
| 267 | + text-overflow: ellipsis; | ||
| 268 | + display: -webkit-box !important; | ||
| 269 | + -webkit-line-clamp: 1; | ||
| 270 | + -webkit-box-orient: vertical; | ||
| 271 | + // text-align: center; | ||
| 272 | + } | ||
| 273 | + | ||
| 274 | + .oh2 { | ||
| 275 | + overflow: hidden; | ||
| 276 | + text-overflow: ellipsis; | ||
| 277 | + display: -webkit-box; | ||
| 278 | + -webkit-line-clamp: 2; | ||
| 279 | + -webkit-box-orient: vertical; | ||
| 280 | + | ||
| 281 | + } | ||
| 282 | + | ||
| 283 | + view { | ||
| 284 | + word-break: break-all; | ||
| 285 | + | ||
| 286 | + word-wrap: break-word; | ||
| 287 | + } | ||
| 288 | + | ||
| 289 | + .oh3 { | ||
| 290 | + overflow: hidden; | ||
| 291 | + text-overflow: ellipsis; | ||
| 292 | + display: -webkit-box; | ||
| 293 | + -webkit-line-clamp: 3; | ||
| 294 | + -webkit-box-orient: vertical; | ||
| 295 | + } | ||
| 296 | + | ||
| 297 | + .oh4 { | ||
| 298 | + overflow: hidden; | ||
| 299 | + text-overflow: ellipsis; | ||
| 300 | + display: -webkit-box; | ||
| 301 | + -webkit-line-clamp: 4; | ||
| 302 | + -webkit-box-orient: vertical; | ||
| 303 | + } | ||
| 304 | + .scroll_x { | ||
| 305 | + width: 100%; | ||
| 306 | + white-space: nowrap; | ||
| 307 | + } | ||
| 308 | + .textarea-uni{ | ||
| 309 | + font-size: 32rpx; | ||
| 310 | + } | ||
| 311 | +</style> |
common/md5.min.js
0 → 100644
| 1 | +/** | ||
| 2 | + * [js-md5]{@link https://github.com/emn178/js-md5} | ||
| 3 | + * | ||
| 4 | + * @namespace md5 | ||
| 5 | + * @version 0.7.3 | ||
| 6 | + * @author Chen, Yi-Cyuan [emn178@gmail.com] | ||
| 7 | + * @copyright Chen, Yi-Cyuan 2014-2017 | ||
| 8 | + * @license MIT | ||
| 9 | + */ | ||
| 10 | +!function(){"use strict";function t(t){if(t)d[0]=d[16]=d[1]=d[2]=d[3]=d[4]=d[5]=d[6]=d[7]=d[8]=d[9]=d[10]=d[11]=d[12]=d[13]=d[14]=d[15]=0,this.blocks=d,this.buffer8=l;else if(a){var r=new ArrayBuffer(68);this.buffer8=new Uint8Array(r),this.blocks=new Uint32Array(r)}else this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.h0=this.h1=this.h2=this.h3=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}var r="input is invalid type",e="object"==typeof window,i=e?window:{};i.JS_MD5_NO_WINDOW&&(e=!1);var s=!e&&"object"==typeof self,h=!i.JS_MD5_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node;h?i=global:s&&(i=self);var f=!i.JS_MD5_NO_COMMON_JS&&"object"==typeof module&&module.exports,o="function"==typeof define&&define.amd,a=!i.JS_MD5_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,n="0123456789abcdef".split(""),u=[128,32768,8388608,-2147483648],y=[0,8,16,24],c=["hex","array","digest","buffer","arrayBuffer","base64"],p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),d=[],l;if(a){var A=new ArrayBuffer(68);l=new Uint8Array(A),d=new Uint32Array(A)}!i.JS_MD5_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!a||!i.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});var b=function(r){return function(e){return new t(!0).update(e)[r]()}},v=function(){var r=b("hex");h&&(r=w(r)),r.create=function(){return new t},r.update=function(t){return r.create().update(t)};for(var e=0;e<c.length;++e){var i=c[e];r[i]=b(i)}return r},w=function(t){var e=eval("require('crypto')"),i=eval("require('buffer').Buffer"),s=function(s){if("string"==typeof s)return e.createHash("md5").update(s,"utf8").digest("hex");if(null===s||void 0===s)throw r;return s.constructor===ArrayBuffer&&(s=new Uint8Array(s)),Array.isArray(s)||ArrayBuffer.isView(s)||s.constructor===i?e.createHash("md5").update(new i(s)).digest("hex"):t(s)};return s};t.prototype.update=function(t){if(!this.finalized){var e,i=typeof t;if("string"!==i){if("object"!==i)throw r;if(null===t)throw r;if(a&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||a&&ArrayBuffer.isView(t)))throw r;e=!0}for(var s,h,f=0,o=t.length,n=this.blocks,u=this.buffer8;f<o;){if(this.hashed&&(this.hashed=!1,n[0]=n[16],n[16]=n[1]=n[2]=n[3]=n[4]=n[5]=n[6]=n[7]=n[8]=n[9]=n[10]=n[11]=n[12]=n[13]=n[14]=n[15]=0),e)if(a)for(h=this.start;f<o&&h<64;++f)u[h++]=t[f];else for(h=this.start;f<o&&h<64;++f)n[h>>2]|=t[f]<<y[3&h++];else if(a)for(h=this.start;f<o&&h<64;++f)(s=t.charCodeAt(f))<128?u[h++]=s:s<2048?(u[h++]=192|s>>6,u[h++]=128|63&s):s<55296||s>=57344?(u[h++]=224|s>>12,u[h++]=128|s>>6&63,u[h++]=128|63&s):(s=65536+((1023&s)<<10|1023&t.charCodeAt(++f)),u[h++]=240|s>>18,u[h++]=128|s>>12&63,u[h++]=128|s>>6&63,u[h++]=128|63&s);else for(h=this.start;f<o&&h<64;++f)(s=t.charCodeAt(f))<128?n[h>>2]|=s<<y[3&h++]:s<2048?(n[h>>2]|=(192|s>>6)<<y[3&h++],n[h>>2]|=(128|63&s)<<y[3&h++]):s<55296||s>=57344?(n[h>>2]|=(224|s>>12)<<y[3&h++],n[h>>2]|=(128|s>>6&63)<<y[3&h++],n[h>>2]|=(128|63&s)<<y[3&h++]):(s=65536+((1023&s)<<10|1023&t.charCodeAt(++f)),n[h>>2]|=(240|s>>18)<<y[3&h++],n[h>>2]|=(128|s>>12&63)<<y[3&h++],n[h>>2]|=(128|s>>6&63)<<y[3&h++],n[h>>2]|=(128|63&s)<<y[3&h++]);this.lastByteIndex=h,this.bytes+=h-this.start,h>=64?(this.start=h-64,this.hash(),this.hashed=!0):this.start=h}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},t.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,r=this.lastByteIndex;t[r>>2]|=u[3&r],r>=56&&(this.hashed||this.hash(),t[0]=t[16],t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.bytes<<3,t[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},t.prototype.hash=function(){var t,r,e,i,s,h,f=this.blocks;this.first?r=((r=((t=((t=f[0]-680876937)<<7|t>>>25)-271733879<<0)^(e=((e=(-271733879^(i=((i=(-1732584194^2004318071&t)+f[1]-117830708)<<12|i>>>20)+t<<0)&(-271733879^t))+f[2]-1126478375)<<17|e>>>15)+i<<0)&(i^t))+f[3]-1316259209)<<22|r>>>10)+e<<0:(t=this.h0,r=this.h1,e=this.h2,r=((r+=((t=((t+=((i=this.h3)^r&(e^i))+f[0]-680876936)<<7|t>>>25)+r<<0)^(e=((e+=(r^(i=((i+=(e^t&(r^e))+f[1]-389564586)<<12|i>>>20)+t<<0)&(t^r))+f[2]+606105819)<<17|e>>>15)+i<<0)&(i^t))+f[3]-1044525330)<<22|r>>>10)+e<<0),r=((r+=((t=((t+=(i^r&(e^i))+f[4]-176418897)<<7|t>>>25)+r<<0)^(e=((e+=(r^(i=((i+=(e^t&(r^e))+f[5]+1200080426)<<12|i>>>20)+t<<0)&(t^r))+f[6]-1473231341)<<17|e>>>15)+i<<0)&(i^t))+f[7]-45705983)<<22|r>>>10)+e<<0,r=((r+=((t=((t+=(i^r&(e^i))+f[8]+1770035416)<<7|t>>>25)+r<<0)^(e=((e+=(r^(i=((i+=(e^t&(r^e))+f[9]-1958414417)<<12|i>>>20)+t<<0)&(t^r))+f[10]-42063)<<17|e>>>15)+i<<0)&(i^t))+f[11]-1990404162)<<22|r>>>10)+e<<0,r=((r+=((t=((t+=(i^r&(e^i))+f[12]+1804603682)<<7|t>>>25)+r<<0)^(e=((e+=(r^(i=((i+=(e^t&(r^e))+f[13]-40341101)<<12|i>>>20)+t<<0)&(t^r))+f[14]-1502002290)<<17|e>>>15)+i<<0)&(i^t))+f[15]+1236535329)<<22|r>>>10)+e<<0,r=((r+=((i=((i+=(r^e&((t=((t+=(e^i&(r^e))+f[1]-165796510)<<5|t>>>27)+r<<0)^r))+f[6]-1069501632)<<9|i>>>23)+t<<0)^t&((e=((e+=(t^r&(i^t))+f[11]+643717713)<<14|e>>>18)+i<<0)^i))+f[0]-373897302)<<20|r>>>12)+e<<0,r=((r+=((i=((i+=(r^e&((t=((t+=(e^i&(r^e))+f[5]-701558691)<<5|t>>>27)+r<<0)^r))+f[10]+38016083)<<9|i>>>23)+t<<0)^t&((e=((e+=(t^r&(i^t))+f[15]-660478335)<<14|e>>>18)+i<<0)^i))+f[4]-405537848)<<20|r>>>12)+e<<0,r=((r+=((i=((i+=(r^e&((t=((t+=(e^i&(r^e))+f[9]+568446438)<<5|t>>>27)+r<<0)^r))+f[14]-1019803690)<<9|i>>>23)+t<<0)^t&((e=((e+=(t^r&(i^t))+f[3]-187363961)<<14|e>>>18)+i<<0)^i))+f[8]+1163531501)<<20|r>>>12)+e<<0,r=((r+=((i=((i+=(r^e&((t=((t+=(e^i&(r^e))+f[13]-1444681467)<<5|t>>>27)+r<<0)^r))+f[2]-51403784)<<9|i>>>23)+t<<0)^t&((e=((e+=(t^r&(i^t))+f[7]+1735328473)<<14|e>>>18)+i<<0)^i))+f[12]-1926607734)<<20|r>>>12)+e<<0,r=((r+=((h=(i=((i+=((s=r^e)^(t=((t+=(s^i)+f[5]-378558)<<4|t>>>28)+r<<0))+f[8]-2022574463)<<11|i>>>21)+t<<0)^t)^(e=((e+=(h^r)+f[11]+1839030562)<<16|e>>>16)+i<<0))+f[14]-35309556)<<23|r>>>9)+e<<0,r=((r+=((h=(i=((i+=((s=r^e)^(t=((t+=(s^i)+f[1]-1530992060)<<4|t>>>28)+r<<0))+f[4]+1272893353)<<11|i>>>21)+t<<0)^t)^(e=((e+=(h^r)+f[7]-155497632)<<16|e>>>16)+i<<0))+f[10]-1094730640)<<23|r>>>9)+e<<0,r=((r+=((h=(i=((i+=((s=r^e)^(t=((t+=(s^i)+f[13]+681279174)<<4|t>>>28)+r<<0))+f[0]-358537222)<<11|i>>>21)+t<<0)^t)^(e=((e+=(h^r)+f[3]-722521979)<<16|e>>>16)+i<<0))+f[6]+76029189)<<23|r>>>9)+e<<0,r=((r+=((h=(i=((i+=((s=r^e)^(t=((t+=(s^i)+f[9]-640364487)<<4|t>>>28)+r<<0))+f[12]-421815835)<<11|i>>>21)+t<<0)^t)^(e=((e+=(h^r)+f[15]+530742520)<<16|e>>>16)+i<<0))+f[2]-995338651)<<23|r>>>9)+e<<0,r=((r+=((i=((i+=(r^((t=((t+=(e^(r|~i))+f[0]-198630844)<<6|t>>>26)+r<<0)|~e))+f[7]+1126891415)<<10|i>>>22)+t<<0)^((e=((e+=(t^(i|~r))+f[14]-1416354905)<<15|e>>>17)+i<<0)|~t))+f[5]-57434055)<<21|r>>>11)+e<<0,r=((r+=((i=((i+=(r^((t=((t+=(e^(r|~i))+f[12]+1700485571)<<6|t>>>26)+r<<0)|~e))+f[3]-1894986606)<<10|i>>>22)+t<<0)^((e=((e+=(t^(i|~r))+f[10]-1051523)<<15|e>>>17)+i<<0)|~t))+f[1]-2054922799)<<21|r>>>11)+e<<0,r=((r+=((i=((i+=(r^((t=((t+=(e^(r|~i))+f[8]+1873313359)<<6|t>>>26)+r<<0)|~e))+f[15]-30611744)<<10|i>>>22)+t<<0)^((e=((e+=(t^(i|~r))+f[6]-1560198380)<<15|e>>>17)+i<<0)|~t))+f[13]+1309151649)<<21|r>>>11)+e<<0,r=((r+=((i=((i+=(r^((t=((t+=(e^(r|~i))+f[4]-145523070)<<6|t>>>26)+r<<0)|~e))+f[11]-1120210379)<<10|i>>>22)+t<<0)^((e=((e+=(t^(i|~r))+f[2]+718787259)<<15|e>>>17)+i<<0)|~t))+f[9]-343485551)<<21|r>>>11)+e<<0,this.first?(this.h0=t+1732584193<<0,this.h1=r-271733879<<0,this.h2=e-1732584194<<0,this.h3=i+271733878<<0,this.first=!1):(this.h0=this.h0+t<<0,this.h1=this.h1+r<<0,this.h2=this.h2+e<<0,this.h3=this.h3+i<<0)},t.prototype.hex=function(){this.finalize();var t=this.h0,r=this.h1,e=this.h2,i=this.h3;return n[t>>4&15]+n[15&t]+n[t>>12&15]+n[t>>8&15]+n[t>>20&15]+n[t>>16&15]+n[t>>28&15]+n[t>>24&15]+n[r>>4&15]+n[15&r]+n[r>>12&15]+n[r>>8&15]+n[r>>20&15]+n[r>>16&15]+n[r>>28&15]+n[r>>24&15]+n[e>>4&15]+n[15&e]+n[e>>12&15]+n[e>>8&15]+n[e>>20&15]+n[e>>16&15]+n[e>>28&15]+n[e>>24&15]+n[i>>4&15]+n[15&i]+n[i>>12&15]+n[i>>8&15]+n[i>>20&15]+n[i>>16&15]+n[i>>28&15]+n[i>>24&15]},t.prototype.toString=t.prototype.hex,t.prototype.digest=function(){this.finalize();var t=this.h0,r=this.h1,e=this.h2,i=this.h3;return[255&t,t>>8&255,t>>16&255,t>>24&255,255&r,r>>8&255,r>>16&255,r>>24&255,255&e,e>>8&255,e>>16&255,e>>24&255,255&i,i>>8&255,i>>16&255,i>>24&255]},t.prototype.array=t.prototype.digest,t.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(16),r=new Uint32Array(t);return r[0]=this.h0,r[1]=this.h1,r[2]=this.h2,r[3]=this.h3,t},t.prototype.buffer=t.prototype.arrayBuffer,t.prototype.base64=function(){for(var t,r,e,i="",s=this.array(),h=0;h<15;)t=s[h++],r=s[h++],e=s[h++],i+=p[t>>>2]+p[63&(t<<4|r>>>4)]+p[63&(r<<2|e>>>6)]+p[63&e];return t=s[h],i+=p[t>>>2]+p[t<<4&63]+"=="};var _=v();f?module.exports=_:(i.md5=_,o&&define(function(){return _}))}(); |
common/share.js
0 → 100644
| 1 | +export default{ | ||
| 2 | + data(){ | ||
| 3 | + return { | ||
| 4 | + //设置默认的分享参数 | ||
| 5 | + //如果页面不设置share,就触发这个默认的分享 | ||
| 6 | + // share:{ | ||
| 7 | + // title:'中志教育', | ||
| 8 | + // path:'/pages/index/index?id='+uni.getStorageSync('parentid'), | ||
| 9 | + // imageUrl:'/static/images/yzxz.png', | ||
| 10 | + // desc:'', | ||
| 11 | + // content:'' | ||
| 12 | + // } | ||
| 13 | + } | ||
| 14 | + }, | ||
| 15 | + // onShareAppMessage(res) { | ||
| 16 | + // return { | ||
| 17 | + // title:this.share.title, | ||
| 18 | + // path:this.share.path, | ||
| 19 | + // imageUrl:this.share.imageUrl, | ||
| 20 | + // desc:this.share.desc, | ||
| 21 | + // content:this.share.content, | ||
| 22 | + // success(res){ | ||
| 23 | + // uni.showToast({ | ||
| 24 | + // title:'分享成功' | ||
| 25 | + // }) | ||
| 26 | + // }, | ||
| 27 | + // fail(res){ | ||
| 28 | + // uni.showToast({ | ||
| 29 | + // title:'分享失败', | ||
| 30 | + // icon:'none' | ||
| 31 | + // }) | ||
| 32 | + // } | ||
| 33 | + // } | ||
| 34 | + // }, | ||
| 35 | + // onShareTimeline(res) {//分享到朋友圈 | ||
| 36 | + // return { | ||
| 37 | + // title:this.share.title, | ||
| 38 | + // path:this.share.path, | ||
| 39 | + // imageUrl:this.share.imageUrl, | ||
| 40 | + // desc:this.share.desc, | ||
| 41 | + // content:this.share.content, | ||
| 42 | + // success(res){ | ||
| 43 | + // uni.showToast({ | ||
| 44 | + // title:'分享成功' | ||
| 45 | + // }) | ||
| 46 | + // }, | ||
| 47 | + // fail(res){ | ||
| 48 | + // uni.showToast({ | ||
| 49 | + // title:'分享失败', | ||
| 50 | + // icon:'none' | ||
| 51 | + // }) | ||
| 52 | + // } | ||
| 53 | + // } | ||
| 54 | + // }, | ||
| 55 | +} |
common/sju.base.js
0 → 100644
| 1 | +/** | ||
| 2 | + * 所有封装包的基础方法 | ||
| 3 | + */ | ||
| 4 | +import alert from '@/common/sju.alert.js'; | ||
| 5 | +import md5 from '@/common/md5.min.js'; | ||
| 6 | + | ||
| 7 | +let base = { | ||
| 8 | + /** | ||
| 9 | + * @description 开发阶段输出信息(可以随时关闭输出) | ||
| 10 | + * @param {string} msg 要输出的消息 | ||
| 11 | + */ | ||
| 12 | + logInfo: function(msg) { | ||
| 13 | + // console.info(msg); | ||
| 14 | + }, | ||
| 15 | + /** | ||
| 16 | + * @description 返回md5加密后的结果 | ||
| 17 | + * @param {string} val 要加密的数据 | ||
| 18 | + */ | ||
| 19 | + toMD5: function(val) { | ||
| 20 | + return md5(val); | ||
| 21 | + }, | ||
| 22 | + /** | ||
| 23 | + * @description 判断是否空值,如果是空值,则返回true | ||
| 24 | + * @param {string} val 要判断的数据 | ||
| 25 | + */ | ||
| 26 | + isNull: function(val) { | ||
| 27 | + var isNull = false; | ||
| 28 | + if (typeof(val) == undefined) | ||
| 29 | + isNull = true; | ||
| 30 | + if (val == null) | ||
| 31 | + isNull = true; | ||
| 32 | + if (val == "") | ||
| 33 | + isNull = true; | ||
| 34 | + return isNull; | ||
| 35 | + }, | ||
| 36 | + /** | ||
| 37 | + * @description 判断是否非空值,如果是非空值,则返回true | ||
| 38 | + * @param {string} val 要判断的数据 | ||
| 39 | + */ | ||
| 40 | + isNotNull: function(val) { | ||
| 41 | + return !base.isNull(val); | ||
| 42 | + }, | ||
| 43 | + /** | ||
| 44 | + * 检查是否非空,如果非空,返回True,否则返回false,并显示错误提示 | ||
| 45 | + * @param {string} val 要判断的数据 | ||
| 46 | + * @param {string} msg 空的时候显示的错误提示 | ||
| 47 | + */ | ||
| 48 | + checkNotNull: function(val, msg) { | ||
| 49 | + if (base.isNull(val)) { | ||
| 50 | + alert.showError(msg); | ||
| 51 | + return false; | ||
| 52 | + } | ||
| 53 | + return true; | ||
| 54 | + }, | ||
| 55 | + /** | ||
| 56 | + * @description 一次检查多个参数是否非空 | ||
| 57 | + * <br/>有一个为空则返回false; | ||
| 58 | + * <br/>返回false时,显示为空的错误提醒 | ||
| 59 | + * @param {array} arr 要检查的数据描述 | ||
| 60 | + * <br/>参数格式: [{val:'xxx',msg:'xxx'},...] | ||
| 61 | + */ | ||
| 62 | + checkArrayNotNull: function(arr) { | ||
| 63 | + var isNotNull = true; | ||
| 64 | + if (typeof(arr) == 'object') { | ||
| 65 | + for (let item of arr) { | ||
| 66 | + if (base.isNull(item.val)) { | ||
| 67 | + isNotNull = false; | ||
| 68 | + alert.showError(item.msg); | ||
| 69 | + break; | ||
| 70 | + } | ||
| 71 | + } | ||
| 72 | + } else { | ||
| 73 | + isNotNull = false; | ||
| 74 | + alert.showError('参数不合法'); | ||
| 75 | + } | ||
| 76 | + return isNotNull; | ||
| 77 | + } | ||
| 78 | +} | ||
| 79 | + | ||
| 80 | +export default base; |
common/sju.login.js
0 → 100644
| 1 | +/** | ||
| 2 | + * 用户登录状态的相关封装 | ||
| 3 | + */ | ||
| 4 | +import ajax from '@/common/sju.ajax.js'; | ||
| 5 | +import base from '@/common/sju.base.js'; | ||
| 6 | +import sjuNav from '@/common/sju.nav.js' | ||
| 7 | + | ||
| 8 | +let login = { | ||
| 9 | + /** | ||
| 10 | + * @description 保存不需要登录的页面路径地址 | ||
| 11 | + * /intake/login 用户登录页面 | ||
| 12 | + * /intake/register 用户注册页面 | ||
| 13 | + * @param {数组} | ||
| 14 | + */ | ||
| 15 | + noLogin: ['/pages/login/login'], | ||
| 16 | + /** | ||
| 17 | + * @description 判断访问的Page是否需要登录 | ||
| 18 | + * 如果需要登录, 则判断是否已登录,未登录则跳转到登陆界面 | ||
| 19 | + * @param {string} url 打开的页面 | ||
| 20 | + */ | ||
| 21 | + checkLogin: function(url) { | ||
| 22 | + // 保存不需要登录的页面,如果pageUrl不在数组中存在,则需要登录 | ||
| 23 | + let needLogin = false; | ||
| 24 | + for (let item of login.noLogin) { | ||
| 25 | + if (item == url) | ||
| 26 | + needLogin = false; | ||
| 27 | + } | ||
| 28 | + // 如果需要登录,并且没有登录token标识,则跳转到登陆页面 | ||
| 29 | + let token = login.getValue('token'); | ||
| 30 | + if (needLogin && base.isNull(token)) { | ||
| 31 | + base.logInfo("需要登录:" + url); | ||
| 32 | + //微信小程序,提供登录提醒 | ||
| 33 | + //#ifdef MP-WEIXIN | ||
| 34 | + login.weixinInfo() | ||
| 35 | + //#endif | ||
| 36 | + | ||
| 37 | + //其它平台,直接跳转登录 | ||
| 38 | + //#ifdef APP-PLUS || H5 | ||
| 39 | + sjuNav.redirectTo('/intake/login'); | ||
| 40 | + //#endif | ||
| 41 | + | ||
| 42 | + } else { | ||
| 43 | + return true; | ||
| 44 | + } | ||
| 45 | + return false; | ||
| 46 | + }, | ||
| 47 | + /** | ||
| 48 | + * @description 微信小程序获取用户信息 | ||
| 49 | + */ | ||
| 50 | + weixinInfo() { | ||
| 51 | + var that = this | ||
| 52 | + uni.hideLoading(); | ||
| 53 | + uni.getUserProfile({ | ||
| 54 | + desc: "用于个人中心信息展示", | ||
| 55 | + lang: "zh_CN", | ||
| 56 | + success: res => { | ||
| 57 | + // var rawData = JSON.parse(res.rawData); | ||
| 58 | + // login.weixinLogin(rawData.nickName, rawData.avatarUrl); | ||
| 59 | + | ||
| 60 | + // console.log(res); | ||
| 61 | + if (res.errMsg == 'getUserProfile:ok' && res.userInfo != | ||
| 62 | + undefined) { | ||
| 63 | + var userInfo = { | ||
| 64 | + avatarUrl: res.userInfo.avatarUrl, | ||
| 65 | + nickName: res.userInfo.nickName, | ||
| 66 | + iv: res.iv, | ||
| 67 | + encryptedData: res.encryptedData | ||
| 68 | + } | ||
| 69 | + login.weixinLogin(userInfo); | ||
| 70 | + } else { | ||
| 71 | + uni.showToast({ | ||
| 72 | + icon: "none", | ||
| 73 | + title: "获取失败,请重试" | ||
| 74 | + }) | ||
| 75 | + } | ||
| 76 | + }, | ||
| 77 | + fail: (res) => { | ||
| 78 | + console.info('获取失败') | ||
| 79 | + } | ||
| 80 | + }); | ||
| 81 | + }, | ||
| 82 | + /** | ||
| 83 | + * @description 微信小程序获取openID | ||
| 84 | + * @param {string} nickName 微信用户名称 | ||
| 85 | + * @param {string} avatarUrl 用户用户头像 | ||
| 86 | + */ | ||
| 87 | + weixinLogin(userInfo) { | ||
| 88 | + | ||
| 89 | + uni.login({ | ||
| 90 | + provider: 'weixin', | ||
| 91 | + scopes: 'auth_user', | ||
| 92 | + success: function(loginRes) { | ||
| 93 | + // 获取临时code | ||
| 94 | + var code = loginRes.code; | ||
| 95 | + | ||
| 96 | + // 请求后台接口获取openID | ||
| 97 | + ajax.post('/api/Member.Member/miniWxLogin', { | ||
| 98 | + code: code, | ||
| 99 | + encryptedData: userInfo.encryptedData, | ||
| 100 | + iv: userInfo.iv | ||
| 101 | + }, data => { | ||
| 102 | + console.log(data); | ||
| 103 | + | ||
| 104 | + }, true) | ||
| 105 | + ajax.post('/api/Member.Member/miniWxCodeRefreshToken', { | ||
| 106 | + code: code | ||
| 107 | + }, data => { | ||
| 108 | + console.log(data); | ||
| 109 | + | ||
| 110 | + // if (loginres.statusCode == 200) { | ||
| 111 | + // let token = loginres.data.data.token | ||
| 112 | + // uni.setStorageSync('token',data.token) | ||
| 113 | + // uni.reLaunch({ | ||
| 114 | + // url: `/pages/profile/profile?headerUrl=${that.headerUrl}&nickName=${that.nickName}` | ||
| 115 | + // }); | ||
| 116 | + // } | ||
| 117 | + | ||
| 118 | + // 把后台返回的token保存到本地存储 | ||
| 119 | + // login.saveValue('token',data.token); | ||
| 120 | + }, true) | ||
| 121 | + | ||
| 122 | + // login.getPhone(userInfo, loginRes) | ||
| 123 | + } | ||
| 124 | + }); | ||
| 125 | + }, | ||
| 126 | + // 绑定手机号 | ||
| 127 | + getPhone(userInfo, loginRes) { | ||
| 128 | + // console.log(userInfo, loginRes); | ||
| 129 | + | ||
| 130 | + var code = loginRes.code; | ||
| 131 | + | ||
| 132 | + ajax.post('/api/Member.Member/bindMobile', { | ||
| 133 | + code: code, | ||
| 134 | + encryptedData: userInfo.encryptedData, | ||
| 135 | + iv: userInfo.iv | ||
| 136 | + }, res => { | ||
| 137 | + // console.log(res); | ||
| 138 | + }) | ||
| 139 | + }, | ||
| 140 | + /** | ||
| 141 | + * @description 本地存储 | ||
| 142 | + * @param {string} key 保存变量的标识 | ||
| 143 | + * @param {any} value 保存的值 | ||
| 144 | + */ | ||
| 145 | + saveValue: function(key, value) { | ||
| 146 | + uni.setStorageSync(key, value); | ||
| 147 | + }, | ||
| 148 | + /** | ||
| 149 | + * @description 从本地存储获取key数据 | ||
| 150 | + * @param {string} key 保存变量的标识 | ||
| 151 | + */ | ||
| 152 | + getValue: function(key) { | ||
| 153 | + let value = uni.getStorageSync(key); | ||
| 154 | + return value; | ||
| 155 | + }, | ||
| 156 | + /** | ||
| 157 | + * @description 从本地存储清除某个key | ||
| 158 | + * @param {string} key 保存变量的标识 | ||
| 159 | + */ | ||
| 160 | + clearKey: function(key) { | ||
| 161 | + uni.removeStorageSync(key); | ||
| 162 | + }, | ||
| 163 | + /** | ||
| 164 | + * @description 从本地存储清除所有数据 | ||
| 165 | + * @param {string} key 保存变量的标识 | ||
| 166 | + */ | ||
| 167 | + clearAll: function(key) { | ||
| 168 | + uni.clearStorageSync(); | ||
| 169 | + } | ||
| 170 | +} | ||
| 171 | +export default login; |
common/sju.nav.js
0 → 100644
| 1 | +// 页面跳转的相关方法 | ||
| 2 | + | ||
| 3 | +// import base from '@/common/sju.base.js'; | ||
| 4 | +// import login from '@/common/sju.login.js' | ||
| 5 | + | ||
| 6 | + | ||
| 7 | + | ||
| 8 | +let nav = { | ||
| 9 | + /** | ||
| 10 | + * @description 保留当前页面,跳转到应用内的某个页面,使用uni.navigateBack可以返回到原页面。 | ||
| 11 | + * @param {string} url 跳转的地址 | ||
| 12 | + */ | ||
| 13 | + navigateTo: function(url, param = {}) { | ||
| 14 | + if (JSON.stringify(param) !== '{}') { | ||
| 15 | + uni.navigateTo({ | ||
| 16 | + url: url += `?param=${JSON.stringify(param)}` | ||
| 17 | + }) | ||
| 18 | + } else { | ||
| 19 | + uni.navigateTo({ | ||
| 20 | + url: url, | ||
| 21 | + fail(err) { | ||
| 22 | + console.log('navigateTo 失败'); | ||
| 23 | + }, | ||
| 24 | + }) | ||
| 25 | + } | ||
| 26 | + return | ||
| 27 | + // 判断打开页面是否需要登录 | ||
| 28 | + if (login.checkLogin(url)) { | ||
| 29 | + // url = tranferUrl(url);//用于判断解析分包 | ||
| 30 | + if (JSON.stringify(param) !== '{}') { | ||
| 31 | + uni.navigateTo({ | ||
| 32 | + url: url += `?param=${JSON.stringify(param)}` | ||
| 33 | + }) | ||
| 34 | + } else { | ||
| 35 | + uni.navigateTo({ | ||
| 36 | + url: url, | ||
| 37 | + fail(err) { | ||
| 38 | + console.log('navigateTo 失败'); | ||
| 39 | + }, | ||
| 40 | + }) | ||
| 41 | + } | ||
| 42 | + } | ||
| 43 | + }, | ||
| 44 | + /** | ||
| 45 | + * @description 关闭当前页面,跳转到应用内的某个页面。 | ||
| 46 | + * @param {sting} url 跳转的地址 | ||
| 47 | + * @param {string} para 页面参数 | ||
| 48 | + */ | ||
| 49 | + redirectTo: function(url, param = {}) { | ||
| 50 | + if (JSON.stringify(param) !== '{}') { | ||
| 51 | + uni.redirectTo({ | ||
| 52 | + url: url += `?param=${JSON.stringify(param)}` | ||
| 53 | + }) | ||
| 54 | + } else { | ||
| 55 | + uni.redirectTo({ | ||
| 56 | + url: url, | ||
| 57 | + fail(err) { | ||
| 58 | + console.log('redirectTo 失败'); | ||
| 59 | + }, | ||
| 60 | + }) | ||
| 61 | + } | ||
| 62 | + return | ||
| 63 | + // 判断打开页面是否需要登录 | ||
| 64 | + if (login.checkLogin(url)) { | ||
| 65 | + // url = tranferUrl(url);//用于判断解析分包 | ||
| 66 | + if (JSON.stringify(param) !== '{}') { | ||
| 67 | + uni.redirectTo({ | ||
| 68 | + url: url += `?param=${JSON.stringify(param)}` | ||
| 69 | + }) | ||
| 70 | + } else { | ||
| 71 | + uni.redirectTo({ | ||
| 72 | + url: url, | ||
| 73 | + fail(err) { | ||
| 74 | + console.log('redirectTo 失败'); | ||
| 75 | + }, | ||
| 76 | + }) | ||
| 77 | + } | ||
| 78 | + } | ||
| 79 | + }, | ||
| 80 | + /** | ||
| 81 | + * @description 关闭所有页面,打开到应用内的某个页面。 | ||
| 82 | + * @param {sting} url 跳转的地址 | ||
| 83 | + * @param {string} para 页面参数 | ||
| 84 | + */ | ||
| 85 | + reLaunch: function(url, param = {}) { | ||
| 86 | + if (JSON.stringify(param) !== '{}') { | ||
| 87 | + uni.reLaunch({ | ||
| 88 | + url: url += `?param=${JSON.stringify(param)}` | ||
| 89 | + }) | ||
| 90 | + } else { | ||
| 91 | + uni.reLaunch({ | ||
| 92 | + url: url, | ||
| 93 | + fail(err) { | ||
| 94 | + console.log('reLaunch 失败'); | ||
| 95 | + }, | ||
| 96 | + }) | ||
| 97 | + } | ||
| 98 | + return | ||
| 99 | + // 判断打开页面是否需要登录 | ||
| 100 | + if (login.checkLogin(url)) { | ||
| 101 | + // url = tranferUrl(url);//用于判断解析分包 | ||
| 102 | + if (JSON.stringify(param) !== '{}') { | ||
| 103 | + uni.reLaunch({ | ||
| 104 | + url: url += `?param=${JSON.stringify(param)}` | ||
| 105 | + }) | ||
| 106 | + } else { | ||
| 107 | + uni.reLaunch({ | ||
| 108 | + url: url, | ||
| 109 | + fail(err) { | ||
| 110 | + console.log('reLaunch 失败'); | ||
| 111 | + }, | ||
| 112 | + }) | ||
| 113 | + } | ||
| 114 | + } | ||
| 115 | + }, | ||
| 116 | + /** | ||
| 117 | + * @description 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面。 | ||
| 118 | + * @param {sting} url 跳转的地址 | ||
| 119 | + */ | ||
| 120 | + switchTab: function(url) { | ||
| 121 | + uni.switchTab({ | ||
| 122 | + url: url, | ||
| 123 | + fail: function() { | ||
| 124 | + console.log('switchTab 失败') | ||
| 125 | + } | ||
| 126 | + }) | ||
| 127 | + return | ||
| 128 | + if (login.checkLogin(url)) { | ||
| 129 | + // url = tranferUrl(url); | ||
| 130 | + uni.switchTab({ | ||
| 131 | + url: url, | ||
| 132 | + fail: function() { | ||
| 133 | + console.log('switchTab 失败') | ||
| 134 | + } | ||
| 135 | + }) | ||
| 136 | + } | ||
| 137 | + }, | ||
| 138 | + /** | ||
| 139 | + * @description 关闭当前页面,返回上一页面或多级页面。可通过 getCurrentPages() 获取当前的页面栈,决定需要返回几层。 | ||
| 140 | + * @param {number} delta 返回的页面数 | ||
| 141 | + */ | ||
| 142 | + navigateBack: function(delta, param = {}) { | ||
| 143 | + if (JSON.stringify(param) !== '{}') { | ||
| 144 | + uni.navigateBack({ | ||
| 145 | + delta: delta += `?param=${JSON.stringify(param)}` | ||
| 146 | + }) | ||
| 147 | + } else { | ||
| 148 | + uni.navigateBack({ | ||
| 149 | + delta: delta | ||
| 150 | + }); | ||
| 151 | + } | ||
| 152 | + } | ||
| 153 | +} | ||
| 154 | +export default nav; |
components/CustomReturn/index.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <view> | ||
| 3 | + <!-- #ifdef MP-WEIXIN --> | ||
| 4 | + <view class="CustomReturn-container" :style="{height: titleHeight, paddingTop: paddingTop, backgroundColor: bgColor}"> | ||
| 5 | + <view class="CustomReturn"> | ||
| 6 | + <view v-if="isShowBreak" class="CustomReturn-r"> | ||
| 7 | + <u-icon name="home" v-if="isFirstPage && !isCustomReturn" @click="toBreak()" size="23" :color="color"></u-icon> | ||
| 8 | + <u-icon name="arrow-left" v-else @click="toBreak()" size="20" :color="color"></u-icon> | ||
| 9 | + </view> | ||
| 10 | + <view style="width: 200rpx;" v-else ></view> | ||
| 11 | + <view class="CustomReturn-title" :style="{'color': color}">{{ title }}</view> | ||
| 12 | + <view style="width: 200rpx;"></view> | ||
| 13 | + </view> | ||
| 14 | + <view class="other"> | ||
| 15 | + <slot></slot> | ||
| 16 | + </view> | ||
| 17 | + </view> | ||
| 18 | + <!-- #endif --> | ||
| 19 | + </view> | ||
| 20 | + | ||
| 21 | + | ||
| 22 | +</template> | ||
| 23 | + | ||
| 24 | +<script> | ||
| 25 | + export default { | ||
| 26 | + name:"CustomReturn", | ||
| 27 | + components: { | ||
| 28 | + }, | ||
| 29 | + props: { | ||
| 30 | + color: { | ||
| 31 | + type: String, | ||
| 32 | + default: '#000000' | ||
| 33 | + }, | ||
| 34 | + isShowOtherIcon: { | ||
| 35 | + type: Boolean, | ||
| 36 | + default: true | ||
| 37 | + }, | ||
| 38 | + bgColor: { | ||
| 39 | + type: String, | ||
| 40 | + default: '#fff' | ||
| 41 | + }, | ||
| 42 | + breakUrl: { | ||
| 43 | + type: String, | ||
| 44 | + default: '' | ||
| 45 | + }, | ||
| 46 | + isShowBreak: { | ||
| 47 | + type: Boolean, | ||
| 48 | + default: true | ||
| 49 | + }, | ||
| 50 | + title: { | ||
| 51 | + type: [String, Number], | ||
| 52 | + default: '标题' | ||
| 53 | + }, | ||
| 54 | + isCustomReturn: { | ||
| 55 | + type: Boolean, | ||
| 56 | + default: false | ||
| 57 | + } | ||
| 58 | + }, | ||
| 59 | + data() { | ||
| 60 | + return { | ||
| 61 | + show: false, | ||
| 62 | + titleHeight: 0, | ||
| 63 | + paddingTop: 0, | ||
| 64 | + otherHeight: 0, | ||
| 65 | + isFirstPage: false, | ||
| 66 | + entityHeight: 0 | ||
| 67 | + }; | ||
| 68 | + }, | ||
| 69 | + mounted() { | ||
| 70 | + this.getHeight() | ||
| 71 | + this.getOther() | ||
| 72 | + this.identifyPages() | ||
| 73 | + }, | ||
| 74 | + methods: { | ||
| 75 | + toExamination() { | ||
| 76 | + uni.reLaunch({ | ||
| 77 | + url: '/pages/examination/examination' | ||
| 78 | + }) | ||
| 79 | + }, | ||
| 80 | + toPersonalCenter() { | ||
| 81 | + uni.reLaunch({ | ||
| 82 | + url: '/pages/personalCenter/personalCenter' | ||
| 83 | + }) | ||
| 84 | + }, | ||
| 85 | + // 获取除顶部导航栏以外的高度 | ||
| 86 | + getOtherHeight() { | ||
| 87 | + return this.otherHeight | ||
| 88 | + }, | ||
| 89 | + getOther() { | ||
| 90 | + uni.createSelectorQuery().in(this).select('.other') | ||
| 91 | + .fields({ size: true }, (res) => { | ||
| 92 | + if (res) { | ||
| 93 | + this.otherHeight = res.height | ||
| 94 | + console.log('元素高度', res.height); | ||
| 95 | + this.$emit('init', {otherHeight: this.otherHeight, entityHeight: this.entityHeight}) | ||
| 96 | + } | ||
| 97 | + }).exec(); | ||
| 98 | + }, | ||
| 99 | + // 辨别页面 | ||
| 100 | + identifyPages() { | ||
| 101 | + let result = getCurrentPages() | ||
| 102 | + if(result.length === 1) { | ||
| 103 | + this.isFirstPage = true | ||
| 104 | + } else { | ||
| 105 | + this.isFirstPage = false | ||
| 106 | + } | ||
| 107 | + }, | ||
| 108 | + getHeight() { | ||
| 109 | + this.titleHeight = 88 + 'rpx'; | ||
| 110 | + this.paddingTop = uni.getSystemInfoSync().statusBarHeight + 'px' | ||
| 111 | + // #ifdef MP-WEIXIN | ||
| 112 | + let res = wx.getMenuButtonBoundingClientRect(); | ||
| 113 | + // #endif | ||
| 114 | + this.paddingTop = res.top + 'px' | ||
| 115 | + this.titleHeight = res.height + 10 + 'px'; | ||
| 116 | + this.entityHeight = res.top + res.height | ||
| 117 | + | ||
| 118 | + }, | ||
| 119 | + toBreak(){ | ||
| 120 | + if(!this.isCustomReturn) { | ||
| 121 | + let result = getCurrentPages() | ||
| 122 | + if(result.length === 1) { | ||
| 123 | + uni.reLaunch({ | ||
| 124 | + url: '/pages/examination/examination' | ||
| 125 | + }) | ||
| 126 | + } else { | ||
| 127 | + uni.navigateBack({ | ||
| 128 | + delta: 1 | ||
| 129 | + }) | ||
| 130 | + } | ||
| 131 | + } else { | ||
| 132 | + this.$emit('goBack') | ||
| 133 | + } | ||
| 134 | + } | ||
| 135 | + } | ||
| 136 | + } | ||
| 137 | +</script> | ||
| 138 | + | ||
| 139 | +<style lang="scss" scoped> | ||
| 140 | +.CustomReturn-container{ | ||
| 141 | + position: fixed; | ||
| 142 | + top: 0; | ||
| 143 | + width: 100%; | ||
| 144 | + z-index: 1002; | ||
| 145 | + transition: all .5s; | ||
| 146 | + box-sizing: content-box; | ||
| 147 | +} | ||
| 148 | +.CustomReturn{ | ||
| 149 | + display: flex; | ||
| 150 | + align-items: center; | ||
| 151 | + flex-grow: 1; | ||
| 152 | + padding: 0 24rpx; | ||
| 153 | + justify-content: space-between; | ||
| 154 | + position: relative; | ||
| 155 | + z-index: 1002; | ||
| 156 | + height: 100%; | ||
| 157 | + padding-bottom: 10px; | ||
| 158 | + box-sizing: border-box; | ||
| 159 | + | ||
| 160 | + .CustomReturn-title{ | ||
| 161 | + font-size: 36rpx; | ||
| 162 | + } | ||
| 163 | + .CustomReturn-r{ | ||
| 164 | + display: flex; | ||
| 165 | + width: 200rpx; | ||
| 166 | + align-items: center; | ||
| 167 | + .CustomReturn-i{ | ||
| 168 | + height: 36rpx; | ||
| 169 | + width: 36rpx; | ||
| 170 | + margin-left: 30rpx; | ||
| 171 | + } | ||
| 172 | + } | ||
| 173 | +} | ||
| 174 | +</style> |
components/HonorWall/index.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <u-popup :show="show" :safeAreaInsetBottom="false" bgColor="transparent" mode="center"> | ||
| 3 | + <view class="HonorWall"> | ||
| 4 | + <view class="HonorWall-i"> | ||
| 5 | + <u-icon name="close-circle" @click="close" size="30" color="#fff"></u-icon> | ||
| 6 | + </view> | ||
| 7 | + <view class="HonorWall-c"> | ||
| 8 | + <image class="HonorWall-c-bg" src="@/static/imagesV2/icon13.png" mode="widthFix"></image> | ||
| 9 | + <view class="HonorWall-c-c"> | ||
| 10 | + <view class="HonorWall-c-c-t"> | ||
| 11 | + <view class="HonorWall-c-c-t-c">荣誉勋章</view> | ||
| 12 | + </view> | ||
| 13 | + <view class="HonorWall-c-c-b"> | ||
| 14 | + <view class="HonorWall-c-c-b-i" v-for="(item, index) in dataList" :key="index"> | ||
| 15 | + <image class="HonorWall-c-c-b-i-i"v-if="item.is_light" src="@/static/imagesV2/icon15s.png" mode="widthFix"></image> | ||
| 16 | + <image class="HonorWall-c-c-b-i-i"v-else src="@/static/imagesV2/icon15.png" mode="widthFix"></image> | ||
| 17 | + <view class="HonorWall-c-c-b-i-t">{{ item.name }}</view> | ||
| 18 | + </view> | ||
| 19 | + </view> | ||
| 20 | + </view> | ||
| 21 | + </view> | ||
| 22 | + </view> | ||
| 23 | + </u-popup> | ||
| 24 | +</template> | ||
| 25 | + | ||
| 26 | +<script> | ||
| 27 | + export default { | ||
| 28 | + name: 'HonorWall', | ||
| 29 | + props: { | ||
| 30 | + dataList: { | ||
| 31 | + type: Array, | ||
| 32 | + default: () => [] | ||
| 33 | + } | ||
| 34 | + }, | ||
| 35 | + data() { | ||
| 36 | + return { | ||
| 37 | + show: false | ||
| 38 | + } | ||
| 39 | + }, | ||
| 40 | + methods: { | ||
| 41 | + close() { | ||
| 42 | + debugger | ||
| 43 | + this.show = false | ||
| 44 | + }, | ||
| 45 | + open() { | ||
| 46 | + this.show = true | ||
| 47 | + } | ||
| 48 | + } | ||
| 49 | + } | ||
| 50 | +</script> | ||
| 51 | + | ||
| 52 | +<style lang="scss" scoped> | ||
| 53 | + .HonorWall{ | ||
| 54 | + .HonorWall-i{ | ||
| 55 | + display: flex; | ||
| 56 | + justify-content: flex-end; | ||
| 57 | + margin-bottom: 20rpx; | ||
| 58 | + } | ||
| 59 | + .HonorWall-c{ | ||
| 60 | + position: relative; | ||
| 61 | + height: 760rpx; | ||
| 62 | + width: 650rpx; | ||
| 63 | + .HonorWall-c-bg{ | ||
| 64 | + height: 100%; | ||
| 65 | + width: 100%; | ||
| 66 | + } | ||
| 67 | + .HonorWall-c-c{ | ||
| 68 | + position: absolute; | ||
| 69 | + top: 0; | ||
| 70 | + left: 0; | ||
| 71 | + padding: 50rpx; | ||
| 72 | + width: 100%; | ||
| 73 | + box-sizing: border-box; | ||
| 74 | + .HonorWall-c-c-t{ | ||
| 75 | + font-size: 34rpx; | ||
| 76 | + color: #555D71; | ||
| 77 | + display: flex; | ||
| 78 | + justify-content: center; | ||
| 79 | + .HonorWall-c-c-t-c{ | ||
| 80 | + position: relative; | ||
| 81 | + padding: 0 17rpx; | ||
| 82 | + &:before{ | ||
| 83 | + content: ''; | ||
| 84 | + background-image: url(@/static/imagesV2/icon14.png); | ||
| 85 | + background-size: 100% 100%; | ||
| 86 | + position: absolute; | ||
| 87 | + left: 0; | ||
| 88 | + top: 50%; | ||
| 89 | + height: 36rpx; | ||
| 90 | + width: 36rpx; | ||
| 91 | + transform: translateY(-50%) translateX(-100%); | ||
| 92 | + } | ||
| 93 | + &:after{ | ||
| 94 | + content: ''; | ||
| 95 | + background-image: url(@/static/imagesV2/icon14s.png); | ||
| 96 | + background-size: 100% 100%; | ||
| 97 | + position: absolute; | ||
| 98 | + right: 0; | ||
| 99 | + top: 50%; | ||
| 100 | + height: 36rpx; | ||
| 101 | + width: 36rpx; | ||
| 102 | + transform: translateY(-50%) translateX(100%); | ||
| 103 | + } | ||
| 104 | + } | ||
| 105 | + } | ||
| 106 | + .HonorWall-c-c-b{ | ||
| 107 | + display: grid; | ||
| 108 | + grid-template-columns: repeat(4, auto); | ||
| 109 | + justify-content: space-between; | ||
| 110 | + margin-top: 20rpx; | ||
| 111 | + grid-row-gap: 40rpx; | ||
| 112 | + grid-column-gap: 40rpx; | ||
| 113 | + .HonorWall-c-c-b-i{ | ||
| 114 | + text-align: center; | ||
| 115 | + .HonorWall-c-c-b-i-i{ | ||
| 116 | + height: 90rpx; | ||
| 117 | + width: 90rpx; | ||
| 118 | + } | ||
| 119 | + .HonorWall-c-c-b-i-t{ | ||
| 120 | + font-size: 24rpx; | ||
| 121 | + color: #555D71; | ||
| 122 | + } | ||
| 123 | + } | ||
| 124 | + } | ||
| 125 | + } | ||
| 126 | + } | ||
| 127 | + } | ||
| 128 | +</style> |
components/PaddingTopB/index.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <view class="sf-padding-top88 PaddingTopB" :style="{paddingTop: PaddingTop, minHeight: minHeight}"> | ||
| 3 | + <slot></slot> | ||
| 4 | + </view> | ||
| 5 | +</template> | ||
| 6 | + | ||
| 7 | +<script> | ||
| 8 | + export default { | ||
| 9 | + name:"PaddingTopB", | ||
| 10 | + watch: { | ||
| 11 | + otherHeight: { | ||
| 12 | + handler(newData){ | ||
| 13 | + this.setOtherHeight(newData) | ||
| 14 | + }, | ||
| 15 | + immediate: true | ||
| 16 | + } | ||
| 17 | + }, | ||
| 18 | + props: { | ||
| 19 | + otherUnit: { | ||
| 20 | + type: String, | ||
| 21 | + default: 'rpx' | ||
| 22 | + }, | ||
| 23 | + otherHeight: { | ||
| 24 | + type: [Number, String], | ||
| 25 | + default: 0 | ||
| 26 | + }, | ||
| 27 | + minHeight: { | ||
| 28 | + type: String, | ||
| 29 | + default: 'calc(100vh)' | ||
| 30 | + } | ||
| 31 | + }, | ||
| 32 | + data() { | ||
| 33 | + return { | ||
| 34 | + PaddingTop: 0 | ||
| 35 | + }; | ||
| 36 | + }, | ||
| 37 | + mounted() { | ||
| 38 | + | ||
| 39 | + }, | ||
| 40 | + methods:{ | ||
| 41 | + setOtherHeight(height, unit = 'rpx') { | ||
| 42 | + // #ifdef MP-WEIXIN | ||
| 43 | + let res = wx.getMenuButtonBoundingClientRect(); | ||
| 44 | + // #endif | ||
| 45 | + let paddingTop = res.top | ||
| 46 | + let titleHeight = res.height + 10; | ||
| 47 | + | ||
| 48 | + this.PaddingTop = `calc(${paddingTop + titleHeight}px + ${height + this.otherUnit})` | ||
| 49 | + | ||
| 50 | + // this.PaddingTop = `calc(${uni.getSystemInfoSync().statusBarHeight}px + ${height}rpx + 88rpx + 5px)` | ||
| 51 | + } | ||
| 52 | + } | ||
| 53 | + } | ||
| 54 | +</script> | ||
| 55 | + | ||
| 56 | +<style lang="scss" scoped> | ||
| 57 | +.sf-padding-top88{ | ||
| 58 | + // position: fixed; | ||
| 59 | + box-sizing: border-box; | ||
| 60 | + position: relative; | ||
| 61 | + width: 100%; | ||
| 62 | + z-index: 20; | ||
| 63 | +} | ||
| 64 | +.PaddingTopB{ | ||
| 65 | + display: flex; | ||
| 66 | +} | ||
| 67 | +</style> |
components/Popup/PopupA/PopupA.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <u-popup :show="show" mode="center" bgColor="transparent"> | ||
| 3 | + <view class="PopupA"> | ||
| 4 | + <view class="PopupA-1"> | ||
| 5 | + <image class="PopupA-1-bg" src="@/static/images/xh_icon10.png"></image> | ||
| 6 | + <view class="PopupA-1-content"> | ||
| 7 | + <view class="PopupA-1-content-icon"> | ||
| 8 | + <image src="@/static/images/xh_icon11.png" mode=""></image> | ||
| 9 | + </view> | ||
| 10 | + <view class="PopupA-1-content-title"> | ||
| 11 | + <image class="PopupA-1-content-title-icon" src="@/static/images/xh_icon12.png" ></image> | ||
| 12 | + <text class="PopupA-1-content-title-text">{{ title }}</text> | ||
| 13 | + <image class="PopupA-1-content-title-icon" src="@/static/images/xh_icon12.png" ></image> | ||
| 14 | + </view> | ||
| 15 | + <view class="PopupA-1-content-details"> | ||
| 16 | + “恭喜你获得中志教育荣誉勋章凭截图可到学生服务中心领取奖品一份” | ||
| 17 | + </view> | ||
| 18 | + </view> | ||
| 19 | + </view> | ||
| 20 | + <view class="PopupA-2"> | ||
| 21 | + <u-icon name="close-circle" color="#fff" size="32" @click.native="close"></u-icon> | ||
| 22 | + </view> | ||
| 23 | + </view> | ||
| 24 | + </u-popup> | ||
| 25 | +</template> | ||
| 26 | + | ||
| 27 | +<script> | ||
| 28 | + export default { | ||
| 29 | + name: 'PopupA', | ||
| 30 | + data() { | ||
| 31 | + return { | ||
| 32 | + show: false, | ||
| 33 | + title: '' | ||
| 34 | + } | ||
| 35 | + }, | ||
| 36 | + methods: { | ||
| 37 | + open({title} = e) { | ||
| 38 | + this.title = title | ||
| 39 | + this.show = true | ||
| 40 | + }, | ||
| 41 | + close() { | ||
| 42 | + this.show = false | ||
| 43 | + this.$emit('close') | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | + } | ||
| 47 | +</script> | ||
| 48 | + | ||
| 49 | +<style lang="scss" scoped> | ||
| 50 | + .PopupA{ | ||
| 51 | + .PopupA-1{ | ||
| 52 | + position: relative; | ||
| 53 | + padding: 140rpx 35rpx 100rpx 35rpx; | ||
| 54 | + height: 830rpx; | ||
| 55 | + width: 640rpx; | ||
| 56 | + .PopupA-1-bg{ | ||
| 57 | + position: absolute; | ||
| 58 | + height: 830rpx; | ||
| 59 | + width: 640rpx; | ||
| 60 | + top: 0; | ||
| 61 | + left: 0; | ||
| 62 | + } | ||
| 63 | + .PopupA-1-content{ | ||
| 64 | + position: relative; | ||
| 65 | + display: flex; | ||
| 66 | + flex-direction: column; | ||
| 67 | + align-items: center; | ||
| 68 | + justify-content: center; | ||
| 69 | + .PopupA-1-content-icon{ | ||
| 70 | + height: 370rpx; | ||
| 71 | + width: 370rpx; | ||
| 72 | + } | ||
| 73 | + .PopupA-1-content-title{ | ||
| 74 | + display: flex; | ||
| 75 | + align-items: center; | ||
| 76 | + .PopupA-1-content-title-text{ | ||
| 77 | + font-size: 32rpx; | ||
| 78 | + color: #422511; | ||
| 79 | + margin: 0 25rpx; | ||
| 80 | + font-weight: bold; | ||
| 81 | + } | ||
| 82 | + .PopupA-1-content-title-icon{ | ||
| 83 | + height: 38rpx; | ||
| 84 | + width: 38rpx; | ||
| 85 | + } | ||
| 86 | + } | ||
| 87 | + .PopupA-1-content-details{ | ||
| 88 | + text-align: center; | ||
| 89 | + color: #72482A; | ||
| 90 | + font-size: 26rpx; | ||
| 91 | + margin-top: 26rpx; | ||
| 92 | + padding: 0 20rpx; | ||
| 93 | + } | ||
| 94 | + } | ||
| 95 | + } | ||
| 96 | + .PopupA-2{ | ||
| 97 | + display: flex; | ||
| 98 | + justify-content: center; | ||
| 99 | + margin-top: 37rpx; | ||
| 100 | + } | ||
| 101 | + } | ||
| 102 | +</style> |
components/ft_add/ft_add.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <view> | ||
| 3 | + <view class="stu_list"> | ||
| 4 | + <!-- datas_stu --> | ||
| 5 | + <view class="add_li"> | ||
| 6 | + <picker mode="selector" :range="datas_stu" range-key="name" @change="stu_change"> | ||
| 7 | + <view class="add_li_box"> | ||
| 8 | + <view class=""> | ||
| 9 | + 学员姓名 | ||
| 10 | + </view> | ||
| 11 | + <input type="text" placeholder="请选择" v-model="name" disabled="true"> | ||
| 12 | + </view> | ||
| 13 | + </picker> | ||
| 14 | + </view> | ||
| 15 | + <view class="add_li"> | ||
| 16 | + <picker mode="date" :value="sx_time" :start="startDate" :end="endDate" @change="bindDateChange"> | ||
| 17 | + <view class="add_li_box"> | ||
| 18 | + <view class=""> | ||
| 19 | + 访谈时间 | ||
| 20 | + </view> | ||
| 21 | + <view class=""> | ||
| 22 | + {{sx_time?sx_time:'请选择'}} | ||
| 23 | + </view> | ||
| 24 | + </view> | ||
| 25 | + </picker> | ||
| 26 | + </view> | ||
| 27 | + <view class="add_li"> | ||
| 28 | + <view class="add_li_box"> | ||
| 29 | + <view class=""> | ||
| 30 | + 班主任自我介绍 | ||
| 31 | + </view> | ||
| 32 | + <view class="sf_v_btn_b" :class="{active:is_teacher==1}" @click="set_tch"> | ||
| 33 | + <text class="icon icon-duigou"></text> | ||
| 34 | + </view> | ||
| 35 | + </view> | ||
| 36 | + </view> | ||
| 37 | + | ||
| 38 | + <view class="add_li"> | ||
| 39 | + <view class="add_li_tit"> | ||
| 40 | + 了解学生信息(专业、学校、政治面貌、籍贯) | ||
| 41 | + </view> | ||
| 42 | + <textarea class="add_li_content" placeholder="请输入" v-model="content_one"></textarea> | ||
| 43 | + </view> | ||
| 44 | + <view class="add_li"> | ||
| 45 | + <view class="add_li_tit"> | ||
| 46 | + 第几次考编,之前有没有参加培训,有没有短板模块 | ||
| 47 | + </view> | ||
| 48 | + <textarea class="add_li_content" placeholder="请输入" v-model="content_two"></textarea> | ||
| 49 | + </view> | ||
| 50 | + | ||
| 51 | + | ||
| 52 | + <view class="add_li"> | ||
| 53 | + <view class="add_li_box"> | ||
| 54 | + <view class=""> | ||
| 55 | + 介绍近期课程安排、纪律要求 | ||
| 56 | + </view> | ||
| 57 | + <view class="sf_v_btn_b" :class="{active:is_introduce==1}" @click="set_tch1"> | ||
| 58 | + <text class="icon icon-duigou"></text> | ||
| 59 | + </view> | ||
| 60 | + </view> | ||
| 61 | + </view> | ||
| 62 | + <view class="add_li"> | ||
| 63 | + <view class="add_li_tit"> | ||
| 64 | + 有无什么要求,是否适应 | ||
| 65 | + </view> | ||
| 66 | + <textarea class="add_li_content" placeholder="请输入" v-model="content_three"></textarea> | ||
| 67 | + </view> | ||
| 68 | + <view class="add_li"> | ||
| 69 | + <view class="add_li_box"> | ||
| 70 | + <view class=""> | ||
| 71 | + 入学测评成绩分析 | ||
| 72 | + </view> | ||
| 73 | + <view class="sf_v_btn_b" :class="{active:is_result==1}" @click="set_tch2"> | ||
| 74 | + <text class="icon icon-duigou"></text> | ||
| 75 | + </view> | ||
| 76 | + </view> | ||
| 77 | + </view> | ||
| 78 | + | ||
| 79 | + </view> | ||
| 80 | + <view class="bz_add" > | ||
| 81 | + <view class="" @click="save_fuc"> | ||
| 82 | + 保存 | ||
| 83 | + </view> | ||
| 84 | + <view v-if="options.id" class="del_btn" @click="del_fuc(options)"> | ||
| 85 | + 删除 | ||
| 86 | + </view> | ||
| 87 | + </view> | ||
| 88 | + </view> | ||
| 89 | +</template> | ||
| 90 | + | ||
| 91 | +<script> | ||
| 92 | + import Vue from 'vue' | ||
| 93 | + import { | ||
| 94 | + mapState, | ||
| 95 | + mapMutations | ||
| 96 | + } from 'vuex' | ||
| 97 | + var that1 | ||
| 98 | + export default { | ||
| 99 | + name:"ft_add", | ||
| 100 | + props: { | ||
| 101 | + options:{ | ||
| 102 | + type: Object, | ||
| 103 | + default: function () { | ||
| 104 | + return {} | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + } | ||
| 108 | + }, | ||
| 109 | + data() { | ||
| 110 | + return { | ||
| 111 | + id:'', | ||
| 112 | + uid:'', | ||
| 113 | + name:'', | ||
| 114 | + sx_time:'', | ||
| 115 | + is_teacher:2, | ||
| 116 | + is_introduce:2, | ||
| 117 | + is_result:0, | ||
| 118 | + content_one:'', | ||
| 119 | + content_two:'', | ||
| 120 | + content_three:'', | ||
| 121 | + datas_stu:'', | ||
| 122 | + datas:'', | ||
| 123 | + }; | ||
| 124 | + }, | ||
| 125 | + computed: { | ||
| 126 | + ...mapState(['hasLogin', 'forcedLogin', 'userName', 'userinfo', 'nowtime']), | ||
| 127 | + startDate() { | ||
| 128 | + return this.getDate('start'); | ||
| 129 | + }, | ||
| 130 | + endDate() { | ||
| 131 | + return this.getDate('end'); | ||
| 132 | + } | ||
| 133 | + }, | ||
| 134 | + mounted() { | ||
| 135 | + that1=this | ||
| 136 | + that1.getdata_stu() | ||
| 137 | + | ||
| 138 | + }, | ||
| 139 | + methods:{ | ||
| 140 | + del_fuc(item){ | ||
| 141 | + //teacher/interviewr_del 常规访谈删除接口 | ||
| 142 | + //teacher/interview_del 入学关怀删除接口 | ||
| 143 | + uni.showModal({ | ||
| 144 | + title: '提示', | ||
| 145 | + content: '是否删除该记录', | ||
| 146 | + success: function (res) { | ||
| 147 | + if (res.confirm) { | ||
| 148 | + console.log('用户点击确定'); | ||
| 149 | + var jkurl='/teacher/interview_del' | ||
| 150 | + // if(that.active==1){ | ||
| 151 | + // kurl='teacher/interview_del' | ||
| 152 | + // } | ||
| 153 | + var datas={ | ||
| 154 | + id:item.id | ||
| 155 | + // address_id:'' | ||
| 156 | + } | ||
| 157 | + var header={ | ||
| 158 | + 'content-type': 'application/json', | ||
| 159 | + } | ||
| 160 | + // that.$service.P_post(jkurl, datas,header).then(res => { | ||
| 161 | + that1.$service.P_post(jkurl, datas).then(res => { | ||
| 162 | + that1.btnkg = 0 | ||
| 163 | + console.log(res) | ||
| 164 | + if (res.code == 1){ | ||
| 165 | + that1.htmlReset = 0 | ||
| 166 | + var datas = res.data | ||
| 167 | + console.log(typeof datas) | ||
| 168 | + | ||
| 169 | + if (typeof datas == 'string') { | ||
| 170 | + datas = JSON.parse(datas) | ||
| 171 | + } | ||
| 172 | + console.log(res) | ||
| 173 | + | ||
| 174 | + uni.showToast({ | ||
| 175 | + icon:'none', | ||
| 176 | + title:'删除成功' | ||
| 177 | + }) | ||
| 178 | + // that1.datas.splice(index,1) | ||
| 179 | + setTimeout(()=>{ | ||
| 180 | + uni.navigateBack({ | ||
| 181 | + delta:1 | ||
| 182 | + }) | ||
| 183 | + },1000) | ||
| 184 | + } else { | ||
| 185 | + | ||
| 186 | + if (res.msg) { | ||
| 187 | + uni.showToast({ | ||
| 188 | + icon: 'none', | ||
| 189 | + title: res.msg | ||
| 190 | + }) | ||
| 191 | + } else { | ||
| 192 | + uni.showToast({ | ||
| 193 | + icon: 'none', | ||
| 194 | + title: '获取数据失败' | ||
| 195 | + }) | ||
| 196 | + } | ||
| 197 | + } | ||
| 198 | + }).catch(e => { | ||
| 199 | + that1.htmlReset = 1 | ||
| 200 | + that1.btnkg = 0 | ||
| 201 | + // that1.$refs.htmlLoading.htmlReset_fuc(1) | ||
| 202 | + console.log(e) | ||
| 203 | + uni.showToast({ | ||
| 204 | + icon: 'none', | ||
| 205 | + title: '获取数据失败,请检查您的网络连接' | ||
| 206 | + }) | ||
| 207 | + }) | ||
| 208 | + } else if (res.cancel) { | ||
| 209 | + console.log('用户点击取消'); | ||
| 210 | + } | ||
| 211 | + } | ||
| 212 | + }); | ||
| 213 | + }, | ||
| 214 | + stu_change(e){ | ||
| 215 | + var index=e.detail.value | ||
| 216 | + this.name = that1.datas_stu[index].name | ||
| 217 | + this.uid = that1.datas_stu[index].id | ||
| 218 | + }, | ||
| 219 | + set_tch(){ | ||
| 220 | + if(that1.is_teacher==1){ | ||
| 221 | + that1.is_teacher=2 | ||
| 222 | + }else{ | ||
| 223 | + that1.is_teacher=1 | ||
| 224 | + } | ||
| 225 | + }, | ||
| 226 | + set_tch1(){ | ||
| 227 | + if(that1.is_introduce==1){ | ||
| 228 | + that1.is_introduce=2 | ||
| 229 | + }else{ | ||
| 230 | + that1.is_introduce=1 | ||
| 231 | + } | ||
| 232 | + }, | ||
| 233 | + set_tch2(){ | ||
| 234 | + if(that1.is_result==1){ | ||
| 235 | + that1.is_result=2 | ||
| 236 | + }else{ | ||
| 237 | + that1.is_result=1 | ||
| 238 | + } | ||
| 239 | + }, | ||
| 240 | + getdata_stu() { | ||
| 241 | + | ||
| 242 | + var jkurl="/teacher/student" | ||
| 243 | + var datas={ | ||
| 244 | + is_interview: 1 | ||
| 245 | + // page:that1.page, | ||
| 246 | + } | ||
| 247 | + // if(that1.data_last == true){ | ||
| 248 | + // return | ||
| 249 | + // } | ||
| 250 | + if (that1.btnkg == 1) { | ||
| 251 | + return | ||
| 252 | + } else { | ||
| 253 | + that1.btnkg = 1 | ||
| 254 | + } | ||
| 255 | + var page_now=1 | ||
| 256 | + that1.$service.P_post(jkurl, datas).then(res => { | ||
| 257 | + that1.btnkg = 0 | ||
| 258 | + console.log(res) | ||
| 259 | + if (res.code == 1) { | ||
| 260 | + var datas = res.data | ||
| 261 | + console.log(typeof datas) | ||
| 262 | + | ||
| 263 | + if (typeof datas == 'string') { | ||
| 264 | + datas = JSON.parse(datas) | ||
| 265 | + } | ||
| 266 | + | ||
| 267 | + if (page_now == 1) { | ||
| 268 | + | ||
| 269 | + that1.datas_stu = datas | ||
| 270 | + if(that1.options&&that1.options.id){ | ||
| 271 | + that1.getdata() | ||
| 272 | + } | ||
| 273 | + } else { | ||
| 274 | + // if (datas.data.length == 0) { | ||
| 275 | + // that.data_last = true | ||
| 276 | + // return | ||
| 277 | + // } | ||
| 278 | + // that.data_last = false | ||
| 279 | + // that.datas = that.datas.concat(datas.data) | ||
| 280 | + } | ||
| 281 | + // that1.page++ | ||
| 282 | + | ||
| 283 | + } else { | ||
| 284 | + if (res.msg) { | ||
| 285 | + uni.showToast({ | ||
| 286 | + icon: 'none', | ||
| 287 | + title: res.msg | ||
| 288 | + }) | ||
| 289 | + } else { | ||
| 290 | + uni.showToast({ | ||
| 291 | + icon: 'none', | ||
| 292 | + title: '操作失败' | ||
| 293 | + }) | ||
| 294 | + } | ||
| 295 | + } | ||
| 296 | + }).catch(e => { | ||
| 297 | + that1.btnkg = 0 | ||
| 298 | + console.log(e) | ||
| 299 | + uni.showToast({ | ||
| 300 | + icon: 'none', | ||
| 301 | + title: '操作失败' | ||
| 302 | + }) | ||
| 303 | + }) | ||
| 304 | + }, | ||
| 305 | + | ||
| 306 | + getdata() { | ||
| 307 | + | ||
| 308 | + var jkurl="/teacher/interview_show" | ||
| 309 | + var datas={ | ||
| 310 | + id:that1.options.id, | ||
| 311 | + | ||
| 312 | + } | ||
| 313 | + // if(that1.data_last == true){ | ||
| 314 | + // return | ||
| 315 | + // } | ||
| 316 | + | ||
| 317 | + if (that1.btnkg == 1) { | ||
| 318 | + return | ||
| 319 | + } else { | ||
| 320 | + that1.btnkg = 1 | ||
| 321 | + } | ||
| 322 | + var page_now=that1.page | ||
| 323 | + that1.$service.P_post(jkurl, datas).then(res => { | ||
| 324 | + that1.btnkg = 0 | ||
| 325 | + console.log(res) | ||
| 326 | + if (res.code == 1) { | ||
| 327 | + var datas = res.data | ||
| 328 | + console.log(typeof datas) | ||
| 329 | + | ||
| 330 | + if (typeof datas == 'string') { | ||
| 331 | + datas = JSON.parse(datas) | ||
| 332 | + } | ||
| 333 | + | ||
| 334 | + that1.datas=datas | ||
| 335 | + that1.id=datas.id | ||
| 336 | + that1.uid=datas.uid | ||
| 337 | + that1.name=datas.name | ||
| 338 | + that1.is_teacher=datas.is_teacher | ||
| 339 | + that1.content_one=datas.content_one | ||
| 340 | + that1.content_two=datas.content_two | ||
| 341 | + that1.is_introduce=datas.is_introduce | ||
| 342 | + that1.content_three=datas.content_three | ||
| 343 | + that1.is_result=datas.is_result | ||
| 344 | + that1.sx_time=datas.add_time | ||
| 345 | + } else { | ||
| 346 | + if (res.msg) { | ||
| 347 | + uni.showToast({ | ||
| 348 | + icon: 'none', | ||
| 349 | + title: res.msg | ||
| 350 | + }) | ||
| 351 | + } else { | ||
| 352 | + uni.showToast({ | ||
| 353 | + icon: 'none', | ||
| 354 | + title: '操作失败' | ||
| 355 | + }) | ||
| 356 | + } | ||
| 357 | + } | ||
| 358 | + }).catch(e => { | ||
| 359 | + that1.btnkg = 0 | ||
| 360 | + console.log(e) | ||
| 361 | + uni.showToast({ | ||
| 362 | + icon: 'none', | ||
| 363 | + title: '操作失败' | ||
| 364 | + }) | ||
| 365 | + }) | ||
| 366 | + }, | ||
| 367 | + | ||
| 368 | + bindDateChange(e) { | ||
| 369 | + var sx_time = e.detail.value | ||
| 370 | + sx_time=sx_time.split('-') | ||
| 371 | + sx_time=sx_time.join('/') | ||
| 372 | + that1.sx_time=sx_time | ||
| 373 | + }, | ||
| 374 | + save_fuc() { | ||
| 375 | + var jkurl="/teacher/interview_add" | ||
| 376 | + var datas={ | ||
| 377 | + uid:that1.uid, | ||
| 378 | + name:that1.name, | ||
| 379 | + is_teacher:that1.is_teacher, | ||
| 380 | + content_one:that1.content_one, | ||
| 381 | + content_two:that1.content_two, | ||
| 382 | + is_introduce:that1.is_introduce, | ||
| 383 | + content_three:that1.content_three, | ||
| 384 | + is_result:that1.is_result, | ||
| 385 | + add_time:that1.sx_time | ||
| 386 | + } | ||
| 387 | + if(that1.id){ | ||
| 388 | + jkurl="/teacher/interview_edit" | ||
| 389 | + datas={ | ||
| 390 | + id:that1.id, | ||
| 391 | + ...datas | ||
| 392 | + } | ||
| 393 | + } | ||
| 394 | + that1.$service.P_post(jkurl, datas).then(res => { | ||
| 395 | + that1.btnkg = 0 | ||
| 396 | + console.log(res) | ||
| 397 | + if (res.code == 1) { | ||
| 398 | + var datas = res.data | ||
| 399 | + console.log(typeof datas) | ||
| 400 | + | ||
| 401 | + if (typeof datas == 'string') { | ||
| 402 | + datas = JSON.parse(datas) | ||
| 403 | + } | ||
| 404 | + | ||
| 405 | + uni.showToast({ | ||
| 406 | + icon: 'none', | ||
| 407 | + title: '保存成功' | ||
| 408 | + }) | ||
| 409 | + setTimeout(function() { | ||
| 410 | + uni.navigateBack({ | ||
| 411 | + delta: 1 | ||
| 412 | + }) | ||
| 413 | + }, 1000) | ||
| 414 | + } else { | ||
| 415 | + if (res.msg) { | ||
| 416 | + uni.showToast({ | ||
| 417 | + icon: 'none', | ||
| 418 | + title: res.msg | ||
| 419 | + }) | ||
| 420 | + } else { | ||
| 421 | + uni.showToast({ | ||
| 422 | + icon: 'none', | ||
| 423 | + title: '操作失败' | ||
| 424 | + }) | ||
| 425 | + } | ||
| 426 | + } | ||
| 427 | + }).catch(e => { | ||
| 428 | + that1.btnkg = 0 | ||
| 429 | + console.log(e) | ||
| 430 | + uni.showToast({ | ||
| 431 | + icon: 'none', | ||
| 432 | + title: '操作失败' | ||
| 433 | + }) | ||
| 434 | + }) | ||
| 435 | + | ||
| 436 | + }, | ||
| 437 | + getDate(type) { | ||
| 438 | + const date = new Date(); | ||
| 439 | + let year = date.getFullYear(); | ||
| 440 | + let month = date.getMonth() + 1; | ||
| 441 | + let day = date.getDate(); | ||
| 442 | + | ||
| 443 | + if (type === 'start') { | ||
| 444 | + year = year - 60; | ||
| 445 | + } else if (type === 'end') { | ||
| 446 | + year = year; | ||
| 447 | + } | ||
| 448 | + month = month > 9 ? month : '0' + month; | ||
| 449 | + day = day > 9 ? day : '0' + day; | ||
| 450 | + return `${year}-${month}-${day}`; | ||
| 451 | + }, | ||
| 452 | + } | ||
| 453 | + } | ||
| 454 | +</script> | ||
| 455 | + | ||
| 456 | +<style lang="less" scoped> | ||
| 457 | + .stu_list { | ||
| 458 | + width: 100%; | ||
| 459 | + min-height: 100rpx; | ||
| 460 | + background: #FFFFFF; | ||
| 461 | + border-radius: 10rpx; | ||
| 462 | + .add_li{ | ||
| 463 | + width: 100%; | ||
| 464 | + min-height: 90rpx; | ||
| 465 | + padding:28rpx 30rpx; | ||
| 466 | + &+.add_li{ | ||
| 467 | + border-top: 1px solid #eee; | ||
| 468 | + } | ||
| 469 | + .add_li_box{ | ||
| 470 | + width: 100%; | ||
| 471 | + display: flex; | ||
| 472 | + align-items: center; | ||
| 473 | + justify-content: space-between; | ||
| 474 | + font-size: 30rpx; | ||
| 475 | + color: #545d71; | ||
| 476 | + input{ | ||
| 477 | + text-align: right; | ||
| 478 | + min-width: 0; | ||
| 479 | + font-size: 30rpx; | ||
| 480 | + } | ||
| 481 | + .sf_v_btn_b{ | ||
| 482 | + display: flex; | ||
| 483 | + align-items: center; | ||
| 484 | + justify-content: center; | ||
| 485 | + font-size: 18rpx; | ||
| 486 | + color: #fff; | ||
| 487 | + width: 32rpx; | ||
| 488 | + height: 32rpx; | ||
| 489 | + border: 1px solid #DEDEDE; | ||
| 490 | + border-radius: 8rpx; | ||
| 491 | + &.active{ | ||
| 492 | + background: #2D81FF; | ||
| 493 | + border: 1px solid #2D81FF; | ||
| 494 | + } | ||
| 495 | + text{ | ||
| 496 | + font-size: 18rpx; | ||
| 497 | + line-height: 20rpx; | ||
| 498 | + } | ||
| 499 | + } | ||
| 500 | + } | ||
| 501 | + .add_li_tit{ | ||
| 502 | + font-size: 30rpx; | ||
| 503 | + color: #545D71; | ||
| 504 | + line-height: 43rpx; | ||
| 505 | + margin-bottom: 12rpx; | ||
| 506 | + } | ||
| 507 | + .add_li_content{ | ||
| 508 | + font-size: 30rpx; | ||
| 509 | + color: #A6A9B1; | ||
| 510 | + line-height: 43rpx; | ||
| 511 | + width: 100%; | ||
| 512 | + height: 120rpx; | ||
| 513 | + letter-spacing:0; | ||
| 514 | + } | ||
| 515 | + } | ||
| 516 | + } | ||
| 517 | + .bz_add{ | ||
| 518 | + width: 100%; | ||
| 519 | + // position: fixed; | ||
| 520 | + // bottom: 0; | ||
| 521 | + // background: #f8f8f8; | ||
| 522 | + // z-index: 800; | ||
| 523 | + // left: 0; | ||
| 524 | + padding: 30rpx 0; | ||
| 525 | + view{ | ||
| 526 | + font-size: 32rpx; | ||
| 527 | + color: #FFFFFF; | ||
| 528 | + width: 100%; | ||
| 529 | + height: 90rpx; | ||
| 530 | + background: #2D81FF; | ||
| 531 | + border-radius: 10rpx; | ||
| 532 | + display: flex; | ||
| 533 | + align-items: center; | ||
| 534 | + justify-content: center; | ||
| 535 | + } | ||
| 536 | + .del_btn{ | ||
| 537 | + margin-top: 20rpx; | ||
| 538 | + } | ||
| 539 | + } | ||
| 540 | +</style> |
components/ft_add/ft_add1.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <view> | ||
| 3 | + <view class="stu_list"> | ||
| 4 | + <view class="add_li"> | ||
| 5 | + <picker v-if="datas_stu.length>0" mode="selector" :range="datas_stu" range-key="name" @change="stu_change"> | ||
| 6 | + <view class="add_li_box"> | ||
| 7 | + <view class=""> | ||
| 8 | + 学员姓名 | ||
| 9 | + </view> | ||
| 10 | + <input type="text" placeholder="请选择" v-model="name" disabled="true"> | ||
| 11 | + </view> | ||
| 12 | + </picker> | ||
| 13 | + </view> | ||
| 14 | + <view class="add_li"> | ||
| 15 | + <picker mode="date" :value="sx_time" :start="startDate" :end="endDate" @change="bindDateChange"> | ||
| 16 | + <view class="add_li_box"> | ||
| 17 | + <view class=""> | ||
| 18 | + 访谈时间 | ||
| 19 | + </view> | ||
| 20 | + <view class=""> | ||
| 21 | + {{sx_time?sx_time:'请选择'}} | ||
| 22 | + </view> | ||
| 23 | + </view> | ||
| 24 | + </picker> | ||
| 25 | + </view> | ||
| 26 | + | ||
| 27 | + <view class="add_li" v-for="(item,index) in diy_data"> | ||
| 28 | + <view class="add_li_tit"> | ||
| 29 | + {{item.title}} | ||
| 30 | + </view> | ||
| 31 | + <view class="add_li_content"> | ||
| 32 | + {{item.content}} | ||
| 33 | + </view> | ||
| 34 | + | ||
| 35 | + </view> | ||
| 36 | + | ||
| 37 | + <view class="add_li"> | ||
| 38 | + <view class="add_li_box"> | ||
| 39 | + <view class=""> | ||
| 40 | + 自定义标题与内容 | ||
| 41 | + </view> | ||
| 42 | + <view class="add_diy" @click="tk_show=true"> | ||
| 43 | + 添加 | ||
| 44 | + </view> | ||
| 45 | + </view> | ||
| 46 | + </view> | ||
| 47 | + | ||
| 48 | + </view> | ||
| 49 | + <u-popup :show="tk_show" @close="close" @open="open"> | ||
| 50 | + <view class="tk_box_s"> | ||
| 51 | + <view class="pop_tit"> | ||
| 52 | + <view class="" @click="close"> | ||
| 53 | + 取消 | ||
| 54 | + </view> | ||
| 55 | + <view class="pop_tit_t" @click="save_diy"> | ||
| 56 | + 确定 | ||
| 57 | + </view> | ||
| 58 | + </view> | ||
| 59 | + <input class="diy_tit" type="text" placeholder="请输入标题" v-model="diy_tit"> | ||
| 60 | + <textarea class="diy_content" placeholder="请输入内容" v-model="diy_content"></textarea> | ||
| 61 | + </view> | ||
| 62 | + </u-popup> | ||
| 63 | + <view class="bz_add" > | ||
| 64 | + <view class="" @click="save_fuc"> | ||
| 65 | + 保存 | ||
| 66 | + </view> | ||
| 67 | + <view v-if="options.id" class="del_btn" @click="del_fuc(options)"> | ||
| 68 | + 删除 | ||
| 69 | + </view> | ||
| 70 | + </view> | ||
| 71 | + </view> | ||
| 72 | +</template> | ||
| 73 | + | ||
| 74 | +<script> | ||
| 75 | + import Vue from 'vue' | ||
| 76 | + import { | ||
| 77 | + mapState, | ||
| 78 | + mapMutations | ||
| 79 | + } from 'vuex' | ||
| 80 | + var that1 | ||
| 81 | + export default { | ||
| 82 | + name:"ft_add1", | ||
| 83 | + props: { | ||
| 84 | + options:{ | ||
| 85 | + type: Object, | ||
| 86 | + default: function () { | ||
| 87 | + return {} | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + } | ||
| 91 | + }, | ||
| 92 | + data() { | ||
| 93 | + return { | ||
| 94 | + id:'', | ||
| 95 | + uid:'', | ||
| 96 | + name:'', | ||
| 97 | + sx_time:'', | ||
| 98 | + tch_js:0, | ||
| 99 | + js_other:0, | ||
| 100 | + result_ask:0, | ||
| 101 | + content:'', | ||
| 102 | + content1:'', | ||
| 103 | + content2:'', | ||
| 104 | + tk_show:false, | ||
| 105 | + diy_tit:'', | ||
| 106 | + diy_content:'', | ||
| 107 | + diy_data:[], | ||
| 108 | + datas_stu:[] | ||
| 109 | + }; | ||
| 110 | + }, | ||
| 111 | + computed: { | ||
| 112 | + ...mapState(['hasLogin', 'forcedLogin', 'userName', 'userinfo', 'nowtime']), | ||
| 113 | + | ||
| 114 | + startDate() { | ||
| 115 | + return this.getDate('start'); | ||
| 116 | + }, | ||
| 117 | + endDate() { | ||
| 118 | + return this.getDate('end'); | ||
| 119 | + } | ||
| 120 | + }, | ||
| 121 | + mounted() { | ||
| 122 | + that1=this | ||
| 123 | + that1.getdata_stu() | ||
| 124 | + }, | ||
| 125 | + methods:{ | ||
| 126 | + del_fuc(item){ | ||
| 127 | + //teacher/interviewr_del 常规访谈删除接口 | ||
| 128 | + //teacher/interview_del 入学关怀删除接口 | ||
| 129 | + uni.showModal({ | ||
| 130 | + title: '提示', | ||
| 131 | + content: '是否删除该记录', | ||
| 132 | + success: function (res) { | ||
| 133 | + if (res.confirm) { | ||
| 134 | + console.log('用户点击确定'); | ||
| 135 | + var jkurl='teacher/interviewr_del' | ||
| 136 | + var datas={ | ||
| 137 | + id:item.id | ||
| 138 | + // address_id:'' | ||
| 139 | + } | ||
| 140 | + var header={ | ||
| 141 | + 'content-type': 'application/json', | ||
| 142 | + } | ||
| 143 | + // that.$service.P_post(jkurl, datas,header).then(res => { | ||
| 144 | + that1.$service.P_post(jkurl, datas).then(res => { | ||
| 145 | + that1.btnkg = 0 | ||
| 146 | + console.log(res) | ||
| 147 | + if (res.code == 1){ | ||
| 148 | + that1.htmlReset = 0 | ||
| 149 | + var datas = res.data | ||
| 150 | + console.log(typeof datas) | ||
| 151 | + | ||
| 152 | + if (typeof datas == 'string') { | ||
| 153 | + datas = JSON.parse(datas) | ||
| 154 | + } | ||
| 155 | + console.log(res) | ||
| 156 | + | ||
| 157 | + uni.showToast({ | ||
| 158 | + icon:'none', | ||
| 159 | + title:'删除成功' | ||
| 160 | + }) | ||
| 161 | + // that1.datas.splice(index,1) | ||
| 162 | + setTimeout(()=>{ | ||
| 163 | + uni.navigateBack({ | ||
| 164 | + delta:1 | ||
| 165 | + }) | ||
| 166 | + },1000) | ||
| 167 | + } else { | ||
| 168 | + | ||
| 169 | + if (res.msg) { | ||
| 170 | + uni.showToast({ | ||
| 171 | + icon: 'none', | ||
| 172 | + title: res.msg | ||
| 173 | + }) | ||
| 174 | + } else { | ||
| 175 | + uni.showToast({ | ||
| 176 | + icon: 'none', | ||
| 177 | + title: '获取数据失败' | ||
| 178 | + }) | ||
| 179 | + } | ||
| 180 | + } | ||
| 181 | + }).catch(e => { | ||
| 182 | + that1.htmlReset = 1 | ||
| 183 | + that1.btnkg = 0 | ||
| 184 | + // that1.$refs.htmlLoading.htmlReset_fuc(1) | ||
| 185 | + console.log(e) | ||
| 186 | + uni.showToast({ | ||
| 187 | + icon: 'none', | ||
| 188 | + title: '获取数据失败,请检查您的网络连接' | ||
| 189 | + }) | ||
| 190 | + }) | ||
| 191 | + } else if (res.cancel) { | ||
| 192 | + console.log('用户点击取消'); | ||
| 193 | + } | ||
| 194 | + } | ||
| 195 | + }); | ||
| 196 | + }, | ||
| 197 | + stu_change(e){ | ||
| 198 | + var index=e.detail.value | ||
| 199 | + this.name = that1.datas_stu[index].name | ||
| 200 | + this.uid = that1.datas_stu[index].id | ||
| 201 | + }, | ||
| 202 | + getdata_stu() { | ||
| 203 | + var that1=this | ||
| 204 | + console.log(this.options) | ||
| 205 | + var jkurl="/teacher/student" | ||
| 206 | + var datas={ | ||
| 207 | + // page:that1.page, | ||
| 208 | + } | ||
| 209 | + // if(that1.data_last == true){ | ||
| 210 | + // return | ||
| 211 | + // } | ||
| 212 | + if (that1.btnkg == 1) { | ||
| 213 | + return | ||
| 214 | + } else { | ||
| 215 | + that1.btnkg = 1 | ||
| 216 | + } | ||
| 217 | + var page_now=1 | ||
| 218 | + that1.$service.P_post(jkurl, datas).then(res => { | ||
| 219 | + that1.btnkg = 0 | ||
| 220 | + console.log(res) | ||
| 221 | + if (res.code == 1) { | ||
| 222 | + var datas = res.data | ||
| 223 | + console.log(typeof datas) | ||
| 224 | + | ||
| 225 | + if (typeof datas == 'string') { | ||
| 226 | + datas = JSON.parse(datas) | ||
| 227 | + } | ||
| 228 | + | ||
| 229 | + if (page_now == 1) { | ||
| 230 | + | ||
| 231 | + that1.datas_stu = datas | ||
| 232 | + console.log(that1.datas_stu) | ||
| 233 | + if(that1.options.id){ | ||
| 234 | + that1.getdata() | ||
| 235 | + } | ||
| 236 | + } else { | ||
| 237 | + // if (datas.data.length == 0) { | ||
| 238 | + // that.data_last = true | ||
| 239 | + // return | ||
| 240 | + // } | ||
| 241 | + // that.data_last = false | ||
| 242 | + // that.datas = that.datas.concat(datas.data) | ||
| 243 | + } | ||
| 244 | + // that1.page++ | ||
| 245 | + | ||
| 246 | + } else { | ||
| 247 | + if (res.msg) { | ||
| 248 | + uni.showToast({ | ||
| 249 | + icon: 'none', | ||
| 250 | + title: res.msg | ||
| 251 | + }) | ||
| 252 | + } else { | ||
| 253 | + uni.showToast({ | ||
| 254 | + icon: 'none', | ||
| 255 | + title: '操作失败' | ||
| 256 | + }) | ||
| 257 | + } | ||
| 258 | + } | ||
| 259 | + }).catch(e => { | ||
| 260 | + that1.btnkg = 0 | ||
| 261 | + console.log(e) | ||
| 262 | + uni.showToast({ | ||
| 263 | + icon: 'none', | ||
| 264 | + title: '操作失败' | ||
| 265 | + }) | ||
| 266 | + }) | ||
| 267 | + }, | ||
| 268 | + | ||
| 269 | + getdata() { | ||
| 270 | + | ||
| 271 | + var jkurl="/teacher/interviewr_show" | ||
| 272 | + var datas={ | ||
| 273 | + id:that1.options.id | ||
| 274 | + } | ||
| 275 | + // if(that1.data_last == true){ | ||
| 276 | + // return | ||
| 277 | + // } | ||
| 278 | + if (that1.btnkg == 1) { | ||
| 279 | + return | ||
| 280 | + } else { | ||
| 281 | + that1.btnkg = 1 | ||
| 282 | + } | ||
| 283 | + var page_now=that1.page | ||
| 284 | + that1.$service.P_post(jkurl, datas).then(res => { | ||
| 285 | + that1.btnkg = 0 | ||
| 286 | + console.log(res) | ||
| 287 | + if (res.code == 1) { | ||
| 288 | + var datas = res.data | ||
| 289 | + console.log(typeof datas) | ||
| 290 | + | ||
| 291 | + if (typeof datas == 'string') { | ||
| 292 | + datas = JSON.parse(datas) | ||
| 293 | + } | ||
| 294 | + | ||
| 295 | + that1.datas=datas | ||
| 296 | + that1.id=datas.id | ||
| 297 | + that1.uid=datas.uid | ||
| 298 | + that1.name=datas.name||'' | ||
| 299 | + that1.sx_time=datas.add_time | ||
| 300 | + that1.diy_data=datas.content||[] | ||
| 301 | + | ||
| 302 | + } else { | ||
| 303 | + if (res.msg) { | ||
| 304 | + uni.showToast({ | ||
| 305 | + icon: 'none', | ||
| 306 | + title: res.msg | ||
| 307 | + }) | ||
| 308 | + } else { | ||
| 309 | + uni.showToast({ | ||
| 310 | + icon: 'none', | ||
| 311 | + title: '操作失败' | ||
| 312 | + }) | ||
| 313 | + } | ||
| 314 | + } | ||
| 315 | + }).catch(e => { | ||
| 316 | + that1.btnkg = 0 | ||
| 317 | + console.log(e) | ||
| 318 | + uni.showToast({ | ||
| 319 | + icon: 'none', | ||
| 320 | + title: '操作失败' | ||
| 321 | + }) | ||
| 322 | + }) | ||
| 323 | + }, | ||
| 324 | + open() { | ||
| 325 | + // console.log('open'); | ||
| 326 | + }, | ||
| 327 | + close() { | ||
| 328 | + this.tk_show = false | ||
| 329 | + // console.log('close'); | ||
| 330 | + }, | ||
| 331 | + save_diy(){ | ||
| 332 | + if(!that1.diy_tit){ | ||
| 333 | + uni.showToast({ | ||
| 334 | + icon:'none', | ||
| 335 | + title:'请输入标题' | ||
| 336 | + }) | ||
| 337 | + return | ||
| 338 | + } | ||
| 339 | + if(!that1.diy_content){ | ||
| 340 | + uni.showToast({ | ||
| 341 | + icon:'none', | ||
| 342 | + title:'请输入内容' | ||
| 343 | + }) | ||
| 344 | + return | ||
| 345 | + } | ||
| 346 | + var datas={ | ||
| 347 | + title:that1.diy_tit, | ||
| 348 | + content:that1.diy_content | ||
| 349 | + } | ||
| 350 | + that1.diy_data.push(datas) | ||
| 351 | + that1.diy_tit='' | ||
| 352 | + that1.diy_content='' | ||
| 353 | + this.tk_show = false | ||
| 354 | + }, | ||
| 355 | + bindDateChange(e) { | ||
| 356 | + var sx_time = e.detail.value | ||
| 357 | + sx_time=sx_time.split('-') | ||
| 358 | + sx_time=sx_time.join('/') | ||
| 359 | + that1.sx_time=sx_time | ||
| 360 | + }, | ||
| 361 | + save_fuc() { | ||
| 362 | + var jkurl="/teacher/interviewr_add" | ||
| 363 | + var datas={ | ||
| 364 | + uid:that1.uid, | ||
| 365 | + name:that1.name, | ||
| 366 | + content:JSON.stringify(that1.diy_data), | ||
| 367 | + add_time:that1.sx_time | ||
| 368 | + } | ||
| 369 | + if(that1.id){ | ||
| 370 | + jkurl="/teacher/interviewr_edit" | ||
| 371 | + datas={ | ||
| 372 | + id:that1.id, | ||
| 373 | + ...datas | ||
| 374 | + } | ||
| 375 | + } | ||
| 376 | + that1.$service.P_post(jkurl, datas).then(res => { | ||
| 377 | + that1.btnkg = 0 | ||
| 378 | + console.log(res) | ||
| 379 | + if (res.code == 1) { | ||
| 380 | + var datas = res.data | ||
| 381 | + console.log(typeof datas) | ||
| 382 | + | ||
| 383 | + if (typeof datas == 'string') { | ||
| 384 | + datas = JSON.parse(datas) | ||
| 385 | + } | ||
| 386 | + | ||
| 387 | + uni.showToast({ | ||
| 388 | + icon: 'none', | ||
| 389 | + title: '保存成功' | ||
| 390 | + }) | ||
| 391 | + setTimeout(function() { | ||
| 392 | + uni.navigateBack({ | ||
| 393 | + delta: 1 | ||
| 394 | + }) | ||
| 395 | + }, 1000) | ||
| 396 | + } else { | ||
| 397 | + if (res.msg) { | ||
| 398 | + uni.showToast({ | ||
| 399 | + icon: 'none', | ||
| 400 | + title: res.msg | ||
| 401 | + }) | ||
| 402 | + } else { | ||
| 403 | + uni.showToast({ | ||
| 404 | + icon: 'none', | ||
| 405 | + title: '操作失败' | ||
| 406 | + }) | ||
| 407 | + } | ||
| 408 | + } | ||
| 409 | + }).catch(e => { | ||
| 410 | + that1.btnkg = 0 | ||
| 411 | + console.log(e) | ||
| 412 | + uni.showToast({ | ||
| 413 | + icon: 'none', | ||
| 414 | + title: '操作失败' | ||
| 415 | + }) | ||
| 416 | + }) | ||
| 417 | + | ||
| 418 | + }, | ||
| 419 | + getDate(type) { | ||
| 420 | + const date = new Date(); | ||
| 421 | + let year = date.getFullYear(); | ||
| 422 | + let month = date.getMonth() + 1; | ||
| 423 | + let day = date.getDate(); | ||
| 424 | + | ||
| 425 | + if (type === 'start') { | ||
| 426 | + year = year - 60; | ||
| 427 | + } else if (type === 'end') { | ||
| 428 | + year = year; | ||
| 429 | + } | ||
| 430 | + month = month > 9 ? month : '0' + month; | ||
| 431 | + day = day > 9 ? day : '0' + day; | ||
| 432 | + return `${year}-${month}-${day}`; | ||
| 433 | + }, | ||
| 434 | + } | ||
| 435 | + } | ||
| 436 | +</script> | ||
| 437 | + | ||
| 438 | +<style lang="less" scoped> | ||
| 439 | + .stu_list { | ||
| 440 | + width: 100%; | ||
| 441 | + min-height: 100rpx; | ||
| 442 | + background: #FFFFFF; | ||
| 443 | + border-radius: 10rpx; | ||
| 444 | + .add_li{ | ||
| 445 | + width: 100%; | ||
| 446 | + min-height: 90rpx; | ||
| 447 | + padding:28rpx 30rpx; | ||
| 448 | + &+.add_li{ | ||
| 449 | + border-top: 1px solid #eee; | ||
| 450 | + } | ||
| 451 | + .add_li_box{ | ||
| 452 | + width: 100%; | ||
| 453 | + display: flex; | ||
| 454 | + align-items: center; | ||
| 455 | + justify-content: space-between; | ||
| 456 | + font-size: 30rpx; | ||
| 457 | + color: #545d71; | ||
| 458 | + input{ | ||
| 459 | + text-align: right; | ||
| 460 | + min-width: 0; | ||
| 461 | + font-size: 30rpx; | ||
| 462 | + } | ||
| 463 | + .sf_v_btn_b{ | ||
| 464 | + display: flex; | ||
| 465 | + align-items: center; | ||
| 466 | + justify-content: center; | ||
| 467 | + font-size: 18rpx; | ||
| 468 | + color: #fff; | ||
| 469 | + width: 32rpx; | ||
| 470 | + height: 32rpx; | ||
| 471 | + border: 1px solid #DEDEDE; | ||
| 472 | + border-radius: 8rpx; | ||
| 473 | + &.active{ | ||
| 474 | + background: #2D81FF; | ||
| 475 | + border: 1px solid #2D81FF; | ||
| 476 | + } | ||
| 477 | + text{ | ||
| 478 | + font-size: 18rpx; | ||
| 479 | + line-height: 20rpx; | ||
| 480 | + } | ||
| 481 | + } | ||
| 482 | + .add_diy{ | ||
| 483 | + font-size: 30rpx; | ||
| 484 | + color: #2D81FF; | ||
| 485 | + } | ||
| 486 | + } | ||
| 487 | + .add_li_tit{ | ||
| 488 | + font-size: 30rpx; | ||
| 489 | + color: #545D71; | ||
| 490 | + line-height: 43rpx; | ||
| 491 | + margin-bottom: 12rpx; | ||
| 492 | + } | ||
| 493 | + .add_li_content{ | ||
| 494 | + font-size: 30rpx; | ||
| 495 | + color: #A6A9B1; | ||
| 496 | + line-height: 43rpx; | ||
| 497 | + width: 100%; | ||
| 498 | + // height: 120rpx; | ||
| 499 | + letter-spacing:0; | ||
| 500 | + } | ||
| 501 | + } | ||
| 502 | + } | ||
| 503 | + .bz_add{ | ||
| 504 | + width: 100%; | ||
| 505 | + // position: fixed; | ||
| 506 | + // bottom: 0; | ||
| 507 | + // background: #f8f8f8; | ||
| 508 | + // z-index: 800; | ||
| 509 | + // left: 0; | ||
| 510 | + padding: 30rpx 0; | ||
| 511 | + view{ | ||
| 512 | + font-size: 32rpx; | ||
| 513 | + color: #FFFFFF; | ||
| 514 | + width: 100%; | ||
| 515 | + height: 90rpx; | ||
| 516 | + background: #2D81FF; | ||
| 517 | + border-radius: 10rpx; | ||
| 518 | + display: flex; | ||
| 519 | + align-items: center; | ||
| 520 | + justify-content: center; | ||
| 521 | + } | ||
| 522 | + .del_btn{ | ||
| 523 | + margin-top: 20rpx; | ||
| 524 | + } | ||
| 525 | + } | ||
| 526 | + .pop_tit{ | ||
| 527 | + width: 100%; | ||
| 528 | + height: 100rpx; | ||
| 529 | + font-size: 30rpx; | ||
| 530 | + color: #A9B1C0; | ||
| 531 | + display: flex; | ||
| 532 | + align-items: center; | ||
| 533 | + justify-content: space-between; | ||
| 534 | + padding: 0 30rpx; | ||
| 535 | + .pop_tit_t{ | ||
| 536 | + color: #2D81FF; | ||
| 537 | + } | ||
| 538 | + } | ||
| 539 | + .tk_box_s{ | ||
| 540 | + // height: 600rpx; | ||
| 541 | + background: #ffffff; | ||
| 542 | + } | ||
| 543 | + .diy_tit{ | ||
| 544 | + width: 100%; | ||
| 545 | + height: 100rpx; | ||
| 546 | + padding: 0 30rpx; | ||
| 547 | + font-size: 30rpx; | ||
| 548 | + color: #333; | ||
| 549 | + border-bottom: 1px solid #EEEEEE; | ||
| 550 | + } | ||
| 551 | + .diy_content{ | ||
| 552 | + width: 100%; | ||
| 553 | + height: 790rpx; | ||
| 554 | + padding: 30rpx; | ||
| 555 | + font-size: 30rpx; | ||
| 556 | + color: #333; | ||
| 557 | + box-sizing: border-box; | ||
| 558 | + } | ||
| 559 | +</style> |
components/my_lazy_load/my_lazy_load.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <view class="mll"> | ||
| 3 | + <block v-if="!isError"> | ||
| 4 | + <image v-if="isShow" :src="src" :mode="mode" @tap="clickImg" | ||
| 5 | + :style="{ | ||
| 6 | + opacity: Number(opacity), | ||
| 7 | + borderRadius: borderRadius + 'rpx', | ||
| 8 | + // 因为time值需要改变,所以不直接用duration值(不能改变父组件prop传过来的值) | ||
| 9 | + transition: `opacity ${time / 1000}s ease-in-out` | ||
| 10 | + }"></image> | ||
| 11 | + <image v-else :src="loadingImg" mode="aspectFill" @error="loadError" @tap="clickImg"></image> | ||
| 12 | + </block> | ||
| 13 | + <image v-else :src="errorImg" mode="aspectFill" :title="errorImg" @tap="clickImg"></image> | ||
| 14 | + <image class="test_img" :src="src" mode="aspectFill" @load="imgLoaded" @error="loadError"></image> | ||
| 15 | + </view> | ||
| 16 | +</template> | ||
| 17 | + | ||
| 18 | +<script> | ||
| 19 | + export default { | ||
| 20 | + name:"my_lazy_load", | ||
| 21 | + props: { | ||
| 22 | + index: { | ||
| 23 | + type: [Number, String] | ||
| 24 | + }, | ||
| 25 | + src:{ | ||
| 26 | + type: String, | ||
| 27 | + default: '' | ||
| 28 | + }, | ||
| 29 | + mode:{ | ||
| 30 | + type: String, | ||
| 31 | + default: '' | ||
| 32 | + }, | ||
| 33 | + // 占位图片路径 | ||
| 34 | + loadingImg: { | ||
| 35 | + type: String, | ||
| 36 | + default: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAMAAAC3Ycb+AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6OUM0QjNBQjkyQUQ2MTFFQTlCNUQ4RTIzNDE5RUIxNjciIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6OUM0QjNBQkEyQUQ2MTFFQTlCNUQ4RTIzNDE5RUIxNjciPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo5QzRCM0FCNzJBRDYxMUVBOUI1RDhFMjM0MTlFQjE2NyIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo5QzRCM0FCODJBRDYxMUVBOUI1RDhFMjM0MTlFQjE2NyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PtRHfPcAAAAzUExURZWVldfX18PDw62trZubm9zc3Li4uKGhoebm5tLS0uHh4c3Nzaenp729vcjIyLKysuvr6141L40AAAcXSURBVHja7NzZlqpGAEBR5lG0//9rIw7IJKJi4or7PGTdtN10wr5SVAEGf/qqArsAiIAAERAgAgJEQIAIiIAAERAgAgJEQIAIiIAAERAgAgJEQIAIiIAAERAgAgJEQIAIiIAAERAgAgJEQIAIiIAAERAgAgJEQIAIiIAAERAgAgJEQIAIiIAAERAgAgJEQIAIiIAAERAgAgJEQIAIiIAAERAgAgJEQIAICBABERAgAgJEQIAICBABERAgAgJEQIAICBABERAgAgJEQIAICBABERAgAgJEQIAICBABERAgAgJEQIAICBABERAgAgJEQIAICBABERAgAgJEQIAICBABERAgAgJEQIAICBABERAg+nmQFMi5Jis+sIniED23jSzIgLTtg2D//iYme/8QBM/9lQ+CAEhbNLM3N9hEHAThX7GPCiBfAxK1b51kD+R7QMLjXg7iCsgWIPUh7pfVozG791oeBPngm48G583uW5GkBvI+SBaM2xXDn1oqum423bX/mgF5FySc2cv93Voug9TdZotsggnkBZB2NzbhrSY5HnoG07jei8dvzsJB/c3W60SALILE46+WCztsbhPR7R2VJq0ukEcT49nyy8QhaKcRa3fYHZD4+ufqOJAcgDz8/59vtw1I3QP5K6JsOG0vm3hce4I8LQp/BaRZGJC3AAn7IKOKXbC+7EdA5vdmmVwOLksgRThqOqiH4XEGsht+peoPUE8U/jJIO5OLH4GEwUslV5G0PTBG5Uiw/Y2jyigO3l9HAHKv9PYb82LloH74dZBoBUgar+l48NsNvtD0fkez9iwrAvIYZDRCl+Xs149Hm/KZmQ+QjUCiO1ei4ru7EsgnQYrkznlQb7thCuRfAzlOAPN72427P4VA/i2Q/DKT/Ls/VR8fvIBsDZIuz7TPF6TCbnk4GJkB2RokejTjuE7/unlgCuSTIO0Cy+Plp6vDfnQlBchy8QtjSHVd3EgmK1bHLm+H6+nXYbz2DuQRSPnqoL7vvq0u70on4zvxgCyWD3b9UyDVdW24PaWaiGTnFZJwPIQAebDpIKheBIm7n124ZthMJipAlkqHO+IZkP1tbfzOJark/A7MgKyvvl60fRqkvXfhuow+t9+q00+0/yyBrK8ZngOtBzldhw2X9tvpNGty0gvkmbPeJ0Cy/r09s/stbmfo0yMWkEdjevgKyOn2t2pxv7UXoibTdCDLje9/Ww1ymqzn87dbp92242ZmMRjI8hASvwKSLq4udqN6ksw8nxXN3tszD9L8Gkg+2mFrQYql5az4tvFj5xOx4VwnSdeBtGdyPwUytxK77pBVlNHdO7OK3rh/eTPUvdutT3fO52tuHMqD4N7llv8pyOQQ//w19YVDfX27+Sfuby9/6nau4pdA8vEdOZuChEH/quHt0Jg+IRJ/5+PrHwKZXfjbDiS73Zo7mu5UkzX7uTsXe0e/7nC3ePf1O69+BUg2XDfZCqSqOu7rGVf8cHBe8zhC2b61dtUHXv0OkGo6ZL4JkpbRYXdUaFevivx2M/1GIOctNh949TtAoumQ+TpIHMX54CJu+8BDd8FkE5BqcZh/59XvAClmTvKfB0nDqIlHo3T70SftyW1eX9dXtgQJqs1f/Q6QaOa/7wmQKtxH8eiGoCRuovODIO3VxOMmruZbHrLyD7z6DSDtGyT7ew1kf9hNn07c986JTovzzem0Id9wUG+Vk/IDr34DSNR7huZJkMFT6vEhqrPx/j5cnlZML8N6/PAzh9Y99Flm5Yde/c9BquDOkvkKkMP58dA4qi9vivE8JOvGz/j8FokfPpr288+pH2ZPOZrLmeGD+7KOh6dqYWJ48ki7yUg0tz0go/fv/LLddfV3sgOLJyaGPY/zrSlh1a36Arkzoue9CyG35ze6E6/dzO2Ga0EGHqdRJIkfn9/8OEjTW8Vq91ZWh39FeehWA7Nu9ft8CpUEk1WWOyDF0OPyEU2Pnzf/bZC0P6IPzmAvu7KauQBVrgKpJ0tG2arHzX8e5Pb3PezNs/PrX+3JMyCLn9XXf37tPFHvt09WfCDDjx+yyn1/p1V11j7GnB/q3leLuVva79S/tzed+db08YpF4uOZtmz/9oXWMq6BCAgQAQEiIEAERECACAgQAQEiIEAERECACAgQAQEiIEAERECACAgQAQEiIEAERECACAgQAQEiIEAERECACAgQAQEiIEAERECACAgQAQEiIEAERECACAgQAQEiIEAERECACAgQAQEiIEAERECACAgQAQEiIEAEBIiACAgQAQEiIEAEBIiACAgQAQEiIEAEBIiACAgQAQEiIEAEBIiACAgQAQEiIEAEBIiACAgQAQEiIEAEBIiACAgQAQEiIEAEBIiACAgQAQEiIEAEBIiACAgQAQEiIEAEBIiACAgQAQEiIEAEBIiAALELvqt/BBgACqVeUBXxcCkAAAAASUVORK5CYII=' | ||
| 37 | + }, | ||
| 38 | + // 加载失败的错误占位图 | ||
| 39 | + errorImg: { | ||
| 40 | + type: String, | ||
| 41 | + default: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAMAAAC3Ycb+AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6ODdDMjhENDYyQUQ2MTFFQTlDQ0VBODgxQjFFOEEyMEMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6ODdDMjhENDcyQUQ2MTFFQTlDQ0VBODgxQjFFOEEyMEMiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo4N0MyOEQ0NDJBRDYxMUVBOUNDRUE4ODFCMUU4QTIwQyIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo4N0MyOEQ0NTJBRDYxMUVBOUNDRUE4ODFCMUU4QTIwQyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PhLwhikAAAAzUExURZWVldfX162trcPDw5ubm7i4uNzc3Obm5s3NzaGhoeHh4cjIyKenp9LS0r29vbKysuvr67sDMEkAAAlpSURBVHja7NzpYqMgAIVRUVHc8/5PO66R1WAbOzX97q+ZtDEpR0AWTR7kVyWhCAAhgABCAAGEAAIIAQQQAggBBBACCCAEEEAIIIAQQAgggBBAACGAAEIAAYQAQgABhAACCAEEEAIIIAQQAgggBBBACCCAEEAAIYAQQAAhgABCAAGEAAIIAYQAAggBBBACCCAEEEAIIAQQQAgggBBAACGAAEIAIYAAQgABhAACCAEEEAIIAQQQAgggBBBACCCAEEAAIYAQQAAhgABCAAGEAAIIAYQAAggBBBACCCAEEEAIIAQQQAgggBBAACGAAEIAIYAAQgABhAACCAEEEAIIAQQQAgggBBBACCCAEEAIIIAQQAAhgABCAAGEAEIAAYQAAggBBBACCCAEEAIIIAQQQAgggBBAACGAEEAAIYAAsqeX5QWHKIcs/Ptl03lfL4zDFPWfBGmSpPn+IZzSH5KkCL5B+n+oklwz6Iz//R2QzFOabzhEmiRirAmZt/bl0w/dpMbLqeeo4wEdpC7zR5WAPKziHKtO7ql+ReKvIa9BxgNaL5ZtEkpeAGIVp5jKJa09xVo9vgSSzQcszdYvmOqjQNSQ6pHK6rO1n1Xj32788miwHLaZz1Tl9i/yayDlYJ/60/+lp8GSY7OY1B8E4p55bWmfquFk22GLuUUxi78cX+m+BjL2GLkhMrV+/muS6Sfic0CEp5T1Yu2OQdTzsKV0MJV73KVjroyTffxfuv5Tf3fd6iLT9wz8YdVHgUzF2Is9/Xhi5sYJqP1w/GUpjOiHVbaI0w2L+pg3GZzvtokcgHxWDXHaiy78l3sPke01qphamT5c+dqyeAGSumdL/mkggauTam0e3L/mPEiqtzKDbl0Z1Wn8xOa4ySo8X/7TQIJnY/seEKWf12UmC72CKP9xYjr19RPT7NNA+oMO+R0gwmlotAry+C6I0f59ch8yXVQOr0BKYcXt1IUYRyCt+Ur9HGsrQKI79WY9sY9ARPKlzFOFdb41ioD8b5Bp+mqeeRKAxINkESBFGpOpKhgv9OuYpH8A8l4Qa3qp60Kl2/k+rG2sWafuuyCBafb2j4JkgZUob3nWcmicpkxEgmTLLGejTxnWSWCi8lPmsk6DlIHFJv24ojiYyYoGacwL8zXTLEAVaDI/Ybb3NIgKDSv2oXpmHkvNs+PTpMASEdlk7fOZeRk37fwJ6yGnQarQsGIfqqcvx43rTOXY6jf7uKXdRzdLDRPbjIrx1cIj3Kr4KyBFezzgUGuR5893qkOQ19fR2uVBaU+r16LphJNOiatK7PeBZK/Kb+tUn71rcQjSvARpghfH/yG/D2RetTuI3N5QrMWdP46brP7FmKZ//CGQ9At9SL01DLkzY/Vs8Z97fQZ7gelw7jHqCz+/Wile5J4g3Vc79eb5a6oLSue+Ve83gaSv2jp5PxCzjzwFUm9zw9MllSMil1kS4d2E9SaQ1xNo9wMxx0+nQNLnew/WDHvveMAHYm08mofl3TFI/8pD3Q6kMAv6DIi2jTCwRJUvNdDYrrJum9oHhusCbWALonwxBRk1vXMnEGWuT5wAmfYuVGUYpJ7fUZujCN92hvzwWlrFgxSfANKb10DxIMbShnfrynyZZV30imA7P43ArXXHbvBVkTCIuGy25AdBrHmNeBCpL214QdLp9LZarG3IMWrmW0ehtuO7F2PS09UcgqS3B7FKPhpknrStD0HGF/vQRne37LwLG8EbHT4WxN7/Fg0yD9Yr/3br4nnstA+0Il6QxzdBmg8A6a2/IRbkcK9h/uzV8zywF/oSkOyageCPglRWgcWClHnEzs9q/t/SENVXgFijlsq3VtXdCsRp4qObrLLLgjuzSq3fX89ZZW6AfxNIzF6X9FYgThN/fk093KkvHX/hbWd+DqS/FUhlf+G3gohEXzVs3g9iDluWoaW8fL73QhB34u+tIHIf19nLuF4Q98a09Eynnl56q+ePgEhnX+dbQOp6H5XnJ0ACd8dFgkwf12nTOTcEqd2pom+CFF02TIPw6dKmrLS5qOtBpo8b5quUtrwrSGbuqPkeSJqllTFHO02NPxdMrm+y5LKdWyWXjw4vA5nGEtnjuyCFyHqNYvEolzmASm3zK1Eg5zr13lhqV1tlksnVw8Pkwgri7O07AVKLJkutRYw87bPlRpBpNXE8xGb+fhBlvEGrGPLqViu5sILIx9dAmqF1705sxF4M8+R8P5dOdQwi12fMnATpjJ2JSt/POIvU9wPJEs/jduJAjLvU0yFT0i64Yb1bsVi79dA4pEy3TzoHMq2O7Re4vXm5O9+l290NpE4CU+YRIMNye2iaqbVS2AUnn2fsekthYKReVNutVedA5juttyIXrT38mOds+ps9DWhwL7GWc61/DVKPzVN9UHDarf1icU98IOU8tm6L031Iq63t1tKzj3fe/FCpO4F0/i0Z2+yvA1KeGBjqj1qYx8/zoxpKZ1Yl367I1k+sfcft/QPy9csXy/32qX1qLZsrryG5BGQaRj0vc/b7N54XXq293TCLB5HO42Fy517obW19b+qjl3CHp0fdLJcWvmdy1etESi/uAdJrs1hTaUklHuW8qSDdC3UfXVR5cnD3rAFSSqtFb7z7eapErx7rC739jCXfbK3aWiipjXo8UbmxXPa7QQq9R289j2Gr88N7Ag5AlHPRKc37pNZv0CZtX1tVMG6rm8qW1/KlCgQvcMss933ybwXZz3dReW5yce4ByZtHFIhwT9kmjxg8BzbKDUe1PB9edBJqSN7/KM1LmqyuMZ5BpeTUw1aD/uDI0relPfSHa/Wn8Pxq1BNfxy/h3IdwOJqIKumb9CHvTqMefyY82RoQAgggBBBACCCAEEAAIYAQQAAhgABCAAGEAAIIAYQAAggBBBACCCAEEEAIIAQQQAgggBBAACGAAEIAIYAAQgABhAACCAEEEAIIAQQQAgggBBBACCCAEEAIIIAQQAAhgABCAAGEAEIAAYQAAggBBBACCCAEEAIIIAQQQAgggBBAACGAEEAAIYAAQgABhAACCAEEEAIIAQQQAgggBBBACCCAEEAIIIAQQAAhgABCAAGEAEIAAYQAAggBBBACCCAEEAIIIAQQQAgggBBAACGAEEAAIYAAQgABhAACCAGEAAIIAQQQAgggBBBACCAEEEAIIIAQQAAhgABCACGAAEIAAYQAAggBBBACCAEEEAIIIAQQQAggfyL/BBgA8PgLdH0TBtkAAAAASUVORK5CYII=' | ||
| 42 | + }, | ||
| 43 | + // 圆角值 | ||
| 44 | + borderRadius: { | ||
| 45 | + type: [Number, String], | ||
| 46 | + default: 0 | ||
| 47 | + }, | ||
| 48 | + // 淡入淡出动画的过渡时间 | ||
| 49 | + duration: { | ||
| 50 | + type: [Number, String], | ||
| 51 | + default: 500 | ||
| 52 | + }, | ||
| 53 | + // 渡效果的速度曲线,各个之间差别不大,因为这是淡入淡出,且时间很短,不是那些变形或者移动的情况,会明显 | ||
| 54 | + // linear|ease|ease-in|ease-out|ease-in-out|cubic-bezier(n,n,n,n); | ||
| 55 | + effect: { | ||
| 56 | + type: String, | ||
| 57 | + default: 'ease-in-out' | ||
| 58 | + }, | ||
| 59 | + // 是否使用过渡效果 | ||
| 60 | + isEffect: { | ||
| 61 | + type: Boolean, | ||
| 62 | + default: true | ||
| 63 | + }, | ||
| 64 | + }, | ||
| 65 | + data() { | ||
| 66 | + return { | ||
| 67 | + isShow: false, | ||
| 68 | + opacity: 1, | ||
| 69 | + time: 100, | ||
| 70 | + loadStatus: '', // 默认是懒加载中的状态 | ||
| 71 | + isError: false, // 图片加载失败 | ||
| 72 | + // elIndex: this.$u.guid() | ||
| 73 | + }; | ||
| 74 | + }, | ||
| 75 | + watch: { | ||
| 76 | + isShow(nVal) { | ||
| 77 | + // 如果是不开启过渡效果,直接返回 | ||
| 78 | + if (!this.isEffect) return; | ||
| 79 | + this.time = 0; | ||
| 80 | + // 原来opacity为1(不透明,是为了显示占位图),改成0(透明,意味着该元素显示的是背景颜色,默认的白色),再改成1,是为了获得过渡效果 | ||
| 81 | + this.opacity = 0; | ||
| 82 | + // 延时30ms,否则在浏览器H5,过渡效果无效 | ||
| 83 | + setTimeout(() => { | ||
| 84 | + this.time = this.duration; | ||
| 85 | + this.opacity = 1; | ||
| 86 | + }, 30) | ||
| 87 | + }, | ||
| 88 | + }, | ||
| 89 | + methods:{ | ||
| 90 | + // 点击图片触发的事件,loadlazy-还是懒加载中状态,loading-图片正在加载,loaded-图片加加载完成 | ||
| 91 | + clickImg() { | ||
| 92 | + let whichImg = ''; | ||
| 93 | + // 如果isShow为false,意味着图片还没开始加载,点击的只能是最开始的占位图 | ||
| 94 | + if (this.isShow == false) whichImg = 'lazyImg'; | ||
| 95 | + // 如果isError为true,意味着图片加载失败,这是只剩下错误的占位图,所以点击的只能是错误占位图 | ||
| 96 | + // 当然,也可以给错误的占位图元素绑定点击事件,看你喜欢~ | ||
| 97 | + else if (this.isError == true) whichImg = 'errorImg'; | ||
| 98 | + // 总共三张图片,除了两个占位图,剩下的只能是正常的那张图片了 | ||
| 99 | + else whichImg = 'realImg'; | ||
| 100 | + // 只通知当前图片的index | ||
| 101 | + this.$emit('click', this.index); | ||
| 102 | + }, | ||
| 103 | + // 图片加载完成事件,可能是加载占位图时触发,也可能是加载真正的图片完成时触发,通过isShow区分 | ||
| 104 | + imgLoaded() { | ||
| 105 | + // 占位图加载完成 | ||
| 106 | + this.isShow=true | ||
| 107 | + return | ||
| 108 | + if (this.loadStatus == '') { | ||
| 109 | + this.loadStatus = 'lazyed'; | ||
| 110 | + } | ||
| 111 | + // 真正的图片加载完成 | ||
| 112 | + else if (this.loadStatus == 'lazyed') { | ||
| 113 | + this.loadStatus = 'loaded'; | ||
| 114 | + // this.$emit('load', this.index); | ||
| 115 | + } | ||
| 116 | + }, | ||
| 117 | + // 图片加载失败 | ||
| 118 | + loadError() { | ||
| 119 | + this.isError = true; | ||
| 120 | + }, | ||
| 121 | + } | ||
| 122 | + } | ||
| 123 | +</script> | ||
| 124 | + | ||
| 125 | +<style> | ||
| 126 | + .mll{ | ||
| 127 | + width: 100%; | ||
| 128 | + height: 100%; | ||
| 129 | + position: relative; | ||
| 130 | + overflow: hidden; | ||
| 131 | + } | ||
| 132 | + image{ | ||
| 133 | + width: 100%; | ||
| 134 | + height: 100%; | ||
| 135 | + } | ||
| 136 | + .test_img{ | ||
| 137 | + position: absolute; | ||
| 138 | + top: -10rpx; | ||
| 139 | + left: -10rpx; | ||
| 140 | + width: 10rpx; | ||
| 141 | + height: 10rpx; | ||
| 142 | + opacity: 0; | ||
| 143 | + } | ||
| 144 | +</style> |
components/praise_item/praise_item.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <view class="praise_Item"> | ||
| 3 | + <!-- 学生端显示 --> | ||
| 4 | + <view class="praise_Item-1" v-if="type === LIKETYPE.STUDENTEND"> | ||
| 5 | + <view class="praise_Item-1-l" v-if="info.is_my"> | ||
| 6 | + <view class="praise_Item-1-l-1" v-if="info.status === OPERATIONSTATUS.ADOPT">已通过</view> | ||
| 7 | + <view class="praise_Item-1-l-1s" v-else-if="info.status === OPERATIONSTATUS.PENDINGREVIEW">待审核</view> | ||
| 8 | + <view class="praise_Item-1-l-1s" v-else>未通过</view> | ||
| 9 | + </view> | ||
| 10 | + <view class="praise_Item-1-l-2">{{ info.create_time }}</view> | ||
| 11 | + </view> | ||
| 12 | + <!-- 老师端/管理员端显示 --> | ||
| 13 | + <view class="praise_Item-t" v-if="type === LIKETYPE.TEACHERSEND || type === LIKETYPE.ADMINEND"> | ||
| 14 | + <view class="praise_Item-t-l"> | ||
| 15 | + <u--image | ||
| 16 | + shape="circle" | ||
| 17 | + height="72rpx" | ||
| 18 | + width="72rpx" | ||
| 19 | + :src="info.uimg"></u--image> | ||
| 20 | + </view> | ||
| 21 | + <view class="praise_Item-t-r"> | ||
| 22 | + <view class="praise_Item-t-r-1">{{ info.uname }}</view> | ||
| 23 | + <view class="praise_Item-t-r-2">{{ info.create_time }}</view> | ||
| 24 | + </view> | ||
| 25 | + </view> | ||
| 26 | + <view class="praise_Item-2"> | ||
| 27 | + {{ info.content }} | ||
| 28 | + </view> | ||
| 29 | + <view class="praise_Item-3"> | ||
| 30 | + <u--image | ||
| 31 | + v-for="(item, index) in info.imgs" | ||
| 32 | + :key="index" | ||
| 33 | + radius="15rpx" | ||
| 34 | + height="145rpx" | ||
| 35 | + width="145rpx" | ||
| 36 | + @click.native="seeImg(index)" | ||
| 37 | + :src="item"></u--image> | ||
| 38 | + </view> | ||
| 39 | + <view class="praise_Item-4" v-if="type === LIKETYPE.ADMINEND && info.showOperation"> | ||
| 40 | + <view class="praise_Item-4-1" @click="operation(OPERATIONSTATUS.REFUSE)">不通过</view> | ||
| 41 | + <view class="praise_Item-4-2" @click="operation(OPERATIONSTATUS.ADOPT)">通过</view> | ||
| 42 | + </view> | ||
| 43 | + </view> | ||
| 44 | +</template> | ||
| 45 | + | ||
| 46 | +<script> | ||
| 47 | + import { LIKETYPE, OPERATIONSTATUS } from "@/emit/index.js" | ||
| 48 | + export default { | ||
| 49 | + name:"praise_Item", | ||
| 50 | + props: { | ||
| 51 | + type: { | ||
| 52 | + type: [String, Number], | ||
| 53 | + default: LIKETYPE.STUDENTEND | ||
| 54 | + }, | ||
| 55 | + info: { | ||
| 56 | + type: Object, | ||
| 57 | + default: () => { | ||
| 58 | + return {} | ||
| 59 | + } | ||
| 60 | + } | ||
| 61 | + }, | ||
| 62 | + data() { | ||
| 63 | + return { | ||
| 64 | + OPERATIONSTATUS, | ||
| 65 | + LIKETYPE | ||
| 66 | + }; | ||
| 67 | + }, | ||
| 68 | + methods: { | ||
| 69 | + operation(type) { | ||
| 70 | + var datas = { | ||
| 71 | + id: this.info.id, | ||
| 72 | + status: type | ||
| 73 | + } | ||
| 74 | + var jkurl = '/admin/praise_check' | ||
| 75 | + this.$service.P_post(jkurl, datas).then(res => { | ||
| 76 | + this.$emit('success', this.info.id) | ||
| 77 | + }) | ||
| 78 | + }, | ||
| 79 | + seeImg(index) { | ||
| 80 | + uni.previewImage({ | ||
| 81 | + current: index, // 当前显示图片的链接,不填则默认为 urls 的第一张图片 | ||
| 82 | + urls: this.info.imgs // 需要预览的图片链接列表 | ||
| 83 | + }) | ||
| 84 | + } | ||
| 85 | + } | ||
| 86 | + } | ||
| 87 | +</script> | ||
| 88 | + | ||
| 89 | +<style lang="scss"> | ||
| 90 | +.praise_Item{ | ||
| 91 | + background: #fff; | ||
| 92 | + border-radius: 15rpx; | ||
| 93 | + padding: 30rpx; | ||
| 94 | + box-shadow: 7rpx 0rpx 24rpx 0rpx rgba(153,153,153,0.22); | ||
| 95 | + margin-bottom: 20rpx; | ||
| 96 | + .praise_Item-1{ | ||
| 97 | + display: flex; | ||
| 98 | + align-items: center; | ||
| 99 | + .praise_Item-1-l{ | ||
| 100 | + .praise_Item-1-l-1{ | ||
| 101 | + line-height: 36rpx; | ||
| 102 | + padding: 0 7rpx; | ||
| 103 | + background-color: #18BD7A; | ||
| 104 | + font-size: 22rpx; | ||
| 105 | + color: #FFFFFF; | ||
| 106 | + border-radius: 5rpx; | ||
| 107 | + } | ||
| 108 | + .praise_Item-1-l-1s{ | ||
| 109 | + line-height: 36rpx; | ||
| 110 | + padding: 0 7rpx; | ||
| 111 | + background-color: #2D9FFF; | ||
| 112 | + font-size: 22rpx; | ||
| 113 | + color: #FFFFFF; | ||
| 114 | + border-radius: 5rpx; | ||
| 115 | + } | ||
| 116 | + } | ||
| 117 | + .praise_Item-1-l-2{ | ||
| 118 | + color: #A1A0AB; | ||
| 119 | + font-size: 24rpx; | ||
| 120 | + margin-left: 20rpx; | ||
| 121 | + } | ||
| 122 | + } | ||
| 123 | + .praise_Item-t{ | ||
| 124 | + display: flex; | ||
| 125 | + align-items: center; | ||
| 126 | + .praise_Item-t-l{ | ||
| 127 | + flex-shrink: 0; | ||
| 128 | + } | ||
| 129 | + .praise_Item-t-r{ | ||
| 130 | + margin-left: 25rpx; | ||
| 131 | + .praise_Item-t-r-1{ | ||
| 132 | + color: #3D4054; | ||
| 133 | + font-size: 28rpx; | ||
| 134 | + } | ||
| 135 | + .praise_Item-t-r-2{ | ||
| 136 | + color: #A1A0AB; | ||
| 137 | + font-size: 24rpx; | ||
| 138 | + } | ||
| 139 | + } | ||
| 140 | + } | ||
| 141 | + .praise_Item-2{ | ||
| 142 | + font-size: 26rpx; | ||
| 143 | + line-height: 39rpx; | ||
| 144 | + color: #3D4054; | ||
| 145 | + margin-top: 28rpx; | ||
| 146 | + } | ||
| 147 | + .praise_Item-3{ | ||
| 148 | + display: grid; | ||
| 149 | + grid-template-columns: repeat(4, 1fr); | ||
| 150 | + grid-row-gap: 20rpx; | ||
| 151 | + grid-column-gap: 20rpx; | ||
| 152 | + margin-top: 30rpx; | ||
| 153 | + } | ||
| 154 | + .praise_Item-4{ | ||
| 155 | + display: flex; | ||
| 156 | + justify-content: flex-end; | ||
| 157 | + padding-top: 20rpx; | ||
| 158 | + border-top: #EEEEEE solid 1rpx; | ||
| 159 | + margin-top: 20rpx; | ||
| 160 | + .praise_Item-4-1{ | ||
| 161 | + width: 172rpx; | ||
| 162 | + border: 1rpx solid #2D81FF; | ||
| 163 | + color: #2D81FF; | ||
| 164 | + background: rgba(45,159,255,0.1); | ||
| 165 | + border-radius: 200rpx; | ||
| 166 | + font-size: 28rpx; | ||
| 167 | + line-height: 63rpx; | ||
| 168 | + text-align: center; | ||
| 169 | + } | ||
| 170 | + .praise_Item-4-2{ | ||
| 171 | + width: 172rpx; | ||
| 172 | + border: 1rpx solid #2D81FF; | ||
| 173 | + color: #FFFFFF; | ||
| 174 | + background: #2D81FF; | ||
| 175 | + border-radius: 200rpx; | ||
| 176 | + font-size: 28rpx; | ||
| 177 | + line-height: 63rpx; | ||
| 178 | + text-align: center; | ||
| 179 | + margin-left: 29rpx; | ||
| 180 | + } | ||
| 181 | + } | ||
| 182 | +} | ||
| 183 | +</style> |
| 1 | +<template> | ||
| 2 | + <view> | ||
| 3 | + <view class="public_selector" @click="show = true"> | ||
| 4 | + <input type="text" :value="value[keyName]" class="public_selector-input" disabled :placeholder="placeholder" placeholder-class="placeholderClass" /> | ||
| 5 | + <u-icon name="arrow-down-fill" size="12" ></u-icon> | ||
| 6 | + </view> | ||
| 7 | + <u-picker :keyName="keyName" :show="show" :columns="columns" @confirm="confirm" @cancel="show = false"></u-picker> | ||
| 8 | + </view> | ||
| 9 | +</template> | ||
| 10 | + | ||
| 11 | +<script> | ||
| 12 | + export default { | ||
| 13 | + name:"public_selector", | ||
| 14 | + props: { | ||
| 15 | + placeholder: { | ||
| 16 | + type: String, | ||
| 17 | + default: '' | ||
| 18 | + }, | ||
| 19 | + keyName: { | ||
| 20 | + type: String, | ||
| 21 | + default: '' | ||
| 22 | + }, | ||
| 23 | + value: { | ||
| 24 | + type: Object, | ||
| 25 | + default: () => { | ||
| 26 | + return {} | ||
| 27 | + } | ||
| 28 | + }, | ||
| 29 | + columns: { | ||
| 30 | + type: [Array], | ||
| 31 | + default: () => [] | ||
| 32 | + } | ||
| 33 | + }, | ||
| 34 | + data() { | ||
| 35 | + return { | ||
| 36 | + show: false | ||
| 37 | + }; | ||
| 38 | + }, | ||
| 39 | + methods: { | ||
| 40 | + confirm(e) { | ||
| 41 | + console.log(e) | ||
| 42 | + this.show = false | ||
| 43 | + this.$emit('change', e) | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | + } | ||
| 47 | +</script> | ||
| 48 | + | ||
| 49 | +<style lang="scss" scoped> | ||
| 50 | + .public_selector{ | ||
| 51 | + background: #FFFFFF; | ||
| 52 | + border-radius: 10rpx; | ||
| 53 | + padding: 0 30rpx; | ||
| 54 | + height: 76rpx; | ||
| 55 | + box-shadow: 7rpx 0rpx 24rpx 0rpx rgba(153,153,153,0.22); | ||
| 56 | + display: flex; | ||
| 57 | + justify-content: space-between; | ||
| 58 | + align-items: center; | ||
| 59 | + .public_selector-input{ | ||
| 60 | + font-size: 28rpx; | ||
| 61 | + } | ||
| 62 | + .placeholderClass{ | ||
| 63 | + color: #505050; | ||
| 64 | + } | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | +</style> |
| 1 | +<template> | ||
| 2 | + <view class="public_switching" :style="{'grid-template-columns': `repeat(${option.length}, 1fr)`}"> | ||
| 3 | + <view | ||
| 4 | + @click="selected(item)" | ||
| 5 | + :class="{'public_switching-i': true, 'public_switching-i-c': item.value === current} " | ||
| 6 | + v-for="item in option" | ||
| 7 | + :key="item.value">{{ item.lable }}</view> | ||
| 8 | + </view> | ||
| 9 | +</template> | ||
| 10 | + | ||
| 11 | +<script> | ||
| 12 | + export default { | ||
| 13 | + name:"public_switching", | ||
| 14 | + props: { | ||
| 15 | + current: { | ||
| 16 | + type: [String, Number], | ||
| 17 | + default: '' | ||
| 18 | + }, | ||
| 19 | + option: { | ||
| 20 | + type: [Array], | ||
| 21 | + default: () => [] | ||
| 22 | + } | ||
| 23 | + }, | ||
| 24 | + data() { | ||
| 25 | + return { | ||
| 26 | + | ||
| 27 | + }; | ||
| 28 | + }, | ||
| 29 | + methods: { | ||
| 30 | + selected(item) { | ||
| 31 | + this.$emit('change', item.value) | ||
| 32 | + } | ||
| 33 | + } | ||
| 34 | + } | ||
| 35 | +</script> | ||
| 36 | + | ||
| 37 | +<style lang="scss" scoped> | ||
| 38 | +.public_switching{ | ||
| 39 | + display: grid; | ||
| 40 | + padding: 20rpx 0; | ||
| 41 | + .public_switching-i{ | ||
| 42 | + flex-grow: 1; | ||
| 43 | + text-align: center; | ||
| 44 | + color: #F8F8F8; | ||
| 45 | + } | ||
| 46 | + .public_switching-i-c{ | ||
| 47 | + color: #F8F8F8; | ||
| 48 | + position: relative; | ||
| 49 | + &::before{ | ||
| 50 | + position: absolute; | ||
| 51 | + content: ''; | ||
| 52 | + width: 38rpx; | ||
| 53 | + background-color: #fff; | ||
| 54 | + height: 4rpx; | ||
| 55 | + bottom: -20rpx; | ||
| 56 | + left: 50%; | ||
| 57 | + transform: translateX(-50%); | ||
| 58 | + } | ||
| 59 | + } | ||
| 60 | +} | ||
| 61 | +</style> |
components/top_bar/top_bar.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <view> | ||
| 3 | + <view class="dh_top" :class="bg_img?'cf':''" :style="style+'background-color:'+bg_color"> | ||
| 4 | + <image v-if="bg_img" class="nav_bar_img" :src="bg_img" mode="widthFix"></image> | ||
| 5 | + <!-- <text class=""></text> | ||
| 6 | + <text>个人中心</text> | ||
| 7 | + <text class=""></text> --> | ||
| 8 | + <view class="dh_top_box" :style="style1"> | ||
| 9 | + <!-- {{bg_img}} --> | ||
| 10 | + <slot></slot> | ||
| 11 | + </view> | ||
| 12 | + </view> | ||
| 13 | + <view v-if="have_top" class="dh_top dh_top1" :style="'height: '+CustomBar+'px;background-color:'+bg_color"></view> | ||
| 14 | + </view> | ||
| 15 | +</template> | ||
| 16 | + | ||
| 17 | +<script> | ||
| 18 | + var that | ||
| 19 | + import { | ||
| 20 | + mapState, | ||
| 21 | + mapMutations | ||
| 22 | + } from 'vuex' | ||
| 23 | + export default { | ||
| 24 | + name:"top_bar", | ||
| 25 | + props: { | ||
| 26 | + bg_img:{ | ||
| 27 | + type: String, | ||
| 28 | + default: '' | ||
| 29 | + }, | ||
| 30 | + bg_color:{ | ||
| 31 | + type: String, | ||
| 32 | + default: '' | ||
| 33 | + }, | ||
| 34 | + have_top:{ | ||
| 35 | + type: Boolean, | ||
| 36 | + default: true | ||
| 37 | + } | ||
| 38 | + }, | ||
| 39 | + data() { | ||
| 40 | + return { | ||
| 41 | + StatusBar: this.StatusBar, | ||
| 42 | + CustomBar: this.CustomBar, | ||
| 43 | + }; | ||
| 44 | + }, | ||
| 45 | + computed: { | ||
| 46 | + ...mapState(['hasLogin', 'forcedLogin', 'userName','loginDatas','relation_phone']), | ||
| 47 | + | ||
| 48 | + style0() { | ||
| 49 | + var StatusBar = this.StatusBar; | ||
| 50 | + var CustomBar = this.CustomBar; | ||
| 51 | + var padd_top = CustomBar | ||
| 52 | + var style = `padding-top:${padd_top}px;`; | ||
| 53 | + | ||
| 54 | + return style | ||
| 55 | + }, | ||
| 56 | + style() { | ||
| 57 | + var StatusBar = this.StatusBar; | ||
| 58 | + var CustomBar = this.CustomBar; | ||
| 59 | + var style = `height:${CustomBar}px;padding-top:${StatusBar}px;`; | ||
| 60 | + | ||
| 61 | + return style | ||
| 62 | + }, | ||
| 63 | + | ||
| 64 | + style1(){ | ||
| 65 | + var StatusBar = this.StatusBar; | ||
| 66 | + var style = `top:${StatusBar}px;`; | ||
| 67 | + | ||
| 68 | + return style | ||
| 69 | + }, | ||
| 70 | + style2(){ | ||
| 71 | + var StatusBar = this.StatusBar; | ||
| 72 | + var CustomBar = this.CustomBar; | ||
| 73 | + var style = `padding-top:${CustomBar}px;`; | ||
| 74 | + | ||
| 75 | + return style | ||
| 76 | + } | ||
| 77 | + }, | ||
| 78 | + methods:{ | ||
| 79 | + back(){ | ||
| 80 | + uni.navigateBack({ | ||
| 81 | + delta:1 | ||
| 82 | + }) | ||
| 83 | + } | ||
| 84 | + } | ||
| 85 | + } | ||
| 86 | +</script> | ||
| 87 | + | ||
| 88 | +<style scoped> | ||
| 89 | + .dh_top{ | ||
| 90 | + width: 100vw; | ||
| 91 | + position: fixed; | ||
| 92 | + top: 0; | ||
| 93 | + left: 0; | ||
| 94 | + right: 0; | ||
| 95 | + z-index: 991; | ||
| 96 | + background-color: #fff; | ||
| 97 | + padding: var(--status-bar-height) 15upx 0; | ||
| 98 | + display: flex; | ||
| 99 | + flex-direction: row; | ||
| 100 | + align-items: center; | ||
| 101 | + justify-content: space-between; | ||
| 102 | + overflow: hidden; | ||
| 103 | + box-sizing: border-box; | ||
| 104 | + } | ||
| 105 | + .dh_top1{ | ||
| 106 | + opacity: 0; | ||
| 107 | + position: relative; | ||
| 108 | + z-index: 100; | ||
| 109 | + } | ||
| 110 | + .dh_top_box{ | ||
| 111 | + position: absolute; | ||
| 112 | + | ||
| 113 | + left: 0; | ||
| 114 | + bottom: 0; | ||
| 115 | + right: 0; | ||
| 116 | + margin: auto; | ||
| 117 | + height: 60rpx; | ||
| 118 | + font-size: 32rpx; | ||
| 119 | + /* line-height: 60rpx; */ | ||
| 120 | + display: flex; | ||
| 121 | + flex-direction: row; | ||
| 122 | + align-items: center; | ||
| 123 | + justify-content: space-between; | ||
| 124 | + padding: 0 15upx; | ||
| 125 | + } | ||
| 126 | + .dh_top>.nav_bar_img{ | ||
| 127 | + position: absolute; | ||
| 128 | + top: 0; | ||
| 129 | + left: 0; | ||
| 130 | + right: 0; | ||
| 131 | + width: 100vw; | ||
| 132 | + height: auto; | ||
| 133 | + z-index: 991; | ||
| 134 | + } | ||
| 135 | + .dh_top /deep/ text{ | ||
| 136 | + position: relative; | ||
| 137 | + z-index: 992; | ||
| 138 | + color: #333; | ||
| 139 | + } | ||
| 140 | + .cf /deep/ text{ | ||
| 141 | + color: #fff; | ||
| 142 | + } | ||
| 143 | +</style> |
components/yq-avatar/yq-avatar.vue
0 → 100644
| 1 | +<template name="yq-avatar"> | ||
| 2 | + <view class="boxsa"> | ||
| 3 | + <image :src="imgSrc.imgSrc" @click="fSelect" :style="[ iS ]" class="my-avatar"></image> | ||
| 4 | + <canvas canvas-id="avatar-canvas" id="avatar-canvas" class="my-canvas" :style="{top: sT, height: csH}" | ||
| 5 | + disable-scroll="false"></canvas> | ||
| 6 | + <canvas canvas-id="oper-canvas" id="oper-canvas" class="oper-canvas" :style="{top: sT, height: csH}" | ||
| 7 | + disable-scroll="false" @touchstart="fStart" @touchmove="fMove" @touchend="fEnd"></canvas> | ||
| 8 | + <canvas canvas-id="prv-canvas" id="prv-canvas" class="prv-canvas" disable-scroll="false" | ||
| 9 | + @touchstart="fHideImg" :style="{ height: csH, top: pT }"></canvas> | ||
| 10 | + <view class="oper-wrapper" :style="{display: sD, top:tp}"> | ||
| 11 | + <view class="oper"> | ||
| 12 | + <view class="btn-wrapper" v-if="sO"> | ||
| 13 | + <view @click="fSelect" hover-class="hover" :style="{width: bW}"><text>重选</text></view> | ||
| 14 | + <view @click="fClose" hover-class="hover" :style="{width: bW}"><text>关闭</text></view> | ||
| 15 | + <view @click="fRotate" hover-class="hover" :style="{width: bW, display: bD}"><text>旋转</text></view> | ||
| 16 | + <view @click="fPreview" hover-class="hover" :style="{width: bW}"><text>预览</text></view> | ||
| 17 | + <view @click="fUpload" hover-class="hover" :style="{width: bW}"><text>上传</text></view> | ||
| 18 | + </view> | ||
| 19 | + <view class="clr-wrapper" v-else> | ||
| 20 | + <slider class="my-slider" @change="fColorChange" block-size="25" value="0" min="-100" max="100" activeColor="red" | ||
| 21 | + backgroundColor="green" block-color="grey" show-value></slider> | ||
| 22 | + <view @click="fPrvUpload" hover-class="hover" :style="{width: bW}"><text>上传</text></view> | ||
| 23 | + </view> | ||
| 24 | + </view> | ||
| 25 | + </view> | ||
| 26 | + </view> | ||
| 27 | +</template> | ||
| 28 | + | ||
| 29 | +<script> | ||
| 30 | + | ||
| 31 | + var that | ||
| 32 | + import { | ||
| 33 | + mapState, | ||
| 34 | + mapMutations | ||
| 35 | + } from 'vuex' | ||
| 36 | + "use strict"; | ||
| 37 | + const tH = 50; | ||
| 38 | + export default { | ||
| 39 | + name: "yq-avatar", | ||
| 40 | + data() { | ||
| 41 | + return { | ||
| 42 | + csH: '0px', | ||
| 43 | + sD: 'none', | ||
| 44 | + sT: '-10000px', | ||
| 45 | + pT: '-10000px', | ||
| 46 | + iS: {}, | ||
| 47 | + sS: {}, | ||
| 48 | + sO: true, | ||
| 49 | + bW: '19%', | ||
| 50 | + bD: 'flex', | ||
| 51 | + tp: 0, | ||
| 52 | + imgSrc: { | ||
| 53 | + imgSrc: '' | ||
| 54 | + } | ||
| 55 | + }; | ||
| 56 | + }, | ||
| 57 | + onLoad() { | ||
| 58 | + that = this | ||
| 59 | + }, | ||
| 60 | + computed: { | ||
| 61 | + ...mapState(['hasLogin', 'forcedLogin', 'userName', 'userinfo']) | ||
| 62 | + }, | ||
| 63 | + watch: { | ||
| 64 | + avatarSrc() { | ||
| 65 | + this.imgSrc.imgSrc = this.avatarSrc; | ||
| 66 | + } | ||
| 67 | + }, | ||
| 68 | + props: { | ||
| 69 | + avatarSrc: '', | ||
| 70 | + avatarStyle: '', | ||
| 71 | + selWidth: '', | ||
| 72 | + selHeight: '', | ||
| 73 | + expWidth: '', | ||
| 74 | + expHeight: '', | ||
| 75 | + minScale: '', | ||
| 76 | + maxScale: '', | ||
| 77 | + canScale: '', | ||
| 78 | + canRotate: '', | ||
| 79 | + lockWidth: '', | ||
| 80 | + lockHeight: '', | ||
| 81 | + stretch: '', | ||
| 82 | + lock: '', | ||
| 83 | + fileType: '', | ||
| 84 | + noTab: '', | ||
| 85 | + inner: '', | ||
| 86 | + quality: '', | ||
| 87 | + index: '', | ||
| 88 | + bgImage: '', | ||
| 89 | + }, | ||
| 90 | + created() { | ||
| 91 | + this.cc = uni.createCanvasContext('avatar-canvas', this); | ||
| 92 | + this.cco = uni.createCanvasContext('oper-canvas', this); | ||
| 93 | + this.ccp = uni.createCanvasContext('prv-canvas', this); | ||
| 94 | + this.qlty = parseFloat(this.quality) || 1; | ||
| 95 | + this.imgSrc.imgSrc = this.avatarSrc; | ||
| 96 | + this.letRotate = (this.canRotate === false || this.inner === true || this.inner === 'true' || this.canRotate === 'false') ? 0 : 1; | ||
| 97 | + this.letScale = (this.canScale === false || this.canScale === 'false') ? 0 : 1; | ||
| 98 | + this.isin = (this.inner === true || this.inner === 'true') ? 1 : 0; | ||
| 99 | + this.indx = this.index || undefined; | ||
| 100 | + this.mnScale = parseFloat(this.minScale) || 0.3; | ||
| 101 | + this.mxScale = parseFloat(this.maxScale) || 4; | ||
| 102 | + this.noBar = (this.noTab === true || this.noTab === 'true') ? 1 : 0; | ||
| 103 | + this.stc = this.stretch; | ||
| 104 | + this.lck = this.lock; | ||
| 105 | + this.fType = this.fileType === 'jpg' ? 'jpg' : 'png'; | ||
| 106 | + if (this.isin||!this.letRotate) { | ||
| 107 | + this.bW = '24%'; | ||
| 108 | + this.bD = 'none'; | ||
| 109 | + } else { | ||
| 110 | + this.bW = '19%'; | ||
| 111 | + this.bD = 'flex'; | ||
| 112 | + } | ||
| 113 | + | ||
| 114 | + if (this.noBar) { | ||
| 115 | + this.fWindowResize(); | ||
| 116 | + } else { | ||
| 117 | + uni.showTabBar({ | ||
| 118 | + fail: ()=>{ | ||
| 119 | + this.noBar = 1; | ||
| 120 | + }, | ||
| 121 | + success: ()=>{ | ||
| 122 | + this.noBar = 0; | ||
| 123 | + }, | ||
| 124 | + complete: (res) => { | ||
| 125 | + this.fWindowResize(); | ||
| 126 | + } | ||
| 127 | + }); | ||
| 128 | + } | ||
| 129 | + }, | ||
| 130 | + methods: { | ||
| 131 | + ...mapMutations(['logout', 'login']), | ||
| 132 | + getimg(img) { | ||
| 133 | + return this.$service.getimg(img) | ||
| 134 | + }, | ||
| 135 | + tiaozhuan(e) { | ||
| 136 | + return this.$service.tiaozhuan(e) | ||
| 137 | + }, | ||
| 138 | + fWindowResize() { | ||
| 139 | + let sysInfo = uni.getSystemInfoSync(); | ||
| 140 | + this.platform = sysInfo.platform; | ||
| 141 | + this.wW = sysInfo.windowWidth; | ||
| 142 | + | ||
| 143 | + // #ifdef H5 | ||
| 144 | + this.drawTop = sysInfo.windowTop; | ||
| 145 | + // #endif | ||
| 146 | + // #ifndef H5 | ||
| 147 | + this.drawTop = 0; | ||
| 148 | + // #endif | ||
| 149 | + | ||
| 150 | + // #ifdef MP-ALIPAY | ||
| 151 | + this.wH = sysInfo.screenHeight - sysInfo.statusBarHeight - sysInfo.titleBarHeight; | ||
| 152 | + this.csH = this.wH - tH + 'px'; | ||
| 153 | + // #endif | ||
| 154 | + | ||
| 155 | + // #ifndef MP-ALIPAY | ||
| 156 | + this.wH = sysInfo.windowHeight; | ||
| 157 | + if(!this.noBar) this.wH += tH; | ||
| 158 | + this.csH = this.wH - tH + 'px'; | ||
| 159 | + // #endif | ||
| 160 | + | ||
| 161 | + this.tp = this.csH; | ||
| 162 | + // #ifdef H5 | ||
| 163 | + this.tp = sysInfo.windowTop + parseInt(this.csH)+ 'px'; | ||
| 164 | + // #endif | ||
| 165 | + | ||
| 166 | + this.pxRatio = this.wW / 750; | ||
| 167 | + | ||
| 168 | + let style = this.avatarStyle; | ||
| 169 | + if (style && style !== true && (style = style.trim())) { | ||
| 170 | + style = style.split(';'); | ||
| 171 | + let obj = {}; | ||
| 172 | + for (let v of style) { | ||
| 173 | + if (!v) continue; | ||
| 174 | + v = v.trim().split(':'); | ||
| 175 | + if (v[1].toString().indexOf('upx') >= 0) { | ||
| 176 | + let arr = v[1].trim().split(' '); | ||
| 177 | + for (let k in arr) { | ||
| 178 | + if (!arr[k]) continue; | ||
| 179 | + if (arr[k].toString().indexOf('upx') >= 0) { | ||
| 180 | + arr[k] = parseFloat(arr[k]) * this.pxRatio + 'px'; | ||
| 181 | + } | ||
| 182 | + } | ||
| 183 | + v[1] = arr.join(' '); | ||
| 184 | + } | ||
| 185 | + obj[v[0].trim()] = v[1].trim(); | ||
| 186 | + } | ||
| 187 | + this.iS = obj; | ||
| 188 | + } | ||
| 189 | + | ||
| 190 | + this.expWidth && (this.eW = this.expWidth.toString().indexOf('upx') >= 0 ? parseInt(this.expWidth) * this.pxRatio : | ||
| 191 | + parseInt(this.expWidth)); | ||
| 192 | + this.expHeight && (this.eH = this.expHeight.toString().indexOf('upx') >= 0 ? parseInt(this.expHeight) * this.pxRatio : | ||
| 193 | + parseInt(this.expHeight)); | ||
| 194 | + | ||
| 195 | + if (this.sD === 'flex') { | ||
| 196 | + this.fDrawInit(true); | ||
| 197 | + } | ||
| 198 | + this.fHideImg(); | ||
| 199 | + }, | ||
| 200 | + fSelect() { | ||
| 201 | + if (this.fSelecting) return; | ||
| 202 | + this.fSelecting = true; | ||
| 203 | + setTimeout(() => { | ||
| 204 | + this.fSelecting = false; | ||
| 205 | + }, 500); | ||
| 206 | + | ||
| 207 | + uni.chooseImage({ | ||
| 208 | + count: 1, | ||
| 209 | + sizeType: ['original', 'compressed'], | ||
| 210 | + sourceType: ['album', 'camera'], | ||
| 211 | + success: (r) => { | ||
| 212 | + // #ifdef MP-ALIPAY | ||
| 213 | + uni.showLoading(); | ||
| 214 | + // #endif | ||
| 215 | + // #ifndef MP-ALIPAY | ||
| 216 | + uni.showLoading({ | ||
| 217 | + title: '加载中...', | ||
| 218 | + mask: true | ||
| 219 | + }); | ||
| 220 | + // #endif | ||
| 221 | + | ||
| 222 | + let path = this.imgPath = r.tempFilePaths[0]; | ||
| 223 | + uni.getImageInfo({ | ||
| 224 | + src: path, | ||
| 225 | + success: r => { | ||
| 226 | + this.imgWidth = r.width; | ||
| 227 | + this.imgHeight = r.height; | ||
| 228 | + this.path = path; | ||
| 229 | + if (!this.hasSel) { | ||
| 230 | + let style = this.sS || {}; | ||
| 231 | + if (this.selWidth && this.selHeight) { | ||
| 232 | + let sW = this.selWidth.toString().indexOf('upx') >= 0 ? parseInt(this.selWidth) * this.pxRatio : parseInt( | ||
| 233 | + this.selWidth), | ||
| 234 | + sH = this.selHeight.toString().indexOf('upx') >= 0 ? parseInt(this.selHeight) * this.pxRatio : parseInt( | ||
| 235 | + this.selHeight); | ||
| 236 | + style.width = sW + 'px'; | ||
| 237 | + style.height = sH + 'px'; | ||
| 238 | + style.top = ((this.wH - sH - tH)|0) / 2 + 'px'; | ||
| 239 | + style.left = ((this.wW - sW)|0) / 2 + 'px'; | ||
| 240 | + } else { | ||
| 241 | + uni.showModal({ | ||
| 242 | + title: '裁剪框的宽或高没有设置', | ||
| 243 | + showCancel: false | ||
| 244 | + }) | ||
| 245 | + return; | ||
| 246 | + } | ||
| 247 | + this.sS = style; | ||
| 248 | + } | ||
| 249 | + | ||
| 250 | + if (this.noBar) { | ||
| 251 | + this.fDrawInit(true); | ||
| 252 | + } else { | ||
| 253 | + uni.hideTabBar({ | ||
| 254 | + complete: () => { | ||
| 255 | + this.fDrawInit(true); | ||
| 256 | + } | ||
| 257 | + }); | ||
| 258 | + } | ||
| 259 | + }, | ||
| 260 | + fail: () => { | ||
| 261 | + uni.showToast({ | ||
| 262 | + title: "请选择正确图片", | ||
| 263 | + icon:'none', | ||
| 264 | + duration: 2000, | ||
| 265 | + }) | ||
| 266 | + }, | ||
| 267 | + complete() { | ||
| 268 | + uni.hideLoading(); | ||
| 269 | + } | ||
| 270 | + }); | ||
| 271 | + } | ||
| 272 | + }) | ||
| 273 | + }, | ||
| 274 | + fUpload() { | ||
| 275 | + if (this.fUploading) return; | ||
| 276 | + this.fUploading = true; | ||
| 277 | + setTimeout(() => { | ||
| 278 | + this.fUploading = false; | ||
| 279 | + }, 1000) | ||
| 280 | + | ||
| 281 | + let style = this.sS, | ||
| 282 | + x = parseInt(style.left), | ||
| 283 | + y = parseInt(style.top), | ||
| 284 | + width = parseInt(style.width), | ||
| 285 | + height = parseInt(style.height), | ||
| 286 | + expWidth = this.eW || (width* this.pixelRatio), | ||
| 287 | + expHeight = this.eH || (height* this.pixelRatio); | ||
| 288 | + | ||
| 289 | + // #ifdef MP-ALIPAY | ||
| 290 | + uni.showLoading(); | ||
| 291 | + // #endif | ||
| 292 | + // #ifndef MP-ALIPAY | ||
| 293 | + uni.showLoading({ | ||
| 294 | + title: '加载中...', | ||
| 295 | + mask: true | ||
| 296 | + }); | ||
| 297 | + // #endif | ||
| 298 | + | ||
| 299 | + this.sD = 'none'; | ||
| 300 | + this.sT = '-10000px'; | ||
| 301 | + this.hasSel = false; | ||
| 302 | + this.fHideImg(); | ||
| 303 | + // #ifdef MP-ALIPAY | ||
| 304 | + this.cc.toTempFilePath({ | ||
| 305 | + x: x, | ||
| 306 | + y: y, | ||
| 307 | + width: width, | ||
| 308 | + height: height, | ||
| 309 | + destWidth: expWidth, | ||
| 310 | + destHeight: expHeight, | ||
| 311 | + fileType: this.fType, | ||
| 312 | + quality: this.qlty, | ||
| 313 | + success: (r) => { | ||
| 314 | + r = r.apFilePath; | ||
| 315 | + this.$emit("upload", { | ||
| 316 | + avatar: this.imgSrc, | ||
| 317 | + path: r, | ||
| 318 | + index: this.indx, | ||
| 319 | + data: this.rtn, | ||
| 320 | + base64: this.base64 || null | ||
| 321 | + }); | ||
| 322 | + }, | ||
| 323 | + fail: (res) => { | ||
| 324 | + uni.showToast({ | ||
| 325 | + title: "error1", | ||
| 326 | + duration: 2000, | ||
| 327 | + }) | ||
| 328 | + }, | ||
| 329 | + complete: () => { | ||
| 330 | + uni.hideLoading(); | ||
| 331 | + this.noBar || uni.showTabBar(); | ||
| 332 | + this.$emit("end"); | ||
| 333 | + } | ||
| 334 | + }); | ||
| 335 | + // #endif | ||
| 336 | + // #ifndef MP-ALIPAY | ||
| 337 | + uni.canvasToTempFilePath({ | ||
| 338 | + x: x, | ||
| 339 | + y: y, | ||
| 340 | + width: width, | ||
| 341 | + height: height, | ||
| 342 | + destWidth: expWidth, | ||
| 343 | + destHeight: expHeight, | ||
| 344 | + canvasId: 'avatar-canvas', | ||
| 345 | + fileType: this.fType, | ||
| 346 | + quality: this.qlty, | ||
| 347 | + success: (r) => { | ||
| 348 | + r = r.tempFilePath; | ||
| 349 | + // #ifdef H5 | ||
| 350 | + this.btop(r).then((r) => { | ||
| 351 | + this.$emit("upload", { | ||
| 352 | + avatar: this.imgSrc, | ||
| 353 | + path: r, | ||
| 354 | + index: this.indx, | ||
| 355 | + data: this.rtn, | ||
| 356 | + base64: this.base64 || null | ||
| 357 | + }); | ||
| 358 | + return; | ||
| 359 | + }) | ||
| 360 | + // #endif | ||
| 361 | + // #ifndef H5 | ||
| 362 | + this.$emit("upload", { | ||
| 363 | + avatar: this.imgSrc, | ||
| 364 | + path: r, | ||
| 365 | + index: this.indx, | ||
| 366 | + data: this.rtn, | ||
| 367 | + base64: this.base64 || null | ||
| 368 | + }); | ||
| 369 | + // #endif | ||
| 370 | + }, | ||
| 371 | + fail: (res) => { | ||
| 372 | + uni.showToast({ | ||
| 373 | + title: "error1", | ||
| 374 | + duration: 2000, | ||
| 375 | + }) | ||
| 376 | + }, | ||
| 377 | + complete: () => { | ||
| 378 | + uni.hideLoading(); | ||
| 379 | + this.noBar || uni.showTabBar(); | ||
| 380 | + this.$emit("end"); | ||
| 381 | + } | ||
| 382 | + }, this); | ||
| 383 | + // #endif | ||
| 384 | + }, | ||
| 385 | + fPrvUpload() { | ||
| 386 | + if (this.fPrvUploading) return; | ||
| 387 | + this.fPrvUploading = true; | ||
| 388 | + setTimeout(() => { | ||
| 389 | + this.fPrvUploading = false; | ||
| 390 | + }, 1000) | ||
| 391 | + // console.log(this.fPrvUploading) | ||
| 392 | + let style = this.sS, | ||
| 393 | + destWidth = parseInt(style.width), | ||
| 394 | + destHeight = parseInt(style.height), | ||
| 395 | + prvX = this.prvX, | ||
| 396 | + prvY = this.prvY, | ||
| 397 | + prvWidth = this.prvWidth, | ||
| 398 | + prvHeight = this.prvHeight, | ||
| 399 | + expWidth = this.eW || (parseInt(style.width) * this.pixelRatio), | ||
| 400 | + expHeight = this.eH || (parseInt(style.height) * this.pixelRatio); | ||
| 401 | + | ||
| 402 | + // #ifdef MP-ALIPAY | ||
| 403 | + uni.showLoading(); | ||
| 404 | + // #endif | ||
| 405 | + // #ifndef MP-ALIPAY | ||
| 406 | + uni.showLoading({ | ||
| 407 | + title: '加载中...', | ||
| 408 | + mask: true | ||
| 409 | + }); | ||
| 410 | + // #endif | ||
| 411 | + | ||
| 412 | + this.sD = 'none'; | ||
| 413 | + this.sT = '-10000px'; | ||
| 414 | + this.hasSel = false; | ||
| 415 | + this.fHideImg(); | ||
| 416 | + // #ifdef MP-ALIPAY | ||
| 417 | + this.ccp.toTempFilePath({ | ||
| 418 | + x: prvX, | ||
| 419 | + y: prvY, | ||
| 420 | + width: prvWidth, | ||
| 421 | + height: prvHeight, | ||
| 422 | + destWidth: expWidth, | ||
| 423 | + destHeight: expHeight, | ||
| 424 | + fileType: this.fType, | ||
| 425 | + quality: this.qlty, | ||
| 426 | + success: (r) => { | ||
| 427 | + r = r.apFilePath; | ||
| 428 | + this.$emit("upload", { | ||
| 429 | + avatar: this.imgSrc, | ||
| 430 | + path: r, | ||
| 431 | + index: this.indx, | ||
| 432 | + data: this.rtn, | ||
| 433 | + base64: this.base64 || null | ||
| 434 | + }); | ||
| 435 | + }, | ||
| 436 | + fail: () => { | ||
| 437 | + uni.showToast({ | ||
| 438 | + title: "error_prv", | ||
| 439 | + duration: 2000, | ||
| 440 | + }) | ||
| 441 | + }, | ||
| 442 | + complete: () => { | ||
| 443 | + uni.hideLoading(); | ||
| 444 | + this.noBar || uni.showTabBar(); | ||
| 445 | + this.$emit("end"); | ||
| 446 | + }, | ||
| 447 | + }); | ||
| 448 | + // #endif | ||
| 449 | + // #ifndef MP-ALIPAY | ||
| 450 | + uni.canvasToTempFilePath({ | ||
| 451 | + x: prvX, | ||
| 452 | + y: prvY, | ||
| 453 | + width: prvWidth, | ||
| 454 | + height: prvHeight, | ||
| 455 | + destWidth: expWidth, | ||
| 456 | + destHeight: expHeight, | ||
| 457 | + canvasId: 'prv-canvas', | ||
| 458 | + fileType: this.fType, | ||
| 459 | + quality: this.qlty, | ||
| 460 | + success: (r) => { | ||
| 461 | + r = r.tempFilePath; | ||
| 462 | + // #ifdef H5 | ||
| 463 | + this.btop(r).then((r) => { | ||
| 464 | + this.$emit("upload", { | ||
| 465 | + avatar: this.imgSrc, | ||
| 466 | + path: r, | ||
| 467 | + index: this.indx, | ||
| 468 | + data: this.rtn, | ||
| 469 | + base64: this.base64 || null | ||
| 470 | + }); | ||
| 471 | + }) | ||
| 472 | + // #endif | ||
| 473 | + // #ifndef H5 | ||
| 474 | + this.$emit("upload", { | ||
| 475 | + avatar: this.imgSrc, | ||
| 476 | + path: r, | ||
| 477 | + index: this.indx, | ||
| 478 | + data: this.rtn, | ||
| 479 | + base64: this.base64 || null | ||
| 480 | + }); | ||
| 481 | + // #endif | ||
| 482 | + }, | ||
| 483 | + fail: () => { | ||
| 484 | + uni.showToast({ | ||
| 485 | + title: "error_prv", | ||
| 486 | + duration: 2000, | ||
| 487 | + }) | ||
| 488 | + }, | ||
| 489 | + complete: () => { | ||
| 490 | + uni.hideLoading(); | ||
| 491 | + this.noBar || uni.showTabBar(); | ||
| 492 | + this.$emit("end"); | ||
| 493 | + } | ||
| 494 | + }, this); | ||
| 495 | + // #endif | ||
| 496 | + }, | ||
| 497 | + | ||
| 498 | + fDrawInit(ini = false) { | ||
| 499 | + let allWidth = this.wW, | ||
| 500 | + allHeight = this.wH, | ||
| 501 | + imgWidth = this.imgWidth, | ||
| 502 | + imgHeight = this.imgHeight, | ||
| 503 | + imgRadio = imgWidth / imgHeight, | ||
| 504 | + useWidth = allWidth - 40, | ||
| 505 | + useHeight = allHeight - tH - 80, | ||
| 506 | + useRadio = useWidth / useHeight, | ||
| 507 | + sW = parseInt(this.sS.width), | ||
| 508 | + sH = parseInt(this.sS.height); | ||
| 509 | + | ||
| 510 | + this.fixWidth = 0; | ||
| 511 | + this.fixHeight = 0; | ||
| 512 | + this.lckWidth = 0; | ||
| 513 | + this.lckHeight = 0; | ||
| 514 | + switch (this.stc) { | ||
| 515 | + case 'x': | ||
| 516 | + this.fixWidth = 1; | ||
| 517 | + break; | ||
| 518 | + case 'y': | ||
| 519 | + this.fixHeight = 1; | ||
| 520 | + break; | ||
| 521 | + case 'long': | ||
| 522 | + if (imgRadio > 1) this.fixWidth = 1; | ||
| 523 | + else this.fixHeight = 1; | ||
| 524 | + break; | ||
| 525 | + case 'short': | ||
| 526 | + if (imgRadio > 1) this.fixHeight = 1; | ||
| 527 | + else this.fixWidth = 1; | ||
| 528 | + break; | ||
| 529 | + case 'longSel': | ||
| 530 | + if (sW > sH) this.fixWidth = 1; | ||
| 531 | + else this.fixHeight = 1; | ||
| 532 | + break; | ||
| 533 | + case 'shortSel': | ||
| 534 | + if (sW > sH) this.fixHeight = 1; | ||
| 535 | + else this.fixWidth = 1; | ||
| 536 | + break; | ||
| 537 | + } | ||
| 538 | + switch (this.lck) { | ||
| 539 | + case 'x': | ||
| 540 | + this.lckWidth = 1; | ||
| 541 | + break; | ||
| 542 | + case 'y': | ||
| 543 | + this.lckHeight = 1; | ||
| 544 | + break; | ||
| 545 | + case 'long': | ||
| 546 | + if (imgRadio > 1) this.lckWidth = 1; | ||
| 547 | + else this.lckHeight = 1; | ||
| 548 | + break; | ||
| 549 | + case 'short': | ||
| 550 | + if (imgRadio > 1) this.lckHeight = 1; | ||
| 551 | + else this.lckWidth = 1; | ||
| 552 | + break; | ||
| 553 | + case 'longSel': | ||
| 554 | + if (sW > sH) this.lckWidth = 1; | ||
| 555 | + else this.lckHeight = 1; | ||
| 556 | + break; | ||
| 557 | + case 'shortSel': | ||
| 558 | + if (sW > sH) this.lckHeight = 1; | ||
| 559 | + else this.lckWidth = 1; | ||
| 560 | + break; | ||
| 561 | + } | ||
| 562 | + if (this.fixWidth) { | ||
| 563 | + useWidth = sW; | ||
| 564 | + useHeight = useWidth / imgRadio; | ||
| 565 | + } else if (this.fixHeight) { | ||
| 566 | + useHeight = sH; | ||
| 567 | + useWidth = useHeight * imgRadio; | ||
| 568 | + } else if (imgRadio < useRadio) { | ||
| 569 | + if (imgHeight < useHeight) { | ||
| 570 | + useWidth = imgWidth; | ||
| 571 | + useHeight = imgHeight; | ||
| 572 | + } else { | ||
| 573 | + useWidth = useHeight * imgRadio; | ||
| 574 | + } | ||
| 575 | + } else { | ||
| 576 | + if (imgWidth < useWidth) { | ||
| 577 | + useWidth = imgWidth; | ||
| 578 | + useHeight = imgHeight; | ||
| 579 | + } else { | ||
| 580 | + useHeight = useWidth / imgRadio; | ||
| 581 | + } | ||
| 582 | + } | ||
| 583 | + if (this.isin) { | ||
| 584 | + if (useWidth < sW) { | ||
| 585 | + useWidth = sW; | ||
| 586 | + useHeight = useWidth / imgRadio; | ||
| 587 | + this.lckHeight = 0; | ||
| 588 | + } | ||
| 589 | + if (useHeight < sH) { | ||
| 590 | + useHeight = sH; | ||
| 591 | + useWidth = useHeight * imgRadio; | ||
| 592 | + this.lckWidth = 0; | ||
| 593 | + } | ||
| 594 | + } | ||
| 595 | + | ||
| 596 | + this.scaleSize = 1; | ||
| 597 | + this.rotateDeg = 0; | ||
| 598 | + this.posWidth = (allWidth - useWidth) / 2 | 0; | ||
| 599 | + this.posHeight = (allHeight - useHeight - tH) / 2 | 0; | ||
| 600 | + this.useWidth = useWidth | 0; | ||
| 601 | + this.useHeight = useHeight | 0; | ||
| 602 | + this.centerX = this.posWidth + useWidth / 2; | ||
| 603 | + this.centerY = this.posHeight + useHeight / 2; | ||
| 604 | + this.focusX = 0; | ||
| 605 | + this.focusY = 0; | ||
| 606 | + | ||
| 607 | + let style = this.sS, | ||
| 608 | + left = parseInt(style.left), | ||
| 609 | + top = parseInt(style.top), | ||
| 610 | + width = parseInt(style.width), | ||
| 611 | + height = parseInt(style.height), | ||
| 612 | + canvas = this.canvas, | ||
| 613 | + canvasOper = this.canvasOper, | ||
| 614 | + cc = this.cc, | ||
| 615 | + cco = this.cco; | ||
| 616 | + | ||
| 617 | + cco.beginPath(); | ||
| 618 | + cco.setLineWidth(3); | ||
| 619 | + cco.setGlobalAlpha(1); | ||
| 620 | + cco.setStrokeStyle('white'); | ||
| 621 | + cco.strokeRect(left, top, width, height); | ||
| 622 | + | ||
| 623 | + cco.setFillStyle('black'); | ||
| 624 | + cco.setGlobalAlpha(0.5); | ||
| 625 | + cco.fillRect(0, 0, this.wW, top); | ||
| 626 | + cco.fillRect(0, top, left, height); | ||
| 627 | + cco.fillRect(0, top + height, this.wW, this.wH - height - top - tH); | ||
| 628 | + cco.fillRect(left + width, top, this.wW - width - left, height); | ||
| 629 | + | ||
| 630 | + cco.setGlobalAlpha(1); | ||
| 631 | + cco.setStrokeStyle('red'); | ||
| 632 | + cco.moveTo(left+15, top); | ||
| 633 | + cco.lineTo(left, top); | ||
| 634 | + cco.lineTo(left, top+15); | ||
| 635 | + cco.moveTo(left+width-15, top); | ||
| 636 | + cco.lineTo(left+width, top); | ||
| 637 | + cco.lineTo(left+width, top+15); | ||
| 638 | + cco.moveTo(left+15, top+height); | ||
| 639 | + cco.lineTo(left, top+height); | ||
| 640 | + cco.lineTo(left, top+height-15); | ||
| 641 | + cco.moveTo(left+width-15, top+height); | ||
| 642 | + cco.lineTo(left+width, top+height); | ||
| 643 | + cco.lineTo(left+width, top+height-15); | ||
| 644 | + cco.stroke(); | ||
| 645 | + | ||
| 646 | + cco.draw(false, () => { | ||
| 647 | + if (ini) { | ||
| 648 | + this.sD = 'flex'; | ||
| 649 | + this.sT = this.drawTop + 'px'; | ||
| 650 | + this.fDrawImage(true); | ||
| 651 | + } | ||
| 652 | + }); | ||
| 653 | + this.$emit("init"); | ||
| 654 | + }, | ||
| 655 | + fDrawImage(ini = false) { | ||
| 656 | + let tm_now = Date.now(); | ||
| 657 | + if (tm_now - this.drawTm < 20) return; | ||
| 658 | + this.drawTm = tm_now; | ||
| 659 | + | ||
| 660 | + let cc = this.cc, | ||
| 661 | + imgWidth = this.useWidth * this.scaleSize, | ||
| 662 | + imgHeight = this.useHeight * this.scaleSize; | ||
| 663 | + | ||
| 664 | + // #ifdef MP-ALIPAY | ||
| 665 | + cc.save(); | ||
| 666 | + // #endif | ||
| 667 | + | ||
| 668 | + if (this.bgImage) { | ||
| 669 | + // #ifdef MP-ALIPAY | ||
| 670 | + cc.clearRect(0, 0, this.wW, this.wH - tH); | ||
| 671 | + // #endif | ||
| 672 | + // #ifndef MP-ALIPAY | ||
| 673 | + cc.drawImage(this.bgImage, 0, 0, this.wW, this.wH - tH); | ||
| 674 | + // #endif | ||
| 675 | + } else { | ||
| 676 | + cc.fillRect(0, 0, this.wW, this.wH - tH); | ||
| 677 | + } | ||
| 678 | + | ||
| 679 | + if (this.isin) { | ||
| 680 | + let cx = this.focusX * (this.scaleSize - 1), | ||
| 681 | + cy = this.focusY * (this.scaleSize - 1); | ||
| 682 | + | ||
| 683 | + cc.translate(this.centerX, this.centerY); | ||
| 684 | + cc.rotate(this.rotateDeg * Math.PI / 180); | ||
| 685 | + cc.drawImage(this.imgPath, this.posWidth-this.centerX-cx, this.posHeight-this.centerY-cy, imgWidth, imgHeight); | ||
| 686 | + | ||
| 687 | + } else { | ||
| 688 | + cc.translate(this.posWidth + imgWidth / 2, this.posHeight + imgHeight / 2); | ||
| 689 | + cc.rotate(this.rotateDeg * Math.PI / 180); | ||
| 690 | + cc.drawImage(this.imgPath, -imgWidth / 2, -imgHeight / 2, imgWidth, imgHeight); | ||
| 691 | + } | ||
| 692 | + | ||
| 693 | + cc.draw(false); | ||
| 694 | + | ||
| 695 | + // #ifdef MP-ALIPAY | ||
| 696 | + cc.restore(); | ||
| 697 | + // #endif | ||
| 698 | + }, | ||
| 699 | + fPreview() { | ||
| 700 | + if (this.fPreviewing) return; | ||
| 701 | + this.fPreviewing = true; | ||
| 702 | + setTimeout(() => { | ||
| 703 | + this.fPreviewing = false; | ||
| 704 | + }, 1000); | ||
| 705 | + | ||
| 706 | + let style = this.sS, | ||
| 707 | + x = parseInt(style.left), | ||
| 708 | + y = parseInt(style.top), | ||
| 709 | + width = parseInt(style.width), | ||
| 710 | + height = parseInt(style.height); | ||
| 711 | + | ||
| 712 | + // #ifdef MP-ALIPAY | ||
| 713 | + uni.showLoading(); | ||
| 714 | + // #endif | ||
| 715 | + // #ifndef MP-ALIPAY | ||
| 716 | + uni.showLoading({ | ||
| 717 | + title: '加载中...', | ||
| 718 | + mask: true | ||
| 719 | + }); | ||
| 720 | + // #endif | ||
| 721 | + | ||
| 722 | + // #ifdef MP-ALIPAY | ||
| 723 | + this.cc.toTempFilePath({ | ||
| 724 | + x: x, | ||
| 725 | + y: y, | ||
| 726 | + width: width, | ||
| 727 | + height: height, | ||
| 728 | + expWidth: width * this.pixelRatio, | ||
| 729 | + expHeight: height * this.pixelRatio, | ||
| 730 | + fileType: this.fType, | ||
| 731 | + quality: this.qlty, | ||
| 732 | + success: (r) => { | ||
| 733 | + this.prvImgTmp = r = r.apFilePath; | ||
| 734 | + let ccp = this.ccp, | ||
| 735 | + prvX = this.wW, | ||
| 736 | + prvY = parseInt(this.csH), | ||
| 737 | + prvWidth = parseInt(this.sS.width), | ||
| 738 | + prvHeight = parseInt(this.sS.height), | ||
| 739 | + useWidth = prvX - 40, | ||
| 740 | + useHeight = prvY - 80, | ||
| 741 | + radio = useWidth / prvWidth, | ||
| 742 | + rHeight = prvHeight * radio; | ||
| 743 | + if (rHeight < useHeight) { | ||
| 744 | + prvWidth = useWidth; | ||
| 745 | + prvHeight = rHeight; | ||
| 746 | + } else { | ||
| 747 | + radio = useHeight / prvHeight; | ||
| 748 | + prvWidth *= radio; | ||
| 749 | + prvHeight = useHeight; | ||
| 750 | + } | ||
| 751 | + ccp.fillRect(0, 0, prvX, prvY); | ||
| 752 | + this.prvX = prvX = ((prvX - prvWidth) / 2) | 0; | ||
| 753 | + this.prvY = prvY = ((prvY - prvHeight) / 2) | 0; | ||
| 754 | + this.prvWidth = prvWidth = prvWidth | 0; | ||
| 755 | + this.prvHeight = prvHeight = prvHeight | 0; | ||
| 756 | + ccp.drawImage(r, prvX, prvY, prvWidth, prvHeight); | ||
| 757 | + ccp.draw(false); | ||
| 758 | + | ||
| 759 | + this.sO = false; | ||
| 760 | + this.pT = '0'; | ||
| 761 | + }, | ||
| 762 | + fail: () => { | ||
| 763 | + uni.showToast({ | ||
| 764 | + title: "error2", | ||
| 765 | + duration: 2000, | ||
| 766 | + }) | ||
| 767 | + }, | ||
| 768 | + complete: () => { | ||
| 769 | + uni.hideLoading(); | ||
| 770 | + } | ||
| 771 | + }); | ||
| 772 | + // #endif | ||
| 773 | + | ||
| 774 | + // #ifndef MP-ALIPAY | ||
| 775 | + uni.canvasToTempFilePath({ | ||
| 776 | + x: x, | ||
| 777 | + y: y, | ||
| 778 | + width: width, | ||
| 779 | + height: height, | ||
| 780 | + expWidth: width * this.pixelRatio, | ||
| 781 | + expHeight: height * this.pixelRatio, | ||
| 782 | + canvasId: 'avatar-canvas', | ||
| 783 | + fileType: this.fType, | ||
| 784 | + quality: this.qlty, | ||
| 785 | + success: (r) => { | ||
| 786 | + this.prvImgTmp = r = r.tempFilePath; | ||
| 787 | + | ||
| 788 | + let ccp = this.ccp, | ||
| 789 | + prvX = this.wW, | ||
| 790 | + prvY = parseInt(this.csH); | ||
| 791 | + | ||
| 792 | + // #ifndef H5||MP-WEIXIN||APP-PLUS | ||
| 793 | + prvY += tH; | ||
| 794 | + // #endif | ||
| 795 | + // #ifdef APP-PLUS | ||
| 796 | + if (this.platform === 'android') { | ||
| 797 | + prvY += tH; | ||
| 798 | + } | ||
| 799 | + // #endif | ||
| 800 | + | ||
| 801 | + let prvWidth = parseInt(this.sS.width), | ||
| 802 | + prvHeight = parseInt(this.sS.height), | ||
| 803 | + useWidth = prvX - 40, | ||
| 804 | + useHeight = prvY - 80, | ||
| 805 | + radio = useWidth / prvWidth, | ||
| 806 | + rHeight = prvHeight * radio; | ||
| 807 | + if (rHeight < useHeight) { | ||
| 808 | + prvWidth = useWidth; | ||
| 809 | + prvHeight = rHeight; | ||
| 810 | + } else { | ||
| 811 | + radio = useHeight / prvHeight; | ||
| 812 | + prvWidth *= radio; | ||
| 813 | + prvHeight = useHeight; | ||
| 814 | + } | ||
| 815 | + | ||
| 816 | + ccp.fillRect(0, 0, prvX, prvY); | ||
| 817 | + this.prvX = prvX = ((prvX - prvWidth) / 2) | 0; | ||
| 818 | + this.prvY = prvY = ((prvY - prvHeight) / 2) | 0; | ||
| 819 | + this.prvWidth = prvWidth = prvWidth | 0; | ||
| 820 | + this.prvHeight = prvHeight = prvHeight | 0; | ||
| 821 | + ccp.drawImage(r, prvX, prvY, prvWidth, prvHeight); | ||
| 822 | + ccp.draw(false); | ||
| 823 | + | ||
| 824 | + // #ifdef H5 | ||
| 825 | + this.btop(r).then((r) => { | ||
| 826 | + this.sO = false; | ||
| 827 | + this.pT = this.drawTop + 'px'; | ||
| 828 | + }) | ||
| 829 | + // #endif | ||
| 830 | + | ||
| 831 | + this.sO = false; | ||
| 832 | + // if (this.platform === 'android') this.sO = false; | ||
| 833 | + this.pT = this.drawTop + 'px'; | ||
| 834 | + }, | ||
| 835 | + fail: () => { | ||
| 836 | + uni.showToast({ | ||
| 837 | + title: "error2", | ||
| 838 | + duration: 2000, | ||
| 839 | + }) | ||
| 840 | + }, | ||
| 841 | + complete: () => { | ||
| 842 | + uni.hideLoading(); | ||
| 843 | + } | ||
| 844 | + }, this); | ||
| 845 | + // #endif | ||
| 846 | + }, | ||
| 847 | + fChooseImg(index = undefined, params = undefined, data = undefined) { | ||
| 848 | + if (params) { | ||
| 849 | + let sW = params.selWidth, | ||
| 850 | + sH = params.selHeight, | ||
| 851 | + expWidth = params.expWidth, | ||
| 852 | + expHeight = params.expHeight, | ||
| 853 | + quality = params.quality, | ||
| 854 | + canRotate = params.canRotate, | ||
| 855 | + canScale = params.canScale, | ||
| 856 | + minScale = params.minScale, | ||
| 857 | + maxScale = params.maxScale, | ||
| 858 | + stretch = params.stretch, | ||
| 859 | + fileType = params.fileType, | ||
| 860 | + inner = params.inner, | ||
| 861 | + lock = params.lock; | ||
| 862 | + | ||
| 863 | + expWidth && (this.eW = expWidth.toString().indexOf('upx') >= 0 ? parseInt(expWidth) * this.pxRatio : parseInt( | ||
| 864 | + expWidth)); | ||
| 865 | + expHeight && (this.eH = expHeight.toString().indexOf('upx') >= 0 ? parseInt(expHeight) * this.pxRatio : parseInt( | ||
| 866 | + expHeight)); | ||
| 867 | + this.letRotate = (canRotate === false || inner === true || inner === 'true' || canRotate === 'false') ? 0 : 1; | ||
| 868 | + this.letScale = (canScale === false || canScale === 'false') ? 0 : 1; | ||
| 869 | + this.qlty = parseFloat(quality) || 1; | ||
| 870 | + this.mnScale = parseFloat(minScale) || 0.3; | ||
| 871 | + this.mxScale = parseFloat(maxScale) || 4; | ||
| 872 | + this.stc = stretch; | ||
| 873 | + this.isin = (inner === true || inner === 'true') ? 1 : 0; | ||
| 874 | + this.fType = fileType === 'jpg' ? 'jpg' : 'png'; | ||
| 875 | + this.lck = lock; | ||
| 876 | + if (this.isin||!this.letRotate) { | ||
| 877 | + this.bW = '24%'; | ||
| 878 | + this.bD = 'none'; | ||
| 879 | + } else { | ||
| 880 | + this.bW = '19%'; | ||
| 881 | + this.bD = 'flex'; | ||
| 882 | + } | ||
| 883 | + | ||
| 884 | + if (sW && sH) { | ||
| 885 | + sW = sW.toString().indexOf('upx') >= 0 ? parseInt(sW) * this.pxRatio : parseInt(sW); | ||
| 886 | + sH = sH.toString().indexOf('upx') >= 0 ? parseInt(sH) * this.pxRatio : parseInt(sH); | ||
| 887 | + this.sS.width = sW + 'px'; | ||
| 888 | + this.sS.height = sH + 'px'; | ||
| 889 | + this.sS.top = ((this.wH - sH - tH)|0) / 2 + 'px'; | ||
| 890 | + this.sS.left = ((this.wW - sW)|0) / 2 + 'px'; | ||
| 891 | + this.hasSel = true; | ||
| 892 | + } | ||
| 893 | + } | ||
| 894 | + this.rtn = data; | ||
| 895 | + this.indx = index; | ||
| 896 | + this.fSelect(); | ||
| 897 | + }, | ||
| 898 | + fRotate() { | ||
| 899 | + this.rotateDeg += 90 - this.rotateDeg % 90; | ||
| 900 | + this.fDrawImage(); | ||
| 901 | + }, | ||
| 902 | + fStart(e) { | ||
| 903 | + let touches = e.touches, | ||
| 904 | + touch0 = touches[0], | ||
| 905 | + touch1 = touches[1]; | ||
| 906 | + | ||
| 907 | + this.touch0 = touch0; | ||
| 908 | + this.touch1 = touch1; | ||
| 909 | + | ||
| 910 | + if (touch1) { | ||
| 911 | + let x = touch1.x - touch0.x, | ||
| 912 | + y = touch1.y - touch0.y; | ||
| 913 | + this.fgDistance = Math.sqrt(x * x + y * y); | ||
| 914 | + } | ||
| 915 | + }, | ||
| 916 | + fMove(e) { | ||
| 917 | + let touches = e.touches, | ||
| 918 | + touch0 = touches[0], | ||
| 919 | + touch1 = touches[1]; | ||
| 920 | + | ||
| 921 | + if (touch1) { | ||
| 922 | + let x = touch1.x - touch0.x, | ||
| 923 | + y = touch1.y - touch0.y, | ||
| 924 | + fgDistance = Math.sqrt(x * x + y * y), | ||
| 925 | + scaleSize = 0.005 * (fgDistance - this.fgDistance), | ||
| 926 | + beScaleSize = this.scaleSize + scaleSize; | ||
| 927 | + | ||
| 928 | + do { | ||
| 929 | + if (!this.letScale) break; | ||
| 930 | + if (beScaleSize < this.mnScale) break; | ||
| 931 | + if (beScaleSize > this.mxScale) break; | ||
| 932 | + | ||
| 933 | + let growX = this.useWidth * scaleSize / 2, | ||
| 934 | + growY = this.useHeight * scaleSize / 2; | ||
| 935 | + if (this.isin) { | ||
| 936 | + let imgWidth = this.useWidth * beScaleSize, | ||
| 937 | + imgHeight = this.useHeight * beScaleSize, | ||
| 938 | + l = this.posWidth - growX, | ||
| 939 | + t = this.posHeight - growY, | ||
| 940 | + r = l + imgWidth, | ||
| 941 | + b = t + imgHeight, | ||
| 942 | + left = parseInt(this.sS.left), | ||
| 943 | + top = parseInt(this.sS.top), | ||
| 944 | + width = parseInt(this.sS.width), | ||
| 945 | + height = parseInt(this.sS.height), | ||
| 946 | + right = left + width, | ||
| 947 | + bottom = top + height, | ||
| 948 | + cx, cy; | ||
| 949 | + | ||
| 950 | + if (imgWidth <= width || imgHeight <= height) break; | ||
| 951 | + this.cx = cx = this.focusX * beScaleSize - this.focusX, | ||
| 952 | + this.cy = cy = this.focusY * beScaleSize - this.focusY; | ||
| 953 | + this.posWidth -= growX; | ||
| 954 | + this.posHeight -= growY; | ||
| 955 | + if (this.posWidth - cx > left) { | ||
| 956 | + this.posWidth = left + cx; | ||
| 957 | + } | ||
| 958 | + if (this.posWidth + imgWidth - cx < right) { | ||
| 959 | + this.posWidth = right - imgWidth + cx; | ||
| 960 | + } | ||
| 961 | + if (this.posHeight - cy > top) { | ||
| 962 | + this.posHeight = top + cy; | ||
| 963 | + } | ||
| 964 | + if (this.posHeight + imgHeight - cy < bottom) { | ||
| 965 | + this.posHeight = bottom - imgHeight + cy; | ||
| 966 | + } | ||
| 967 | + } else { | ||
| 968 | + this.posWidth -= growX; | ||
| 969 | + this.posHeight -= growY; | ||
| 970 | + } | ||
| 971 | + | ||
| 972 | + this.scaleSize = beScaleSize; | ||
| 973 | + } while (0); | ||
| 974 | + this.fgDistance = fgDistance; | ||
| 975 | + if (touch1.x !== touch0.x && this.letRotate) { | ||
| 976 | + x = (this.touch1.y - this.touch0.y) / (this.touch1.x - this.touch0.x); | ||
| 977 | + y = (touch1.y - touch0.y) / (touch1.x - touch0.x); | ||
| 978 | + this.rotateDeg += Math.atan((y - x) / (1 + x * y)) * 180 / Math.PI; | ||
| 979 | + this.touch0 = touch0; | ||
| 980 | + this.touch1 = touch1; | ||
| 981 | + } | ||
| 982 | + | ||
| 983 | + this.fDrawImage(); | ||
| 984 | + } else if (this.touch0) { | ||
| 985 | + let x = touch0.x - this.touch0.x, | ||
| 986 | + y = touch0.y - this.touch0.y, | ||
| 987 | + beX = this.posWidth + x, | ||
| 988 | + beY = this.posHeight + y; | ||
| 989 | + if (this.isin) { | ||
| 990 | + let imgWidth = this.useWidth * this.scaleSize, | ||
| 991 | + imgHeight = this.useHeight * this.scaleSize, | ||
| 992 | + l = beX, | ||
| 993 | + t = beY, | ||
| 994 | + r = l + imgWidth, | ||
| 995 | + b = t + imgHeight, | ||
| 996 | + left = parseInt(this.sS.left), | ||
| 997 | + top = parseInt(this.sS.top), | ||
| 998 | + right = left + parseInt(this.sS.width), | ||
| 999 | + bottom = top + parseInt(this.sS.height), | ||
| 1000 | + cx, cy; | ||
| 1001 | + | ||
| 1002 | + this.cx = cx = this.focusX * this.scaleSize - this.focusX; | ||
| 1003 | + this.cy = cy = this.focusY * this.scaleSize - this.focusY; | ||
| 1004 | + | ||
| 1005 | + if (!this.lckWidth && Math.abs(x) < 100) { | ||
| 1006 | + if (left < l - cx) { | ||
| 1007 | + this.posWidth = left + cx; | ||
| 1008 | + } else if (right > r - cx) { | ||
| 1009 | + this.posWidth = right - imgWidth + cx; | ||
| 1010 | + } else { | ||
| 1011 | + this.posWidth = beX; | ||
| 1012 | + this.focusX -= x; | ||
| 1013 | + } | ||
| 1014 | + } | ||
| 1015 | + if (!this.lckHeight && Math.abs(y) < 100) { | ||
| 1016 | + if (top < t - cy) { | ||
| 1017 | + this.focusY -= (top + cy - this.posHeight); | ||
| 1018 | + this.posHeight = top + cy; | ||
| 1019 | + } else if (bottom > b - cy) { | ||
| 1020 | + this.focusY -= (bottom + cy - (this.posHeight + imgHeight)); | ||
| 1021 | + this.posHeight = bottom - imgHeight + cy; | ||
| 1022 | + } else { | ||
| 1023 | + this.posHeight = beY; | ||
| 1024 | + this.focusY -= y; | ||
| 1025 | + } | ||
| 1026 | + } | ||
| 1027 | + } else { | ||
| 1028 | + if (Math.abs(x) < 100 && !this.lckWidth) this.posWidth = beX; | ||
| 1029 | + if (Math.abs(y) < 100 && !this.lckHeight) this.posHeight = beY; | ||
| 1030 | + this.focusX -= x; | ||
| 1031 | + this.focusY -= y; | ||
| 1032 | + } | ||
| 1033 | + | ||
| 1034 | + this.touch0 = touch0; | ||
| 1035 | + this.fDrawImage(); | ||
| 1036 | + } | ||
| 1037 | + }, | ||
| 1038 | + fEnd(e) { | ||
| 1039 | + let touches = e.touches, | ||
| 1040 | + touch0 = touches && touches[0], | ||
| 1041 | + touch1 = touches && touches[1]; | ||
| 1042 | + if (touch0) { | ||
| 1043 | + this.touch0 = touch0; | ||
| 1044 | + } else { | ||
| 1045 | + this.touch0 = null; | ||
| 1046 | + this.touch1 = null; | ||
| 1047 | + } | ||
| 1048 | + }, | ||
| 1049 | + fHideImg() { | ||
| 1050 | + this.prvImg = ''; | ||
| 1051 | + this.pT = '-10000px'; | ||
| 1052 | + this.sO = true; | ||
| 1053 | + this.prvImgData = null; | ||
| 1054 | + this.target = null; | ||
| 1055 | + }, | ||
| 1056 | + fClose() { | ||
| 1057 | + this.sD = 'none'; | ||
| 1058 | + this.sT = '-10000px'; | ||
| 1059 | + this.hasSel = false; | ||
| 1060 | + this.fHideImg(); | ||
| 1061 | + this.noBar || uni.showTabBar(); | ||
| 1062 | + this.$emit("end"); | ||
| 1063 | + }, | ||
| 1064 | + fGetImgData() { | ||
| 1065 | + return new Promise((resolve, reject) => { | ||
| 1066 | + let prvX = this.prvX, | ||
| 1067 | + prvY = this.prvY, | ||
| 1068 | + prvWidth = this.prvWidth, | ||
| 1069 | + prvHeight = this.prvHeight; | ||
| 1070 | + // #ifdef MP-ALIPAY | ||
| 1071 | + this.ccp.getImageData({ | ||
| 1072 | + x: prvX, | ||
| 1073 | + y: prvY, | ||
| 1074 | + width: prvWidth, | ||
| 1075 | + height: prvHeight, | ||
| 1076 | + success(res) { | ||
| 1077 | + resolve(res.data); | ||
| 1078 | + }, | ||
| 1079 | + fail(err) { | ||
| 1080 | + reject(err); | ||
| 1081 | + } | ||
| 1082 | + }, this); | ||
| 1083 | + // #endif | ||
| 1084 | + // #ifndef MP-ALIPAY | ||
| 1085 | + uni.canvasGetImageData({ | ||
| 1086 | + canvasId: 'prv-canvas', | ||
| 1087 | + x: prvX, | ||
| 1088 | + y: prvY, | ||
| 1089 | + width: prvWidth, | ||
| 1090 | + height: prvHeight, | ||
| 1091 | + success(res) { | ||
| 1092 | + resolve(res.data); | ||
| 1093 | + }, | ||
| 1094 | + fail(err) { | ||
| 1095 | + reject(err); | ||
| 1096 | + } | ||
| 1097 | + }, this); | ||
| 1098 | + // #endif | ||
| 1099 | + }); | ||
| 1100 | + }, | ||
| 1101 | + async fColorChange(e) { | ||
| 1102 | + let tm_now = Date.now(); | ||
| 1103 | + if (tm_now - this.prvTm < 100) return; | ||
| 1104 | + this.prvTm = tm_now; | ||
| 1105 | + | ||
| 1106 | + // #ifdef MP-ALIPAY | ||
| 1107 | + uni.showLoading(); | ||
| 1108 | + // #endif | ||
| 1109 | + // #ifndef MP-ALIPAY | ||
| 1110 | + uni.showLoading({ | ||
| 1111 | + title: '加载中...', | ||
| 1112 | + mask: true | ||
| 1113 | + }); | ||
| 1114 | + // #endif | ||
| 1115 | + | ||
| 1116 | + if (!this.prvImgData) { | ||
| 1117 | + if (!(this.prvImgData = await this.fGetImgData().catch(() => { | ||
| 1118 | + uni.showToast({ | ||
| 1119 | + title: "error_read", | ||
| 1120 | + duration: 2000, | ||
| 1121 | + }) | ||
| 1122 | + }))) return; | ||
| 1123 | + | ||
| 1124 | + this.target = new Uint8ClampedArray(this.prvImgData.length); | ||
| 1125 | + } | ||
| 1126 | + | ||
| 1127 | + let data = this.prvImgData, | ||
| 1128 | + target = this.target, | ||
| 1129 | + i = e.detail.value, | ||
| 1130 | + r, g, b, a, h, s, l, d, p, q, t, min, max, hK, tR, tG, tB; | ||
| 1131 | + | ||
| 1132 | + if (i === 0) { | ||
| 1133 | + target = data; | ||
| 1134 | + } else { | ||
| 1135 | + i = (i + 100) / 200; | ||
| 1136 | + if (i < 0.005) i = 0; | ||
| 1137 | + if (i > 0.995) i = 1; | ||
| 1138 | + for (let n = data.length - 1; n >= 0; n -= 4) { | ||
| 1139 | + r = data[n - 3] / 255; | ||
| 1140 | + g = data[n - 2] / 255; | ||
| 1141 | + b = data[n - 1] / 255; | ||
| 1142 | + max = Math.max(r, g, b); | ||
| 1143 | + min = Math.min(r, g, b); | ||
| 1144 | + d = max - min; | ||
| 1145 | + if (max === min) { | ||
| 1146 | + h = 0; | ||
| 1147 | + } else if (max === r && g >= b) { | ||
| 1148 | + h = 60 * ((g - b) / d); | ||
| 1149 | + } else if (max === r && g < b) { | ||
| 1150 | + h = 60 * ((g - b) / d) + 360; | ||
| 1151 | + } else if (max === g) { | ||
| 1152 | + h = 60 * ((b - r) / d) + 120; | ||
| 1153 | + } else if (max === b) { | ||
| 1154 | + h = 60 * ((r - g) / d) + 240; | ||
| 1155 | + } | ||
| 1156 | + l = (max + min) / 2; | ||
| 1157 | + if (l === 0 || max === min) { | ||
| 1158 | + s = 0; | ||
| 1159 | + } else if (0 < l && l <= 0.5) { | ||
| 1160 | + s = d / (2 * l); | ||
| 1161 | + } else if (l > 0.5) { | ||
| 1162 | + s = d / (2 - 2 * l); | ||
| 1163 | + } | ||
| 1164 | + data[n] && (a = data[n]); | ||
| 1165 | + | ||
| 1166 | + if (i < 0.5) { | ||
| 1167 | + s = s * i / 0.5; | ||
| 1168 | + } else if (i > 0.5) { | ||
| 1169 | + s = 2 * s + 2 * i - (s * i / 0.5) - 1; | ||
| 1170 | + } | ||
| 1171 | + | ||
| 1172 | + if (s === 0) { | ||
| 1173 | + r = g = b = Math.round(l * 255); | ||
| 1174 | + } else { | ||
| 1175 | + if (l < 0.5) { | ||
| 1176 | + q = l * (1 + s); | ||
| 1177 | + } else if (l >= 0.5) { | ||
| 1178 | + q = l + s - (l * s); | ||
| 1179 | + } | ||
| 1180 | + p = 2 * l - q; | ||
| 1181 | + hK = h / 360; | ||
| 1182 | + tR = hK + 1 / 3; | ||
| 1183 | + tG = hK; | ||
| 1184 | + tB = hK - 1 / 3; | ||
| 1185 | + let correctRGB = (t) => { | ||
| 1186 | + if (t < 0) { | ||
| 1187 | + return t + 1.0; | ||
| 1188 | + } | ||
| 1189 | + if (t > 1) { | ||
| 1190 | + return t - 1.0; | ||
| 1191 | + } | ||
| 1192 | + return t; | ||
| 1193 | + }; | ||
| 1194 | + let createRGB = (t) => { | ||
| 1195 | + if (t < (1 / 6)) { | ||
| 1196 | + return p + ((q - p) * 6 * t); | ||
| 1197 | + } else if (t >= (1 / 6) && t < (1 / 2)) { | ||
| 1198 | + return q; | ||
| 1199 | + } else if (t >= (1 / 2) && t < (2 / 3)) { | ||
| 1200 | + return p + ((q - p) * 6 * ((2 / 3) - t)); | ||
| 1201 | + } | ||
| 1202 | + return p; | ||
| 1203 | + }; | ||
| 1204 | + r = tR = Math.round(createRGB(correctRGB(tR)) * 255); | ||
| 1205 | + g = tG = Math.round(createRGB(correctRGB(tG)) * 255); | ||
| 1206 | + b = tB = Math.round(createRGB(correctRGB(tB)) * 255); | ||
| 1207 | + } | ||
| 1208 | + a && (target[n] = a); | ||
| 1209 | + target[n - 3] = r; | ||
| 1210 | + target[n - 2] = g; | ||
| 1211 | + target[n - 1] = b; | ||
| 1212 | + } | ||
| 1213 | + } | ||
| 1214 | + | ||
| 1215 | + let prvX = this.prvX, | ||
| 1216 | + prvY = this.prvY, | ||
| 1217 | + prvWidth = this.prvWidth, | ||
| 1218 | + prvHeight = this.prvHeight; | ||
| 1219 | + | ||
| 1220 | + // #ifdef MP-ALIPAY | ||
| 1221 | + this.ccp.putImageData({ | ||
| 1222 | + x: prvX, | ||
| 1223 | + y: prvY, | ||
| 1224 | + width: prvWidth, | ||
| 1225 | + height: prvHeight, | ||
| 1226 | + data: target, | ||
| 1227 | + fail() { | ||
| 1228 | + uni.showToast({ | ||
| 1229 | + title: 'error_put', | ||
| 1230 | + duration: 2000 | ||
| 1231 | + }) | ||
| 1232 | + }, | ||
| 1233 | + complete() { | ||
| 1234 | + uni.hideLoading(); | ||
| 1235 | + } | ||
| 1236 | + }, this); | ||
| 1237 | + // #endif | ||
| 1238 | + | ||
| 1239 | + // #ifndef MP-ALIPAY | ||
| 1240 | + uni.canvasPutImageData({ | ||
| 1241 | + canvasId: 'prv-canvas', | ||
| 1242 | + x: prvX, | ||
| 1243 | + y: prvY, | ||
| 1244 | + width: prvWidth, | ||
| 1245 | + height: prvHeight, | ||
| 1246 | + data: target, | ||
| 1247 | + fail() { | ||
| 1248 | + uni.showToast({ | ||
| 1249 | + title: 'error_put', | ||
| 1250 | + duration: 2000 | ||
| 1251 | + }) | ||
| 1252 | + }, | ||
| 1253 | + complete() { | ||
| 1254 | + uni.hideLoading(); | ||
| 1255 | + } | ||
| 1256 | + }, this); | ||
| 1257 | + // #endif | ||
| 1258 | + }, | ||
| 1259 | + btop(base64) { | ||
| 1260 | + this.base64 = base64; | ||
| 1261 | + return new Promise(function(resolve, reject) { | ||
| 1262 | + var arr = base64.split(','), | ||
| 1263 | + mime = arr[0].match(/:(.*?);/)[1], | ||
| 1264 | + bstr = atob(arr[1]), | ||
| 1265 | + n = bstr.length, | ||
| 1266 | + u8arr = new Uint8Array(n); | ||
| 1267 | + while (n--) { | ||
| 1268 | + u8arr[n] = bstr.charCodeAt(n); | ||
| 1269 | + } | ||
| 1270 | + return resolve((window.URL || window.webkitURL).createObjectURL(new Blob([u8arr], { | ||
| 1271 | + type: mime | ||
| 1272 | + }))); | ||
| 1273 | + }); | ||
| 1274 | + }, | ||
| 1275 | + } | ||
| 1276 | + } | ||
| 1277 | +</script> | ||
| 1278 | + | ||
| 1279 | +<style> | ||
| 1280 | + .boxsa{ | ||
| 1281 | + z-index: 800; | ||
| 1282 | + } | ||
| 1283 | + .my-canvas { | ||
| 1284 | + display: flex; | ||
| 1285 | + position: fixed !important; | ||
| 1286 | + background: #000000; | ||
| 1287 | + left: 0; | ||
| 1288 | + z-index: 100000; | ||
| 1289 | + width: 100%; | ||
| 1290 | + } | ||
| 1291 | + | ||
| 1292 | + .my-avatar { | ||
| 1293 | + width: 150upx; | ||
| 1294 | + height: 150upx; | ||
| 1295 | + border-radius: 100%; | ||
| 1296 | + } | ||
| 1297 | + | ||
| 1298 | + .oper-canvas { | ||
| 1299 | + display: flex; | ||
| 1300 | + position: fixed !important; | ||
| 1301 | + left: 0; | ||
| 1302 | + z-index: 100001; | ||
| 1303 | + width: 100%; | ||
| 1304 | + } | ||
| 1305 | + | ||
| 1306 | + .prv-canvas { | ||
| 1307 | + display: flex; | ||
| 1308 | + position: fixed !important; | ||
| 1309 | + background: #000000; | ||
| 1310 | + left: 0; | ||
| 1311 | + z-index: 200000; | ||
| 1312 | + width: 100%; | ||
| 1313 | + } | ||
| 1314 | + | ||
| 1315 | + .oper-wrapper { | ||
| 1316 | + height: 50px; | ||
| 1317 | + position: fixed !important; | ||
| 1318 | + box-sizing: border-box; | ||
| 1319 | + border: 1px solid #F1F1F1; | ||
| 1320 | + background: #ffffff; | ||
| 1321 | + width: 100%; | ||
| 1322 | + left: 0; | ||
| 1323 | + bottom: 0; | ||
| 1324 | + z-index: 100009; | ||
| 1325 | + flex-direction: row; | ||
| 1326 | + } | ||
| 1327 | + | ||
| 1328 | + .oper { | ||
| 1329 | + display: flex; | ||
| 1330 | + flex-direction: column; | ||
| 1331 | + justify-content: center; | ||
| 1332 | + padding: 10upx 20upx; | ||
| 1333 | + width: 100%; | ||
| 1334 | + height: 100%; | ||
| 1335 | + box-sizing: border-box; | ||
| 1336 | + align-self: center; | ||
| 1337 | + } | ||
| 1338 | + | ||
| 1339 | + .btn-wrapper { | ||
| 1340 | + display: flex; | ||
| 1341 | + flex-direction: row; | ||
| 1342 | + /* #ifndef H5 */ | ||
| 1343 | + flex-grow: 1; | ||
| 1344 | + /* #endif */ | ||
| 1345 | + /* #ifdef H5 */ | ||
| 1346 | + height: 50px; | ||
| 1347 | + /* #endif */ | ||
| 1348 | + justify-content: space-between; | ||
| 1349 | + } | ||
| 1350 | + | ||
| 1351 | + .btn-wrapper view { | ||
| 1352 | + display: flex; | ||
| 1353 | + align-items: center; | ||
| 1354 | + justify-content: center; | ||
| 1355 | + font-size: 16px; | ||
| 1356 | + color: #333; | ||
| 1357 | + border: 1px solid #f1f1f1; | ||
| 1358 | + border-radius: 6%; | ||
| 1359 | + } | ||
| 1360 | + | ||
| 1361 | + .hover { | ||
| 1362 | + background: #f1f1f1; | ||
| 1363 | + border-radius: 6%; | ||
| 1364 | + } | ||
| 1365 | + | ||
| 1366 | + .clr-wrapper { | ||
| 1367 | + display: flex; | ||
| 1368 | + flex-direction: row; | ||
| 1369 | + flex-grow: 1; | ||
| 1370 | + } | ||
| 1371 | + | ||
| 1372 | + .clr-wrapper view { | ||
| 1373 | + display: flex; | ||
| 1374 | + align-items: center; | ||
| 1375 | + justify-content: center; | ||
| 1376 | + font-size: 16px; | ||
| 1377 | + color: #333; | ||
| 1378 | + border: 1px solid #f1f1f1; | ||
| 1379 | + border-radius: 6%; | ||
| 1380 | + } | ||
| 1381 | + | ||
| 1382 | + .my-slider { | ||
| 1383 | + flex-grow: 1; | ||
| 1384 | + } | ||
| 1385 | +</style> |
emit/index.js
0 → 100644
| 1 | +/** | ||
| 2 | + * 点赞类型 | ||
| 3 | + */ | ||
| 4 | +export const LIKETYPE = { | ||
| 5 | + /** | ||
| 6 | + * 学生端 | ||
| 7 | + * @value STUDENTEND | ||
| 8 | + */ | ||
| 9 | + 'STUDENTEND': 'STUDENTEND', | ||
| 10 | + /** | ||
| 11 | + * 老师端 | ||
| 12 | + * @value TEACHERSEND | ||
| 13 | + */ | ||
| 14 | + 'TEACHERSEND': 'TEACHERSEND', | ||
| 15 | + /** | ||
| 16 | + * 管理员端 | ||
| 17 | + * @value ADMINEND | ||
| 18 | + */ | ||
| 19 | + 'ADMINEND': 'ADMINEND' | ||
| 20 | +} | ||
| 21 | +/** | ||
| 22 | + * 性别类型 | ||
| 23 | + */ | ||
| 24 | +export const GENDER = { | ||
| 25 | + /** | ||
| 26 | + * 男 | ||
| 27 | + * @value 1 | ||
| 28 | + */ | ||
| 29 | + "MALE": 1, | ||
| 30 | + /** | ||
| 31 | + * 女 | ||
| 32 | + * @value 2 | ||
| 33 | + */ | ||
| 34 | + "FEMALE": 2 | ||
| 35 | +} | ||
| 36 | +/** | ||
| 37 | + * 操作状态 | ||
| 38 | + */ | ||
| 39 | +export const OPERATIONSTATUS = { | ||
| 40 | + /** | ||
| 41 | + * 待审核 | ||
| 42 | + * @value 0 | ||
| 43 | + */ | ||
| 44 | + 'PENDINGREVIEW': 0, | ||
| 45 | + /** | ||
| 46 | + * 通过 | ||
| 47 | + * @value 1 | ||
| 48 | + */ | ||
| 49 | + 'ADOPT': 1, | ||
| 50 | + /** | ||
| 51 | + * 不通过 | ||
| 52 | + * @value 2 | ||
| 53 | + */ | ||
| 54 | + 'REFUSE': 2 | ||
| 55 | +} | ||
| 56 | +/** | ||
| 57 | + * 请假审核状态 | ||
| 58 | + */ | ||
| 59 | +export const AUDITSTATUS = { | ||
| 60 | + /** | ||
| 61 | + * 待审核 | ||
| 62 | + * @value 1 | ||
| 63 | + */ | ||
| 64 | + 'PENDINGREVIEW': 1, | ||
| 65 | + /** | ||
| 66 | + * 审核通过 | ||
| 67 | + * @value 2 | ||
| 68 | + */ | ||
| 69 | + 'APPROVED': 2, | ||
| 70 | + /** | ||
| 71 | + * 未通过 | ||
| 72 | + * @value 3 | ||
| 73 | + */ | ||
| 74 | + 'FAILED': 3 | ||
| 75 | +} |
index.html
0 → 100644
| 1 | +<!DOCTYPE html> | ||
| 2 | +<html lang="en"> | ||
| 3 | + <head> | ||
| 4 | + <meta charset="UTF-8" /> | ||
| 5 | + <script> | ||
| 6 | + var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || | ||
| 7 | + CSS.supports('top: constant(a)')) | ||
| 8 | + document.write( | ||
| 9 | + '<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + | ||
| 10 | + (coverSupport ? ', viewport-fit=cover' : '') + '" />') | ||
| 11 | + </script> | ||
| 12 | + <title></title> | ||
| 13 | + <!--preload-links--> | ||
| 14 | + <!--app-context--> | ||
| 15 | + </head> | ||
| 16 | + <body> | ||
| 17 | + <div id="app"><!--app-html--></div> | ||
| 18 | + <script type="module" src="/main.js"></script> | ||
| 19 | + </body> | ||
| 20 | +</html> |
main.js
0 → 100644
| 1 | +import Vue from 'vue' | ||
| 2 | +import App from './App' | ||
| 3 | +import service from "@/common/service.js" | ||
| 4 | + | ||
| 5 | +import store from './store' | ||
| 6 | +// 导入并挂载全局的分享方法 | ||
| 7 | +import share from '@/common/share.js' | ||
| 8 | +Vue.mixin(share) | ||
| 9 | + | ||
| 10 | + | ||
| 11 | +// (ID):wx5bbc433d447d1a86 | ||
| 12 | +// (密钥):7fc1344c96e987638638f9fd9701346b | ||
| 13 | + | ||
| 14 | +//导入自己封装的类库 | ||
| 15 | +// import sjuAsync from './common/sju.async.js' | ||
| 16 | +// import sjuBase from './common/sju.base.js' | ||
| 17 | +// import sjuAlert from './common/sju.alert.js' | ||
| 18 | +// import sjuLogin from './common/sju.login.js' | ||
| 19 | +// import sjuAjax from './common/sju.ajax.js' | ||
| 20 | +// import sjuPay from './common/sju.pay.js' | ||
| 21 | +import sjuNav from './common/sju.nav.js' | ||
| 22 | + | ||
| 23 | + | ||
| 24 | + | ||
| 25 | +// 将封装库引入Vue原型链 | ||
| 26 | +// Vue.prototype.$sjuAsync = sjuAsync; | ||
| 27 | +// Vue.prototype.$sjuBase = sjuBase; | ||
| 28 | +// Vue.prototype.$sjuAlert = sjuAlert; | ||
| 29 | +// Vue.prototype.$sjuLogin = sjuLogin; | ||
| 30 | +// Vue.prototype.$sjuAjax = sjuAjax; | ||
| 31 | +// Vue.prototype.$sjuPay = sjuPay; | ||
| 32 | +// 引入全局uView | ||
| 33 | +import uView from 'uview-ui' | ||
| 34 | +Vue.use(uView); | ||
| 35 | +import topbar from './components/top_bar/top_bar.vue' | ||
| 36 | +Vue.component('topbar',topbar) | ||
| 37 | + | ||
| 38 | +import ftadd from './components/ft_add/ft_add.vue' | ||
| 39 | +Vue.component('ftadd',ftadd) | ||
| 40 | +import ftadd1 from './components/ft_add/ft_add1.vue' | ||
| 41 | +Vue.component('ftadd1',ftadd1) | ||
| 42 | + | ||
| 43 | +// 剪裁头像 | ||
| 44 | +import avatar from "./components/yq-avatar/yq-avatar.vue"; | ||
| 45 | +// Vue.prototype.$url = url | ||
| 46 | +Vue.component('avatar',avatar) | ||
| 47 | +// 图片懒加载 | ||
| 48 | +import myLazyLoad from "./components/my_lazy_load/my_lazy_load.vue"; | ||
| 49 | +// Vue.prototype.$url = url | ||
| 50 | +Vue.component('myLazyLoad',myLazyLoad) | ||
| 51 | + | ||
| 52 | +Vue.prototype.$sjuNav = sjuNav //页面跳转 | ||
| 53 | +Vue.prototype.$service = service; | ||
| 54 | +Vue.prototype.$store = store | ||
| 55 | +// Vue.prototype.$service = service | ||
| 56 | +App.mpType = 'app' | ||
| 57 | + | ||
| 58 | +const app = new Vue({ | ||
| 59 | + store, | ||
| 60 | + ...App | ||
| 61 | +}) | ||
| 62 | +app.$mount() | ||
| 63 | + | ||
| 64 | + | ||
| 65 | + | ||
| 66 | + | ||
| 67 | + |
manifest.json
0 → 100644
| 1 | +{ | ||
| 2 | + "name" : "teaching", | ||
| 3 | + "appid" : "__UNI__C551C4D", | ||
| 4 | + "description" : "", | ||
| 5 | + "versionName" : "1.0.0", | ||
| 6 | + "versionCode" : "100", | ||
| 7 | + "transformPx" : false, | ||
| 8 | + /* 5+App特有相关 */ | ||
| 9 | + "app-plus" : { | ||
| 10 | + "usingComponents" : true, | ||
| 11 | + "nvueStyleCompiler" : "uni-app", | ||
| 12 | + "compilerVersion" : 3, | ||
| 13 | + "splashscreen" : { | ||
| 14 | + "alwaysShowBeforeRender" : true, | ||
| 15 | + "waiting" : true, | ||
| 16 | + "autoclose" : true, | ||
| 17 | + "delay" : 0 | ||
| 18 | + }, | ||
| 19 | + /* 模块配置 */ | ||
| 20 | + "modules" : {}, | ||
| 21 | + /* 应用发布信息 */ | ||
| 22 | + "distribute" : { | ||
| 23 | + /* android打包配置 */ | ||
| 24 | + "android" : { | ||
| 25 | + "permissions" : [ | ||
| 26 | + "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>", | ||
| 27 | + "<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>", | ||
| 28 | + "<uses-permission android:name=\"android.permission.VIBRATE\"/>", | ||
| 29 | + "<uses-permission android:name=\"android.permission.READ_LOGS\"/>", | ||
| 30 | + "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>", | ||
| 31 | + "<uses-feature android:name=\"android.hardware.camera.autofocus\"/>", | ||
| 32 | + "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>", | ||
| 33 | + "<uses-permission android:name=\"android.permission.CAMERA\"/>", | ||
| 34 | + "<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>", | ||
| 35 | + "<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>", | ||
| 36 | + "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>", | ||
| 37 | + "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>", | ||
| 38 | + "<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>", | ||
| 39 | + "<uses-feature android:name=\"android.hardware.camera\"/>", | ||
| 40 | + "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>" | ||
| 41 | + ] | ||
| 42 | + }, | ||
| 43 | + /* ios打包配置 */ | ||
| 44 | + "ios" : {}, | ||
| 45 | + /* SDK配置 */ | ||
| 46 | + "sdkConfigs" : {} | ||
| 47 | + } | ||
| 48 | + }, | ||
| 49 | + /* 快应用特有相关 */ | ||
| 50 | + "quickapp" : {}, | ||
| 51 | + /* 小程序特有相关 */ | ||
| 52 | + "mp-weixin" : { | ||
| 53 | + "appid" : "wx5bbc433d447d1a86", | ||
| 54 | + "setting" : { | ||
| 55 | + "urlCheck" : false, | ||
| 56 | + "es6" : true | ||
| 57 | + }, | ||
| 58 | + "usingComponents" : true | ||
| 59 | + }, | ||
| 60 | + "mp-alipay" : { | ||
| 61 | + "usingComponents" : true | ||
| 62 | + }, | ||
| 63 | + "mp-baidu" : { | ||
| 64 | + "usingComponents" : true | ||
| 65 | + }, | ||
| 66 | + "mp-toutiao" : { | ||
| 67 | + "usingComponents" : true | ||
| 68 | + }, | ||
| 69 | + "uniStatistics" : { | ||
| 70 | + "enable" : false | ||
| 71 | + }, | ||
| 72 | + "vueVersion" : "2" | ||
| 73 | +} |
page_admin/add_praise/add_praise.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <view class="add_praise"> | ||
| 3 | + <view class="tel_index_bg"></view> | ||
| 4 | + <view class="add_praise-main"> | ||
| 5 | + <view class="add_praise-main-1"> | ||
| 6 | + <view class="add_praise-main-1-l">请在此处提交你对我校及某位老师的表扬</view> | ||
| 7 | + <view class="add_praise-main-1-b"> | ||
| 8 | + <view class="add_praise-main-1-b-u"> | ||
| 9 | + <u-upload | ||
| 10 | + :fileList="fileList" | ||
| 11 | + @afterRead="afterRead" | ||
| 12 | + @delete="deletePic" | ||
| 13 | + name="4" | ||
| 14 | + multiple | ||
| 15 | + :maxCount="6" | ||
| 16 | + ></u-upload> | ||
| 17 | + </view> | ||
| 18 | + <view class="add_praise-main-1-b-t"> | ||
| 19 | + <u--textarea height="150" v-model="content" placeholder="请输入文字内容" ></u--textarea> | ||
| 20 | + </view> | ||
| 21 | + </view> | ||
| 22 | + | ||
| 23 | + </view> | ||
| 24 | + <view class="operation" @click="submit"> | ||
| 25 | + 提交表扬 | ||
| 26 | + </view> | ||
| 27 | + </view> | ||
| 28 | + </view> | ||
| 29 | +</template> | ||
| 30 | + | ||
| 31 | +<script> | ||
| 32 | + export default { | ||
| 33 | + data() { | ||
| 34 | + return { | ||
| 35 | + fileList: [], | ||
| 36 | + content: '' | ||
| 37 | + }; | ||
| 38 | + }, | ||
| 39 | + methods: { | ||
| 40 | + submit() { | ||
| 41 | + var datas = { | ||
| 42 | + content: this.content, | ||
| 43 | + imgs: this.fileList.map(item => item.url) | ||
| 44 | + } | ||
| 45 | + var jkurl = '/praise/add' | ||
| 46 | + this.$service.P_post(jkurl, datas).then(res => { | ||
| 47 | + uni.showToast({ | ||
| 48 | + icon:'none', | ||
| 49 | + title: '上传成功' | ||
| 50 | + }) | ||
| 51 | + setTimeout(() => { | ||
| 52 | + uni.navigateBack({ | ||
| 53 | + delta: 1 | ||
| 54 | + }) | ||
| 55 | + }, 1500) | ||
| 56 | + }) | ||
| 57 | + }, | ||
| 58 | + async afterRead(event) { | ||
| 59 | + let lists = [].concat(event.file) | ||
| 60 | + for (let i = 0; i < lists.length; i++) { | ||
| 61 | + let res = await this.uploadFilePromise(lists[i].url) | ||
| 62 | + this.fileList.push({ | ||
| 63 | + name: res.data, | ||
| 64 | + url: res.name | ||
| 65 | + }) | ||
| 66 | + } | ||
| 67 | + this.$emit('change', this.fileList) | ||
| 68 | + }, | ||
| 69 | + uploadFilePromise(url) { | ||
| 70 | + let baseurl = this.$service.baseurl | ||
| 71 | + | ||
| 72 | + return new Promise((resolve, reject) => { | ||
| 73 | + uni.showLoading({ | ||
| 74 | + title: '上传中' | ||
| 75 | + }) | ||
| 76 | + uni.uploadFile({ | ||
| 77 | + url: baseurl + 'api/login/upload', // 仅为示例,非真实的接口地址 | ||
| 78 | + filePath: url, | ||
| 79 | + name: 'file', | ||
| 80 | + header: { | ||
| 81 | + 'Authorization': uni.getStorageSync('token') | ||
| 82 | + }, | ||
| 83 | + formData: {}, | ||
| 84 | + success: (res) => { | ||
| 85 | + console.log('res=====>', JSON.parse(res.data)) | ||
| 86 | + resolve(JSON.parse(res.data)) | ||
| 87 | + uni.hideLoading() | ||
| 88 | + } | ||
| 89 | + }); | ||
| 90 | + | ||
| 91 | + }) | ||
| 92 | + }, | ||
| 93 | + deletePic(e) { | ||
| 94 | + console.log(e.index) | ||
| 95 | + this.fileList.splice(0, 1) | ||
| 96 | + } | ||
| 97 | + } | ||
| 98 | + } | ||
| 99 | +</script> | ||
| 100 | + | ||
| 101 | +<style lang="scss"> | ||
| 102 | +.add_praise{ | ||
| 103 | + .tel_index_bg{ | ||
| 104 | + position: absolute; | ||
| 105 | + top: 0; | ||
| 106 | + z-index: 1; | ||
| 107 | + width: 100%; | ||
| 108 | + min-height: 220rpx; | ||
| 109 | + background: linear-gradient(0deg, #f8f8f8 0%, #ffffff 25%, #5D9DFD 60%, #428EFE 70%, #2D81FF 100%); | ||
| 110 | + } | ||
| 111 | + .add_praise-main{ | ||
| 112 | + position: relative; | ||
| 113 | + z-index: 1; | ||
| 114 | + padding: 15rpx 25rpx; | ||
| 115 | + .add_praise-main-1{ | ||
| 116 | + border-radius: 15rpx; | ||
| 117 | + background: #fff; | ||
| 118 | + overflow: hidden; | ||
| 119 | + .add_praise-main-1-l{ | ||
| 120 | + line-height: 60rpx; | ||
| 121 | + padding: 0 30rpx; | ||
| 122 | + background: #fff9eb; | ||
| 123 | + color: #F5AC1A; | ||
| 124 | + font-size: 24rpx; | ||
| 125 | + } | ||
| 126 | + .add_praise-main-1-b{ | ||
| 127 | + padding: 0rpx 30rpx; | ||
| 128 | + .add_praise-main-1-b-u{ | ||
| 129 | + padding: 40rpx 0rpx; | ||
| 130 | + border-bottom: #EEEEEE solid 1rpx; | ||
| 131 | + } | ||
| 132 | + } | ||
| 133 | + } | ||
| 134 | + .operation{ | ||
| 135 | + border-radius: 15rpx; | ||
| 136 | + background-color: #2C82FD; | ||
| 137 | + line-height: 90rpx; | ||
| 138 | + text-align: center; | ||
| 139 | + width: 700rpx; | ||
| 140 | + color: #fff; | ||
| 141 | + z-index: 1; | ||
| 142 | + margin-top: 40rpx; | ||
| 143 | + } | ||
| 144 | + } | ||
| 145 | +} | ||
| 146 | +</style> |
page_admin/admin_praise/admin_praise.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <view class="admin_praise"> | ||
| 3 | + <view class="tel_index_bg"></view> | ||
| 4 | + <view class="admin_praise-main"> | ||
| 5 | + <public-switching :option="option" :current="current" @change="changeSwitching"></public-switching> | ||
| 6 | + <scroll-view :scroll-y="true" class="praise_andLike-list" @scrolltolower="getData"> | ||
| 7 | + <view v-if="dataList.length"> | ||
| 8 | + <praise-item :type="LIKETYPE.ADMINEND" :info="item" v-for="item in dataList" :key="item.id" @success="success"></praise-item> | ||
| 9 | + </view> | ||
| 10 | + <u-empty v-else mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png" ></u-empty> | ||
| 11 | + </scroll-view> | ||
| 12 | + </view> | ||
| 13 | + </view> | ||
| 14 | +</template> | ||
| 15 | + | ||
| 16 | +<script> | ||
| 17 | + import public_switching from "@/components/public_switching/public_switching.vue" | ||
| 18 | + import praise_item from "@/components/praise_item/praise_item.vue" | ||
| 19 | + import { PRAISEANDLIKE } from "./emit.js" | ||
| 20 | + import { LIKETYPE } from "@/emit/index.js" | ||
| 21 | + export default { | ||
| 22 | + components: { | ||
| 23 | + PublicSwitching: public_switching, | ||
| 24 | + PraiseItem: praise_item | ||
| 25 | + }, | ||
| 26 | + data() { | ||
| 27 | + return { | ||
| 28 | + LIKETYPE, | ||
| 29 | + option: [ | ||
| 30 | + { | ||
| 31 | + lable: '全部表扬', | ||
| 32 | + value: PRAISEANDLIKE.WHOLE | ||
| 33 | + }, | ||
| 34 | + { | ||
| 35 | + lable: '待审核表扬', | ||
| 36 | + value: PRAISEANDLIKE.PENDINGREVIEW | ||
| 37 | + } | ||
| 38 | + ], | ||
| 39 | + current: PRAISEANDLIKE.WHOLE, | ||
| 40 | + total: 0, | ||
| 41 | + dataList: [], | ||
| 42 | + page: 1 | ||
| 43 | + } | ||
| 44 | + }, | ||
| 45 | + onLoad() { | ||
| 46 | + this.getData() | ||
| 47 | + }, | ||
| 48 | + methods: { | ||
| 49 | + success(e) { | ||
| 50 | + this.dataList = this.dataList.filter(item => item.id !== e) | ||
| 51 | + }, | ||
| 52 | + changeSwitching(e) { | ||
| 53 | + this.current = e | ||
| 54 | + this.page = 1 | ||
| 55 | + this.total = 0 | ||
| 56 | + this.dataList = [] | ||
| 57 | + this.getData() | ||
| 58 | + }, | ||
| 59 | + getData() { | ||
| 60 | + var datas = { | ||
| 61 | + is_uncheck: this.current, | ||
| 62 | + page: this.page, | ||
| 63 | + limit: 10 | ||
| 64 | + } | ||
| 65 | + var jkurl = '/admin/praise' | ||
| 66 | + this.$service.P_post(jkurl, datas).then(res => { | ||
| 67 | + this.total = res.data.total | ||
| 68 | + if(this.dataList.length < this.total) { | ||
| 69 | + if(this.page === 1) { | ||
| 70 | + this.dataList = res.data.data | ||
| 71 | + console.log('res====>', res) | ||
| 72 | + } else { | ||
| 73 | + | ||
| 74 | + this.dataList.push(...result) | ||
| 75 | + } | ||
| 76 | + this.page++ | ||
| 77 | + } | ||
| 78 | + if(this.current === PRAISEANDLIKE.PENDINGREVIEW) { | ||
| 79 | + this.dataList = this.dataList.map(item => { | ||
| 80 | + return { | ||
| 81 | + ...item, | ||
| 82 | + showOperation: true | ||
| 83 | + } | ||
| 84 | + }) | ||
| 85 | + } | ||
| 86 | + console.log('dataList====>', this.dataList) | ||
| 87 | + }) | ||
| 88 | + } | ||
| 89 | + } | ||
| 90 | + } | ||
| 91 | +</script> | ||
| 92 | + | ||
| 93 | +<style lang="scss" scoped> | ||
| 94 | + .admin_praise{ | ||
| 95 | + .tel_index_bg{ | ||
| 96 | + position: absolute; | ||
| 97 | + top: 0; | ||
| 98 | + z-index: 1; | ||
| 99 | + width: 100%; | ||
| 100 | + min-height: 220rpx; | ||
| 101 | + background: linear-gradient(0deg, #f8f8f8 0%, #ffffff 25%, #5D9DFD 60%, #428EFE 70%, #2D81FF 100%); | ||
| 102 | + } | ||
| 103 | + .admin_praise-main{ | ||
| 104 | + position: relative; | ||
| 105 | + z-index: 1; | ||
| 106 | + padding: 0rpx 25rpx; | ||
| 107 | + .praise_andLike-list{ | ||
| 108 | + margin-top: 30rpx; | ||
| 109 | + height: calc(100vh - 152rpx); | ||
| 110 | + } | ||
| 111 | + } | ||
| 112 | + } | ||
| 113 | +</style> |
-
请 注册 或 登录 后发表评论