Browse Source

fix: bug修复;

pull/9/head
Fox-33 1 month ago
parent
commit
afa3860594
7 changed files with 61 additions and 27 deletions
  1. +6
    -1
      pages/index/center.vue
  2. +11
    -7
      pages_order/article/index.vue
  3. +3
    -1
      pages_order/article/search.vue
  4. +14
    -1
      pages_order/auth/roleChoose.vue
  5. +0
    -1
      pages_order/auth/wxUserInfo.vue
  6. +2
    -0
      pages_order/components/agreementModal.vue
  7. +25
    -16
      store/store.js

+ 6
- 1
pages/index/center.vue View File

@ -18,7 +18,10 @@
<view class="user-info"> <view class="user-info">
<view class="flex user-info-name"> <view class="flex user-info-name">
<view class="highligt" v-if="userInfo.nickName">{{ userInfo.nickName || '' }}</view> <view class="highligt" v-if="userInfo.nickName">{{ userInfo.nickName || '' }}</view>
<view class="light">{{ `ID:${userInfo.id}` }}</view>
<view class="flex light" @click="$utils.copyText(userInfo.id)">
<view>{{ `ID:${userInfo.id}` }}</view>
<uv-icon name="file-text" color="#FFFFFF" size="28rpx"></uv-icon>
</view>
</view> </view>
<view class="user-info-desc" v-if="userInfo.phone">{{ `手机号${userInfo.phone}` }}</view> <view class="user-info-desc" v-if="userInfo.phone">{{ `手机号${userInfo.phone}` }}</view>
</view> </view>
@ -246,6 +249,8 @@
.light { .light {
font-size: 24rpx; font-size: 24rpx;
justify-content: flex-start;
column-gap: 8rpx;
} }
} }


+ 11
- 7
pages_order/article/index.vue View File

@ -2,10 +2,10 @@
<view class="page__view"> <view class="page__view">
<!-- 导航栏 --> <!-- 导航栏 -->
<navbar :title="details.title" leftClick @leftClick="$utils.navigateBack" bgColor="#FFFFFF" />
<navbar :title="title" leftClick @leftClick="$utils.navigateBack" bgColor="#FFFFFF" />
<!-- <image class="img" :src="details.details" mode="widthFix"></image> --> <!-- <image class="img" :src="details.details" mode="widthFix"></image> -->
<uv-parse :content="details.details"></uv-parse>
<uv-parse :content="content"></uv-parse>
</view> </view>
</template> </template>
@ -14,16 +14,20 @@
export default { export default {
data() { data() {
return { return {
details: {},
title: '',
content: '',
} }
}, },
onLoad({ api, id, idKey }) {
this.getData(api, id, idKey)
onLoad({ api, id, idKey, contentKey }) {
this.getData(api, id, idKey, contentKey)
}, },
methods: { methods: {
async getData(api, id, idKey) {
async getData(api, id, idKey, contentKey) {
try { try {
this.details = await this.$fetch(api, { [idKey]: id })
const result = await this.$fetch(api, { [idKey]: id })
this.title = result.title
this.content = result[contentKey]
} catch (err) { } catch (err) {
console.log('err', err) console.log('err', err)
} }


+ 3
- 1
pages_order/article/search.vue View File

@ -81,6 +81,7 @@
jumpToDetail(id) { jumpToDetail(id) {
let api let api
let idKey let idKey
let contentKey = 'details'
switch(this.mixinsListApi) { switch(this.mixinsListApi) {
case 'queryNewsList': case 'queryNewsList':
@ -94,13 +95,14 @@
case 'queryJournalList': case 'queryJournalList':
api = 'queryJournalById', api = 'queryJournalById',
idKey = 'journalId' idKey = 'journalId'
contentKey = 'content'
break break
default: default:
break break
} }
uni.navigateTo({ uni.navigateTo({
url: `/pages_order/article/index?api=${api}&id=${id}&idKey=${idKey}`
url: `/pages_order/article/index?api=${api}&id=${id}&idKey=${idKey}&contentKey=${contentKey}`
}) })
}, },
}, },


+ 14
- 1
pages_order/auth/roleChoose.vue View File

@ -6,7 +6,13 @@
<view class="card"> <view class="card">
<view class="card-header">角色信息</view> <view class="card-header">角色信息</view>
<view class="card-content"> <view class="card-content">
<uv-radio-group v-model="role" placement="column" activeColor="#00A9FF">
<uv-radio-group
v-model="role"
placement="column"
size="36rpx"
iconSize="36rpx"
activeColor="#00A9FF"
>
<view class="flex option" v-for="item in roleOptions" :key="item.id" @click="onSelect(item.value)"> <view class="flex option" v-for="item in roleOptions" :key="item.id" @click="onSelect(item.value)">
<view> <view>
<uv-radio :name="item.value"></uv-radio> <uv-radio :name="item.value"></uv-radio>
@ -48,7 +54,14 @@
}, },
async onConfirm() { async onConfirm() {
try { try {
const {
nickName,
phone,
} = this.userInfo
const params = { const params = {
nickName,
phone,
role: this.role role: this.role
} }


+ 0
- 1
pages_order/auth/wxUserInfo.vue View File

@ -184,7 +184,6 @@
uni.reLaunch({ uni.reLaunch({
url:'/pages/index/index' url:'/pages/index/index'
}) })
this.$store.commit('getUserInfo')
}, 800) }, 800)
} }


+ 2
- 0
pages_order/components/agreementModal.vue View File

@ -68,6 +68,8 @@ export default {
.content { .content {
padding: 8rpx 32rpx 40rpx 32rpx; padding: 8rpx 32rpx 40rpx 32rpx;
max-height: 70vh;
overflow-y: scroll;
font-size: 28rpx; font-size: 28rpx;
font-family: PingFang SC; font-family: PingFang SC;
font-weight: 400; font-weight: 400;


+ 25
- 16
store/store.js View File

@ -6,6 +6,24 @@ Vue.use(Vuex); //vue的插件机制
import api from '@/api/api.js' import api from '@/api/api.js'
import fetch from '@/api/fetch.js' import fetch from '@/api/fetch.js'
const setUserInfo = (state, data) => {
const userInfo = data
switch (userInfo.role) {
case '0':
userInfo.roleDesc = '家长'
break
case '1':
userInfo.roleDesc = '学生'
break
default:
break
}
state.userInfo = userInfo
}
//Vuex.Store 构造器选项 //Vuex.Store 构造器选项
const store = new Vuex.Store({ const store = new Vuex.Store({
state: { state: {
@ -86,7 +104,11 @@ const store = new Vuex.Store({
uni.navigateTo({ uni.navigateTo({
url: '/pages_order/auth/wxUserInfo' url: '/pages_order/auth/wxUserInfo'
}) })
}else{
} else if (!state.userInfo.role) {
uni.navigateTo({
url: '/pages_order/auth/roleChoose'
})
} else {
uni.navigateBack(-1) uni.navigateBack(-1)
} }
}) })
@ -97,21 +119,8 @@ const store = new Vuex.Store({
getUserInfo(state){ getUserInfo(state){
api('getInfo', res => { api('getInfo', res => {
if(res.code == 200){ if(res.code == 200){
const result = res.result
switch (result.role) {
case '0':
result.roleDesc = '家长'
break
case '1':
result.roleDesc = '学生'
break
default:
break
}
state.userInfo = result
setUserInfo(state, res.result)
if (!state.userInfo.role) { if (!state.userInfo.role) {
uni.navigateTo({ uni.navigateTo({
url: '/pages_order/auth/roleChoose' url: '/pages_order/auth/roleChoose'


Loading…
Cancel
Save