新
@ -47,17 +47,17 @@ export default async function() {
|
|||||||
methodName, // 云对象的方法名称
|
methodName, // 云对象的方法名称
|
||||||
params // 参数列表
|
params // 参数列表
|
||||||
}) {
|
}) {
|
||||||
// console.log('interceptObject',{
|
console.log('interceptObject',{
|
||||||
// objectName, // 云对象名称
|
objectName, // 云对象名称
|
||||||
// methodName, // 云对象的方法名称
|
methodName, // 云对象的方法名称
|
||||||
// params // 参数列表
|
params // 参数列表
|
||||||
// });
|
});
|
||||||
if(objectName == "uni-id-co" && (methodName.includes('loginBy') || ['login','registerUser'].includes(methodName) )){
|
if(objectName == "uni-id-co" && (methodName.includes('loginBy') || ['login','registerUser'].includes(methodName) )){
|
||||||
console.log('执行登录相关云对象');
|
console.log('执行登录相关云对象');
|
||||||
params[0].inviteCode = await new Promise((callBack) => {
|
params[0].inviteCode = await new Promise((callBack) => {
|
||||||
uni.getClipboardData({
|
uni.getClipboardData({
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
console.log('剪切板内容:'+res.data);
|
console.log('剪切板内容:'+JSON.stringify(res));
|
||||||
if (res.data.slice(0, 18) == 'uniInvitationCode:') {
|
if (res.data.slice(0, 18) == 'uniInvitationCode:') {
|
||||||
let uniInvitationCode = res.data.slice(18, 38)
|
let uniInvitationCode = res.data.slice(18, 38)
|
||||||
console.log('当前用户是其他用户推荐下载的,推荐者的code是:' + uniInvitationCode);
|
console.log('当前用户是其他用户推荐下载的,推荐者的code是:' + uniInvitationCode);
|
||||||
|
|||||||
33
env.js
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// 参考文档: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/#envjs
|
||||||
|
module.exports = {
|
||||||
|
"is-custom-runtime": false,
|
||||||
|
"UNI_TEST_CUSTOM_ENV": {},
|
||||||
|
"compile": true,
|
||||||
|
"h5": {
|
||||||
|
"options": {
|
||||||
|
"headless": true
|
||||||
|
},
|
||||||
|
"executablePath": ""
|
||||||
|
},
|
||||||
|
"mp-weixin": {
|
||||||
|
"port": 9420,
|
||||||
|
"account": "",
|
||||||
|
"args": "",
|
||||||
|
"cwd": "",
|
||||||
|
"launch": true,
|
||||||
|
"teardown": "disconnect",
|
||||||
|
"remote": false,
|
||||||
|
"executablePath": ""
|
||||||
|
},
|
||||||
|
"app-plus": {
|
||||||
|
"android": {
|
||||||
|
"id": "",
|
||||||
|
"executablePath": ""
|
||||||
|
},
|
||||||
|
"version": "",
|
||||||
|
"ios": {
|
||||||
|
"id": "",
|
||||||
|
"executablePath": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
jest.config.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
module.exports = {
|
||||||
|
testTimeout: 10000,
|
||||||
|
reporters: [
|
||||||
|
'default'
|
||||||
|
],
|
||||||
|
watchPathIgnorePatterns: ['/node_modules/', '/dist/', '/.git/'],
|
||||||
|
moduleFileExtensions: ['js', 'json'],
|
||||||
|
rootDir: __dirname,
|
||||||
|
testMatch: ["<rootDir>/pages/**/*test.[jt]s?(x)"],
|
||||||
|
testPathIgnorePatterns: ['/node_modules/']
|
||||||
|
}
|
||||||
@ -1,43 +1,36 @@
|
|||||||
/* /// Pages-Tool: 该文件是pages-tool插件的配置文件,根据pages-config.json的配置,本文件的内容可能合并到pages.json*/
|
/* /// Pages-Tool: 该文件是pages-tool插件的配置文件,根据pages-config.json的配置,本文件的内容可能合并到pages.json*/
|
||||||
{
|
{
|
||||||
"pages": [
|
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
|
||||||
// {
|
|
||||||
// "path": "pages/grid/login",
|
|
||||||
// "style": {
|
|
||||||
// "navigationStyle": "custom"
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// ,
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"path": "pages/grid/grid",
|
"path": "pages/index/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationStyle": "custom"
|
"navigationBarTitleText": "主页"
|
||||||
}
|
|
||||||
},{
|
|
||||||
"path": "pages/ucenter",
|
|
||||||
"style": {
|
|
||||||
"navigationStyle": "custom"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/list/list",
|
"path": "pages/cal/cal",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationStyle": "custom"
|
"navigationBarTitleText": "计算"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/list/detail",
|
"path": "pages/info/info",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationStyle": "custom"
|
"navigationBarTitleText": "资料"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/ucenter/ucenter",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "我的"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
,{
|
,
|
||||||
|
{
|
||||||
"path": "uni_modules/uni-upgrade-center-app/pages/upgrade-popup",
|
"path": "uni_modules/uni-upgrade-center-app/pages/upgrade-popup",
|
||||||
"style": {
|
"style": {
|
||||||
"disableScroll": true,
|
"disableScroll": true,
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
/* /// Pages-Tool: 该文件是pages-tool插件的配置文件,根据pages-config.json的配置,本文件的内容可能合并到pages.json*/
|
|
||||||
{
|
{
|
||||||
"tabBar": {
|
"tabBar": {
|
||||||
"color": "#7A7E83",
|
"color": "#7A7E83",
|
||||||
@ -6,23 +5,28 @@
|
|||||||
"borderStyle": "black",
|
"borderStyle": "black",
|
||||||
"backgroundColor": "#FFFFFF",
|
"backgroundColor": "#FFFFFF",
|
||||||
"list": [{
|
"list": [{
|
||||||
"pagePath": "pages/grid/grid",
|
"pagePath": "pages/index/index",
|
||||||
"iconPath": "static/tabbar/list.png",
|
"iconPath": "static/tabbar/list.png",
|
||||||
"selectedIconPath": "static/tabbar/list_active.png",
|
"selectedIconPath": "static/tabbar/list_active.png",
|
||||||
"text": "首页"
|
"text": "首页"
|
||||||
|
}, {
|
||||||
|
"pagePath": "pages/cal/cal",
|
||||||
|
"iconPath": "static/tabbar/cal.png",
|
||||||
|
"selectedIconPath": "static/tabbar/cal_active.png",
|
||||||
|
"text": "计算"
|
||||||
|
}, {
|
||||||
|
"pagePath": "pages/info/info",
|
||||||
|
"iconPath": "static/tabbar/info.png",
|
||||||
|
"selectedIconPath": "static/tabbar/info_active.png",
|
||||||
|
"text": "资料"
|
||||||
}
|
}
|
||||||
// , {
|
|
||||||
// "pagePath": "pages/list/list",
|
|
||||||
// "iconPath": "static/tabbar/grid.png",
|
|
||||||
// "selectedIconPath": "static/tabbar/grid_active.png",
|
|
||||||
// "text": "常用资料"
|
|
||||||
// }
|
|
||||||
, {
|
, {
|
||||||
"pagePath": "pages/ucenter",
|
"pagePath": "pages/ucenter/ucenter",
|
||||||
"iconPath": "static/tabbar/me.png",
|
"iconPath": "static/tabbar/me.png",
|
||||||
"selectedIconPath": "static/tabbar/me_active.png",
|
"selectedIconPath": "static/tabbar/me_active.png",
|
||||||
"text": "我的"
|
"text": "我的"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}s
|
||||||
58
pages.json
@ -1,42 +1,35 @@
|
|||||||
{
|
{
|
||||||
"pages": [
|
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
|
||||||
// {
|
|
||||||
// "path": "pages/grid/login",
|
|
||||||
// "style": {
|
|
||||||
// "navigationStyle": "custom"
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// ,
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"path": "pages/grid/grid",
|
"path": "pages/index/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationStyle": "custom"
|
"navigationBarTitleText": "主页"
|
||||||
}
|
|
||||||
},{
|
|
||||||
"path": "pages/ucenter",
|
|
||||||
"style": {
|
|
||||||
"navigationStyle": "custom"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/list/list",
|
"path": "pages/cal/cal",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationStyle": "custom"
|
"navigationBarTitleText": "计算"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/list/detail",
|
"path": "pages/info/info",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationStyle": "custom"
|
"navigationBarTitleText": "资料"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/ucenter/ucenter",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "我的"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
,{
|
,
|
||||||
|
{
|
||||||
"path": "uni_modules/uni-upgrade-center-app/pages/upgrade-popup",
|
"path": "uni_modules/uni-upgrade-center-app/pages/upgrade-popup",
|
||||||
"style": {
|
"style": {
|
||||||
"disableScroll": true,
|
"disableScroll": true,
|
||||||
@ -648,19 +641,24 @@
|
|||||||
"borderStyle": "black",
|
"borderStyle": "black",
|
||||||
"backgroundColor": "#FFFFFF",
|
"backgroundColor": "#FFFFFF",
|
||||||
"list": [{
|
"list": [{
|
||||||
"pagePath": "pages/grid/grid",
|
"pagePath": "pages/index/index",
|
||||||
"iconPath": "static/tabbar/list.png",
|
"iconPath": "static/tabbar/list.png",
|
||||||
"selectedIconPath": "static/tabbar/list_active.png",
|
"selectedIconPath": "static/tabbar/list_active.png",
|
||||||
"text": "首页"
|
"text": "首页"
|
||||||
|
}, {
|
||||||
|
"pagePath": "pages/cal/cal",
|
||||||
|
"iconPath": "static/tabbar/cal.png",
|
||||||
|
"selectedIconPath": "static/tabbar/cal_active.png",
|
||||||
|
"text": "计算"
|
||||||
|
}, {
|
||||||
|
"pagePath": "pages/info/info",
|
||||||
|
"iconPath": "static/tabbar/info.png",
|
||||||
|
"selectedIconPath": "static/tabbar/info_active.png",
|
||||||
|
"text": "资料"
|
||||||
}
|
}
|
||||||
// , {
|
|
||||||
// "pagePath": "pages/list/list",
|
|
||||||
// "iconPath": "static/tabbar/grid.png",
|
|
||||||
// "selectedIconPath": "static/tabbar/grid_active.png",
|
|
||||||
// "text": "常用资料"
|
|
||||||
// }
|
|
||||||
, {
|
, {
|
||||||
"pagePath": "pages/ucenter",
|
"pagePath": "pages/ucenter/ucenter",
|
||||||
"iconPath": "static/tabbar/me.png",
|
"iconPath": "static/tabbar/me.png",
|
||||||
"selectedIconPath": "static/tabbar/me_active.png",
|
"selectedIconPath": "static/tabbar/me_active.png",
|
||||||
"text": "我的"
|
"text": "我的"
|
||||||
|
|||||||
370
pages/cal/cal.vue
Normal file
@ -0,0 +1,370 @@
|
|||||||
|
<template>
|
||||||
|
<view class="warp">
|
||||||
|
<uni-nav-bar dark :fixed="true" shadow background-color="#007AFF" status-bar title="计算工具" />
|
||||||
|
<view>
|
||||||
|
<!-- 流量计算 -->
|
||||||
|
<view class="section-box">
|
||||||
|
<text class="decoration"></text>
|
||||||
|
<text class="section-text">{{ $t('llJs.grid') }}</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="Grid">
|
||||||
|
<view class="Grid-Item" v-for="(item, index) in llJsgridList" :key="index">
|
||||||
|
<navigator :url="item.url">
|
||||||
|
<view class="GSimg">
|
||||||
|
<image class="Image" :src="getStaticFilePath('mianicon/' + item.icon)" mode="aspectFit"></image>
|
||||||
|
</view>
|
||||||
|
<view class="GStitle">{{ item.type }}</view>
|
||||||
|
</navigator>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 参数计算 -->
|
||||||
|
<view class="section-box">
|
||||||
|
<text class="decoration"></text>
|
||||||
|
<text class="section-text">{{ $t('wxcsJs.grid') }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="Grid">
|
||||||
|
<view class="Grid-Item" v-for="(item, index) in wxcsJsgridList" :key="index">
|
||||||
|
<navigator :url="item.url">
|
||||||
|
<view class="GSimg">
|
||||||
|
<image class="Image" :src="getStaticFilePath('mianicon/' + item.icon)" mode="aspectFit"></image>
|
||||||
|
</view>
|
||||||
|
<view class="GStitle">{{ item.type }}</view>
|
||||||
|
</navigator>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- CNG计算 -->
|
||||||
|
<view class="section-box">
|
||||||
|
<text class="decoration"></text>
|
||||||
|
<text class="section-text">{{ $t('CNGJs.grid') }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="Grid">
|
||||||
|
<view class="Grid-Item" v-for="(item, index) in CNGJsgridList" :key="index">
|
||||||
|
<navigator :url="item.url">
|
||||||
|
<view class="GSimg">
|
||||||
|
<image class="Image" :src="getStaticFilePath('mianicon/' + item.icon)" mode="aspectFill"></image>
|
||||||
|
</view>
|
||||||
|
<view class="GStitle">{{ item.type }}</view>
|
||||||
|
</navigator>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- <!-- CNG计算 -->
|
||||||
|
<view class="section-box">
|
||||||
|
<text class="decoration"></text>
|
||||||
|
<text class="section-text">{{ $t('QtJs.grid') }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="Grid">
|
||||||
|
<view class="Grid-Item" v-for="(item, index) in QtJsgridList" :key="index">
|
||||||
|
<navigator :url="item.url">
|
||||||
|
<view class="GSimg">
|
||||||
|
<image class="Image" :src="getStaticFilePath('mianicon/' + item.icon)" mode="aspectFill"></image>
|
||||||
|
</view>
|
||||||
|
<view class="GStitle">{{ item.type }}</view>
|
||||||
|
</navigator>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// import {
|
||||||
|
// getJsonTree,
|
||||||
|
// groupBy
|
||||||
|
// } from "@/js_sdk/util/jsonData";
|
||||||
|
import deviceinfo from '@/js_sdk/dc-deviceinfo/deviceinfo.js';
|
||||||
|
import { saveDepartStore, saveDictItemStore } from '@/js_sdk/util/dictTools';
|
||||||
|
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
import statusBar from '@/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-status-bar';
|
||||||
|
// #endif
|
||||||
|
const db = uniCloud.database();
|
||||||
|
|
||||||
|
export default {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
components: {
|
||||||
|
statusBar
|
||||||
|
},
|
||||||
|
// #endif
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
llJsgridList: [],
|
||||||
|
wxcsJsgridList: [],
|
||||||
|
CNGJsgridList: [],
|
||||||
|
QtJsgridList: [],
|
||||||
|
current: 0,
|
||||||
|
hasLogin: false,
|
||||||
|
CPUNo: [],
|
||||||
|
msgList: []
|
||||||
|
};
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
this.hasLogin = uniCloud.getCurrentUserInfo().tokenExpired > Date.now();
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
//#ifdef APP
|
||||||
|
|
||||||
|
plus.device.getInfo({
|
||||||
|
success: function (e) {
|
||||||
|
console.log('getDeviceInfo success: ' + JSON.stringify(e));
|
||||||
|
},
|
||||||
|
fail: function (e) {
|
||||||
|
console.log('getDeviceInfo failed: ' + JSON.stringify(e));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// this.CPUNo=JSON.stringify(plus.device.getInfo())
|
||||||
|
//#endif
|
||||||
|
|
||||||
|
let that = this;
|
||||||
|
uni.getSystemInfo({
|
||||||
|
success: function (res) {
|
||||||
|
// console.log(res)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
this.getGrid();
|
||||||
|
saveDictItemStore();
|
||||||
|
saveDepartStore();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getGrid() {
|
||||||
|
let gridList = [];
|
||||||
|
gridList.push({
|
||||||
|
type: this.$t('llJs.cysllJs.title'),
|
||||||
|
url: this.$t('llJs.cysllJs.url'),
|
||||||
|
icon: this.$t('llJs.cysllJs.icon')
|
||||||
|
});
|
||||||
|
gridList.push({
|
||||||
|
type: this.$t('llJs.sdsllJs.title'),
|
||||||
|
url: this.$t('llJs.sdsllJs.url'),
|
||||||
|
icon: this.$t('llJs.sdsllJs.icon')
|
||||||
|
});
|
||||||
|
gridList.push({
|
||||||
|
type: this.$t('llJs.ljlllJs.title'),
|
||||||
|
url: this.$t('llJs.ljlllJs.url'),
|
||||||
|
icon: this.$t('llJs.ljlllJs.icon')
|
||||||
|
});
|
||||||
|
|
||||||
|
this.llJsgridList = gridList;
|
||||||
|
gridList = [];
|
||||||
|
gridList.push({
|
||||||
|
type: this.$t('wxcsJs.ysyzJs.title'),
|
||||||
|
url: this.$t('wxcsJs.ysyzJs.url'),
|
||||||
|
icon: this.$t('wxcsJs.ysyzJs.icon')
|
||||||
|
});
|
||||||
|
gridList.push({
|
||||||
|
type: this.$t('wxcsJs.rzJs.title'),
|
||||||
|
url: this.$t('wxcsJs.rzJs.url'),
|
||||||
|
icon: this.$t('wxcsJs.rzJs.icon')
|
||||||
|
});
|
||||||
|
gridList.push({
|
||||||
|
type: this.$t('wxcsJs.qtJs.title'),
|
||||||
|
url: this.$t('wxcsJs.qtJs.url'),
|
||||||
|
icon: this.$t('wxcsJs.qtJs.icon')
|
||||||
|
});
|
||||||
|
this.wxcsJsgridList = gridList;
|
||||||
|
|
||||||
|
gridList = [];
|
||||||
|
|
||||||
|
gridList.push({
|
||||||
|
type: this.$t('CNGJs.srjJs.title'),
|
||||||
|
url: this.$t('CNGJs.srjJs.url'),
|
||||||
|
icon: this.$t('CNGJs.srjJs.icon')
|
||||||
|
});
|
||||||
|
gridList.push({
|
||||||
|
type: this.$t('CNGJs.zxcJs.title'),
|
||||||
|
url: this.$t('CNGJs.zxcJs.url'),
|
||||||
|
icon: this.$t('CNGJs.zxcJs.icon')
|
||||||
|
});
|
||||||
|
gridList.push({
|
||||||
|
type: this.$t('CNGJs.LNGQhJs.title'),
|
||||||
|
url: this.$t('CNGJs.LNGQhJs.url'),
|
||||||
|
icon: this.$t('CNGJs.LNGQhJs.icon')
|
||||||
|
});
|
||||||
|
this.CNGJsgridList = gridList;
|
||||||
|
gridList = [];
|
||||||
|
|
||||||
|
gridList.push({
|
||||||
|
type: this.$t('QtJs.ZBGJs.title'),
|
||||||
|
url: this.$t('QtJs.ZBGJs.url'),
|
||||||
|
icon: this.$t('QtJs.ZBGJs.icon')
|
||||||
|
});
|
||||||
|
gridList.push({
|
||||||
|
type: this.$t('QtJs.srjBGJs.title'),
|
||||||
|
url: this.$t('QtJs.srjBGJs.url'),
|
||||||
|
icon: this.$t('QtJs.srjBGJs.icon')
|
||||||
|
});
|
||||||
|
// gridList.push({
|
||||||
|
// "type": this.$t('QtJs.SqgyJs.title'),
|
||||||
|
// "url": this.$t('QtJs.SqgyJs.url')
|
||||||
|
// })
|
||||||
|
this.QtJsgridList = gridList;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* banner加载后触发的回调
|
||||||
|
*/
|
||||||
|
onqueryload(data) {
|
||||||
|
// console.log(JSON.stringify(data))
|
||||||
|
},
|
||||||
|
changeSwiper(e) {
|
||||||
|
this.current = e.detail.current;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 点击banner的处理
|
||||||
|
*/
|
||||||
|
clickBannerItem(item) {
|
||||||
|
// 有外部链接-跳转url
|
||||||
|
if (item.open_url) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/uni_modules/uni-id-pages/pages/common/webview/webview?url=' + item.open_url + '&title=' + item.title,
|
||||||
|
success: (res) => {},
|
||||||
|
fail: () => {},
|
||||||
|
complete: () => {}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 其余业务处理
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
/* #ifndef APP-NVUE */
|
||||||
|
page {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
box-sizing: border-box;
|
||||||
|
background-color: #fff;
|
||||||
|
min-height: 100%;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
view {
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* #endif */
|
||||||
|
|
||||||
|
.section-box {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: left;
|
||||||
|
padding-left: calc(10vw / 2);
|
||||||
|
padding-top: 10px;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.decoration {
|
||||||
|
width: 4px;
|
||||||
|
height: 12px;
|
||||||
|
border-radius: 10px;
|
||||||
|
background-color: #2979ff;
|
||||||
|
// margin-left: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-text {
|
||||||
|
color: blue;
|
||||||
|
margin-left: 10rpx;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* #ifdef APP-NVUE */
|
||||||
|
.warp {
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* #endif */
|
||||||
|
|
||||||
|
.Grid {
|
||||||
|
width: 90vw;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: flex-start;
|
||||||
|
align-content: space-between;
|
||||||
|
padding-left: calc(10vw / 2);
|
||||||
|
column-gap: calc(25% / 3);
|
||||||
|
row-gap: 5rpx;
|
||||||
|
box-sizing: content-box;
|
||||||
|
|
||||||
|
.Grid-Item {
|
||||||
|
width: 25%;
|
||||||
|
height: 150rpx;
|
||||||
|
text-align: center;
|
||||||
|
border: 0rpx solid #ccc;
|
||||||
|
box-sizing: content-box;
|
||||||
|
background: #ffffff;
|
||||||
|
background-image: '@/static/uni-center/headers.png';
|
||||||
|
|
||||||
|
.GSimg {
|
||||||
|
width: 100%;
|
||||||
|
height: 10rpx;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
.Image {
|
||||||
|
width: 100rpx;
|
||||||
|
height: 100rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.GStitle {
|
||||||
|
width: 100%;
|
||||||
|
height: 34rpx;
|
||||||
|
line-height: 34rpx;
|
||||||
|
color: orangered;
|
||||||
|
font-size: 26rpx;
|
||||||
|
padding-top: 15px;
|
||||||
|
margin-top: 80rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.banner-image {
|
||||||
|
width: 750rpx;
|
||||||
|
height: 400rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.swiper-box {
|
||||||
|
height: 400rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-icons {
|
||||||
|
padding: 16rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-container-bar {
|
||||||
|
/* #ifndef APP-NVUE */
|
||||||
|
display: flex;
|
||||||
|
/* #endif */
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
z-index: 10;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* #ifndef APP-NVUE || VUE3*/
|
||||||
|
::v-deep
|
||||||
|
|
||||||
|
/* #endif */
|
||||||
|
.uni-searchbar__box {
|
||||||
|
border-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* #ifndef APP-NVUE || VUE3 */
|
||||||
|
::v-deep
|
||||||
|
|
||||||
|
/* #endif */
|
||||||
|
.uni-input-placeholder {
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -1,399 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view class="warp">
|
|
||||||
<uni-nav-bar dark :fixed="true" shadow background-color="#007AFF" status-bar title="天然气计算工具集" />
|
|
||||||
<view>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- 流量计算 -->
|
|
||||||
<view class="section-box">
|
|
||||||
<text class="decoration"></text>
|
|
||||||
<text class="section-text">{{$t('llJs.grid')}}</text>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="Grid">
|
|
||||||
<view class="Grid-Item" v-for="(item,index) in llJsgridList" :key="index">
|
|
||||||
<navigator :url="item.url">
|
|
||||||
<view class="GSimg">
|
|
||||||
<image class="Image" :src="getStaticFilePath('mianicon/'+item.icon)" mode="aspectFit">
|
|
||||||
</image>
|
|
||||||
</view>
|
|
||||||
<view class="GStitle">{{ item.type }}</view>
|
|
||||||
</navigator>
|
|
||||||
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- 参数计算 -->
|
|
||||||
<view class="section-box">
|
|
||||||
<text class="decoration"></text>
|
|
||||||
<text class="section-text">{{$t('wxcsJs.grid')}}</text>
|
|
||||||
</view>
|
|
||||||
<view class="Grid">
|
|
||||||
<view class="Grid-Item" v-for="(item,index) in wxcsJsgridList" :key="index">
|
|
||||||
<navigator :url="item.url">
|
|
||||||
<view class="GSimg">
|
|
||||||
<image class="Image" :src="getStaticFilePath('mianicon/'+item.icon)" mode="aspectFit">
|
|
||||||
</image>
|
|
||||||
</view>
|
|
||||||
<view class="GStitle">{{ item.type }}</view>
|
|
||||||
</navigator>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- CNG计算 -->
|
|
||||||
<view class="section-box">
|
|
||||||
<text class="decoration"></text>
|
|
||||||
<text class="section-text">{{$t('CNGJs.grid')}}</text>
|
|
||||||
</view>
|
|
||||||
<view class="Grid">
|
|
||||||
<view class="Grid-Item" v-for="(item,index) in CNGJsgridList" :key="index">
|
|
||||||
<navigator :url="item.url">
|
|
||||||
<view class="GSimg">
|
|
||||||
<image class="Image" :src="getStaticFilePath('mianicon/'+item.icon)" mode="aspectFill">
|
|
||||||
</image>
|
|
||||||
</view>
|
|
||||||
<view class="GStitle">{{ item.type }}</view>
|
|
||||||
</navigator>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- <!-- CNG计算 -->
|
|
||||||
<view class="section-box">
|
|
||||||
<text class="decoration"></text>
|
|
||||||
<text class="section-text">{{$t('QtJs.grid')}}</text>
|
|
||||||
</view>
|
|
||||||
<view class="Grid">
|
|
||||||
<view class="Grid-Item" v-for="(item,index) in QtJsgridList" :key="index">
|
|
||||||
<navigator :url="item.url">
|
|
||||||
<view class="GSimg">
|
|
||||||
<image class="Image" :src="getStaticFilePath('mianicon/'+item.icon)" mode="aspectFill">
|
|
||||||
</image>
|
|
||||||
</view>
|
|
||||||
<view class="GStitle">{{ item.type }}</view>
|
|
||||||
</navigator>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
// import {
|
|
||||||
// getJsonTree,
|
|
||||||
// groupBy
|
|
||||||
// } from "@/js_sdk/util/jsonData";
|
|
||||||
import deviceinfo from '@/js_sdk/dc-deviceinfo/deviceinfo.js'
|
|
||||||
import {
|
|
||||||
saveDepartStore,
|
|
||||||
saveDictItemStore
|
|
||||||
} from '@/js_sdk/util/dictTools';
|
|
||||||
|
|
||||||
// #ifdef APP-PLUS
|
|
||||||
import statusBar from "@/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-status-bar";
|
|
||||||
// #endif
|
|
||||||
const db = uniCloud.database();
|
|
||||||
|
|
||||||
export default {
|
|
||||||
// #ifdef APP-PLUS
|
|
||||||
components: {
|
|
||||||
statusBar
|
|
||||||
},
|
|
||||||
// #endif
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
llJsgridList: [],
|
|
||||||
wxcsJsgridList: [],
|
|
||||||
CNGJsgridList: [],
|
|
||||||
QtJsgridList: [],
|
|
||||||
current: 0,
|
|
||||||
hasLogin: false,
|
|
||||||
CPUNo: [],
|
|
||||||
msgList: []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onShow() {
|
|
||||||
this.hasLogin = uniCloud.getCurrentUserInfo().tokenExpired > Date.now()
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
|
|
||||||
//#ifdef APP
|
|
||||||
|
|
||||||
plus.device.getInfo({
|
|
||||||
success: function(e) {
|
|
||||||
console.log('getDeviceInfo success: ' + JSON.stringify(e));
|
|
||||||
},
|
|
||||||
fail: function(e) {
|
|
||||||
console.log('getDeviceInfo failed: ' + JSON.stringify(e));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// this.CPUNo=JSON.stringify(plus.device.getInfo())
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
|
|
||||||
let that = this;
|
|
||||||
uni.getSystemInfo({
|
|
||||||
success: function(res) {
|
|
||||||
// console.log(res)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
onLoad() {
|
|
||||||
|
|
||||||
this.getGrid();
|
|
||||||
saveDictItemStore();
|
|
||||||
saveDepartStore();
|
|
||||||
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
|
|
||||||
|
|
||||||
getGrid() {
|
|
||||||
let gridList = []
|
|
||||||
gridList.push({
|
|
||||||
"type": this.$t('llJs.cysllJs.title'),
|
|
||||||
"url": this.$t('llJs.cysllJs.url'),
|
|
||||||
"icon": this.$t('llJs.cysllJs.icon')
|
|
||||||
})
|
|
||||||
gridList.push({
|
|
||||||
"type": this.$t('llJs.sdsllJs.title'),
|
|
||||||
"url": this.$t('llJs.sdsllJs.url'),
|
|
||||||
"icon": this.$t('llJs.sdsllJs.icon')
|
|
||||||
})
|
|
||||||
gridList.push({
|
|
||||||
"type": this.$t('llJs.ljlllJs.title'),
|
|
||||||
"url": this.$t('llJs.ljlllJs.url'),
|
|
||||||
"icon": this.$t('llJs.ljlllJs.icon')
|
|
||||||
})
|
|
||||||
|
|
||||||
this.llJsgridList = gridList
|
|
||||||
gridList = []
|
|
||||||
gridList.push({
|
|
||||||
"type": this.$t('wxcsJs.ysyzJs.title'),
|
|
||||||
"url": this.$t('wxcsJs.ysyzJs.url'),
|
|
||||||
"icon": this.$t('wxcsJs.ysyzJs.icon')
|
|
||||||
})
|
|
||||||
gridList.push({
|
|
||||||
"type": this.$t('wxcsJs.rzJs.title'),
|
|
||||||
"url": this.$t('wxcsJs.rzJs.url'),
|
|
||||||
"icon": this.$t('wxcsJs.rzJs.icon')
|
|
||||||
})
|
|
||||||
gridList.push({
|
|
||||||
"type": this.$t('wxcsJs.qtJs.title'),
|
|
||||||
"url": this.$t('wxcsJs.qtJs.url'),
|
|
||||||
"icon": this.$t('wxcsJs.qtJs.icon')
|
|
||||||
})
|
|
||||||
this.wxcsJsgridList = gridList
|
|
||||||
|
|
||||||
gridList = []
|
|
||||||
|
|
||||||
gridList.push({
|
|
||||||
"type": this.$t('CNGJs.srjJs.title'),
|
|
||||||
"url": this.$t('CNGJs.srjJs.url'),
|
|
||||||
"icon": this.$t('CNGJs.srjJs.icon')
|
|
||||||
})
|
|
||||||
gridList.push({
|
|
||||||
"type": this.$t('CNGJs.zxcJs.title'),
|
|
||||||
"url": this.$t('CNGJs.zxcJs.url'),
|
|
||||||
"icon": this.$t('CNGJs.zxcJs.icon')
|
|
||||||
})
|
|
||||||
gridList.push({
|
|
||||||
"type": this.$t('CNGJs.LNGQhJs.title'),
|
|
||||||
"url": this.$t('CNGJs.LNGQhJs.url'),
|
|
||||||
"icon": this.$t('CNGJs.LNGQhJs.icon')
|
|
||||||
})
|
|
||||||
this.CNGJsgridList = gridList
|
|
||||||
gridList = []
|
|
||||||
|
|
||||||
gridList.push({
|
|
||||||
"type": this.$t('QtJs.ZBGJs.title'),
|
|
||||||
"url": this.$t('QtJs.ZBGJs.url'),
|
|
||||||
"icon": this.$t('QtJs.ZBGJs.icon')
|
|
||||||
})
|
|
||||||
gridList.push({
|
|
||||||
"type": this.$t('QtJs.srjBGJs.title'),
|
|
||||||
"url": this.$t('QtJs.srjBGJs.url'),
|
|
||||||
"icon": this.$t('QtJs.srjBGJs.icon')
|
|
||||||
})
|
|
||||||
// gridList.push({
|
|
||||||
// "type": this.$t('QtJs.SqgyJs.title'),
|
|
||||||
// "url": this.$t('QtJs.SqgyJs.url')
|
|
||||||
// })
|
|
||||||
this.QtJsgridList = gridList
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* banner加载后触发的回调
|
|
||||||
*/
|
|
||||||
onqueryload(data) {
|
|
||||||
// console.log(JSON.stringify(data))
|
|
||||||
},
|
|
||||||
changeSwiper(e) {
|
|
||||||
this.current = e.detail.current
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* 点击banner的处理
|
|
||||||
*/
|
|
||||||
clickBannerItem(item) {
|
|
||||||
// 有外部链接-跳转url
|
|
||||||
if (item.open_url) {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: '/uni_modules/uni-id-pages/pages/common/webview/webview?url=' + item.open_url +
|
|
||||||
'&title=' + item.title,
|
|
||||||
success: res => {},
|
|
||||||
fail: () => {},
|
|
||||||
complete: () => {}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// 其余业务处理
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss">
|
|
||||||
/* #ifndef APP-NVUE */
|
|
||||||
page {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
box-sizing: border-box;
|
|
||||||
background-color: #fff;
|
|
||||||
min-height: 100%;
|
|
||||||
height: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
view {
|
|
||||||
font-size: 14px;
|
|
||||||
line-height: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* #endif */
|
|
||||||
|
|
||||||
.section-box {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
align-items: left;
|
|
||||||
padding-left: calc(10vw /2);
|
|
||||||
padding-top: 10px;
|
|
||||||
padding-bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.decoration {
|
|
||||||
width: 4px;
|
|
||||||
height: 12px;
|
|
||||||
border-radius: 10px;
|
|
||||||
background-color: #2979ff;
|
|
||||||
// margin-left: 30rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.section-text {
|
|
||||||
color: blue;
|
|
||||||
margin-left: 10rpx;
|
|
||||||
font-size: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* #ifdef APP-NVUE */
|
|
||||||
.warp {
|
|
||||||
background-color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* #endif */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.Grid {
|
|
||||||
width: 90vw;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
justify-content: flex-start;
|
|
||||||
align-content: space-between;
|
|
||||||
padding-left: calc(10vw /2);
|
|
||||||
column-gap: calc(25% / 3);
|
|
||||||
row-gap: 5rpx;
|
|
||||||
box-sizing: content-box;
|
|
||||||
|
|
||||||
.Grid-Item {
|
|
||||||
width: 25%;
|
|
||||||
height: 150rpx;
|
|
||||||
text-align: center;
|
|
||||||
border: 0rpx solid #ccc;
|
|
||||||
box-sizing: content-box;
|
|
||||||
background: #ffffff;
|
|
||||||
background-image: "@/static/uni-center/headers.png";
|
|
||||||
|
|
||||||
.GSimg {
|
|
||||||
width: 100%;
|
|
||||||
height: 10rpx;
|
|
||||||
text-align: center;
|
|
||||||
|
|
||||||
.Image {
|
|
||||||
width: 100rpx;
|
|
||||||
height: 100rpx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.GStitle {
|
|
||||||
width: 100%;
|
|
||||||
height: 34rpx;
|
|
||||||
line-height: 34rpx;
|
|
||||||
color: orangered;
|
|
||||||
font-size: 26rpx;
|
|
||||||
padding-top: 15px;
|
|
||||||
margin-top: 80rpx;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.banner-image {
|
|
||||||
width: 750rpx;
|
|
||||||
height: 400rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.swiper-box {
|
|
||||||
height: 400rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.search-icons {
|
|
||||||
padding: 16rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.search-container-bar {
|
|
||||||
/* #ifndef APP-NVUE */
|
|
||||||
display: flex;
|
|
||||||
/* #endif */
|
|
||||||
flex-direction: row;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
position: fixed;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
z-index: 10;
|
|
||||||
background-color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* #ifndef APP-NVUE || VUE3*/
|
|
||||||
::v-deep
|
|
||||||
|
|
||||||
/* #endif */
|
|
||||||
.uni-searchbar__box {
|
|
||||||
border-width: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* #ifndef APP-NVUE || VUE3 */
|
|
||||||
::v-deep
|
|
||||||
|
|
||||||
/* #endif */
|
|
||||||
.uni-input-placeholder {
|
|
||||||
font-size: 28rpx;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -1,21 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view>
|
|
||||||
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
|
|
||||||
onLoad() {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: '/uni_modules/uni-id-pages/pages/login/login-withpwd'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
</style>
|
|
||||||
52
pages/index/index.vue
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
<template>
|
||||||
|
<view class="content">
|
||||||
|
<image class="logo" src="/static/logo.png"></image>
|
||||||
|
<view class="text-area">
|
||||||
|
<text class="title">{{title}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
title: 'Hello'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.content {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo {
|
||||||
|
height: 200rpx;
|
||||||
|
width: 200rpx;
|
||||||
|
margin-top: 200rpx;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
margin-bottom: 50rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-area {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
font-size: 36rpx;
|
||||||
|
color: #8f8f94;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
9
pages/info/info.vue
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<template>
|
||||||
|
<view class="warp">
|
||||||
|
<uni-nav-bar dark :fixed="true" shadow background-color="#007AFF" status-bar title="文档资料" />
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script></script>
|
||||||
|
|
||||||
|
<style></style>
|
||||||
@ -1,373 +0,0 @@
|
|||||||
<template>
|
|
||||||
<!--
|
|
||||||
本页面模板教程:https://ext.dcloud.net.cn/plugin?id=2717
|
|
||||||
uni-list 文档:https://ext.dcloud.net.cn/plugin?id=24
|
|
||||||
uniCloud 文档:https://uniapp.dcloud.io/uniCloud/README
|
|
||||||
unicloud-db 组件文档:https://uniapp.dcloud.net.cn/uniCloud/unicloud-db-component
|
|
||||||
DB Schema 规范:https://uniapp.dcloud.net.cn/uniCloud/schema
|
|
||||||
-->
|
|
||||||
<view class="article">
|
|
||||||
<!-- #ifdef APP-PLUS -->
|
|
||||||
<uni-nav-bar :statusBar="true" :border="false"></uni-nav-bar>
|
|
||||||
<!-- #endif -->
|
|
||||||
<view class="article-title">{{ title }}</view>
|
|
||||||
<unicloud-db v-slot:default="{data, loading, error, options}" :options="formData" collection="opendb-news-articles,uni-id-users"
|
|
||||||
:field="field" :getone="true" :where="where" :manual="true" ref="detail"
|
|
||||||
foreignKey="opendb-news-articles.user_id" @load="loadData">
|
|
||||||
<template v-if="!loading && data">
|
|
||||||
<uni-list :border="false">
|
|
||||||
<uni-list-item thumbSize="lg" :thumb="data.image">
|
|
||||||
<!-- 通过body插槽定义作者信息内容 -->
|
|
||||||
<template v-slot:body>
|
|
||||||
<view class="header-content">
|
|
||||||
<view class="uni-title">{{data.user_id && data.user_id[0] && data.user_id[0].nickname || '未知'}}</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
<template v-slot:footer>
|
|
||||||
<view class="footer">
|
|
||||||
<view class="uni-note">更新于
|
|
||||||
<uni-dateformat :date="data.last_modify_date" format="yyyy-MM-dd hh:mm"
|
|
||||||
:threshold="[60000, 2592000000]" />
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
</uni-list-item>
|
|
||||||
</uni-list>
|
|
||||||
<view class="banner">
|
|
||||||
<!-- 文章开头,缩略图 -->
|
|
||||||
<image class="banner-img" :src="data.avatar" mode="widthFix"></image>
|
|
||||||
<!-- 文章摘要 -->
|
|
||||||
<view class="banner-title">
|
|
||||||
<text class="uni-ellipsis">{{data.excerpt}}</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="article-content">
|
|
||||||
<rich-text :nodes="data.content"></rich-text>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
</unicloud-db>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
// #ifdef APP
|
|
||||||
import UniShare from '@/uni_modules/uni-share/js_sdk/uni-share.js';
|
|
||||||
import uniNavBar from '@/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-nav-bar.vue';
|
|
||||||
const uniShare = new UniShare()
|
|
||||||
// #endif
|
|
||||||
const db = uniCloud.database();
|
|
||||||
const readNewsLog = db.collection('read-news-log')
|
|
||||||
export default {
|
|
||||||
// #ifdef APP
|
|
||||||
components:{
|
|
||||||
"uni-nav-bar":uniNavBar
|
|
||||||
},
|
|
||||||
onBackPress({from}) {
|
|
||||||
if(from == 'backbutton'){
|
|
||||||
if(uniShare.isShow){
|
|
||||||
this.$nextTick(function(){
|
|
||||||
console.log(uniShare);
|
|
||||||
uniShare.hide()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return uniShare.isShow;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// #endif
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
// 当前显示 _id
|
|
||||||
id: "",
|
|
||||||
title: 'title',
|
|
||||||
// 数据表名
|
|
||||||
// 查询字段,多个字段用 , 分割
|
|
||||||
field: 'user_id.nickname,user_id._id,avatar,excerpt,last_modify_date,comment_count,like_count,title,content',
|
|
||||||
formData: {
|
|
||||||
noData: '<p style="text-align:center;color:#666">详情加载中...</p>'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
uniStarterConfig() {
|
|
||||||
return getApp().globalData.config
|
|
||||||
},
|
|
||||||
where(){
|
|
||||||
//拼接where条件 查询条件 ,更多详见 :https://uniapp.dcloud.net.cn/uniCloud/unicloud-db?id=jsquery
|
|
||||||
return `_id =="${this.id}"`
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onLoad(event) {
|
|
||||||
//获取真实新闻id,通常 id 来自上一个页面
|
|
||||||
if (event.id) {
|
|
||||||
this.id = event.id
|
|
||||||
}
|
|
||||||
//若上一页传递了标题过来,则设置导航栏标题
|
|
||||||
if (event.title) {
|
|
||||||
this.title = event.title
|
|
||||||
uni.setNavigationBarTitle({
|
|
||||||
title: event.title
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onReady() {
|
|
||||||
// 开始加载数据,修改 where 条件后才开始去加载 clinetDB 的数据 ,需要等组件渲染完毕后才开始执行 loadData,所以不能再 onLoad 中执行
|
|
||||||
if (this.id) { // ID 不为空,则发起查询
|
|
||||||
this.$refs.detail.loadData()
|
|
||||||
} else {
|
|
||||||
uni.showToast({
|
|
||||||
icon: 'none',
|
|
||||||
title: this.$t('listDetail.newsErr')
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onNavigationBarButtonTap(event) {
|
|
||||||
if (event.type == 'share') {
|
|
||||||
this.shareClick();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
$log(...args){
|
|
||||||
console.log('args',...args,this.id)
|
|
||||||
},
|
|
||||||
setReadNewsLog(){
|
|
||||||
let item = {
|
|
||||||
"article_id":this.id,
|
|
||||||
"last_time":Date.now()
|
|
||||||
},
|
|
||||||
readNewsLog = uni.getStorageSync('readNewsLog')||[],
|
|
||||||
index = -1;
|
|
||||||
readNewsLog.forEach(({article_id},i)=>{
|
|
||||||
if(article_id == item.article_id){
|
|
||||||
index = i
|
|
||||||
}
|
|
||||||
})
|
|
||||||
if(index === -1){
|
|
||||||
readNewsLog.push(item)
|
|
||||||
}else{
|
|
||||||
readNewsLog.splice(index,1,item)
|
|
||||||
}
|
|
||||||
uni.setStorageSync('readNewsLog',readNewsLog)
|
|
||||||
console.log(readNewsLog);
|
|
||||||
},
|
|
||||||
setFavorite() {
|
|
||||||
if ( uniCloud.getCurrentUserInfo().tokenExpired < Date.now() ){
|
|
||||||
return console.log('未登录用户');
|
|
||||||
}
|
|
||||||
let article_id = this.id,
|
|
||||||
last_time = Date.now();
|
|
||||||
console.log({article_id,last_time});
|
|
||||||
readNewsLog.where(`"article_id" == "${article_id}" && "user_id"==$env.uid`)
|
|
||||||
.update({last_time})
|
|
||||||
.then(({result:{updated}}) => {
|
|
||||||
console.log('updated',updated);
|
|
||||||
if (!updated) {
|
|
||||||
readNewsLog.add({article_id}).then(e=>{
|
|
||||||
console.log(e);
|
|
||||||
}).catch(err => {
|
|
||||||
console.log(err);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}).catch(err => {
|
|
||||||
console.log(err);
|
|
||||||
})
|
|
||||||
},
|
|
||||||
loadData(data) {
|
|
||||||
//如果上一页未传递标题过来(如搜索直达详情),则从新闻详情中读取标题
|
|
||||||
if (this.title == '' && data[0].title) {
|
|
||||||
this.title = data[0].title
|
|
||||||
uni.setNavigationBarTitle({
|
|
||||||
title: data[0].title
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
this.setReadNewsLog();
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* followClick
|
|
||||||
* 点击关注
|
|
||||||
*/
|
|
||||||
followClick() {
|
|
||||||
uni.showToast({
|
|
||||||
title:this.$t('listDetail.follow'),
|
|
||||||
icon: 'none'
|
|
||||||
});
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* 分享该文章
|
|
||||||
*/
|
|
||||||
// #ifdef APP
|
|
||||||
shareClick() {
|
|
||||||
let {
|
|
||||||
_id,
|
|
||||||
title,
|
|
||||||
excerpt,
|
|
||||||
avatar
|
|
||||||
} = this.$refs.detail.dataList
|
|
||||||
console.log( JSON.stringify({
|
|
||||||
_id,
|
|
||||||
title,
|
|
||||||
excerpt,
|
|
||||||
avatar
|
|
||||||
}) );
|
|
||||||
uniShare.show({
|
|
||||||
content: { //公共的分享类型(type)、链接(herf)、标题(title)、summary(描述)、imageUrl(缩略图)
|
|
||||||
type: 0,
|
|
||||||
href: this.uniStarterConfig.h5.url + `/#/pages/list/detail?id=${_id}&title=${title}`,
|
|
||||||
title: this.title,
|
|
||||||
summary: excerpt,
|
|
||||||
imageUrl: avatar + '?x-oss-process=image/resize,m_fill,h_100,w_100' //压缩图片解决,在ios端分享图过大导致的图片失效问题
|
|
||||||
},
|
|
||||||
menus: [{
|
|
||||||
"img": "/static/app-plus/sharemenu/wechatfriend.png",
|
|
||||||
"text": this.$t('common.wechatFriends'),
|
|
||||||
"share": {
|
|
||||||
"provider": "weixin",
|
|
||||||
"scene": "WXSceneSession"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"img": "/static/app-plus/sharemenu/wechatmoments.png",
|
|
||||||
"text": this.$t('common.wechatBbs'),
|
|
||||||
"share": {
|
|
||||||
"provider": "weixin",
|
|
||||||
"scene": "WXSceneTimeline"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"img": "/static/app-plus/sharemenu/mp_weixin.png",
|
|
||||||
"text": this.$t('common.wechatApplet'),
|
|
||||||
"share": {
|
|
||||||
provider: "weixin",
|
|
||||||
scene: "WXSceneSession",
|
|
||||||
type: 5,
|
|
||||||
miniProgram: {
|
|
||||||
id: this.uniStarterConfig.mp.weixin.id,
|
|
||||||
path: `/pages/list/detail?id=${_id}&title=${title}`,
|
|
||||||
webUrl: this.uniStarterConfig.h5.url +
|
|
||||||
`/#/pages/list/detail?id=${_id}&title=${title}`,
|
|
||||||
type: 0
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"img": "/static/app-plus/sharemenu/weibo.png",
|
|
||||||
"text": this.$t('common.weibo'),
|
|
||||||
"share": {
|
|
||||||
"provider": "sinaweibo"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"img": "/static/app-plus/sharemenu/qq.png",
|
|
||||||
"text": "QQ",
|
|
||||||
"share": {
|
|
||||||
"provider": "qq"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"img": "/static/app-plus/sharemenu/copyurl.png",
|
|
||||||
"text": this.$t('common.copy'),
|
|
||||||
"share": "copyurl"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"img": "/static/app-plus/sharemenu/more.png",
|
|
||||||
"text": this.$t('common.more'),
|
|
||||||
"share": "shareSystem"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
cancelText: this.$t('common.cancelShare'),
|
|
||||||
}, e => { //callback
|
|
||||||
console.log(e);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
// #endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.header-content {
|
|
||||||
flex: 1;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 标题 */
|
|
||||||
.uni-title {
|
|
||||||
display: flex;
|
|
||||||
margin-bottom: 5px;
|
|
||||||
font-size: 14px;
|
|
||||||
font-weight: bold;
|
|
||||||
color: #3b4144;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 描述 额外文本 */
|
|
||||||
.uni-note {
|
|
||||||
color: #999;
|
|
||||||
font-size: 12px;
|
|
||||||
|
|
||||||
/* #ifndef APP-NVUE */
|
|
||||||
display: flex;
|
|
||||||
/* #endif */
|
|
||||||
flex-direction: row;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.footer {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.footer-button {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
font-size: 12px;
|
|
||||||
height: 30px;
|
|
||||||
color: #fff;
|
|
||||||
background-color: #ff5a5f;
|
|
||||||
}
|
|
||||||
|
|
||||||
.banner {
|
|
||||||
position: relative;
|
|
||||||
margin: 0 15px;
|
|
||||||
height: 180px;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.banner-img {
|
|
||||||
position: absolute;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.banner-title {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
position: absolute;
|
|
||||||
padding: 0 15px;
|
|
||||||
width: 100%;
|
|
||||||
bottom: 0;
|
|
||||||
height: 30px;
|
|
||||||
font-size: 14px;
|
|
||||||
color: #fff;
|
|
||||||
background: rgba(0, 0, 0, 0.4);
|
|
||||||
overflow: hidden;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.uni-ellipsis {
|
|
||||||
overflow: hidden;
|
|
||||||
white-space: nowrap;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
|
||||||
|
|
||||||
.article-title {
|
|
||||||
padding: 20px 15px;
|
|
||||||
padding-bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.article-content {
|
|
||||||
padding: 15px;
|
|
||||||
font-size: 15px;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -1,206 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view class="pages">
|
|
||||||
<!-- #ifndef H5 -->
|
|
||||||
<statusBar></statusBar>
|
|
||||||
<!-- #endif -->
|
|
||||||
<info-list></info-list>
|
|
||||||
|
|
||||||
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
let cdbRef;
|
|
||||||
|
|
||||||
import infoList from '@/pagesPackage/ngtools_information/list.vue'
|
|
||||||
|
|
||||||
import statusBar from "@/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-status-bar";
|
|
||||||
|
|
||||||
import Gps from '@/uni_modules/json-gps/js_sdk/gps.js';
|
|
||||||
const gps = new Gps(),
|
|
||||||
db = uniCloud.database();
|
|
||||||
|
|
||||||
export default {
|
|
||||||
components: {
|
|
||||||
statusBar,
|
|
||||||
infoList
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
inputPlaceholder(e) {
|
|
||||||
if (uni.getStorageSync('CURRENT_LANG') == "en") {
|
|
||||||
return 'Please enter the search content'
|
|
||||||
} else {
|
|
||||||
return '请输入搜索内容'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
colList() {
|
|
||||||
return [
|
|
||||||
db.collection('opendb-news-articles').where(this.where).field(
|
|
||||||
'avatar,title,last_modify_date,user_id').getTemp(),
|
|
||||||
db.collection('uni-id-users').field('_id,nickname').getTemp()
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
where: '"article_status" == 1',
|
|
||||||
keyword: "",
|
|
||||||
showRefresh: false,
|
|
||||||
listHight: 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
keyword(keyword, oldValue) {
|
|
||||||
let where = '"article_status" == 1 '
|
|
||||||
if (keyword) {
|
|
||||||
this.where = where + `&& /${keyword}/.test(title)`;
|
|
||||||
} else {
|
|
||||||
this.where = where;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
async onReady() {
|
|
||||||
// #ifdef APP-NVUE
|
|
||||||
/* 可用窗口高度 - 搜索框高 - 状态栏高 */
|
|
||||||
this.listHight = uni.getSystemInfoSync().windowHeight - uni.getSystemInfoSync().statusBarHeight - 50 +
|
|
||||||
'px';
|
|
||||||
// #endif
|
|
||||||
// #ifndef APP-NVUE
|
|
||||||
this.listHight = 'auto'
|
|
||||||
// #endif
|
|
||||||
cdbRef = this.$refs.udb
|
|
||||||
},
|
|
||||||
async onShow() {
|
|
||||||
this.keyword = getApp().globalData.searchText
|
|
||||||
getApp().globalData.searchText = ''
|
|
||||||
//这里仅演示如何,在onShow生命周期获取设备位置,并在设备或者应用没有权限时自动引导。设置完毕自动重新获取。
|
|
||||||
//你可以基于他做自己的业务,比如:根据距离由近到远排序列表数据等
|
|
||||||
// uni.showLoading({
|
|
||||||
// title:"获取定位中"
|
|
||||||
// });
|
|
||||||
//默认h5端不获取定位
|
|
||||||
// #ifndef H5
|
|
||||||
let location = await gps.getLocation({
|
|
||||||
geocode: true
|
|
||||||
})
|
|
||||||
// console.log(location);
|
|
||||||
// #endif
|
|
||||||
// if(location){
|
|
||||||
// uni.showToast({
|
|
||||||
// title: JSON.stringify(location),
|
|
||||||
// icon: 'none'
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// uni.hideLoading()
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
searchClick(e) { //点击搜索框
|
|
||||||
uni.hideKeyboard();
|
|
||||||
uni.navigateTo({
|
|
||||||
url: '/pages/list/search/search',
|
|
||||||
animationType: 'fade-in'
|
|
||||||
});
|
|
||||||
},
|
|
||||||
retry() {
|
|
||||||
this.refresh()
|
|
||||||
},
|
|
||||||
refresh() {
|
|
||||||
cdbRef.loadData({
|
|
||||||
clear: true
|
|
||||||
}, () => {
|
|
||||||
uni.stopPullDownRefresh()
|
|
||||||
// #ifdef APP-NVUE
|
|
||||||
this.showRefresh = false
|
|
||||||
// #endif
|
|
||||||
console.log('end');
|
|
||||||
})
|
|
||||||
console.log('refresh');
|
|
||||||
},
|
|
||||||
loadMore() {
|
|
||||||
cdbRef.loadMore()
|
|
||||||
},
|
|
||||||
onqueryerror(e) {
|
|
||||||
console.error(e);
|
|
||||||
},
|
|
||||||
onpullingdown(e) {
|
|
||||||
console.log(e);
|
|
||||||
this.showRefresh = true
|
|
||||||
if (e.pullingDistance > 100) {
|
|
||||||
this.refresh()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// #ifndef APP-NVUE
|
|
||||||
onPullDownRefresh() {
|
|
||||||
this.refresh()
|
|
||||||
},
|
|
||||||
onReachBottom() {
|
|
||||||
this.loadMore()
|
|
||||||
}
|
|
||||||
// #endif
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
/* #ifndef APP-NVUE */
|
|
||||||
view {
|
|
||||||
display: flex;
|
|
||||||
box-sizing: border-box;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* #endif */
|
|
||||||
.pages {
|
|
||||||
background-color: #FFFFFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
.avatar {
|
|
||||||
width: 200rpx;
|
|
||||||
height: 200rpx;
|
|
||||||
margin-right: 10rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.main {
|
|
||||||
justify-content: space-between;
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.title {
|
|
||||||
font-size: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info {
|
|
||||||
flex-direction: row;
|
|
||||||
justify-content: space-between;
|
|
||||||
}
|
|
||||||
|
|
||||||
.author,
|
|
||||||
.last_modify_date {
|
|
||||||
font-size: 14px;
|
|
||||||
color: #999999;
|
|
||||||
}
|
|
||||||
|
|
||||||
.uni-search-box {
|
|
||||||
background-color: #FFFFFF;
|
|
||||||
position: sticky;
|
|
||||||
height: 50px;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
/* #ifndef APP-PLUS */
|
|
||||||
z-index: 9;
|
|
||||||
/* #endif */
|
|
||||||
/* #ifdef MP-WEIXIN */
|
|
||||||
width: 580rpx;
|
|
||||||
/* #endif */
|
|
||||||
}
|
|
||||||
|
|
||||||
.cover-search-bar {
|
|
||||||
height: 50px;
|
|
||||||
position: relative;
|
|
||||||
top: -50px;
|
|
||||||
margin-bottom: -50px;
|
|
||||||
/* #ifndef APP-NVUE */
|
|
||||||
z-index: 999;
|
|
||||||
/* #endif */
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -1,505 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view class="center">
|
|
||||||
<uni-sign-in ref="signIn"></uni-sign-in>
|
|
||||||
<view class="userInfo" @click.capture="toUserInfo">
|
|
||||||
<cloud-image width="150rpx" height="150rpx" v-if="hasLogin&&userInfo.avatar_file&&userInfo.avatar_file.url"
|
|
||||||
:src="userInfo.avatar_file.url"></cloud-image>
|
|
||||||
|
|
||||||
<view v-else class="defaultAvatarUrl">
|
|
||||||
<uni-icons color="#ffffff" size="50" type="person-filled" />
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="logo-title">
|
|
||||||
|
|
||||||
<text class="uer-name" v-if="hasLogin">{{userInfo.nickname||userInfo.username||userInfo.mobile}}</text>
|
|
||||||
<text class="uer-name" v-else>{{$t('mine.notLogged')}}</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'}">
|
|
||||||
<template v-slot:footer>
|
|
||||||
<view v-if="item.showBadge" class="item-footer">
|
|
||||||
<text class="item-footer-text">{{item.rightText}}</text>
|
|
||||||
<view class="item-footer-badge"></view>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
</uni-list-item>
|
|
||||||
</uni-list>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
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';
|
|
||||||
// #ifdef APP
|
|
||||||
import UniShare from '@/uni_modules/uni-share/js_sdk/uni-share.js';
|
|
||||||
const uniShare = new UniShare()
|
|
||||||
// #endif
|
|
||||||
const db = uniCloud.database();
|
|
||||||
import {
|
|
||||||
store,
|
|
||||||
mutations
|
|
||||||
} from '@/uni_modules/uni-id-pages/common/store.js'
|
|
||||||
export default {
|
|
||||||
// #ifdef APP
|
|
||||||
onBackPress({
|
|
||||||
from
|
|
||||||
}) {
|
|
||||||
if (from == 'backbutton') {
|
|
||||||
this.$nextTick(function() {
|
|
||||||
uniShare.hide()
|
|
||||||
})
|
|
||||||
return uniShare.isShow;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// #endif
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
gridList: [{
|
|
||||||
"text": this.$t('mine.dict'),
|
|
||||||
"icon": "chat"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": this.$t('mine.showText'),
|
|
||||||
"icon": "cloud-upload"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": this.$t('mine.showText'),
|
|
||||||
"icon": "contact"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": this.$t('mine.showText'),
|
|
||||||
"icon": "download"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
ucenterList: [
|
|
||||||
[
|
|
||||||
|
|
||||||
{
|
|
||||||
"title": this.$t('mine.dict'),
|
|
||||||
"event": 'dictSetting',
|
|
||||||
"icon": "compose"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"title": this.$t('mine.depart'),
|
|
||||||
"event": 'departSetting',
|
|
||||||
"icon": "compose"
|
|
||||||
},
|
|
||||||
|
|
||||||
// {
|
|
||||||
// "title": this.$t('mine.myPay'),
|
|
||||||
// "event": 'myPaySetting',
|
|
||||||
// "icon": "compose"
|
|
||||||
// },
|
|
||||||
|
|
||||||
|
|
||||||
// // #ifdef APP-PLUS
|
|
||||||
// {
|
|
||||||
// "title": this.$t('mine.toEvaluate'),
|
|
||||||
// "event": 'gotoMarket',
|
|
||||||
// "icon": "star"
|
|
||||||
// },
|
|
||||||
// //#endif
|
|
||||||
// {
|
|
||||||
// "title":this.$t('mine.readArticles'),
|
|
||||||
// "to": '/pages/ucenter/read-news-log/read-news-log',
|
|
||||||
// "icon": "flag"
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// "title": this.$t('mine.myScore'),
|
|
||||||
// "to": '',
|
|
||||||
// "event": 'getScore',
|
|
||||||
// "icon": "paperplane"
|
|
||||||
// }
|
|
||||||
// // #ifdef APP-PLUS
|
|
||||||
// , {
|
|
||||||
// "title": this.$t('mine.invite'),
|
|
||||||
// "event": 'share',
|
|
||||||
// "icon": "redo"
|
|
||||||
// }
|
|
||||||
// // #endif
|
|
||||||
],
|
|
||||||
[
|
|
||||||
// {
|
|
||||||
// "title": this.$t('mine.feedback'),
|
|
||||||
// "to": '/uni_modules/uni-feedback/pages/opendb-feedback/opendb-feedback',
|
|
||||||
// "icon": "help"
|
|
||||||
// },
|
|
||||||
{
|
|
||||||
"title": this.$t('mine.settings'),
|
|
||||||
"to": '/pagesPackage/ucenter/settings/settings',
|
|
||||||
"icon": "gear"
|
|
||||||
}],
|
|
||||||
// #ifdef APP-PLUS
|
|
||||||
[{
|
|
||||||
"title": this.$t('mine.about'),
|
|
||||||
"to": '/pagesPackage/ucenter/about/about',
|
|
||||||
"icon": "info"
|
|
||||||
}]
|
|
||||||
// #endif
|
|
||||||
],
|
|
||||||
listStyles: {
|
|
||||||
"height": "150rpx", // 边框高度
|
|
||||||
"width": "150rpx", // 边框宽度
|
|
||||||
"border": { // 如果为 Boolean 值,可以控制边框显示与否
|
|
||||||
"color": "#eee", // 边框颜色
|
|
||||||
"width": "1px", // 边框宽度
|
|
||||||
"style": "solid", // 边框样式
|
|
||||||
"radius": "100%" // 边框圆角,支持百分比
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onLoad() {
|
|
||||||
//#ifdef APP-PLUS
|
|
||||||
this.ucenterList[this.ucenterList.length - 2].unshift({
|
|
||||||
title: this.$t('mine.checkUpdate'), // this.this.$t('mine.checkUpdate')"检查更新"
|
|
||||||
rightText: this.appVersion.version + '-' + this.appVersion.versionCode,
|
|
||||||
event: 'checkVersion',
|
|
||||||
icon: 'loop',
|
|
||||||
showBadge: this.appVersion.hasNew
|
|
||||||
})
|
|
||||||
//#endif
|
|
||||||
},
|
|
||||||
onShow() {},
|
|
||||||
computed: {
|
|
||||||
userInfo() {
|
|
||||||
return store.userInfo
|
|
||||||
},
|
|
||||||
hasLogin() {
|
|
||||||
return store.hasLogin
|
|
||||||
},
|
|
||||||
// #ifdef APP-PLUS
|
|
||||||
appVersion() {
|
|
||||||
return getApp().appVersion
|
|
||||||
},
|
|
||||||
// #endif
|
|
||||||
appConfig() {
|
|
||||||
return getApp().globalData.config
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
toSettings() {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: "/pages/ucenter/settings/settings"
|
|
||||||
})
|
|
||||||
},
|
|
||||||
signIn() { //普通签到
|
|
||||||
this.$refs.signIn.open()
|
|
||||||
},
|
|
||||||
dictSetting() { //数据字典设置
|
|
||||||
|
|
||||||
uni.navigateTo({
|
|
||||||
url: "/pagesPackage/ngTools_Dict/list"
|
|
||||||
})
|
|
||||||
|
|
||||||
},
|
|
||||||
departSetting() { //组织机构设置
|
|
||||||
|
|
||||||
uni.navigateTo({
|
|
||||||
url: "/pagesPackage/ngTools_depart/list"
|
|
||||||
})
|
|
||||||
|
|
||||||
},
|
|
||||||
myPaySetting() { //购买打赏
|
|
||||||
|
|
||||||
uni.navigateTo({
|
|
||||||
url: "/pagesPackage/ucenter/pay/index"
|
|
||||||
})
|
|
||||||
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* 个人中心项目列表点击事件
|
|
||||||
*/
|
|
||||||
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: '/uni_modules/uni-id-pages/pages/userinfo/userinfo'
|
|
||||||
})
|
|
||||||
},
|
|
||||||
tapGrid(index) {
|
|
||||||
uni.showToast({
|
|
||||||
// title: '你点击了,第' + (index + 1) + '个',
|
|
||||||
title: this.$t('mine.clicked') + " " + (index + 1),
|
|
||||||
icon: 'none'
|
|
||||||
});
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* 去应用市场评分
|
|
||||||
*/
|
|
||||||
gotoMarket() {
|
|
||||||
// #ifdef APP-PLUS
|
|
||||||
if (uni.getSystemInfoSync().platform == "ios") {
|
|
||||||
// 这里填写appstore应用id
|
|
||||||
let appstoreid = this.appConfig.marketId.ios; // 'id1417078253';
|
|
||||||
console.log({
|
|
||||||
appstoreid
|
|
||||||
});
|
|
||||||
plus.runtime.openURL("itms-apps://" + 'itunes.apple.com/cn/app/wechat/' + appstoreid + '?mt=8',
|
|
||||||
err => {
|
|
||||||
console.log('plus.runtime.openURL err:' + JSON.stringify(err));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
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: this.$t('mine.checkScore'),
|
|
||||||
icon: 'none'
|
|
||||||
});
|
|
||||||
uni.showLoading({
|
|
||||||
mask: true
|
|
||||||
})
|
|
||||||
db.collection("uni-id-scores")
|
|
||||||
.where('"user_id" == $env.uid')
|
|
||||||
.field('score,balance')
|
|
||||||
.orderBy("create_date", "desc")
|
|
||||||
.limit(1)
|
|
||||||
.get()
|
|
||||||
.then((res) => {
|
|
||||||
console.log(res);
|
|
||||||
const data = res.result.data[0];
|
|
||||||
let msg = '';
|
|
||||||
msg = data ? (this.$t('mine.currentScore') + data.balance) : this.$t('mine.noScore');
|
|
||||||
uni.showToast({
|
|
||||||
title: msg,
|
|
||||||
icon: 'none'
|
|
||||||
});
|
|
||||||
}).finally(() => {
|
|
||||||
uni.hideLoading()
|
|
||||||
})
|
|
||||||
},
|
|
||||||
async share() {
|
|
||||||
let {
|
|
||||||
result
|
|
||||||
} = await db.collection('uni-id-users').where("'_id' == $cloudEnv_uid").field('my_invite_code').get()
|
|
||||||
let myInviteCode = result.data[0].my_invite_code
|
|
||||||
if (!myInviteCode) {
|
|
||||||
return uni.showToast({
|
|
||||||
title: '请检查uni-config-center中uni-id配置,是否已启用 autoSetInviteCode',
|
|
||||||
icon: 'none'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
console.log({
|
|
||||||
myInviteCode
|
|
||||||
});
|
|
||||||
let {
|
|
||||||
appName,
|
|
||||||
logo,
|
|
||||||
company,
|
|
||||||
slogan
|
|
||||||
} = this.appConfig.about
|
|
||||||
// #ifdef APP-PLUS
|
|
||||||
uniShare.show({
|
|
||||||
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": this.$t('common.wechatFriends'),
|
|
||||||
"share": {
|
|
||||||
"provider": "weixin",
|
|
||||||
"scene": "WXSceneSession"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"img": "/static/app-plus/sharemenu/wechatmoments.png",
|
|
||||||
"text": this.$t('common.wechatBbs'),
|
|
||||||
"share": {
|
|
||||||
"provider": "weixin",
|
|
||||||
"scene": "WXSceneTimeline"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"img": "/static/app-plus/sharemenu/weibo.png",
|
|
||||||
"text": this.$t('common.weibo'),
|
|
||||||
"share": {
|
|
||||||
"provider": "sinaweibo"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"img": "/static/app-plus/sharemenu/qq.png",
|
|
||||||
"text": "QQ",
|
|
||||||
"share": {
|
|
||||||
"provider": "qq"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"img": "/static/app-plus/sharemenu/copyurl.png",
|
|
||||||
"text": this.$t('common.copy'),
|
|
||||||
"share": "copyurl"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"img": "/static/app-plus/sharemenu/more.png",
|
|
||||||
"text": this.$t('common.more'),
|
|
||||||
"share": "shareSystem"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
cancelText: this.$t('common.cancelShare'),
|
|
||||||
}, 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;
|
|
||||||
background-color: #f8f8f8;
|
|
||||||
}
|
|
||||||
|
|
||||||
.userInfo {
|
|
||||||
// padding: 20rpx;
|
|
||||||
padding-top: 60px;
|
|
||||||
background-image: url(http://h5.ngtools.cn/pic/static/uni-center/headers.png);
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.defaultAvatarUrl {
|
|
||||||
width: 150rpx;
|
|
||||||
height: 150rpx;
|
|
||||||
background-color: #007aff;
|
|
||||||
border-radius: 100%;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.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: blue;
|
|
||||||
}
|
|
||||||
|
|
||||||
.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: 16px;
|
|
||||||
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 */
|
|
||||||
.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 APP-NVUE */
|
|
||||||
border-radius: 10rpx;
|
|
||||||
/* #endif */
|
|
||||||
background-color: #DD524D;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
508
pages/ucenter/ucenter.vue
Normal file
@ -0,0 +1,508 @@
|
|||||||
|
<template>
|
||||||
|
<view class="center">
|
||||||
|
<uni-sign-in ref="signIn"></uni-sign-in>
|
||||||
|
<view class="userInfo" @click.capture="toUserInfo">
|
||||||
|
<cloud-image width="150rpx" height="150rpx" v-if="hasLogin && userInfo.avatar_file && userInfo.avatar_file.url" :src="userInfo.avatar_file.url"></cloud-image>
|
||||||
|
|
||||||
|
<view v-else class="defaultAvatarUrl">
|
||||||
|
<uni-icons color="#ffffff" size="50" type="person-filled" />
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="logo-title">
|
||||||
|
<text class="uer-name" v-if="hasLogin">{{ userInfo.nickname || userInfo.username || userInfo.mobile }}</text>
|
||||||
|
<text class="uer-name" v-else>{{ $t('mine.notLogged') }}</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' }"
|
||||||
|
>
|
||||||
|
<template v-slot:footer>
|
||||||
|
<view v-if="item.showBadge" class="item-footer">
|
||||||
|
<text class="item-footer-text">{{ item.rightText }}</text>
|
||||||
|
<view class="item-footer-badge"></view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</uni-list-item>
|
||||||
|
</uni-list>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
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';
|
||||||
|
// #ifdef APP
|
||||||
|
import UniShare from '@/uni_modules/uni-share/js_sdk/uni-share.js';
|
||||||
|
const uniShare = new UniShare();
|
||||||
|
// #endif
|
||||||
|
const db = uniCloud.database();
|
||||||
|
import { store, mutations } from '@/uni_modules/uni-id-pages/common/store.js';
|
||||||
|
export default {
|
||||||
|
// #ifdef APP
|
||||||
|
onBackPress({ from }) {
|
||||||
|
if (from == 'backbutton') {
|
||||||
|
this.$nextTick(function () {
|
||||||
|
uniShare.hide();
|
||||||
|
});
|
||||||
|
return uniShare.isShow;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// #endif
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
gridList: [
|
||||||
|
{
|
||||||
|
text: this.$t('mine.dict'),
|
||||||
|
icon: 'chat'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: this.$t('mine.showText'),
|
||||||
|
icon: 'cloud-upload'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: this.$t('mine.showText'),
|
||||||
|
icon: 'contact'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: this.$t('mine.showText'),
|
||||||
|
icon: 'download'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
ucenterList: [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
title: this.$t('mine.dict'),
|
||||||
|
event: 'dictSetting',
|
||||||
|
icon: 'compose'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: this.$t('mine.depart'),
|
||||||
|
event: 'departSetting',
|
||||||
|
icon: 'compose'
|
||||||
|
}
|
||||||
|
|
||||||
|
// {
|
||||||
|
// "title": this.$t('mine.myPay'),
|
||||||
|
// "event": 'myPaySetting',
|
||||||
|
// "icon": "compose"
|
||||||
|
// },
|
||||||
|
|
||||||
|
// // #ifdef APP-PLUS
|
||||||
|
// {
|
||||||
|
// "title": this.$t('mine.toEvaluate'),
|
||||||
|
// "event": 'gotoMarket',
|
||||||
|
// "icon": "star"
|
||||||
|
// },
|
||||||
|
// //#endif
|
||||||
|
// {
|
||||||
|
// "title":this.$t('mine.readArticles'),
|
||||||
|
// "to": '/pages/ucenter/read-news-log/read-news-log',
|
||||||
|
// "icon": "flag"
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// "title": this.$t('mine.myScore'),
|
||||||
|
// "to": '',
|
||||||
|
// "event": 'getScore',
|
||||||
|
// "icon": "paperplane"
|
||||||
|
// }
|
||||||
|
// // #ifdef APP-PLUS
|
||||||
|
// , {
|
||||||
|
// "title": this.$t('mine.invite'),
|
||||||
|
// "event": 'share',
|
||||||
|
// "icon": "redo"
|
||||||
|
// }
|
||||||
|
// // #endif
|
||||||
|
],
|
||||||
|
[
|
||||||
|
// {
|
||||||
|
// "title": this.$t('mine.feedback'),
|
||||||
|
// "to": '/uni_modules/uni-feedback/pages/opendb-feedback/opendb-feedback',
|
||||||
|
// "icon": "help"
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
title: this.$t('mine.settings'),
|
||||||
|
to: '/pagesPackage/ucenter/settings/settings',
|
||||||
|
icon: 'gear'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
[
|
||||||
|
{
|
||||||
|
title: this.$t('mine.about'),
|
||||||
|
to: '/pagesPackage/ucenter/about/about',
|
||||||
|
icon: 'info'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
// #endif
|
||||||
|
],
|
||||||
|
listStyles: {
|
||||||
|
height: '150rpx', // 边框高度
|
||||||
|
width: '150rpx', // 边框宽度
|
||||||
|
border: {
|
||||||
|
// 如果为 Boolean 值,可以控制边框显示与否
|
||||||
|
color: '#eee', // 边框颜色
|
||||||
|
width: '1px', // 边框宽度
|
||||||
|
style: 'solid', // 边框样式
|
||||||
|
radius: '100%' // 边框圆角,支持百分比
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
//#ifdef APP-PLUS
|
||||||
|
this.ucenterList[this.ucenterList.length - 2].unshift({
|
||||||
|
title: this.$t('mine.checkUpdate'), // this.this.$t('mine.checkUpdate')"检查更新"
|
||||||
|
rightText: this.appVersion.version + '-' + this.appVersion.versionCode,
|
||||||
|
event: 'checkVersion',
|
||||||
|
icon: 'loop',
|
||||||
|
showBadge: this.appVersion.hasNew
|
||||||
|
});
|
||||||
|
//#endif
|
||||||
|
},
|
||||||
|
onShow() {},
|
||||||
|
computed: {
|
||||||
|
userInfo() {
|
||||||
|
return store.userInfo;
|
||||||
|
},
|
||||||
|
hasLogin() {
|
||||||
|
return store.hasLogin;
|
||||||
|
},
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
appVersion() {
|
||||||
|
return getApp().appVersion;
|
||||||
|
},
|
||||||
|
// #endif
|
||||||
|
appConfig() {
|
||||||
|
return getApp().globalData.config;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
toSettings() {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/ucenter/settings/settings'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
signIn() {
|
||||||
|
//普通签到
|
||||||
|
this.$refs.signIn.open();
|
||||||
|
},
|
||||||
|
dictSetting() {
|
||||||
|
//数据字典设置
|
||||||
|
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pagesPackage/ngTools_Dict/list'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
departSetting() {
|
||||||
|
//组织机构设置
|
||||||
|
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pagesPackage/ngTools_depart/list'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
myPaySetting() {
|
||||||
|
//购买打赏
|
||||||
|
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pagesPackage/ucenter/pay/index'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 个人中心项目列表点击事件
|
||||||
|
*/
|
||||||
|
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: '/uni_modules/uni-id-pages/pages/userinfo/userinfo'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
tapGrid(index) {
|
||||||
|
uni.showToast({
|
||||||
|
// title: '你点击了,第' + (index + 1) + '个',
|
||||||
|
title: this.$t('mine.clicked') + ' ' + (index + 1),
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 去应用市场评分
|
||||||
|
*/
|
||||||
|
gotoMarket() {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
if (uni.getSystemInfoSync().platform == 'ios') {
|
||||||
|
// 这里填写appstore应用id
|
||||||
|
let appstoreid = this.appConfig.marketId.ios; // 'id1417078253';
|
||||||
|
console.log({
|
||||||
|
appstoreid
|
||||||
|
});
|
||||||
|
plus.runtime.openURL('itms-apps://' + 'itunes.apple.com/cn/app/wechat/' + appstoreid + '?mt=8', (err) => {
|
||||||
|
console.log('plus.runtime.openURL err:' + JSON.stringify(err));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
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: this.$t('mine.checkScore'),
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
uni.showLoading({
|
||||||
|
mask: true
|
||||||
|
});
|
||||||
|
db.collection('uni-id-scores')
|
||||||
|
.where('"user_id" == $env.uid')
|
||||||
|
.field('score,balance')
|
||||||
|
.orderBy('create_date', 'desc')
|
||||||
|
.limit(1)
|
||||||
|
.get()
|
||||||
|
.then((res) => {
|
||||||
|
console.log(res);
|
||||||
|
const data = res.result.data[0];
|
||||||
|
let msg = '';
|
||||||
|
msg = data ? this.$t('mine.currentScore') + data.balance : this.$t('mine.noScore');
|
||||||
|
uni.showToast({
|
||||||
|
title: msg,
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
uni.hideLoading();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
async share() {
|
||||||
|
let { result } = await db.collection('uni-id-users').where("'_id' == $cloudEnv_uid").field('my_invite_code').get();
|
||||||
|
let myInviteCode = result.data[0].my_invite_code;
|
||||||
|
if (!myInviteCode) {
|
||||||
|
return uni.showToast({
|
||||||
|
title: '请检查uni-config-center中uni-id配置,是否已启用 autoSetInviteCode',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
console.log({
|
||||||
|
myInviteCode
|
||||||
|
});
|
||||||
|
let { appName, logo, company, slogan } = this.appConfig.about;
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
uniShare.show(
|
||||||
|
{
|
||||||
|
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: this.$t('common.wechatFriends'),
|
||||||
|
share: {
|
||||||
|
provider: 'weixin',
|
||||||
|
scene: 'WXSceneSession'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
img: '/static/app-plus/sharemenu/wechatmoments.png',
|
||||||
|
text: this.$t('common.wechatBbs'),
|
||||||
|
share: {
|
||||||
|
provider: 'weixin',
|
||||||
|
scene: 'WXSceneTimeline'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
img: '/static/app-plus/sharemenu/weibo.png',
|
||||||
|
text: this.$t('common.weibo'),
|
||||||
|
share: {
|
||||||
|
provider: 'sinaweibo'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
img: '/static/app-plus/sharemenu/qq.png',
|
||||||
|
text: 'QQ',
|
||||||
|
share: {
|
||||||
|
provider: 'qq'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
img: '/static/app-plus/sharemenu/copyurl.png',
|
||||||
|
text: this.$t('common.copy'),
|
||||||
|
share: 'copyurl'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
img: '/static/app-plus/sharemenu/more.png',
|
||||||
|
text: this.$t('common.more'),
|
||||||
|
share: 'shareSystem'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
cancelText: this.$t('common.cancelShare')
|
||||||
|
},
|
||||||
|
(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;
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.userInfo {
|
||||||
|
// padding: 20rpx;
|
||||||
|
padding-top: 60px;
|
||||||
|
background-image: url(http://ngtools.cn:3000/pic/static/uni-center/headers.png);
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.defaultAvatarUrl {
|
||||||
|
width: 150rpx;
|
||||||
|
height: 150rpx;
|
||||||
|
background-color: #007aff;
|
||||||
|
border-radius: 100%;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.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: blue;
|
||||||
|
}
|
||||||
|
|
||||||
|
.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: 16px;
|
||||||
|
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 */
|
||||||
|
.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 APP-NVUE */
|
||||||
|
border-radius: 10rpx;
|
||||||
|
/* #endif */
|
||||||
|
background-color: #dd524d;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
BIN
static/logo.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
static/tabbar/cal.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
static/tabbar/cal_active.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 2.5 KiB |
BIN
static/tabbar/info.png
Normal file
|
After Width: | Height: | Size: 7.8 KiB |
BIN
static/tabbar/info_active.png
Normal file
|
After Width: | Height: | Size: 8.4 KiB |
@ -1 +1,63 @@
|
|||||||
{"bsonType":"object","required":[],"permission":{"read":true,"create":true,"update":true,"delete":true},"properties":{"_id":{"description":"ID,系统自动生成"},"dictName":{"description":"字典名称","bsonType":"string","title":"字典名称","trim":"both"},"dictCode":{"description":"字典编码","bsonType":"string","title":"字典编码","trim":"both"},"description":{"description":"描述","bsonType":"string","title":"描述","trim":"both"},"delFlag":{"description":"删除状态","bsonType":"int","title":"删除状态","trim":"both"},"createTime":{"description":"创建时间","bsonType":"string","title":"创建时间","trim":"both"},"createBy":{"description":"创建人","bsonType":"string","title":"创建人","trim":"both"},"updateTime":{"description":"更新时间","bsonType":"datetime","title":"更新时间","trim":"both"},"updateBy":{"description":"更新人","bsonType":"string","title":"更新人","trim":"both"}}}
|
{
|
||||||
|
"bsonType": "object",
|
||||||
|
"required": [],
|
||||||
|
"permission": {
|
||||||
|
"read": true,
|
||||||
|
"create": true,
|
||||||
|
"update": true,
|
||||||
|
"delete": true
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"_id": {
|
||||||
|
"description": "ID,系统自动生成"
|
||||||
|
},
|
||||||
|
"dictName": {
|
||||||
|
"description": "字典名称",
|
||||||
|
"bsonType": "string",
|
||||||
|
"title": "字典名称",
|
||||||
|
"trim": "both"
|
||||||
|
},
|
||||||
|
"dictCode": {
|
||||||
|
"description": "字典编码",
|
||||||
|
"bsonType": "string",
|
||||||
|
"title": "字典编码",
|
||||||
|
"trim": "both"
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"description": "描述",
|
||||||
|
"bsonType": "string",
|
||||||
|
"title": "描述",
|
||||||
|
"trim": "both"
|
||||||
|
},
|
||||||
|
"delFlag": {
|
||||||
|
"description": "删除状态",
|
||||||
|
"bsonType": "int",
|
||||||
|
"title": "删除状态",
|
||||||
|
"trim": "both"
|
||||||
|
},
|
||||||
|
"createTime": {
|
||||||
|
"description": "创建时间",
|
||||||
|
"bsonType": "string",
|
||||||
|
"title": "创建时间",
|
||||||
|
"trim": "both"
|
||||||
|
},
|
||||||
|
"createBy": {
|
||||||
|
"description": "创建人",
|
||||||
|
"bsonType": "string",
|
||||||
|
"title": "创建人",
|
||||||
|
"trim": "both"
|
||||||
|
},
|
||||||
|
"updateTime": {
|
||||||
|
"description": "更新时间",
|
||||||
|
"bsonType": "datetime",
|
||||||
|
"title": "更新时间",
|
||||||
|
"trim": "both"
|
||||||
|
},
|
||||||
|
"updateBy": {
|
||||||
|
"description": "更新人",
|
||||||
|
"bsonType": "string",
|
||||||
|
"title": "更新人",
|
||||||
|
"trim": "both"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1 +1,82 @@
|
|||||||
{"bsonType":"object","required":[],"permission":{"read":true,"create":true,"update":true,"delete":true},"properties":{"_id":{"description":"ID,系统自动生成"},"dictID":{"description":"字典ID","bsonType":"string","title":"字典ID","trim":"both"},"itemValue":{"description":"字典项值","bsonType":"string","title":"字典项值","trim":"both","length":"1024"},"itemText":{"description":"字典项文本","bsonType":"string","title":"字典项文本","trim":"both"},"itemColor":{"description":"字典项颜色","bsonType":"string","title":"字典项颜色","trim":"both"},"description":{"description":"描述","bsonType":"string","title":"描述","trim":"both"},"sortOrder":{"description":"排序","bsonType":"string","title":"排序","trim":"both"},"status":{"description":"状态","bsonType":"int","title":"状态","trim":"both"},"createTime":{"description":"创建时间","bsonType":"datetime","title":"创建时间","trim":"both"},"createBy":{"description":"创建人","bsonType":"string","title":"创建人","trim":"both"},"updateTime":{"description":"更新时间","bsonType":"datetime","title":"更新时间","trim":"both"},"updateBy":{"description":"更新人","bsonType":"string","title":"更新人","trim":"both"}}}
|
{
|
||||||
|
"bsonType": "object",
|
||||||
|
"required": [],
|
||||||
|
"permission": {
|
||||||
|
"read": true,
|
||||||
|
"create": true,
|
||||||
|
"update": true,
|
||||||
|
"delete": true
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"_id": {
|
||||||
|
"description": "ID,系统自动生成"
|
||||||
|
},
|
||||||
|
"dictID": {
|
||||||
|
"description": "字典ID",
|
||||||
|
"bsonType": "string",
|
||||||
|
"title": "字典ID",
|
||||||
|
"trim": "both"
|
||||||
|
},
|
||||||
|
"itemValue": {
|
||||||
|
"description": "字典项值",
|
||||||
|
"bsonType": "string",
|
||||||
|
"title": "字典项值",
|
||||||
|
"trim": "both",
|
||||||
|
"length": "1024"
|
||||||
|
},
|
||||||
|
"itemText": {
|
||||||
|
"description": "字典项文本",
|
||||||
|
"bsonType": "string",
|
||||||
|
"title": "字典项文本",
|
||||||
|
"trim": "both"
|
||||||
|
},
|
||||||
|
"itemColor": {
|
||||||
|
"description": "字典项颜色",
|
||||||
|
"bsonType": "string",
|
||||||
|
"title": "字典项颜色",
|
||||||
|
"trim": "both"
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"description": "描述",
|
||||||
|
"bsonType": "string",
|
||||||
|
"title": "描述",
|
||||||
|
"trim": "both"
|
||||||
|
},
|
||||||
|
"sortOrder": {
|
||||||
|
"description": "排序",
|
||||||
|
"bsonType": "string",
|
||||||
|
"title": "排序",
|
||||||
|
"trim": "both"
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"description": "状态",
|
||||||
|
"bsonType": "int",
|
||||||
|
"title": "状态",
|
||||||
|
"trim": "both"
|
||||||
|
},
|
||||||
|
"createTime": {
|
||||||
|
"description": "创建时间",
|
||||||
|
"bsonType": "datetime",
|
||||||
|
"title": "创建时间",
|
||||||
|
"trim": "both"
|
||||||
|
},
|
||||||
|
"createBy": {
|
||||||
|
"description": "创建人",
|
||||||
|
"bsonType": "string",
|
||||||
|
"title": "创建人",
|
||||||
|
"trim": "both"
|
||||||
|
},
|
||||||
|
"updateTime": {
|
||||||
|
"description": "更新时间",
|
||||||
|
"bsonType": "datetime",
|
||||||
|
"title": "更新时间",
|
||||||
|
"trim": "both"
|
||||||
|
},
|
||||||
|
"updateBy": {
|
||||||
|
"description": "更新人",
|
||||||
|
"bsonType": "string",
|
||||||
|
"title": "更新人",
|
||||||
|
"trim": "both"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1 +1,102 @@
|
|||||||
{"bsonType":"object","description":"记录上报的应用运行错误日志","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"},"appid":{"bsonType":"string","description":"用户端上报的应用ID"},"version":{"bsonType":"string","description":"用户端上报的应用版本号"},"platform":{"bsonType":"string","description":"用户端上报的平台code"},"channel":{"bsonType":"string","description":"用户端上报的渠道code\/场景值"},"error_type":{"bsonType":"int","description":"错误类型","defaultValue":0,"enum":[{"text":"未知","value":0},{"text":"表示webview页面js异常(uni-app项目对应vue页面)","value":2},{"text":"表示uni框架js异常(仅uni-app项目)","value":4},{"text":"表示控制页js异常(仅uni-app项目)","value":5},{"text":"表示nvue页面js异常(仅uni-app项目)","value":6}]},"device_id":{"bsonType":"string","description":"客户端携带的设备标识"},"uid":{"bsonType":"string","description":"用户编号, 对应uni-id-users._id"},"os":{"bsonType":"string","description":"客户端操作系统"},"ua":{"bsonType":"string","description":"客户端user-agent信息"},"space_id":{"bsonType":"string","description":"服务空间编号"},"space_provider":{"bsonType":"string","description":"服务空间提供商"},"sdk_version":{"bsonType":"string","description":"小程序基础库版本号"},"platform_version":{"bsonType":"string","description":"微信、支付宝宿主App的版本号"},"error_msg":{"bsonType":"string","description":"错误信息"},"error_hash":{"bsonType":"string","description":"错误hash码"},"page_url":{"bsonType":"string","description":"页面url"},"create_time":{"bsonType":"timestamp","description":"创建时间"}},"version":"0.0.2"}
|
{
|
||||||
|
"bsonType": "object",
|
||||||
|
"description": "记录上报的应用运行错误日志",
|
||||||
|
"required": [],
|
||||||
|
"permission": {
|
||||||
|
"read": false,
|
||||||
|
"create": false,
|
||||||
|
"update": false,
|
||||||
|
"delete": false
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"_id": {
|
||||||
|
"description": "ID,系统自动生成"
|
||||||
|
},
|
||||||
|
"appid": {
|
||||||
|
"bsonType": "string",
|
||||||
|
"description": "用户端上报的应用ID"
|
||||||
|
},
|
||||||
|
"version": {
|
||||||
|
"bsonType": "string",
|
||||||
|
"description": "用户端上报的应用版本号"
|
||||||
|
},
|
||||||
|
"platform": {
|
||||||
|
"bsonType": "string",
|
||||||
|
"description": "用户端上报的平台code"
|
||||||
|
},
|
||||||
|
"channel": {
|
||||||
|
"bsonType": "string",
|
||||||
|
"description": "用户端上报的渠道code\/场景值"
|
||||||
|
},
|
||||||
|
"error_type": {
|
||||||
|
"bsonType": "int",
|
||||||
|
"description": "错误类型",
|
||||||
|
"defaultValue": 0,
|
||||||
|
"enum": [{
|
||||||
|
"text": "未知",
|
||||||
|
"value": 0
|
||||||
|
}, {
|
||||||
|
"text": "表示webview页面js异常(uni-app项目对应vue页面)",
|
||||||
|
"value": 2
|
||||||
|
}, {
|
||||||
|
"text": "表示uni框架js异常(仅uni-app项目)",
|
||||||
|
"value": 4
|
||||||
|
}, {
|
||||||
|
"text": "表示控制页js异常(仅uni-app项目)",
|
||||||
|
"value": 5
|
||||||
|
}, {
|
||||||
|
"text": "表示nvue页面js异常(仅uni-app项目)",
|
||||||
|
"value": 6
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
"device_id": {
|
||||||
|
"bsonType": "string",
|
||||||
|
"description": "客户端携带的设备标识"
|
||||||
|
},
|
||||||
|
"uid": {
|
||||||
|
"bsonType": "string",
|
||||||
|
"description": "用户编号, 对应uni-id-users._id"
|
||||||
|
},
|
||||||
|
"os": {
|
||||||
|
"bsonType": "string",
|
||||||
|
"description": "客户端操作系统"
|
||||||
|
},
|
||||||
|
"ua": {
|
||||||
|
"bsonType": "string",
|
||||||
|
"description": "客户端user-agent信息"
|
||||||
|
},
|
||||||
|
"space_id": {
|
||||||
|
"bsonType": "string",
|
||||||
|
"description": "服务空间编号"
|
||||||
|
},
|
||||||
|
"space_provider": {
|
||||||
|
"bsonType": "string",
|
||||||
|
"description": "服务空间提供商"
|
||||||
|
},
|
||||||
|
"sdk_version": {
|
||||||
|
"bsonType": "string",
|
||||||
|
"description": "小程序基础库版本号"
|
||||||
|
},
|
||||||
|
"platform_version": {
|
||||||
|
"bsonType": "string",
|
||||||
|
"description": "微信、支付宝宿主App的版本号"
|
||||||
|
},
|
||||||
|
"error_msg": {
|
||||||
|
"bsonType": "string",
|
||||||
|
"description": "错误信息"
|
||||||
|
},
|
||||||
|
"error_hash": {
|
||||||
|
"bsonType": "string",
|
||||||
|
"description": "错误hash码"
|
||||||
|
},
|
||||||
|
"page_url": {
|
||||||
|
"bsonType": "string",
|
||||||
|
"description": "页面url"
|
||||||
|
},
|
||||||
|
"create_time": {
|
||||||
|
"bsonType": "timestamp",
|
||||||
|
"description": "创建时间"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"version": "0.0.2"
|
||||||
|
}
|
||||||
@ -1 +1,96 @@
|
|||||||
{"bsonType":"object","description":"存储汇总的错误日志的数据","required":[],"permission":{"read":false,"create":false,"update":false,"delete":false},"properties":{"_id":{"description":"ID,系统自动生成"},"appid":{"bsonType":"string","description":"应用ID"},"platform_id":{"bsonType":"string","description":"应用平台ID,对应uni-stat-app-platforms._id","foreignKey":"uni-stat-app-platforms._id"},"channel_id":{"bsonType":"string","description":"渠道\/场景值ID,对应uni-stat-app-channels._id","foreignKey":"uni-stat-app-channels._id"},"version_id":{"bsonType":"string","description":"应用版本ID,对应opendb-app-versions._id","foreignKey":"opendb-app-versions._id"},"type":{"bsonType":"string","description":"错误类型","enum":[{"text":"前端js错误","value":"js"},{"text":"原生应用崩溃错误","value":"crash"}]},"hash":{"bsonType":"string","description":"错误hash码"},"msg":{"bsonType":"string","description":"错误信息"},"count":{"bsonType":"int","description":"报错次数"},"app_launch_count":{"bsonType":"int","description":"本时间段App启动或从后台切到前台的次数"},"last_time":{"bsonType":"timestamp","description":"最近一次报错事件"},"dimension":{"bsonType":"string","description":"统计范围 day:按天统计,hour:按小时统计","enum":[{"text":"月","value":"month"},{"text":"周","value":"week"},{"text":"天","value":"day"},{"text":"小时","value":"hour"}]},"stat_date":{"bsonType":"int","description":"统计日期,格式yyyymmdd,例:20211201"},"start_time":{"bsonType":"timestamp","description":"开始时间"},"end_time":{"bsonType":"timestamp","description":"结束时间"}},"version":"0.0.2"}
|
{
|
||||||
|
"bsonType": "object",
|
||||||
|
"description": "存储汇总的错误日志的数据",
|
||||||
|
"required": [],
|
||||||
|
"permission": {
|
||||||
|
"read": false,
|
||||||
|
"create": false,
|
||||||
|
"update": false,
|
||||||
|
"delete": false
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"_id": {
|
||||||
|
"description": "ID,系统自动生成"
|
||||||
|
},
|
||||||
|
"appid": {
|
||||||
|
"bsonType": "string",
|
||||||
|
"description": "应用ID"
|
||||||
|
},
|
||||||
|
"platform_id": {
|
||||||
|
"bsonType": "string",
|
||||||
|
"description": "应用平台ID,对应uni-stat-app-platforms._id",
|
||||||
|
"foreignKey": "uni-stat-app-platforms._id"
|
||||||
|
},
|
||||||
|
"channel_id": {
|
||||||
|
"bsonType": "string",
|
||||||
|
"description": "渠道\/场景值ID,对应uni-stat-app-channels._id",
|
||||||
|
"foreignKey": "uni-stat-app-channels._id"
|
||||||
|
},
|
||||||
|
"version_id": {
|
||||||
|
"bsonType": "string",
|
||||||
|
"description": "应用版本ID,对应opendb-app-versions._id",
|
||||||
|
"foreignKey": "opendb-app-versions._id"
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"bsonType": "string",
|
||||||
|
"description": "错误类型",
|
||||||
|
"enum": [{
|
||||||
|
"text": "前端js错误",
|
||||||
|
"value": "js"
|
||||||
|
}, {
|
||||||
|
"text": "原生应用崩溃错误",
|
||||||
|
"value": "crash"
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
"hash": {
|
||||||
|
"bsonType": "string",
|
||||||
|
"description": "错误hash码"
|
||||||
|
},
|
||||||
|
"msg": {
|
||||||
|
"bsonType": "string",
|
||||||
|
"description": "错误信息"
|
||||||
|
},
|
||||||
|
"count": {
|
||||||
|
"bsonType": "int",
|
||||||
|
"description": "报错次数"
|
||||||
|
},
|
||||||
|
"app_launch_count": {
|
||||||
|
"bsonType": "int",
|
||||||
|
"description": "本时间段App启动或从后台切到前台的次数"
|
||||||
|
},
|
||||||
|
"last_time": {
|
||||||
|
"bsonType": "timestamp",
|
||||||
|
"description": "最近一次报错事件"
|
||||||
|
},
|
||||||
|
"dimension": {
|
||||||
|
"bsonType": "string",
|
||||||
|
"description": "统计范围 day:按天统计,hour:按小时统计",
|
||||||
|
"enum": [{
|
||||||
|
"text": "月",
|
||||||
|
"value": "month"
|
||||||
|
}, {
|
||||||
|
"text": "周",
|
||||||
|
"value": "week"
|
||||||
|
}, {
|
||||||
|
"text": "天",
|
||||||
|
"value": "day"
|
||||||
|
}, {
|
||||||
|
"text": "小时",
|
||||||
|
"value": "hour"
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
"stat_date": {
|
||||||
|
"bsonType": "int",
|
||||||
|
"description": "统计日期,格式yyyymmdd,例:20211201"
|
||||||
|
},
|
||||||
|
"start_time": {
|
||||||
|
"bsonType": "timestamp",
|
||||||
|
"description": "开始时间"
|
||||||
|
},
|
||||||
|
"end_time": {
|
||||||
|
"bsonType": "timestamp",
|
||||||
|
"description": "结束时间"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"version": "0.0.2"
|
||||||
|
}
|
||||||
1034
uni_modules/next-tree/components/next-tree/next-tree.vue
Normal file
269
uni_modules/next-tree/components/next-tree/style.css
Normal file
@ -0,0 +1,269 @@
|
|||||||
|
@font-face {
|
||||||
|
font-family: 'iconfont';
|
||||||
|
src: url('//at.alicdn.com/t/c/font_4110624_qs48wckazsh.ttf?t=1712479573821') format('truetype');
|
||||||
|
}
|
||||||
|
@keyframes spin {
|
||||||
|
0% { transform: rotate(0deg); }
|
||||||
|
100% { transform: rotate(360deg); }
|
||||||
|
}
|
||||||
|
|
||||||
|
.iconfont {
|
||||||
|
font-family: iconfont;
|
||||||
|
font-style: normal;
|
||||||
|
}
|
||||||
|
.iconfont-loading {
|
||||||
|
font-family: iconfont;
|
||||||
|
display: inline-block;
|
||||||
|
font-style: normal;
|
||||||
|
animation: spin 1s linear infinite;
|
||||||
|
}
|
||||||
|
.next-tree-mask {
|
||||||
|
position: fixed;
|
||||||
|
top: 0rpx;
|
||||||
|
right: 0rpx;
|
||||||
|
bottom: 0rpx;
|
||||||
|
left: 0rpx;
|
||||||
|
z-index: 997;
|
||||||
|
background-color: rgba(0, 0, 0, 0.6);
|
||||||
|
opacity: 0;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
.next-tree-mask.show {
|
||||||
|
visibility: visible;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
.next-tree-cnt {
|
||||||
|
position: fixed;
|
||||||
|
top: 0rpx;
|
||||||
|
right: 0rpx;
|
||||||
|
bottom: 0rpx;
|
||||||
|
left: 0rpx;
|
||||||
|
z-index: 997;
|
||||||
|
top: 360rpx;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
transform: translateY(100%);
|
||||||
|
}
|
||||||
|
.next-tree-cnt.next-tree-cnt-page {
|
||||||
|
transition: none;
|
||||||
|
}
|
||||||
|
.next-tree-cnt.show {
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
.next-tree-bar {
|
||||||
|
background-color: #fff;
|
||||||
|
height: 72rpx;
|
||||||
|
padding-left: 20rpx;
|
||||||
|
padding-right: 20rpx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border-bottom-width: 1rpx !important;
|
||||||
|
border-bottom-style: solid;
|
||||||
|
border-bottom-color: #f5f5f5;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #757575;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
.next-tree-bar-btns {
|
||||||
|
display: inline-block;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
.btn-divid {
|
||||||
|
display: inline-block;
|
||||||
|
width: 1px;
|
||||||
|
margin: 0 10px;
|
||||||
|
background-color: #ccc;
|
||||||
|
}
|
||||||
|
.next-tree-bar-confirm {
|
||||||
|
color: #f9ae3d;
|
||||||
|
}
|
||||||
|
.next-tree-view {
|
||||||
|
position: absolute;
|
||||||
|
top: 0rpx;
|
||||||
|
right: 0rpx;
|
||||||
|
bottom: 0rpx;
|
||||||
|
left: 0rpx;
|
||||||
|
top: 72rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
padding-top: 20rpx;
|
||||||
|
padding-right: 20rpx;
|
||||||
|
padding-bottom: 20rpx;
|
||||||
|
padding-left: 20rpx;
|
||||||
|
}
|
||||||
|
.next-tree-view-sc {
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.next-tree-view-sc .empty {
|
||||||
|
text-align: center;
|
||||||
|
color: #757575;
|
||||||
|
padding: 30rpx;
|
||||||
|
}
|
||||||
|
.next-tree-item-block {
|
||||||
|
|
||||||
|
}
|
||||||
|
.next-tree-item {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #757575;
|
||||||
|
line-height: 1;
|
||||||
|
height: 0;
|
||||||
|
opacity: 0;
|
||||||
|
transition: 0.2s;
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.next-tree-item .icon-btn {
|
||||||
|
font-size: 30rpx;
|
||||||
|
margin-right: 20rpx;
|
||||||
|
}
|
||||||
|
.next-tree-item .left-line {
|
||||||
|
position: relative;
|
||||||
|
width: 1rpx;
|
||||||
|
height: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
.next-tree-item .left-line::before {
|
||||||
|
position: absolute;
|
||||||
|
content: "";
|
||||||
|
width: 1rpx;
|
||||||
|
height: 100%;
|
||||||
|
background-color: rgba(204,204,204,0.9);
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
left: -18rpx;
|
||||||
|
}
|
||||||
|
.next-tree-item .parent-horizontal-line {
|
||||||
|
width: 1rpx;
|
||||||
|
height: 100%;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
background-color: rgba(204,204,204,0.9);
|
||||||
|
}
|
||||||
|
.next-tree-item .left-line .horizontal-line {
|
||||||
|
width: 20rpx;
|
||||||
|
height: 1rpx;
|
||||||
|
position: absolute;
|
||||||
|
top: 40rpx;
|
||||||
|
left: 0rpx;
|
||||||
|
background-color: rgba(204,204,204,0.9);
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.next-tree-item.show {
|
||||||
|
height: 80rpx;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
.next-tree-item.showchild:before {
|
||||||
|
transform: rotate(90deg);
|
||||||
|
}
|
||||||
|
.next-tree-item.border {
|
||||||
|
border-bottom: 1rpx solid rgba(204,204,204,0.2);
|
||||||
|
}
|
||||||
|
.next-tree-item.last:before {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
.next-tree-item.disabled {
|
||||||
|
color: #ccc!important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.next-tree-icon {
|
||||||
|
width: 26rpx;
|
||||||
|
height: 26rpx;
|
||||||
|
margin-right: 8rpx;
|
||||||
|
}
|
||||||
|
.next-tree-label {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
height: 100%;
|
||||||
|
line-height: 1.2;
|
||||||
|
}
|
||||||
|
.next-tree-label .label-input {
|
||||||
|
border: 1rpx solid #f0f0f0;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
width: 100%;
|
||||||
|
padding: 12rpx 18rpx;
|
||||||
|
margin-right: 30rpx;
|
||||||
|
}
|
||||||
|
.next-tree-check {
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.next-tree-check-yes,
|
||||||
|
.next-tree-check-no {
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
border-top-left-radius: 20%;
|
||||||
|
border-top-right-radius: 20%;
|
||||||
|
border-bottom-right-radius: 20%;
|
||||||
|
border-bottom-left-radius: 20%;
|
||||||
|
border-top-width: 1rpx;
|
||||||
|
border-left-width: 1rpx;
|
||||||
|
border-bottom-width: 1rpx;
|
||||||
|
border-right-width: 1rpx;
|
||||||
|
border-style: solid;
|
||||||
|
border-color: #f9ae3d;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
.next-tree-check-yes-b {
|
||||||
|
border-top-left-radius: 20%;
|
||||||
|
border-top-right-radius: 20%;
|
||||||
|
border-bottom-right-radius: 20%;
|
||||||
|
border-bottom-left-radius: 20%;
|
||||||
|
background-color: #f9ae3d;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
.next-tree-check-yes-b .icon-text {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: normal;
|
||||||
|
font-family: uicon-iconfont;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.next-tree-check .radio {
|
||||||
|
border-top-left-radius: 50%;
|
||||||
|
border-top-right-radius: 50%;
|
||||||
|
border-bottom-right-radius: 50%;
|
||||||
|
border-bottom-left-radius: 50%;
|
||||||
|
}
|
||||||
|
.next-tree-check .radio .next-tree-check-yes-b {
|
||||||
|
border-top-left-radius: 50%;
|
||||||
|
border-top-right-radius: 50%;
|
||||||
|
border-bottom-right-radius: 50%;
|
||||||
|
border-bottom-left-radius: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.next-tree-item.disabled .next-tree-check-no {
|
||||||
|
color: #ccc!important;
|
||||||
|
}
|
||||||
|
.next-tree-item.disabled .next-tree-check-yes-b {
|
||||||
|
background-color: #ccc!important;
|
||||||
|
}
|
||||||
|
.hover-c {
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fixed-bottom-bar {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0rpx;
|
||||||
|
left: 0rpx;
|
||||||
|
right: 0rpx;
|
||||||
|
z-index: 998;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
84
uni_modules/next-tree/package.json
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
{
|
||||||
|
"id": "next-tree",
|
||||||
|
"displayName": "next-tree(超强树选择器、树组件、树插件、无限级联树、单选树、多选树、自定义样式树、树形选择器)",
|
||||||
|
"version": "1.8.7",
|
||||||
|
"description": "next-tree 弹窗树形选择器,支持多选,支持大数据, 无限级联,单选,父子级级联,远程/ajax加载,子节点增量/异步渲染,自定义样式定制,具名插槽等;支持h5/小程序/APP,全端通用",
|
||||||
|
"keywords": [
|
||||||
|
"树选择",
|
||||||
|
"tree",
|
||||||
|
"弹窗树选择器",
|
||||||
|
"多选树",
|
||||||
|
"单选树"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
},
|
||||||
|
"dcloudext": {
|
||||||
|
"sale": {
|
||||||
|
"regular": {
|
||||||
|
"price": "0.00"
|
||||||
|
},
|
||||||
|
"sourcecode": {
|
||||||
|
"price": "0.00"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"contact": {
|
||||||
|
"qq": ""
|
||||||
|
},
|
||||||
|
"declaration": {
|
||||||
|
"ads": "无",
|
||||||
|
"data": "修改版本说明",
|
||||||
|
"permissions": "无"
|
||||||
|
},
|
||||||
|
"npmurl": "",
|
||||||
|
"type": "component-vue"
|
||||||
|
},
|
||||||
|
"uni_modules": {
|
||||||
|
"dependencies": ["next-search-more"],
|
||||||
|
"encrypt": [],
|
||||||
|
"platforms": {
|
||||||
|
"cloud": {
|
||||||
|
"tcb": "y",
|
||||||
|
"aliyun": "y",
|
||||||
|
"alipay": "n"
|
||||||
|
},
|
||||||
|
"client": {
|
||||||
|
"Vue": {
|
||||||
|
"vue2": "y",
|
||||||
|
"vue3": "y"
|
||||||
|
},
|
||||||
|
"App": {
|
||||||
|
"app-vue": "y",
|
||||||
|
"app-nvue": "u"
|
||||||
|
},
|
||||||
|
"H5-mobile": {
|
||||||
|
"Safari": "y",
|
||||||
|
"Android Browser": "y",
|
||||||
|
"微信浏览器(Android)": "y",
|
||||||
|
"QQ浏览器(Android)": "y"
|
||||||
|
},
|
||||||
|
"H5-pc": {
|
||||||
|
"Chrome": "y",
|
||||||
|
"IE": "n",
|
||||||
|
"Edge": "y",
|
||||||
|
"Firefox": "y",
|
||||||
|
"Safari": "u"
|
||||||
|
},
|
||||||
|
"小程序": {
|
||||||
|
"微信": "y",
|
||||||
|
"阿里": "y",
|
||||||
|
"百度": "y",
|
||||||
|
"字节跳动": "u",
|
||||||
|
"QQ": "y",
|
||||||
|
"钉钉": "y",
|
||||||
|
"快手": "u",
|
||||||
|
"飞书": "u",
|
||||||
|
"京东": "u"
|
||||||
|
},
|
||||||
|
"快应用": {
|
||||||
|
"华为": "u",
|
||||||
|
"联盟": "u"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,13 +1,15 @@
|
|||||||
{
|
{
|
||||||
"passwordSecret": "passwordSecret-demo",
|
"passwordSecret": "test-passwordSecret",
|
||||||
"tokenSecret": "tokenSecret-demo",
|
"tokenSecret": "test-tokenSecret",
|
||||||
"tokenExpiresIn": 7200,
|
"tokenExpiresIn": 7200,
|
||||||
"tokenExpiresThreshold": 600,
|
"tokenExpiresThreshold": 600,
|
||||||
"passwordErrorLimit": 6,
|
"passwordErrorLimit": 6,
|
||||||
"bindTokenToDevice": false,
|
"bindTokenToDevice": false,
|
||||||
"passwordErrorRetryTime": 3600,
|
"passwordErrorRetryTime": 3600,
|
||||||
"autoSetInviteCode": false,
|
"autoSetInviteCode": true,
|
||||||
"forceInviteCode": false,
|
"forceInviteCode": false,
|
||||||
|
"preferedAppPlatform": "app",
|
||||||
|
"requestAuthSecret": "testSecret",
|
||||||
"app": {
|
"app": {
|
||||||
"tokenExpiresIn": 2592000,
|
"tokenExpiresIn": 2592000,
|
||||||
"oauth": {
|
"oauth": {
|
||||||
@ -20,6 +22,18 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"web": {
|
||||||
|
"oauth": {
|
||||||
|
"weixin-h5": {
|
||||||
|
"appid": "微信浏览器内微信登录,所用的微信公众号appid",
|
||||||
|
"appsecret": "微信公众号后台获取的appsecret"
|
||||||
|
},
|
||||||
|
"weixin-web": {
|
||||||
|
"appid": "手机微信扫码登录,所用的微信开放平台(https://open.weixin.qq.com/)-网站应用的appid",
|
||||||
|
"appsecret": "微信开放平台-网站应用的appsecret"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"mp-weixin": {
|
"mp-weixin": {
|
||||||
"oauth": {
|
"oauth": {
|
||||||
"weixin": {
|
"weixin": {
|
||||||
@ -31,26 +45,22 @@
|
|||||||
"mp-alipay": {
|
"mp-alipay": {
|
||||||
"oauth": {
|
"oauth": {
|
||||||
"alipay": {
|
"alipay": {
|
||||||
"appid": "alipay appid",
|
"appid": "支付宝小程序登录用到的appid、privateKey请参考支付宝小程序的文档进行设置或者获取,https://opendocs.alipay.com/open/291/105971#LDsXr",
|
||||||
"privateKey": "alipay privateKey"
|
"privateKey": "支付宝小程序登录用到的appid、privateKey请参考支付宝小程序的文档进行设置或者获取,https://opendocs.alipay.com/open/291/105971#LDsXr"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"service": {
|
"service": {
|
||||||
"sms": {
|
"sms": {
|
||||||
"name": "应用名称,对应短信模版的name",
|
"name": "应用名称,对应短信模版的name",
|
||||||
"codeExpiresIn": 180,
|
"codeExpiresIn": 300,
|
||||||
"smsKey": "短信密钥key,开通短信服务处可以看到",
|
"smsKey": "ec5fba39363dc30af7f21bbb5ac6e857",
|
||||||
"smsSecret": "短信密钥secret,开通短信服务处可以看到",
|
"smsSecret": "09abff426ab62fd2e104c3be794b84c7"
|
||||||
"scene": {
|
|
||||||
"bind-mobile-by-sms": {
|
|
||||||
"templateId": "绑定手机号使用的短信验证码模板",
|
|
||||||
"codeExpiresIn": 240
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"univerify": {
|
"univerify": {
|
||||||
"appid": "当前应用的appid,使用云函数URL化,此项必须配置"
|
"appid": "当前应用的appid,使用云函数URL化,此项必须配置",
|
||||||
|
"apiKey": "apiKey 和 apiSecret 在开发者中心获取,开发者中心:https://dev.dcloud.net.cn/uniLogin/index?type=0,文档:https://ask.dcloud.net.cn/article/37965",
|
||||||
|
"apiSecret": ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"name": "uni-id",
|
||||||
|
"dependencies": {}
|
||||||
|
}
|
||||||
@ -1,188 +1,183 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<view class="fab-login-box">
|
<view class="fab-login-box">
|
||||||
<view class="item" v-for="(item,index) in servicesList" :key="index"
|
<view class="item" v-for="(item, index) in servicesList" :key="index" @click="item.path ? toPage(item.path) : login_before(item.id, false)">
|
||||||
@click="item.path?toPage(item.path):login_before(item.id,false)">
|
|
||||||
<image class="logo" :src="item.logo" mode="scaleToFill"></image>
|
<image class="logo" :src="item.logo" mode="scaleToFill"></image>
|
||||||
<text class="login-title">{{item.text}}</text>
|
<text class="login-title">{{ item.text }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import config from '@/uni_modules/uni-id-pages/config.js'
|
import config from '@/uni_modules/uni-id-pages/config.js';
|
||||||
//前一个窗口的页面地址。控制点击切换快捷登录方式是创建还是返回
|
//前一个窗口的页面地址。控制点击切换快捷登录方式是创建还是返回
|
||||||
import {store,mutations} from '@/uni_modules/uni-id-pages/common/store.js'
|
import { store, mutations } from '@/uni_modules/uni-id-pages/common/store.js';
|
||||||
let allServicesList = []
|
let allServicesList = [];
|
||||||
export default {
|
export default {
|
||||||
computed: {
|
computed: {
|
||||||
agreements() {
|
agreements() {
|
||||||
if (!config.agreements) {
|
if (!config.agreements) {
|
||||||
return []
|
return [];
|
||||||
}
|
}
|
||||||
let {
|
let { serviceUrl, privacyUrl } = config.agreements;
|
||||||
serviceUrl,
|
return [
|
||||||
privacyUrl
|
{
|
||||||
} = config.agreements
|
|
||||||
return [{
|
|
||||||
url: serviceUrl,
|
url: serviceUrl,
|
||||||
title: "用户服务协议"
|
title: '用户服务协议'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
url: privacyUrl,
|
url: privacyUrl,
|
||||||
title: "隐私政策条款"
|
title: '隐私政策条款'
|
||||||
}
|
}
|
||||||
]
|
];
|
||||||
},
|
},
|
||||||
agree: {
|
agree: {
|
||||||
get() {
|
get() {
|
||||||
return this.getParentComponent().agree
|
return this.getParentComponent().agree;
|
||||||
},
|
},
|
||||||
set(agree) {
|
set(agree) {
|
||||||
return this.getParentComponent().agree = agree
|
return (this.getParentComponent().agree = agree);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
servicesList: [{
|
servicesList: [
|
||||||
"id": "username",
|
{
|
||||||
"text": "账号登录",
|
id: 'username',
|
||||||
"logo": "/uni_modules/uni-id-pages/static/login/uni-fab-login/user.png",
|
text: '账号登录',
|
||||||
"path": "/uni_modules/uni-id-pages/pages/login/login-withpwd"
|
logo: '/uni_modules/uni-id-pages/static/login/uni-fab-login/user.png',
|
||||||
|
path: '/uni_modules/uni-id-pages/pages/login/login-withpwd'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "smsCode",
|
id: 'smsCode',
|
||||||
"text": "短信验证码",
|
text: '短信验证码',
|
||||||
"logo": "/uni_modules/uni-id-pages/static/login/uni-fab-login/sms.png",
|
logo: '/uni_modules/uni-id-pages/static/login/uni-fab-login/sms.png',
|
||||||
"path": "/uni_modules/uni-id-pages/pages/login/login-withoutpwd?type=smsCode"
|
path: '/uni_modules/uni-id-pages/pages/login/login-withoutpwd?type=smsCode'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "weixin",
|
id: 'weixin',
|
||||||
"text": "微信登录",
|
text: '微信登录',
|
||||||
"logo": "/uni_modules/uni-id-pages/static/login/uni-fab-login/weixin.png",
|
logo: '/uni_modules/uni-id-pages/static/login/uni-fab-login/weixin.png'
|
||||||
},
|
},
|
||||||
// #ifndef MP-WEIXIN
|
// #ifndef MP-WEIXIN
|
||||||
{
|
{
|
||||||
"id": "apple",
|
id: 'apple',
|
||||||
"text": "苹果登录",
|
text: '苹果登录',
|
||||||
"logo": "/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/apple.png",
|
logo: '/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/apple.png'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "univerify",
|
id: 'univerify',
|
||||||
"text": "一键登录",
|
text: '一键登录',
|
||||||
"logo": "/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/univerify.png",
|
logo: '/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/univerify.png'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "taobao",
|
id: 'taobao',
|
||||||
"text": "淘宝登录", //暂未提供该登录方式的接口示例
|
text: '淘宝登录', //暂未提供该登录方式的接口示例
|
||||||
"logo": "/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/taobao.png",
|
logo: '/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/taobao.png'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "facebook",
|
id: 'facebook',
|
||||||
"text": "脸书登录", //暂未提供该登录方式的接口示例
|
text: '脸书登录', //暂未提供该登录方式的接口示例
|
||||||
"logo": "/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/facebook.png",
|
logo: '/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/facebook.png'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "alipay",
|
id: 'alipay',
|
||||||
"text": "支付宝登录", //暂未提供该登录方式的接口示例
|
text: '支付宝登录', //暂未提供该登录方式的接口示例
|
||||||
"logo": "/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/alipay.png",
|
logo: '/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/alipay.png'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "qq",
|
id: 'qq',
|
||||||
"text": "QQ登录", //暂未提供该登录方式的接口示例
|
text: 'QQ登录', //暂未提供该登录方式的接口示例
|
||||||
"logo": "/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/qq.png",
|
logo: '/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/qq.png'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "google",
|
id: 'google',
|
||||||
"text": "谷歌登录", //暂未提供该登录方式的接口示例
|
text: '谷歌登录', //暂未提供该登录方式的接口示例
|
||||||
"logo": "/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/google.png",
|
logo: '/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/google.png'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "douyin",
|
id: 'douyin',
|
||||||
"text": "抖音登录", //暂未提供该登录方式的接口示例
|
text: '抖音登录', //暂未提供该登录方式的接口示例
|
||||||
"logo": "/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/douyin.png",
|
logo: '/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/douyin.png'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "sinaweibo",
|
id: 'sinaweibo',
|
||||||
"text": "新浪微博", //暂未提供该登录方式的接口示例
|
text: '新浪微博', //暂未提供该登录方式的接口示例
|
||||||
"logo": "/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/sinaweibo.png",
|
logo: '/uni_modules/uni-id-pages/static/app-plus/uni-fab-login/sinaweibo.png'
|
||||||
}
|
}
|
||||||
// #endif
|
// #endif
|
||||||
],
|
],
|
||||||
univerifyStyle: { //一键登录弹出窗的样式配置参数
|
univerifyStyle: {
|
||||||
"fullScreen": true, // 是否全屏显示,true表示全屏模式,false表示非全屏模式,默认值为false。
|
//一键登录弹出窗的样式配置参数
|
||||||
"backgroundColor": "#ffffff", // 授权页面背景颜色,默认值:#ffffff
|
fullScreen: true, // 是否全屏显示,true表示全屏模式,false表示非全屏模式,默认值为false。
|
||||||
"buttons": { // 自定义登录按钮
|
backgroundColor: '#ffffff', // 授权页面背景颜色,默认值:#ffffff
|
||||||
"iconWidth": "45px", // 图标宽度(高度等比例缩放) 默认值:45px
|
buttons: {
|
||||||
"list": []
|
// 自定义登录按钮
|
||||||
|
iconWidth: '45px', // 图标宽度(高度等比例缩放) 默认值:45px
|
||||||
|
list: []
|
||||||
},
|
},
|
||||||
"privacyTerms": {
|
privacyTerms: {
|
||||||
"defaultCheckBoxState": false, // 条款勾选框初始状态 默认值: true
|
defaultCheckBoxState: false, // 条款勾选框初始状态 默认值: true
|
||||||
"textColor": "#BBBBBB", // 文字颜色 默认值:#BBBBBB
|
textColor: '#BBBBBB', // 文字颜色 默认值:#BBBBBB
|
||||||
"termsColor": "#5496E3", // 协议文字颜色 默认值: #5496E3
|
termsColor: '#5496E3', // 协议文字颜色 默认值: #5496E3
|
||||||
"prefix": "我已阅读并同意", // 条款前的文案 默认值:“我已阅读并同意”
|
prefix: '我已阅读并同意', // 条款前的文案 默认值:“我已阅读并同意”
|
||||||
"suffix": "并使用本机号码登录", // 条款后的文案 默认值:“并使用本机号码登录”
|
suffix: '并使用本机号码登录', // 条款后的文案 默认值:“并使用本机号码登录”
|
||||||
"privacyItems": []
|
privacyItems: []
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
agree(agree) {
|
agree(agree) {
|
||||||
this.univerifyStyle.privacyTerms.defaultCheckBoxState = agree
|
this.univerifyStyle.privacyTerms.defaultCheckBoxState = agree;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async created() {
|
async created() {
|
||||||
let servicesList = this.servicesList
|
let servicesList = this.servicesList;
|
||||||
let loginTypes = config.loginTypes
|
let loginTypes = config.loginTypes;
|
||||||
|
|
||||||
servicesList = servicesList.filter(item => {
|
|
||||||
|
|
||||||
|
servicesList = servicesList.filter((item) => {
|
||||||
// #ifndef APP
|
// #ifndef APP
|
||||||
//非app端去掉apple登录
|
//非app端去掉apple登录
|
||||||
if (item.id == 'apple') {
|
if (item.id == 'apple') {
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifdef APP
|
// #ifdef APP
|
||||||
//去掉非ios系统上的apple登录
|
//去掉非ios系统上的apple登录
|
||||||
if (item.id == 'apple' && uni.getSystemInfoSync().osName != 'ios') {
|
if (item.id == 'apple' && uni.getSystemInfoSync().osName != 'ios') {
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
return loginTypes.includes(item.id)
|
return loginTypes.includes(item.id);
|
||||||
})
|
});
|
||||||
//处理一键登录
|
//处理一键登录
|
||||||
if (loginTypes.includes('univerify')) {
|
if (loginTypes.includes('univerify')) {
|
||||||
this.univerifyStyle.privacyTerms.privacyItems = this.agreements
|
this.univerifyStyle.privacyTerms.privacyItems = this.agreements;
|
||||||
//设置一键登录功能底下的快捷登录按钮
|
//设置一键登录功能底下的快捷登录按钮
|
||||||
servicesList.forEach(({
|
servicesList.forEach(({ id, logo, path }) => {
|
||||||
id,
|
|
||||||
logo,
|
|
||||||
path
|
|
||||||
}) => {
|
|
||||||
if (id != 'univerify') {
|
if (id != 'univerify') {
|
||||||
this.univerifyStyle.buttons.list.push({
|
this.univerifyStyle.buttons.list.push({
|
||||||
"iconPath": logo,
|
iconPath: logo,
|
||||||
"provider": id,
|
provider: id,
|
||||||
path //路径用于点击快捷按钮时判断是跳转页面
|
path //路径用于点击快捷按钮时判断是跳转页面
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
// console.log(servicesList);
|
// console.log(servicesList);
|
||||||
|
|
||||||
//去掉当前页面对应的登录选项
|
//去掉当前页面对应的登录选项
|
||||||
this.servicesList = servicesList.filter(item => {
|
this.servicesList = servicesList.filter((item) => {
|
||||||
let path = item.path ? item.path.split('?')[0] : '';
|
let path = item.path ? item.path.split('?')[0] : '';
|
||||||
return path != this.getRoute(1)
|
return path != this.getRoute(1);
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getParentComponent(){
|
getParentComponent() {
|
||||||
// #ifndef H5
|
// #ifndef H5
|
||||||
return this.$parent;
|
return this.$parent;
|
||||||
// #endif
|
// #endif
|
||||||
@ -197,36 +192,36 @@
|
|||||||
getRoute(n = 0) {
|
getRoute(n = 0) {
|
||||||
let pages = getCurrentPages();
|
let pages = getCurrentPages();
|
||||||
if (n > pages.length) {
|
if (n > pages.length) {
|
||||||
return ''
|
return '';
|
||||||
}
|
}
|
||||||
return '/' + pages[pages.length - n].route
|
return '/' + pages[pages.length - n].route;
|
||||||
},
|
},
|
||||||
toPage(path,index = 0) {
|
toPage(path, index = 0) {
|
||||||
//console.log('比较', this.getRoute(1),this.getRoute(2), path)
|
//console.log('比较', this.getRoute(1),this.getRoute(2), path)
|
||||||
if (this.getRoute(1) == path.split('?')[0] && this.getRoute(1) ==
|
if (this.getRoute(1) == path.split('?')[0] && this.getRoute(1) == '/uni_modules/uni-id-pages/pages/login/login-withoutpwd') {
|
||||||
'/uni_modules/uni-id-pages/pages/login/login-withoutpwd') {
|
|
||||||
//如果要被打开的页面已经打开,且这个页面是 /uni_modules/uni-id-pages/pages/index/index 则把类型参数传给他
|
//如果要被打开的页面已经打开,且这个页面是 /uni_modules/uni-id-pages/pages/index/index 则把类型参数传给他
|
||||||
let loginType = path.split('?')[1].split('=')[1]
|
let loginType = path.split('?')[1].split('=')[1];
|
||||||
uni.$emit('uni-id-pages-setLoginType', loginType)
|
uni.$emit('uni-id-pages-setLoginType', loginType);
|
||||||
} else if (this.getRoute(2) == path) { // 如果上一个页面就是,马上要打开的页面,直接返回。防止重复开启
|
} else if (this.getRoute(2) == path) {
|
||||||
|
// 如果上一个页面就是,马上要打开的页面,直接返回。防止重复开启
|
||||||
uni.navigateBack();
|
uni.navigateBack();
|
||||||
} else if (this.getRoute(1) != path) {
|
} else if (this.getRoute(1) != path) {
|
||||||
if(index === 0){
|
if (index === 0) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: path,
|
url: path,
|
||||||
animationType: 'slide-in-left',
|
animationType: 'slide-in-left',
|
||||||
complete(e) {
|
complete(e) {
|
||||||
// console.log(e);
|
// console.log(e);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}else{
|
} else {
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: path,
|
url: path,
|
||||||
animationType: 'slide-in-left',
|
animationType: 'slide-in-left',
|
||||||
complete(e) {
|
complete(e) {
|
||||||
// console.log(e);
|
// console.log(e);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log('出乎意料的情况,path:' + path);
|
console.log('出乎意料的情况,path:' + path);
|
||||||
@ -235,15 +230,7 @@
|
|||||||
async login_before(type, navigateBack = true, options = {}) {
|
async login_before(type, navigateBack = true, options = {}) {
|
||||||
console.log(type);
|
console.log(type);
|
||||||
//提示空实现
|
//提示空实现
|
||||||
if (["qq",
|
if (['qq', 'xiaomi', 'sinaweibo', 'taobao', 'facebook', 'google', 'alipay', 'douyin'].includes(type)) {
|
||||||
"xiaomi",
|
|
||||||
"sinaweibo",
|
|
||||||
"taobao",
|
|
||||||
"facebook",
|
|
||||||
"google",
|
|
||||||
"alipay",
|
|
||||||
"douyin",
|
|
||||||
].includes(type)) {
|
|
||||||
return uni.showToast({
|
return uni.showToast({
|
||||||
title: '该登录方式暂未实现,欢迎提交pr',
|
title: '该登录方式暂未实现,欢迎提交pr',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
@ -253,36 +240,38 @@
|
|||||||
|
|
||||||
//检查当前环境是否支持这种登录方式
|
//检查当前环境是否支持这种登录方式
|
||||||
// #ifdef APP
|
// #ifdef APP
|
||||||
let isAppExist = true
|
let isAppExist = true;
|
||||||
await new Promise((callback) => {
|
await new Promise((callback) => {
|
||||||
plus.oauth.getServices(oauthServices => {
|
plus.oauth.getServices(
|
||||||
let index = oauthServices.findIndex(e => e.id == type)
|
(oauthServices) => {
|
||||||
if(index != -1){
|
let index = oauthServices.findIndex((e) => e.id == type);
|
||||||
isAppExist = oauthServices[index].nativeClient
|
if (index != -1) {
|
||||||
callback()
|
isAppExist = oauthServices[index].nativeClient;
|
||||||
}else{
|
callback();
|
||||||
|
} else {
|
||||||
return uni.showToast({
|
return uni.showToast({
|
||||||
title: '当前设备不支持此登录,请选择其他登录方式',
|
title: '当前设备不支持此登录,请选择其他登录方式',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 3000
|
duration: 3000
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, err => {
|
},
|
||||||
throw new Error('获取服务供应商失败:' + JSON.stringify(err))
|
(err) => {
|
||||||
})
|
throw new Error('获取服务供应商失败:' + JSON.stringify(err));
|
||||||
})
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
if (
|
if (
|
||||||
// #ifdef APP
|
// #ifdef APP
|
||||||
!isAppExist
|
!isAppExist[]
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
//非app端使用了,app特有登录方式
|
//非app端使用了,app特有登录方式
|
||||||
// #ifndef APP
|
// #ifndef APP
|
||||||
["univerify","apple"].includes(type)
|
('univerify', 'apple')
|
||||||
|
.includes(type)
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
) {
|
) {
|
||||||
return uni.showToast({
|
return uni.showToast({
|
||||||
title: '当前设备不支持此登录,请选择其他登录方式',
|
title: '当前设备不支持此登录,请选择其他登录方式',
|
||||||
@ -292,38 +281,39 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
//判断是否需要弹出隐私协议授权框
|
//判断是否需要弹出隐私协议授权框
|
||||||
let needAgreements = (config?.agreements?.scope || []).includes('register')
|
let needAgreements = (config?.agreements?.scope || []).includes('register');
|
||||||
if (type != 'univerify' && needAgreements && !this.agree) {
|
if (type != 'univerify' && needAgreements && !this.agree) {
|
||||||
let agreementsRef = this.getParentComponent().$refs.agreements
|
let agreementsRef = this.getParentComponent().$refs.agreements;
|
||||||
return agreementsRef.popup(() => {
|
return agreementsRef.popup(() => {
|
||||||
this.login_before(type, navigateBack, options)
|
this.login_before(type, navigateBack, options);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
if(type == 'weixin'){
|
if (type == 'weixin') {
|
||||||
// console.log('开始微信网页登录');
|
// console.log('开始微信网页登录');
|
||||||
// let redirectUrl = location.protocol +'//'+
|
// let redirectUrl = location.protocol +'//'+
|
||||||
// document.domain +
|
// document.domain +
|
||||||
// (window.location.href.includes('#')?'/#':'') +
|
// (window.location.href.includes('#')?'/#':'') +
|
||||||
// '/uni_modules/uni-id-pages/pages/login/login-withoutpwd?is_weixin_redirect=true&type=weixin'
|
// '/uni_modules/uni-id-pages/pages/login/login-withoutpwd?is_weixin_redirect=true&type=weixin'
|
||||||
// #ifdef VUE2
|
// #ifdef VUE2
|
||||||
const baseUrl = process.env.BASE_URL
|
const baseUrl = process.env.BASE_URL;
|
||||||
// #endif
|
// #endif
|
||||||
// #ifdef VUE3
|
// #ifdef VUE3
|
||||||
const baseUrl = import.meta.env.BASE_URL
|
const baseUrl = import.meta.env.BASE_URL;
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
let redirectUrl = location.protocol +
|
let redirectUrl =
|
||||||
|
location.protocol +
|
||||||
'//' +
|
'//' +
|
||||||
location.host +
|
location.host +
|
||||||
baseUrl.replace(/\/$/, '') +
|
baseUrl.replace(/\/$/, '') +
|
||||||
(window.location.href.includes('#')?'/#':'') +
|
(window.location.href.includes('#') ? '/#' : '') +
|
||||||
'/uni_modules/uni-id-pages/pages/login/login-withoutpwd?is_weixin_redirect=true&type=weixin'
|
'/uni_modules/uni-id-pages/pages/login/login-withoutpwd?is_weixin_redirect=true&type=weixin';
|
||||||
|
|
||||||
// console.log('redirectUrl----',redirectUrl);
|
// console.log('redirectUrl----',redirectUrl);
|
||||||
let ua = window.navigator.userAgent.toLowerCase();
|
let ua = window.navigator.userAgent.toLowerCase();
|
||||||
if (ua.match(/MicroMessenger/i) == 'micromessenger'){
|
if (ua.match(/MicroMessenger/i) == 'micromessenger') {
|
||||||
// console.log('在微信公众号内');
|
// console.log('在微信公众号内');
|
||||||
return window.open(`https://open.weixin.qq.com/connect/oauth2/authorize?
|
return window.open(`https://open.weixin.qq.com/connect/oauth2/authorize?
|
||||||
appid=${config.appid.weixin.h5}
|
appid=${config.appid.weixin.h5}
|
||||||
@ -331,77 +321,74 @@
|
|||||||
&response_type=code
|
&response_type=code
|
||||||
&scope=snsapi_userinfo
|
&scope=snsapi_userinfo
|
||||||
&state=STATE&connect_redirect=1#wechat_redirect`);
|
&state=STATE&connect_redirect=1#wechat_redirect`);
|
||||||
|
} else {
|
||||||
}else{
|
|
||||||
// console.log('非微信公众号内');
|
// console.log('非微信公众号内');
|
||||||
return location.href = `https://open.weixin.qq.com/connect/qrconnect?appid=${config.appid.weixin.web}
|
return (location.href = `https://open.weixin.qq.com/connect/qrconnect?appid=${config.appid.weixin.web}
|
||||||
&redirect_uri=${encodeURIComponent(redirectUrl)}
|
&redirect_uri=${encodeURIComponent(redirectUrl)}
|
||||||
&response_type=code&scope=snsapi_login&state=STATE#wechat_redirect`
|
&response_type=code&scope=snsapi_login&state=STATE#wechat_redirect`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
mask: true
|
mask: true
|
||||||
})
|
});
|
||||||
|
|
||||||
if (type == 'univerify') {
|
if (type == 'univerify') {
|
||||||
let univerifyManager = uni.getUniverifyManager()
|
let univerifyManager = uni.getUniverifyManager();
|
||||||
let clickAnotherButtons = false
|
let clickAnotherButtons = false;
|
||||||
let onButtonsClickFn = async res => {
|
let onButtonsClickFn = async (res) => {
|
||||||
console.log('点击了第三方登录,provider:', res, res.provider, this.univerifyStyle.buttons.list);
|
console.log('点击了第三方登录,provider:', res, res.provider, this.univerifyStyle.buttons.list);
|
||||||
clickAnotherButtons = true
|
clickAnotherButtons = true;
|
||||||
let checkBoxState = await uni.getCheckBoxState();
|
let checkBoxState = await uni.getCheckBoxState();
|
||||||
// 同步一键登录弹出层隐私协议框是否打勾
|
// 同步一键登录弹出层隐私协议框是否打勾
|
||||||
// #ifdef VUE2
|
// #ifdef VUE2
|
||||||
this.agree = checkBoxState[1].state
|
this.agree = checkBoxState[1].state;
|
||||||
// #endif
|
// #endif
|
||||||
// #ifdef VUE3
|
// #ifdef VUE3
|
||||||
this.agree = checkBoxState.state
|
this.agree = checkBoxState.state;
|
||||||
// #endif
|
// #endif
|
||||||
let {
|
let { path } = this.univerifyStyle.buttons.list[res.index];
|
||||||
path
|
|
||||||
} = this.univerifyStyle.buttons.list[res.index]
|
|
||||||
if (path) {
|
if (path) {
|
||||||
if( this.getRoute(1).includes('login-withoutpwd') && path.includes('login-withoutpwd') ){
|
if (this.getRoute(1).includes('login-withoutpwd') && path.includes('login-withoutpwd')) {
|
||||||
this.getParentComponent().showCurrentWebview()
|
this.getParentComponent().showCurrentWebview();
|
||||||
}
|
}
|
||||||
this.toPage(path,1)
|
this.toPage(path, 1);
|
||||||
closeUniverify()
|
closeUniverify();
|
||||||
} else {
|
} else {
|
||||||
if (this.agree) {
|
if (this.agree) {
|
||||||
closeUniverify()
|
closeUniverify();
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.login_before(res.provider)
|
this.login_before(res.provider);
|
||||||
}, 500)
|
}, 500);
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "你未同意隐私政策协议",
|
title: '你未同意隐私政策协议',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 3000
|
duration: 3000
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
function closeUniverify() {
|
function closeUniverify() {
|
||||||
uni.hideLoading()
|
uni.hideLoading();
|
||||||
univerifyManager.close()
|
univerifyManager.close();
|
||||||
// 取消订阅自定义按钮点击事件
|
// 取消订阅自定义按钮点击事件
|
||||||
univerifyManager.offButtonsClick(onButtonsClickFn)
|
univerifyManager.offButtonsClick(onButtonsClickFn);
|
||||||
}
|
}
|
||||||
// 订阅自定义按钮点击事件
|
// 订阅自定义按钮点击事件
|
||||||
univerifyManager.onButtonsClick(onButtonsClickFn)
|
univerifyManager.onButtonsClick(onButtonsClickFn);
|
||||||
// 调用一键登录弹框
|
// 调用一键登录弹框
|
||||||
return univerifyManager.login({
|
return univerifyManager.login({
|
||||||
"univerifyStyle": this.univerifyStyle,
|
univerifyStyle: this.univerifyStyle,
|
||||||
success: res => {
|
success: (res) => {
|
||||||
this.login(res.authResult, 'univerify')
|
this.login(res.authResult, 'univerify');
|
||||||
},
|
},
|
||||||
fail(err) {
|
fail(err) {
|
||||||
console.log(err)
|
console.log(err);
|
||||||
if(!clickAnotherButtons){
|
if (!clickAnotherButtons) {
|
||||||
uni.navigateBack()
|
uni.navigateBack();
|
||||||
}
|
}
|
||||||
// uni.showToast({
|
// uni.showToast({
|
||||||
// title: JSON.stringify(err),
|
// title: JSON.stringify(err),
|
||||||
@ -409,78 +396,88 @@
|
|||||||
// duration: 3000
|
// duration: 3000
|
||||||
// });
|
// });
|
||||||
},
|
},
|
||||||
complete: async e => {
|
complete: async (e) => {
|
||||||
uni.hideLoading()
|
uni.hideLoading();
|
||||||
//同步一键登录弹出层隐私协议框是否打勾
|
//同步一键登录弹出层隐私协议框是否打勾
|
||||||
// this.agree = (await uni.getCheckBoxState())[1].state
|
// this.agree = (await uni.getCheckBoxState())[1].state
|
||||||
// 取消订阅自定义按钮点击事件
|
// 取消订阅自定义按钮点击事件
|
||||||
univerifyManager.offButtonsClick(onButtonsClickFn)
|
univerifyManager.offButtonsClick(onButtonsClickFn);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type === 'weixinMobile') {
|
if (type === 'weixinMobile') {
|
||||||
return this.login({
|
return this.login(
|
||||||
|
{
|
||||||
phoneCode: options.phoneNumberCode
|
phoneCode: options.phoneNumberCode
|
||||||
}, type)
|
},
|
||||||
|
type
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
uni.login({
|
uni.login({
|
||||||
"provider": type,
|
provider: type,
|
||||||
"onlyAuthorize": true,
|
onlyAuthorize: true,
|
||||||
// #ifdef APP
|
// #ifdef APP
|
||||||
"univerifyStyle": this.univerifyStyle,
|
univerifyStyle: this.univerifyStyle,
|
||||||
// #endif
|
// #endif
|
||||||
success: async e => {
|
success: async (e) => {
|
||||||
if (type == 'apple') {
|
if (type == 'apple') {
|
||||||
let res = await this.getUserInfo({
|
let res = await this.getUserInfo({
|
||||||
provider: "apple"
|
provider: 'apple'
|
||||||
})
|
});
|
||||||
Object.assign(e.authResult, res.userInfo)
|
Object.assign(e.authResult, res.userInfo);
|
||||||
uni.hideLoading()
|
uni.hideLoading();
|
||||||
}
|
}
|
||||||
this.login(type == 'weixin' ? {
|
this.login(
|
||||||
|
type == 'weixin'
|
||||||
|
? {
|
||||||
code: e.code
|
code: e.code
|
||||||
} : e.authResult, type)
|
}
|
||||||
|
: e.authResult,
|
||||||
|
type
|
||||||
|
);
|
||||||
},
|
},
|
||||||
fail: async (err) => {
|
fail: async (err) => {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
uni.hideLoading()
|
uni.hideLoading();
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
login(params, type) { //联网验证登录
|
login(params, type) {
|
||||||
|
//联网验证登录
|
||||||
// console.log('执行登录开始----');
|
// console.log('执行登录开始----');
|
||||||
console.log({params,type});
|
console.log({ params, type });
|
||||||
//toLowerCase
|
//toLowerCase
|
||||||
let action = 'loginBy' + type.trim().replace(type[0], type[0].toUpperCase())
|
let action = 'loginBy' + type.trim().replace(type[0], type[0].toUpperCase());
|
||||||
const uniIdCo = uniCloud.importObject("uni-id-co",{
|
const uniIdCo = uniCloud.importObject('uni-id-co', {
|
||||||
customUI:true
|
customUI: true
|
||||||
})
|
});
|
||||||
uniIdCo[action](params).then(result => {
|
uniIdCo[action](params)
|
||||||
|
.then((result) => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '登录成功',
|
title: '登录成功',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 2000
|
duration: 2000
|
||||||
});
|
});
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
result.loginType = type
|
result.loginType = type;
|
||||||
// #endif
|
// #endif
|
||||||
mutations.loginSuccess(result)
|
mutations.loginSuccess(result);
|
||||||
})
|
})
|
||||||
.catch(e=>{
|
.catch((e) => {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
content: e.message,
|
content: e.message,
|
||||||
confirmText:"知道了",
|
confirmText: '知道了',
|
||||||
showCancel: false
|
showCancel: false
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.finally(e => {
|
.finally((e) => {
|
||||||
if (type == 'univerify') {
|
if (type == 'univerify') {
|
||||||
uni.closeAuthView()
|
uni.closeAuthView();
|
||||||
}
|
}
|
||||||
uni.hideLoading()
|
uni.hideLoading();
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
async getUserInfo(e) {
|
async getUserInfo(e) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
@ -496,42 +493,42 @@
|
|||||||
});
|
});
|
||||||
reject(err);
|
reject(err);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
.fab-login-box,
|
.fab-login-box,
|
||||||
.item {
|
.item {
|
||||||
display: flex;
|
display: flex;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
/* #endif */
|
/* #endif */
|
||||||
|
|
||||||
.fab-login-box {
|
.fab-login-box {
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
width: 750rpx;
|
width: 750rpx;
|
||||||
justify-content: space-around;
|
justify-content: space-around;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
left: 0;
|
left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item {
|
.item {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
height: 200rpx;
|
height: 200rpx;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* #ifndef APP-NVUE */
|
/* #ifndef APP-NVUE */
|
||||||
@media screen and (min-width: 690px) {
|
@media screen and (min-width: 690px) {
|
||||||
.fab-login-box {
|
.fab-login-box {
|
||||||
max-width: 500px;
|
max-width: 500px;
|
||||||
margin-left: calc(50% - 250px);
|
margin-left: calc(50% - 250px);
|
||||||
@ -539,30 +536,30 @@
|
|||||||
.item {
|
.item {
|
||||||
height: 160rpx;
|
height: 160rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 690px) {
|
@media screen and (max-width: 690px) {
|
||||||
.fab-login-box {
|
.fab-login-box {
|
||||||
bottom: 10rpx;
|
bottom: 10rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* #endif */
|
/* #endif */
|
||||||
|
|
||||||
.logo {
|
.logo {
|
||||||
width: 60rpx;
|
width: 60rpx;
|
||||||
height: 60rpx;
|
height: 60rpx;
|
||||||
max-width: 40px;
|
max-width: 40px;
|
||||||
max-height: 40px;
|
max-height: 40px;
|
||||||
border-radius: 100%;
|
border-radius: 100%;
|
||||||
border: solid 1px #F6F6F6;
|
border: solid 1px #f6f6f6;
|
||||||
}
|
}
|
||||||
|
|
||||||
.login-title {
|
.login-title {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin-top: 6px;
|
margin-top: 6px;
|
||||||
color: #999;
|
color: #999;
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
width: 70px;
|
width: 70px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -39,7 +39,7 @@ export default {
|
|||||||
appid: {
|
appid: {
|
||||||
weixin: {
|
weixin: {
|
||||||
// 微信公众号的appid,来源:登录微信公众号(https://mp.weixin.qq.com)-> 设置与开发 -> 基本配置 -> 公众号开发信息 -> AppID
|
// 微信公众号的appid,来源:登录微信公众号(https://mp.weixin.qq.com)-> 设置与开发 -> 基本配置 -> 公众号开发信息 -> AppID
|
||||||
h5: 'xxxxxx',
|
h5: 'wx9f9b7d747d261686',
|
||||||
// 微信开放平台的appid,来源:登录微信开放平台(https://open.weixin.qq.com) -> 管理中心 -> 网站应用 -> 选择对应的应用名称,点击查看 -> AppID
|
// 微信开放平台的appid,来源:登录微信开放平台(https://open.weixin.qq.com) -> 管理中心 -> 网站应用 -> 选择对应的应用名称,点击查看 -> AppID
|
||||||
web: 'xxxxxx'
|
web: 'xxxxxx'
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,2 +0,0 @@
|
|||||||
## 1.0.0(2024-04-25)
|
|
||||||
- 更新 在 Android 和 iOS 上打开链接的 UTS API
|
|
||||||
@ -1,82 +0,0 @@
|
|||||||
{
|
|
||||||
"id": "uts-openSchema",
|
|
||||||
"displayName": "uts-openSchema",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"description": "在 Android 和 iOS 上打开链接的 UTS API",
|
|
||||||
"keywords": [
|
|
||||||
"uts-openSchema"
|
|
||||||
],
|
|
||||||
"repository": "",
|
|
||||||
"engines": {
|
|
||||||
"HBuilderX": "^4.0"
|
|
||||||
},
|
|
||||||
"dcloudext": {
|
|
||||||
"type": "uts",
|
|
||||||
"sale": {
|
|
||||||
"regular": {
|
|
||||||
"price": "0.00"
|
|
||||||
},
|
|
||||||
"sourcecode": {
|
|
||||||
"price": "0.00"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"contact": {
|
|
||||||
"qq": ""
|
|
||||||
},
|
|
||||||
"declaration": {
|
|
||||||
"ads": "无",
|
|
||||||
"data": "无",
|
|
||||||
"permissions": "无"
|
|
||||||
},
|
|
||||||
"npmurl": ""
|
|
||||||
},
|
|
||||||
"uni_modules": {
|
|
||||||
"dependencies": [],
|
|
||||||
"encrypt": [],
|
|
||||||
"platforms": {
|
|
||||||
"cloud": {
|
|
||||||
"tcb": "y",
|
|
||||||
"aliyun": "y",
|
|
||||||
"alipay": "y"
|
|
||||||
},
|
|
||||||
"client": {
|
|
||||||
"Vue": {
|
|
||||||
"vue2": "n",
|
|
||||||
"vue3": "y"
|
|
||||||
},
|
|
||||||
"App": {
|
|
||||||
"app-android": "y",
|
|
||||||
"app-ios": "y"
|
|
||||||
},
|
|
||||||
"H5-mobile": {
|
|
||||||
"Safari": "n",
|
|
||||||
"Android Browser": "n",
|
|
||||||
"微信浏览器(Android)": "n",
|
|
||||||
"QQ浏览器(Android)": "n"
|
|
||||||
},
|
|
||||||
"H5-pc": {
|
|
||||||
"Chrome": "n",
|
|
||||||
"IE": "n",
|
|
||||||
"Edge": "n",
|
|
||||||
"Firefox": "n",
|
|
||||||
"Safari": "n"
|
|
||||||
},
|
|
||||||
"小程序": {
|
|
||||||
"微信": "n",
|
|
||||||
"阿里": "n",
|
|
||||||
"百度": "n",
|
|
||||||
"字节跳动": "n",
|
|
||||||
"QQ": "n",
|
|
||||||
"钉钉": "n",
|
|
||||||
"快手": "n",
|
|
||||||
"飞书": "n",
|
|
||||||
"京东": "n"
|
|
||||||
},
|
|
||||||
"快应用": {
|
|
||||||
"华为": "n",
|
|
||||||
"联盟": "n"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
# uts-openSchema
|
|
||||||
### 开发文档
|
|
||||||
[UTS 语法](https://uniapp.dcloud.net.cn/tutorial/syntax-uts.html)
|
|
||||||
[UTS API插件](https://uniapp.dcloud.net.cn/plugin/uts-plugin.html)
|
|
||||||
[UTS 组件插件](https://uniapp.dcloud.net.cn/plugin/uts-component.html)
|
|
||||||
[Hello UTS](https://gitcode.net/dcloud/hello-uts)
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"minSdkVersion": "21"
|
|
||||||
}
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
import Intent from 'android.content.Intent'
|
|
||||||
import Uri from 'android.net.Uri'
|
|
||||||
import { OpenSchema } from '../interface.uts'
|
|
||||||
|
|
||||||
export const openSchema: OpenSchema = function (url: string) {
|
|
||||||
if (typeof url === 'string' && url.length > 0) {
|
|
||||||
const context = UTSAndroid.getUniActivity()!
|
|
||||||
const uri = Uri.parse(url)
|
|
||||||
const intent = new Intent(Intent.ACTION_VIEW, uri)
|
|
||||||
intent.setData(uri)
|
|
||||||
context.startActivity(intent)
|
|
||||||
} else {
|
|
||||||
console.error('url param ERROR:', JSON.stringify(url))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"deploymentTarget": "12.0"
|
|
||||||
}
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
import { OpenSchema } from '../interface.uts'
|
|
||||||
|
|
||||||
export const openSchema: OpenSchema = function(url: string): void {
|
|
||||||
if (typeof url == 'string' && url.length > 0) {
|
|
||||||
let uri = new URL(string = url)
|
|
||||||
if (uri != null && UIApplication.shared.canOpenURL(uri!)) {
|
|
||||||
UIApplication.shared.open(uri!, options = new Map<UIApplication.OpenExternalURLOptionsKey, any>(), completionHandler = null)
|
|
||||||
}else {
|
|
||||||
console.error('url param Error: ', url)
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
console.error('url param Error: ', url)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1 +0,0 @@
|
|||||||
export type OpenSchema = (url: string) => void
|
|
||||||