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) {
if (this.user.phone) {
console.log('this.userId: ', this.userId);
debugger;
this.$u.route('pages/questionnaire-webview/questionnaire-webview', { u: this.userId, url: url });
} else {
// this.$u.route('/pages/get-phone-power/get-phone-power');

11
src/components/VolumeProject/VolumeProject.vue

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

35
src/pages/index/index.vue

@ -5,7 +5,7 @@
<view class="relative">
<!-- 日历 -->
<!-- <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 -->
<!-- <Upload @success="onUploadSuccess" @error="onUploadError" /> -->
@ -14,9 +14,12 @@
</view>
<Volume />
<VolumeProject />
<!-- <view style="height: 25rpx; width: 100%"></view> -->
<view style="padding-top: 25rpx">
<view class="news-title"> 新闻中心 </view>
</view>
<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 }}
</view>
<view class="flex justify-between" style="font-size: 24rpx">
@ -92,6 +95,33 @@ export default {
methods: {
...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) {
if (item.articleUrl) {
@ -231,6 +261,7 @@ page {
overflow: hidden;
}
.news-title {
margin-top: 25rpx;
font-weight: bold;
font-size: 32rpx;
border-left: 4rpx solid #3dadff;

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

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

Loading…
Cancel
Save