修一下

This commit is contained in:
2025-06-20 16:59:15 +08:00
parent 7a066b3026
commit 9b2f38e5cb
7 changed files with 115 additions and 27 deletions

View File

@ -42,19 +42,13 @@
}) })
}, },
goAbout() { goAbout() {
uni.navigateTo({ wx.openSetting()
url: "/pages/const/about"
})
}, },
goLicense() { goLicense() {
uni.navigateTo({ wx.openPrivacyContract()
url: "/pages/const/license"
})
}, },
goPrivacy() { goPrivacy() {
uni.navigateTo({ wx.openPrivacyContract()
url: "/pages/const/privacy"
})
}, },
} }
} }

View File

@ -13,7 +13,7 @@
<image src="/static/images/icon-photograph.png" alt="随手拍" class="icon-img"></image> <image src="/static/images/icon-photograph.png" alt="随手拍" class="icon-img"></image>
<text class="icon-text">随手拍</text> <text class="icon-text">随手拍</text>
</view> </view>
<view class="icon-block" @click="gotoShop"> <view class="icon-block" @click="gotoShop" v-if="shopEnable">
<image src="/static/images/icon-store.png" alt="" class="icon-img"></image> <image src="/static/images/icon-store.png" alt="" class="icon-img"></image>
<text class="icon-text">积分商城</text> <text class="icon-text">积分商城</text>
</view> </view>
@ -67,6 +67,7 @@
id: '', id: '',
name: '全部' name: '全部'
}], }],
shopEnable: false,
tabIndex: 0, tabIndex: 0,
newsList: [], newsList: [],
curPage: 1, curPage: 1,
@ -90,6 +91,9 @@
this.bannerList.push(item) this.bannerList.push(item)
}) })
}) })
TaAjax.get('/points_mall/api.goods/enable').then((res) => {
this.shopEnable = res.data;
})
}, },
onReady() { onReady() {
this.refreshData(); this.refreshData();

View File

@ -1,6 +1,14 @@
<template> <template>
<view class="flex flex-column" style="width:100vw;height: 100vh;"> <view class="flex flex-column" style="width:100vw;height: 100vh;">
<i-loading v-if="loading" /> <i-loading v-if="loading" />
<scroll-view scroll-x class="scroll-row" style="height: 90rpx;" :scroll-with-animation="true"
:show-scrollbar="false">
<view class="scroll-row-item px-3" @click="changeTab(index)" v-for="(item,index) in tabBars"
:key="item.id">
<text style="line-height: 88rpx;" class="d-block"
:class="tabIndex === index ? 'font-weight700 font36 border-bottom border-danger text-danger':'font30'">{{item.name}}</text>
</view>
</scroll-view>
<view class="flex flex-column flex-1"> <view class="flex flex-column flex-1">
<scroll-view class="flex-1" :scroll-y="true" :refresher-enabled="true" <scroll-view class="flex-1" :scroll-y="true" :refresher-enabled="true"
:refresher-triggered="refresh" @refresherrefresh="refreshData" @scrolltolower="loadData"> :refresher-triggered="refresh" @refresherrefresh="refreshData" @scrolltolower="loadData">
@ -34,6 +42,13 @@
}, },
data() { data() {
return { return {
tabIndex: 0,
tabBars: [
{
id: -1,
name: "全部",
}
],
newsList: [], newsList: [],
curPage: 1, curPage: 1,
loading: true, loading: true,
@ -41,16 +56,39 @@
finish: false finish: false
} }
}, },
onShow() {
this.loadCate();
},
methods: { methods: {
changeTab(idx) {
this.tabIndex = idx;
this.refresh = true;
this.loadData()
},
loadCate() {
TaAjax.get('/cms/api.category/index', {
pid: 1
}).then((result) => {
this.tabBars = [
{
id: -1,
name: "全部",
},
...result.data,
]
})
},
loadData() { loadData() {
if (this.refresh) { if (this.refresh) {
this.newsList.length = 0; this.newsList.length = 0;
this.curPage = 1;
this.finish = false; this.finish = false;
} }
if (this.finish) { if (this.finish) {
return; return;
} }
TaAjax.get('/cms/api.tutorial/index', { TaAjax.get('/cms/api.tutorial/index', {
cid: this.tabBars[this.tabIndex].id,
page: this.curPage page: this.curPage
}).then((result) => { }).then((result) => {
const data = result.data; const data = result.data;

View File

@ -88,14 +88,22 @@
created() { created() {
const that = this; const that = this;
const userInfo = TaCache.get('auth.user'); const userInfo = TaCache.get('auth.user');
if (!userInfo) { if (!userInfo || !userInfo.id) {
uni.navigateTo({ uni.redirectTo({
url: "/pages/user/login" url: "/pages/user/login"
}) })
} }
uni.getLocation({ uni.getLocation({
type: 'gcj02', type: 'gcj02',
success(res) { success(res) {
console.log(res)
TaPost('/ticket/api.auth.UserShare/query_address', {
lat: res.latitude,
lng: res.longitude
}).then((result) => {
const data = result.data;
that.form.ticket_address = data;
})
that.form.ticket_lat = res.latitude; that.form.ticket_lat = res.latitude;
that.form.ticket_lng = res.longitude; that.form.ticket_lng = res.longitude;
}, },

View File

@ -56,9 +56,11 @@
}, },
onShow() { onShow() {
const userInfo = TaCache.get('auth.user'); const userInfo = TaCache.get('auth.user');
if (userInfo) { if (userInfo && userInfo.id) {
this.userInfo = userInfo; this.userInfo = userInfo;
this.isLogin = true; this.isLogin = true;
} else {
this.goLogin()
} }
}, },
methods: { methods: {

View File

@ -34,7 +34,7 @@
this.userInfo = userInfo; this.userInfo = userInfo;
if (!this.userInfo.phone) { if (!this.userInfo.phone) {
uni.navigateTo({ uni.navigateTo({
url: '/pages/user/bind' url: '/pages/user/bind/bind'
}) })
} }
this.form.nickname = this.userInfo.nickname || this.userInfo.extra.nickName this.form.nickname = this.userInfo.nickname || this.userInfo.extra.nickName

View File

@ -1,14 +1,10 @@
<template> <template>
<view class="login"> <view class="login">
<view class="login-head flex-y"> <view class="login-body flex-column">
<text class="login-head-h1">登录</text>
</view>
<view class="login-body flex-y">
<view class="flex-center"> <view class="flex-center">
<text class="login-body-name">微信授权</text> <text class="login-body-name">微信授权登录</text>
</view> </view>
<view style="margin-top:80rpx;" class="flex-center"> <view style="margin-top:80rpx;" class="flex-center">
@ -17,14 +13,12 @@
</view> </view>
</view> </view>
<!--
<view class="login-foot"> <view class="login-foot">
<view class='login-foot-agent flex-center'> <view class='login-foot-agent flex-center'>
<checkbox label="1" v-model="agent.value">同意协议</checkbox> <checkbox label="1" :value="agent.value">同意协议</checkbox>
<text @click="agent.show = true">用户隐私协议</text> <text @click="showAgreement">用户隐私协议</text>
</view> </view>
</view> --> </view>
</view> </view>
</template> </template>
@ -45,13 +39,21 @@
}, },
created() { created() {
const userInfo = TaCache.get('auth.user') const userInfo = TaCache.get('auth.user')
if (userInfo) { if (userInfo && userInfo.id) {
uni.navigateBack() uni.navigateBack()
} }
this.doLogin()
}, },
methods: { methods: {
showAgreement() {
wx.openPrivacyContract()
},
// 执行注册登录 // 执行注册登录
doLogin() { doLogin() {
if (!this.agent.value) {
TaToast.toast("请先同意协议")
return
}
TaToast.loading("登录中") TaToast.loading("登录中")
this.login().then((data) => { this.login().then((data) => {
TaCache.set('auth.user', data) TaCache.set('auth.user', data)
@ -98,4 +100,44 @@
} }
}, },
} }
</script> </script>
<style>
.login {
width: 100%;
height: 100%;
background-color: #FFFFFF;
}
.login-body {
width: 100%;
height: 100%;
}
.login-body-name {
font-size: 40rpx;
font-weight: bold;
color: #333333;
}
.login-foot {
width: 100%;
height: 100rpx;
background-color: #FFFFFF;
position: fixed;
bottom: 0;
left: 0;
}
.login-foot-agent {
width: 100%;
height: 100rpx;
line-height: 100rpx;
font-size: 24rpx;
color: #999999;
}
.login-foot-agent checkbox {
margin-right: 10rpx;
}
</style>