上传头像
This commit is contained in:
4673
unpackage/dist/dev/mp-weixin/common/vendor.js
vendored
4673
unpackage/dist/dev/mp-weixin/common/vendor.js
vendored
File diff suppressed because one or more lines are too long
@@ -1,8 +1,9 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../common/vendor.js");
|
||||
let vueVersion = 3;
|
||||
function TUIlogin(chatInfo, info, userSig) {
|
||||
common_vendor.index.$SDKAppID = chatInfo.appId;
|
||||
common_vendor.index.$userID = info.userChatId;
|
||||
common_vendor.index.$SDKAppID = chatInfo;
|
||||
common_vendor.index.$userID = String(info);
|
||||
common_vendor.index.$userSig = userSig;
|
||||
common_vendor.A.login({
|
||||
SDKAppID: common_vendor.index.$SDKAppID,
|
||||
|
||||
16
unpackage/dist/dev/mp-weixin/components/generateFileName.js
vendored
Normal file
16
unpackage/dist/dev/mp-weixin/components/generateFileName.js
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
function generateRandomString(length = 6) {
|
||||
const chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
let result = "";
|
||||
for (let i = 0; i < length; i++) {
|
||||
result += chars[Math.floor(Math.random() * chars.length)];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function generateFileName() {
|
||||
const randomPart = generateRandomString();
|
||||
const timestamp = Date.now();
|
||||
return `${randomPart}${timestamp}.jpg`;
|
||||
}
|
||||
exports.generateFileName = generateFileName;
|
||||
//# sourceMappingURL=../../.sourcemap/mp-weixin/components/generateFileName.js.map
|
||||
38
unpackage/dist/dev/mp-weixin/components/postFile.js
vendored
Normal file
38
unpackage/dist/dev/mp-weixin/components/postFile.js
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../common/vendor.js");
|
||||
const cos = new common_vendor.COS({
|
||||
SecretId: "AKID4KPIyQgjjnkWJzSnwtfHj281tcBZo28v",
|
||||
// 推荐使用环境变量获取;用户的 SecretId,建议使用子账号密钥,授权遵循最小权限指引,降低使用风险。子账号密钥获取可参考https://cloud.tencent.com/document/product/598/37140
|
||||
SecretKey: "kQvMjuscBWgfSCqeHiGfx3vc7PUP7ctx"
|
||||
// 推荐使用环境变量获取;用户的 SecretKey,建议使用子账号密钥,授权遵循最小权限指引,降低使用风险。子账号密钥获取可参考https://cloud.tencent.com/document/product/598/37140
|
||||
});
|
||||
const uploadFile = function(file) {
|
||||
return new Promise((resolve, reject) => {
|
||||
cos.uploadFile({
|
||||
Bucket: "vv-1317974657",
|
||||
// 填入您自己的存储桶,必须字段
|
||||
Region: "ap-shanghai",
|
||||
// 存储桶所在地域,例如 ap-beijing,必须字段
|
||||
Key: "headerIcon/" + file.name,
|
||||
// 存储在桶里的对象键(例如1.jpg,a/b/test.txt),必须字段文件名
|
||||
FilePath: file.path,
|
||||
// 必须
|
||||
FileSize: "",
|
||||
// v1.4.3之前的版本必须,v1.4.3及以后的版本非必须
|
||||
SliceSize: 1024 * 1024 * 2,
|
||||
// 触发分块上传的阈值,超过2MB使用分块上传,非必须,按需调整,最小支持1MB
|
||||
// 支持自定义 headers 非必须
|
||||
Headers: {
|
||||
"x-cos-meta-test": 123
|
||||
}
|
||||
}, function(err, data) {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
resolve(data.Location);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
exports.uploadFile = uploadFile;
|
||||
//# sourceMappingURL=../../.sourcemap/mp-weixin/components/postFile.js.map
|
||||
@@ -3,7 +3,6 @@ const common_vendor = require("../common/vendor.js");
|
||||
function request(urldata) {
|
||||
const { url, data, method, header, userInfo } = urldata;
|
||||
const baseUrl = "http://192.168.0.218:8086/" + url;
|
||||
common_vendor.index.__f__("log", "at components/request.js:6", "``````````````````````````````````", userInfo);
|
||||
if (userInfo) {
|
||||
common_vendor.index.getStorage({
|
||||
key: "userinfo",
|
||||
|
||||
@@ -14,7 +14,6 @@ const _sfc_main = {
|
||||
},
|
||||
methods: {
|
||||
goAdvertisement() {
|
||||
common_vendor.index.__f__("log", "at pages/Home/Home.vue:34", common_vendor.index);
|
||||
this.$global.lastPage = getCurrentPages().router;
|
||||
common_vendor.index.navigateTo({ url: "/pages/login/login" });
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ const _sfc_main = {
|
||||
key: "userinfo",
|
||||
success: (res) => {
|
||||
this.userinfo = res.data;
|
||||
common_vendor.index.__f__("log", "at pages/Mine/Mine.vue:33", this.userinfo);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const components_request = require("../../components/request.js");
|
||||
const components_postFile = require("../../components/postFile.js");
|
||||
const components_generateFileName = require("../../components/generateFileName.js");
|
||||
const _sfc_main = {
|
||||
inject: ["$global"],
|
||||
data() {
|
||||
@@ -44,38 +46,42 @@ const _sfc_main = {
|
||||
title: "登录中...",
|
||||
mask: true
|
||||
});
|
||||
common_vendor.index.__f__("log", "at pages/Setting/Setting.vue:62", "userinfo", this.userinfo);
|
||||
common_vendor.index.__f__("log", "at pages/Setting/Setting.vue:63", "name", this.name);
|
||||
common_vendor.index.__f__("log", "at pages/Setting/Setting.vue:64", "id", this.id);
|
||||
common_vendor.index.__f__("log", "at pages/Setting/Setting.vue:65", "userSig", this.userSig);
|
||||
const res = await components_request.request({
|
||||
url: "user/updateUserInfo",
|
||||
method: "POST",
|
||||
data: {
|
||||
id: this.id,
|
||||
headerIcon: this.userinfo,
|
||||
nickName: this.name,
|
||||
usersig: this.userSig
|
||||
},
|
||||
userInfo: false
|
||||
components_postFile.uploadFile({
|
||||
path: this.userinfo,
|
||||
name: components_generateFileName.generateFileName()
|
||||
}).then((res) => {
|
||||
this.userinfo = res;
|
||||
}).catch((err) => {
|
||||
common_vendor.index.__f__("log", "at pages/Setting/Setting.vue:71", err);
|
||||
});
|
||||
common_vendor.index.__f__("log", "at pages/Setting/Setting.vue:78", "res", res);
|
||||
if (res.code === 200) {
|
||||
common_vendor.index.showToast({
|
||||
title: "修改成功",
|
||||
icon: "success"
|
||||
});
|
||||
common_vendor.index.__f__("log", "at pages/Setting/Setting.vue:84", "修改成功", res.data);
|
||||
common_vendor.index.setStorageSync("userinfo", res.data.info);
|
||||
common_vendor.index.hideLoading();
|
||||
common_vendor.index.navigateBack({
|
||||
delta: 1
|
||||
});
|
||||
} else {
|
||||
common_vendor.index.showToast({
|
||||
title: "修改失败",
|
||||
icon: "none"
|
||||
if (this.userinfo) {
|
||||
const res = await components_request.request({
|
||||
url: "user/updateUserInfo",
|
||||
method: "POST",
|
||||
data: {
|
||||
id: this.id,
|
||||
headerIcon: this.userinfo,
|
||||
nickName: this.name,
|
||||
usersig: this.userSig.userSig
|
||||
},
|
||||
userInfo: false
|
||||
});
|
||||
if (res.code === 200) {
|
||||
common_vendor.index.showToast({
|
||||
title: "修改成功",
|
||||
icon: "success"
|
||||
});
|
||||
common_vendor.index.setStorageSync("userinfo", res.data.info);
|
||||
common_vendor.index.hideLoading();
|
||||
common_vendor.index.navigateBack({
|
||||
delta: 1
|
||||
});
|
||||
} else {
|
||||
common_vendor.index.showToast({
|
||||
title: "修改失败",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const components_request = require("../../components/request.js");
|
||||
const components_postFile = require("../../components/postFile.js");
|
||||
const components_generateFileName = require("../../components/generateFileName.js");
|
||||
const _sfc_main = {
|
||||
inject: ["$global"],
|
||||
data() {
|
||||
@@ -46,39 +48,47 @@ const _sfc_main = {
|
||||
provider: "weixin",
|
||||
onlyAuthorize: true
|
||||
});
|
||||
common_vendor.index.__f__("log", "at pages/UserInformation/UserInformation.vue:67", "code", code);
|
||||
common_vendor.index.__f__("log", "at pages/UserInformation/UserInformation.vue:68", "code", this.name);
|
||||
common_vendor.index.__f__("log", "at pages/UserInformation/UserInformation.vue:69", "code", this.userinfo);
|
||||
common_vendor.index.__f__("log", "at pages/UserInformation/UserInformation.vue:70", "code", this.id);
|
||||
common_vendor.index.__f__("log", "at pages/UserInformation/UserInformation.vue:71", "code", this.userSig);
|
||||
const res = await components_request.request({
|
||||
url: "user/inputUserInfo",
|
||||
method: "POST",
|
||||
data: {
|
||||
id: this.id,
|
||||
headerIcon: this.userinfo,
|
||||
nickName: this.name,
|
||||
code,
|
||||
usersig: this.userSig
|
||||
},
|
||||
userInfo: false
|
||||
components_postFile.uploadFile({
|
||||
path: this.userinfo,
|
||||
name: components_generateFileName.generateFileName()
|
||||
}).then((res) => {
|
||||
this.userinfo = res;
|
||||
}).catch((err) => {
|
||||
common_vendor.index.__f__("log", "at pages/UserInformation/UserInformation.vue:76", err);
|
||||
});
|
||||
common_vendor.index.__f__("log", "at pages/UserInformation/UserInformation.vue:84", "res", res);
|
||||
if (res.code === 200) {
|
||||
common_vendor.index.showToast({
|
||||
title: "登录成功",
|
||||
icon: "success"
|
||||
});
|
||||
common_vendor.index.__f__("log", "at pages/UserInformation/UserInformation.vue:90", "登录成功", res.data);
|
||||
common_vendor.index.setStorageSync("userinfo", res.data.info);
|
||||
common_vendor.index.hideLoading();
|
||||
common_vendor.index.reLaunch({
|
||||
url: this.$global.lastPage || "/pages/Home/Home"
|
||||
// 默认页
|
||||
if (this.userinfo) {
|
||||
const res = await components_request.request({
|
||||
url: "user/inputUserInfo",
|
||||
method: "POST",
|
||||
data: {
|
||||
id: this.id,
|
||||
headerIcon: this.userinfo,
|
||||
nickName: this.name,
|
||||
code,
|
||||
usersig: this.userSig.userSig
|
||||
},
|
||||
userInfo: false
|
||||
});
|
||||
if (res.code === 200) {
|
||||
common_vendor.index.showToast({
|
||||
title: "登录成功",
|
||||
icon: "success"
|
||||
});
|
||||
common_vendor.index.setStorageSync("userinfo", res.data.info);
|
||||
common_vendor.index.hideLoading();
|
||||
common_vendor.index.reLaunch({
|
||||
url: this.$global.lastPage || "/pages/Home/Home"
|
||||
// 默认页
|
||||
});
|
||||
} else {
|
||||
common_vendor.index.showToast({
|
||||
title: "登录失败",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
} else {
|
||||
common_vendor.index.showToast({
|
||||
title: "登录失败",
|
||||
title: "上传失败",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -8,7 +8,8 @@ const _sfc_main = {
|
||||
data() {
|
||||
return {
|
||||
userInfo: {},
|
||||
info: {}
|
||||
info: {},
|
||||
userSig: ""
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
@@ -34,27 +35,26 @@ const _sfc_main = {
|
||||
},
|
||||
userInfo: false
|
||||
});
|
||||
common_vendor.index.__f__("log", "at pages/login/login.vue:47", "登录结果:", res);
|
||||
this.info = res;
|
||||
const sdkAppID = Number(this.info.data.chatInfo.appId);
|
||||
const userID = "administrator";
|
||||
this.userSig = components_debug_GenerateTestUserSig.genTestUserSig({
|
||||
SDKAPPID: sdkAppID,
|
||||
SECRETKEY: this.info.data.chatInfo.appKey,
|
||||
userID
|
||||
});
|
||||
common_vendor.index.setStorageSync("chatInfo", this.info.data.chatInfo);
|
||||
common_vendor.index.setStorageSync("userSig", this.userSig);
|
||||
common_vendor.index.setStorageSync("userinfo", this.info.data.info);
|
||||
if (this.info.code === 200) {
|
||||
if (this.info.data.newAccount) {
|
||||
const sdkAppID = Number(this.info.data.chatInfo.appId);
|
||||
const userID = "administrator";
|
||||
const { userSig: userSig2 } = components_debug_GenerateTestUserSig.genTestUserSig({
|
||||
SDKAPPID: sdkAppID,
|
||||
SECRETKEY: this.info.data.chatInfo.appKey,
|
||||
userID
|
||||
});
|
||||
common_vendor.index.setStorageSync("chatInfo", this.info.data.chatInfo);
|
||||
common_vendor.index.setStorageSync("userSig", userSig2);
|
||||
common_vendor.index.setStorageSync("userinfo", this.info.data.info);
|
||||
common_vendor.index.reLaunch({
|
||||
url: "/pages/UserInformation/UserInformation"
|
||||
});
|
||||
} else {
|
||||
common_vendor.index.setStorageSync("userinfo", this.info.data.info);
|
||||
common_vendor.index.hideLoading();
|
||||
components_TUILogin.TUIlogin(this.info.data.chatInfo.appId, this.info.data.info.userChatId, userSig);
|
||||
components_TUILogin.TUIlogin(this.info.data.chatInfo.appId, this.info.data.info.id, this.userSig.userSig);
|
||||
common_vendor.index.reLaunch({
|
||||
url: this.$global.lastPage || "/pages/Home/Home"
|
||||
// 默认页
|
||||
|
||||
Reference in New Issue
Block a user