2 Commits

7 changed files with 61 additions and 27 deletions
Split View
  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="flex user-info-name">
<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 class="user-info-desc" v-if="userInfo.phone">{{ `手机号${userInfo.phone}` }}</view>
</view>
@ -246,6 +249,8 @@
.light {
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">
<!-- 导航栏 -->
<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> -->
<uv-parse :content="details.details"></uv-parse>
<uv-parse :content="content"></uv-parse>
</view>
</template>
@ -14,16 +14,20 @@
export default {
data() {
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: {
async getData(api, id, idKey) {
async getData(api, id, idKey, contentKey) {
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) {
console.log('err', err)
}


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

@ -81,6 +81,7 @@
jumpToDetail(id) {
let api
let idKey
let contentKey = 'details'
switch(this.mixinsListApi) {
case 'queryNewsList':
@ -94,13 +95,14 @@
case 'queryJournalList':
api = 'queryJournalById',
idKey = 'journalId'
contentKey = 'content'
break
default:
break
}
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-header">角色信息</view>
<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>
<uv-radio :name="item.value"></uv-radio>
@ -48,7 +54,14 @@
},
async onConfirm() {
try {
const {
nickName,
phone,
} = this.userInfo
const params = {
nickName,
phone,
role: this.role
}


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

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


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

@ -68,6 +68,8 @@ export default {
.content {
padding: 8rpx 32rpx 40rpx 32rpx;
max-height: 70vh;
overflow-y: scroll;
font-size: 28rpx;
font-family: PingFang SC;
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 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 构造器选项
const store = new Vuex.Store({
state: {
@ -86,7 +104,11 @@ const store = new Vuex.Store({
uni.navigateTo({
url: '/pages_order/auth/wxUserInfo'
})
}else{
} else if (!state.userInfo.role) {
uni.navigateTo({
url: '/pages_order/auth/roleChoose'
})
} else {
uni.navigateBack(-1)
}
})
@ -97,21 +119,8 @@ const store = new Vuex.Store({
getUserInfo(state){
api('getInfo', res => {
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) {
uni.navigateTo({
url: '/pages_order/auth/roleChoose'


Loading…
Cancel
Save