diff --git a/baseapp.config.js b/baseapp.config.js
index c817375d19f7fda488258d46b053f59ab26f216c..16d4af0bff1d8e6eac84933ee5871ed52c3b48c1 100644
--- a/baseapp.config.js
+++ b/baseapp.config.js
@@ -1,7 +1,7 @@
module.exports = {
"h5":{
- "url":"https://static-76ce2c5e-31c7-4d81-8fcf-ed1541ecbc6e.bspapp.com" ,// 前端网页托管的域名
- "openApp":{
+ "url":"https://static-76ce2c5e-31c7-4d81-8fcf-ed1541ecbc6e.bspapp.com",// 前端网页托管的域名
+ "openApp":{ // 在h5端全局悬浮引导用户下载app的功能 更多自定义要求在/common/openApp.js中修改
"openUrl":'https://sj.qq.com/myapp/detail.htm?apkName=com.tencent.android.qqdownloader&info=6646FD239A6EBA9E2DEE5DFC7E18D867',
"appname": 'base-app',
"logo": './static/logo.png',
diff --git a/common/openApp.js b/common/openApp.js
index f12c62396b4a479f8f1e35c1ebbebff6e519b301..b288a7155aa4ce0fdf6866f6c4ab35ca2d2dc450 100644
--- a/common/openApp.js
+++ b/common/openApp.js
@@ -10,15 +10,14 @@ export default function() {
`` : '';
let openApp = document.createElement("div");
openApp.id = 'openApp';
-
openApp.style =
- 'position: fixed;top: 0;left: 0;right: 0;z-index: 999;width: 100%;height: 45px;display: flex;flex-direction: row;justify-content: space-between;align-items: center;box-sizing: border-box;padding: 0 0.5rem;background-color: #FFFFFF;'
+ 'position: fixed;background:#FFFFFF;box-shadow: #eeeeee 1px 1px 9px; ;top: 0;left: 0;right: 0;z-index: 999;width: 100%;height: 45px;display: flex;flex-direction: row;justify-content: space-between;align-items: center;box-sizing: border-box;padding: 0 0.5rem;'
openApp.innerHTML = `
${openLogo}
-
${CONFIG_OPEN.appname || ''}
+
${CONFIG_OPEN.appname || ''}
- 下载app
+ 下载app
`;
document.body.insertBefore(openApp, document.body.firstChild);
document.body.style = 'height:calc(100% - 45px); margin-top:45px;';
diff --git a/pages/ucenter/ucenter.vue b/pages/ucenter/ucenter.vue
index e423edc3c21a4f5ffc8aee41bd4719238dfb36f7..02a4bb5fcf54444c0f05f2c7607c6f5c2135081a 100644
--- a/pages/ucenter/ucenter.vue
+++ b/pages/ucenter/ucenter.vue
@@ -330,6 +330,6 @@
/* #ifdef APP-NVUE */
border-radius: 10rpx;
/* #endif */
- background-color: #DD524D;
+ background-color: #DD524D;
}
diff --git a/uni_modules/opendb-feedback/uniCloud/database/opendb-feedback.schema.json b/uni_modules/opendb-feedback/uniCloud/database/opendb-feedback.schema.json
deleted file mode 100644
index 0decc34aab2a31cb95a10fc2665f98a437493e3c..0000000000000000000000000000000000000000
--- a/uni_modules/opendb-feedback/uniCloud/database/opendb-feedback.schema.json
+++ /dev/null
@@ -1,68 +0,0 @@
-{
- "bsonType": "object",
- "permission": {
- "read": "doc.is_reply == false",
- "create": true,
- "update": false,
- "delete": false
- },
- "properties": {
- "_id": {
- "description": "ID,系统自动生成"
- },
- "user_id": {
- "bsonType": "string",
- "description": "留言反馈用户ID\/回复留言用户ID,参考uni-id-users表",
- "foreignKey": "uni-id-users._id",
- "forceDefaultValue": {
- "$env": "uid"
- }
- },
- "title": {
- "description": "反馈标题(用于列表展示)"
- },
- "ip": {
- "forceDefaultValue": {
- "$env": "clientIP"
- }
- },
- "create_date": {
- "bsonType": "timestamp",
- "description": "留言时间\/回复留言时间",
- "forceDefaultValue": {
- "$env": "now"
- }
- },
- "content": {
- "bsonType": "string",
- "description": "留言内容\/回复内容",
- "trim": "right"
- },
- "imgs": {
- "bsonType": "array",
- "description": "图片列表"
- },
- "is_reply": {
- "bsonType": "bool",
- "description": "是否是回复类型"
- },
- "feedback_id": {
- "bsonType": "string",
- "description": "被回复留言ID"
- },
- "contact": {
- "bsonType": "string",
- "description": "联系人",
- "trim": "both"
- },
- "mobile": {
- "bsonType": "string",
- "description": "联系电话",
- "trim": "both"
- },
- "reply_count": {
- "bsonType": "int",
- "description": "被回复条数"
- }
- }
-}
diff --git a/uni_modules/uni-login-page/uniCloud/cloudfunctions/user-center/index.js b/uni_modules/uni-login-page/uniCloud/cloudfunctions/user-center/index.js
index b9dc949aaaf464875cb10d0b2cc85cf036a41a03..4f765eae1d198331d71ef9934f78f5a12421a447 100644
--- a/uni_modules/uni-login-page/uniCloud/cloudfunctions/user-center/index.js
+++ b/uni_modules/uni-login-page/uniCloud/cloudfunctions/user-center/index.js
@@ -3,23 +3,23 @@ let uniID = require('uni-id')
const uniCaptcha = require('uni-captcha')
const db = uniCloud.database()
const dbCmd = db.command
-exports.main = async (event, context) => {
- /**
- * UNI_WYQ:这里的uniID换成新的,保证多人访问不会冲突
- */
- uniID = uniID.createInstance({
- context
- })
- //event为客户端上传的参数
- console.log('event : ' + JSON.stringify(event))
- let params = event.params || {}
-
+exports.main = async (event, context) => {
+ /**
+ * UNI_WYQ:这里的uniID换成新的,保证多人访问不会冲突
+ */
+ uniID = uniID.createInstance({
+ context
+ })
+ //event为客户端上传的参数
+ console.log('event : ' + JSON.stringify(event))
+ let params = event.params || {}
+
//防止黑客恶意破解登陆,连续登陆失败一定次数后,需要用户提供验证码
- const getNeedCaptcha = async () => {
+ const getNeedCaptcha = async () => {
//当用户最近“2小时内(recordDate)”登陆失败达到2次(recordSize)时。要求用户提交验证码
- const now = Date.now(),
- recordDate = 120 * 60 * 1000,
- recordSize = 2;
+ const now = Date.now(),
+ recordDate = 120 * 60 * 1000,
+ recordSize = 2;
const uniIdLogCollection = db.collection('uni-id-log')
let recentRecord = await uniIdLogCollection.where({
deviceId: params.deviceId || context.DEVICEID,
@@ -31,14 +31,26 @@ exports.main = async (event, context) => {
.get();
return recentRecord.data.filter(item => item.state === 0).length === recordSize;
}
-
+
+ //注册成功后为用户执行相关操作,如创建该用户的积分表等
+ function registerSuccess(uid) {
+ await db.collection('uni-id-scores').add({
+ user_id: uid,
+ score: 1,
+ type: 1,
+ balance: 1,
+ comment: "",
+ create_date: Date.now()
+ })
+ }
+
//设置某些模块不需要token(也就是登陆成功后)才能操作,如果需要token就获取当前操作账户的uid
let noCheckAction = [
- 'register', 'checkToken','login', 'logout', 'sendSmsCode',
- 'createCaptcha', 'verifyCaptcha','refreshCaptcha', 'inviteLogin',
- 'login_by_weixin','login_by_univerify','login_by_apple','loginBySms','resetPwdBySmsCode'
- ]
- let payload;
+ 'register', 'checkToken', 'login', 'logout', 'sendSmsCode',
+ 'createCaptcha', 'verifyCaptcha', 'refreshCaptcha', 'inviteLogin',
+ 'login_by_weixin', 'login_by_univerify', 'login_by_apple', 'loginBySms', 'resetPwdBySmsCode'
+ ]
+ let payload;
console.log(event.action);
if (!noCheckAction.includes(event.action)) {
if (!event.uniIdToken) {
@@ -46,93 +58,117 @@ exports.main = async (event, context) => {
code: 403,
msg: '缺少token'
}
- }
+ }
payload = await uniID.checkToken(event.uniIdToken)
if (payload.code && payload.code > 0) {
return payload
}
params.uid = payload.uid
- }
-
-
- //记录成功登陆的日志
- const loginLog = async (res = {}, type = 'login') => {
- const now = Date.now()
- const uniIdLogCollection = db.collection('uni-id-log')
- let logData = {
- deviceId: params.deviceId || context.DEVICEID,
- ip: params.ip || context.CLIENTIP,
- type,
- ua: context.CLIENTUA,
- create_date: now
- };
-
- Object.assign(logData,
- res.code === 0 ? {
- user_id: res.uid,
- state: 1
- } : {
- state: 0
- })
-
- return uniIdLogCollection.add(logData)
}
-
-
+
+
+ //记录成功登陆的日志
+ const loginLog = async (res = {}, type = 'login') => {
+ const now = Date.now()
+ const uniIdLogCollection = db.collection('uni-id-log')
+ let logData = {
+ deviceId: params.deviceId || context.DEVICEID,
+ ip: params.ip || context.CLIENTIP,
+ type,
+ ua: context.CLIENTUA,
+ create_date: now
+ };
+
+ Object.assign(logData,
+ res.code === 0 ? {
+ user_id: res.uid,
+ state: 1
+ } : {
+ state: 0
+ })
+
+ return uniIdLogCollection.add(logData)
+ }
+
+
let res = {}
switch (event.action) {
- case 'register':
- let {username,password,gender,nickname} = params
- if(/^1\d{10}$/.test(username)){
- return {
- code: 401,
- msg: '用户名不能是手机号'
- }
- };
- if(/^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/.test(username)){
- return {
- code: 401,
- msg: '用户名不能是邮箱'
- }
- }
- res = await uniID.register({username,password,gender,nickname,password});
+ case 'register':
+ let {
+ username, password, gender, nickname
+ } = params
+ if (/^1\d{10}$/.test(username)) {
+ return {
+ code: 401,
+ msg: '用户名不能是手机号'
+ }
+ };
+ if (/^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/.test(username)) {
+ return {
+ code: 401,
+ msg: '用户名不能是邮箱'
+ }
+ }
+ res = await uniID.register({
+ username,
+ password,
+ gender,
+ nickname,
+ password
+ });
+ if (res.code === 0) {
+ registerSuccess(res.uid)
+ }
break;
case 'login':
let passed = false;
let needCaptcha = await getNeedCaptcha();
-
+
if (needCaptcha) {
res = await uniCaptcha.verify(params)
if (res.code === 0) passed = true;
}
-
+
if (!needCaptcha || passed) {
- res = await uniID.login({
- ...params,
- queryField: ['username', 'email', 'mobile']
+ res = await uniID.login({
+ ...params,
+ queryField: ['username', 'email', 'mobile']
});
await loginLog(res);
+ if (res.code == 0 && res.type == 'register') {
+ registerSuccess(res.uid)
+ }
+
needCaptcha = await getNeedCaptcha();
}
-
+
res.needCaptcha = needCaptcha;
- break;
- case 'login_by_weixin':
- res = await uniID.loginByWeixin(params);
- await uniID.updateUser({
- uid: params.uid,
- username:"微信用户"
+ break;
+ case 'login_by_weixin':
+ res = await uniID.loginByWeixin(params);
+ await uniID.updateUser({
+ uid: res.uid,
+ username: "微信用户"
});
- res.userInfo.username = "微信用户"
- loginLog(res)
- break;
- case 'login_by_univerify':
+ if (res.code == 0 && res.type == 'register') {
+ registerSuccess(res.uid)
+ }
+ res.userInfo.username = "微信用户"
+ loginLog(res)
+ break;
+ case 'login_by_univerify':
res = await uniID.loginByUniverify(params)
- break;
- case 'login_by_apple':
+ if (res.code == 0 && res.type == 'register') {
+ registerSuccess(res.uid)
+ }
+ break;
+ case 'login_by_apple':
res = await uniID.loginByApple(params)
- loginLog(res)
+ if (res.code == 0 && res.type == 'register') {
+ registerSuccess(res.uid)
+ }
+ loginLog(res)
break;
case 'checkToken':
res = await uniID.checkToken(event.uniIdToken);
@@ -166,7 +202,10 @@ exports.main = async (event, context) => {
code,
type: params.type,
templateId
- })
+ })
+ if (res.code == 0 && res.type == 'register') {
+ registerSuccess(res.uid)
+ }
break;
case 'loginBySms':
if (!params.code) {
@@ -181,7 +220,10 @@ exports.main = async (event, context) => {
msg: '手机号码填写错误'
}
}
- res = await uniID.loginBySms(params)
+ res = await uniID.loginBySms(params)
+ if (res.code == 0 && res.type == 'register') {
+ registerSuccess(res.uid)
+ }
loginLog(res)
break;
case 'inviteLogin':
@@ -194,28 +236,34 @@ exports.main = async (event, context) => {
res = await uniID.loginBySms({
...params,
type: 'register'
- })
- break;
- case 'resetPwdBySmsCode':
- if (!params.code) {
- return {
- code: 500,
- msg: '请填写验证码'
- }
- }
- if (!/^1\d{10}$/.test(params.mobile)) {
- return {
- code: 500,
- msg: '手机号码填写错误'
- }
- }
- let loginBySmsRes = await uniID.loginBySms(params)
- console.log(loginBySmsRes);
- if(loginBySmsRes.code === 0){
- res = await uniID.resetPwd({password:params.password,"uid":loginBySmsRes.uid})
- }else{
- return loginBySmsRes
- }
+ })
+ if (res.code == 0 && res.type == 'register') {
+ registerSuccess(res.uid)
+ }
+ break;
+ case 'resetPwdBySmsCode':
+ if (!params.code) {
+ return {
+ code: 500,
+ msg: '请填写验证码'
+ }
+ }
+ if (!/^1\d{10}$/.test(params.mobile)) {
+ return {
+ code: 500,
+ msg: '手机号码填写错误'
+ }
+ }
+ let loginBySmsRes = await uniID.loginBySms(params)
+ console.log(loginBySmsRes);
+ if (loginBySmsRes.code === 0) {
+ res = await uniID.resetPwd({
+ password: params.password,
+ "uid": loginBySmsRes.uid
+ })
+ } else {
+ return loginBySmsRes
+ }
break;
case 'getInviteCode':
res = await uniID.getUserInfo({
@@ -241,7 +289,7 @@ exports.main = async (event, context) => {
break;
case 'refreshCaptcha':
res = await uniCaptcha.refresh(params)
- break;
+ break;
default:
res = {
code: 403,
diff --git a/uni_modules/uni-news-favorite/pages/uni-news-favorite/add.vue b/uni_modules/uni-news-favorite/pages/uni-news-favorite/add.vue
deleted file mode 100644
index 21d6e0b2f1f09b70a2c7be42f64e05e612db96c3..0000000000000000000000000000000000000000
--- a/uni_modules/uni-news-favorite/pages/uni-news-favorite/add.vue
+++ /dev/null
@@ -1,129 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/uni_modules/uni-news-favorite/pages/uni-news-favorite/detail.vue b/uni_modules/uni-news-favorite/pages/uni-news-favorite/detail.vue
deleted file mode 100644
index c973d837894e2a6d79a163bb0f770823b69ab355..0000000000000000000000000000000000000000
--- a/uni_modules/uni-news-favorite/pages/uni-news-favorite/detail.vue
+++ /dev/null
@@ -1,101 +0,0 @@
-
-
-
- {{error.message}}
-
-
-
-
-
- article_id:
- {{data.article_id}}
-
-
- create_date:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/uni_modules/uni-news-favorite/pages/uni-news-favorite/edit.vue b/uni_modules/uni-news-favorite/pages/uni-news-favorite/edit.vue
deleted file mode 100644
index 0dfa6de59527c6ade2e9df7db753c18c6a37d4b0..0000000000000000000000000000000000000000
--- a/uni_modules/uni-news-favorite/pages/uni-news-favorite/edit.vue
+++ /dev/null
@@ -1,156 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-