{"version":3,"sources":["webpack:///./src/views/UserCenter/ContactCreate.vue?3ba2","webpack:///./src/views/UserCenter/ContactCreate.vue","webpack:///src/views/UserCenter/ContactCreate.vue","webpack:///./src/views/UserCenter/ContactCreate.vue?a02a","webpack:///./src/views/UserCenter/ContactCreate.vue?158e"],"names":["render","_vm","this","_c","_self","staticClass","attrs","userInfo","nationality","on","save","staticRenderFns","name","components","Contact","data","userToken","beforeMount","$store","commit","dispatch","isHideFooter","showPage","methods","$loading","show","initPage","hide","state","user","length","getEditInfo","$router","push","encodeURIComponent","window","location","pathname","userName","success","errMsg","api","userEditInfo","console","log","getCountryArea","country","contact","isCN","$alert","chineseLastName","chineseFirstName","isChinese","pinYinLastName","pinYinFirstName","isLetter","pinyinLastName","pinyinFirstName","gender","dateOfBirth","email","checkMail","telephone","checkTel","passportNum","checkPassport","updateFields","includes","createContact","component"],"mappings":"yIAAA,W,yCCAA,IAAIA,EAAS,WAAkB,IAAIC,EAAIC,KAAKC,EAAGF,EAAIG,MAAMD,GAAG,OAAOA,EAAG,MAAM,CAACE,YAAY,iBAAiB,CAACF,EAAG,MAAM,CAACE,YAAY,yCAAyC,CAACF,EAAG,UAAU,CAACG,MAAM,CAAC,UAAyC,OAA7BL,EAAIM,SAASC,YAAuB,KAAO,MAAMC,GAAG,CAAC,UAAUR,EAAIS,SAAS,MAEpRC,EAAkB,G,gDCUtB,GACAC,KAAA,gBACAC,WAAA,CACAC,gBAEAC,OACA,OACAC,UAAA,GACAT,SAAA,KAGAU,cACA,KAAAC,OAAAC,OAAA,0BACA,KAAAD,OAAAE,SAAA,mBAAAC,cAAA,IACA,KAAAC,YAEAC,QAAA,CACA,iBACA,KAAAC,SAAAC,aACA,KAAAC,WACA,KAAAF,SAAAG,QAEA,iBACA,MAAAX,EAAA,KAAAE,OAAAU,MAAAC,KAAAb,UACAA,GAAA,GAAAA,EAAAc,QAIA,KAAAd,YACA,KAAAT,eAAA,KAAAwB,YAAA,KAAAf,YAJA,KAAAgB,QAA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QAGA,KAAAf,QAAAC,KAAA,uCAjCA,KAAAgB,OAAAxB,KAAA,YACA,IANA,KAAAwB,OAAAxB,KAAA,UACA,IANA,KAAAwB,OAAAxB,KAAA,kBACA,IAPA,KAAAwB,OAAAxB,KAAA,WACA,IANA,KAAAwB,OAAAxB,KAAA,WACA,IAuDA,oBAAAsB,GACA,KAAAvB,SAAAC,OACA,cAAAc,EAAA,KAAAxB,EAAA,OAAAyB,SAAAC,OAAAZ,KAAAuC,cAAArB,GACAR,EAGAI,QAAAC,IAAA7B,GAFA,KAAAkC,OAAAxB,KAAAe,GAIA,KAAAhB,SAAAG,UCrJqW,I,wBCQjW0C,EAAY,eACd,EACArE,EACAW,GACA,EACA,KACA,WACA,MAIa,aAAA0D,E","file":"js/chunk-3a9203c0.2f9f1e58.js","sourcesContent":["export * from \"-!../../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--6-oneOf-1-0!../../../node_modules/css-loader/dist/cjs.js??ref--6-oneOf-1-1!../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../node_modules/postcss-loader/src/index.js??ref--6-oneOf-1-2!../../../node_modules/style-resources-loader/lib/index.js??ref--6-oneOf-1-3!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ContactCreate.vue?vue&type=style&index=0&id=13d988e0&prod&scoped=true&lang=css\"","var render = function render(){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:\"page noScroll\"},[_c('div',{staticClass:\"page-content infinite-scroll noScroll\"},[_c('Contact',{attrs:{\"nationTip\":_vm.userInfo.nationality === '涓浗' ? '蹇呭~' : '閫夊~'},on:{\"on-save\":_vm.save}})],1)])\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","<template>\r\n    <div class=\"page noScroll\">\r\n        <div class=\"page-content infinite-scroll noScroll\">\r\n            <Contact :nationTip=\"userInfo.nationality === '涓浗' ? '蹇呭~' : '閫夊~'\" @on-save=\"save\"></Contact>\r\n        </div>\r\n    </div>\r\n</template>\r\n\r\n<script>\r\n    import api from '@/api'\r\n    import Contact from '@/components/Contact'\r\n    import { isChinese, isLetter, checkTel, checkMail, checkPassport } from '@/utilities/tools'\r\n    export default {\r\n        name: 'ContactCreate',\r\n        components: {\r\n            Contact\r\n        },\r\n        data () {\r\n            return {\r\n                userToken: '',\r\n                userInfo: {}\r\n            }\r\n        },\r\n        beforeMount () {\r\n            this.$store.commit('SET_PAGE_TITLE', '甯哥敤鑱旂郴浜�')\r\n            this.$store.dispatch('HIDE_HEADER_BAR', {isHideFooter: true})\r\n            this.showPage()\r\n        },\r\n        methods: {\r\n            async showPage () {\r\n                this.$loading.show()\r\n                await this.initPage()\r\n                this.$loading.hide()\r\n            },\r\n            async initPage () {\r\n                const userToken = this.$store.state.user.userToken\r\n                if (!userToken && userToken.length == 0) {\r\n                    this.$router.push(`/Orchard.Rccl.Users/Login/Login?returnUrl=${encodeURIComponent(window.location.pathname)}`)\r\n                    return\r\n                }\r\n                this.userToken = userToken\r\n                this.userInfo = await this.getEditInfo(this.userToken)\r\n            },\r\n            async getEditInfo (userName) {\r\n                const {success, data, errMsg} = await api.user.userEditInfo(userName)\r\n                if (!success) {\r\n                    console.log(errMsg)\r\n                    return null\r\n                } else {\r\n                    return data\r\n                }\r\n            },\r\n            getCountryArea(country){\r\n              return country===\"CN\" ||\r\n                  country === \"HK\" ||\r\n                  country === \"MAC\" ||\r\n                  country === \"TWN\";\r\n            },\r\n            async save (data) {\r\n                let contact = data\r\n                let isCN = this.getCountryArea(contact.country)\r\n                if (!contact.country && this.userInfo.nationality === '涓浗') {\r\n                    this.$alert.show('璇烽€夋嫨鍥藉鎴栧湴鍖�')\r\n                    return false\r\n                }\r\n                if(isCN){\r\n                  if (!contact.chineseLastName) {\r\n                    this.$alert.show('璇疯緭鍏ヤ腑鏂囧')\r\n                    return false\r\n                  }\r\n\r\n                  if (!contact.chineseFirstName) {\r\n                    this.$alert.show('璇疯緭鍏ヤ腑鏂囧悕')\r\n                    return false\r\n                  }\r\n\r\n                  if (!isChinese(contact.chineseLastName)\r\n                      || !isChinese(contact.chineseFirstName)) {\r\n                    this.$alert.show('璇疯緭鍏ユ纭殑涓枃濮撴垨涓枃鍚�')\r\n                    return false\r\n                  }\r\n                }\r\n\r\n\r\n                if (!contact.pinYinLastName) {\r\n                    this.$alert.show('璇疯緭鍏ユ嫾闊冲')\r\n                    return false\r\n                }\r\n\r\n                if (!contact.pinYinFirstName) {\r\n                    this.$alert.show('璇疯緭鍏ユ嫾闊冲悕')\r\n                    return false\r\n                }\r\n\r\n                if (!isLetter(contact.pinyinLastName)\r\n                || !isLetter(contact.pinyinFirstName)) {\r\n                    this.$alert.show('璇疯緭鍏ユ纭殑鎷奸煶濮撴垨鎷奸煶鍚�')\r\n                    return false\r\n                }\r\n\r\n                if (!contact.gender) {\r\n                    this.$alert.show('璇烽€夋嫨鎬у埆')\r\n                    return false\r\n                }\r\n\r\n                if (!contact.dateOfBirth) {\r\n                    this.$alert.show('璇疯緭鍏ュ嚭鐢熸棩鏈�')\r\n                    return false\r\n                }\r\n\r\n                if (contact.email && contact.email.length > 0\r\n                && !checkMail(contact.email)) {\r\n                    this.$alert.show('璇疯緭鍏ユ纭殑閭');\r\n                    return false;\r\n                }\r\n\r\n                if (contact.telephone && contact.telephone.length > 0\r\n                && !checkTel(contact.telephone)) {\r\n                    this.$alert.show('璇疯緭鍏ユ纭殑鎵嬫満鍙风爜');\r\n                    return false;\r\n                }\r\n\r\n                if (contact.passportNum && contact.passportNum.length > 0\r\n                && !checkPassport(contact.passportNum)) {\r\n                    this.$alert.show('璇疯緭鍏ユ纭殑鎶ょ収鍙�');\r\n                    return false;\r\n                }\r\n\r\n                if(contact.updateFields.includes(\"ChineseFirstName\") && !contact.updateFields.includes(\"PinYinFirstName\")) {\r\n                  contact.updateFields.push(\"PinYinFirstName\")\r\n                }\r\n\r\n                if(!contact.updateFields.includes(\"ChineseLastName\") || !contact.updateFields.includes(\"PinYinLastName\")) {\r\n                  contact.updateFields.push(\"PinYinLastName\")\r\n                }\r\n                // 鎻愪氦淇℃伅\r\n                await this.createContact(contact)\r\n\r\n                // 杩斿洖鍒楄〃椤礬r\n                this.$router.push('/Rccl.UserCenter/UserContact/List')\r\n            },\r\n            async createContact (contact) {\r\n                this.$loading.show()\r\n                const {success, data, errMsg} = await api.user.createContact(contact)\r\n                if (!success) {\r\n                    this.$alert.show(errMsg)\r\n                } else {\r\n                    console.log(data)\r\n                }\r\n                this.$loading.hide()\r\n            }\r\n        }\r\n    }\r\n</script>\r\n\r\n<style scoped>\r\n    .page {\r\n        display: block;\r\n        background: #F6F7F8 !important;\r\n    }\r\n    .page-content{\r\n        padding-bottom: 100px;\r\n    }\r\n</style>\r\n","import mod from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ContactCreate.vue?vue&type=script&lang=js\"; export default mod; export * from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ContactCreate.vue?vue&type=script&lang=js\"","import { render, staticRenderFns } from \"./ContactCreate.vue?vue&type=template&id=13d988e0&scoped=true\"\nimport script from \"./ContactCreate.vue?vue&type=script&lang=js\"\nexport * from \"./ContactCreate.vue?vue&type=script&lang=js\"\nimport style0 from \"./ContactCreate.vue?vue&type=style&index=0&id=13d988e0&prod&scoped=true&lang=css\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n  script,\n  render,\n  staticRenderFns,\n  false,\n  null,\n  \"13d988e0\",\n  null\n  \n)\n\nexport default component.exports"],"sourceRoot":""}