2 Commits

Author SHA1 Message Date
  xiaobo 0f116d3b68 2 2 months ago
  xiaobo e6a9078f1c 1 2 months ago
5 changed files with 68 additions and 29 deletions
Split View
  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 utils from '../utils/utils.js'
let limit = {}
let debounce = {}
const models = ['login', 'index', 'vip', 'info', 'order']
const models = ['login', 'index', 'vip', 'info', 'order','zhaomu']
const config = {
// 示例


+ 4
- 4
api/http.js View File

@ -1,7 +1,7 @@
import Vue from 'vue'
import utils from '../utils/utils.js'
import store from '../store/store.js'
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'
},
success: (res) => {
console.log(res,'res')
if(showLoading){
uni.hideLoading();
}
@ -28,9 +28,9 @@ function http(uri, data, callback, method = 'GET', showLoading, title) {
if(res.statusCode == 401 ||
res.data.message == '操作失败,token非法无效!' ||
res.data.message == '操作失败,用户不存在!'){
uni.removeStorageSync('token')
store.commit('logout')
console.error('登录过期');
utils.toLogin()
// utils.toLogin()
}
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="search-box">
<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 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-top">
<view>点击授权登录</view>
<view class="level-box">普通用户</view>
<view> {{token ? userInfo.nickName : '请点击登录'}}</view>
<!-- <view class="level-box">普通用户</view> -->
</view>
<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>
@ -50,7 +50,7 @@
<script>
import tabber from '@/components/base/tabbar.vue'
import zhaomuItem from '@/components/zhaomu/zhaomu-item.vue'
import { mapState } from 'vuex'
import { mapState,mapGetters } from 'vuex'
export default {
components: {
tabber,
@ -58,15 +58,23 @@
},
data() {
return {
params:{
title:'',
pageNo:1,
pageSize:10
},
bgColor:'transparent',
list: [
'https://cdn.uviewui.com/uview/swiper/swiper3.png',
]
};
},
computed : {
computed: {
...mapState(['token']),
...mapGetters(["userInfo"]),
},
onLoad({leftClick}) {
onLoad() {
this.getList()
},
onShow() {
@ -79,10 +87,39 @@
}
},
methods:{
getList() {
this.$api('recruitPageList',this.params,res=>{
if(res.code == 200) {
}
})
},
toRenzheng() {
uni.navigateTo({
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%;
height: 534rpx;
position: absolute;
z-index: -1;
}
.content {
padding: 0 30rpx;


+ 4
- 13
store/store.js View File

@ -99,19 +99,10 @@ const store = new Vuex.Store({
},
// 退出登录
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){


Loading…
Cancel
Save