1 |
- {"version":3,"sources":["uni-app:///main.js","webpack:////Users/yangxiaohai/Desktop/boyuan/iot-test-app/pages/upload-face/upload-face.vue?6b0f","webpack:////Users/yangxiaohai/Desktop/boyuan/iot-test-app/pages/upload-face/upload-face.vue?009b","webpack:////Users/yangxiaohai/Desktop/boyuan/iot-test-app/pages/upload-face/upload-face.vue?fb83","webpack:////Users/yangxiaohai/Desktop/boyuan/iot-test-app/pages/upload-face/upload-face.vue?86ae","uni-app:///pages/upload-face/upload-face.vue","webpack:////Users/yangxiaohai/Desktop/boyuan/iot-test-app/pages/upload-face/upload-face.vue?a9e9"],"names":["wx","__webpack_require_UNI_MP_PLUGIN__","__webpack_require__","createPage","Page","renderjs","component","options","__file","components","uIcon","uButton","uToast","e","message","indexOf","console","error","render","_vm","this","_h","$createElement","_self","_c","recyclableRender","staticRenderFns","_withStripped","data","bgColor","pic","msg","userId","facePic","methods","takePhoto","uni","count","sizeType","sourceType","success","urlTobase64","filePath","encoding","url","that","mask","title","result","type","icon","fail","getFacePic","res","deleteFace","duration","onLoad"],"mappings":"wJAAA,MAGA,aACA,YAFAA,EAAGC,kCAAoCC,EAGvCC,EAAWC,a,gFCLX,oIACIC,EADJ,QASIC,EAAY,qBACd,aACA,YACA,sBACA,EACA,KACA,KACA,MACA,EACA,gBACAD,GAGFC,EAAUC,QAAQC,OAAS,oCACZ,aAAAF,E,0CCvBf,uQ,iCCAA,IAAIG,EAAJ,0LACA,IACEA,EAAa,CACXC,MAAO,WACL,OAAO,iHAITC,QAAS,WACP,OAAO,qHAITC,OAAQ,WACN,OAAO,gFAKX,MAAOC,GACP,IAC+C,IAA7CA,EAAEC,QAAQC,QAAQ,wBACa,IAA/BF,EAAEC,QAAQC,QAAQ,QAWlB,MAAMF,EATNG,QAAQC,MAAMJ,EAAEC,SAChBE,QAAQC,MAAM,mBACdD,QAAQC,MACN,uFAEFD,QAAQC,MACN,mDAMN,IAAIC,EAAS,WACX,IAAIC,EAAMC,KACNC,EAAKF,EAAIG,eACJH,EAAII,MAAMC,IAEjBC,GAAmB,EACnBC,EAAkB,GACtBR,EAAOS,eAAgB,G,iCC3CvB,yHAAy1B,eAAG,G,uJCe51B,CACAC,gBACA,OAEAC,kBACAC,OACAC,KACAC,kCACAC,cAIAC,SAEAC,qBAAA,WACAC,eACAC,QACAC,wBACAC,8BACAC,oBACA,sBACAxB,kBACA,wBAKAyB,wBAAA,WACAzB,qBACA,WACAoB,mCACAM,WACAC,kBACAH,mBAAA,oIAOA,OANAI,kCACAA,kBACAC,gBACAT,eACAU,QACAC,gBACA,SAGAX,6CAAA,gBADAY,SAEAZ,gBACApB,kBACA,aACA,qBACA6B,mCAIA,qBACAI,aACAC,QACAH,aACAjC,gBAGA,4CAGA,sDA7BA0B,GA8BAW,iBAAA,4BAIAC,sBAAA,4IAKA,OAJAhB,eACAU,QACAC,aACAG,cACA,SAGAd,+DAAA,gBADAiB,SAEArC,eACAoB,gBACA,aACA,sCACApB,oBAEA,0BACA,0CAhBA,IAoBAsC,sBAAA,4JAGAlB,+DAAA,gBADAY,SAEAhC,0BACA,cACAoB,aACAmB,cACAR,aACAG,cAEA,UAEAd,mBACA,0CAdA,KAmBAoB,kBACA,oBAEA,c,6DC5HA,yHAAwjD,eAAG,G","file":"pages/upload-face/upload-face.js","sourcesContent":["import 'uni-pages';\n// @ts-ignore\nwx.__webpack_require_UNI_MP_PLUGIN__ = __webpack_require__;\nimport Vue from 'vue'\nimport Page from './pages/upload-face/upload-face.vue'\ncreatePage(Page)","import { render, staticRenderFns, recyclableRender, components } from \"./upload-face.vue?vue&type=template&id=28b58c5a&\"\nvar renderjs\nimport script from \"./upload-face.vue?vue&type=script&lang=js&\"\nexport * from \"./upload-face.vue?vue&type=script&lang=js&\"\nimport style0 from \"./upload-face.vue?vue&type=style&index=0&lang=scss&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null,\n false,\n components,\n renderjs\n)\n\ncomponent.options.__file = \"pages/upload-face/upload-face.vue\"\nexport default component.exports","export * from \"-!../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--17-0!../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/template.js!../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-uni-app-loader/page-meta.js!../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js??vue-loader-options!../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./upload-face.vue?vue&type=template&id=28b58c5a&\"","var components\ntry {\n components = {\n uIcon: function () {\n return import(\n /* webpackChunkName: \"uni_modules/uview-ui/components/u-icon/u-icon\" */ \"@/uni_modules/uview-ui/components/u-icon/u-icon.vue\"\n )\n },\n uButton: function () {\n return import(\n /* webpackChunkName: \"uni_modules/uview-ui/components/u-button/u-button\" */ \"@/uni_modules/uview-ui/components/u-button/u-button.vue\"\n )\n },\n uToast: function () {\n return import(\n /* webpackChunkName: \"uni_modules/uview-ui/components/u-toast/u-toast\" */ \"@/uni_modules/uview-ui/components/u-toast/u-toast.vue\"\n )\n },\n }\n} catch (e) {\n if (\n e.message.indexOf(\"Cannot find module\") !== -1 &&\n e.message.indexOf(\".vue\") !== -1\n ) {\n console.error(e.message)\n console.error(\"1. 排查组件名称拼写是否正确\")\n console.error(\n \"2. 排查组件是否符合 easycom 规范,文档:https://uniapp.dcloud.net.cn/collocation/pages?id=easycom\"\n )\n console.error(\n \"3. 若组件不符合 easycom 规范,需手动引入,并在 components 中注册该组件\"\n )\n } else {\n throw e\n }\n}\nvar render = function () {\n var _vm = this\n var _h = _vm.$createElement\n var _c = _vm._self._c || _h\n}\nvar recyclableRender = false\nvar staticRenderFns = []\nrender._withStripped = true\n\nexport { render, staticRenderFns, recyclableRender, components }","import mod from \"-!../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/babel-loader/lib/index.js!../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--13-1!../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/script.js!../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js??vue-loader-options!../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./upload-face.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/babel-loader/lib/index.js!../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--13-1!../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/script.js!../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js??vue-loader-options!../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./upload-face.vue?vue&type=script&lang=js&\"","<template>\n\t<view class=\"\">\n\n\t\t<view class=\"pic\" @click=\"takePhoto\">\n\t\t\t<u-icon v-if=\"!pic\" class=\"icon\" name=\"plus\" color=\"#2979ff\" size=\"50\"></u-icon>\n\t\t\t<img v-else :src=\"pic\" alt=\"\">\n\t\t</view>\n\t\t<view class=\"upload\" style=\"width: 100%;\">\n\t\t\t<u-button color=\"red\" @click=\"deleteFace\" type=\"primary\" size=\"large\" text=\"删除人脸\"></u-button>\n\t\t</view>\n\t\t<u-toast ref=\"uToast\"></u-toast>\n\t</view>\n</template>\n\n<script>\n\texport default {\n\t\tdata() {\n\t\t\treturn {\n\n\t\t\t\tbgColor: '#3c9cff',\n\t\t\t\tpic: '',\n\t\t\t\tmsg: {\n\t\t\t\t\tuserId: uni.getStorageSync('userId'),\n\t\t\t\t\tfacePic: \"\"\n\t\t\t\t},\n\t\t\t}\n\t\t},\n\t\tmethods: {\n\n\t\t\ttakePhoto() {\n\t\t\t\tuni.chooseImage({\n\t\t\t\t\tcount: 1, //选择图片的数量,默认9\n\t\t\t\t\tsizeType: ['compressed'], //原图、压缩图或者两者都有,可以指定原图或压缩图,默认两者都有\n\t\t\t\t\tsourceType: ['album', 'camera'], //从相册选择\n\t\t\t\t\tsuccess: res => {\n\t\t\t\t\t\tconst tempFilePaths = res.tempFilePaths; // 返回选定照片的本地文件路径列表\n\t\t\t\t\t\tconsole.log(tempFilePaths[0]);\n\t\t\t\t\t\tthis.urlTobase64(tempFilePaths[0])\n\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t},\n\t\t\turlTobase64(url) {\n\t\t\t\tconsole.log('url', url);\n\t\t\t\tlet that = this\n\t\t\t\tuni.getFileSystemManager().readFile({\n\t\t\t\t\tfilePath: url, //照片的临时地址\n\t\t\t\t\tencoding: \"base64\", //编码格式\n\t\t\t\t\tsuccess: async (res) => {\n\t\t\t\t\t\tlet url = \"data:image/jpg\" + \";base64,\" + res.data //base64地址\n\t\t\t\t\t\turl = url.split(',')[1]\n\t\t\t\t\t\tthat.msg.facePic = url\n\t\t\t\t\t\tuni.showLoading({\n\t\t\t\t\t\t\tmask: true,\n\t\t\t\t\t\t\ttitle: '图片上传中'\n\t\t\t\t\t\t})\n\t\t\t\t\t\tconst {\n\t\t\t\t\t\t\tdata: result\n\t\t\t\t\t\t} = await uni.$http.post('/api/v1/test/user/face', that.msg)\n\t\t\t\t\t\tuni.hideLoading()\n\t\t\t\t\t\tconsole.log(11, result);\n\t\t\t\t\t\tif (result.code == 200) {\n\t\t\t\t\t\t\tthis.$u.toast(`人脸上传成功`)\n\t\t\t\t\t\t\tthat.pic = 'data:image/jpeg;base64,' + url\n\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// this.$u.toast(result.msg)\n\t\t\t\t\t\t\tthis.$refs.uToast.show({\n\t\t\t\t\t\t\t\ttype: 'error',\n\t\t\t\t\t\t\t\ticon: false,\n\t\t\t\t\t\t\t\ttitle: '失败主题',\n\t\t\t\t\t\t\t\tmessage: result.msg\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\n\n\t\t\t\t\t},\n\t\t\t\t\tfail: (res) => reject(res.errMsg),\n\t\t\t\t})\n\n\t\t\t},\n\t\t\tasync getFacePic() {\n\t\t\t\tuni.showLoading({\n\t\t\t\t\tmask: true,\n\t\t\t\t\ttitle: '正在加载',\n\t\t\t\t\ticon: \"none\"\n\t\t\t\t})\n\t\t\t\tlet {\n\t\t\t\t\tdata: res\n\t\t\t\t} = await uni.$http.get(`/api/v1/test/user/facePic/${this.msg.userId}`)\n\t\t\t\tconsole.log(res);\n\t\t\t\tuni.hideLoading()\n\t\t\t\tif (res.code == 200) {\n\t\t\t\t\tthis.pic = 'data:image/jpg;base64,' + res.data\n\t\t\t\t\tconsole.log(this.pic);\n\t\t\t\t} else {\n\t\t\t\t\tthis.$u.toast(`人脸未上传,请上传照片`)\n\t\t\t\t}\n\n\t\t\t},\n\n\t\t\tasync deleteFace() {\n\t\t\t\tconst {\n\t\t\t\t\tdata: result\n\t\t\t\t} = await uni.$http.delete(`/api/v1/test/user/face/${this.msg.userId}`)\n\t\t\t\tconsole.log(this.msg.userId);\n\t\t\t\tif (result.code === 200) {\n\t\t\t\t\tuni.showToast({\n\t\t\t\t\t\tduration: 1500,\n\t\t\t\t\t\ttitle: result.data,\n\t\t\t\t\t\ticon: 'none'\n\t\t\t\t\t})\n\t\t\t\t\tthis.pic = ''\n\t\t\t\t} else {\n\t\t\t\t\tuni.$showMsg('删除失败')\n\t\t\t\t}\n\n\n\t\t\t}\n\t\t},\n\t\tonLoad() {\n\t\t\tthis.getFacePic()\n\t\t}\n\t}\n</script>\n<style lang=\"scss\">\n\t.camera {\n\n\t\tdisplay: flex;\n\t\tjustify-content: center;\n\t\talign-items: center;\n\t\tmargin-top: 20px;\n\t}\n\n\t.pic {\n\t\tmargin: 100px auto;\n\t\tborder: 1px solid #3c9cff;\n\t\twidth: 500rpx;\n\t\theight: 300px;\n\t\tdisplay: flex;\n\t\tjustify-content: center;\n\t\talign-items: center;\n\n\t\t.icon {}\n\n\t\timg {\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n\t\t}\n\t}\n\n\t.upload {\n\t\tdisplay: inline-block;\n\t\tposition: fixed;\n\t\tbottom: 0;\n\t}\n</style>","import mod from \"-!../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/mini-css-extract-plugin/dist/loader.js??ref--8-oneOf-1-0!../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/loaders/stylePostLoader.js!../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--8-oneOf-1-2!../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/postcss-loader/src/index.js??ref--8-oneOf-1-3!../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/sass-loader/dist/cjs.js??ref--8-oneOf-1-4!../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--8-oneOf-1-5!../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js??vue-loader-options!../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./upload-face.vue?vue&type=style&index=0&lang=scss&\"; export default mod; export * from \"-!../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/mini-css-extract-plugin/dist/loader.js??ref--8-oneOf-1-0!../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/loaders/stylePostLoader.js!../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--8-oneOf-1-2!../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/postcss-loader/src/index.js??ref--8-oneOf-1-3!../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/sass-loader/dist/cjs.js??ref--8-oneOf-1-4!../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader/index.js??ref--8-oneOf-1-5!../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/index.js??vue-loader-options!../../../../../../../Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./upload-face.vue?vue&type=style&index=0&lang=scss&\""],"sourceRoot":""}
|