This commit is contained in:
Gdpao 2020-08-05 21:06:29 +08:00
parent a47238a7a4
commit c4c11781fb
15 changed files with 305 additions and 159 deletions

21
App.vue
View File

@ -1,6 +1,9 @@
<script>
import { mapMutations } from 'vuex';
import { mapMutations, mapState } from 'vuex';
export default {
computed: {
...mapState(["hasLogin"])
},
onLaunch() {
// token
uni.getStorage({
@ -9,9 +12,23 @@
this.loginIn(res.data);
}
})
// token
if (this.hasLogin) {
this.refreshToken_function();
}
},
methods: {
...mapMutations(['loginIn'])
...mapMutations(['loginIn']),
// token
refreshToken_function(){
this.$u.api.refreshToken({}).then((res) => {
// console.log(res);
if (res.errCode == 0) {
let token = res.data.token;
uni.setStorageSync('token', token);//toke
}
})
},
}
}
</script>

View File

@ -3,8 +3,8 @@ const install = (Vue, vm) => {
Vue.prototype.$u.http.setConfig({
baseUrl: 'https://dmmall.sdbairui.com/api',
loadingText: '努力加载中~',
loadingTime: 800
loadingTime: 800,
// originalData: true
});
// 请求拦截配置Token等参数
@ -17,6 +17,28 @@ const install = (Vue, vm) => {
return config;
}
// 响应拦截,如配置,每次请求结束都会执行本方法
Vue.prototype.$u.http.interceptor.response = (res) => {
if(parseInt(res.errCode) == 0) {
// res为服务端返回值可能有errCoderesult等字段
// 这里对res.result进行返回将会在this.$u.post(url).then(res => {})的then回调中的res的到
// 如果配置了originalData为true请留意这里的返回值
return res;
} else if(res.errCode == 401) {
// 假设201为token失效这里跳转登录
vm.$u.toast('验证失败,请重新登录');
setTimeout(() => {
// 此为uView的方法详见路由相关文档
vm.$u.route('/pageA/login/login')
}, 1500)
return false;
} else {
// 如果返回false则会调用Promise的reject回调
// 并将进入this.$u.post(url).then().catch(res=>{})的catch回调中res为服务端的返回值
return false;
}
}
}

View File

