xbx #75

Merged
theluyuan merged 8 commits from xbx into master 2020-07-21 13:04:02 +00:00
10 changed files with 88 additions and 80 deletions

3
.gitignore vendored
View File

@ -1,3 +1,4 @@
.vscode
/node_modules/*
unpackage
unpackage
manifest.json

View File

@ -249,6 +249,17 @@ export default {
type: type,
status: status,
});
},
// 获取直播列表
tabLiveList(){
return vm.$u.post('Specialci/tabLiveList')
},
// 获取图文视频详情
articleInfo({article_id}){
return vm.$u.post('article/articleInfo',{article_id})
},
getStoreInfo({id}){
return vm.$u.post('Store/getStoreInfo',{id})
}
}
}

View File

@ -4,59 +4,20 @@ const install = (Vue, vm) => {
baseUrl: 'https://dmmall.sdbairui.com/api',
loadingText: '努力加载中~',
loadingTime: 800
// ......
});
// 请求拦截配置Token等参数
Vue.prototype.$u.http.interceptor.request = (config) => {
// 引用token
// 方式一存放在vuex的token假设使用了uView封装的vuex方式
// 见https://uviewui.com/components/globalVariable.html
// config.header.token = vm.token;
// 方式二如果没有使用uView封装的vuex方法那么需要使用$store.state获取
// config.header.token = vm.$store.state.token;
// 方式三如果token放在了globalData通过getApp().globalData获取
// config.header.token = getApp().globalData.username;
// 方式四如果token放在了Storage本地存储中拦截是每次请求都执行的
// 所以哪怕您重新登录修改了Storage下一次的请求将会是最新值
const token = uni.getStorageSync('token');
// console.log(token);
// config.header.token = token;
config.header.Authorization = 'Bearer' + " " + token;
// config.header.Token = 'xxxxxx';
// 可以对某个url进行特别处理此url参数为this.$u.get(url)中的url值
// if(config.url == '/user/login') config.header.noToken = true;
// 最后需要将config进行return
return config;
// 如果return一个false值则会取消本次请求
// if(config.url == '/user/rest') return false; // 取消某次请求
}
// // 响应拦截,判断状态码是否通过
// Vue.prototype.$u.http.interceptor.response = (res) => {
// if(res.code == 200) {
// // res为服务端返回值可能有coderesult等字段
// // 这里对res.result进行返回将会在this.$u.post(url).then(res => {})的then回调中的res的到
// // 如果配置了originalData为true请留意这里的返回值
// return res.result;
// } else if(res.code == 201) {
// // 假设201为token失效这里跳转登录
// vm.$u.toast('验证失败,请重新登录');
// setTimeout(() => {
// // 此为uView的方法详见路由相关文档
// vm.$u.route('/pages/user/login')
// }, 1500)
// return false;
// } else {
// // 如果返回false则会调用Promise的reject回调
// // 并将进入this.$u.post(url).then().catch(res=>{})的catch回调中res为服务端的返回值
// return false;
// }
// }
const token = uni.getStorageSync('token');
config.header.Authorization = 'Bearer' + " " + token;
return config;
}
}
export default {

View File

@ -1,5 +1,5 @@
<template>
<view class="video-item" v-if="item" @click="toDetailsPage()" data-article_id="item.article_id" >
<view class="video-item" v-if="item" @click="toDetailsPage(item.article_id)">
<image class="head" :src="item.article_pic" v-if="item.type == 1" ></image>
<view class="header_fist" v-else>
<view class="backes"></view>
@ -15,17 +15,17 @@
<image src="/static/image/common/4.png" @click.stop="showAction"></image>
<view class="action" v-if="show == item.article_id">
<view class="bubble">
<view @click="articleLike">
<view @click.stop="articleLike">
<image src="/static/image/common/5.png" v-if="item.is_like == 0"></image>
<image src="/static/image/common/8.png" v-else></image>
<text>点赞</text>
</view>
<view @click="articleCollect">
<view @click.stop="articleCollect">
<image src="/static/image/common/6.png" v-if="item.is_collect == 0"></image>
<image src="/static/image/common/9.png" v-else></image>
<text>收藏</text>
</view>
<view @click="articleAddShield">
<view @click.stop="articleAddShield">
<image src="/static/image/common/7.png"></image>
<text>屏蔽用户</text>
</view>
@ -229,11 +229,9 @@ export default {
}
})
},
toDetailsPage(e) {
console.log(e)
let article_id = '2'
toDetailsPage(id) {
uni.navigateTo({
url: '/pageB/photo/index?article_id=' + article_id,
url: '/pageB/photo/index?id=' + id
});
},

View File

@ -1,6 +1,6 @@
{
"name" : "deming",
"appid" : "__UNI__10450AF",
"appid" : "__UNI__62A680B",
"description" : "",
"versionName" : "1.0.0",
"versionCode" : "100",

View File

@ -1,20 +1,20 @@
<template>
<view class="userinfo">
<view class="userhead">
<image></image>
<image :src="list.member_avatar"></image>
<text>+</text>
</view>
<view class="zan">
<image></image>
<text>123</text>
<text>{{list.like_num}}</text>
</view>
<view class="shoucang">
<image></image>
<text>123</text>
<text>{{list.collect_num}}</text>
</view>
<view class="pinglun">
<image></image>
<text>123</text>
<text>{{list.comment_num}}</text>
</view>
<view class="gouwu">
<image></image>
@ -78,6 +78,7 @@ export default {
return {
}
}
},
props:['list']
}
</script>

View File

@ -5,11 +5,11 @@
</view>
<swiper class="swiper">
<swiper-item>
<image></image>
<image :src="list.article_pic"></image>
</swiper-item>
<swiper-item>
<!-- <swiper-item>
<image></image>
</swiper-item>
</swiper-item> -->
</swiper>
<view class="bottom">
@ -21,7 +21,7 @@
<view class="title">hasjdhajskhj</view>
<view class="info u-line-2">asdjhasjdkasljdklasjkl</view>
</view>
<userinfo class="userinfo"></userinfo>
<userinfo class="userinfo" :list="list"></userinfo>
<shpoone class="shpoone"></shpoone>
<shoplist></shoplist>
</view>
@ -120,6 +120,23 @@ export default {
userinfo,
shpoone,
shoplist
},
data(){
return {
list:{}
}
},
methods:{
articleInfo(article_id){
this.$u.api.articleInfo({article_id}).then((res)=>{
console.log(res)
this.list = res.data.info
})
}
},
onLoad(o){
this.id = o.id
this.articleInfo(this.id)
}
}
</script>

View File

@ -1,12 +1,12 @@
<template>
<view class="details">
<view class="top">
<image></image>
<view class="name">店铺名称</view>
<view class="info">创建时间2020年04月10日 | 浙江金华市</view>
<image :src="info.store_avatar"></image>
<view class="name">{{info.store_name}}</view>
<view class="info">创建时间{{store_addtime|date}} | {{info.live_store_address}}</view>
<view class="num">
<view>
<view class="value">23435</view>
<view class="value">{{info.store_collect}}</view>
<view class="title">粉丝数</view>
</view>
<view>
@ -14,7 +14,7 @@
<view class="title">评价</view>
</view>
<view>
<view class="value">23435</view>
<view class="value">{{info.store_credit}}</view>
<view class="title">信用等级</view>
</view>
</view>
@ -25,7 +25,7 @@
<image></image>
</view>
<view class="image-list">
<image></image>
<image :src="info.business_licence_number_electronic"></image>
</view>
</view>
</view>
@ -33,7 +33,15 @@
<script>
export default {
data() {
return {}
return {
info:{}
}
},
onLoad(){
this.$u.api.getStoreInfo({id:1}).then((res)=>{
console.log(res)
this.info = res.data
})
}
};
</script>

View File

@ -14,11 +14,11 @@
<view>我的</view>
</view>
</view>
<view class="top">
<image></image>
<view class="top" :style="{'background-image':'url(' + info.store_banner + ')'}">
<image :src="info.store_avatar"></image>
<view class="info">
<view class="name u-line-1">小米官方旗舰店</view>
<view class="num">粉丝数234</view>
<view class="name u-line-1">{{info.store_name}}</view>
<view class="num">粉丝数{{info.store_collect}}</view>
</view>
<view class="btn">
<image></image>
@ -85,7 +85,8 @@ export default {
cur: 0,
list:[],
indexlist:[],
indextop:[]
indextop:[],
info:{}
}
},
components:{
@ -111,6 +112,10 @@ export default {
this.indextop = [res.data[0],res.data[1]]
this.indexlist = res.data.slice(2,)
})
this.$u.api.getStoreInfo({id:1}).then((res)=>{
console.log(res)
this.info = res.data
})
}
};
</script>

View File

@ -216,8 +216,14 @@
this.getRecommendList();
this.getSwiper();
this.getZhiBoSwiper();
this.tabLiveList();
},
methods: {
tabLiveList(){
this.$u.api.tabLiveList().then((res)=>{
console.log(res)
})
},
getSwiper() {
this.$u.api.getIndexSwiper().then(res => {
if (res.errCode == 0) {
@ -277,4 +283,4 @@
},
},
}
</script>
</script>