提交 e9d33106 编写于 作者: DCloud_JSON's avatar DCloud_JSON

添加文件说明注释

上级 b306ac06
<script>
import initApp from '@/common/appInit.js';
import checkIsAgree from '@/uni_modules/uni-agree/utils/uni-agree.js';
import checkIsAgree from '@/uni_modules/uni-agree/utils/uni-agree.js';
export default {
globalData: {
searchText: '',
appVersion: {}
appVersion: {},
config:{}
},
onLaunch: function() {
console.log('App Launch')
......
module.exports = {
"h5": {
"url": "https://static-76ce2c5e-31c7-4d81-8fcf-ed1541ecbc6e.bspapp.com", // 前端网页托管的域名
"openApp": { // 在h5端全局悬浮引导用户下载app的功能 更多自定义要求在/common/openApp.js中修改
"openUrl": 'https://sj.qq.com/myapp/detail.htm?apkName=com.tencent.android.qqdownloader&info=6646FD239A6EBA9E2DEE5DFC7E18D867',
"appname": 'base-app',
"logo": './static/logo.png',
}
},
"mp": {
"weixin": {
"id": "gh_33446d7f7a26"
}
},
"router": {
"needLogin": [ //配置需要路由拦截的页面地址,在打开这些页面之前会自动检查(不联网)uni_id_token的值是否存在/过期等
"/pages/ucenter/edit/edit",
"/uni_modules/uni-news-favorite/pages/uni-news-favorite/list",
"/pages/ucenter/edit/uploadCutImageToUnicloud"
],
//这是应用的配置页面,App.vue挂载到getApp().globalData.config
module.exports = {
"h5": {
"url": "https://static-76ce2c5e-31c7-4d81-8fcf-ed1541ecbc6e.bspapp.com", // 前端网页托管的域名
// 在h5端全局悬浮引导用户下载app的功能 更多自定义要求在/common/openApp.js中修改
"openApp": {
//点击悬浮下载栏后打开的网页链接
"openUrl": 'https://sj.qq.com/myapp/detail.htm?apkName=com.tencent.android.qqdownloader&info=6646FD239A6EBA9E2DEE5DFC7E18D867',
//左侧显示的应用名称
"appname": 'base-app',
//应用的图标
"logo": './static/logo.png',
}
},
"mp": {
"weixin": {
//微信小程序原始id,微信小程序分享时
"id": "gh_33446d7f7a26"
}
},
"router": {
//配置需要路由拦截的页面地址,在打开这些页面之前会自动检查(不联网)uni_id_token的值是否存在/过期等
"needLogin": [
"/pages/ucenter/userinfo/userinfo",
"/uni_modules/uni-news-favorite/pages/uni-news-favorite/list",
"/pages/ucenter/edit/uploadCutImageToUnicloud"
],
"login": [ "smsCode","uniVerify", "username", "weixin", "apple"],
/*
根据数组的第0项,决定登陆方式的第一优先级。
为完全列举到的或设备环境不支持的选项,将被隐藏。
未列举到的,或设备环境不支持的选项,将被隐藏。
快捷登陆按钮,在任意一页面都存在。
所以只有三种情况:
一键登录(uniVerify)、账号(username)、验证码登陆(其他值为第一项都为验证码登陆)
*/
},
"about": {
"appName": "base-app",
"logo": "/static/logo.png",
"company": "数字天堂(北京)网络技术有限公司",
"slogan": "为开发而生",
"agreements": [{
"title": "用户服务协议",
"url": "https://ask.dcloud.net.cn/protocol.html"
},
{
"title": "隐私政策",
"url": "https://ask.dcloud.net.cn/protocol.html"
}
],
如果你需要在不同平台有不同的配置,直接用条件编译即可
*/
},
"about": {
"appName": "base-app",
"logo": "/static/logo.png",
"company": "数字天堂(北京)网络技术有限公司",
"slogan": "为开发而生",
"agreements": [{
"title": "用户服务协议",
"url": "https://ask.dcloud.net.cn/protocol.html"
},
{
"title": "隐私政策",
"url": "https://ask.dcloud.net.cn/protocol.html"
}
],
"download": "https://m3w.cn/uniapp"
},
"marketId":{//用于打开应用市场评分界面
//用于打开应用市场评分界面
"marketId":{
"ios":"id1417078253",
"android":"123456"
}
}
}
//应用初始化页
import baseappConfig from '@/baseapp.config.js';
// #ifdef APP-PLUS
import checkUpdate from '@/uni_modules/uni-upgrade-center-app/utils/check-update';
......@@ -6,18 +7,36 @@ import callCheckVersion from '@/uni_modules/uni-upgrade-center-app/utils/call-ch
export default function() {
// 初始化appVersion(仅app生效)
initAppVersion();
// baseappConfig挂载到getApp().
getApp({allowDefault: true}).config = baseappConfig;
//自定义路由拦截
const {
"router": {
needLogin,
login
}
getApp({allowDefault: true}).globalData.config = baseappConfig;
/*
这里应用拦截器实现了,路由拦截。当应用无访问摄像头/相册权限,引导跳到设置界面
1.添加拦截器说明如下:
uni.addInterceptor(item, {
invoke(e) { // 调用前拦截
},
success() { // 成功回调拦截
},
fail(err) { // 失败回调拦截
console.log(err);
},
complete(e) { // 完成回调拦截
//console.log(e);
},
returnValue() { // 返回结果拦截
}
})
2.移除拦截器API removeInterceptor('request')
*/
//自定义路由拦截
const {
"router": {
needLogin,
login
}
} = baseappConfig //需要登陆的页面
//uni.addInterceptor的写法
let list = ["navigateTo", "redirectTo", "reLaunch", "switchTab"];
list.forEach(item => {
uni.addInterceptor(item, {
......@@ -60,6 +79,7 @@ export default function() {
},
})
})
//当应用无访问摄像头/相册权限,引导跳到设置界面
uni.addInterceptor('chooseImage', {
......@@ -96,8 +116,25 @@ export default function() {
})
// #ifdef APP-PLUS
// 设备网络状态变化事件
eventListenerNetwork()
// 监听并提示设备网络状态变化
uni.onNetworkStatusChange(res=> {
console.log(res.isConnected);
console.log(res.networkType);
if(res.networkType!='none'){
uni.showToast({
title:'当前网络类型:'+res.networkType,
icon:'none',
duration:3000
})
}else{
showNetworkErrPage()
uni.showToast({
title:'网络类型:'+res.networkType,
icon:'none',
duration:3000
})
}
});
// #endif
}
......@@ -131,98 +168,4 @@ function initAppVersion() {
// 检查更新
checkUpdate();
// #endif
}
// 设备网络状态变化事件
function eventListenerNetwork() {
/*
//网络掉线
uni.getNetworkType({
success:res=>{
console.log(res);
if(res.networkType=='none'){
showNetworkErrPage()
}
uni.showToast({
title:'当前网络类型:'+res.networkType,
icon:'none',
duration:3000
})
}
});
//监听网络变化
uni.onNetworkStatusChange(res=> {
console.log(res.isConnected);
console.log(res.networkType);
if(res.networkType!='none'){
uni.showToast({
title:'当前网络类型:'+res.networkType,
icon:'none',
duration:3000
})
}else{
showNetworkErrPage()
uni.showToast({
title:'网络类型:'+res.networkType,
icon:'none',
duration:3000
})
}
});
function showNetworkErrPage(){
let pages = getCurrentPages();
console.log('pages.length',pages.length);
if(pages.length===0 || pages[pages.length - 1].route!='/pages/networkErr/networkErr.vue'){
uni.navigateTo({
url:'/pages/networkErr/networkErr'
})
}else{
console.log('已经打开');
}
}
}
function openAppPermissionSetting(){
// 跳转到**应用**的权限页面
if (uni.getSystemInfoSync().platform == "ios") {
var UIApplication = plus.ios.import("UIApplication");
var application2 = UIApplication.sharedApplication();
var NSURL2 = plus.ios.import("NSURL");
// var setting2 = NSURL2.URLWithString("prefs:root=LOCATION_SERVICES");
var setting2 = NSURL2.URLWithString("app-settings:");
application2.openURL(setting2);
plus.ios.deleteObject(setting2);
plus.ios.deleteObject(NSURL2);
plus.ios.deleteObject(application2);
} else {
// console.log(plus.device.vendor);
var Intent = plus.android.importClass("android.content.Intent");
var Settings = plus.android.importClass("android.provider.Settings");
var Uri = plus.android.importClass("android.net.Uri");
var mainActivity = plus.android.runtimeMainActivity();
var intent = new Intent();
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
var uri = Uri.fromParts("package", mainActivity.getPackageName(), null);
intent.setData(uri);
mainActivity.startActivity(intent);
}
*/
}
/*
uni.addInterceptor(item, {
invoke(e) { // 调用前拦截
},
success() { // 成功回调拦截
},
fail(err) { // 失败回调拦截
console.log(err);
},
complete(e) { // 完成回调拦截
//console.log(e);
},
returnValue() { // 返回结果拦截
}
}) // 移除拦截器API removeInterceptor('request')
*/
\ No newline at end of file
}
\ No newline at end of file
/*
创建在h5端全局悬浮引导用户下载app的功能,
如不需要本功能直接移除配置文件baseapp.config.js下的h5/openApp即可
*/
import CONFIG from '../baseapp.config.js';
const CONFIG_OPEN = CONFIG?.h5?.openApp?.openUrl ? CONFIG.h5.openApp : {};
......
<template>
<view :class="[flex?'flex':'null']">
<slot></slot>
</view>
</template>
<script>
export default {
props: {
flex: {
default(){
return false
}
},
},
data() {
return {
}
},
watch: {
},
methods: {
},
}
</script>
<style lang="scss" scoped>
.null{
display: inline-flex;
width: auto;
}
.flex{
display: flex;
}
</style>
此差异已折叠。
......@@ -13,7 +13,7 @@
name:"uni-agreements",
computed:{
agreements(){
return getApp().config.about.agreements
return getApp().globalData.config.about.agreements
}
},
methods:{
......
<template>
<view class="box" v-if="networkType == 'none'">
<image class="icon-image" src="../../static/uni-network/disconnection.png" mode="widthFix"></image>
<text class="tip-text">网络异常</text>
<view class="btn btn-default" v-if="networkType!='none'" @click="retry">
<text class="btn-text">重试</text>
</view>
<view class="btn btn-default" v-if="networkType=='none'" @click="openSettings">
<text class="btn-text">前往设置</text>
</view>
</view>
</template>
<script>
export default {
name: "uni-network",
data() {
return {
"networkType": ""
};
},
mounted() {
uni.onNetworkStatusChange(({
networkType
}) => {
if(this.networkType == 'none' && networkType != 'none'){
this.change()
}
this.networkType = networkType;
});
uni.getNetworkType({
success: ({
networkType
}) => {
this.networkType = networkType;
}
});
},
methods:{
openSettings(){
if (uni.getSystemInfoSync().platform == "ios") {
var UIApplication = plus.ios.import("UIApplication");
var application2 = UIApplication.sharedApplication();
var NSURL2 = plus.ios.import("NSURL");
var setting2 = NSURL2.URLWithString("App-prefs:root=General");
application2.openURL(setting2);
plus.ios.deleteObject(setting2);
plus.ios.deleteObject(NSURL2);
plus.ios.deleteObject(application2);
} else {
var Intent = plus.android.importClass("android.content.Intent");
var Settings = plus.android.importClass("android.provider.Settings");
var mainActivity = plus.android.runtimeMainActivity();
var intent = new Intent(Settings.ACTION_SETTINGS);
mainActivity.startActivity(intent);
}
},
change(){
this.$emit('change')
}
}
}
</script>
<style scoped>
.box{
margin:100rpx 0;
flex-direction: column;
align-items: center;
justify-content: center;
}
.icon-image{
width: 300rpx;
}
.tip-text{
color: #999999;
font-size: 32rpx;
margin-bottom: 30rpx;
}
.btn {
padding: 5px 10px;
width: 128px;
flex-direction: row;
align-items: center;
justify-content: center;
text-align: center;
}
.btn-text {
color: #999999;
font-size: 15px;
}
.btn-default {
border-color: #999999;
border-style: solid;
border-width: 1px;
border-radius: 3px;
}
</style>
......@@ -11,8 +11,8 @@
"prompt" : "template",
"template" : {
"title" : "服务协议和隐私政策",
"message" : "  请你务必审慎阅读、充分理解“服务协议”和“隐私政策”各条款,包括但不限于:为了更好的向你提供服务,我们需要收集你的设备标识、操作日志等信息用于分析、优化应用性能。<br/>  你可阅读<a href=\"\">《服务协议》</a>和<a href=\"\">《隐私政策》</a>了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。",
"buttonAccept" : "我知道了",
"message" : "  请你务必审慎阅读、充分理解“服务协议”和“隐私政策”各条款,包括但不限于:为了更好的向你提供服务,我们需要收集你的设备标识、操作日志等信息用于分析、优化应用性能。<br/>  你可阅读<a href=\"https://ask.dcloud.net.cn/protocol.html\">《服务协议》</a>和<a href=\"https://ask.dcloud.net.cn/protocol.html\">《隐私政策》</a>了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。",
"buttonAccept" : "同意",
"buttonRefuse" : "暂不同意"
}
},
......@@ -113,8 +113,8 @@
"es6" : false
},
"usingComponents" : true
// "betterScopedSlots" : true
},
// "betterScopedSlots" : true
"mp-alipay" : {
"usingComponents" : true
},
......
......@@ -3,23 +3,17 @@
{
"path": "pages/list/list",
"style": {
// #ifdef APP-NVUE
"enablePullDownRefresh": false,
// #endif
// #ifdef H5
"navigationStyle":"custom",
// #endif
"enablePullDownRefresh": true,
"app-plus":{
// #ifdef APP-PLUS
"titleNView":{ /*排除了H5*/
"searchInput":{
"placeholder":"请输入搜索的内容",
"backgroundColor":"#efefef",
"disabled":true,
"borderRadius":"30px"
}
}
// #endif
// "titleNView":{ /*排除了H5*/
// "searchInput":{
// "placeholder":"请输入搜索的内容",
// "backgroundColor":"#efefef",
// "disabled":true,
// "borderRadius":"30px"
// }
// }
}
}
},
......@@ -73,7 +67,7 @@
"navigationBarTitleText": "文章详情"
}
}, {
"path": "pages/ucenter/edit/bind-mobile/bind-mobile",
"path": "pages/ucenter/userinfo/bind-mobile/bind-mobile",
"style": {
"navigationBarTitleText": "绑定手机号码"
}
......@@ -162,12 +156,12 @@
}
}, {
"path": "pages/ucenter/edit/edit",
"path": "pages/ucenter/userinfo/userinfo",
"style": {
"navigationBarTitleText": "个人资料"
}
}, {
"path": "pages/ucenter/edit/uploadCutImageToUnicloud",
"path": "pages/ucenter/userinfo/uploadCutImageToUnicloud",
"style": {
"navigationStyle": "custom"
}
......
......@@ -47,7 +47,6 @@
</template>
<script>
import baseappConfig from '@/baseapp.config.js';
import uniShare from 'uni_modules/uni-share/js_sdk/uni-share.js';
const db = uniCloud.database();
......@@ -57,7 +56,7 @@
} from 'vuex';
export default {
data() {
return {
return {
// 当前显示 _id
id: "",
title: 'title',
......@@ -79,7 +78,10 @@
...mapGetters({
'userInfo': 'user/info',
'hasLogin': 'user/hasLogin'
})
}),
baseappConfig(){
return getApp().globalData.config
}
},
onLoad(event) {
//获取真实新闻id,通常 id 来自上一个页面
......@@ -249,7 +251,7 @@
}
</script>
<style scoped>
<style scoped>
.header-content {
flex: 1;
display: flex;
......@@ -335,4 +337,4 @@
font-size: 15px;
overflow: hidden;
}
</style>
</style>
<template>
<view>
<!-- 搜索功能 小程序用绘制的且带原生导航,h5和app用原生自带绘制 -->
<!-- #ifndef APP-PLUS -->
<view class="uni-search-box">
<uni-search-bar class="uni-search-bar" v-model="keyword" ref="searchBar" radius="100"
@click.native="searchClick" cancelButton="none" disabled />
</view>
<!-- #endif -->
<unicloud-db ref='udb' v-slot:default="{data,pagination,hasMore, loading, error, options}" @load="handleLoad"
<view>
<!-- #ifdef APP-PLUS -->
<uni-nav-bar :border="false"></uni-nav-bar>
<!-- #endif -->
<!-- 搜索功能 -->
<uni-search-bar class="uni-search-box" v-model="keyword" ref="searchBar" radius="100"
@click.native="searchClick" cancelButton="none" disabled />
<unicloud-db ref='udb' v-slot:default="{data,pagination,hasMore, loading, error, options}" @load="handleLoad" @error="onqueryerror"
:where="where" collection="opendb-news-articles,uni-id-users"
field="avatar,title,last_modify_date,user_id{username}">
<!-- 基于 uni-list 的页面布局 -->
<uni-list class="uni-list" :border="false" :style='{height:windowHeight+"px"}' :bounce="true"
:alwaysScrollableVertical="true">
<uni-list class="uni-list" :border="false" :bounce="true" :alwaysScrollableVertical="true"
<!-- #ifdef APP-NVUE -->
<refresh @refresh="refresh" @pullingdown="onpullingdown" :display="!loading ? 'show' : 'hide'">
<refreshBox :state="refreshState"></refreshBox>
</refresh>
:style='{height:listHight+"px"}'
<!-- #endif -->
<cell class="get-data-state" v-if="data.length===0&&pagination.current===1">
<!-- 刷新页面后的顶部提示框 当前弹出内容没有实际逻辑 ,可根据当前业务修改弹出提示 -->
<text class="refresh-tip"
:class="{ 'show-refresh-tip':showRefreshTip }">为您更新了{{data.length}}条内容</text>
<!-- 数据为空 当前页码为1,且正在加载中;这里为了演示,更加直观的表达内部逻辑。商用项目建议将这部分封装为组件,更好的让业务逻辑与功能分离-->
<template v-if="loading">
<image class="get-data-state-img" src="@/static/getDataState/loading.png" mode="widthFix">
</image>
<text class="get-data-state-text">加载中...</text>
</template>
<template v-else>
<image class="get-data-state-img" src="@/static/getDataState/nodata.png" mode="widthFix">
</image>
<text class="get-data-state-text">内容为空</text>
</template>
</cell>
<uni-list-item v-if="error">{{error.message}}</uni-list-item>
<uni-list-item v-else :to="'./detail?id='+item._id+'&title='+item.title"
v-for="(item,index) in testData(data)" :key="index">
<!-- 通过header插槽定义列表左侧图片 -->
<template v-slot:header>
<image class="avatar" :src="item.avatar" mode="aspectFill"></image>
</template>
<!-- 通过body插槽定义布局 -->
<view slot="body" class="main">
<text class="title">{{ item.title }}</text>
<view class="info">
<text class="author">{{item.user_id[0].username}}</text>
<uni-dateformat class="last_modify_date" :date="item.last_modify_date" format="yyyy-MM-dd"
:threshold="[60000, 2592000000]" />
>
<cell v-if="error">
<template slot="body">
<!-- 设置网络 -->
<uni-network @change="refresh" @retry="refresh"></uni-network>
</template>
</cell>
<template v-else>
<cell class="get-data-state" v-if="data.length===0&&pagination.current===1">
<!-- 数据为空 当前页码为1,且正在加载中;这里为了演示,更加直观的表达内部逻辑。商用项目建议将这部分封装为组件,更好的让业务逻辑与功能分离-->
<uni-load-more v-if="loading" status="loading"></uni-load-more>
<template v-else>
<image class="get-data-state-img" src="@/static/getDataState/nodata.png" mode="widthFix">
</image>
<text class="get-data-state-text">内容为空</text>
</template>
</cell>
<uni-list-item :to="'./detail?id='+item._id+'&title='+item.title"
v-for="(item,index) in testData(data)" :key="index">
<!-- 通过header插槽定义列表左侧图片 -->
<template v-slot:header>
<image class="avatar" :src="item.avatar" mode="aspectFill"></image>
</template>
<!-- 通过body插槽定义布局 -->
<view slot="body" class="main">
<text class="title">{{ item.title }}</text>
<view class="info">
<text class="author">{{item.user_id[0].username}}</text>
<uni-dateformat class="last_modify_date" :date="item.last_modify_date"
format="yyyy-MM-dd" :threshold="[60000, 2592000000]" />
</view>
</view>
</view>
</uni-list-item>
<!-- 存在下一页数据,且不在加载中 通过 loadMore 组件实现上拉加载效果,如需自定义显示内容,可参考:https://ext.dcloud.net.cn/plugin?id=29 -->
<cell v-if="hasMore">
<uni-load-more v-if="!error &&!loading&&hasMore" :status="options.status"></uni-load-more>
</cell>
<cell v-else>
<text class="noMore">- 没有更多数据了 -</text>
</cell>
</uni-list-item>
<!-- 存在下一页数据,且不在加载中 通过 loadMore 组件实现上拉加载效果,如需自定义显示内容,可参考:https://ext.dcloud.net.cn/plugin?id=29 -->
<template v-if="!loading">
<cell v-if="hasMore">
<uni-load-more :status="options.status"></uni-load-more>
</cell>
<cell v-else>
<text class="noMore">- 没有更多数据了 -</text>
</cell>
</template>
</template>
</uni-list>
</unicloud-db>
</view>
......@@ -70,42 +70,34 @@
export default {
data() {
return {
showRefreshTip: true,
where: "",
keyword: "",
refreshState: 0,
windowHeight: 0 //窗口的高
listHight: 0
}
},
onReady() {
this.windowHeight = uni.getSystemInfoSync().windowHeight
this.showRefreshTip = false
this.listHight = uni.getSystemInfoSync().windowHeight - uni.getSystemInfoSync().statusBarHeight - 65
cdbRef = this.$refs.udb
console.log(cdbRef);
},
onShow() {
try{
this.keyword = getApp().globalData.searchText
console.log(this.keyword);
getApp().globalData.searchText = ''
this.setInputText()
}catch(e){
console.log(e);
//TODO handle the exception
this.keyword = getApp().globalData.searchText
console.log(this.keyword);
getApp().globalData.searchText = ''
if(this.keyword){
// #ifdef APP-PLUS
if (!currentWebview) {
let pages = getCurrentPages();
currentWebview = pages[pages.length - 1].$getAppWebview();
}
// 设置 searchInput的 text
currentWebview.setTitleNViewSearchInputText(this.keyword)
// #endif
}
},
methods: {
setInputText() {
// 设置 searchInput的 text
// #ifdef APP-PLUS
if (!currentWebview) {
let pages = getCurrentPages();
currentWebview = pages[pages.length - 1].$getAppWebview();
}
currentWebview.setTitleNViewSearchInputText(this.keyword)
// #endif
},
testData(data) {
testData(data) { //复制同一个数据多遍方便测试,正式项目中不要带
var testData = []
for (let i = 0; i < 10; i++) {
testData.push(...data)
......@@ -116,7 +108,6 @@
// `data` 当前查询结果 `ended` 是否有更多数据 `pagination` 分页信息 HBuilderX 3.1.5+ 支持
console.log(9527, data, ended, pagination);
//上拉加载成功
this.loadMoreEnd()
},
searchClick() {
uni.hideKeyboard();
......@@ -129,66 +120,29 @@
}
}
});
},
refresh() {
cdbRef.loadData({
clear: true
}, () => {
this.showRefreshTip = true
setTimeout(() => {
this.showRefreshTip = false
}, 1000)
this.refreshEnd()
})
},
loadMore() {
cdbRef.loadMore({
clear: true
})
},
refreshEnd() {
// #ifdef APP-NVUE
this.refreshState = 0
// #endif
uni.stopPullDownRefresh()
},
loadMoreEnd() {
console.log('loadMoreEnd');
},
// #ifdef APP-NVUE
onpullingdown({
pullingDistance,
viewHeight
}) {
if (pullingDistance > viewHeight) {
this.refreshState = 1
}
},
// #endif
},
retry(){
this.refresh()
},
refresh(){
cdbRef.loadData({
clear: true
}, () => {
uni.stopPullDownRefresh()
})
console.log('refresh');
}
},
// #ifndef APP-NVUE
onPullDownRefresh() {
this.refresh()
console.log('refresh');
},
// #endif
onReachBottom() {
this.loadMore()
console.log('触底了');
},
onNavigationBarSearchInputClicked() {
this.searchClick()
},
onNavigationBarSearchInputChanged(e) {
console.log('变了', e);
if (e.text) {
this.where = 'title == ' + e.text
}
cdbRef.loadMore({clear: true})
}
}
</script>
<style>
<style scoped>
.avatar {
width: 200rpx;
height: 200rpx;
......@@ -201,6 +155,7 @@
.title {
width: 480rpx;
font-size: 32rpx;
}
.info {
......@@ -230,10 +185,10 @@
background-color: #FFFFFF;
position: sticky;
top: 0;
left: 0;
/* #ifndef APP-PLUS */
z-index:9;
/* #endif */
left: 0;
/* #ifndef APP-PLUS */
z-index: 9;
/* #endif */
}
.show-refresh-tip {
......@@ -260,8 +215,7 @@
text-align: center;
}
.uni-list {
}
.uni-list {}
.noMore {
width: 750rpx;
......
......@@ -19,7 +19,6 @@
</view>
</template>
<script>
import baseappConfig from '@/baseapp.config.js';
import uniShare from 'uni_modules/uni-share/js_sdk/uni-share.js';
export default {
onLoad() {
......@@ -27,6 +26,12 @@ import uniShare from 'uni_modules/uni-share/js_sdk/uni-share.js';
this.version = plus.runtime.version
// #endif
},
computed:{
baseappConfig(){
console.log(getApp());
return getApp().globalData.config
}
},
data() {
return {
version:"V1.0.0",
......@@ -35,7 +40,8 @@ import uniShare from 'uni_modules/uni-share/js_sdk/uni-share.js';
};
},
created() {
this.about = baseappConfig.about
console.log();
this.about = this.baseappConfig.about
uni.setNavigationBarTitle({
title:'关于'+this.about.appName
})
......
......@@ -18,7 +18,7 @@ var univerify_first,currentWebview;//是否一键登陆优先
export default {
data() {
return {
phone:"17769516081"
phone:""
}
},
computed: {
......
<template>
<view class="center">
<view class="userInfo" @click="toUserInfo">
<image class="logo-img" :src="userInfo.avatar||avatarUrl"></image>
<image class="logo-img" :src="userInfo.avatar||avatarUrl"></image>
<view class="logo-title">
<text class="uer-name">{{userInfo.nickname||userInfo.username||userInfo.mobile||'未登录'}}</text>
<uni-icons class="icon" color="#FFFFFF" type="arrowright" v-if="!login" size="16"></uni-icons>
......@@ -21,7 +21,7 @@
<view class="item-footer-badge"></view>
</view>
</uni-list-item>
</uni-list>
</uni-list>
</view>
</template>
......@@ -91,7 +91,7 @@
]
}
},
onLoad() {
onLoad() {
//#ifdef APP-PLUS
this.ucenterList[this.ucenterList.length - 2].unshift({
title: '检查更新',
......@@ -111,9 +111,9 @@
appVersion() {
return getApp().appVersion
}
// #endif
,appConfig(){
return getApp().config
// #endif
,appConfig(){
return getApp().globalData.config
}
},
methods: {
......@@ -146,7 +146,7 @@
},
toUserInfo() {
uni.navigateTo({
url: '/pages/ucenter/edit/edit'
url: '/pages/ucenter/userinfo/userinfo'
})
},
tapGrid(index) {
......@@ -159,7 +159,7 @@
* 去应用市场评分
*/
gotoMarket() {
// #ifdef APP-PLUS
// #ifdef APP-PLUS
if (uni.getSystemInfoSync().platform == "ios") {
// 这里填写appstore应用id
let appstoreid = this.appConfig.marketId.ios;// 'id1417078253';
......@@ -299,4 +299,4 @@
/* #endif */
background-color: #DD524D;
}
</style>
</style>
static/getDataState/nodata.png

44.7 KB | W: | H:

static/getDataState/nodata.png

33.5 KB | W: | H:

static/getDataState/nodata.png
static/getDataState/nodata.png
static/getDataState/nodata.png
static/getDataState/nodata.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -61,7 +61,7 @@ $uni-spacing-row-lg: 30rpx;
/* 垂直间距 */
$uni-spacing-col-sm: 8rpx;
$uni-spacing-col-base: 16rpx;
$uni-spacing-col-base: 8px;
$uni-spacing-col-lg: 24rpx;
/* 透明度 */
......
# uni-image-menu
\ No newline at end of file
# uni-image-menu
使用示例:
```
import uniImageMenu from 'uni_modules/uni-image-menu/js_sdk/uni-image-menu.js';
uniImageMenu.show({
list:[{
"img": "/static/sharemenu/wechatfriend.png",
"text": "微信好友"
},
{
"img": "/static/sharemenu/wechatmoments.png",
"text": "微信朋友圈"
}],
cancelText:param.cancelText
}, e => {
console.log(e)
})
```
\ No newline at end of file
<template>
<view class="nodata">
<view class="nodata-content">
<view class="text-view a-i-c j-c-c t-a-c">
<text class="title">{{textTypes[networkType]}}</text>
</view>
<view class="icon-view">
<!-- 无数据 icon -->
<image v-if="!isLoading" src="/uni_modules/uni-nodata/static/nodata.png" class="icon-image"></image>
<!-- 加载中 icon -->
<image v-else src="/uni_modules/uni-nodata/static/loading.png" class="icon-loading"></image>
<text class="title">{{isLoading ? '加载中...' : ''}}</text>
</view>
<view class="opera-view" v-if="!isLoading">
<view class="btn btn-default" v-if="networkType!='none'" @click="retry">
<text class="btn-text">重试</text>
</view>
<view class="btn btn-default" v-if="networkType=='none'" @click="openSettings">
<text class="btn-text">设置</text>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'uni-nodata',
props:{
isLoading:{
type:Boolean,
default:false
}
},
data() {
return {
textTypes: {
none: "暂无网络"
},
isConnected: false,
networkType: "none"
}
},
mounted() {
this.isIOS = (uni.getSystemInfoSync().platform === 'ios');
uni.onNetworkStatusChange((res) => {
this.isConnected = res.isConnected;
this.networkType = res.networkType;
});
uni.getNetworkType({
success: (res) => {
this.networkType = res.networkType;
}
});
},
methods: {
retry() {
this.$emit('retry');
},
async openSettings() {
if (this.networkType == "none") {
this.openSystemSettings();
return;
}
},
openAppSettings() {
this.gotoAppSetting();
},
openSystemSettings() {
if (this.isIOS) {
this.gotoiOSSetting();
} else {
this.gotoAndroidSetting();
}
},
network() {
var result = null;
var cellularData = plus.ios.newObject("CTCellularData");
var state = cellularData.plusGetAttribute("restrictedState");
if (state == 0) {
result = null;
console.log("StateUnknown");
} else if (state == 2) {
result = 1;
console.log("已经开启了互联网权限:NotRestricted");
} else if (state == 1) {
result = 2;
console.log("Restricted");
}
plus.ios.deleteObject(cellularData);
return result;
},
gotoAppSetting() {
if (this.isIOS) {
var UIApplication = plus.ios.import("UIApplication");
var application2 = UIApplication.sharedApplication();
var NSURL2 = plus.ios.import("NSURL");
var setting2 = NSURL2.URLWithString("app-settings:");
application2.openURL(setting2);
plus.ios.deleteObject(setting2);
plus.ios.deleteObject(NSURL2);
plus.ios.deleteObject(application2);
} else {
var Intent = plus.android.importClass("android.content.Intent");
var Settings = plus.android.importClass("android.provider.Settings");
var Uri = plus.android.importClass("android.net.Uri");
var mainActivity = plus.android.runtimeMainActivity();
var intent = new Intent();
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
var uri = Uri.fromParts("package", mainActivity.getPackageName(), null);
intent.setData(uri);
mainActivity.startActivity(intent);
}
},
gotoiOSSetting() {
var UIApplication = plus.ios.import("UIApplication");
var application2 = UIApplication.sharedApplication();
var NSURL2 = plus.ios.import("NSURL");
var setting2 = NSURL2.URLWithString("App-prefs:root=General");
application2.openURL(setting2);
plus.ios.deleteObject(setting2);
plus.ios.deleteObject(NSURL2);
plus.ios.deleteObject(application2);
},
gotoAndroidSetting() {
var Intent = plus.android.importClass("android.content.Intent");
var Settings = plus.android.importClass("android.provider.Settings");
var mainActivity = plus.android.runtimeMainActivity();
var intent = new Intent(Settings.ACTION_SETTINGS);
mainActivity.startActivity(intent);
}
}
}
</script>
<style>
.a-i-c {
align-items: center;
}
.j-c-c {
justify-content: center;
}
.t-a-c {
text-align: center;
}
.nodata {
flex: 1;
flex-direction: column;
/* #ifndef APP-PLUS */
display: flex;
/* #endif */
align-items: center;
justify-content: center;
padding: 30px;
background-color: #f8f8f8;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
/* #ifndef APP-NVUE */
margin: auto;
z-index:9;
/* #endif */
}
.nodata-content {
transform: translateY(-50px);
}
.text-view {
margin-bottom: 40px;
}
.title {
color: #999999;
font-size: 18px;
}
.opera-view {
flex-direction: column;
align-items: center;
justify-content: center;
}
.btn {
padding: 5px 10px;
width: 128px;
flex-direction: row;
align-items: center;
justify-content: center;
text-align: center;
}
.btn-text {
color: #999999;
font-size: 15px;
}
.btn-default {
border-color: #999999;
border-style: solid;
border-width: 1px;
border-radius: 3px;
}
.icon-view{
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
justify-content: center;
align-items: center;
border-width: 1rpx;
border-color: #DD524D;
}
.icon-loading{
width: 500rpx;
height: 300rpx;
}
.icon-image{
width: 640rpx;
height: 640rpx;
}
</style>
{
"id": "uni-nodata",
"displayName": "uni-nodata",
"version": "1.0.0",
"description": "uni-nodata",
"keywords": [
"uni-nodata"
],
"repository": "",
"engines": {
"HBuilderX": "^3.1.0"
},
"dcloudext": {
"category": [
"前端组件",
"通用组件"
],
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "",
"data": "",
"permissions": ""
},
"npmurl": ""
},
"uni_modules": {
"dependencies": [],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "u",
"aliyun": "u"
},
"client": {
"App": {
"app-vue": "u",
"app-nvue": "u"
},
"H5-mobile": {
"Safari": "u",
"Android Browser": "u",
"微信浏览器(Android)": "u",
"QQ浏览器(Android)": "u"
},
"H5-pc": {
"Chrome": "u",
"IE": "u",
"Edge": "u",
"Firefox": "u",
"Safari": "u"
},
"小程序": {
"微信": "u",
"阿里": "u",
"百度": "u",
"字节跳动": "u",
"QQ": "u"
},
"快应用": {
"华为": "u",
"联盟": "u"
}
}
}
}
}
\ No newline at end of file
# uni-nodata
\ No newline at end of file
......@@ -78,6 +78,4 @@ export default async (param,callback) => {
callback(e)
});
}
}
}
\ No newline at end of file
......@@ -2,9 +2,9 @@
"id": "uni-share",
"displayName": "uni-share",
"version": "1.0.0",
"description": "uni-share",
"description": "底部弹出宫格图标式的分享菜单,可覆盖原生组件。",
"keywords": [
"uni-share"
"分享菜单"
],
"repository": "",
"engines": {
......@@ -13,7 +13,7 @@
"dcloudext": {
"category": [
"JS SDK",
"JS SDK"
"通用 SDK"
],
"sale": {
"regular": {
......@@ -27,9 +27,9 @@
"qq": ""
},
"declaration": {
"ads": "",
"data": "",
"permissions": ""
"ads": "",
"data": "",
"permissions": ""
},
"npmurl": ""
},
......@@ -38,37 +38,37 @@
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "u",
"aliyun": "u"
"tcb": "y",
"aliyun": "y"
},
"client": {
"App": {
"app-vue": "u",
"app-nvue": "u"
"app-vue": "y",
"app-nvue": "y"
},
"H5-mobile": {
"Safari": "u",
"Android Browser": "u",
"微信浏览器(Android)": "u",
"QQ浏览器(Android)": "u"
"Safari": "n",
"Android Browser": "n",
"微信浏览器(Android)": "n",
"QQ浏览器(Android)": "n"
},
"H5-pc": {
"Chrome": "u",
"IE": "u",
"Edge": "u",
"Firefox": "u",
"Safari": "u"
"Chrome": "n",
"IE": "n",
"Edge": "n",
"Firefox": "n",
"Safari": "n"
},
"小程序": {
"微信": "u",
"阿里": "u",
"百度": "u",
"字节跳动": "u",
"QQ": "u"
"微信": "n",
"阿里": "n",
"百度": "n",
"字节跳动": "n",
"QQ": "n"
},
"快应用": {
"华为": "u",
"联盟": "u"
"华为": "n",
"联盟": "n"
}
}
}
......
# uni-share
例子
import uniShare from 'uni_modules/uni-share/js_sdk/uni-share.js';
uniShare({
menus:[
{
"img": "/static/sharemenu/wechatfriend.png",
"text": "微信好友",
"share": {
"provider": "weixin",
"scene": "WXSceneSession"
}
},
{
"img": "/static/sharemenu/wechatmoments.png",
"text": "微信朋友圈",
"share": {
"provider": "weixin",
"scene": "WXSceneSession"
}
},
{
"img": "/static/sharemenu/weibo.png",
"text": "微博",
"share": {
"provider": "sinaweibo"
}
},
{
"img": "/static/sharemenu/qq.png",
"text": "QQ",
"share": {
"provider": "qq"
}
},
{
"img": "/static/sharemenu/copyurl.png",
"text": "复制",
"share": "copyurl"
},
{
"img": "/static/sharemenu/more.png",
"text": "更多",
"share": "shareSystem"
}
],
cancelText:"取消分享",
content:{
type: 0,
href: "https://uniapp.dcloud.io/api/plugins/share?id=share",
title: "主标题",
summary: "分享内容的摘要",
imageUrl: "https://uniapp.dcloud.io/api/plugins/share?id=share",
}
},e=>{ //callback
console.log(e);
})
\ No newline at end of file
#### 本功能基于[底部图标菜单](https://ext.dcloud.net.cn/plugin?id=4858)封装而成。
### 示例代码
```
uniShare({
content: { //公共的分享参数配置 类型(type)、链接(herf)、标题(title)、summary(描述)、imageUrl(缩略图)
type: 0,
href: 'https://uniapp.dcloud.io/',
title: '标题',
summary: '描述',
imageUrl: 'https://img-cdn-aliyun.dcloud.net.cn/stream/icon/__UNI__HelloUniApp.png'
},
menus: [{
"img": "/static/app-plus/sharemenu/wechatfriend.png",
"text": "微信好友",
"share": { //当前项的分享参数配置。可覆盖公共的配置如下:分享到微信小程序,配置了type=5
"provider": "weixin",
"scene": "WXSceneSession"
}
},
{
"img": "/static/app-plus/sharemenu/wechatmoments.png",
"text": "微信朋友圈",
"share": {
"provider": "weixin",
"scene": "WXSenceTimeline"
}
},
{
"img": "/static/app-plus/sharemenu/mp_weixin.png",
"text": "微信小程序",
"share": {
provider: "weixin",
scene: "WXSceneSession",
type: 5,
miniProgram: {
id: baseappConfig.mp.weixin.id,
path: `/pages/list/detail?id=${_id}&title=${title}`,
webUrl: baseappConfig.h5.url +
`/#/pages/list/detail?id=${_id}&title=${title}`,
type: 0
},
}
},
{
"img": "/static/app-plus/sharemenu/weibo.png",
"text": "微博",
"share": {
"provider": "sinaweibo"
}
},
{
"img": "/static/app-plus/sharemenu/qq.png",
"text": "QQ",
"share": {
"provider": "qq"
}
},
{
"img": "/static/app-plus/sharemenu/copyurl.png",
"text": "复制",
"share": "copyurl"
},
{
"img": "/static/app-plus/sharemenu/more.png",
"text": "更多",
"share": "shareSystem"
}
],
cancelText: "取消分享",
}, e => { //callback
console.log(e);
})
```
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册