You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
204 lines
7.0 KiB
204 lines
7.0 KiB
"use strict"; |
|
const common_vendor = require("../../common/vendor.js"); |
|
const config_host = require("../../config/host.js"); |
|
const utils_functions = require("../../utils/functions.js"); |
|
const utils_log = require("../../utils/log.js"); |
|
const api_user = require("../../api/user.js"); |
|
const config_UserCache = require("../../config/UserCache.js"); |
|
require("../../utils/qqmap-wx-jssdk.min.js"); |
|
require("../../api/other.js"); |
|
require("../../utils/request.js"); |
|
const HeaderNav = () => "../../components/HeaderNav/Index.js"; |
|
const _sfc_main = { |
|
components: { |
|
HeaderNav |
|
}, |
|
data: { |
|
sexChecked: 0, |
|
sexTitle: "", |
|
birthday: "", |
|
show: false, |
|
sexShow: false, |
|
sexs: [[{ title: "男", value: 1 }, { title: "女", value: 2 }]], |
|
staticImage: { |
|
wallpaperBgImage: config_host.imghost + "/static/image/background.png" |
|
}, |
|
user: { |
|
avatar: config_host.imghost + "/static/image/banner.png", |
|
name: "清晨的风", |
|
background_image: config_host.imghost + "/static/image/banner.png", |
|
sex: 1, |
|
phone: "15012345678", |
|
coupons: 221, |
|
id: 88685, |
|
birthday: "2002-05-11" |
|
}, |
|
writeWaitTime: 1e3, |
|
writeHandler: null, |
|
background: [] |
|
}, |
|
onLoad() { |
|
this.setSexTitle(); |
|
this.getUserDetail(); |
|
}, |
|
watch: { |
|
user: { |
|
handler(value) { |
|
this.writeHandler && clearTimeout(this.writeHandler); |
|
this.writeHandler = setTimeout(() => { |
|
this.submit(); |
|
}, this.writeWaitTime); |
|
}, |
|
deep: true |
|
} |
|
}, |
|
methods: { |
|
getUserDetail() { |
|
api_user.userDetail().then(({ data }) => { |
|
this.user = data; |
|
this.birthday = this.user.birthday ? this.user.birthday : "2000-01-01"; |
|
this.background = [{ url: this.user.background_image }]; |
|
this.user.birthday = this.birthday; |
|
this.user.sex = this.user.sex === 1 ? 1 : 2; |
|
this.setSexTitle(this.user.sex); |
|
}); |
|
}, |
|
sexConfirm(v) { |
|
utils_log.log(v); |
|
this.user.sex = v.value[0].value; |
|
this.setSexTitle(v.value[0].value); |
|
}, |
|
birthdayConfirm(v) { |
|
this.birthday = common_vendor.index.$u.timeFormat(v.value, "yyyy-mm-dd"); |
|
}, |
|
submit() { |
|
if (this.user.birthday) { |
|
this.user.birthday = common_vendor.index.$u.timeFormat(this.user.birthday, "yyyy-mm-dd"); |
|
} |
|
api_user.updateUserDetail(this.user).then((data) => { |
|
config_UserCache.UserCache.set(data.data); |
|
}); |
|
}, |
|
setSexTitle(v) { |
|
utils_log.log(v); |
|
this.sexTitle = [0, "男", "女"][v ? v : this.user.sex]; |
|
utils_log.log(this.sexTitle); |
|
}, |
|
chooseAvatar(v) { |
|
utils_functions.api.uploadOssFile(v.detail.avatarUrl).then((res) => { |
|
this.user.avatar = res.show_path; |
|
}); |
|
}, |
|
backgroundRead(file, lists, name) { |
|
utils_functions.api.uploadOssFile(file.file.url).then((res) => { |
|
this.background = [{ url: res.show_path }]; |
|
this.user.background_image = res.show_path; |
|
}); |
|
}, |
|
backgroundDel(index, file, name) { |
|
this.background = []; |
|
this.user.background = ""; |
|
}, |
|
loginout() { |
|
common_vendor.index.clearStorageSync(); |
|
this.$store.commit("userInfo", {}); |
|
this.$store.commit("userExtends", {}); |
|
common_vendor.index.reLaunch({ url: "/pages/Index/index" }); |
|
} |
|
}, |
|
onPageScroll(res) { |
|
}, |
|
created() { |
|
} |
|
}; |
|
if (!Array) { |
|
const _component_HeaderNav = common_vendor.resolveComponent("HeaderNav"); |
|
const _easycom_u_input2 = common_vendor.resolveComponent("u-input"); |
|
const _easycom_u_icon2 = common_vendor.resolveComponent("u-icon"); |
|
const _easycom_u_text2 = common_vendor.resolveComponent("u-text"); |
|
const _easycom_uv_datetime_picker2 = common_vendor.resolveComponent("uv-datetime-picker"); |
|
const _easycom_uv_picker2 = common_vendor.resolveComponent("uv-picker"); |
|
const _easycom_u_upload2 = common_vendor.resolveComponent("u-upload"); |
|
(_component_HeaderNav + _easycom_u_input2 + _easycom_u_icon2 + _easycom_u_text2 + _easycom_uv_datetime_picker2 + _easycom_uv_picker2 + _easycom_u_upload2)(); |
|
} |
|
const _easycom_u_input = () => "../../uni_modules/uview-plus/components/u-input/u-input.js"; |
|
const _easycom_u_icon = () => "../../uni_modules/uview-plus/components/u-icon/u-icon.js"; |
|
const _easycom_u_text = () => "../../uni_modules/uview-plus/components/u-text/u-text.js"; |
|
const _easycom_uv_datetime_picker = () => "../../uni_modules/uv-datetime-picker/components/uv-datetime-picker/uv-datetime-picker.js"; |
|
const _easycom_uv_picker = () => "../../uni_modules/uv-picker/components/uv-picker/uv-picker.js"; |
|
const _easycom_u_upload = () => "../../uni_modules/uview-plus/components/u-upload/u-upload.js"; |
|
if (!Math) { |
|
(_easycom_u_input + _easycom_u_icon + _easycom_u_text + _easycom_uv_datetime_picker + _easycom_uv_picker + _easycom_u_upload)(); |
|
} |
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { |
|
return { |
|
a: common_vendor.p({ |
|
title: "个人信息", |
|
["is-back"]: true |
|
}), |
|
b: _ctx.user.avatar, |
|
c: common_vendor.o((...args) => $options.chooseAvatar && $options.chooseAvatar(...args)), |
|
d: common_vendor.o(($event) => _ctx.user.name = $event), |
|
e: common_vendor.p({ |
|
inputAlign: "right", |
|
modelValue: _ctx.user.name |
|
}), |
|
f: common_vendor.p({ |
|
name: "arrow-right" |
|
}), |
|
g: common_vendor.p({ |
|
text: _ctx.birthday, |
|
size: "28", |
|
color: "#636363" |
|
}), |
|
h: common_vendor.sr("datetimepicker", "eb116cca-4"), |
|
i: common_vendor.o($options.birthdayConfirm), |
|
j: common_vendor.o(($event) => _ctx.user.birthday = $event), |
|
k: common_vendor.p({ |
|
mode: "date", |
|
minDate: "1900-01-01", |
|
modelValue: _ctx.user.birthday |
|
}), |
|
l: common_vendor.p({ |
|
name: "arrow-right" |
|
}), |
|
m: common_vendor.o(($event) => _ctx.$refs.datetimepicker.open()), |
|
n: common_vendor.o(($event) => _ctx.user.phone = $event), |
|
o: common_vendor.p({ |
|
inputAlign: "right", |
|
modelValue: _ctx.user.phone |
|
}), |
|
p: common_vendor.p({ |
|
name: "arrow-right" |
|
}), |
|
q: common_vendor.p({ |
|
text: _ctx.sexTitle, |
|
size: "28", |
|
color: "#636363" |
|
}), |
|
r: common_vendor.sr("sexPicker", "eb116cca-9"), |
|
s: common_vendor.o($options.sexConfirm), |
|
t: common_vendor.o(($event) => _ctx.user.sex = $event), |
|
v: common_vendor.p({ |
|
["default-index"]: [_ctx.sexChecked], |
|
["key-name"]: "title", |
|
columns: _ctx.sexs, |
|
modelValue: _ctx.user.sex |
|
}), |
|
w: common_vendor.p({ |
|
name: "arrow-right" |
|
}), |
|
x: common_vendor.o(($event) => _ctx.$refs.sexPicker.open()), |
|
y: common_vendor.o($options.backgroundDel), |
|
z: common_vendor.o($options.backgroundRead), |
|
A: common_vendor.p({ |
|
["file-list"]: _ctx.background, |
|
maxCount: 1 |
|
}), |
|
B: common_vendor.o((...args) => $options.loginout && $options.loginout(...args)), |
|
C: "url(" + _ctx.staticImage.wallpaperBgImage + ")" |
|
}; |
|
} |
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "E:/Project/pet_uni/pages/UserDetail/index.vue"]]); |
|
_sfc_main.__runtimeHooks = 1; |
|
wx.createPage(MiniProgramPage);
|
|
|