update vue3

This commit is contained in:
RuoYi
2025-03-28 23:23:07 +08:00
parent fb0656fe14
commit 03e023cbc4
18 changed files with 477 additions and 514 deletions

View File

@@ -43,15 +43,9 @@
</view>
</template>
<script>
export default {
data() {
return {
url: getApp().globalData.config.appInfo.site_url,
version: getApp().globalData.config.appInfo.version
}
}
}
<script setup>
const url = getApp().globalData.config.appInfo.site_url
const version = getApp().globalData.config.appInfo.version
</script>
<style lang="scss" scoped>

View File

@@ -15,49 +15,45 @@
</view>
</template>
<script>
export default {
data() {
return {
list: [{
icon: 'iconfont icon-github',
title: '若依问题',
childList: [{
title: '若依开源吗?',
content: '开源'
}, {
title: '若依可以商用吗?',
content: '可以'
}, {
title: '若依官网地址多少?',
content: 'http://ruoyi.vip'
}, {
title: '若依文档地址多少?',
content: 'http://doc.ruoyi.vip'
}]
},
{
icon: 'iconfont icon-help',
title: '其他问题',
childList: [{
title: '如何退出登录?',
content: '请点击[我的] - [应用设置] - [退出登录]即可退出登录',
}, {
title: '如何修改用户头像?',
content: '请点击[我的] - [选择头像] - [点击提交]即可更换用户头像',
}, {
title: '如何修改登录密码?',
content: '请点击[我的] - [应用设置] - [修改密码]即可修改登录密码',
}]
}
]
}
},
methods: {
handleText(item) {
this.$tab.navigateTo(`/pages/common/textview/index?title=${item.title}&content=${item.content}`)
}
}
<script setup>
import { ref, getCurrentInstance } from "vue"
const { proxy } = getCurrentInstance()
const list = ref([{
icon: 'iconfont icon-github',
title: '若依问题',
childList: [{
title: '若依开源吗?',
content: '开源'
}, {
title: '若依可以商用吗?',
content: '可以'
}, {
title: '若依官网地址多少?',
content: 'http://ruoyi.vip'
}, {
title: '若依文档地址多少?',
content: 'http://doc.ruoyi.vip'
}]
},
{
icon: 'iconfont icon-help',
title: '其他问题',
childList: [{
title: '如何退出登录?',
content: '请点击[我的] - [应用设置] - [退出登录]即可退出登录',
}, {
title: '如何修改用户头像',
content: '请点击[我的] - [选择头像] - [点击提交]即可更换用户头像',
}, {
title: '如何修改登录密码',
content: '请点击[我的] - [应用设置] - [修改密码]即可修改登录密码',
}]
}])
function handleText(item) {
proxy.$tab.navigateTo(`/pages/common/textview/index?title=${item.title}&content=${item.content}`)
}
</script>

View File

@@ -76,51 +76,50 @@
</view>
</template>
<script>
export default {
data() {
return {
name: this.$store.state.user.name,
version: getApp().globalData.config.appInfo.version
}
},
computed: {
avatar() {
return this.$store.state.user.avatar
},
windowHeight() {
return uni.getSystemInfoSync().windowHeight - 50
}
},
methods: {
handleToInfo() {
this.$tab.navigateTo('/pages/mine/info/index')
},
handleToEditInfo() {
this.$tab.navigateTo('/pages/mine/info/edit')
},
handleToSetting() {
this.$tab.navigateTo('/pages/mine/setting/index')
},
handleToLogin() {
this.$tab.reLaunch('/pages/login')
},
handleToAvatar() {
this.$tab.navigateTo('/pages/mine/avatar/index')
},
handleHelp() {
this.$tab.navigateTo('/pages/mine/help/index')
},
handleAbout() {
this.$tab.navigateTo('/pages/mine/about/index')
},
handleJiaoLiuQun() {
this.$modal.showToast('QQ群①133713780(满)、②146013835(满)、③189091635')
},
handleBuilding() {
this.$modal.showToast('模块建设中~')
}
}
<script setup>
import store from '@/store'
import { computed , getCurrentInstance } from "vue"
const { proxy } = getCurrentInstance()
const name = store.state.user.name
const version= getApp().globalData.config.appInfo.version
const avatar = computed(() => store.state.user.avatar)
const windowHeight = computed(() => uni.getSystemInfoSync().windowHeight - 50)
function handleToInfo() {
proxy.$tab.navigateTo('/pages/mine/info/index')
}
function handleToEditInfo() {
proxy.$tab.navigateTo('/pages/mine/info/edit')
}
function handleToSetting() {
proxy.$tab.navigateTo('/pages/mine/setting/index')
}
function handleToLogin() {
proxy.$tab.reLaunch('/pages/login')
}
function handleToAvatar() {
proxy.$tab.navigateTo('/pages/mine/avatar/index')
}
function handleHelp() {
proxy.$tab.navigateTo('/pages/mine/help/index')
}
function handleAbout() {
proxy.$tab.navigateTo('/pages/mine/about/index')
}
function handleJiaoLiuQun() {
proxy.$modal.showToast('QQ群①133713780(满)、②146013835(满)、③189091635')
}
function handleBuilding() {
proxy.$modal.showToast('模块建设中~')
}
</script>

View File

@@ -20,75 +20,72 @@
</view>
</template>
<script>
<script setup>
import { getUserProfile } from "@/api/system/user"
import { updateUserProfile } from "@/api/system/user"
import { ref , getCurrentInstance } from "vue"
import { onReady } from "@dcloudio/uni-app"
export default {
data() {
return {
user: {
nickName: "",
phonenumber: "",
email: "",
sex: ""
},
sexs: [{
text: '男',
value: "0"
}, {
text: '女',
value: "1"
}],
rules: {
nickName: {
rules: [{
required: true,
errorMessage: '用户昵称不能为空'
}]
},
phonenumber: {
rules: [{
required: true,
errorMessage: '手机号码不能为空'
}, {
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
errorMessage: '请输入正确的手机号码'
}]
},
email: {
rules: [{
required: true,
errorMessage: '邮箱地址不能为空'
}, {
format: 'email',
errorMessage: '请输入正确的邮箱地址'
}]
}
}
}
const { proxy } = getCurrentInstance()
const user = ref({
nickName: "",
phonenumber: "",
email: "",
sex: ""
})
const sexs = [{
text: '男',
value: "0"
}, {
text: '女',
value: "1"
}]
const rules = ref({
nickName: {
rules: [{
required: true,
errorMessage: '用户昵称不能为空'
}]
},
onLoad() {
this.getUser()
phonenumber: {
rules: [{
required: true,
errorMessage: '手机号码不能为空'
}, {
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
errorMessage: '请输入正确的手机号码'
}]
},
onReady() {
this.$refs.form.setRules(this.rules)
},
methods: {
getUser() {
getUserProfile().then(response => {
this.user = response.data
})
},
submit(ref) {
this.$refs.form.validate().then(res => {
updateUserProfile(this.user).then(response => {
this.$modal.msgSuccess("修改成功")
})
})
}
email: {
rules: [{
required: true,
errorMessage: '邮箱地址不能为空'
}, {
format: 'email',
errorMessage: '请输入正确的邮箱地址'
}]
}
})
function getUser() {
getUserProfile().then(response => {
user.value = response.data
})
}
function submit(ref) {
proxy.$refs.form.validate().then(res => {
updateUserProfile(user.value).then(response => {
proxy.$modal.msgSuccess("修改成功")
})
})
}
onReady(() => {
proxy.$refs.form.setRules(rules.value)
})
getUser()
</script>
<style lang="scss" scoped>

View File

@@ -11,30 +11,23 @@
</view>
</template>
<script>
<script setup>
import { getUserProfile } from "@/api/system/user"
import { ref, reactive } from "vue"
export default {
data() {
return {
user: {},
roleGroup: "",
postGroup: ""
}
},
onLoad() {
this.getUser()
},
methods: {
getUser() {
getUserProfile().then(response => {
this.user = response.data
this.roleGroup = response.roleGroup
this.postGroup = response.postGroup
})
}
}
const user = ref({})
const roleGroup = ref("")
const postGroup = ref("")
function getUser() {
getUserProfile().then(response => {
user.value = response.data
roleGroup.value = response.roleGroup
postGroup.value = response.postGroup
})
}
getUser()
</script>
<style lang="scss">

View File

@@ -15,61 +15,55 @@
</view>
</template>
<script>
<script setup>
import { updateUserPwd } from "@/api/system/user"
import { ref, reactive , getCurrentInstance } from "vue"
import { onReady } from "@dcloudio/uni-app"
export default {
data() {
return {
user: {
oldPassword: undefined,
newPassword: undefined,
confirmPassword: undefined
},
rules: {
oldPassword: {
rules: [{
required: true,
errorMessage: '旧密码不能为空'
}]
},
newPassword: {
rules: [{
required: true,
errorMessage: '新密码不能为空',
},
{
minLength: 6,
maxLength: 20,
errorMessage: '长度在 6 到 20 个字符'
}
]
},
confirmPassword: {
rules: [{
required: true,
errorMessage: '确认密码不能为空'
}, {
validateFunction: (rule, value, data) => data.newPassword === value,
errorMessage: '两次输入的密码不一致'
}
]
}
}
}
const { proxy } = getCurrentInstance()
const user = reactive({
oldPassword: undefined,
newPassword: undefined,
confirmPassword: undefined
})
const rules = ref({
oldPassword: {
rules: [{
required: true,
errorMessage: '旧密码不能为空'
}]
},
onReady() {
this.$refs.form.setRules(this.rules)
newPassword: {
rules: [{
required: true,
errorMessage: '新密码不能为空',
}, {
minLength: 6,
maxLength: 20,
errorMessage: '长度在 6 到 20 个字符'
}]
},
methods: {
submit() {
this.$refs.form.validate().then(res => {
updateUserPwd(this.user.oldPassword, this.user.newPassword).then(response => {
this.$modal.msgSuccess("修改成功")
})
})
}
confirmPassword: {
rules: [{
required: true,
errorMessage: '确认密码不能为空'
}, {
validateFunction: (rule, value, data) => user.newPassword === value,
errorMessage: '两次输入的密码不一致'
}]
}
})
onReady(() => {
proxy.$refs.form.setRules(rules.value)
})
function submit() {
proxy.$refs.form.validate().then(res => {
updateUserPwd(user.oldPassword, user.newPassword).then(response => {
proxy.$modal.msgSuccess("修改成功")
})
})
}
</script>

View File

@@ -30,31 +30,31 @@
</view>
</template>
<script>
export default {
data() {
return {
windowHeight: uni.getSystemInfoSync().windowHeight
}
},
methods: {
handleToPwd() {
this.$tab.navigateTo('/pages/mine/pwd/index')
},
handleToUpgrade() {
this.$modal.showToast('模块建设中~')
},
handleCleanTmp() {
this.$modal.showToast('模块建设中~')
},
handleLogout() {
this.$modal.confirm('确定注销并退出系统吗?').then(() => {
this.$store.dispatch('LogOut').then(() => {}).finally(()=>{
this.$tab.reLaunch('/pages/index')
})
})
}
}
<script setup>
import store from '@/store'
import { ref, computed , getCurrentInstance } from "vue"
const { proxy } = getCurrentInstance()
const windowHeight = computed(() => uni.getSystemInfoSync().windowHeight - 50)
function handleToPwd() {
proxy.$tab.navigateTo('/pages/mine/pwd/index')
}
function handleToUpgrade() {
proxy.$modal.showToast('模块建设中~')
}
function handleCleanTmp() {
proxy.$modal.showToast('模块建设中~')
}
function handleLogout() {
proxy.$modal.confirm('确定注销并退出系统吗?').then(() => {
store.dispatch('LogOut').then(() => {}).finally(()=>{
proxy.$tab.reLaunch('/pages/index')
})
})
}
</script>