提交 968aa6af 编写于 作者: DCloud_JSON's avatar DCloud_JSON 提交者: study夏羽

清理多余文件

上级 2f288711
......@@ -14,9 +14,8 @@
//checkIsAgree(); APP端暂时先用原生默认生成的。目前,自定义方式启动vue界面时,原生层已经请求了部分权限这并不符合国家的法规
// #endif
// #ifdef H5
checkIsAgree();
// 默认不开启。目前全球,仅欧盟国家有网页端同意隐私权限的需要。如果需要
// #ifdef H5
// checkIsAgree(); // 默认不开启。目前全球,仅欧盟国家有网页端同意隐私权限的需要。如果需要
// #endif
// #ifdef APP-PLUS
......
## 1.0.46(2021-08-05)
删除多余文件
清理多余文件
## 1.0.45(2021-08-05)
默认首页为nvue页面+fast
## 1.0.44(2021-08-05)
......
......@@ -241,7 +241,7 @@
},
fail: (err) => {
uni.hideLoading()
console.error(err);
console.log(err);
if (type == 'univerify') {
if (err.metadata && err.metadata.error_data) {
......
......@@ -75,7 +75,7 @@
},
"Vue": {
"vue2": "y",
"vue3": "u"
"vue3": "y"
}
}
}
......
......@@ -83,7 +83,7 @@
},
onLoad(event) {
console.log(event);
event = {"id":"60783c5cb781700001375672","title":"阿里小程序IDE官方内嵌uni-app,为开发者提供多端开发服务","excerpt":"阿里小程序IDE官方内嵌uni-app,为开发者提供多端开发服务","avatar":"https://vkceyugu.cdn.bspapp.com/VKCEYUGU-aliyun-gacrhzeynhss7c6d04/249516a0-3941-11eb-899d-733ae62bed2f.jpg"}
// event = {"id":"60783c5cb781700001375672","title":"阿里小程序IDE官方内嵌uni-app,为开发者提供多端开发服务","excerpt":"阿里小程序IDE官方内嵌uni-app,为开发者提供多端开发服务","avatar":"https://vkceyugu.cdn.bspapp.com/VKCEYUGU-aliyun-gacrhzeynhss7c6d04/249516a0-3941-11eb-899d-733ae62bed2f.jpg"}
//获取真实新闻id,通常 id 来自上一个页面
if (event.id) {
this.id = event.id
......
......@@ -4,10 +4,12 @@
<statusBar></statusBar>
<!-- #endif -->
<!-- 搜索功能 -->
<view @click.capture="searchClick">
<uni-search-bar class="uni-search-box" v-model="keyword" ref="searchBar" radius="100"
cancelButton="none" />
</view>
<uni-search-bar @click="searchClick" class="uni-search-box" v-model="keyword" ref="searchBar" radius="100"
cancelButton="none" disabled />
<view class="cover-search-bar" @click="searchClick"></view>
<unicloud-db ref='udb' v-slot:default="{data,pagination,hasMore, loading, error, options}" @error="onqueryerror"
:where="where" collection="opendb-news-articles,uni-id-users" :page-size="10"
field="avatar,title,last_modify_date,user_id.username">
......@@ -223,5 +225,14 @@
.f1 {
flex: 1;
}
.cover-search-bar{
height: 50px;
position: relative;
top: -50px;
margin-bottom: -50px;
/* #ifndef APP-NVUE */
z-index:999;
/* #endif */
}
</style>
\ No newline at end of file
<template>
<view class="center">
<uni-sign-in ref="signIn"></uni-sign-in>
<template>
<view class="center">
<uni-sign-in ref="signIn"></uni-sign-in>
<view class="userInfo" @click.capture="toUserInfo">
<uni-file-picker v-if="userInfo.avatar_file&&userInfo.avatar_file.url" v-model="userInfo.avatar_file"
fileMediatype="image" :del-icon="false" return-type="object" :image-styles="listStyles" disablePreview
disabled />
<image v-else class="logo-img" src="/static/uni-center/defaultAvatarUrl.png"></image>
<uni-file-picker v-if="userInfo.avatar_file&&userInfo.avatar_file.url" v-model="userInfo.avatar_file"
fileMediatype="image" :del-icon="false" return-type="object" :image-styles="listStyles" disablePreview
disabled />
<image v-else class="logo-img" src="/static/uni-center/defaultAvatarUrl.png"></image>
<view class="logo-title">
<text class="uer-name" v-if="hasLogin">{{userInfo.nickname||userInfo.username||userInfo.mobile}}</text>
<text class="uer-name" v-else>未登陆</text>
</view>
</view>
<uni-grid class="grid" :column="4" :showBorder="false" :square="true">
<uni-grid-item class="item" v-for="(item,index) in gridList" @click.native="tapGrid(index)" :key="index">
<uni-icons class="icon" color="#007AFF" :type="item.icon" size="26"></uni-icons>
<text class="text">{{item.text}}</text>
</uni-grid-item>
<text class="uer-name" v-if="hasLogin">{{userInfo.nickname||userInfo.username||userInfo.mobile}}</text>
<text class="uer-name" v-else>未登陆</text>
</view>
</view>
<uni-grid class="grid" :column="4" :showBorder="false" :square="true">
<uni-grid-item class="item" v-for="(item,index) in gridList" @click.native="tapGrid(index)" :key="index">
<uni-icons class="icon" color="#007AFF" :type="item.icon" size="26"></uni-icons>
<text class="text">{{item.text}}</text>
</uni-grid-item>
</uni-grid>
<uni-list class="center-list" v-for="(sublist , index) in ucenterList" :key="index">
<uni-list-item v-for="(item,i) in sublist" :title="item.title" link :rightText="item.rightText" :key="i"
:clickable="true" :to="item.to" @click="ucenterListClick(item)" :show-extra-icon="true"
:extraIcon="{type:item.icon,color:'#999'}">
<view v-if="item.showBadge" class="item-footer" slot="footer">
<text class="item-footer-text">{{item.rightText}}</text>
<view class="item-footer-badge"></view>
</view>
</uni-list-item>
</uni-list>
</view>
</template>
<script>
import {
mapGetters,
mapMutations
} from 'vuex';
import checkUpdate from '@/uni_modules/uni-upgrade-center-app/utils/check-update';
import callCheckVersion from '@/uni_modules/uni-upgrade-center-app/utils/call-check-version';
import uniShare from '@/uni_modules/uni-share/js_sdk/uni-share.js';
const db = uniCloud.database();
export default {
data() {
return {
gridList: [{
"text": "文字1",
"icon": "chat"
},
{
"text": "文字2",
"icon": "cloud-upload"
},
{
"text": "文字3",
"icon": "contact"
},
{
"text": "文字4",
"icon": "download"
}
],
ucenterList: [
[{
"title": '签到有奖',
"event": 'signIn',
"icon": "compose"
},
// #ifdef APP-PLUS
{
"title": '去评分',
"event": 'gotoMarket',
"icon": "hand-thumbsup"
},
//#endif
{
"title": '阅读过的文章',
"to": '/pages/ucenter/read-news-log/read-news-log',
"icon": "flag"
},
{
"title": '我的积分',
"to": '',
"event": 'getScore',
"icon": "paperplane"
}
// #ifdef APP-PLUS
, {
"title": '分销推荐',
"event": 'share',
"icon": "redo"
}
// #endif
],
[{
"title": '问题与反馈',
"to": '/uni_modules/uni-feedback/pages/uni-feedback/uni-feedback',
"icon": "help"
}, {
"title": '设置',
"to": '/pages/ucenter/settings/settings',
"icon": "gear"
}],
[{
"title": '关于',
"to": '/pages/ucenter/about/about',
"icon": "info"
}]
],
listStyles: {
"height": "150rpx", // 边框高度
"width": "150rpx", // 边框宽度
"border": { // 如果为 Boolean 值,可以控制边框显示与否
"color": "#eee", // 边框颜色
"width": "1px", // 边框宽度
"style": "solid", // 边框样式
"radius": "100%" // 边框圆角,支持百分比
}
}
}
},
<uni-list class="center-list" v-for="(sublist , index) in ucenterList" :key="index">
<uni-list-item v-for="(item,i) in sublist" :title="item.title" link :rightText="item.rightText" :key="i"
:clickable="true" :to="item.to" @click="ucenterListClick(item)" :show-extra-icon="true"
:extraIcon="{type:item.icon,color:'#999'}">
<view v-if="item.showBadge" class="item-footer" slot="footer">
<text class="item-footer-text">{{item.rightText}}</text>
<view class="item-footer-badge"></view>
</view>
</uni-list-item>
</uni-list>
</view>
</template>
<script>
import {
mapGetters,
mapMutations
} from 'vuex';
import checkUpdate from '@/uni_modules/uni-upgrade-center-app/utils/check-update';
import callCheckVersion from '@/uni_modules/uni-upgrade-center-app/utils/call-check-version';
import uniShare from '@/uni_modules/uni-share/js_sdk/uni-share.js';
const db = uniCloud.database();
export default {
data() {
return {
gridList: [{
"text": "文字1",
"icon": "chat"
},
{
"text": "文字2",
"icon": "cloud-upload"
},
{
"text": "文字3",
"icon": "contact"
},
{
"text": "文字4",
"icon": "download"
}
],
ucenterList: [
[{
"title": '签到有奖',
"event": 'signIn',
"icon": "compose"
},
// #ifdef APP-PLUS
{
"title": '去评分',
"event": 'gotoMarket',
"icon": "hand-thumbsup"
},
//#endif
{
"title": '阅读过的文章',
"to": '/pages/ucenter/read-news-log/read-news-log',
"icon": "flag"
},
{
"title": '我的积分',
"to": '',
"event": 'getScore',
"icon": "paperplane"
}
// #ifdef APP-PLUS
, {
"title": '分销推荐',
"event": 'share',
"icon": "redo"
}
// #endif
],
[{
"title": '问题与反馈',
"to": '/uni_modules/uni-feedback/pages/uni-feedback/uni-feedback',
"icon": "help"
}, {
"title": '设置',
"to": '/pages/ucenter/settings/settings',
"icon": "gear"
}],
[{
"title": '关于',
"to": '/pages/ucenter/about/about',
"icon": "info"
}]
],
listStyles: {
"height": "150rpx", // 边框高度
"width": "150rpx", // 边框宽度
"border": { // 如果为 Boolean 值,可以控制边框显示与否
"color": "#eee", // 边框颜色
"width": "1px", // 边框宽度
"style": "solid", // 边框样式
"radius": "100%" // 边框圆角,支持百分比
}
}
}
},
onLoad() {
console.log(313,this.userInfo,this.hasLogin);
//#ifdef APP-PLUS
this.ucenterList[this.ucenterList.length - 2].unshift({
title: '检查更新',
rightText: this.appVersion.version + '-' + this.appVersion.versionCode,
event: 'checkVersion',
icon: 'loop',
showBadge: this.appVersion.hasNew
})
console.log(313,this.userInfo,this.hasLogin);
//#ifdef APP-PLUS
this.ucenterList[this.ucenterList.length - 2].unshift({
title: '检查更新',
rightText: this.appVersion.version + '-' + this.appVersion.versionCode,
event: 'checkVersion',
icon: 'loop',
showBadge: this.appVersion.hasNew
})
//#endif
},
computed: {
...mapGetters({
userInfo: 'user/info',
hasLogin: 'user/hasLogin'
})
// #ifdef APP-PLUS
,
appVersion() {
return getApp().appVersion
}
// #endif
,
appConfig() {
return getApp().globalData.config
}
},
methods: {
...mapMutations({
setUserInfo: 'user/login'
}),
toSettings() {
uni.navigateTo({
url: "/pages/ucenter/settings/settings"
})
},
signIn() { //签到
this.$refs.signIn.open()
},
/**
* 个人中心项目列表点击事件
*/
ucenterListClick(item) {
if (!item.to && item.event) {
this[item.event]();
}
},
async checkVersion() {
let res = await callCheckVersion()
console.log(res);
if (res.result.code > 0) {
checkUpdate()
} else {
uni.showToast({
title: res.result.message,
icon: 'none'
});
}
},
toUserInfo() {
uni.navigateTo({
url: '/pages/ucenter/userinfo/userinfo'
})
},
tapGrid(index) {
uni.showToast({
title: '你点击了,第' + (index + 1) + '',
icon: 'none'
});
},
/**
* 去应用市场评分
*/
gotoMarket() {
// #ifdef APP-PLUS
if (uni.getSystemInfoSync().platform == "ios") {
// 这里填写appstore应用id
let appstoreid = this.appConfig.marketId.ios; // 'id1417078253';
plus.runtime.openURL("itms-apps://" + 'itunes.apple.com/cn/app/wechat/' + appstoreid + '?mt=8');
}
if (uni.getSystemInfoSync().platform == "android") {
var Uri = plus.android.importClass("android.net.Uri");
var uri = Uri.parse("market://details?id=" + this.appConfig.marketId.android);
var Intent = plus.android.importClass('android.content.Intent');
var intent = new Intent(Intent.ACTION_VIEW, uri);
var main = plus.android.runtimeMainActivity();
main.startActivity(intent);
}
// #endif
},
/**
* 获取积分信息
*/
getScore() {
if (!this.userInfo) return uni.showToast({
title: '请登录后查看积分',
icon: 'none'
});
uni.showLoading({
mask: true
})
db.collection("uni-id-scores").where('"user_id" == $env.uid').field('score,balance').get().then((res) => {
uni.hideLoading()
console.log(res);
const data = res.result.data[0];
let msg = '';
msg = data ? ('当前积分为' + data.score) : '当前无积分';
uni.showToast({
title: msg,
icon: 'none'
});
},
computed: {
...mapGetters({
userInfo: 'user/info',
hasLogin: 'user/hasLogin'
})
// #ifdef APP-PLUS
,
appVersion() {
return getApp().appVersion
}
// #endif
,
appConfig() {
return getApp().globalData.config
}
},
methods: {
...mapMutations({
setUserInfo: 'user/login'
}),
toSettings() {
uni.navigateTo({
url: "/pages/ucenter/settings/settings"
})
},
signIn() { //签到
this.$refs.signIn.open()
},
/**
* 个人中心项目列表点击事件
*/
ucenterListClick(item) {
if (!item.to && item.event) {
this[item.event]();
}
},
async checkVersion() {
let res = await callCheckVersion()
console.log(res);
if (res.result.code > 0) {
checkUpdate()
} else {
uni.showToast({
title: res.result.message,
icon: 'none'
});
}
},
toUserInfo() {
uni.navigateTo({
url: '/pages/ucenter/userinfo/userinfo'
})
},
tapGrid(index) {
uni.showToast({
title: '你点击了,第' + (index + 1) + '',
icon: 'none'
});
},
/**
* 去应用市场评分
*/
gotoMarket() {
// #ifdef APP-PLUS
if (uni.getSystemInfoSync().platform == "ios") {
// 这里填写appstore应用id
let appstoreid = this.appConfig.marketId.ios; // 'id1417078253';
plus.runtime.openURL("itms-apps://" + 'itunes.apple.com/cn/app/wechat/' + appstoreid + '?mt=8');
}
if (uni.getSystemInfoSync().platform == "android") {
var Uri = plus.android.importClass("android.net.Uri");
var uri = Uri.parse("market://details?id=" + this.appConfig.marketId.android);
var Intent = plus.android.importClass('android.content.Intent');
var intent = new Intent(Intent.ACTION_VIEW, uri);
var main = plus.android.runtimeMainActivity();
main.startActivity(intent);
}
// #endif
},
/**
* 获取积分信息
*/
getScore() {
if (!this.userInfo) return uni.showToast({
title: '请登录后查看积分',
icon: 'none'
});
uni.showLoading({
mask: true
})
db.collection("uni-id-scores").where('"user_id" == $env.uid').field('score,balance').get().then((res) => {
uni.hideLoading()
console.log(res);
const data = res.result.data[0];
let msg = '';
msg = data ? ('当前积分为' + data.score) : '当前无积分';
uni.showToast({
title: msg,
icon: 'none'
});
}).finally(()=>{
uni.hideLoading()
})
},
async share() {
let {
result
} = await uniCloud.callFunction({
name: 'uni-id-cf',
data: {
action: 'getUserInviteCode'
}
})
console.log(result);
let myInviteCode = result.myInviteCode || result.userInfo.my_invite_code
console.log(myInviteCode);
let {
appName,
logo,
company,
slogan
} = this.appConfig.about
// #ifdef APP-PLUS
uniShare({
content: { //公共的分享类型(type)、链接(herf)、标题(title)、summary(描述)、imageUrl(缩略图)
type: 0,
href: this.appConfig.h5.url +
`/#/pages/ucenter/invite/invite?code=uniInvitationCode:${myInviteCode}`,
title: appName,
summary: slogan,
imageUrl: logo +
'?x-oss-process=image/resize,m_fill,h_100,w_100' //压缩图片解决,在ios端分享图过大导致的图片失效问题
},
menus: [{
"img": "/static/app-plus/sharemenu/wechatfriend.png",
"text": "微信好友",
"share": {
"provider": "weixin",
"scene": "WXSceneSession"
}
},
{
"img": "/static/app-plus/sharemenu/wechatmoments.png",
"text": "微信朋友圈",
"share": {
"provider": "weixin",
"scene": "WXSenceTimeline"
}
},
{
"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);
})
// #endif
}
}
}
</script>
<style lang="scss" scoped>
/* #ifndef APP-NVUE */
view {
display: flex;
box-sizing: border-box;
})
},
async share() {
let {
result
} = await uniCloud.callFunction({
name: 'uni-id-cf',
data: {
action: 'getUserInviteCode'
}
})
console.log(result);
let myInviteCode = result.myInviteCode || result.userInfo.my_invite_code
console.log(myInviteCode);
let {
appName,
logo,
company,
slogan
} = this.appConfig.about
// #ifdef APP-PLUS
uniShare({
content: { //公共的分享类型(type)、链接(herf)、标题(title)、summary(描述)、imageUrl(缩略图)
type: 0,
href: this.appConfig.h5.url +
`/#/pages/ucenter/invite/invite?code=uniInvitationCode:${myInviteCode}`,
title: appName,
summary: slogan,
imageUrl: logo +
'?x-oss-process=image/resize,m_fill,h_100,w_100' //压缩图片解决,在ios端分享图过大导致的图片失效问题
},
menus: [{
"img": "/static/app-plus/sharemenu/wechatfriend.png",
"text": "微信好友",
"share": {
"provider": "weixin",
"scene": "WXSceneSession"
}
},
{
"img": "/static/app-plus/sharemenu/wechatmoments.png",
"text": "微信朋友圈",
"share": {
"provider": "weixin",
"scene": "WXSenceTimeline"
}
},
{
"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);
})
// #endif
}
}
}
</script>
<style lang="scss" scoped>
/* #ifndef APP-NVUE */
view {
display: flex;
box-sizing: border-box;
flex-direction: column;
}
page {
background-color: #f8f8f8;
}
/* #endif*/
.center {
flex: 1;
flex-direction: column;
}
page {
background-color: #f8f8f8;
}
/* #endif*/
.center {
flex: 1;
flex-direction: column;
background-color: #f8f8f8;
}
.userInfo {
width: 750rpx;
padding: 20rpx;
padding-top: 50px;
background-image: url(../../static/uni-center/headers.png);
flex-direction: column;
align-items: center;
}
.logo-img {
width: 150rpx;
height: 150rpx;
border-radius: 150rpx;
}
.logo-title {
flex: 1;
align-items: center;
justify-content: space-between;
flex-direction: row;
}
.uer-name {
height: 100rpx;
line-height: 100rpx;
font-size: 38rpx;
color: #FFFFFF;
}
.center-list {
margin-bottom: 30rpx;
background-color: #f9f9f9;
}
.center-list-cell {
width: 750rpx;
background-color: #007AFF;
height: 40rpx;
}
.grid {
background-color: #FFFFFF;
margin-bottom: 6px;
}
.uni-grid .text {
font-size: 30rpx;
height: 25px;
line-height: 25px;
color: #817f82;
}
.uni-grid .item ::v-deep .uni-grid-item__box {
justify-content: center;
align-items: center;
}
/*修改边线粗细示例*/
background-color: #f8f8f8;
}
.userInfo {
width: 750rpx;
padding: 20rpx;
padding-top: 50px;
background-image: url(../../static/uni-center/headers.png);
flex-direction: column;
align-items: center;
}
.logo-img {
width: 150rpx;
height: 150rpx;
border-radius: 150rpx;
}
.logo-title {
flex: 1;
align-items: center;
justify-content: space-between;
flex-direction: row;
}
.uer-name {
height: 100rpx;
line-height: 100rpx;
font-size: 38rpx;
color: #FFFFFF;
}
.center-list {
margin-bottom: 30rpx;
background-color: #f9f9f9;
}
.center-list-cell {
width: 750rpx;
background-color: #007AFF;
height: 40rpx;
}
.grid {
background-color: #FFFFFF;
margin-bottom: 6px;
}
.uni-grid .text {
font-size: 30rpx;
height: 25px;
line-height: 25px;
color: #817f82;
}
.uni-grid .item ::v-deep .uni-grid-item__box {
justify-content: center;
align-items: center;
}
/*修改边线粗细示例*/
/* #ifndef APP-NVUE */
/* #ifdef VUE2 */
.center-list ::v-deep .uni-list--border:after{
/* #endif */
/* #ifdef VUE3 */
.center-list :deep(.uni-list--border:after){
/* #endif */
-webkit-transform: scaleY(0.2);
transform: scaleY(0.2);
margin-left: 80rpx;
}
/* #ifdef VUE2 */
.center-list ::v-deep .uni-list--border-top,
.center-list ::v-deep .uni-list--border-bottom{
.center-list ::v-deep .uni-list--border:after {
-webkit-transform: scaleY(0.2);
transform: scaleY(0.2);
margin-left: 80rpx;
}
.center-list ::v-deep .uni-list--border-top,
.center-list ::v-deep .uni-list--border-bottom {
display: none;
}
/* #endif */
.item-footer {
flex-direction: row;
align-items: center;
}
.item-footer-text {
color: #999;
font-size: 24rpx;
padding-right: 10rpx;
}
.item-footer-badge {
width: 20rpx;
height: 20rpx;
/* #ifndef APP-NVUE */
border-radius: 50%;
/* #endif */
/* #ifdef VUE3 */
.center-list :deep(.uni-list--border-top),
.center-list :deep(.uni-list--border-bottom){
/* #ifdef APP-NVUE */
border-radius: 10rpx;
/* #endif */
display: none;
}
/* #endif */
.item-footer {
flex-direction: row;
align-items: center;
}
.item-footer-text {
color: #999;
font-size: 24rpx;
padding-right: 10rpx;
}
.item-footer-badge {
width: 20rpx;
height: 20rpx;
/* #ifndef APP-NVUE */
border-radius: 50%;
/* #endif */
/* #ifdef APP-NVUE */
border-radius: 10rpx;
/* #endif */
background-color: #DD524D;
}
</style>
background-color: #DD524D;
}
</style>
\ No newline at end of file
<template>
<uni-sign-in ref="signIn"></uni-sign-in>
<template>
<script>
export default {
methods: {
signIn() { //签到
this.$refs.signIn.open()
}
}
}
<script>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册