|
@@ -11,6 +11,12 @@ export const getUserInfo = () => {
|
|
|
const {
|
|
|
data
|
|
|
} = response;
|
|
|
+
|
|
|
+ // tab数字角标
|
|
|
+ uni.setTabBarBadge({
|
|
|
+ index: 2,
|
|
|
+ text: data.unread
|
|
|
+ })
|
|
|
uni.setStorageSync('recycle_mobile_user', data);
|
|
|
resolve(data);
|
|
|
})
|
|
@@ -35,49 +41,49 @@ const createName = function(name) {
|
|
|
|
|
|
// 图片上传
|
|
|
export const uploadImg = async function(file) {
|
|
|
- console.log(file);
|
|
|
- uni.showLoading({
|
|
|
- mask: true,
|
|
|
- })
|
|
|
-
|
|
|
- // 获取oss配置
|
|
|
- const par = await axios({
|
|
|
- url: '/common/oss/config',
|
|
|
- method: 'get'
|
|
|
- }).then(res=>{
|
|
|
- return res.data;
|
|
|
- }).catch(err=>{
|
|
|
- uni.hideLoading();
|
|
|
- })
|
|
|
-
|
|
|
- const fileKey = par.dir + createName(file.path);
|
|
|
-
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
- uni.uploadFile({
|
|
|
- url: par.host,
|
|
|
- // header: {
|
|
|
- // "Content-Type": 'multipart/form-data',
|
|
|
- // },
|
|
|
- name: 'file',
|
|
|
- formData:{
|
|
|
- ...par,
|
|
|
- name: file.name,
|
|
|
- key: fileKey
|
|
|
- },
|
|
|
- filePath: file.path,
|
|
|
- success(res) {
|
|
|
- resolve({
|
|
|
- url: fileKey
|
|
|
- })
|
|
|
- },
|
|
|
- fail(err) {
|
|
|
- reject(err)
|
|
|
- },
|
|
|
- complete(res) {
|
|
|
- uni.hideLoading();
|
|
|
- }
|
|
|
- })
|
|
|
- })
|
|
|
+ console.log(file);
|
|
|
+ uni.showLoading({
|
|
|
+ mask: true,
|
|
|
+ })
|
|
|
+
|
|
|
+ // 获取oss配置
|
|
|
+ const par = await axios({
|
|
|
+ url: '/common/oss/config',
|
|
|
+ method: 'get'
|
|
|
+ }).then(res => {
|
|
|
+ return res.data;
|
|
|
+ }).catch(err => {
|
|
|
+ uni.hideLoading();
|
|
|
+ })
|
|
|
+
|
|
|
+ const fileKey = par.dir + createName(file.path);
|
|
|
+
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ uni.uploadFile({
|
|
|
+ url: par.host,
|
|
|
+ // header: {
|
|
|
+ // "Content-Type": 'multipart/form-data',
|
|
|
+ // },
|
|
|
+ name: 'file',
|
|
|
+ formData: {
|
|
|
+ ...par,
|
|
|
+ name: file.name,
|
|
|
+ key: fileKey
|
|
|
+ },
|
|
|
+ filePath: file.path,
|
|
|
+ success(res) {
|
|
|
+ resolve({
|
|
|
+ url: fileKey
|
|
|
+ })
|
|
|
+ },
|
|
|
+ fail(err) {
|
|
|
+ reject(err)
|
|
|
+ },
|
|
|
+ complete(res) {
|
|
|
+ uni.hideLoading();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
export const getArea = function(str) {
|