提交 d3a960dc 编写于 作者: L linju

12

上级 9d05c7e8
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
}, },
onLaunch: function() { onLaunch: function() {
console.log('App Launch') console.log('App Launch')
// initApp(); initApp();
}, },
onShow: function() { onShow: function() {
console.log('App Show') console.log('App Show')
......
...@@ -25,7 +25,7 @@ function keepScreenOn(){ ...@@ -25,7 +25,7 @@ function keepScreenOn(){
* // 初始化appVersion * // 初始化appVersion
*/ */
function initAppVersion(){ function initAppVersion(){
// #ifdef APP-NVUE // #ifdef APP-PLUS
let appid = plus.runtime.appid; let appid = plus.runtime.appid;
plus.runtime.getProperty(appid ,(wgtInfo) => { plus.runtime.getProperty(appid ,(wgtInfo) => {
wgtInfo.version wgtInfo.version
......
/* 头条小程序需要把 iconfont 样式放到组件外 */
@font-face {
font-family: uniicons;
font-weight: normal;
font-style: normal;
src: url('/static/uni.ttf') format('truetype');
}
.m-icon {
font-family: uniicons;
/* font-size: 24px; */
margin-left: 20px;
font-weight: normal;
font-style: normal;
line-height: 1;
display: inline-block;
text-decoration: none;
-webkit-font-smoothing: antialiased;
}
.m-icon.uni-active {
color: #007aff;
}
.m-icon-contact:before {
content: '\e100';
}
.m-icon-person:before {
content: '\e101';
}
.m-icon-personadd:before {
content: '\e102';
}
.m-icon-contact-filled:before {
content: '\e130';
}
.m-icon-person-filled:before {
content: '\e131';
}
.m-icon-personadd-filled:before {
content: '\e132';
}
.m-icon-phone:before {
content: '\e200';
}
.m-icon-email:before {
content: '\e201';
}
.m-icon-chatbubble:before {
content: '\e202';
}
.m-icon-chatboxes:before {
content: '\e203';
}
.m-icon-phone-filled:before {
content: '\e230';
}
.m-icon-email-filled:before {
content: '\e231';
}
.m-icon-chatbubble-filled:before {
content: '\e232';
}
.m-icon-chatboxes-filled:before {
content: '\e233';
}
.m-icon-weibo:before {
content: '\e260';
}
.m-icon-weixin:before {
content: '\e261';
}
.m-icon-pengyouquan:before {
content: '\e262';
}
.m-icon-chat:before {
content: '\e263';
}
.m-icon-qq:before {
content: '\e264';
}
.m-icon-videocam:before {
content: '\e300';
}
.m-icon-camera:before {
content: '\e301';
}
.m-icon-mic:before {
content: '\e302';
}
.m-icon-location:before {
content: '\e303';
}
.m-icon-mic-filled:before,
.m-icon-speech:before {
content: '\e332';
}
.m-icon-location-filled:before {
content: '\e333';
}
.m-icon-micoff:before {
content: '\e360';
}
.m-icon-image:before {
content: '\e363';
}
.m-icon-map:before {
content: '\e364';
}
.m-icon-compose:before {
content: '\e400';
}
.m-icon-trash:before {
content: '\e401';
}
.m-icon-upload:before {
content: '\e402';
}
.m-icon-download:before {
content: '\e403';
}
.m-icon-close:before {
content: '\e404';
}
.m-icon-redo:before {
content: '\e405';
}
.m-icon-undo:before {
content: '\e406';
}
.m-icon-refresh:before {
content: '\e407';
}
.m-icon-star:before {
content: '\e408';
}
.m-icon-plus:before {
content: '\e409';
}
.m-icon-minus:before {
content: '\e410';
}
.m-icon-circle:before,
.m-icon-checkbox:before {
content: '\e411';
}
.m-icon-close-filled:before,
.m-icon-clear:before {
content: '\e434';
}
.m-icon-refresh-filled:before {
content: '\e437';
}
.m-icon-star-filled:before {
content: '\e438';
}
.m-icon-plus-filled:before {
content: '\e439';
}
.m-icon-minus-filled:before {
content: '\e440';
}
.m-icon-circle-filled:before {
content: '\e441';
}
.m-icon-checkbox-filled:before {
content: '\e442';
}
.m-icon-closeempty:before {
content: '\e460';
}
.m-icon-refreshempty:before {
content: '\e461';
}
.m-icon-reload:before {
content: '\e462';
}
.m-icon-starhalf:before {
content: '\e463';
}
.m-icon-spinner:before {
content: '\e464';
}
.m-icon-spinner-cycle:before {
content: '\e465';
}
.m-icon-search:before {
content: '\e466';
}
.m-icon-plusempty:before {
content: '\e468';
}
.m-icon-forward:before {
content: '\e470';
}
.m-icon-back:before,
.m-icon-left-nav:before {
content: '\e471';
}
.m-icon-checkmarkempty:before {
content: '\e472';
}
.m-icon-home:before {
content: '\e500';
}
.m-icon-navigate:before {
content: '\e501';
}
.m-icon-gear:before {
content: '\e502';
}
.m-icon-paperplane:before {
content: '\e503';
}
.m-icon-info:before {
content: '\e504';
}
.m-icon-help:before {
content: '\e505';
}
.m-icon-locked:before {
content: '\e506';
}
.m-icon-more:before {
content: '\e507';
}
.m-icon-flag:before {
content: '\e508';
}
.m-icon-home-filled:before {
content: '\e530';
}
.m-icon-gear-filled:before {
content: '\e532';
}
.m-icon-info-filled:before {
content: '\e534';
}
.m-icon-help-filled:before {
content: '\e535';
}
.m-icon-more-filled:before {
content: '\e537';
}
.m-icon-settings:before {
content: '\e560';
}
.m-icon-list:before {
content: '\e562';
}
.m-icon-bars:before {
content: '\e563';
}
.m-icon-loop:before {
content: '\e565';
}
.m-icon-paperclip:before {
content: '\e567';
}
.m-icon-eye:before {
content: '\e568';
}
.m-icon-arrowup:before {
content: '\e580';
}
.m-icon-arrowdown:before {
content: '\e581';
}
.m-icon-arrowleft:before {
content: '\e582';
}
.m-icon-arrowright:before {
content: '\e583';
}
.m-icon-arrowthinup:before {
content: '\e584';
}
.m-icon-arrowthindown:before {
content: '\e585';
}
.m-icon-arrowthinleft:before {
content: '\e586';
}
.m-icon-arrowthinright:before {
content: '\e587';
}
.m-icon-pulldown:before {
content: '\e588';
}
.m-icon-scan:before {
content: "\e612";
}
/*每个页面公共css */
page {
min-height: 100%;
display: flex;
font-size: 14px;
}
input,
textarea,
button {
font-size: 14px;
}
/* #ifdef MP-BAIDU */
page {
width: 100%;
height: 100%;
display: block;
}
swan-template {
width: 100%;
min-height: 100%;
display: flex;
}
/* 原生组件模式下需要注意组件外部样式 */
custom-component {
width: 100%;
min-height: 100%;
display: flex;
}
/* #endif */
/* #ifdef MP-ALIPAY */
page {
min-height: 100vh;
}
/* #endif */
/* 原生组件模式下需要注意组件外部样式 */
m-input {
width: 100%;
/* min-height: 100%; */
display: flex;
flex: 1;
}
.content {
display: flex;
flex: 1;
flex-direction: column;
background-color: #efeff4;
padding: 10px;
}
.input-group {
background-color: #ffffff;
margin-top: 20px;
position: relative;
}
.input-group::before {
position: absolute;
right: 0;
top: 0;
left: 0;
height: 1px;
content: '';
-webkit-transform: scaleY(.5);
transform: scaleY(.5);
background-color: #c8c7cc;
}
.input-group::after {
position: absolute;
right: 0;
bottom: 0;
left: 0;
height: 1px;
content: '';
-webkit-transform: scaleY(.5);
transform: scaleY(.5);
background-color: #c8c7cc;
}
.input-row {
display: flex;
flex-direction: row;
position: relative;
/* font-size: 18px; */
height: 40px;
line-height: 40px;
}
.input-row .title {
width: 70px;
padding-left: 15px;
}
.input-row.border::after {
position: absolute;
right: 0;
bottom: 0;
left: 8px;
height: 1px;
content: '';
-webkit-transform: scaleY(.5);
transform: scaleY(.5);
background-color: #c8c7cc;
}
.btn-row {
margin-top: 25px;
padding: 10px;
}
button.primary {
background-color: #0faeff;
}
\ No newline at end of file
.uni-flex {
display: flex;
}
.uni-flex-row {
@extend .uni-flex;
flex-direction: row;
box-sizing: border-box;
}
.uni-flex-column {
@extend .uni-flex;
flex-direction: column;
}
.uni-color-gary {
color: #3b4144;
}
/* 标题 */
.uni-title {
display: flex;
margin-bottom: $uni-spacing-col-base;
font-size: $uni-font-size-lg;
font-weight: bold;
color: #3b4144;
}
.uni-title-sub {
display: flex;
// margin-bottom: $uni-spacing-col-base;
font-size: $uni-font-size-base;
font-weight: 500;
color: #3b4144;
}
/* 描述 额外文本 */
.uni-note {
margin-top: 10px;
color: #999;
font-size: $uni-font-size-sm;
}
/* 列表内容 */
.uni-list-box {
@extend .uni-flex-row;
flex: 1;
margin-top: 10px;
}
/* 略缩图 */
.uni-thumb {
flex-shrink: 0;
margin-right: $uni-spacing-row-base;
width: 125px;
height: 75px;
border-radius: $uni-border-radius-lg;
overflow: hidden;
border: 1px #f5f5f5 solid;
image {
width: 100%;
height: 100%;
}
}
.uni-media-box {
@extend .uni-flex-row;
// margin-bottom: $uni-spacing-col-base;
border-radius: $uni-border-radius-lg;
overflow: hidden;
.uni-thumb {
margin: 0;
margin-left: 4px;
flex-shrink: 1;
width: 33%;
border-radius:0;
&:first-child {
margin: 0;
}
}
}
/* 内容 */
.uni-content {
@extend .uni-flex-column;
justify-content: space-between;
}
/* 列表footer */
.uni-footer {
@extend .uni-flex-row;
justify-content: space-between;
margin-top: $uni-spacing-col-lg;
}
.uni-footer-text {
font-size: $uni-font-size-sm;
color: $uni-text-color-grey;
margin-left: 5px;
}
/* 标签 */
.uni-tag {
flex-shrink: 0;
padding: 0 5px;
border: 1px $uni-border-color solid;
margin-right: $uni-spacing-row-sm;
border-radius: $uni-border-radius-base;
background: $uni-bg-color-grey;
color: $uni-text-color;
font-size: $uni-font-size-sm;
}
/* 链接 */
.uni-link {
margin-left: 10px;
color: $uni-text-color;
text-decoration: underline;
}
此差异已折叠。
import Vuex from '@/store/index.js'
export function univerifyLogin() {
const commit = Vuex.commit;
const PROVIDER = 'univerify';
/**
* reject(true) 点击其他登录方式
* reject(false) 关闭登录框
*/
return new Promise((resolve, reject) => {
uni.getProvider({
service: 'oauth',
success: (res) => {
if (res.provider.indexOf(PROVIDER) !== -1) {
// 一键登录已在APP onLaunch的时候进行了预登陆,可以显著提高登录速度。登录成功后,预登陆状态会重置
uni.login({
provider: PROVIDER,
success: (res) => {
uni.closeAuthView();
uni.showLoading();
uniCloud.callFunction({
name: 'user-center',
data: {
action: 'loginByUniverify',
params: res.authResult
},
success: (e) => {
console.log('login success', e);
if (e.result.code == 0) {
const username = e.result.username || e.result.mobile || '一键登录新用户'
uni.setStorageSync('uni_id_token', e.result.token)
uni.setStorageSync('username', username)
uni.setStorageSync('login_type', 'online')
commit('login', username)
resolve();
uni.switchTab({
url: '../main/main',
});
} else {
uni.showModal({
title: `登录失败: ${e.result.code}`,
content: e.result.message,
showCancel: false
})
console.log('登录失败', e);
e.result.errMsg = e.result.message;
}
},
fail: (e) => {
uni.showModal({
title: `登录失败`,
content: e.errMsg,
showCancel: false
})
},
complete: () => {
uni.hideLoading()
}
})
},
fail: (err) => {
console.error('授权登录失败:' + JSON.stringify(err));
// 一键登录点击其他登录方式
if (err.code == 30002) {
uni.closeAuthView();
reject(true);
return;
}
// 关闭登录
if (err.code == 30003) {
uni.closeAuthView();
reject(false);
return;
}
reject(err);
}
})
} else {
reject();
}
},
fail: (err) => {
console.error('获取服务供应商失败:' + err.errMsg);
reject(err)
}
});
})
}
export function univerifyErrorHandler(err, cb) {
if (!err) {
cb && cb()
return
};
const state = Vuex.state;
const obj = {
/* showCancel: true,
cancelText: '其他登录方式',
success(res) {
if (res.cancel) {
cb && cb()
}
} */
}
switch (true) {
// 未开通
case err.code == 1000:
uni.showModal(Object.assign({
title: `登录失败`,
content: `${err.errMsg},错误码:${err.code}\n开通指南:https://ask.dcloud.net.cn/article/37965`,
}, obj));
break;
// 预登陆失败
case err.code == 30005:
uni.showModal(Object.assign({
showCancel: false,
title: `预登录失败`,
content: `${err.errMsg},错误码:${err.code}`
}, obj));
break;
//用户关闭验证界面
case err.code != 30003:
uni.showModal(Object.assign({
showCancel: false,
title: `登录失败`,
content: `${err.errMsg},错误码:${err.code}`,
}, obj));
break;
}
}
此差异已折叠。
export function getDeviceUUID() {
let deviceId = uni.getStorageSync('uni_deviceId') ||
uni.getSystemInfoSync().deviceId ||
uni.getSystemInfoSync().system + '_' + Math.random().toString(36).substr(2);
uni.setStorageSync('uni_deviceId', deviceId)
return deviceId;
}
export function friendlyDate(timestamp) {
var formats = {
'year': '%n% 年前',
'month': '%n% 月前',
'day': '%n% 天前',
'hour': '%n% 小时前',
'minute': '%n% 分钟前',
'second': '%n% 秒前',
};
var now = Date.now();
var seconds = Math.floor((now - timestamp) / 1000);
var minutes = Math.floor(seconds / 60);
var hours = Math.floor(minutes / 60);
var days = Math.floor(hours / 24);
var months = Math.floor(days / 30);
var years = Math.floor(months / 12);
var diffType = '';
var diffValue = 0;
if (years > 0) {
diffType = 'year';
diffValue = years;
} else {
if (months > 0) {
diffType = 'month';
diffValue = months;
} else {
if (days > 0) {
diffType = 'day';
diffValue = days;
} else {
if (hours > 0) {
diffType = 'hour';
diffValue = hours;
} else {
if (minutes > 0) {
diffType = 'minute';
diffValue = minutes;
} else {
diffType = 'second';
diffValue = seconds === 0 ? (seconds = 1) : seconds;
}
}
}
}
}
return formats[diffType].replace('%n%', diffValue);
}
\ No newline at end of file
<template>
<uni-popup ref="popup" type="center" :maskClick="false">
<view class="update-wrap">
<view class="white-bg"></view>
<image src="@/static/images/top_2.png" class="updateCon-img"></image>
<view class="updateCon-top">
<!-- 发现新版本 -->
<text class="update-top-title">发现新版本</text>
<text class="update-top-version">V{{update_info.version}}</text>
</view>
<text class="uodate-content" v-if="!update_ing">更新内容:{{update_info.version_note}}</text>
<text class="current-version" v-if="!update_ing">当前版本:V{{version}}</text>
<view class="update-btn" v-if="!update_ing">
<view class="update-btn-item update-btn-left" @click="up_close">
<!-- 残忍拒绝 -->
<text class="update-btn-item-text ">残忍拒绝</text>
</view>
<view class="update-btn-item" @click="nowUpdate">
<!-- 立即升级 -->
<text class="update-btn-item-text text-bule">立即升级</text>
</view>
</view>
<!-- 下载进度 -->
<view class="sche-wrap" v-if="update_ing">
<!-- 更新包下载中 -->
<text class="sche-wrap-text">更新包下载中...</text>
<view class="sche-bg">
<view class="sche-bg-jindu" :style="lengthWidth">
<view class="sche-bg-round">
<text class="sche-bg-round-text" v-if="schedule">{{schedule}}%</text>
<text class="sche-bg-round-text" v-else>{{(downloadedSize/1024/1024 ).toFixed(2)}}M</text>
</view>
</view>
</view>
</view>
</view>
</uni-popup>
</template>
<script>
import uniPopup from '@/components/uni-popup/uni-popup.vue'
export default {
data() {
return {
platform: "", //ios or android
version: "1.0.0", //当前软件版本
is_update: false, // 是否更新
is_reques: false, //是否请求中
update_info: {
"type": "1", //1分发平台更新 2安装包/升级包更新
"version_note": "", //ios更新备注
"version": "1.0.0", //ios版本号
"download_url": "", //ios更新新链接
},
is_update: false,
schedule: 0,
update_ing: false, //点击升级
is_down: false,
downloadedSize: 0,
};
},
components:{uniPopup},
mounted() {
this.getSystemInfo() //获取系统新
},
computed: {
// 下载进度计算
lengthWidth: function() {
return {
width: this.schedule * 480 / 100 + "rpx"
}
}
},
methods: {
// 获取系统信息
getSystemInfo() {
let vm = this;
// 获取手机系统信息
uni.getSystemInfo({
success: function(res) {
vm.platform = res.platform //ios or android
}
});
// 获取版本号
plus.runtime.getProperty(plus.runtime.appid, function(inf) {
vm.version = inf.version
});
vm.getUpdateInfo(); //获取更新信息
},
// 获取线上版本信息
getUpdateInfo() {
let vm = this;
uni.request({
url: 'http://ui.ishenghuo.org.cn/api/version.php', //仅为示例,并非真实接口地址。
success: (res) => {
let data = res.data.data;
if (vm.platform == "ios") {
vm.update_info.type = data.ios_type
vm.update_info.version_note = data.ios_version_note
vm.update_info.version = data.ios_version
vm.update_info.download_url = data.ios_download_url
} else if (vm.platform == "android") {
vm.update_info.type = data.android_type
vm.update_info.version_note = data.android_version_note
vm.update_info.version = data.android_version
vm.update_info.download_url = data.android_download_url
} else {
return false
}
vm.checkUpdate(); ///检查是否更新
}
});
},
// 检查是否更新
checkUpdate() {
let vm = this;
vm.is_update = vm.compareVersion(vm.version, vm.update_info.version); // 检查是否升级
if (vm.is_update) {
vm.$refs.popup.open() //显示升级弹窗
} else {
// 不更新,根据需要做处理
}
},
// 取消更新
up_close() {
// console.log('点击取消')
plus.os.name == "Android" ? plus.runtime.quit() : plus.ios.import("UIApplication").sharedApplication().performSelector("exit");
},
// 立即更新
nowUpdate() {
let vm = this;
if(vm.is_reques){
return false //如果正在下载就停止操作
}else{
vm.is_reques = true
}
console.log(111111);
if (vm.update_info.type == 1) {
// 分发平台更新 //调用浏览器打开链接或者分发平台
plus.runtime.openURL(vm.update_info.download_url, function() {
plus.nativeUI.toast("打开错误");
});
setTimeout(function() {
plus.runtime.quit(); //五秒后关闭app
}, 5000)
} else if (vm.update_info.type == 2) {
// 安装包/升级包更新
vm.download_wgt()
}
},
// 下载升级资源包
download_wgt() {
let vm = this;
plus.nativeUI.showWaiting("下载更新文件..."); //下载更新文件...
let options = {
method: "POST"
};
let dtask = plus.downloader.createDownload(vm.update_info.download_url, options);
dtask.addEventListener("statechanged", function(task, status) {
switch (task.state) {
case 1: // 开始
break;
case 2: //已连接到服务器
vm.update_ing = true;
break;
case 3: // 已接收到数据
vm.downloadedSize = task.downloadedSize;
let totalSize = 0;
if (task.totalSize) {
totalSize = task.totalSize //服务器须返回正确的content-length才会有长度
}
vm.schedule = parseInt(100 * task.downloadedSize / totalSize);
break;
case 4:
vm.installWgt(task.filename); // 安装wgt包
break;
}
});
dtask.start();
},
// 安装文件
installWgt(path) {
let vm = this;
plus.nativeUI.showWaiting("安装更新文件..."); //安装更新文件...
plus.runtime.install(path, {}, function() {
plus.nativeUI.closeWaiting();
// 应用资源更新完成!
plus.nativeUI.alert("应用资源更新完成!", function() {
plus.runtime.restart();
});
}, function(e) {
plus.nativeUI.closeWaiting();
// 安装更新文件失败
plus.nativeUI.alert("安装更新文件失败[" + e.code + "]:" + e.message);
});
},
// 对比版本号
compareVersion(ov, nv) {
if (!ov || !nv || ov == "" || nv == "") {
return false;
}
let b = false,
ova = ov.split(".", 4),
nva = nv.split(".", 4);
for (let i = 0; i < ova.length && i < nva.length; i++) {
let so = ova[i],
no = parseInt(so),
sn = nva[i],
nn = parseInt(sn);
if (nn > no || sn.length > so.length) {
return true;
} else if (nn < no) {
return false;
}
}
if (nva.length > ova.length && 0 == nv.indexOf(ov)) {
return true;
} else {
return false;
}
},
}
}
</script>
<style scoped>
/*#ifndef APP-NVUE*/
view {
display: flex;
flex-direction: column;
box-sizing: border-box;
}
/*#endif*/
.updateBox {
background-color: rgba(0, 0, 0, 0.6);
z-index: 1000;
position: fixed;
right: 0px;
top: 0;
left: 0;
bottom: 0;
align-items: center;
justify-content: center;
}
.update-wrap {
width: 580rpx;
height: 500rpx;
border-radius: 10px;
padding-bottom: 0px;
position: relative;
}
.white-bg {
position: absolute;
top: 60rpx;
left: 0px;
width: 580rpx;
height: 440rpx;
background-color: #ffffff;
border-bottom-left-radius: 30rpx;
border-bottom-right-radius: 30rpx;
}
.updateCon-img {
position: absolute;
top: 0rpx;
left: 0px;
width: 580rpx;
height: 440rpx;
}
.updateCon-top {
padding: 70rpx 50rpx;
/*#ifndef APP-NVUE*/
z-index: 1;
/*#endif*/
}
.update-top-title {
color: #fff;
font-size: 36rpx;
font-weight: bold;
}
.update-top-version {
color: #fff;
font-size: 28rpx;
margin-top: 10rpx;
}
.uodate-content {
color: #333;
font-size: 18px;
padding: 0px 50rpx;
margin-top: 80rpx;
/*#ifndef APP-NVUE*/
z-index: 1;
/*#endif*/
}
.current-version {
text-align: center;
margin-top: 10rpx;
font-size: 24rpx;
color: #666;
/*#ifndef APP-NVUE*/
z-index: 1;
/*#endif*/
}
.update-btn {
position: absolute;
left: 0px;
bottom: 0px;
width: 580rpx;
height: 80rpx;
padding: 0px 50rpx;
align-items: center;
flex-direction: row;
border-top-color: #e7e7e7;
border-top-style: solid;
border-top-width: 1px;
background-color: #fff;
border-bottom-left-radius: 30rpx;
border-bottom-right-radius: 30rpx;
}
.update-btn-item {
width: 240rpx;
height: 80rpx;
justify-content: center;
align-items: center;
}
.update-btn-left {
border-right-color: #e7e7e7;
border-right-style: solid;
border-right-width: 1px;
}
.update-btn-item-text {
text-align: center;
font-size: 28rpx;
color: #666;
}
.text-bule {
color: #045FCF;
}
.sche-wrap {
padding: 0px 50rpx 0rpx;
height: 100rpx;
align-items: center;
border-bottom-left-radius: 30rpx;
border-bottom-right-radius: 30rpx;
flex: 1;
justify-content: flex-end;
}
.sche-wrap-text {
font-size: 24rpx;
color: #666;
margin-bottom: 20rpx;
}
.sche-bg {
position: relative;
background-color: #ccc;
height: 20rpx;
border-radius: 100px;
width: 480rpx;
margin-bottom: 30rpx;
}
.sche-bg-jindu {
position: absolute;
left: 0px;
top: 0px;
height: 20rpx;
background-color: #5775e7;
border-radius: 100px;
}
.sche-bg-round {
position: absolute;
left: 100%;
height: 24rpx;
width: 24rpx;
background-color: #fff;
border-color: #fff;
border-style: solid;
border-width: 10px;
border-radius: 100px;
transform: translateX(-20rpx) translateY(-10rpx);
}
.sche-bg-round-text {
font-size: 24rpx;
width: 120rpx;
text-align: center;
transform: translateX(-50rpx) translateY(-40rpx);
color: #5775e7;
}
.uodate-close {
/* display: flex; */
flex-direction: row;
justify-content: center;
padding-top: 50rpx;
}
.uodate-close-img {
width: 80rpx;
height: 80rpx;
}
</style>
@font-face {
font-family: uniicons;
font-weight: normal;
font-style: normal;
src: url('/static/uni.ttf') format('truetype');
}
.m-icon {
font-family: uniicons;
/* font-size: 24px; */
margin-left: 20px;
font-weight: normal;
font-style: normal;
line-height: 1;
display: inline-block;
text-decoration: none;
-webkit-font-smoothing: antialiased;
}
.m-icon.uni-active {
color: #007aff;
}
.m-icon-contact:before {
content: '\e100';
}
.m-icon-person:before {
content: '\e101';
}
.m-icon-personadd:before {
content: '\e102';
}
.m-icon-contact-filled:before {
content: '\e130';
}
.m-icon-person-filled:before {
content: '\e131';
}
.m-icon-personadd-filled:before {
content: '\e132';
}
.m-icon-phone:before {
content: '\e200';
}
.m-icon-email:before {
content: '\e201';
}
.m-icon-chatbubble:before {
content: '\e202';
}
.m-icon-chatboxes:before {
content: '\e203';
}
.m-icon-phone-filled:before {
content: '\e230';
}
.m-icon-email-filled:before {
content: '\e231';
}
.m-icon-chatbubble-filled:before {
content: '\e232';
}
.m-icon-chatboxes-filled:before {
content: '\e233';
}
.m-icon-weibo:before {
content: '\e260';
}
.m-icon-weixin:before {
content: '\e261';
}
.m-icon-pengyouquan:before {
content: '\e262';
}
.m-icon-chat:before {
content: '\e263';
}
.m-icon-qq:before {
content: '\e264';
}
.m-icon-videocam:before {
content: '\e300';
}
.m-icon-camera:before {
content: '\e301';
}
.m-icon-mic:before {
content: '\e302';
}
.m-icon-location:before {
content: '\e303';
}
.m-icon-mic-filled:before,
.m-icon-speech:before {
content: '\e332';
}
.m-icon-location-filled:before {
content: '\e333';
}
.m-icon-micoff:before {
content: '\e360';
}
.m-icon-image:before {
content: '\e363';
}
.m-icon-map:before {
content: '\e364';
}
.m-icon-compose:before {
content: '\e400';
}
.m-icon-trash:before {
content: '\e401';
}
.m-icon-upload:before {
content: '\e402';
}
.m-icon-download:before {
content: '\e403';
}
.m-icon-close:before {
content: '\e404';
}
.m-icon-redo:before {
content: '\e405';
}
.m-icon-undo:before {
content: '\e406';
}
.m-icon-refresh:before {
content: '\e407';
}
.m-icon-star:before {
content: '\e408';
}
.m-icon-plus:before {
content: '\e409';
}
.m-icon-minus:before {
content: '\e410';
}
.m-icon-circle:before,
.m-icon-checkbox:before {
content: '\e411';
}
.m-icon-close-filled:before,
.m-icon-clear:before {
content: '\e434';
}
.m-icon-refresh-filled:before {
content: '\e437';
}
.m-icon-star-filled:before {
content: '\e438';
}
.m-icon-plus-filled:before {
content: '\e439';
}
.m-icon-minus-filled:before {
content: '\e440';
}
.m-icon-circle-filled:before {
content: '\e441';
}
.m-icon-checkbox-filled:before {
content: '\e442';
}
.m-icon-closeempty:before {
content: '\e460';
}
.m-icon-refreshempty:before {
content: '\e461';
}
.m-icon-reload:before {
content: '\e462';
}
.m-icon-starhalf:before {
content: '\e463';
}
.m-icon-spinner:before {
content: '\e464';
}
.m-icon-spinner-cycle:before {
content: '\e465';
}
.m-icon-search:before {
content: '\e466';
}
.m-icon-plusempty:before {
content: '\e468';
}
.m-icon-forward:before {
content: '\e470';
}
.m-icon-back:before,
.m-icon-left-nav:before {
content: '\e471';
}
.m-icon-checkmarkempty:before {
content: '\e472';
}
.m-icon-home:before {
content: '\e500';
}
.m-icon-navigate:before {
content: '\e501';
}
.m-icon-gear:before {
content: '\e502';
}
.m-icon-paperplane:before {
content: '\e503';
}
.m-icon-info:before {
content: '\e504';
}
.m-icon-help:before {
content: '\e505';
}
.m-icon-locked:before {
content: '\e506';
}
.m-icon-more:before {
content: '\e507';
}
.m-icon-flag:before {
content: '\e508';
}
.m-icon-home-filled:before {
content: '\e530';
}
.m-icon-gear-filled:before {
content: '\e532';
}
.m-icon-info-filled:before {
content: '\e534';
}
.m-icon-help-filled:before {
content: '\e535';
}
.m-icon-more-filled:before {
content: '\e537';
}
.m-icon-settings:before {
content: '\e560';
}
.m-icon-list:before {
content: '\e562';
}
.m-icon-bars:before {
content: '\e563';
}
.m-icon-loop:before {
content: '\e565';
}
.m-icon-paperclip:before {
content: '\e567';
}
.m-icon-eye:before {
content: '\e568';
}
.m-icon-arrowup:before {
content: '\e580';
}
.m-icon-arrowdown:before {
content: '\e581';
}
.m-icon-arrowleft:before {
content: '\e582';
}
.m-icon-arrowright:before {
content: '\e583';
}
.m-icon-arrowthinup:before {
content: '\e584';
}
.m-icon-arrowthindown:before {
content: '\e585';
}
.m-icon-arrowthinleft:before {
content: '\e586';
}
.m-icon-arrowthinright:before {
content: '\e587';
}
.m-icon-pulldown:before {
content: '\e588';
}
.m-icon-scan:before {
content: "\e612";
}
<template>
<view class="m-icon" :class="['m-icon-'+type]" @click="onClick()"></view>
</template>
<script>
export default {
props: {
/**
* 图标类型
*/
type: String
},
methods: {
onClick() {
this.$emit('click')
}
}
}
</script>
<style>
@import "./m-icon.css";
</style>
<template>
<view class="m-input-view">
<input :focus="focus" :type="inputType" :value="value" @input="onInput" class="m-input-input" :placeholder="placeholder"
:password="type==='password'&&!showPassword" @focus="onFocus" @blur="onBlur" />
<!-- 优先显示密码可见按钮 -->
<view v-if="clearable&&!displayable&&value.length" class="m-input-icon">
<m-icon color="#666666" type="clear" @click="clear"></m-icon>
</view>
<view v-if="displayable" class="m-input-icon">
<m-icon :style="{color:showPassword?'#666666':'#cccccc'}" type="eye" @click="display"></m-icon>
</view>
</view>
</template>
<script>
import mIcon from './m-icon/m-icon.vue'
export default {
components: {
mIcon
},
props: {
/**
* 输入类型
*/
type: String,
/**
* 值
*/
value: String,
/**
* 占位符
*/
placeholder: String,
/**
* 是否显示清除按钮
*/
clearable: {
type: [Boolean, String],
default: false
},
/**
* 是否显示密码可见按钮
*/
displayable: {
type: [Boolean, String],
default: false
},
/**
* 自动获取焦点
*/
focus: {
type: [Boolean, String],
default: false
}
},
model: {
prop: 'value',
event: 'input'
},
data() {
return {
/**
* 显示密码明文
*/
showPassword: false,
/**
* 是否获取焦点
*/
isFocus: false
}
},
computed: {
inputType() {
const type = this.type
return type === 'password' ? 'text' : type
}
},
methods: {
clear() {
this.$emit('input', '')
},
display() {
this.showPassword = !this.showPassword
},
onFocus() {
this.isFocus = true
},
onBlur() {
this.$nextTick(() => {
this.isFocus = false
})
},
onInput(e) {
this.$emit('input', e.detail.value)
}
}
}
</script>
<style>
.m-input-view {
display: inline-flex;
flex-direction: row;
align-items: center;
/* width: 100%; */
flex: 1;
padding: 0 10px;
}
.m-input-input {
flex: 1;
width: 100%;
height: 20px;
line-height: 20px;
background-color: rgba(0, 0, 0, 0);
}
.m-input-icon {
/* width: 20px; */
font-size: 20px;
line-height: 20px;
color: #666666;
}
</style>
<template>
<view>
<canvas :id="cid" :canvas-id="cid" :style="{width: `${size}px`, height: `${size}px`}" />
</view>
</template>
<script>
import uQRCode from '@/common/uqrcode.js'
export default {
props: {
cid: {
type: String,
required: true
},
text: {
type: String,
required: true
},
size: {
type: Number,
default: uni.upx2px(590)
},
margin: {
type: Number,
default: 0
},
backgroundColor: {
type: String,
default: '#ffffff'
},
foregroundColor: {
type: String,
default: '#000000'
},
backgroundImage: {
type: String
},
logo: {
type: String
},
makeOnLoad: {
type: Boolean,
default: false
}
},
data() {
return {
}
},
mounted() {
if (this.makeOnLoad) {
this.make()
}
},
methods: {
async make() {
var options = {
canvasId: this.cid,
componentInstance: this,
text: this.text,
size: this.size,
margin: this.margin,
backgroundColor: this.backgroundImage ? 'rgba(255,255,255,0)' : this.backgroundColor,
foregroundColor: this.foregroundColor
}
var filePath = await this.makeSync(options)
if (this.backgroundImage) {
filePath = await this.drawBackgroundImageSync(filePath)
}
if (this.logo) {
filePath = await this.drawLogoSync(filePath)
}
this.makeComplete(filePath)
},
makeComplete(filePath) {
this.$emit('makeComplete', filePath)
},
drawBackgroundImage(options) {
var ctx = uni.createCanvasContext(this.cid, this)
ctx.drawImage(this.backgroundImage, 0, 0, this.size, this.size)
ctx.drawImage(options.filePath, 0, 0, this.size, this.size)
ctx.draw(false, () => {
uni.canvasToTempFilePath({
canvasId: this.cid,
success: res => {
options.success && options.success(res.tempFilePath)
},
fail: error => {
options.fail && options.fail(error)
}
}, this)
})
},
async drawBackgroundImageSync(filePath) {
return new Promise((resolve, reject) => {
this.drawBackgroundImage({
filePath: filePath,
success: res => {
resolve(res)
},
fail: error => {
reject(error)
}
})
})
},
fillRoundRect(ctx, r, x, y, w, h) {
ctx.save()
ctx.translate(x, y)
ctx.beginPath()
ctx.arc(w - r, h - r, r, 0, Math.PI / 2)
ctx.lineTo(r, h)
ctx.arc(r, h - r, r, Math.PI / 2, Math.PI)
ctx.lineTo(0, r)
ctx.arc(r, r, r, Math.PI, Math.PI * 3 / 2)
ctx.lineTo(w - r, 0)
ctx.arc(w - r, r, r, Math.PI * 3 / 2, Math.PI * 2)
ctx.lineTo(w, h - r)
ctx.closePath()
ctx.setFillStyle('#ffffff')
ctx.fill()
ctx.restore()
},
drawLogo(options) {
var ctx = uni.createCanvasContext(this.cid, this)
ctx.drawImage(options.filePath, 0, 0, this.size, this.size)
var logoSize = this.size / 4
var logoX = this.size / 2 - logoSize / 2
var logoY = logoX
var borderSize = logoSize + 10
var borderX = this.size / 2 - borderSize / 2
var borderY = borderX
var borderRadius = 5
this.fillRoundRect(ctx, borderRadius, borderX, borderY, borderSize, borderSize)
ctx.drawImage(this.logo, logoX, logoY, logoSize, logoSize)
ctx.draw(false, () => {
uni.canvasToTempFilePath({
canvasId: this.cid,
success: res => {
options.success && options.success(res.tempFilePath)
},
fail: error => {
options.fail && options.fail(error)
}
}, this)
})
},
async drawLogoSync(filePath) {
return new Promise((resolve, reject) => {
this.drawLogo({
filePath: filePath,
success: res => {
resolve(res)
},
fail: error => {
reject(error)
}
})
})
},
async makeSync(options) {
return new Promise((resolve, reject) => {
uQRCode.make({
canvasId: options.canvasId,
componentInstance: options.componentInstance,
text: options.text,
size: options.size,
margin: options.margin,
backgroundColor: options.backgroundColor,
foregroundColor: options.foregroundColor,
success: res => {
resolve(res)
},
fail: error => {
reject(error)
}
})
})
}
}
}
</script>
<template>
<view class="container">
<view class="intro">本项目已包含uni ui组件,无需import和注册,可直接使用。在代码区键入字母u,即可通过代码助手列出所有可用组件。光标置于组件名称处按F1,即可查看组件文档。</view>
<text class="intro">详见:</text>
<uni-link :href="href" :text="href"></uni-link>
</view>
</template>
<script>
export default {
data() {
return {
href: 'https://uniapp.dcloud.io/component/README?id=uniui'
}
},
methods: {
}
}
</script>
<style>
.container {
padding: 20px;
font-size: 14px;
line-height: 24px;
}
</style>
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
...@@ -57,8 +57,6 @@ ...@@ -57,8 +57,6 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import '@/common/uni-ui.scss';
page { page {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
......
...@@ -160,7 +160,7 @@ ...@@ -160,7 +160,7 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import '@/common/uni-ui.scss'; // @import '@/common/uni-ui.scss';
page { page {
display: flex; display: flex;
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
import { import {
isOn, isOn,
setting setting
} from '@/common/dc-push/push.js'; } from './dc-push/push.js';
import { import {
mapMutations mapMutations
} from 'vuex'; } from 'vuex';
......
...@@ -72,11 +72,11 @@ ...@@ -72,11 +72,11 @@
to: '/pages/about/about' to: '/pages/about/about'
}, },
//#ifdef APP-PLUS //#ifdef APP-PLUS
// { {
// title: '检查更新', title: '检查更新',
// rightText: `V${getApp().appVersion.finall.version}_${getApp().appVersion.finall.versionCode}`, rightText: `V${getApp().appVersion.finall.version}_${getApp().appVersion.finall.versionCode}`,
// event:'checkVersion' event:'checkVersion'
// } }
//#endif //#endif
], ],
[{ [{
......
此差异已折叠。
此差异已折叠。
<template>
<view class="m-icon" :class="['m-icon-'+type]" @click="onClick()"></view>
</template>
<script>
export default {
props: {
/**
* 图标类型
*/
type: String
},
methods: {
onClick() {
this.$emit('click')
}
}
}
</script>
<style>
@import "./m-icon.css";
</style>
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册