Browse Source

轮播图跳转及新用户操作问题

210plan
aBin 3 years ago
parent
commit
639b82510c
  1. 1
      src/components/Volume/Volume.vue
  2. 11
      src/components/VolumeProject/VolumeProject.vue
  3. 35
      src/pages/index/index.vue
  4. 11
      src/pages/phone-bind/phone-bind.vue

1
src/components/Volume/Volume.vue

@ -64,7 +64,6 @@ export default {
jumpV(url) { jumpV(url) {
if (this.user.phone) { if (this.user.phone) {
console.log('this.userId: ', this.userId); console.log('this.userId: ', this.userId);
debugger;
this.$u.route('pages/questionnaire-webview/questionnaire-webview', { u: this.userId, url: url }); this.$u.route('pages/questionnaire-webview/questionnaire-webview', { u: this.userId, url: url });
} else { } else {
// this.$u.route('/pages/get-phone-power/get-phone-power'); // this.$u.route('/pages/get-phone-power/get-phone-power');

11
src/components/VolumeProject/VolumeProject.vue

@ -1,5 +1,5 @@
<template> <template>
<view class="volume-box"> <view class="volume-box" v-if="itemList.length">
<swiper <swiper
class="swiper" class="swiper"
circular circular
@ -15,8 +15,9 @@
class="swiper-item flex items-center justify-center" class="swiper-item flex items-center justify-center"
:class="['card-item', currentCardIndex === index ? 'card-item-current' : 'card-item-default']" :class="['card-item', currentCardIndex === index ? 'card-item-current' : 'card-item-default']"
style="transition: all 0.3s" style="transition: all 0.3s"
>{{ item.name }}</view
> >
{{ item.name }}
</view>
</swiper-item> </swiper-item>
</swiper> </swiper>
</view> </view>
@ -105,13 +106,13 @@ export default {
width: 100%; width: 100%;
background: url('https://www.tall.wiki/gateway/carbasics/v4.0/uploads/project.png'); background: url('https://www.tall.wiki/gateway/carbasics/v4.0/uploads/project.png');
background-size: 100% 100%; background-size: 100% 100%;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2); /* box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2); */
} }
.volume-box { .volume-box {
width: 700rpx; width: 700rpx;
height: 120px; height: 120px;
margin: 0 25rpx 25rpx 25rpx; margin: 25rpx;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); /* box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); */
border-radius: 8rpx; border-radius: 8rpx;
/* overflow: hidden; */ /* overflow: hidden; */
/* background: #f9fafb; */ /* background: #f9fafb; */

35
src/pages/index/index.vue

@ -5,7 +5,7 @@
<view class="relative"> <view class="relative">
<!-- 日历 --> <!-- 日历 -->
<!-- <Calendar @selected-change="onDateChange" :show-back="true" ref="calendar" @handleFindPoint="handleFindPoint" /> --> <!-- <Calendar @selected-change="onDateChange" :show-back="true" ref="calendar" @handleFindPoint="handleFindPoint" /> -->
<u-swiper :list="list" border-radius="0" height="400"></u-swiper> <u-swiper :list="list" border-radius="0" height="400" @click="gitSwiper"></u-swiper>
<!-- 上传 导入wbs --> <!-- 上传 导入wbs -->
<!-- <Upload @success="onUploadSuccess" @error="onUploadError" /> --> <!-- <Upload @success="onUploadSuccess" @error="onUploadError" /> -->
@ -14,9 +14,12 @@
</view> </view>
<Volume /> <Volume />
<VolumeProject /> <VolumeProject />
<!-- <view style="height: 25rpx; width: 100%"></view> -->
<view style="padding-top: 25rpx">
<view class="news-title"> 新闻中心 </view> <view class="news-title"> 新闻中心 </view>
</view>
<view class="news-content" v-for="(item, index) in newsList" :key="index" @click="jumpDetail(item)"> <view class="news-content" v-for="(item, index) in newsList" :key="index" @click="jumpDetail(item)">
<view class="mb-2"> <view class="mb-2" style="font-weight: 600; color: rgba(0, 0, 0, 0.85)">
{{ item.title }} {{ item.title }}
</view> </view>
<view class="flex justify-between" style="font-size: 24rpx"> <view class="flex justify-between" style="font-size: 24rpx">
@ -92,6 +95,33 @@ export default {
methods: { methods: {
...mapMutations('project', ['setProjects', 'setDotList']), ...mapMutations('project', ['setProjects', 'setDotList']),
gitSwiper(e) {
const data = this.list[e];
if (data.jumpUrl) {
const jumpType = data.jumpType;
if (jumpType === 1) {
uni.navigateTo({ url: `/pages/detail-webview/detail-webview?jumpUrl=${data.jumpUrl}` });
} else if (jumpType === 2) {
uni.downloadFile({
url: data.jumpUrl,
success: function (res) {
var filePath = res.tempFilePath;
uni.openDocument({
filePath: filePath,
showMenu: true,
});
},
});
} else if (jumpType === 3) {
uni.previewImage({
urls: [data.jumpUrl],
longPressActions: {
itemList: ['发送给朋友', '保存图片', '收藏'],
},
});
}
}
},
// //
jumpDetail(item) { jumpDetail(item) {
if (item.articleUrl) { if (item.articleUrl) {
@ -231,6 +261,7 @@ page {
overflow: hidden; overflow: hidden;
} }
.news-title { .news-title {
margin-top: 25rpx;
font-weight: bold; font-weight: bold;
font-size: 32rpx; font-size: 32rpx;
border-left: 4rpx solid #3dadff; border-left: 4rpx solid #3dadff;

11
src/pages/phone-bind/phone-bind.vue

@ -27,6 +27,7 @@
</template> </template>
<script> <script>
import { mapState, mapMutations } from 'vuex';
import UserAuthMixin from '@/mixins/userAuth'; import UserAuthMixin from '@/mixins/userAuth';
export default { export default {
@ -75,11 +76,14 @@ export default {
errorType: ['message'], errorType: ['message'],
}; };
}, },
computed: {
...mapState('user', ['user']),
},
onReady() { onReady() {
this.$refs.uForm.setRules(this.rules); this.$refs.uForm.setRules(this.rules);
}, },
methods: { methods: {
...mapMutations('user', ['setToken', 'setUser']),
submit() { submit() {
this.$refs.uForm.validate(async valid => { this.$refs.uForm.validate(async valid => {
if (valid) { if (valid) {
@ -87,12 +91,17 @@ export default {
const { phone, code } = this.model; const { phone, code } = this.model;
const data = await this.$u.api.phoneBind(phone, code); const data = await this.$u.api.phoneBind(phone, code);
console.log('data: ', data); console.log('data: ', data);
if (data && data.token) {
this.setUser(data);
this.setToken(data.token);
console.log(this.user);
this.$refs.uTips.show({ this.$refs.uTips.show({
title: '手机号绑定成功, 即将跳转上一页', title: '手机号绑定成功, 即将跳转上一页',
type: 'success', type: 'success',
duration: '3000', duration: '3000',
}); });
setTimeout(() => uni.navigateBack(-2), 2000); setTimeout(() => uni.navigateBack(-2), 2000);
}
} catch (error) { } catch (error) {
this.$refs.uTips.show({ this.$refs.uTips.show({
title: error.msg || '手机号绑定失败', title: error.msg || '手机号绑定失败',

Loading…
Cancel
Save