acdr-ui/dist/dev/mp-weixin/modules/mall/user/info.js.map

1 line
16 KiB
Plaintext

{"version":3,"file":"info.js","sources":["../../../../../../src/modules/mall/user/info.vue","../../../../../../uniPage:/bW9kdWxlc1xtYWxsXHVzZXJcaW5mby52dWU"],"sourcesContent":["<!-- 用户信息 -->\r\n<template>\r\n <s-layout title=\"用户信息\" class=\"set-userinfo-wrap\">\r\n <uni-forms\r\n :model=\"state.model\"\r\n :rules=\"state.rules\"\r\n labelPosition=\"left\"\r\n border\r\n class=\"form-box\"\r\n >\r\n <!-- 头像 -->\r\n <view class=\"ss-flex ss-row-center ss-col-center ss-p-t-60 ss-p-b-0 bg-white\">\r\n <view class=\"header-box-content\">\r\n <su-image\r\n class=\"content-img\"\r\n isPreview\r\n :current=\"0\"\r\n :src=\"state.model?.avatar\"\r\n :height=\"160\"\r\n :width=\"160\"\r\n :radius=\"80\"\r\n mode=\"scaleToFill\"\r\n />\r\n <view class=\"avatar-action\">\r\n <!-- #ifdef MP -->\r\n <button\r\n class=\"ss-reset-button avatar-action-btn\"\r\n open-type=\"chooseAvatar\"\r\n @chooseavatar=\"onChooseAvatar\"\r\n >\r\n 修改\r\n </button>\r\n <!-- #endif -->\r\n <!-- #ifndef MP -->\r\n <button class=\"ss-reset-button avatar-action-btn\" @tap=\"onChangeAvatar\">修改</button>\r\n <!-- #endif -->\r\n </view>\r\n </view>\r\n </view>\r\n\r\n <view class=\"bg-white ss-p-x-30\">\r\n <!-- 昵称 + 性别 -->\r\n <uni-forms-item name=\"nickname\" label=\"昵称\">\r\n <uni-easyinput\r\n v-model=\"state.model.nickname\"\r\n type=\"nickname\"\r\n placeholder=\"设置昵称\"\r\n :inputBorder=\"false\"\r\n :placeholderStyle=\"placeholderStyle\"\r\n />\r\n </uni-forms-item>\r\n <uni-forms-item name=\"sex\" label=\"性别\">\r\n <view class=\"ss-flex ss-col-center ss-h-100\">\r\n <radio-group @change=\"onChangeGender\" class=\"ss-flex ss-col-center\">\r\n <label class=\"radio\" v-for=\"item in sexRadioMap\" :key=\"item.value\">\r\n <view class=\"ss-flex ss-col-center ss-m-r-32\">\r\n <radio\r\n :value=\"item.value\"\r\n color=\"var(--ui-BG-Main)\"\r\n style=\"transform: scale(0.8)\"\r\n :checked=\"parseInt(item.value) === state.model?.sex\"\r\n />\r\n <view class=\"gender-name\">{{ item.name }}</view>\r\n </view>\r\n </label>\r\n </radio-group>\r\n </view>\r\n </uni-forms-item>\r\n\r\n <uni-forms-item name=\"mobile\" label=\"手机号\" @tap=\"onChangeMobile\">\r\n <uni-easyinput\r\n v-model=\"userInfo.mobile\"\r\n placeholder=\"请绑定手机号\"\r\n :inputBorder=\"false\"\r\n disabled\r\n :styles=\"{ disableColor: '#fff' }\"\r\n :placeholderStyle=\"placeholderStyle\"\r\n :clearable=\"false\"\r\n >\r\n <template v-slot:right>\r\n <view class=\"ss-flex ss-col-center\">\r\n <su-radio v-if=\"userInfo.verification?.mobile\" :modelValue=\"true\" />\r\n <button v-else class=\"ss-reset-button ss-flex ss-col-center ss-row-center\">\r\n <text class=\"_icon-forward\" style=\"font-size: 26rpx; color: #bbbbbb\"></text>\r\n </button>\r\n </view>\r\n </template>\r\n </uni-easyinput>\r\n </uni-forms-item>\r\n\r\n <uni-forms-item name=\"password\" label=\"登录密码\" @tap=\"onSetPassword\">\r\n <uni-easyinput\r\n v-model=\"userInfo.password\"\r\n placeholder=\"点击修改登录密码\"\r\n :inputBorder=\"false\"\r\n :styles=\"{ disableColor: '#fff' }\"\r\n disabled\r\n placeholderStyle=\"color:#BBBBBB;font-size:28rpx;line-height:normal\"\r\n :clearable=\"false\"\r\n >\r\n <template v-slot:right>\r\n <view class=\"ss-flex ss-col-center\">\r\n <su-radio\r\n class=\"ss-flex\"\r\n v-if=\"userInfo.verification?.password\"\r\n :modelValue=\"true\"\r\n />\r\n <button v-else class=\"ss-reset-button ss-flex ss-col-center ss-row-center\">\r\n <text class=\"_icon-forward\" style=\"font-size: 26rpx; color: #bbbbbb\" />\r\n </button>\r\n </view>\r\n </template>\r\n </uni-easyinput>\r\n </uni-forms-item>\r\n </view>\r\n\r\n <view class=\"bg-white ss-m-t-14\">\r\n <uni-list>\r\n <uni-list-item\r\n clickable\r\n @tap=\"sheep.$router.go('/modules/mall/user/address/list')\"\r\n title=\"地址管理\"\r\n showArrow\r\n :border=\"false\"\r\n class=\"list-border\"\r\n />\r\n </uni-list>\r\n </view>\r\n </uni-forms>\r\n\r\n <!-- 当前社交平台的绑定关系,只处理 wechat 微信场景 -->\r\n <view v-if=\"sheep.$platform.name !== 'H5'\">\r\n <view class=\"title-box ss-p-l-30\">第三方账号绑定</view>\r\n <view class=\"account-list ss-flex ss-row-between\">\r\n <view v-if=\"'WechatOfficialAccount' === sheep.$platform.name\" class=\"ss-flex ss-col-center\">\r\n <image\r\n class=\"list-img\"\r\n :src=\"sheep.$url.static('/static/img/shop/platform/WechatOfficialAccount.png')\"\r\n />\r\n <text class=\"list-name\">微信公众号</text>\r\n </view>\r\n <view v-if=\"'WechatMiniProgram' === sheep.$platform.name\" class=\"ss-flex ss-col-center\">\r\n <image\r\n class=\"list-img\"\r\n :src=\"sheep.$url.static('/static/img/shop/platform/WechatMiniProgram.png')\"\r\n />\r\n <text class=\"list-name\">微信小程序</text>\r\n </view>\r\n <view v-if=\"'App' === sheep.$platform.name\" class=\"ss-flex ss-col-center\">\r\n <image\r\n class=\"list-img\"\r\n :src=\"sheep.$url.static('/static/img/shop/platform/wechat.png')\"\r\n />\r\n <text class=\"list-name\">微信开放平台</text>\r\n </view>\r\n <view class=\"ss-flex ss-col-center\">\r\n <view class=\"info ss-flex ss-col-center\" v-if=\"state.thirdInfo\">\r\n <image class=\"avatar ss-m-r-20\" :src=\"sheep.$url.cdn(state.thirdInfo.avatar)\" />\r\n <text class=\"name\">{{ state.thirdInfo.nickname }}</text>\r\n </view>\r\n <view class=\"bind-box ss-m-l-20\">\r\n <button\r\n v-if=\"state.thirdInfo.openid\"\r\n class=\"ss-reset-button relieve-btn\"\r\n @tap=\"unBindThirdOauth\"\r\n >\r\n 解绑\r\n </button>\r\n <button v-else class=\"ss-reset-button bind-btn\" @tap=\"bindThirdOauth\">绑定</button>\r\n </view>\r\n </view>\r\n </view>\r\n </view>\r\n\r\n <su-fixed bottom placeholder bg=\"none\">\r\n <view class=\"footer-box ss-p-20\">\r\n <button class=\"ss-rest-button logout-btn ui-Shadow-Main\" @tap=\"onSubmit\">保存</button>\r\n </view>\r\n </su-fixed>\r\n </s-layout>\r\n</template>\r\n\r\n<script setup>\r\nimport { computed, reactive, onBeforeMount } from 'vue'\r\nimport sheep from '@/sheep'\r\nimport { clone } from 'lodash-es'\r\nimport { showAuthModal } from '@/sheep/hooks/useModal'\r\nimport FileApi from '@/sheep/api/infra/file'\r\nimport UserApi from '@/sheep/api/member/user'\r\n\r\nconst state = reactive({\r\n model: {}, // 个人信息\r\n rules: {},\r\n thirdInfo: {}, // 社交用户的信息\r\n})\r\n\r\nconst placeholderStyle = 'color:#BBBBBB;font-size:28rpx;line-height:normal'\r\n\r\nconst sexRadioMap = [\r\n {\r\n name: '男',\r\n value: '1',\r\n },\r\n {\r\n name: '女',\r\n value: '2',\r\n },\r\n]\r\n\r\nconst userInfo = computed(() => sheep.$store('user').userInfo)\r\n\r\n// 选择性别\r\nfunction onChangeGender(e) {\r\n state.model.sex = e.detail.value\r\n}\r\n\r\n// 修改手机号\r\nconst onChangeMobile = () => {\r\n showAuthModal('changeMobile')\r\n}\r\n\r\n// 选择微信的头像,进行上传\r\nfunction onChooseAvatar(e) {\r\n const tempUrl = e.detail.avatarUrl || ''\r\n uploadAvatar(tempUrl)\r\n}\r\n\r\n// 手动选择头像,进行上传\r\nfunction onChangeAvatar() {\r\n uni.chooseImage({\r\n success: async (chooseImageRes) => {\r\n const tempUrl = chooseImageRes.tempFilePaths[0]\r\n await uploadAvatar(tempUrl)\r\n },\r\n })\r\n}\r\n\r\n// 上传头像文件\r\nasync function uploadAvatar(tempUrl) {\r\n if (!tempUrl) {\r\n return\r\n }\r\n const { data } = await FileApi.uploadFile(tempUrl)\r\n state.model.avatar = data\r\n}\r\n\r\n// 修改密码\r\nfunction onSetPassword() {\r\n showAuthModal('changePassword')\r\n}\r\n\r\n// 绑定第三方账号\r\nasync function bindThirdOauth() {\r\n const result = await sheep.$platform.useProvider('wechat').bind()\r\n if (result) {\r\n await getUserInfo()\r\n }\r\n}\r\n\r\n// 解绑第三方账号\r\nfunction unBindThirdOauth() {\r\n uni.showModal({\r\n title: '解绑提醒',\r\n content: '解绑后您将无法通过微信登录此账号',\r\n cancelText: '再想想',\r\n confirmText: '确定',\r\n success: async function (res) {\r\n if (!res.confirm) {\r\n return\r\n }\r\n const result = await sheep.$platform.useProvider('wechat').unbind(state.thirdInfo.openid)\r\n if (result) {\r\n await getUserInfo()\r\n }\r\n },\r\n })\r\n}\r\n\r\n// 保存信息\r\nasync function onSubmit() {\r\n const { code } = await UserApi.updateUser({\r\n avatar: state.model.avatar,\r\n nickname: state.model.nickname,\r\n sex: state.model.sex,\r\n })\r\n if (code === 0) {\r\n await getUserInfo()\r\n }\r\n}\r\n\r\n// 获得用户信息\r\nconst getUserInfo = async () => {\r\n // 个人信息\r\n const userInfo = await sheep.$store('user').getInfo()\r\n state.model = clone(userInfo)\r\n\r\n // 获得社交用户的信息\r\n if (sheep.$platform.name !== 'H5') {\r\n const result = await sheep.$platform.useProvider('wechat').getInfo()\r\n state.thirdInfo = result || {}\r\n }\r\n}\r\n\r\nonBeforeMount(() => {\r\n getUserInfo()\r\n})\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n \r\n:deep() {\r\n .uni-file-picker {\r\n border-radius: 50%;\r\n }\r\n\r\n .uni-file-picker__container {\r\n margin: -14rpx -12rpx;\r\n }\r\n\r\n .file-picker__progress {\r\n height: 0 !important;\r\n }\r\n\r\n .uni-list-item__content-title {\r\n font-size: 28rpx !important;\r\n line-height: normal !important;\r\n color: #333333 !important;\r\n }\r\n\r\n .uni-icons {\r\n font-size: 40rpx !important;\r\n }\r\n\r\n .is-disabled {\r\n color: #333333;\r\n }\r\n}\r\n\r\n:deep(.disabled) {\r\n opacity: 1;\r\n}\r\n\r\n.gender-name {\r\n font-size: 28rpx;\r\n font-weight: 500;\r\n line-height: normal;\r\n color: #333333;\r\n}\r\n\r\n.title-box {\r\n font-size: 28rpx;\r\n font-weight: 500;\r\n line-height: 100rpx;\r\n color: #666666;\r\n}\r\n\r\n.logout-btn {\r\n width: 710rpx;\r\n height: 80rpx;\r\n font-size: 30rpx;\r\n font-weight: 500;\r\n color: $white;\r\n background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));\r\n border-radius: 40rpx;\r\n}\r\n\r\n.radio-dark {\r\n filter: grayscale(100%);\r\n filter: gray;\r\n opacity: 0.4;\r\n}\r\n\r\n.content-img {\r\n border-radius: 50%;\r\n}\r\n.header-box-content {\r\n position: relative;\r\n width: 160rpx;\r\n height: 160rpx;\r\n overflow: hidden;\r\n border-radius: 50%;\r\n}\r\n.avatar-action {\r\n position: absolute;\r\n bottom: 0;\r\n left: 50%;\r\n z-index: 1;\r\n width: 160rpx;\r\n height: 46rpx;\r\n background: rgba(#000000, 0.3);\r\n transform: translateX(-50%);\r\n\r\n .avatar-action-btn {\r\n width: 160rpx;\r\n height: 46rpx;\r\n font-size: 24rpx;\r\n font-weight: 500;\r\n color: #ffffff;\r\n }\r\n}\r\n\r\n// 绑定项\r\n.account-list {\r\n height: 100rpx;\r\n padding: 0 20rpx;\r\n background-color: $white;\r\n\r\n .list-img {\r\n width: 40rpx;\r\n height: 40rpx;\r\n margin-right: 10rpx;\r\n }\r\n\r\n .list-name {\r\n font-size: 28rpx;\r\n color: #333333;\r\n }\r\n\r\n .info {\r\n .avatar {\r\n width: 38rpx;\r\n height: 38rpx;\r\n overflow: hidden;\r\n border-radius: 50%;\r\n }\r\n\r\n .name {\r\n font-size: 28rpx;\r\n font-weight: 400;\r\n color: $dark-9;\r\n }\r\n }\r\n\r\n .bind-box {\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n width: 100rpx;\r\n height: 50rpx;\r\n font-size: 24rpx;\r\n line-height: normal;\r\n\r\n .bind-btn {\r\n width: 100%;\r\n height: 100%;\r\n color: #999999;\r\n background: #f4f4f4;\r\n border-radius: 25rpx;\r\n }\r\n .relieve-btn {\r\n width: 100%;\r\n height: 100%;\r\n color: var(--ui-BG-Main);\r\n background: var(--ui-BG-Main-opacity-1);\r\n border-radius: 25rpx;\r\n }\r\n }\r\n}\r\n\r\n.list-border {\r\n font-size: 28rpx;\r\n font-weight: 400;\r\n color: #333333;\r\n border-bottom: 2rpx solid #eeeeee;\r\n}\r\n\r\nimage {\r\n width: 100%;\r\n height: 100%;\r\n}\r\n</style>\r\n","import MiniProgramPage from 'D:/App/Work/addr/acdr-ui/src/modules/mall/user/info.vue'\nwx.createPage(MiniProgramPage)"],"names":["reactive","computed","sheep","showAuthModal","FileApi","uni","UserApi","userInfo","clone","onBeforeMount"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8LA,UAAA,QAAAA,cAAAA,SAAA;AAAA,MACA,OAAA,CAAA;AAAA;AAAA,MACA,OAAA,CAAA;AAAA,MACA,WAAA,CAAA;AAAA;AAAA,IACA,CAAA;AAIA,UAAA,cAAA;AAAA,MACA;AAAA,QACA,MAAA;AAAA,QACA,OAAA;AAAA,MACA;AAAA,MACA;AAAA,QACA,MAAA;AAAA,QACA,OAAA;AAAA,MACA;AAAA,IACA;AAEA,UAAA,WAAAC,cAAA,SAAA,MAAAC,YAAAA,MAAA,OAAA,MAAA,EAAA,QAAA;AAGA,aAAA,eAAA,GAAA;AACA,YAAA,MAAA,MAAA,EAAA,OAAA;AAAA,IACA;AAGA,UAAA,iBAAA,MAAA;AACAC,2BAAAA,cAAA,cAAA;AAAA,IACA;AAGA,aAAA,eAAA,GAAA;AACA,YAAA,UAAA,EAAA,OAAA,aAAA;AACA,mBAAA,OAAA;AAAA,IAC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