@ -1,6 +1,6 @@
<template>
<view class="daren-item" @click="toDetailsPage">
<image class="head" :src="info.member_avatar"></image>
<view class="daren-item">
<image class="head" @click="toDetailsPage" :src="info.member_avatar"></image>
<text class="name">{{ info.member_nickname }}</text>
<text class="zhuangtai">状态: {{ info.live_status == 1 ? '正在直播' : '未开播' }}</text>
<view class="guanzhu action" @tap="changeType(info.member_id)" v-if="info.is_attention == 1">已关注</view>
@ -8,17 +8,31 @@
</view>
</template>
<script>
import { mapState } from 'vuex';
export default {
name:"daren-item",
props: {
info: Object,
},
computed: {
...mapState(["login","hasLogin"]),
},
watch: {
info(newVal, old) {
// console.log(newVal);
},
deep: true
},
methods: {
toDetailsPage() {
//
const toke = uni.getStorageSync('token');
if (toke) {
console.log(toke);
// console.log();
if (this.hasLogin) {
this.$u.route({
url: "/pageB/details/index",
params: {
id: this.info.member_id
}
});
}else{
uni.navigateTo({
url: '/pageA/login/login'
@ -32,8 +46,8 @@ export default {
// })
},
changeType:function(type){
console.log("111")
this.$emit("pChangeType",type)
// console.log("111")
this.$emit("pChangeType",type);
},
},

View File

@ -37,12 +37,13 @@
</template>
<style lang="scss" scoped>
.video-item{
margin-top: 20rpx;
flex-shrink: 0;
width: 335rpx;
box-shadow:0 3rpx 7rpx 0 rgba(153, 153, 153, 0.35);
padding-bottom: 20rpx;
border-radius: 20rpx;
margin-top: 20rpx;
overflow: hidden;
border-radius: 20rpx;
box-shadow:0 3rpx 7rpx 0 rgba(153, 153, 153, 0.35);
.head{
width: 100%;
height: 334rpx;
@ -195,29 +196,40 @@ export default {
// console.log(this.item);
this.show = -1;
},
watch: {
item(newVal, old) {
// console.log(newVal);
this.item = newVal;
},
deep: true
},
methods: {
showAction() {
this.show = this.show > 0 ? -1 : this.item.article_id;
},
//
articleLike() {
this.item.is_like = !this.item.is_like;
this.$u.api.articleLike({
article_id: this.item.article_id,
}).then(res => {
console.log(res)
if(res.errCode == 0) {
this.$u.toast(res.message);
this.$emit("getArticlelist");
// this.$emit("getArticlelist");
}
})
},
//
articleCollect() {
this.item.is_collect = !this.item.is_collect;
this.$u.api.articleCollect({
article_id: this.item.article_id,
}).then(res => {
console.log(res);
if(res.errCode == 0) {
this.$u.toast(res.message);
this.$emit("getArticlelist");
// this.$emit("getArticlelist");
}
})
},

View File

@ -1,7 +1,7 @@
<template>
<view id="info_title">
<view>
<view class="url_info" v-for="(item,index) in list" :key="index" @click="route_skip(index)">
<view class="url_info" v-for="(item,index) in information" :key="index" @click="route_skip(index)">
<image :src="item.url"></image>
<text>{{item.text}}</text>
</view>
@ -56,33 +56,15 @@
props:['information'],
name: "info_title",
data() {
return {
list: [{
id: 0,
url: '../../static/pageD/info(11).png',
text: '公告/资讯'
},
{
id: 0,
url: '../../static/pageD/info(6).png',
text: '活动消息'
},
{
id: 0,
url: '../../static/pageD/info(14).png',
text: '交易物流'
},
{
id: 0,
url: '../../static/pageD/info(15).png',
text: '关注消息'
},
],
}
},
watch: {
information(newVal, old) {
console.log(newVal);
},
deep: true
},
methods: {
//
route_skip(index) {

View File

@ -187,19 +187,9 @@
rgb.push(color)
}
return '#' + rgb.join('')
},
refreshToken_function(){
this.$u.api.refreshToken({}).then((res) => {
console.log(res)
if (res.errCode == 0) {
let token = res.data.token;
uni.setStorageSync('token', token);//toke
}
})
}
},
mounted() {
this.refreshToken_function();
// 3
this.remaining_time();
this.apiwelcome();

View File

@ -1,6 +1,6 @@
<template>
<view class="item" @click="toDetailsPage">
<image class="head" :src="info.pintuan_image"></image>
<image class="head" :src="info.pintuan_image" mode="widthFix"></image>
<text class="title u-line-1">{{ info.pintuan_goods_name }}</text>
<view class="price">
<view>{{ info.pintuan_goods_price }}</view>
@ -47,9 +47,9 @@ export default {
width: 210rpx;
overflow: hidden;
.head{
width: 210rpx;
height: 131rpx;
border-radius: 6rpx;
width: 150rpx;
height: 150rpx;
border-radius: 10rpx;
}
.title{
display: inline-block;

View File

@ -18,7 +18,7 @@
</view>
<!-- 服务协议 -->
<view class="pact">
<view class="pact" v-if="0">
<view>
<view></view>
<text>我已详细阅读并同意</text>

View File

@ -19,7 +19,7 @@ export default {
console.log(option)
//
let typeIindex = option.index;
this.typeIndexRquest(typeIindex)
this.typeIndexRquest(typeIindex);
},
methods: {
typeIndexRquest(typeIindex){
@ -28,16 +28,22 @@ export default {
this.$u.api.documentInfo({
document_code: 'agreement'
}).then((res)=>{
console.log(res)
// console.log(res.data.document_title);
uni.setNavigationBarTitle({
title: res.data.document_title
})
let data = common.unescapeHTML(res.data.document_content);
this.document_content = data
this.document_content = data;
})
}
if(typeIindex == 1){
this.$u.api.documentInfo({
document_code: 'privacy'
}).then((res)=>{
console.log(res)
// console.log(res.data.document_title);
uni.setNavigationBarTitle({
title: res.data.document_title
})
let data = common.unescapeHTML(res.data.document_content);
this.document_content = data
})
@ -46,7 +52,10 @@ export default {
this.$u.api.documentInfo({
document_code: 'use'
}).then((res)=>{
console.log(res)
// console.log(res.data.document_title);
uni.setNavigationBarTitle({
title: res.data.document_title
})
let data = common.unescapeHTML(res.data.document_content);
this.document_content = data
})

View File

@ -1,27 +1,29 @@
<template>
<view class="userinfo">
<view class="user">
<view class="info">
<image></image>
<view>
<text>达人昵称</text>
<text>关注数量</text>
<view class="avatar">
<image :src="item.member_avatar"></image>
</view>
<view class="box">
<view class="name">{{ item.member_nickname }}</view>
<view class="num">
<text>粉丝数{{ item.fans_num }}</text>
<text>评论数{{ item.comment_num }}</text>
</view>
</view>
</view>
<view class="guanzhu">关注</view>
<view class="btn" :class="[ is_follow ? 'btn-follow' : 'btn-unfollow' ]" @click="following">{{ is_follow ? "已关注" : "关注" }}</view>
</view>
<view class="profile">个性签名</view>
<view class="profile" :class="{'u-line-2': is_open }" @click="openPro">
个性签名{{ item.recommend ? item.recommend : "对方很懒没有留下任何东西~~" }}
</view>
</view>
</template>
<style lang="scss" scoped>
image{
background-color: #0f0;
}
.userinfo{
height: 261rpx;
width: 100%;
// height: 261rpx;
padding: 30rpx;
.user{
display: flex;
@ -31,53 +33,92 @@ image{
.info{
display: flex;
align-items: center;
>image{
width: 140rpx;
height: 140rpx;
border-radius: 50%;
.avatar {
&>image{
width: 140rpx;
height: 140rpx;
border-radius: 50%;
}
}
>view{
margin-left: 40rpx;
.box {
display: flex;
height: 79rpx;
justify-content: space-between;
flex-direction: column;
>text:first-child{
height: 79rpx;
margin-left: 40rpx;
color: #333;
.name {
font-size: 28rpx;
color:#333;
}
>text:last-child{
.num {
font-size: 24rpx;
color: #333;
& > :first-child {
margin-right: 20rpx;
}
}
}
}
.guanzhu{
.btn{
width: 140rpx;
height: 60rpx;
font-size: 26rpx;
color:#fff;
line-height: 60rpx;
border-radius: 30rpx;
background-color: #FF780F;
text-align: center;
color:#fff;
border-radius: 30rpx;
}
.btn-follow {
background-color: #007AFF;
}
.btn-unfollow {
background-color: #FF780F;
}
}
.profile{
margin-top: 19rpx;
margin-top: 20rpx;
font-size: 24rpx;
color: #333;
margin-left: 14rpx;
line-height: 1.2;
}
}
</style>
<script>
export default {
name:"userinfo",
props: ["list"],
data(){
return {
item: {},
is_open: true,
is_follow: false,
}
},
watch: {
list(newVal, old) {
// console.log(newVal);
this.item = newVal;
this.is_follow = newVal.is_attention;
},
deep: true
},
methods: {
//
openPro() {
this.is_open = !this.is_open;
},
//
following() {
this.$u.api.attentionMember({
member_id: this.item.member_id
}).then(res => {
console.log(res);
if (res.errCode == 0) {
this.is_follow = !this.is_follow;
this.$u.toast(res.message);
} else {
this.$u.toast(res.message);
}
})
}
}
}

View File

@ -1,7 +1,7 @@
<template>
<view class="details">
<view style="border-top: 1rpx solid #ececec;"></view>
<userinfo></userinfo>
<userinfo :list="userInfo"></userinfo>
<view style="border-top: 20rpx solid #ececec;"></view>
<u-tabs :is-scroll="false" bar-width="70" ref="tabs" :list="list" :current="num" :bar-style="{
'background-color':'#FF780F',
@ -13,39 +13,15 @@
}"
:bold="false"
@change="dianji"
:show-bar="false"></u-tabs>
<swiper class="card" @change="dianji" :current="num">
<swiper-item>
<scroll-view style="width:100%;height:100%" scroll-y="true">
<view class="box">
<view class="list">
<view >
<videoItem v-for="item in 10" :key="index"></videoItem>
</view>
<view style="margin-left:20rpx">
<videoItem v-for="item in 10" :key="index"></videoItem>
</view>
</view>
</view>
</scroll-view>
</swiper-item>
<swiper-item>
<scroll-view style="width:100%;height:100%" scroll-y="true">
<view class="box">
<view class="list">
<view >
<zhiboItem v-for="item in 10" :key="index"></zhiboItem>
</view>
<view style="margin-left:20rpx">
<zhiboItem v-for="item in 10" :key="index"></zhiboItem>
</view>
</view>
</view>
</scroll-view>
</swiper-item>
</swiper>
:show-bar="false">
</u-tabs>
<scroll-view class="scroll-box" scroll-y="true">
<view class="box">
<videoItem v-for="item in listInfo" :key="item.article_id" :item="item"
@getArticlelist="getArticlelist"></videoItem>
<view class="no-data" v-show="!listInfo && !page">暂无数据</view>
</view>
</scroll-view>
</view>
</template>
<style lang="scss" scoped>
@ -61,39 +37,85 @@
display: flex;
}
}
.scroll-box {
// display: flex;
padding: 20rpx;
box-sizing: border-box;
.box {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
.no-data {
margin: 100rpx auto 0;
}
}
}
}
</style>
<script>
import videoItem from "@/components/index/video-item/index"
import zhiboItem from "@/components/index/zhibo-item/index"
import userinfo from "../components/details/userinfo"
import videoItem from "@/components/index/video-item/index"
export default {
name:"details",
// name:"details",
components:{
userinfo,
videoItem,
zhiboItem
videoItem
},
data(){
return {
list:[
{
name: '短视频'
}, {
name: '图文'
}, {
name: '短视频'
}
],
num:0
num: 0,
userInfo: {}, //
listInfo: [], //
member_id: 0,
page: 0,
}
},
onLoad(option) {
// console.log(option);
this.member_id = option.id;
this.getUserInfo(option.id);
this.getArticlelist();
},
methods:{
//
getUserInfo(id) {
this.$u.post("MemberExpert/expertInfo",{member_id: id}).then(res => {
// console.log(res);
this.userInfo = res.data.info;
// console.log(this.userInfo);
})
},
//
getArticlelist() {
this.$u.api.getArticlelist({
page: this.page,
is_video_img: this.num + 1,
member_id: this.member_id,
}).then(res => {
if (res.errCode == 0) {
// console.log(res);
this.listInfo = res.data.list;
console.log(this.listInfo);
} else {
console.log(res.message);
}
})
},
dianji(a){
console.log(a)
console.log(a);
if(typeof a == "object"){
this.num = a.detail.current
}else{
this.num = a
}
this.getArticlelist();
}
}
}

View File

@ -14,7 +14,7 @@
<text>图片</text>
<view v-for="(item,index) in list.photo" :key="index" :style="{'background-color':index == swiper_id ? '#fff' : '#ede8e8'}"></view>
</view>
<view class="username">{{ list.member_nickname }}</view>
<view class="username">@{{ list.member_nickname }}</view>
<view class="title">{{ list.article_title }}</view>
<view class="info">{{ list.article_content }}</view>
<view class="box">
@ -29,7 +29,7 @@
<text>评论</text>
<u-icon name="arrow-down" color="#333" size="28" @click="is_comment=false"></u-icon>
</view>
<scroll-view class="scroll-box" scroll-y="true" >
<scroll-view class="scroll-box" scroll-y="true" @scrolltolower="scrollBottom">
<block v-for="(item,index) in commentList" :key="index" v-if="commentList.length">
<view class="box">
<image :src="item.member_avatar" mode="aspectFill"></image>
@ -373,6 +373,7 @@ export default {
return {
list:{},
swiper_id: "",
page: 1, //
cart_type: false, //
is_comment: false, //
is_focus: false, //
@ -489,6 +490,10 @@ export default {
current: e.currentTarget.dataset.url,
})
},
//
scrollBottom(e) {
console.log(e);
},
//
gotoInfo(id) {
console.log(id);

View File

@ -84,7 +84,7 @@
{
"path": "follow/index",
"style": {
"navigationBarTitleText": "推荐达人列表",
"navigationBarTitleText": "推荐达人",
"app-plus":{
"titleNView":{
"backgroundColor":"#ffffff"
@ -95,7 +95,7 @@
{
"path": "details/index",
"style": {
"navigationBarTitleText": "",
"navigationBarTitleText": "达人详情",
"app-plus":{
"titleNView":{
"backgroundColor":"#ffffff"

View File

@ -61,7 +61,7 @@
<view></view>
<text>推荐达人</text>
</view>
<image class="right" src="/static/image/common/1.png"></image>
<u-icon name="arrow-right" color="#666" size="28"></u-icon>
</view>
<view class="tuijianlist">
<!-- <darenItem style="margin-right:23rpx"></darenItem>
@ -69,16 +69,12 @@
<darenItem v-for="item in recommendList.slice(0,3)" :key="item.id" :info="item" v-on:pChangeType="changeType"></darenItem>
</view>
</view>
<view class="list">
<view>
<!-- <videoItem isguanzhu="true" v-for="item in 10"></videoItem> -->
<videoItem isguanzhu="true" v-for="item in articleList.filter((_, index) => !(index&1))" :key="item.article_id"
:item="item" @getArticlelist="getArticlelist"></videoItem>
</view>
<view style="margin-left:20rpx">
<!-- <videoItem isguanzhu="true" v-for="item in 10"></videoItem> -->
<videoItem isguanzhu="true" v-for="item in articleList.filter((_, index) => index&1)" :key="item.article_id"
:item="item" @getArticlelist="getArticlelist"></videoItem>
<view class="rec-list">
<view class="rec-box">
<!-- {{ fansList }} -->
<videoItem isguanzhu="true" v-for="item in fansList" :key="item.article_id"
:item="item"></videoItem>
<view class="no-data" v-show="!fansList.length">您还没有关注哦赶紧去点点关注</view>
</view>
</view>
</view>
@ -181,6 +177,17 @@
}
}
}
.rec-list {
width: 100%;
.rec-box {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
.no-data {
margin: 200rpx auto 0;
}
}
}
}
</style>
<script>
@ -206,7 +213,8 @@
recommendList: [], //
indexImageSwiper: [],
zhiboImageSwiper: [],
tabLiveLists: []
tabLiveLists: [],
fansList: [], //
}
},
components: {
@ -221,18 +229,21 @@
this.getSwiper();
this.getZhiBoSwiper();
this.tabLiveList();
this.getFollowList();
},
onPullDownRefresh() {
this.getArticlelist();
// this.getManicureList({ load: 'reload' });
},
methods: {
//
tabLiveList() {
this.$u.api.tabLiveList().then((res) => {
console.log(res)
this.tabLiveLists = res.data
this.tabLiveLists = res.data;
})
},
//
getSwiper() {
this.$u.api.getIndexSwiper().then(res => {
if (res.errCode == 0) {
@ -240,14 +251,16 @@
}
})
},
//
changeType(member_id) {
console.log(member_id);
this.$emit("pChangeType")
// this.$emit("pChangeType");
this.$u.api.attentionMember({
member_id: member_id
}).then((res) => {
console.log(res)
this.getRecommendList();
this.getFollowList(); //
})
},
getZhiBoSwiper() {
@ -257,26 +270,29 @@
}
})
},
//
dianji(a) {
// console.log(a)
console.log(a);
if (typeof a == "object") {
this.num = a.detail.current
} else {
this.num = a
}
},
//
getArticlelist() {
this.$u.api.getArticlelist({
page: this.page,
is_video_img: 0, // 1 2 0
}).then(res => {
uni.stopPullDownRefresh();
console.log('37647744ghj', res)
// uni.stopPullDownRefresh();
// console.log('37647744ghj', res)
if (res.errCode == 0) {
this.articleList = res.data.list;
}
})
},
//
getRecommendList() {
this.$u.api.getRecommendList().then(res => {
console.log(res)
@ -285,6 +301,17 @@
}
})
},
//
getFollowList() {
this.$u.post("article/attentionArticleList",{
page: 0,
}).then(res => {
if (res.errCode == 0) {
this.fansList = res.data.list;
}
// console.log(res);
})
},
toSearchPage() {
console.log("22");
uni.navigateTo({

View File

@ -31,8 +31,12 @@
</template>
<script>
import { mapState } from 'vuex';
import titles from "@/components/informations/titles/titles"
export default {
computed: {
...mapState(["hasLogin,token"])
},
data() {
return {
information_dles : [{
@ -49,7 +53,6 @@
id: 0,
url: '../../static/pageD/info(14).png',
text: '交易物流'
},
{
id: 0,
@ -90,7 +93,9 @@
},
onLoad() {
// /
this.messageIndex()
if (this.hasLogin) {
this.messageIndex();
}
},
methods: {
// checkbox