12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- "use strict";
- var common_vendor = require("../common/vendor.js");
- var api_user = require("../api/user.js");
- require("../common/request.js");
- const _sfc_main = {
- data() {
- return {
- user: {
- avatar: null,
- phone: ""
- }
- };
- },
- onLoad() {
- this.getUserInfo();
- },
- methods: {
- bindblur(e) {
- this.user.nickName = e.detail.value;
- },
- bindinput(e) {
- this.user.nickName = e.detail.value;
- },
- onChooseAvatar(e) {
- let {
- avatarUrl
- } = e.detail;
- common_vendor.index.uploadFile({
- url: common_vendor.index.getStorageSync("requestPath") + "/app/common/uploadOSS",
- filePath: avatarUrl,
- name: "file",
- formData: {
- "user": "test"
- },
- success: (uploadFileRes) => {
- this.user.avatar = JSON.parse(uploadFileRes.data).url;
- }
- });
- },
- submit() {
- this.user.isWeixinAuth = 1;
- api_user.editUser(this.user).then((res) => {
- if (res.code == 200) {
- common_vendor.index.setStorageSync("avatar", this.avatar);
- common_vendor.index.setStorageSync("nickName", this.nickName);
- common_vendor.index.showToast({
- icon: "success",
- title: "\u4FEE\u6539\u6210\u529F"
- });
- this.getUserInfo();
- } else {
- common_vendor.index.showToast({
- icon: "none",
- title: "\u8BF7\u6C42\u5931\u8D25"
- });
- }
- }, (rej) => {
- });
- },
- getUserInfo() {
- api_user.getUserInfo().then((res) => {
- if (res.code == 200) {
- if (res.user != null) {
- this.user = res.user;
- } else {
- this.utils.loginOut();
- }
- } else {
- common_vendor.index.showToast({
- icon: "none",
- title: "\u8BF7\u6C42\u5931\u8D25"
- });
- }
- }, (rej) => {
- });
- }
- }
- };
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
- return common_vendor.e({
- a: $data.user.avatar == null ? "https://fs-1319721001.cos.ap-chongqing.myqcloud.com/fs/20240229/22cb9518a55040dea74d8f730551a7a2.jpg" : $data.user.avatar,
- b: common_vendor.o((...args) => $options.onChooseAvatar && $options.onChooseAvatar(...args)),
- c: common_vendor.o((...args) => $options.bindblur && $options.bindblur(...args)),
- d: common_vendor.o([($event) => $data.user.nickName = $event.detail.value, (...args) => $options.bindinput && $options.bindinput(...args)]),
- e: $data.user.nickName,
- f: $data.user != null
- }, $data.user != null ? {
- g: common_vendor.t(_ctx.$parsePhone($data.user.phone))
- } : {}, {
- h: common_vendor.o(($event) => $options.submit())
- });
- }
- var MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-2a25b94e"], ["__file", "E:/Project/2023/\u95EE\u8BCA\u5E73\u53F0/his_user_miniapp/pages_user/personInfo.vue"]]);
- wx.createPage(MiniProgramPage);
|