1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- "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: {
- nickName: "",
- avatar: null,
- user: null
- }
- };
- },
- onLoad() {
- },
- methods: {
- bindblur(e) {
- this.nickName = e.detail.value;
- },
- bindinput(e) {
- this.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() {
- if (this.nickName == null || this.nickName == "") {
- common_vendor.index.showToast({
- icon: "none",
- title: "\u8BF7\u8F93\u5165\u6635\u79F0"
- });
- return;
- }
- this.user.nickName = this.nickName;
- 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);
- this.$emit("updateUser");
- } 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;
- console.log(this.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 {
- 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) => _ctx.nickName = $event.detail.value, (...args) => $options.bindinput && $options.bindinput(...args)]),
- e: _ctx.nickName,
- f: common_vendor.o(($event) => $options.submit())
- };
- }
- var Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-0a951519"], ["__file", "E:/Project/2023/\u95EE\u8BCA\u5E73\u53F0/his_user_miniapp/pages/components/wxAuth.vue"]]);
- wx.createComponent(Component);
|