sc
This commit is contained in:
@@ -19,6 +19,7 @@
|
|||||||
"@dcloudio/uni-mp-weixin": "3.0.0-alpha-3060420220922001",
|
"@dcloudio/uni-mp-weixin": "3.0.0-alpha-3060420220922001",
|
||||||
"dayjs": "^1.11.13",
|
"dayjs": "^1.11.13",
|
||||||
"jsencrypt-plus": "^0.1.0",
|
"jsencrypt-plus": "^0.1.0",
|
||||||
|
"jweixin-module": "^1.6.0",
|
||||||
"pinia": "2.0.36",
|
"pinia": "2.0.36",
|
||||||
"pinia-plugin-persist-uni": "^1.2.0",
|
"pinia-plugin-persist-uni": "^1.2.0",
|
||||||
"vue": "^3.2.37",
|
"vue": "^3.2.37",
|
||||||
@@ -30,7 +31,7 @@
|
|||||||
"@dcloudio/uni-cli-shared": "3.0.0-alpha-3060420220922001",
|
"@dcloudio/uni-cli-shared": "3.0.0-alpha-3060420220922001",
|
||||||
"@dcloudio/uni-stacktracey": "3.0.0-alpha-3060420220922001",
|
"@dcloudio/uni-stacktracey": "3.0.0-alpha-3060420220922001",
|
||||||
"@dcloudio/vite-plugin-uni": "3.0.0-alpha-3060420220922001",
|
"@dcloudio/vite-plugin-uni": "3.0.0-alpha-3060420220922001",
|
||||||
"sass": "^1.63.6",
|
"sass": "1.75",
|
||||||
"sass-loader": "^13.3.2",
|
"sass-loader": "^13.3.2",
|
||||||
"vite": "^2.9.14"
|
"vite": "^2.9.14"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,3 +31,21 @@ export function getUserLikeList(data) {
|
|||||||
data
|
data
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 修改用户信息
|
||||||
|
export function updateUserInfo(data) {
|
||||||
|
return request({
|
||||||
|
url: 'sinology-api/sysUser/update',
|
||||||
|
method: 'POST',
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询用户开通的会员
|
||||||
|
export function queryUserMember(data) {
|
||||||
|
return request({
|
||||||
|
url: 'sinology-api/sysMember/queryUserMember',
|
||||||
|
method: 'POST',
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import { login, getInfo } from '@/jtools/api/login';
|
import { login, getInfo } from '@/jtools/api/login';
|
||||||
import storage from '@/jtools/storage';
|
import storage from '@/jtools/storage';
|
||||||
|
import { queryUserMember } from '@/jtools/api/user';
|
||||||
|
|
||||||
const useUserStore = defineStore({
|
const useUserStore = defineStore({
|
||||||
id: 'user',
|
id: 'user',
|
||||||
@@ -25,6 +26,7 @@ const useUserStore = defineStore({
|
|||||||
this.isLogin = true;
|
this.isLogin = true;
|
||||||
this.token = resp.data.token;
|
this.token = resp.data.token;
|
||||||
this.userInfo = resp.data;
|
this.userInfo = resp.data;
|
||||||
|
this.searchVip()
|
||||||
storage.set('isLogin', true);
|
storage.set('isLogin', true);
|
||||||
storage.set('token', resp.data.token);
|
storage.set('token', resp.data.token);
|
||||||
storage.set('userInfo', resp.data);
|
storage.set('userInfo', resp.data);
|
||||||
@@ -60,17 +62,20 @@ const useUserStore = defineStore({
|
|||||||
getInfo().then(resp => {
|
getInfo().then(resp => {
|
||||||
if (resp.code == '0000') {
|
if (resp.code == '0000') {
|
||||||
this.userInfo = resp.data;
|
this.userInfo = resp.data;
|
||||||
if (resp.data.driverTypeId && resp.data.modelId) {
|
this.searchVip()
|
||||||
this.currentType = {
|
|
||||||
modelId: resp.data.modelId,
|
|
||||||
typeId: resp.data.driverTypeId,
|
|
||||||
showName: `${resp.data.modelName} - ${resp.data.driverTypeName}`
|
|
||||||
};
|
|
||||||
}
|
|
||||||
storage.set('userInfo', resp.data);
|
storage.set('userInfo', resp.data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
searchVip() {
|
||||||
|
queryUserMember({ userId: this.userInfo.userId }).then(resp => {
|
||||||
|
if (resp.code == '0000') {
|
||||||
|
// this.vipInfo = resp.data;
|
||||||
|
console.log(resp);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
setUserInfo(info) {
|
setUserInfo(info) {
|
||||||
this.userInfo = info;
|
this.userInfo = info;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -62,7 +62,7 @@
|
|||||||
_this.total = res.data.total
|
_this.total = res.data.total
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleClick(item) {
|
handleClick(chapter) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/course/detail?id=${chapter.chapterId}`
|
url: `/pages/course/detail?id=${chapter.chapterId}`
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<!-- 用户信息 -->
|
<!-- 用户信息 -->
|
||||||
<view class="user-info" @tap="next('/pages/me/userInfo')">
|
<view class="user-info" @tap="next('/pages/me/userInfo')">
|
||||||
<view class="fl1 flex ai-c">
|
<view class="fl1 flex ai-c">
|
||||||
<u-avatar size="48"></u-avatar>
|
<u-avatar size="48" :src="userInfo?.avatar"></u-avatar>
|
||||||
<view class="ml10 fs16 fw600">
|
<view class="ml10 fs16 fw600">
|
||||||
<view>{{ isLogin ? userInfo?.userName : '点击登陆' }}</view>
|
<view>{{ isLogin ? userInfo?.userName : '点击登陆' }}</view>
|
||||||
<view class="fs12 cor-999">{{ isLogin ? userInfo?.phone : '未登录' }}</view>
|
<view class="fs12 cor-999">{{ isLogin ? userInfo?.phone : '未登录' }}</view>
|
||||||
|
|||||||
@@ -18,14 +18,14 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="flex ai-c jc-sb p15 bb1">
|
<view class="flex ai-c jc-sb p15 bb1">
|
||||||
<view class="fs14">性别</view>
|
<view class="fs14">性别</view>
|
||||||
<view class="flex" @tap="showPicker">
|
<view class="flex" @tap="showSexPicker">
|
||||||
<text class="cor-666">{{ form.sex || '请选择性别' }}</text>
|
<text class="cor-666">{{ ['男', '女'][form.sex] || '请选择性别' }}</text>
|
||||||
<u-icon name="arrow-right" size="16" class="ml10"></u-icon>
|
<u-icon name="arrow-right" size="16" class="ml10"></u-icon>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex ai-c jc-sb p15 bb1">
|
<view class="flex ai-c jc-sb p15 bb1">
|
||||||
<view class="fs14">生日</view>
|
<view class="fs14">生日</view>
|
||||||
<view class="flex" @tap="showPicker">
|
<view class="flex" @tap="showDate = true">
|
||||||
<text class="cor-666">{{ form.birthday || '请选择出生日期' }}</text>
|
<text class="cor-666">{{ form.birthday || '请选择出生日期' }}</text>
|
||||||
<u-icon name="arrow-right" size="16" class="ml10"></u-icon>
|
<u-icon name="arrow-right" size="16" class="ml10"></u-icon>
|
||||||
</view>
|
</view>
|
||||||
@@ -39,18 +39,21 @@
|
|||||||
<view class="p15 mt20">
|
<view class="p15 mt20">
|
||||||
<u-button type="primary" @tap="submit">保存</u-button>
|
<u-button type="primary" @tap="submit">保存</u-button>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<u-datetime-picker :show="showDate" mode="date" closeOnClickOverlay v-model="form.birthday" :minDate="Number(new Date('1900-01-01'))" @confirm="confirmDate" @cancel="showDate=false"></u-datetime-picker>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// import { updateUserInfo } from '@/jtools/api/user'
|
import { updateUserInfo } from '@/jtools/api/user'
|
||||||
import useUserStore from '@/jtools/store/user' //引入store
|
import useUserStore from '@/jtools/store/user' //引入store
|
||||||
export default {
|
export default {
|
||||||
name: 'UserInfo',
|
name: 'UserInfo',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
form: {...useUserStore().userInfo},
|
form: {...useUserStore().userInfo, sex: useUserStore().userInfo.sex || 0},
|
||||||
saving: false,
|
saving: false,
|
||||||
|
showDate: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -76,23 +79,36 @@ import useUserStore from '@/jtools/store/user' //引入store
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
uploadAvatar(url) {
|
uploadAvatar(url) {
|
||||||
|
const _this = this
|
||||||
uni.uploadFile({
|
uni.uploadFile({
|
||||||
url: import.meta.env.VITE_UPLOAD_URL + 'wrj-api/system/file/upload', // 仅为示例,非真实的接口地址
|
url: import.meta.env.VITE_UPLOAD_URL + 'sinology-api/system/file/upload', // 仅为示例,非真实的接口地址
|
||||||
filePath: url,
|
filePath: url,
|
||||||
name: 'file',
|
name: 'file',
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
// setTimeout(() => {
|
console.log(JSON.parse(res.data).data);
|
||||||
// resolve(JSON.parse(res.data).data);
|
|
||||||
// }, 100);
|
_this.form.avatar = JSON.parse(res.data).data
|
||||||
this.saving = false;
|
this.saving = false;
|
||||||
},
|
},
|
||||||
fail: () => {
|
fail: () => {
|
||||||
resolve(null);
|
uni.showToast({ title: '上传失败', icon: 'none' });
|
||||||
this.saving = false;
|
this.saving = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
|
showSexPicker() {
|
||||||
|
uni.showActionSheet({
|
||||||
|
itemList: ['男', '女'],
|
||||||
|
success: (res) => {
|
||||||
|
this.form.sex = res.tapIndex
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
confirmDate(e) {
|
||||||
|
this.showDate = false;
|
||||||
|
this.form.birthday = uni.$u.timeFormat(e.value, 'yyyy-mm-dd');
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user