xiaobo 2 months ago
parent
commit
e6a9078f1c
5 changed files with 68 additions and 29 deletions
  1. +1
    -2
      api/api.js
  2. +4
    -4
      api/http.js
  3. +11
    -0
      api/model/zhaomu.js
  4. +48
    -10
      pages/index/member.vue
  5. +4
    -13
      store/store.js

+ 1
- 2
api/api.js View File

@ -1,11 +1,10 @@
import http from './http.js' import http from './http.js'
import utils from '../utils/utils.js' import utils from '../utils/utils.js'
let limit = {} let limit = {}
let debounce = {} let debounce = {}
const models = ['login', 'index', 'vip', 'info']
const models = ['login', 'index', 'vip', 'info','zhaomu']
const config = { const config = {
// 示例 // 示例


+ 4
- 4
api/http.js View File

@ -1,7 +1,7 @@
import Vue from 'vue' import Vue from 'vue'
import utils from '../utils/utils.js' import utils from '../utils/utils.js'
import store from '../store/store.js'
function http(uri, data, callback, method = 'GET', showLoading, title) { function http(uri, data, callback, method = 'GET', showLoading, title) {
@ -20,7 +20,7 @@ function http(uri, data, callback, method = 'GET', showLoading, title) {
'Content-Type' : 'application/x-www-form-urlencoded' 'Content-Type' : 'application/x-www-form-urlencoded'
}, },
success: (res) => { success: (res) => {
console.log(res,'res')
if(showLoading){ if(showLoading){
uni.hideLoading(); uni.hideLoading();
} }
@ -28,9 +28,9 @@ function http(uri, data, callback, method = 'GET', showLoading, title) {
if(res.statusCode == 401 || if(res.statusCode == 401 ||
res.data.message == '操作失败,token非法无效!' || res.data.message == '操作失败,token非法无效!' ||
res.data.message == '操作失败,用户不存在!'){ res.data.message == '操作失败,用户不存在!'){
uni.removeStorageSync('token')
store.commit('logout')
console.error('登录过期'); console.error('登录过期');
utils.toLogin()
// utils.toLogin()
} }
if(res.statusCode == 200 && res.data.code != 200 if(res.statusCode == 200 && res.data.code != 200


+ 11
- 0
api/model/zhaomu.js View File

@ -0,0 +1,11 @@
const api = {
// 招募订单
recruitPageList: {
url: '/popularize-admin/shop_common/getRecruitPageList',
method: 'GET',
},
}
export default api

+ 48
- 10
pages/index/member.vue View File

@ -5,19 +5,19 @@
<view class="content"> <view class="content">
<view class="search-box"> <view class="search-box">
<view class="search-box-r"> <view class="search-box-r">
<uv-search placeholder="搜索感兴趣的活动" v-model="keyword" shape="square" :showAction="false" color="#fff" placeholderColor="#BDABAC" :clearabled="false" searchIconColor="#fff" searchIconSize="50rpx" bgColor="#4A2A2B" height="63rpx"></uv-search>
<uv-search placeholder="搜索感兴趣的活动" v-model="params.title" shape="square" :showAction="false" color="#fff" placeholderColor="#BDABAC" :clearabled="false" searchIconColor="#fff" searchIconSize="50rpx" bgColor="#4A2A2B" height="63rpx"></uv-search>
</view> </view>
</view> </view>
<view class="user-box">
<uv-avatar src="https://via.placeholder.com/200x200.png/2878ff" size="98rpx" shape="circle"></uv-avatar>
<view class="user-box" @click="toInfo">
<uv-avatar :src="userInfo.headImage" size="98rpx" shape="circle"></uv-avatar>
<view class="user-msg"> <view class="user-msg">
<view class="user-msg-top"> <view class="user-msg-top">
<view>点击授权登录</view>
<view class="level-box">普通用户</view>
<view> {{token ? userInfo.nickName : '请点击登录'}}</view>
<!-- <view class="level-box">普通用户</view> -->
</view> </view>
<view class="id-box"> <view class="id-box">
<text>ID:000001</text>
<text class="copy-text">复制</text>
<text>{{token ? userInfo.id : ''}}</text>
<text class="copy-text" @click="copy" v-if="token">复制</text>
</view> </view>
</view> </view>
</view> </view>
@ -50,7 +50,7 @@
<script> <script>
import tabber from '@/components/base/tabbar.vue' import tabber from '@/components/base/tabbar.vue'
import zhaomuItem from '@/components/zhaomu/zhaomu-item.vue' import zhaomuItem from '@/components/zhaomu/zhaomu-item.vue'
import { mapState } from 'vuex'
import { mapState,mapGetters } from 'vuex'
export default { export default {
components: { components: {
tabber, tabber,
@ -58,15 +58,23 @@
}, },
data() { data() {
return { return {
params:{
title:'',
pageNo:1,
pageSize:10
},
bgColor:'transparent', bgColor:'transparent',
list: [ list: [
'https://cdn.uviewui.com/uview/swiper/swiper3.png', 'https://cdn.uviewui.com/uview/swiper/swiper3.png',
] ]
}; };
}, },
computed : {
computed: {
...mapState(['token']),
...mapGetters(["userInfo"]),
}, },
onLoad({leftClick}) {
onLoad() {
this.getList()
}, },
onShow() { onShow() {
@ -79,10 +87,39 @@
} }
}, },
methods:{ methods:{
getList() {
this.$api('recruitPageList',this.params,res=>{
if(res.code == 200) {
}
})
},
toRenzheng() { toRenzheng() {
uni.navigateTo({ uni.navigateTo({
url:'/pages_zlx/zlx-form' url:'/pages_zlx/zlx-form'
}) })
},
toInfo() {
if(!this.token) {
uni.navigateTo({
url:'/pages_login/wxLogin'
})
}else{
uni.navigateTo({
url:'/pages_my/user-info'
})
}
},
copy() {
uni.setClipboardData({
data:this.userInfo.id,
success: () => {
uni.showToast({
title:'复制成功',
icon:'none'
})
}
})
} }
} }
} }
@ -101,6 +138,7 @@
width: 100%; width: 100%;
height: 534rpx; height: 534rpx;
position: absolute; position: absolute;
z-index: -1;
} }
.content { .content {
padding: 0 30rpx; padding: 0 30rpx;


+ 4
- 13
store/store.js View File

@ -99,19 +99,10 @@ const store = new Vuex.Store({
}, },
// 退出登录 // 退出登录
logout(state){ logout(state){
uni.showModal({
title: '确认退出登录吗',
success(r) {
if(r.confirm){
state.userInfo = {}
state.role = false
uni.removeStorageSync('token')
uni.reLaunch({
url: '/pages/index/index'
})
}
}
})
state.userInfo = {}
state.role = false
state.token = ""
uni.removeStorageSync('token')
}, },
// 查询分类接口 // 查询分类接口
getCategoryList(state){ getCategoryList(state){


Loading…
Cancel
Save