新增部分注释优化一些代码

master
lemon橪 2021-05-24 15:49:22 +08:00
parent dd0c7259e6
commit 3d74e3d907
28 changed files with 209 additions and 752 deletions

View File

@ -31,19 +31,18 @@ export default {
onShow() { onShow() {
// #ifndef H5 // #ifndef H5
this.getClipboard(); this.getClipboard();
// #endif // #endif
}, },
methods: { methods: {
// 广 // TODO 广
launch() { launch() {
try { try {
// launchFlag 广 // launchFlag 广
const value = uni.getStorageSync("launchFlag"); const value = uni.getStorageSync("launchFlag");
if (!value) { if (!value) {
this.$u.route("/pages/index/agreement"); // this.$u.route("/pages/index/agreement");
} else { } else {
//app广 //app广
var w = plus.webview.open( var w = plus.webview.open(

View File

@ -18,9 +18,9 @@ import config from "@/config/config";
export default { export default {
data() { data() {
return { return {
config, config, //
weChat: false, weChat: false, // true
logo: require("@/icon.png"), logo: require("@/icon.png"), //logo
}; };
}, },
mounted() { mounted() {
@ -36,11 +36,16 @@ export default {
// #endif // #endif
}, },
methods: { methods: {
/**
* 跳转到下载app页面
*/
downloadApp() { downloadApp() {
setTimeout(function () { setTimeout(function () {
window.location.href = config.downloadLink; window.location.href = config.downloadLink;
}, 2000); }, 2000);
}, },
/** /**
* 打开app 仅在h5生效 使用ifream唤醒app * 打开app 仅在h5生效 使用ifream唤醒app
*/ */

View File

@ -3,7 +3,6 @@
<div class="index"> <div class="index">
<u-modal v-model="show" :show-title="false" :show-confirm-button="false" mask-close-able> <u-modal v-model="show" :show-title="false" :show-confirm-button="false" mask-close-able>
<view class="slot-content"> <view class="slot-content">
<image @click="downLoad()" class="img" :src="imgUrl" /> <image @click="downLoad()" class="img" :src="imgUrl" />
<div class="canvas-hide"> <div class="canvas-hide">
<!-- #ifdef MP-WEIXIN --> <!-- #ifdef MP-WEIXIN -->
@ -19,21 +18,20 @@
</div> </div>
</template> </template>
<script> <script>
//
import DrawPoster from "@/js_sdk/u-draw-poster"; import DrawPoster from "@/js_sdk/u-draw-poster";
export default { export default {
data: () => ({ data: () => ({
imgUrl: "", imgUrl: "", //
width: "", show: false, //
height: "", dp: {}, //dp
show: false, logo: require("@/pages/passport/static/logo-title.png"), //logo
dp: {},
logo: require("@/pages/passport/static/logo-title.png"),
}), }),
props: { props: {
/** /**
* 封装组件 * 父级传参的数据
*/ */
res: { res: {
type: null, type: null,
@ -54,8 +52,10 @@ export default {
st2: (size) => size, st2: (size) => size,
// #endif // #endif
/**
* 保存图片
*/
downLoad() { downLoad() {
uni.saveImageToPhotosAlbum({ uni.saveImageToPhotosAlbum({
filePath: this.imgUrl, filePath: this.imgUrl,
success: function () { success: function () {

View File

@ -18,8 +18,8 @@
<view class="city-head-title">{{ headTitle }}</view> <view class="city-head-title">{{ headTitle }}</view>
<icon <icon
type="clear" type="clear"
v-if="rightIcon" v-if="clearRightIcon"
class="rightIcon" class="clearRightIcon"
size="20" size="20"
color="#cccccc" color="#cccccc"
@click="hide" @click="hide"
@ -105,17 +105,21 @@ export default {
}, },
data() { data() {
return { return {
rightIcon: true, clearRightIcon: true, //icon
scrollLeft: 500, // scrollLeft: 500, //
scrollTop: 0, scrollTop: 0, //0
enableScroll: true, enableScroll: true, //
tabCurrentIndex: 0, // tabCurrentIndex: 0, //
tabbars: this.provinceData, tabbars: this.provinceData, //id
pickersize: this.pickerSize, pickersize: this.pickerSize, //tab 4
showPicker: false, showPicker: false, //
}; };
}, },
methods: { methods: {
/**
* 显示选择器
*/
show() { show() {
this.showPicker = true; this.showPicker = true;
if (this.tabbars[0].children.length == 0) { if (this.tabbars[0].children.length == 0) {
@ -126,10 +130,17 @@ export default {
windowWidth = uni.getSystemInfoSync().windowWidth; windowWidth = uni.getSystemInfoSync().windowWidth;
}, },
/**
* 关闭选择器
*/
hide() { hide() {
this.showPicker = false; this.showPicker = false;
}, },
//tab
/**
* tab切换
*/
changeTab(e) { changeTab(e) {
let index = e; let index = e;
this.setScroll(index); this.setScroll(index);
@ -139,7 +150,10 @@ export default {
this.getScroll("show" + index); this.getScroll("show" + index);
}, 10); }, 10);
}, },
//size
/**
* 获得元素的大小
*/
getElSize(id) { getElSize(id) {
return new Promise((res, rej) => { return new Promise((res, rej) => {
let el = uni let el = uni
@ -158,6 +172,10 @@ export default {
).exec(); ).exec();
}); });
}, },
/**
* 点击城市后回调
*/
async changCity(index, item) { async changCity(index, item) {
if (this.tabbars[index].id != item.id) { if (this.tabbars[index].id != item.id) {
this.tabbars[index].localName = item.name; this.tabbars[index].localName = item.name;
@ -165,14 +183,14 @@ export default {
if (index < this.tabbars.length - 1) { if (index < this.tabbars.length - 1) {
this.tabbars.splice(index + 1, this.tabbars.length - index - 1); this.tabbars.splice(index + 1, this.tabbars.length - index - 1);
} }
if (this.tabbars.length < this.pickersize) { if (this.tabbars.length < this.pickersize) {
let data = await getRegionsById(item.id); let data = await getRegionsById(item.id);
//
if (data.data.result.length == 0) { if (data.data.result.length == 0) {
this.$emit("funcValue", this.tabbars); this.$emit("funcValue", this.tabbars);
this.hide(); this.hide();
} else { } else {
//
var current = { var current = {
localName: "请选择", localName: "请选择",
id: "", id: "",
@ -181,6 +199,7 @@ export default {
this.tabbars.push(current); this.tabbars.push(current);
this.tabCurrentIndex++; this.tabCurrentIndex++;
//
this.scrollTop = 0; this.scrollTop = 0;
} }
} else { } else {
@ -189,6 +208,10 @@ export default {
} }
} }
}, },
/**
* 获取当前tab中滚动的距离
*/
async setScroll(index) { async setScroll(index) {
let width = 0; let width = 0;
let nowWidth = 0; let nowWidth = 0;
@ -205,6 +228,10 @@ export default {
this.scrollLeft = 0; this.scrollLeft = 0;
} }
}, },
/**
* 计算当前的滚动距离
*/
getScroll(id) { getScroll(id) {
uni uni
.createSelectorQuery() .createSelectorQuery()
@ -229,7 +256,7 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
/* 优惠券面板 */
.mask { .mask {
visibility: hidden; visibility: hidden;
position: fixed; position: fixed;
@ -275,7 +302,7 @@ export default {
text-align: center; text-align: center;
/* #endif */ /* #endif */
} }
.rightIcon { .clearRightIcon {
position: absolute; position: absolute;
right: 15px; right: 15px;
top: 12px; top: 12px;

View File

@ -1,7 +1,7 @@
<template> <template>
<view class="serach"> <view class="serach">
<view class="left-box" @tap="onClickLeft"> <view class="left-box" @tap="onClickLeft">
<uni-icons style="line-height:70rpx" :color="color" type="back" size="24" /> <uni-icons style="line-height:70rpx" type="back" size="24" />
</view> </view>
<view class="content" :style="{ 'border-radius': radius + 'px' }"> <view class="content" :style="{ 'border-radius': radius + 'px' }">
<!-- HM修改 增加进入输入状态的点击范围 --> <!-- HM修改 增加进入输入状态的点击范围 -->
@ -10,21 +10,17 @@
<!-- HM修改 增加placeholder input confirm-type confirm--> <!-- HM修改 增加placeholder input confirm-type confirm-->
<input style="width:100%; " :placeholder="placeholder" placeholder-class="placeholder-color" @input="inputChange" confirm-type="search" @confirm="triggerConfirm" class="input" <input style="width:100%; " :placeholder="placeholder" placeholder-class="placeholder-color" @input="inputChange" confirm-type="search" @confirm="triggerConfirm" class="input"
:class="{ center: !active && mode === 2 }" :focus="isFocus" v-model="inputVal" @focus="focus" @blur="blur" /> :class="{ center: !active && mode === 2 }" :focus="isFocus" v-model="inputVal" @focus="focus" @blur="blur" />
<!-- <view v-if="!active && mode === 2" class="input sub" @click="getFocus"></view> --> <u-icon name="close" v-if="isDelShow" style="padding:0 30rpx;" @click="clear"></u-icon>
<!-- HM修改 @click换成@click.stop阻止冒泡 -->
<text v-if="isDelShow" class="icon icon-del" @click.stop="clear"></text>
</view> </view>
<view v-show="(active && show && button === 'inside') || (isDelShow && button === 'inside')" class="serachBtn" @click="search"></view> <view v-show="(active && show && button === 'inside') || (isDelShow && button === 'inside')" class="serachBtn" @click="search"></view>
</view> </view>
<view v-if="button === 'outside'" class="button" :class="{ active: show || active }"> <view v-if="button === 'outside'" class="button" :class="{ active: show || active }">
<!-- @click="search" -->
<view v-if="isShowSeachGoods !=true" class="button-item"> <view v-if="isShowSeachGoods !=true" class="button-item">
<div @click="out()"></div> <div @click="out()"></div>
</view> </view>
<view v-else class="button-item"> <view v-else class="button-item">
<!-- {{ !show ? searchName : '搜索' }} --> <u-icon name="grid-fill" size="50" @click="handelListClass()" v-if="!switchLayout"></u-icon>
<u-icon name="grid-fill" size="50" @click="handelListClass()" v-if="!isListClass"></u-icon>
<u-icon v-else @click="handelListClass()" name="list-dot" size="50"></u-icon> <u-icon v-else @click="handelListClass()" name="list-dot" size="50"></u-icon>
</view> </view>
</view> </view>
@ -36,9 +32,6 @@ import uniStatusBar from "../uni-status-bar/uni-status-bar.vue";
import uniIcons from "../uni-icons/uni-icons.vue"; import uniIcons from "../uni-icons/uni-icons.vue";
export default { export default {
watch: {},
mounted() {},
components: { components: {
uniStatusBar, uniStatusBar,
uniIcons, uniIcons,
@ -61,37 +54,17 @@ export default {
value: String, value: String,
default: "outside", default: "outside",
}, },
//
show: { show: {
value: Boolean, value: Boolean,
default: true, default: true,
}, },
leftText: { // 60
type: String,
default: "",
},
color: {
type: String,
},
statusBar: {
type: [Boolean, String],
default: false,
},
rightText: {
type: String,
default: "",
},
leftIcon: {
type: String,
default: "",
},
rightIcon: {
type: String,
default: "",
},
radius: { radius: {
value: String, value: String,
default: 60, default: 60,
}, },
//
isFocusVal: { isFocusVal: {
value: Boolean, value: Boolean,
default: true, default: true,
@ -99,46 +72,36 @@ export default {
}, },
data() { data() {
return { return {
isShowSeachGoods: false, isShowSeachGoods: false, //
// active: false, //
nums: 0, inputVal: "", //Input
iconParams: false, isDelShow: false, //icon
active: false, isFocus: false, //
inputVal: "", switchLayout: true, //
searchName: "取消",
isDelShow: false,
isFocus: false,
isListClass: true,
}; };
}, },
mounted() { mounted() {
this.isFocus = this.isFocusVal; this.isFocus = this.isFocusVal;
}, },
methods: { methods: {
ddType() { //
this.isShowSeachGoods = true;
},
out() { out() {
uni.reLaunch({ uni.reLaunch({
url: "/pages/tabbar/home/index" url: "/pages/tabbar/home/index",
}); });
}, },
// //
handelListClass() { handelListClass() {
this.isListClass = !this.isListClass; this.switchLayout = !this.switchLayout;
this.$emit("SwitchType"); this.$emit("SwitchType");
}, },
//HM confirm //HM confirm
triggerConfirm() { triggerConfirm() {
this.nums++;
this.$emit("confirm", false); this.$emit("confirm", false);
uni.hideKeyboard(); uni.hideKeyboard();
this.isShowSeachGoods = true;
}, },
//HM input //HM input
inputChange(event) { inputChange(event) {
this.nums++;
var keyword = event.detail.value; var keyword = event.detail.value;
this.$emit("input", keyword); this.$emit("input", keyword);
if (this.inputVal) { if (this.inputVal) {
@ -168,17 +131,19 @@ export default {
this.$emit("input", ""); this.$emit("input", "");
//this.$emit('search', '');//HM //this.$emit('search', '');//HM
}, },
getFocus() {
if (!this.isFocus) {
this.isFocus = true; /**
} * 回退到上一级
}, */
onClickLeft() { onClickLeft() {
uni.navigateBack(); uni.navigateBack();
}, },
/**
* 内容为空时输入默认关键字
*/
search() { search() {
this.nums++;
//HM 退
if (!this.inputVal) { if (!this.inputVal) {
if (!this.show && this.searchName == "取消") { if (!this.show && this.searchName == "取消") {
uni.hideKeyboard(); uni.hideKeyboard();
@ -191,24 +156,17 @@ export default {
}, },
}, },
watch: { watch: {
/**
* 监听当前是否有值 是否显示清除图标
*/
inputVal(newVal) { inputVal(newVal) {
if (newVal) { newVal ? (this.isDelShow = true) : (this.isDelShow = false);
this.searchName = "搜索";
//this.isDelShow = true; //HM
} else {
this.searchName = "取消";
this.isDelShow = false;
}
},
//HM
value(val) {
this.inputVal = val;
}, },
}, },
}; };
</script> </script>
<style lang="scss"> <style lang="scss" scoped>
.serach { .serach {
display: flex; display: flex;
width: 100%; width: 100%;
@ -233,14 +191,10 @@ export default {
background: #eee; background: #eee;
overflow: hidden; overflow: hidden;
transition: all 0.2s linear; transition: all 0.2s linear;
// border-radius: 30px;
.content-box { .content-box {
width: 100%; width: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
&.center { &.center {
justify-content: center; justify-content: center;
} }
@ -248,14 +202,6 @@ export default {
.icon { .icon {
padding: 0 15rpx; padding: 0 15rpx;
&.icon-del {
font-size: 38rpx;
&:before {
content: "\e644";
}
}
&.icon-serach:before { &.icon-serach:before {
content: "\e61c"; content: "\e61c";
} }

View File

@ -394,12 +394,6 @@
} }
} }
}, },
{
"path": "restPassword",
"style": {
"navigationBarTitleText": "重设密码"
}
},
{ {
"path": "article", "path": "article",
"style": { "style": {

View File

@ -2,6 +2,7 @@
<view class="content"> <view class="content">
<u-navbar :background="navObj" :is-back="false"> <u-navbar :background="navObj" :is-back="false">
<!-- mSearch组件 如果使用原样式删除组件元素--> <!-- mSearch组件 如果使用原样式删除组件元素-->
<mSearch ref="mSearch" class="mSearch-input-box" @clickLeft="back" :mode="2" :placeholder="defaultKeyword" @search="doSearch(false)" @input="inputChange" @confirm="doSearch(false)" <mSearch ref="mSearch" class="mSearch-input-box" @clickLeft="back" :mode="2" :placeholder="defaultKeyword" @search="doSearch(false)" @input="inputChange" @confirm="doSearch(false)"
@SwitchType="doSearchSwitch()" v-model="keyword" :isFocusVal="!isShowSeachGoods"></mSearch> @SwitchType="doSearchSwitch()" v-model="keyword" :isFocusVal="!isShowSeachGoods"></mSearch>
</u-navbar> </u-navbar>

View File

@ -5,7 +5,6 @@
<view class="u-skeleton" v-if="!articleData"> <view class="u-skeleton" v-if="!articleData">
<u-empty text="文章暂无内容" mode="list"></u-empty> <u-empty text="文章暂无内容" mode="list"></u-empty>
</view> </view>
<!-- <h3>{{routers.title}}</h3> -->
<u-parse v-else :html="articleData"></u-parse> <u-parse v-else :html="articleData"></u-parse>
</view> </view>
</view> </view>
@ -16,18 +15,20 @@ import { getArticleDetail } from "@/api/article.js";
export default { export default {
data() { data() {
return { return {
loading: true, //
routers: "", routers: "",
//
articleData: "", articleData: "",
}; };
}, },
onLoad(val) { onLoad(val) {
this.routers = val; this.routers = val;
getArticleDetail(val.id).then((res) => { getArticleDetail(val.id).then((res) => {
if (res.data.result) { if (res.data.result) {
//
this.articleData = res.data.result.content; this.articleData = res.data.result.content;
} }
// NavigationBar()
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: val.title, title: val.title,
}); });

View File

@ -36,15 +36,15 @@ export default {
return { return {
uuid, uuid,
flage: false, // flage: false, //
codeFlag: true, // codeFlag: true, //
codeForm: { codeForm: {
mobile: "", // mobile: "", //
code: "", // code: "", //
}, },
tips: "", // tips: "", //
clientType: "", // clientType: "", //
seconds: 60, seconds: 60, //
//
codeRules: { codeRules: {
// //
mobile: [ mobile: [
@ -69,7 +69,7 @@ export default {
}, },
}; };
}, },
// onReadyonLoad // onReadysetRulesonLoad
mounted() { mounted() {
this.$refs.validateCodeForm.setRules(this.codeRules); this.$refs.validateCodeForm.setRules(this.codeRules);
/** /**
@ -86,7 +86,7 @@ export default {
flage(val) { flage(val) {
if (val) { if (val) {
if (this.$refs.uCode.canGetCode) { if (this.$refs.uCode.canGetCode) {
// //
uni.showLoading({ uni.showLoading({
title: "正在获取验证码", title: "正在获取验证码",
}); });

View File

@ -26,11 +26,10 @@
font-size: 24upx; font-size: 24upx;
color: #999; color: #999;
text-align: center; text-align: center;
position: absolute; margin-top: 360rpx;
width: 100%; width: 100%;
display: flex; display: flex;
justify-content: center; justify-content: center;
bottom: 50rpx;
} }
span { span {
color: $aider-light-color; color: $aider-light-color;

View File

@ -1,185 +0,0 @@
<template>
<view class="container">
<view class="wrapper">
<view class="input-content">
<view class="input-item" v-if="step === 0">
<view class="input-item-title">
<image src="/static/login/user.png"></image>
</view>
<input type="text" v-model="form.account" placeholder="请输入账户名" placeholder-class="input-empty" maxlength="11"
/>
</view>
<view class="input-item" v-if="step === 0">
<view class="input-item-title">
<image class="img-code-icon" src="/static/login/code.png"></image>
</view>
<input v-model="form.img_code" placeholder="请输入图片验证码" placeholder-class="input-empty" maxlength="4"
@confirm="toLogin" />
<image :src="validate_url" class="img_code" mode="" @click="getValidImgUrl"></image>
</view>
<view class="input-item" v-if="step === 1">
<view class="input-item-title">
<image src="/static/login/user.png"></image>
<view class="phone-number">+86</view>
<image class="vertical" src="/static/vertical-line.svg"></image>
</view>
<input type="mobile" v-model="form.mobile" disabled="true" placeholder="请输入手机号码" placeholder-class="input-empty" maxlength="11"
/>
</view>
<view class="input-item" v-if="step === 1">
<view class="input-item-title">
<image class="img-code-icon" src="/static/login/code.png"></image>
</view>
<input v-model="form.img_code_phone" placeholder="请输入图片验证码" placeholder-class="input-empty"
maxlength="4" @confirm="toLogin" />
<image :src="validate_url" class="img_code" mode="" @click="getValidImgUrl"></image>
</view>
<view class="input-item" v-if="step === 1">
<view class="input-item-title">
<image src="/static/login/pwd2.png"></image>
</view>
<input v-model="form.sms_code" placeholder="请输入验证码" placeholder-class="input-empty" maxlength="4"
@confirm="toLogin" />
<view class="get-captcha" @click="handleGetCapcha">{{ sendTime === 0 ? '' : sendTime + 's' }}</view>
</view>
<view class="input-item" v-if="step === 2">
<view class="input-item-title">
<image src="/static/login/pwd2.png"></image>
</view>
<input type="password" v-model="form.password" placeholder="请输入新密码" placeholder-class="input-empty" maxlength="20"
@confirm="toLogin" />
</view>
<view class="input-item" v-if="step === 2">
<view class="input-item-title">
<image src="/static/login/pwd2.png"></image>
</view>
<input type="password" v-model="form.rep_password" placeholder="请再次输入密码" placeholder-class="input-empty" maxlength="20"
@confirm="toLogin" />
</view>
<button class="confirm-btn" @click="toNext">{{ step === 0 ? '' : (step==1?'':'') }}</button>
</view>
</view>
</view>
</template>
<script>
import {
validAccount,
sendFindPasswordSms,
validFindPasswordSms,
changePassword
} from '@/api/passport.js';
import {
getValidateCodeUrl
} from '@/api/common.js';
import * as RegExp from '@/utils/RegExp.js';
export default {
data() {
return {
validate_url: '',
sendTime: 0,
form: {},
step: 0,
}
},
onLoad() {
this.$nextTick(this.getValidImgUrl)
},
methods: {
handleGetCapcha() {
if (this.sendTime == 0) {
sendFindPasswordSms(this.form.uuid,this.form.img_code_phone).then(res => { //
if (res.statusCode == 200) {
this.sendTime = 60;
let timer = setInterval(() => {
this.sendTime--;
if (this.sendTime === 0) {
clearInterval(timer);
}
}, 1000);
}
})
}
},
getValidImgUrl() { //
const uuid = this.step === 0 ? '' : this.form.uuid
this.validate_url = getValidateCodeUrl('FIND_PASSWORD',uuid)
},
toNext() {
// TODO
if (this.step === 0) {
const { account,img_code } = this.form
validAccount(img_code, account).then(res=>{
if(res.statusCode==200){
this.step = 1
this.form.mobile = res.data.mobile
this.form.uname = res.data.uname
this.form.uuid = res.data.uuid
this.getValidImgUrl()
}
});
} else if (this.step == 1) {
const { uuid, sms_code } = this.form
validFindPasswordSms(uuid,sms_code).then((res) => {
if(res.statusCode==200){
this.step = 2;
this.sendTime = 0;
this.getValidImgUrl()
}
})
}else{
const { password,uuid,rep_password } = this.form
if(!password){
this.$api.msg('请输入密码')
return;
}
if(!RegExp.password.test(password)){
this.$api.msg('密码应为6-20位英文或数字')
return ;
}
if(password!=rep_password){
this.$api.msg('两次输入密码不一致')
return;
}
changePassword(password,uuid).then(res=>{
if(res.statusCode==200){
this.$api.msg('修改密码成功!')
setTimeout(function() {
uni.reLaunch({
url:"/pages/passport/login"
})
}, 500);
}
})
}
}
}
}
</script>
<style lang="scss" scoped>
@import './login.scss';
.container {
padding-top: 0;
.img_code {
width: 140rpx;
height: 48rpx;
margin-right: 20rpx;
}
.img-code-icon {
width: 44rpx;
height: 35rpx;
}
.input-content {
margin-top: 300rpx;
}
}
</style>

View File

@ -1,185 +0,0 @@
<template>
<view class="content">
<view class="con" :style="{width: windowWidth + 'px',height: windowHeight + 'px' }"><image :src="imgSrc" mode="scaleToFill" > </image></view>
<view class="btn" id="timer">
<view id="info"> </view>
<view class="circleProgress_wrapper btn">
<view class="wrapper right"><view class="circleProgress rightcircle"></view></view>
<view class="wrapper left"><view class="circleProgress leftcircle"></view></view>
</view>
</view>
</view>
</template>
<script>
import { getAdvertisement } from '@/api/home.js';
function getRandom(start, end, fixed = 0) {
let differ = end - start;
let random = Math.random();
return (start + differ * random).toFixed(fixed);
}
export default {
data() {
return {
imgSrc: '',
windowWidth: 0,
windowHeight: 0
};
},
onLoad() {
const res = uni.getSystemInfoSync();
this.windowWidth = res.windowWidth;
this.windowHeight = res.windowHeight;
this.init();
},
methods: {
init() {
getAdvertisement().then(res => {
if (res.statusCode === 200) {
const ads = res.data[getRandom(0, res.data.length - 1)];
this.imgSrc = ads.pic_url;
console.warn(this.imgSrc);
}
});
}
}
};
</script>
<style lang="less" scoped>
.content {
width: 100%;
height: 100%;
.con {
display: flex;
align-items: center;
image {
width: 100%;
height: 100%;
}
}
}
#timer {
display: inline-block;
position: fixed;
top: 40px;
right: 10px;
}
#info {
position: absolute;
top: 0;
left: 0;
width: 36px;
height: 36px;
line-height: 36px;
border-radius: 50%;
background-color: rgba(0, 0, 0, 0.3);
text-align: center;
color: #ffffff;
font-size: 12px;
}
.circleProgress_wrapper {
width: 36px;
height: 36px;
position: relative;
}
.wrapper {
width: 18px;
height: 36px;
position: absolute;
top: 0;
overflow: hidden;
}
.right {
right: 0;
}
.left {
left: 0;
}
.circleProgress {
width: 32px;
height: 32px;
border: 2px solid #ffffff;
border-radius: 50%;
position: absolute;
top: 0;
-webkit-transform: rotate(45deg);
}
.rightcircle {
border-top: 2px solid #03a9f4;
border-right: 2px solid #03a9f4;
right: 0;
-webkit-animation: circleProgressLoad_right 4s linear;
/*动画停留在最后一帧*/
animation-fill-mode: forwards;
-moz-animation-fill-mode: forwards;
-webkit-animation-fill-mode: forwards;
-o-animation-fill-mode: forwards;
}
.leftcircle {
border-bottom: 2px solid #03a9f4;
border-left: 2px solid #03a9f4;
left: 0;
-webkit-animation: circleProgressLoad_left 4s linear;
/*动画停留在最后一帧*/
animation-fill-mode: forwards;
-moz-animation-fill-mode: forwards;
-webkit-animation-fill-mode: forwards;
-o-animation-fill-mode: forwards;
}
@-webkit-keyframes circleProgressLoad_right {
0% {
border-top: 2px solid #03a9f4;
border-right: 2px solid #03a9f4;
-webkit-transform: rotate(45deg);
}
50% {
border-top: 2px solid #03a9f4;
border-right: 2px solid #03a9f4;
border-left: 2px solid #ffffff;
border-bottom: 2px solid #ffffff;
-webkit-transform: rotate(225deg);
}
100% {
border-left: 2px solid #ffffff;
border-bottom: 2px solid #ffffff;
-webkit-transform: rotate(225deg);
}
}
@-webkit-keyframes circleProgressLoad_left {
0% {
border-bottom: 2px solid #03a9f4;
border-left: 2px solid #03a9f4;
-webkit-transform: rotate(45deg);
}
50% {
border-bottom: 2px solid #03a9f4;
border-left: 2px solid #03a9f4;
border-top: 2px solid #ffffff;
border-right: 2px solid #ffffff;
-webkit-transform: rotate(45deg);
}
100% {
border-top: 2px solid #ffffff;
border-right: 2px solid #ffffff;
-webkit-transform: rotate(225deg);
}
}
</style>

View File

@ -1,118 +0,0 @@
<template>
<view class="container">
<view class="status_bar"><!-- 这里是状态栏 --></view>
<view class="header">{{ agreement.article_name }}</view>
<view class="u-update-content">
<view class="about-us"><view v-html="agreement.content"></view></view>
</view>
<view class="bottom-btn">
<view class="disagree-btn">不同意</view>
<view class="agree-btn" @click="closeModal"></view>
</view>
<u-loading mode="flower" size="100" :show="loading"></u-loading>
</view>
</template>
<script>
0;
import { getArticleDetail } from '@/api/article.js';
export default {
data() {
return {
show: true,
loading: true,
agreement: {}
};
},
onReady() {
this.show = true;
},
onLoad(options) {
this.init();
},
methods: {
init() {
getArticleDetail(111).then(res => {
if (res.statusCode === 200) {
this.agreement = res.data;
this.loading = false;
}
});
},
cancel() {
this.closeModal();
},
confirm() {
this.closeModal();
},
closeModal() {
uni.setStorage({
key: 'launchFlag',
data: true
});
uni.switchTab({
url: '/pages/tabbar/home/index'
});
}
}
};
</script>
<style scoped lang="scss">
.container {
background-color: #ffffff;
display: flex;
flex-direction: column;
align-items: center;
}
.status_bar {
position: fixed;
top: 0px;
height: var(--status-bar-height);
width: 100%;
background: #1abc9c;
}
.header {
width: 100%;
margin-top: var(--status-bar-height);
display: flex;
justify-content: center;
align-items: center;
font-size: 34rpx;
font-weight: 400;
height: 100rpx;
}
.u-full-content {
background-color: #00c777;
}
.bottom-btn {
position: fixed;
z-index: 999;
bottom: 0px;
left: 0px;
width: 100%;
height: 100rpx;
background-color: #ffffff;
display: flex;
align-items: center;
justify-content: center;
view {
width: 50%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.agree-btn {
background-color: #1abc9c;
color: #ffffff;
}
}
.u-update-content {
padding: 10rpx;
font-size: 26rpx;
}
</style>

View File

@ -1,5 +1,6 @@
<template> <template>
<div class="wrapper"> <div class="wrapper">
<!-- 楼层装修组件 -->
<tpl /> <tpl />
</div> </div>
</template> </template>

View File

@ -17,8 +17,7 @@ export default {
modelNavigateTo, modelNavigateTo,
}; };
}, },
mounted() { mounted() {},
},
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -1,27 +1,23 @@
<template> <template>
<div class="layout"> <div class="layout">
<u-image height="175rpx" width="175rpx" @click="modelNavigateTo(item)" class="image-mode" :src="item.img" v-for="(item,index) in res.list" :key="index" > <u-image height="175rpx" width="175rpx" @click="modelNavigateTo(item)" class="image-mode" :src="item.img" v-for="(item,index) in res.list" :key="index">
<u-loading slot="loading"></u-loading> <u-loading slot="loading"></u-loading>
</u-image> </u-image>
</div> </div>
</template> </template>
<script> <script>
import { modelNavigateTo } from "./tpl";
import {modelNavigateTo} from './tpl'
export default { export default {
title: "四列单行图片模块", title: "四列单行图片模块",
props: ["res"], props: ["res"],
data () { data() {
return { return {
modelNavigateTo, modelNavigateTo,
} };
}, },
mounted() { mounted() {},
}
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -33,7 +29,7 @@ export default {
justify-content: center; justify-content: center;
background-size: cover; background-size: cover;
} }
img{ img {
width: 84px; width: 84px;
} }
</style> </style>

View File

@ -9,6 +9,7 @@
import { modelNavigateTo } from "./tpl"; import { modelNavigateTo } from "./tpl";
export default { export default {
title:"单行图片模块",
data() { data() {
return { return {
modelNavigateTo, modelNavigateTo,

View File

@ -1,31 +1,18 @@
<template> <template>
<div class="layout"> <div class="layout">
<div class="goods-cell-title"> <div class="goods-cell-title">
<div <div class="goods-item-title" :class="{ 'selected-title': selected.index == index }" @click="handleClickTitle(title, index)" v-for="(title, index) in res.list[0].titleWay" :key="index">
class="goods-item-title"
:class="{ 'selected-title': selected.index == index }"
@click="handleClickTitle(title, index)"
v-for="(title, index) in res.list[0].titleWay"
:key="index"
>
<h4 class="h4">{{ title.title }}</h4> <h4 class="h4">{{ title.title }}</h4>
<div>{{ title.desc }}</div> <div>{{ title.desc }}</div>
</div> </div>
</div> </div>
<div class="goods-list"> <div class="goods-list">
<div <div v-if="selected.val == item.type" @click="handleClick(item)" class="goods-item" v-for="(item, item_index) in res.list[0].listWay" :key="item_index">
v-if="selected.val == item.type"
@click="handleClick(item)"
class="goods-item"
v-for="(item, item_index) in res.list[0].listWay"
:key="item_index"
>
<div class="goods-img"> <div class="goods-img">
<u-image :src="item.img" height="350rpx" mode="aspectFit" width="100%"> <u-image :src="item.img" height="350rpx" mode="aspectFit" width="100%">
<u-loading slot="loading"></u-loading <u-loading slot="loading"></u-loading>
></u-image> </u-image>
</div> </div>
<div class="goods-desc"> <div class="goods-desc">
<div class="goods-title"> <div class="goods-title">
@ -42,6 +29,7 @@
<script> <script>
import uImage from "@/uview-ui/components/u-image/u-image.vue"; import uImage from "@/uview-ui/components/u-image/u-image.vue";
export default { export default {
title: "商品分类以及商品",
components: { uImage }, components: { uImage },
data() { data() {
return { return {
@ -55,7 +43,6 @@ export default {
mounted() {}, mounted() {},
methods: { methods: {
handleClick(item) { handleClick(item) {
uni.navigateTo({ uni.navigateTo({
url: `/pages/product/goods?id=${item.id}&goodsId=${item.goodsId}`, url: `/pages/product/goods?id=${item.id}&goodsId=${item.goodsId}`,
}); });
@ -102,7 +89,6 @@ $w_94: 94%;
> h4 { > h4 {
font-size: 32rpx; font-size: 32rpx;
} }
> div { > div {
@ -130,7 +116,7 @@ $w_94: 94%;
margin: 0 auto; margin: 0 auto;
// width: 158px; // width: 158px;
width: $w_94; width: $w_94;
border-top-left-radius: 20rpx; border-top-left-radius: 20rpx;
border-top-right-radius: 20rpx; border-top-right-radius: 20rpx;

View File

@ -3,18 +3,12 @@
<div class="join-list"> <div class="join-list">
<div class="join-title"> <div class="join-title">
<div>{{ res.list[0].title }}</div> <div>{{ res.list[0].title }}</div>
<div>更多</div> <div>更多</div>
</div> </div>
<div class="join-box"> <div class="join-box">
<div class="join-item" @click="modelNavigateTo(item)" v-for="item in 4" :key="item"> <div class="join-item" @click="modelNavigateTo(item)" v-for="item in 4" :key="item">
<div class="item-img-box"> <div class="item-img-box">
<img class="item-img" src="https://picsum.photos/id/268/200/200" alt />
<img
class="item-img"
src="https://picsum.photos/id/268/200/200"
alt
/>
</div> </div>
<div class="item-price"> <div class="item-price">
<span>120.00</span> <span>120.00</span>
@ -28,19 +22,19 @@
</div> </div>
</template> </template>
<script> <script>
// TODO
import {modelNavigateTo} from './tpl' import { modelNavigateTo } from "./tpl";
export default { export default {
props: ["res"], props: ["res"],
data () { title: "拼团",
data() {
return { return {
modelNavigateTo, modelNavigateTo,
} };
}, },
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "./tpl.scss"; @import "./tpl.scss";
@import './advertising.scss'; @import "./advertising.scss";
</style> </style>

View File

@ -3,18 +3,12 @@
<div class="join-list"> <div class="join-list">
<div class="join-title"> <div class="join-title">
<div>{{ res.list[0].title }}</div> <div>{{ res.list[0].title }}</div>
<div>更多</div> <div>更多</div>
</div> </div>
<div class="join-box"> <div class="join-box">
<div class="join-item" v-for="item in 4" :key="item"> <div class="join-item" v-for="item in 4" :key="item">
<div class="item-img-box"> <div class="item-img-box">
<img <img class="item-img" src="https://picsum.photos/id/268/200/200" alt />
class="item-img"
src="https://picsum.photos/id/268/200/200"
alt
/>
</div> </div>
<div class="item-price"> <div class="item-price">
<span>20积分</span> <span>20积分</span>
@ -28,7 +22,9 @@
</div> </div>
</template> </template>
<script> <script>
// TODO
export default { export default {
title:"积分商品",
props: ["res"], props: ["res"],
}; };
</script> </script>

View File

@ -3,7 +3,6 @@
<div class="join-list"> <div class="join-list">
<div class="join-title"> <div class="join-title">
<div>{{ res.list[0].title }}</div> <div>{{ res.list[0].title }}</div>
<div>更多</div> <div>更多</div>
</div> </div>
<div class="join-box"> <div class="join-box">
@ -28,8 +27,10 @@
</div> </div>
</template> </template>
<script> <script>
// TODO
export default { export default {
props: ["res"], props: ["res"],
title:"团购"
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -20,7 +20,6 @@
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import {modelNavigateTo} from './tpl' import {modelNavigateTo} from './tpl'
export default { export default {

View File

@ -20,6 +20,7 @@
<script> <script>
import {modelNavigateTo} from './tpl' import {modelNavigateTo} from './tpl'
export default { export default {
title:"五列菜单",
props: ["res"], props: ["res"],
data () { data () {
return { return {

View File

@ -8,6 +8,7 @@
</template> </template>
<script> <script>
export default { export default {
title:"搜索栏",
props: ["res"], props: ["res"],
methods: { methods: {
handleSearch() { handleSearch() {

View File

@ -3,13 +3,11 @@
<div class="join-list"> <div class="join-list">
<div class="join-title"> <div class="join-title">
<div>{{ res.list[0].title }}</div> <div>{{ res.list[0].title }}</div>
<div>更多</div> <div>更多</div>
</div> </div>
<div class="join-box"> <div class="join-box">
<div class="join-item" v-for="item in 4" :key="item"> <div class="join-item" v-for="item in 4" :key="item">
<div class="item-img-box"> <div class="item-img-box">
<img <img
class="item-img" class="item-img"
src="https://picsum.photos/id/268/200/200" src="https://picsum.photos/id/268/200/200"
@ -28,6 +26,7 @@
</div> </div>
</template> </template>
<script> <script>
// TODO
export default { export default {
props: ["res"], props: ["res"],
}; };

View File

@ -1,51 +1,47 @@
<template> <template>
<div class="layout"> <div class="layout">
<div class="background"> <div class="background">
<div class="title" :style="{ color: res.list[0].color }"> <div class="title" :style="{ color: res.list[0].color }">
{{ res.list[0].title }}
{{ res.list[0].title }} </div>
</div> </div>
</div> </div>
</div>
</template> </template>
<script> <script>
export default { export default {
title: "标题栏", title: "标题栏",
props: ["res"], props: ["res"],
mounted() { mounted() {},
};
},
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "./tpl.scss"; @import "./tpl.scss";
.background {
background: url("/static/title.png") no-repeat;
position: absolute;
z-index: 2;
width: 100%;
height: 84rpx;
background-position-x: center;
background-position-y: center;
background-size: cover;
}
.background { .layout {
background: url("/static/title.png") no-repeat; text-align: center;
position: absolute; position: relative;
z-index: 2; height: 84rpx;
width: 100%; display: flex;
height: 84rpx; align-items: center;
background-position-x: center; justify-content: center;
background-position-y: center;
background-size: cover;
}
.layout { background: #ffffff;
text-align: center; }
position: relative;
height: 84rpx;
display: flex;
align-items: center;
justify-content: center;
background: #ffffff; .title {
} line-height: 84rpx;
font-size: 30rpx;
.title { font-weight: bold;
line-height: 84rpx; }
font-size: 30rpx;
font-weight: bold;
}
</style> </style>

View File

@ -2,7 +2,8 @@
<div class="wrapper"> <div class="wrapper">
<!-- uni 中不能使用 vue component 所以用if判断每个组件 --> <!-- uni 中不能使用 vue component 所以用if判断每个组件 -->
<div v-for="(item,index) in pageData.list" :key="index"> <div v-for="(item,index) in pageData.list" :key="index">
<u-navbar class="navbar" v-if="item.type == 'search'" :is-back="false"> <!-- 搜索栏如果在楼层装修顶部则会自动浮动否则不浮动 -->
<u-navbar class="navbar" v-if="item.type == 'search'" :is-back="false" :is-fixed="index ===1 ? false : true">
<search style="width:100%" :res="item.options" /> <search style="width:100%" :res="item.options" />
<!-- #ifndef H5 --> <!-- #ifndef H5 -->
<!-- 扫码功能 不兼容h5 详情文档: https://uniapp.dcloud.io/api/system/barcode?id=scancode --> <!-- 扫码功能 不兼容h5 详情文档: https://uniapp.dcloud.io/api/system/barcode?id=scancode -->
@ -23,12 +24,13 @@
<flexTwo v-if="item.type == 'flexTwo'" :res="item.options" /> <flexTwo v-if="item.type == 'flexTwo'" :res="item.options" />
<textPicture v-if="item.type == 'textPicture'" :res="item.options" /> <textPicture v-if="item.type == 'textPicture'" :res="item.options" />
<menuLayout v-if="item.type == 'menu'" :res="item.options" /> <menuLayout v-if="item.type == 'menu'" :res="item.options" />
<joinGroup v-if="item.type == 'joinGroup'" :res="item.options" />
<flexOne v-if="item.type == 'flexOne'" :res="item.options" /> <flexOne v-if="item.type == 'flexOne'" :res="item.options" />
<goods v-if="item.type == 'goods'" :res="item.options" /> <goods v-if="item.type == 'goods'" :res="item.options" />
<integral v-if="item.type == 'integral'" :res="item.options" />
<spike v-if="item.type == 'spike'" :res="item.options" />
<group v-if="item.type == 'group'" :res="item.options" /> <group v-if="item.type == 'group'" :res="item.options" />
<!-- <joinGroup v-if="item.type == 'joinGroup'" :res="item.options" /> -->
<!-- <integral v-if="item.type == 'integral'" :res="item.options" /> -->
<!-- <spike v-if="item.type == 'spike'" :res="item.options" /> -->
</div> </div>
<u-no-network></u-no-network> <u-no-network></u-no-network>
</div> </div>
@ -36,34 +38,35 @@
<script> <script>
// //
import tpl_banner from "@/pages/tabbar/home/template/tpl_banner"; import tpl_banner from "@/pages/tabbar/home/template/tpl_banner"; //
import tpl_title from "@/pages/tabbar/home/template/tpl_title"; import tpl_title from "@/pages/tabbar/home/template/tpl_title"; //
import tpl_left_one_right_two from "@/pages/tabbar/home/template/tpl_left_one_right_two"; import tpl_left_one_right_two from "@/pages/tabbar/home/template/tpl_left_one_right_two"; //
import tpl_left_two_right_one from "@/pages/tabbar/home/template/tpl_left_two_right_one"; import tpl_left_two_right_one from "@/pages/tabbar/home/template/tpl_left_two_right_one"; //
import tpl_top_one_bottom_two from "@/pages/tabbar/home/template/tpl_top_one_bottom_two"; import tpl_top_one_bottom_two from "@/pages/tabbar/home/template/tpl_top_one_bottom_two"; //
import tpl_top_two_bottom_one from "@/pages/tabbar/home/template/tpl_top_two_bottom_one"; import tpl_top_two_bottom_one from "@/pages/tabbar/home/template/tpl_top_two_bottom_one"; //
import tpl_flex_one from "@/pages/tabbar/home/template/tpl_flex_one"; import tpl_flex_one from "@/pages/tabbar/home/template/tpl_flex_one"; //
import tpl_flex_two from "@/pages/tabbar/home/template/tpl_flex_two"; import tpl_flex_two from "@/pages/tabbar/home/template/tpl_flex_two"; //
import tpl_flex_three from "@/pages/tabbar/home/template/tpl_flex_three"; import tpl_flex_three from "@/pages/tabbar/home/template/tpl_flex_three"; //
import tpl_flex_five from "@/pages/tabbar/home/template/tpl_flex_five"; import tpl_flex_five from "@/pages/tabbar/home/template/tpl_flex_five"; //
import tpl_flex_four from "@/pages/tabbar/home/template/tpl_flex_four"; import tpl_flex_four from "@/pages/tabbar/home/template/tpl_flex_four"; //
import tpl_text_picture from "@/pages/tabbar/home/template/tpl_text_picture"; import tpl_text_picture from "@/pages/tabbar/home/template/tpl_text_picture"; //
import tpl_menu from "@/pages/tabbar/home/template/tpl_menu"; import tpl_menu from "@/pages/tabbar/home/template/tpl_menu"; //
import tpl_search from "@/pages/tabbar/home/template/tpl_search"; import tpl_search from "@/pages/tabbar/home/template/tpl_search"; //
import tpl_join_group from "@/pages/tabbar/home/template/tpl_join_group"; import tpl_group from "@/pages/tabbar/home/template/tpl_group"; //
import tpl_integral from "@/pages/tabbar/home/template/tpl_integral"; import tpl_goods from "@/pages/tabbar/home/template/tpl_goods"; //
import tpl_spike from "@/pages/tabbar/home/template/tpl_spike";
import tpl_group from "@/pages/tabbar/home/template/tpl_group";
import tpl_goods from "@/pages/tabbar/home/template/tpl_goods";
// //
import { getFloorData } from "@/api/home"; import { getFloorData } from "@/api/home"; //
import permision from "@/js_sdk/wa-permission/permission.js"; //
// TODO
// import tpl_join_group from "@/pages/tabbar/home/template/tpl_join_group";
// import tpl_integral from "@/pages/tabbar/home/template/tpl_integral";
// import tpl_spike from "@/pages/tabbar/home/template/tpl_spike";
import { modelNavigateTo } from "./template/tpl.js"; //
import permision from "@/js_sdk/wa-permission/permission.js"; //
export default { export default {
data() { data() {
return { return {
pageData: "", pageData: "", //
}; };
}, },
components: { components: {
@ -80,17 +83,15 @@ export default {
textPicture: tpl_text_picture, textPicture: tpl_text_picture,
menuLayout: tpl_menu, menuLayout: tpl_menu,
search: tpl_search, search: tpl_search,
joinGroup: tpl_join_group,
flexOne: tpl_flex_one, flexOne: tpl_flex_one,
goods: tpl_goods, goods: tpl_goods,
integral: tpl_integral,
spike: tpl_spike,
group: tpl_group, group: tpl_group,
// spike: tpl_spike,
// joinGroup: tpl_join_group,
// integral: tpl_integral,
}, },
mounted() { mounted() {
this.init(); this.init();
}, },
methods: { methods: {
@ -110,11 +111,12 @@ export default {
* 没权限去申请权限有权限获取扫码功能 * 没权限去申请权限有权限获取扫码功能
*/ */
scan() { scan() {
if (permision.judgeIosPermission("camera")) { if (permision.judgeIosPermission("camera")) {
uni.scanCode({ uni.scanCode({
success: function (res) { success: function (res) {
let path = encodeURIComponent(res.result); let path = encodeURIComponent(res.result);
// TODO
// webview
setTimeout(() => { setTimeout(() => {
uni.navigateTo({ uni.navigateTo({
url: "/pages/tabbar/home/web-view?src=" + path, url: "/pages/tabbar/home/web-view?src=" + path,
@ -123,6 +125,7 @@ export default {
}, },
}); });
} else { } else {
//
uni.showModal({ uni.showModal({
title: "提示", title: "提示",
content: "您已经关闭相机权限,去设置", content: "您已经关闭相机权限,去设置",