update 福恋重构初始化
9
.editorconfig
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
1
.eslintignore
Normal file
@ -0,0 +1 @@
|
|||||||
|
dist/*
|
||||||
50
.eslintrc.js
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
module.exports = {
|
||||||
|
root: true,
|
||||||
|
parser: 'babel-eslint',
|
||||||
|
parserOptions: {
|
||||||
|
sourceType: 'module'
|
||||||
|
|
||||||
|
},
|
||||||
|
env: {
|
||||||
|
browser: true
|
||||||
|
},
|
||||||
|
// https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
|
||||||
|
extends: 'standard',
|
||||||
|
// required to lint *.wpy files
|
||||||
|
plugins: [
|
||||||
|
'html'
|
||||||
|
],
|
||||||
|
settings: {
|
||||||
|
'html/html-extensions': ['.html', '.wpy']
|
||||||
|
},
|
||||||
|
// add your custom rules here
|
||||||
|
'rules': {
|
||||||
|
'indent': 'off',
|
||||||
|
'eqeqeq': 0,
|
||||||
|
'no-fallthrough': 0,
|
||||||
|
'no-duplicate-imports': 0,
|
||||||
|
// allow paren-less arrow functions
|
||||||
|
'arrow-parens': 0,
|
||||||
|
// allow async-await
|
||||||
|
'generator-star-spacing': 0,
|
||||||
|
'camelcase': 0,
|
||||||
|
'no-return-assign': 0,
|
||||||
|
// allow debugger during development
|
||||||
|
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
|
||||||
|
'one-var': 0,
|
||||||
|
// "yoda": [0, "never"],
|
||||||
|
'no-unused-expressions': 0,
|
||||||
|
'no-unneeded-ternary': 0,
|
||||||
|
'no-undef': 0,
|
||||||
|
'space-before-function-paren': 0,
|
||||||
|
'no-unused-vars': [0, {
|
||||||
|
// 允许声明未使用变量
|
||||||
|
'vars': 'local',
|
||||||
|
// 参数不检查
|
||||||
|
'args': 'none'
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
globals: {
|
||||||
|
wx: true
|
||||||
|
}
|
||||||
|
}
|
||||||
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
weapp
|
||||||
|
.DS_Store
|
||||||
5
.idea/.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# 默认忽略的文件
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# 基于编辑器的 HTTP 客户端请求
|
||||||
|
/httpRequests/
|
||||||
25
.idea/codeStyles/Project.xml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<code_scheme name="Project" version="173">
|
||||||
|
<JSCodeStyleSettings version="0">
|
||||||
|
<option name="USE_SEMICOLON_AFTER_STATEMENT" value="false" />
|
||||||
|
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
||||||
|
<option name="SPACE_BEFORE_GENERATOR_MULT" value="true" />
|
||||||
|
<option name="USE_DOUBLE_QUOTES" value="false" />
|
||||||
|
<option name="FORCE_QUOTE_STYlE" value="true" />
|
||||||
|
<option name="ENFORCE_TRAILING_COMMA" value="Remove" />
|
||||||
|
</JSCodeStyleSettings>
|
||||||
|
<codeStyleSettings language="JavaScript">
|
||||||
|
<option name="BLOCK_COMMENT_ADD_SPACE" value="true" />
|
||||||
|
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
|
||||||
|
<option name="ALIGN_MULTILINE_PARAMETERS" value="false" />
|
||||||
|
<option name="ALIGN_MULTILINE_FOR" value="false" />
|
||||||
|
<option name="IF_BRACE_FORCE" value="1" />
|
||||||
|
<option name="DOWHILE_BRACE_FORCE" value="1" />
|
||||||
|
<option name="WHILE_BRACE_FORCE" value="1" />
|
||||||
|
<option name="FOR_BRACE_FORCE" value="1" />
|
||||||
|
<indentOptions>
|
||||||
|
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
||||||
|
</indentOptions>
|
||||||
|
</codeStyleSettings>
|
||||||
|
</code_scheme>
|
||||||
|
</component>
|
||||||
5
.idea/codeStyles/codeStyleConfig.xml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<state>
|
||||||
|
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||||
|
</state>
|
||||||
|
</component>
|
||||||
6
.idea/inspectionProfiles/Project_Default.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
</profile>
|
||||||
|
</component>
|
||||||
6
.idea/jsLibraryMappings.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="JavaScriptLibraryMappings">
|
||||||
|
<excludedPredefinedLibrary name="wechat-mini-program-api" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
8
.idea/jsLinters/eslint.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="EslintConfiguration">
|
||||||
|
<custom-configuration-file used="true" path="$PROJECT_DIR$/.eslintrc.js" />
|
||||||
|
<files-pattern value="{**/*,*}.{js,ts,jsx,tsx,html,vue,wpy,wxs}" />
|
||||||
|
<option name="fix-on-save" value="true" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
.idea/misc.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="JavaScriptSettings">
|
||||||
|
<option name="languageLevel" value="ES6" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
8
.idea/modules.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/myproj.iml" filepath="$PROJECT_DIR$/.idea/myproj.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
12
.idea/myproj.iml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="WEB_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
7
.idea/vagrant.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VagrantProjectSettings">
|
||||||
|
<option name="instanceFolder" value="" />
|
||||||
|
<option name="provider" value="" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
3
.prettierrc
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"singleQuote": true
|
||||||
|
}
|
||||||
1
.wepycache
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"E:\\code\\mine\\js\\wepy_group\\wepy_templates\\templates\\standard\\node_modules\\wepy\\lib\\wepy.js":1508932485000,"E:\\code\\mine\\js\\wepy_group\\wepy_templates\\templates\\standard\\node_modules\\wepy-async-function\\index.js":1487759227000,"E:\\code\\mine\\js\\wepy_group\\wepy_templates\\templates\\standard\\node_modules\\wepy-com-toast\\toast.wpy":1488432898000,"E:\\code\\mine\\js\\wepy_group\\wepy_templates\\templates\\standard\\node_modules\\wepy\\lib\\app.js":1508932484000,"E:\\code\\mine\\js\\wepy_group\\wepy_templates\\templates\\standard\\node_modules\\wepy\\lib\\page.js":1508932485000,"E:\\code\\mine\\js\\wepy_group\\wepy_templates\\templates\\standard\\node_modules\\wepy\\lib\\component.js":1508932485000,"E:\\code\\mine\\js\\wepy_group\\wepy_templates\\templates\\standard\\node_modules\\wepy\\lib\\event.js":1508932485000,"E:\\code\\mine\\js\\wepy_group\\wepy_templates\\templates\\standard\\node_modules\\wepy\\lib\\base.js":1508932484000,"E:\\code\\mine\\js\\wepy_group\\wepy_templates\\templates\\standard\\node_modules\\wepy\\lib\\base.js":1508932485000,"E:\\code\\mine\\js\\wepy_group\\wepy_templates\\templates\\standard\\node_modules\\wepy\\lib\\mixin.js":1508932485000,"E:\\code\\mine\\js\\wepy_group\\wepy_templates\\templates\\standard\\node_modules\\wepy-async-function\\global.js":1487760749000,"E:\\code\\mine\\js\\wepy_group\\wepy_templates\\templates\\standard\\node_modules\\promise-polyfill\\promise.js":1511627065000,"E:\\code\\mine\\js\\wepy_group\\wepy_templates\\templates\\standard\\node_modules\\regenerator-runtime\\runtime.js":1493390741000,"E:\\code\\mine\\js\\wepy_group\\wepy_templates\\templates\\standard\\node_modules\\wepy\\lib\\native.js":1508932485000}
|
||||||
4
.wepyignore
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
.DS_Store
|
||||||
|
*.wpy___jb_tmp___
|
||||||
6854
package-lock.json
generated
Normal file
46
package.json
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"name": "ufutx_dma",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"description": "A WePY project",
|
||||||
|
"main": "weapp/app.js",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "./node_modules/.bin/wepy build --watch",
|
||||||
|
"build": "cross-env NODE_ENV=production ./node_modules/.bin/wepy build --no-cache",
|
||||||
|
"clean": "rm -rf weapp",
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"wepy": {
|
||||||
|
"module-a": false,
|
||||||
|
"./src/components/list": "./src/components/wepy-list.wpy"
|
||||||
|
},
|
||||||
|
"author": "mamba <dengzhifeng_63@163.com>",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@wepy/core": "^2.0.0-alpha.16",
|
||||||
|
"@wepy/use-promisify": "^2.1.0",
|
||||||
|
"@wepy/x": "^2.0.2",
|
||||||
|
"@yolanda-qn/four-electrodes-report-lib-pe": "^1.1.5",
|
||||||
|
"dayjs": "^1.11.7",
|
||||||
|
"miniprogram-slide-view": "0.0.3",
|
||||||
|
"nim-web-sdk-ng": "^10.3.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@babel/core": "^7.1.0",
|
||||||
|
"@babel/preset-env": "^7.1.0",
|
||||||
|
"@wepy/babel-plugin-import-regenerator": "0.0.2",
|
||||||
|
"@wepy/cli": "^2.0.0-alpha.28",
|
||||||
|
"@wepy/compiler-babel": "^2.0.1",
|
||||||
|
"@wepy/compiler-less": "^2.0.1",
|
||||||
|
"babel-eslint": "^7.2.1",
|
||||||
|
"cross-env": "^5.1.3",
|
||||||
|
"eslint": "^3.18.0",
|
||||||
|
"eslint-config-standard": "^7.1.0",
|
||||||
|
"eslint-friendly-formatter": "^2.0.7",
|
||||||
|
"eslint-plugin-html": "^2.0.1",
|
||||||
|
"eslint-plugin-promise": "^3.5.0",
|
||||||
|
"eslint-plugin-standard": "^2.0.1",
|
||||||
|
"less": "^3.8.1",
|
||||||
|
"wepy-cli-extend": "^1.0.3",
|
||||||
|
"wepy-eslint": "^1.5.3"
|
||||||
|
}
|
||||||
|
}
|
||||||
30
project.config.json
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"description": "A WePY project",
|
||||||
|
"setting": {
|
||||||
|
"urlCheck": true,
|
||||||
|
"es6": true,
|
||||||
|
"postcss": true,
|
||||||
|
"minified": true,
|
||||||
|
"babelSetting": {
|
||||||
|
"ignore": [],
|
||||||
|
"disablePlugins": [],
|
||||||
|
"outputPath": ""
|
||||||
|
},
|
||||||
|
"condition": false,
|
||||||
|
"enhance": true
|
||||||
|
},
|
||||||
|
"compileType": "miniprogram",
|
||||||
|
"appid": "wxe486777f4379507e",
|
||||||
|
"projectname": "myproj",
|
||||||
|
"miniprogramRoot": "weapp/",
|
||||||
|
"srcMiniprogramRoot": "weapp/",
|
||||||
|
"packOptions": {
|
||||||
|
"ignore": [],
|
||||||
|
"include": []
|
||||||
|
},
|
||||||
|
"condition": {},
|
||||||
|
"editorSetting": {
|
||||||
|
"tabIndent": "insertSpaces",
|
||||||
|
"tabSize": 2
|
||||||
|
}
|
||||||
|
}
|
||||||
217
src/app.wpy
Normal file
@ -0,0 +1,217 @@
|
|||||||
|
<style lang="less">
|
||||||
|
@import './styles/index.less';
|
||||||
|
|
||||||
|
.container {
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
background: red;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script>
|
||||||
|
import wepy from '@wepy/core'
|
||||||
|
import vuex from '@wepy/x'
|
||||||
|
import promisify from '@wepy/use-promisify'
|
||||||
|
import { wx_login } from './utils/util'
|
||||||
|
import { IM } from './utils/im'
|
||||||
|
import {service} from './config'
|
||||||
|
|
||||||
|
wepy.use(promisify)
|
||||||
|
wepy.use(vuex)
|
||||||
|
|
||||||
|
wepy.app({
|
||||||
|
hooks: {
|
||||||
|
// App 级别 hook,对整个 App 生效
|
||||||
|
// 同时存在 Page hook 和 App hook 时,优先执行 Page hook,返回值再交由 App hook 处
|
||||||
|
'before-setData': function (dirty) {
|
||||||
|
// console.log('setData dirty: ', dirty)
|
||||||
|
return dirty
|
||||||
|
}
|
||||||
|
},
|
||||||
|
globalData: {
|
||||||
|
versions: 'v1.0.84', // 版本号
|
||||||
|
navBarHeight: 0, // 导航栏高度
|
||||||
|
navRight: 0, // 胶囊距右方间距(方保持左、右间距一致)
|
||||||
|
navTop: 0, // 胶囊距顶部间距
|
||||||
|
navHeight: 0, // 胶囊高度(自定义内容可与胶囊高度保证一致)
|
||||||
|
userInfo: null,
|
||||||
|
uploadData: null,
|
||||||
|
nim: null,
|
||||||
|
APPID: 'wxe486777f4379507e',
|
||||||
|
bottomHeight: 0 // 底部小黑条的高度
|
||||||
|
},
|
||||||
|
|
||||||
|
onLaunch() {
|
||||||
|
let vm = this
|
||||||
|
vm.appLogin()
|
||||||
|
wx.getSystemInfo({
|
||||||
|
success: res => {
|
||||||
|
vm.$options.globalData.bottomHeight = res.screenHeight - res.safeArea.bottom
|
||||||
|
vm.$options.globalData.StatusBar = res.statusBarHeight
|
||||||
|
let capsule = wx.getMenuButtonBoundingClientRect()
|
||||||
|
if (capsule) {
|
||||||
|
vm.$options.globalData.Custom = capsule
|
||||||
|
vm.$options.globalData.CustomBar = capsule.bottom + capsule.top - res.statusBarHeight
|
||||||
|
} else {
|
||||||
|
vm.$options.globalData.CustomBar = res.statusBarHeight + 50
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail(err) {
|
||||||
|
console.log(err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// 获取系统信息
|
||||||
|
const systemInfo = wx.getSystemInfoSync()
|
||||||
|
// 胶囊按钮位置信息
|
||||||
|
const menuButtonInfo = wx.getMenuButtonBoundingClientRect()
|
||||||
|
// 导航栏高度 = 状态栏高度 + 44
|
||||||
|
vm.$options.globalData.navBarHeight = systemInfo.statusBarHeight + 44
|
||||||
|
vm.$options.globalData.navRight = systemInfo.screenWidth - menuButtonInfo.right
|
||||||
|
vm.$options.globalData.navTop = menuButtonInfo.top
|
||||||
|
vm.$options.globalData.navHeight = menuButtonInfo.height
|
||||||
|
},
|
||||||
|
|
||||||
|
onShow(options) {
|
||||||
|
console.log('路径携带参数:', options)
|
||||||
|
if (options.query.scene) {
|
||||||
|
let sceneList = decodeURIComponent(options.query.scene).split(/[= &]/)
|
||||||
|
sceneList.forEach((item, index) => {
|
||||||
|
if (item == 'userId') {
|
||||||
|
wx.setStorageSync('agent_user_id', sceneList[index + 1])
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (options.query && options.query.from_user_id) {
|
||||||
|
wx.setStorageSync('from_user_id', options.query.from_user_id)
|
||||||
|
} else {
|
||||||
|
if (options.path && options.path === 'pages/sub_mall/confirmOrder') {
|
||||||
|
} else {
|
||||||
|
wx.removeStorageSync('from_user_id')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
onHide() {},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
appLogin() {
|
||||||
|
let vm = this
|
||||||
|
wx_login().then((e) => {
|
||||||
|
wx.hideLoading()
|
||||||
|
let {accid, token} = e.data.user.wyy_user
|
||||||
|
vm.$options.globalData.nim = IM(accid, token)
|
||||||
|
}).catch((msg) => {
|
||||||
|
wx.showModal({ // 使用模态框提示用户进行操作
|
||||||
|
title: '温馨提示:',
|
||||||
|
content: `${msg}`,
|
||||||
|
showCancel: false,
|
||||||
|
success: function (res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
wx.navigateBack({
|
||||||
|
delta: 1
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<config>
|
||||||
|
{
|
||||||
|
pages: [
|
||||||
|
'pages/tabBar/welcome',
|
||||||
|
'pages/tabBar/home',
|
||||||
|
'pages/tabBar/news',
|
||||||
|
'pages/tabBar/user',
|
||||||
|
'pages/login',
|
||||||
|
],
|
||||||
|
'permission': {
|
||||||
|
'scope.userFuzzyLocation': {
|
||||||
|
'desc': '你的位置信息将用于小程序位置接口的效果展示'
|
||||||
|
},
|
||||||
|
'scope.userLocation': {
|
||||||
|
'desc': '你的位置信息将用于小程序位置接口的效果展示'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
subPackages: [
|
||||||
|
{
|
||||||
|
'root': 'pages/home',
|
||||||
|
'pages': [
|
||||||
|
'information',
|
||||||
|
'qualitySingle',
|
||||||
|
'registration',
|
||||||
|
'searchCondition',
|
||||||
|
'searchUsers',
|
||||||
|
'singleSquare',
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'root': 'pages/news',
|
||||||
|
'pages': [
|
||||||
|
'chitchat',
|
||||||
|
'friendRequest',
|
||||||
|
'groupChitchat',
|
||||||
|
'groupChitchatDetail',
|
||||||
|
'review',
|
||||||
|
'systemNews',
|
||||||
|
'visitor',
|
||||||
|
]
|
||||||
|
},
|
||||||
|
],
|
||||||
|
window: {
|
||||||
|
backgroundTextStyle: 'light',
|
||||||
|
navigationBarBackgroundColor: '#fff',
|
||||||
|
navigationBarTitleText: 'WeChat',
|
||||||
|
navigationBarTextStyle: 'black'
|
||||||
|
},
|
||||||
|
tabBar: {
|
||||||
|
color: '#999999',
|
||||||
|
selectedColor: '#5AC7A0',
|
||||||
|
backgroundColor: '#ffffff',
|
||||||
|
borderStyle: 'black',
|
||||||
|
list: [
|
||||||
|
{
|
||||||
|
pagePath: 'pages/tabBar/home',
|
||||||
|
iconPath: './images/tabbar/inactiveHome.png',
|
||||||
|
selectedIconPath: './images/tabbar/activeHome.png',
|
||||||
|
text: '健康'
|
||||||
|
}, {
|
||||||
|
pagePath: 'pages/tabBar/news',
|
||||||
|
iconPath: './images/tabbar/inactiveServe.png',
|
||||||
|
selectedIconPath: './images/tabbar/activeServe.png',
|
||||||
|
text: '商城'
|
||||||
|
}, {
|
||||||
|
pagePath: 'pages/tabBar/user',
|
||||||
|
iconPath: './images/tabbar/inactiveMy.png',
|
||||||
|
selectedIconPath: './images/tabbar/activeMy.png',
|
||||||
|
text: '我的'
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
useExtendedLib: {
|
||||||
|
'weui': true
|
||||||
|
},
|
||||||
|
plugins: {
|
||||||
|
"QNBleApi": {
|
||||||
|
"version": "4.7.1",
|
||||||
|
"provider": "wx2a4ca48ed5e96748"
|
||||||
|
},
|
||||||
|
"FL-plugin": {
|
||||||
|
"version": "0.0.3",
|
||||||
|
"provider": "wxc41491431733671e"
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"miniApp": {
|
||||||
|
"useAuthorizePage": true
|
||||||
|
},
|
||||||
|
"lazyCodeLoading": "requiredComponents",
|
||||||
|
'requiredPrivateInfos': [
|
||||||
|
'chooseAddress',
|
||||||
|
'getFuzzyLocation',
|
||||||
|
'chooseLocation'
|
||||||
|
],
|
||||||
|
}
|
||||||
|
</config>
|
||||||
5
src/common/eventHub.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import wepy from '@wepy/core';
|
||||||
|
|
||||||
|
let eventHub = new wepy();
|
||||||
|
|
||||||
|
export default eventHub;
|
||||||
105
src/components/chatEmojiFile/ChatEmoji.wpy
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
<template>
|
||||||
|
<view class="m_chat_emoji">
|
||||||
|
<view class="emoji-content">
|
||||||
|
<scroll-view scroll-y style="width: 100%;height: 100%;">
|
||||||
|
<view>
|
||||||
|
<view class="cnt">
|
||||||
|
<span class="emoji-item {{item.type==='pinup'?'pinup-item':''}}" v-for="(item,index) in emojiArray.list" :key="index" @tap="selectEmoji(item)">
|
||||||
|
<image mode="aspectFit" lazy-load="true" src="{{item.img}}"/>
|
||||||
|
</span>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import wepy from '@wepy/core'
|
||||||
|
import https from '../../mixins/https'
|
||||||
|
import base from '../../mixins/base'
|
||||||
|
import emojiObj from './emoji'
|
||||||
|
|
||||||
|
wepy.component({
|
||||||
|
config: {},
|
||||||
|
mixins: [https, base],
|
||||||
|
props: {
|
||||||
|
emojiArray: {
|
||||||
|
type: Object,
|
||||||
|
default: {},
|
||||||
|
twoWay: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
selectEmoji(emoji) {
|
||||||
|
this.$emit('selectEmoji', emoji.key)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less">
|
||||||
|
.m_chat_emoji {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 400rpx;
|
||||||
|
display: block;
|
||||||
|
.emoji-channel {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 16rpx;
|
||||||
|
z-index: 9;
|
||||||
|
width: 100%;
|
||||||
|
display: block;
|
||||||
|
background-color: #fff;
|
||||||
|
.emoji-album {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 10rpx;
|
||||||
|
width: 1.8rem;
|
||||||
|
height: 1.8rem;
|
||||||
|
border-right: 1px solid #f0f0f0;
|
||||||
|
image {
|
||||||
|
margin: 0;
|
||||||
|
display: block;
|
||||||
|
width: inherit;
|
||||||
|
height: inherit;
|
||||||
|
}
|
||||||
|
&.active {
|
||||||
|
background-color: #f0f0f0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.emoji-content {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
padding-top: 6px;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
.cnt {
|
||||||
|
display: grid;
|
||||||
|
justify-content: left;
|
||||||
|
align-items: center;
|
||||||
|
gap: 20rpx;
|
||||||
|
grid-template-columns: repeat(auto-fill, 68rpx);
|
||||||
|
padding-bottom: 22rpx;
|
||||||
|
border-bottom: 2rpx solid #EDEDED;
|
||||||
|
}
|
||||||
|
.emoji-item {
|
||||||
|
display: inline-block;
|
||||||
|
width: 68rpx;
|
||||||
|
height: 68rpx;
|
||||||
|
vertical-align: middle;
|
||||||
|
image {
|
||||||
|
width: inherit;
|
||||||
|
height: inherit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.pinup-item {
|
||||||
|
width: 94rpx;
|
||||||
|
height: 94rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
183
src/components/chatEmojiFile/emoji.js
Normal file
@ -0,0 +1,183 @@
|
|||||||
|
/* 表情原图配置文件 */
|
||||||
|
// import config from './index'
|
||||||
|
|
||||||
|
let emojiBaseUrl = `https://ufutx-image.oss-cn-shenzhen.aliyuncs.com`
|
||||||
|
// let emojiBaseUrl = `http://yx-web.nosdn.127.net/webdoc/h5/emoji`
|
||||||
|
|
||||||
|
// let emojiList = {
|
||||||
|
// 'emoji': {
|
||||||
|
// '[大笑]': {file: 'emoji_0.png'}, '[可爱]': {file: 'emoji_01.png'}, '[色]': {file: 'emoji_02.png'}, '[嘘]': {file: 'emoji_03.png'}, '[亲]': {file: 'emoji_04.png'}, '[呆]': {file: 'emoji_05.png'}, '[口水]': {file: 'emoji_06.png'}, '[汗]': {file: 'emoji_145.png'}, '[呲牙]': {file: 'emoji_07.png'}, '[鬼脸]': {file: 'emoji_08.png'}, '[害羞]': {file: 'emoji_09.png'}, '[偷笑]': {file: 'emoji_10.png'}, '[调皮]': {file: 'emoji_11.png'}, '[可怜]': {file: 'emoji_12.png'}, '[敲]': {file: 'emoji_13.png'}, '[惊讶]': {file: 'emoji_14.png'}, '[流感]': {file: 'emoji_15.png'}, '[委屈]': {file: 'emoji_16.png'}, '[流泪]': {file: 'emoji_17.png'}, '[嚎哭]': {file: 'emoji_18.png'}, '[惊恐]': {file: 'emoji_19.png'}, '[怒]': {file: 'emoji_20.png'}, '[酷]': {file: 'emoji_21.png'}, '[不说]': {file: 'emoji_22.png'}, '[鄙视]': {file: 'emoji_23.png'}, '[阿弥陀佛]': {file: 'emoji_24.png'}, '[奸笑]': {file: 'emoji_25.png'}, '[睡着]': {file: 'emoji_26.png'}, '[口罩]': {file: 'emoji_27.png'}, '[努力]': {file: 'emoji_28.png'}, '[抠鼻孔]': {file: 'emoji_29.png'}, '[疑问]': {file: 'emoji_30.png'}, '[怒骂]': {file: 'emoji_31.png'}, '[晕]': {file: 'emoji_32.png'}, '[呕吐]': {file: 'emoji_33.png'}, '[拜一拜]': {file: 'emoji_160.png'}, '[惊喜]': {file: 'emoji_161.png'}, '[流汗]': {file: 'emoji_162.png'}, '[卖萌]': {file: 'emoji_163.png'}, '[默契眨眼]': {file: 'emoji_164.png'}, '[烧香拜佛]': {file: 'emoji_165.png'}, '[晚安]': {file: 'emoji_166.png'}, '[强]': {file: 'emoji_34.png'}, '[弱]': {file: 'emoji_35.png'}, '[OK]': {file: 'emoji_36.png'}, '[拳头]': {file: 'emoji_37.png'}, '[胜利]': {file: 'emoji_38.png'}, '[鼓掌]': {file: 'emoji_39.png'}, '[握手]': {file: 'emoji_200.png'}, '[发怒]': {file: 'emoji_40.png'}, '[骷髅]': {file: 'emoji_41.png'}, '[便便]': {file: 'emoji_42.png'}, '[火]': {file: 'emoji_43.png'}, '[溜]': {file: 'emoji_44.png'}, '[爱心]': {file: 'emoji_45.png'}, '[心碎]': {file: 'emoji_46.png'}, '[钟情]': {file: 'emoji_47.png'}, '[唇]': {file: 'emoji_48.png'}, '[戒指]': {file: 'emoji_49.png'}, '[钻石]': {file: 'emoji_50.png'}, '[太阳]': {file: 'emoji_51.png'}, '[有时晴]': {file: 'emoji_52.png'}, '[多云]': {file: 'emoji_53.png'}, '[雷]': {file: 'emoji_54.png'}, '[雨]': {file: 'emoji_55.png'}, '[雪花]': {file: 'emoji_56.png'}, '[爱人]': {file: 'emoji_57.png'}, '[帽子]': {file: 'emoji_58.png'}, '[皇冠]': {file: 'emoji_59.png'}, '[篮球]': {file: 'emoji_60.png'}, '[足球]': {file: 'emoji_61.png'}, '[垒球]': {file: 'emoji_62.png'}, '[网球]': {file: 'emoji_63.png'}, '[台球]': {file: 'emoji_64.png'}, '[咖啡]': {file: 'emoji_65.png'}, '[啤酒]': {file: 'emoji_66.png'}, '[干杯]': {file: 'emoji_67.png'}, '[柠檬汁]': {file: 'emoji_68.png'}, '[餐具]': {file: 'emoji_69.png'}, '[汉堡]': {file: 'emoji_70.png'}, '[鸡腿]': {file: 'emoji_71.png'}, '[面条]': {file: 'emoji_72.png'}, '[冰淇淋]': {file: 'emoji_73.png'}, '[沙冰]': {file: 'emoji_74.png'}, '[生日蛋糕]': {file: 'emoji_75.png'}, '[蛋糕]': {file: 'emoji_76.png'}, '[糖果]': {file: 'emoji_77.png'}, '[葡萄]': {file: 'emoji_78.png'}, '[西瓜]': {file: 'emoji_79.png'}, '[光碟]': {file: 'emoji_80.png'}, '[手机]': {file: 'emoji_81.png'}, '[电话]': {file: 'emoji_82.png'}, '[电视]': {file: 'emoji_83.png'}, '[声音开启]': {file: 'emoji_84.png'}, '[声音关闭]': {file: 'emoji_85.png'}, '[铃铛]': {file: 'emoji_86.png'}, '[锁头]': {file: 'emoji_87.png'}, '[放大镜]': {file: 'emoji_88.png'}, '[灯泡]': {file: 'emoji_89.png'}, '[锤头]': {file: 'emoji_90.png'}, '[烟]': {file: 'emoji_91.png'}, '[炸弹]': {file: 'emoji_92.png'}, '[枪]': {file: 'emoji_93.png'}, '[刀]': {file: 'emoji_94.png'}, '[药]': {file: 'emoji_95.png'}, '[打针]': {file: 'emoji_96.png'}, '[钱袋]': {file: 'emoji_97.png'}, '[钞票]': {file: 'emoji_98.png'}, '[银行卡]': {file: 'emoji_99.png'}, '[手柄]': {file: 'emoji_100.png'}, '[麻将]': {file: 'emoji_101.png'}, '[调色板]': {file: 'emoji_102.png'}, '[电影]': {file: 'emoji_103.png'}, '[麦克风]': {file: 'emoji_104.png'}, '[耳机]': {file: 'emoji_105.png'}, '[音乐]': {file: 'emoji_106.png'}, '[吉他]': {file: 'emoji_107.png'}, '[火箭]': {file: 'emoji_108.png'}, '[飞机]': {file: 'emoji_109.png'}, '[火车]': {file: 'emoji_110.png'}, '[公交]': {file: 'emoji_111.png'}, '[轿车]': {file: 'emoji_112.png'}, '[出租车]': {file: 'emoji_113.png'}, '[警车]': {file: 'emoji_114.png'}, '[自行车]': {file: 'emoji_115.png'}
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
let emojiList = {
|
||||||
|
'emoji': {
|
||||||
|
'[大笑]': {file: 'emoji_0.png'},
|
||||||
|
'[可爱]': {file: 'emoji_01.png'},
|
||||||
|
'[色]': {file: 'emoji_02.png'},
|
||||||
|
'[嘘]': {file: 'emoji_03.png'},
|
||||||
|
'[亲]': {file: 'emoji_04.png'},
|
||||||
|
'[呆]': {file: 'emoji_05.png'},
|
||||||
|
'[口水]': {file: 'emoji_06.png'},
|
||||||
|
'[汗]': {file: 'emoji_145.png'},
|
||||||
|
'[呲牙]': {file: 'emoji_07.png'},
|
||||||
|
// '[鬼脸]': {file: 'emoji_08.png'},
|
||||||
|
'[害羞]': {file: 'emoji_09.png'},
|
||||||
|
'[偷笑]': {file: 'emoji_10.png'},
|
||||||
|
'[调皮]': {file: 'emoji_11.png'},
|
||||||
|
'[可怜]': {file: 'emoji_12.png'},
|
||||||
|
'[敲]': {file: 'emoji_13.png'},
|
||||||
|
'[惊讶]': {file: 'emoji_14.png'},
|
||||||
|
'[流感]': {file: 'emoji_15.png'},
|
||||||
|
'[委屈]': {file: 'emoji_16.png'},
|
||||||
|
'[流泪]': {file: 'emoji_17.png'},
|
||||||
|
'[嚎哭]': {file: 'emoji_18.png'},
|
||||||
|
'[惊恐]': {file: 'emoji_19.png'},
|
||||||
|
'[怒]': {file: 'emoji_20.png'},
|
||||||
|
'[酷]': {file: 'emoji_21.png'},
|
||||||
|
'[不说]': {file: 'emoji_22.png'},
|
||||||
|
'[鄙视]': {file: 'emoji_23.png'},
|
||||||
|
// '[阿弥陀佛]': {file: 'emoji_24.png'},
|
||||||
|
'[奸笑]': {file: 'emoji_25.png'},
|
||||||
|
'[睡着]': {file: 'emoji_26.png'},
|
||||||
|
// '[口罩]': {file: 'emoji_27.png'},
|
||||||
|
'[努力]': {file: 'emoji_28.png'},
|
||||||
|
// '[抠鼻孔]': {file: 'emoji_29.png'},
|
||||||
|
'[疑问]': {file: 'emoji_30.png'},
|
||||||
|
'[怒骂]': {file: 'emoji_31.png'},
|
||||||
|
'[晕]': {file: 'emoji_32.png'},
|
||||||
|
'[呕吐]': {file: 'emoji_33.png'},
|
||||||
|
// '[拜一拜]': {file: 'emoji_160.png'},
|
||||||
|
// '[惊喜]': {file: 'emoji_161.png'},
|
||||||
|
// '[流汗]': {file: 'emoji_162.png'},
|
||||||
|
'[卖萌]': {file: 'emoji_163.png'},
|
||||||
|
'[默契眨眼]': {file: 'emoji_164.png'},
|
||||||
|
// '[烧香拜佛]': {file: 'emoji_165.png'},
|
||||||
|
'[晚安]': {file: 'emoji_166.png'},
|
||||||
|
'[强]': {file: 'emoji_34.png'},
|
||||||
|
'[弱]': {file: 'emoji_35.png'},
|
||||||
|
'[OK]': {file: 'emoji_36.png'},
|
||||||
|
'[爱心]': {file: 'emoji_45.png'},
|
||||||
|
'[鼓掌]': {file: 'emoji_39.png'},
|
||||||
|
'[戒指]': {file: 'emoji_49.png'},
|
||||||
|
'[心碎]': {file: 'emoji_46.png'},
|
||||||
|
'[太阳]': {file: 'emoji_51.png'},
|
||||||
|
'[胜利]': {file: 'emoji_38.png'},
|
||||||
|
'[耳机]': {file: 'emoji_105.png'},
|
||||||
|
'[吉他]': {file: 'emoji_107.png'},
|
||||||
|
'[糖果]': {file: 'emoji_77.png'},
|
||||||
|
'[音乐]': {file: 'emoji_106.png'},
|
||||||
|
'[唇]': {file: 'emoji_48.png'},
|
||||||
|
'[多云]': {file: 'emoji_53.png'},
|
||||||
|
'[放大镜]': {file: 'emoji_88.png'},
|
||||||
|
'[皇冠]': {file: 'emoji_59.png'},
|
||||||
|
'[火]': {file: 'emoji_43.png'},
|
||||||
|
'[火箭]': {file: 'emoji_108.png'},
|
||||||
|
'[咖啡]': {file: 'emoji_65.png'},
|
||||||
|
'[麻将]': {file: 'emoji_101.png'},
|
||||||
|
'[柠檬汁]': {file: 'emoji_68.png'},
|
||||||
|
'[手机]': {file: 'emoji_81.png'},
|
||||||
|
'[西瓜]': {file: 'emoji_79.png'},
|
||||||
|
'[冰淇淋]': {file: 'emoji_73.png'},
|
||||||
|
'[干杯]': {file: 'emoji_67.png'}
|
||||||
|
|
||||||
|
// '[拳头]': {file: 'emoji_37.png'},
|
||||||
|
// '[握手]': {file: 'emoji_200.png'},
|
||||||
|
// '[发怒]': {file: 'emoji_40.png'},
|
||||||
|
// '[骷髅]': {file: 'emoji_41.png'},
|
||||||
|
// '[便便]': {file: 'emoji_42.png'},
|
||||||
|
// '[溜]': {file: 'emoji_44.png'},
|
||||||
|
// '[钟情]': {file: 'emoji_47.png'},
|
||||||
|
// '[钻石]': {file: 'emoji_50.png'},
|
||||||
|
// '[有时晴]': {file: 'emoji_52.png'},
|
||||||
|
// '[多云]': {file: 'emoji_53.png'},
|
||||||
|
// '[雷]': {file: 'emoji_54.png'},
|
||||||
|
// '[雨]': {file: 'emoji_55.png'},
|
||||||
|
// '[雪花]': {file: 'emoji_56.png'},
|
||||||
|
// '[爱人]': {file: 'emoji_57.png'},
|
||||||
|
// '[帽子]': {file: 'emoji_58.png'},
|
||||||
|
// '[篮球]': {file: 'emoji_60.png'},
|
||||||
|
// '[足球]': {file: 'emoji_61.png'},
|
||||||
|
// '[垒球]': {file: 'emoji_62.png'},
|
||||||
|
// '[网球]': {file: 'emoji_63.png'},
|
||||||
|
// '[台球]': {file: 'emoji_64.png'},
|
||||||
|
// '[啤酒]': {file: 'emoji_66.png'},
|
||||||
|
// '[餐具]': {file: 'emoji_69.png'},
|
||||||
|
// '[汉堡]': {file: 'emoji_70.png'},
|
||||||
|
// '[鸡腿]': {file: 'emoji_71.png'},
|
||||||
|
// '[面条]': {file: 'emoji_72.png'},
|
||||||
|
// '[沙冰]': {file: 'emoji_74.png'},
|
||||||
|
// '[生日蛋糕]': {file: 'emoji_75.png'},
|
||||||
|
// '[蛋糕]': {file: 'emoji_76.png'},
|
||||||
|
// '[葡萄]': {file: 'emoji_78.png'},
|
||||||
|
// '[光碟]': {file: 'emoji_80.png'},
|
||||||
|
// '[电话]': {file: 'emoji_82.png'},
|
||||||
|
// '[电视]': {file: 'emoji_83.png'},
|
||||||
|
// '[声音开启]': {file: 'emoji_84.png'},
|
||||||
|
// '[声音关闭]': {file: 'emoji_85.png'},
|
||||||
|
// '[铃铛]': {file: 'emoji_86.png'},
|
||||||
|
// '[锁头]': {file: 'emoji_87.png'},
|
||||||
|
// '[灯泡]': {file: 'emoji_89.png'},
|
||||||
|
// '[锤头]': {file: 'emoji_90.png'},
|
||||||
|
// '[烟]': {file: 'emoji_91.png'},
|
||||||
|
// '[炸弹]': {file: 'emoji_92.png'},
|
||||||
|
// '[枪]': {file: 'emoji_93.png'},
|
||||||
|
// '[刀]': {file: 'emoji_94.png'},
|
||||||
|
// '[药]': {file: 'emoji_95.png'},
|
||||||
|
// '[打针]': {file: 'emoji_96.png'},
|
||||||
|
// '[钱袋]': {file: 'emoji_97.png'},
|
||||||
|
// '[钞票]': {file: 'emoji_98.png'},
|
||||||
|
// '[银行卡]': {file: 'emoji_99.png'},
|
||||||
|
// '[手柄]': {file: 'emoji_100.png'},
|
||||||
|
// '[调色板]': {file: 'emoji_102.png'},
|
||||||
|
// '[电影]': {file: 'emoji_103.png'},
|
||||||
|
// '[麦克风]': {file: 'emoji_104.png'},
|
||||||
|
// '[吉他]': {file: 'emoji_107.png'},
|
||||||
|
// '[飞机]': {file: 'emoji_109.png'},
|
||||||
|
// '[火车]': {file: 'emoji_110.png'},
|
||||||
|
// '[公交]': {file: 'emoji_111.png'},
|
||||||
|
// '[轿车]': {file: 'emoji_112.png'},
|
||||||
|
// '[出租车]': {file: 'emoji_113.png'},
|
||||||
|
// '[警车]': {file: 'emoji_114.png'},
|
||||||
|
// '[自行车]': {file: 'emoji_115.png'}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let emoji in emojiList) {
|
||||||
|
let emojiItem = emojiList[emoji]
|
||||||
|
for (let key in emojiItem) {
|
||||||
|
let item = emojiItem[key]
|
||||||
|
item.img = `${emojiBaseUrl}/${emoji}/${item.file}`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let pinupList = {
|
||||||
|
'ajmd': {},
|
||||||
|
'xxy': {},
|
||||||
|
'lt': {}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 1; i <= 48; i++) {
|
||||||
|
let key = 'ajmd0' + (i >= 10 ? i : '0' + i)
|
||||||
|
pinupList['ajmd'][key] = {file: key + '.png'}
|
||||||
|
}
|
||||||
|
for (let i = 1; i <= 40; i++) {
|
||||||
|
let key = 'xxy0' + (i >= 10 ? i : '0' + i)
|
||||||
|
pinupList['xxy'][key] = {file: key + '.png'}
|
||||||
|
}
|
||||||
|
for (let i = 1; i <= 20; i++) {
|
||||||
|
let key = 'lt0' + (i >= 10 ? i : '0' + i)
|
||||||
|
pinupList['lt'][key] = {file: key + '.png'}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let emoji in pinupList) {
|
||||||
|
let emojiItem = pinupList[emoji]
|
||||||
|
for (let key in emojiItem) {
|
||||||
|
let item = emojiItem[key]
|
||||||
|
item.img = `${emojiBaseUrl}/${emoji}/${item.file}`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
emojiList,
|
||||||
|
pinupList
|
||||||
|
}
|
||||||
53
src/components/cuCustom.wpy
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<style lang="less">
|
||||||
|
.m_search {
|
||||||
|
width: 446rpx;
|
||||||
|
height: 64rpx;
|
||||||
|
background-color: #F8F8F8;
|
||||||
|
border-radius: 100rpx;
|
||||||
|
padding: 0 22rpx;
|
||||||
|
margin-left: 30rpx;
|
||||||
|
|
||||||
|
.m_search_icon {
|
||||||
|
width: 28rpx;
|
||||||
|
height: 28rpx;
|
||||||
|
margin-right: 8rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<template>
|
||||||
|
<view class="~cu-custom" :style="{height: CustomBar + 'px', zIndex: 1}">
|
||||||
|
<view class="~cu-bar ~fixed" :style="{height: CustomBar + 'px', paddingTop: StatusBar + 'px', background: bgColor}">
|
||||||
|
<view class="m_search ~f-fcl">
|
||||||
|
<image class="m_search_icon" src="https://images.ufutx.com/202106/19/c607aaf49440b0df3308d6e048fd9ad7.png" mode="aspectFit" lazy-load="false"></image>
|
||||||
|
<input disabled type="text" placeholder="搜索昵称">
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import wepy from '@wepy/core'
|
||||||
|
import base from '../mixins/base'
|
||||||
|
import https from '../mixins/https'
|
||||||
|
|
||||||
|
wepy.component({
|
||||||
|
props: {
|
||||||
|
bgColor: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
StatusBar: 0,
|
||||||
|
CustomBar: 0,
|
||||||
|
Custom: 0
|
||||||
|
},
|
||||||
|
mixins: [https, base],
|
||||||
|
methods: {
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.StatusBar = this.$app.$options.globalData.StatusBar
|
||||||
|
this.CustomBar = this.$app.$options.globalData.CustomBar
|
||||||
|
this.Custom = this.$app.$options.globalData.Custom
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
63
src/components/pageScroll.wpy
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
<style lang="less">
|
||||||
|
.m_returnTop {
|
||||||
|
position: fixed;
|
||||||
|
right: 62rpx;
|
||||||
|
bottom: 200rpx;
|
||||||
|
z-index: 99;
|
||||||
|
-webkit-transition: opacity 1s;
|
||||||
|
transition: opacity 1s;
|
||||||
|
.u_returnTop_img {
|
||||||
|
width: 92rpx;
|
||||||
|
height: 92rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
box-shadow: 0 0 12rpx 6rpx rgba(0, 0, 0, .06);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@keyframes opacity{
|
||||||
|
0%{opacity: 0}
|
||||||
|
100%{
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.hide{
|
||||||
|
opacity:0;
|
||||||
|
}
|
||||||
|
.show{
|
||||||
|
opacity:1;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<template>
|
||||||
|
<view class="m_returnTop {{ showBackTopBtn ? 'show' : 'hide'}}">
|
||||||
|
<image class="u_returnTop_img" @tap.stop="BackTop" src="https://images.ufutx.com/202106/23/f0d10551dc5d3399cc7f15805cf04f4f.png" mode="scaleToFill" lazy-load="false"></image>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import wepy from '@wepy/core'
|
||||||
|
import base from '../mixins/base'
|
||||||
|
import https from '../mixins/https'
|
||||||
|
|
||||||
|
wepy.component({
|
||||||
|
props: {
|
||||||
|
bgColor: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
showBackTopBtn: false // 显示置顶
|
||||||
|
},
|
||||||
|
mixins: [https, base],
|
||||||
|
methods: {
|
||||||
|
BackTop() {
|
||||||
|
let vm = this
|
||||||
|
vm.showBackTopBtn = false
|
||||||
|
wx.pageScrollTo({
|
||||||
|
scrollTop: 0,
|
||||||
|
duration: 400
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
281
src/components/recommendDialog.wpy
Normal file
@ -0,0 +1,281 @@
|
|||||||
|
<style lang="less">
|
||||||
|
.d_text{
|
||||||
|
padding: 10rpx 0 5rpx 0;
|
||||||
|
.d_icon{
|
||||||
|
width: 24rpx;
|
||||||
|
height: 24rpx;
|
||||||
|
align-items: center; /*定义body的元素垂直居中*/
|
||||||
|
vertical-align:text-bottom;
|
||||||
|
margin-bottom: 2rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.m_modal_box {
|
||||||
|
position: relative;
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: middle;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
width: 600rpx;
|
||||||
|
overflow: initial;
|
||||||
|
.m_modal {
|
||||||
|
position: relative;
|
||||||
|
border-radius: 30rpx;
|
||||||
|
background: #FFFFFF !important;
|
||||||
|
margin-bottom: 100rpx;
|
||||||
|
padding: 36rpx 30rpx 30rpx;
|
||||||
|
.text_left {
|
||||||
|
text-align: left;
|
||||||
|
margin-top: 20rpx;
|
||||||
|
}
|
||||||
|
.operation_box {
|
||||||
|
padding: 0 30rpx;
|
||||||
|
background-color: #F8F8F8;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
.u_list {
|
||||||
|
margin: 30rpx 0;
|
||||||
|
height: 100rpx;
|
||||||
|
.u_bu {
|
||||||
|
width: 120rpx;
|
||||||
|
height: 60rpx;
|
||||||
|
border-radius: 100rpx;
|
||||||
|
background: #FF5380;
|
||||||
|
}
|
||||||
|
.u_bu.sel {
|
||||||
|
background-color: #C2C2C2;
|
||||||
|
|
||||||
|
}
|
||||||
|
.u_bu.etc {
|
||||||
|
background-color: #FFBB00;
|
||||||
|
}
|
||||||
|
.font_family {
|
||||||
|
margin-right: 12rpx;
|
||||||
|
}
|
||||||
|
.u_icom {
|
||||||
|
width: 36rpx;
|
||||||
|
height: 36rpx;
|
||||||
|
margin-right: 12rpx;
|
||||||
|
margin-top: 2rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.u_list.border_bottom {
|
||||||
|
border-bottom: 2rpx solid #EEEEEE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.actions {
|
||||||
|
position: absolute;
|
||||||
|
bottom: -100rpx;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
margin: auto;
|
||||||
|
width: 48rpx;
|
||||||
|
height: 48rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.intention_confirm_box{
|
||||||
|
position: relative;
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: middle;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
width: 600rpx;
|
||||||
|
max-width: 100%;
|
||||||
|
background-color: #ffffff;
|
||||||
|
border-radius: 24rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
.intentionContent{
|
||||||
|
padding: 58rpx 56rpx 64rpx 56rpx;
|
||||||
|
}
|
||||||
|
.intentionContent_1{
|
||||||
|
padding: 58rpx 56rpx 44rpx 56rpx;
|
||||||
|
}
|
||||||
|
.intentionOperation{
|
||||||
|
margin: 0 78rpx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
.operationButton{
|
||||||
|
width: 192rpx;
|
||||||
|
height: 68rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<template>
|
||||||
|
<template name="isShow">
|
||||||
|
<!--判断是否完善-->
|
||||||
|
<view class="d_text" v-for="(item,index) in d_data" :key="index">
|
||||||
|
{{index+1}}、{{item.text}}
|
||||||
|
<view class="~font_24 ~flo_r" v-if="item.value">
|
||||||
|
<image class="d_icon" src="https://image.fulllinkai.com/202203/25/b4089c692d74cafe961a40a2885c33ad.png" mode="aspectFill" lazy-load="true"></image> 已完成
|
||||||
|
</view>
|
||||||
|
<view class="~font_24 ~flo_r" v-else style="color: #EF4646">
|
||||||
|
<image class="d_icon" src="https://image.fulllinkai.com/202203/25/9996eef2097cbc5a425b307343b66a30.png" mode="aspectFill" lazy-load="true"></image> 未完成
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<view class="recommendDialog">
|
||||||
|
<view class="~cu-modal" :class="{'~show' : recommendShow}">
|
||||||
|
<view class="m_modal_box ~animation-slide-top">
|
||||||
|
<view class="m_modal">
|
||||||
|
<view class="~font_40 ~color333 ~bold ~f-fcc">我也要上推荐</view>
|
||||||
|
<view class="~font_24 ~color999 ~text_left">满足以下要求,申请后通过审核,即可在{{id==1?'置顶推荐展示;提升曝光度,可以获得更多推荐,也更容易脱单哦!':'专区推荐展示,还可进入群聊,更容易脱单哦!'}}</view>
|
||||||
|
<view class="~font_28 ~color333 ~text_left">
|
||||||
|
<template is="isShow" data="{{d_data}}"></template>
|
||||||
|
</view>
|
||||||
|
<view class="operation_box">
|
||||||
|
<view class="basis_data ~f-fbc u_list border_bottom" v-if="recommendData.profile != 1">
|
||||||
|
<view class="~f-fc ~font_30 ~color333">
|
||||||
|
<image class="u_icom" src="https://images.ufutx.com/202105/14/aed70ef1c706a196d513bc37ecfae628.png" mode="aspectFill" lazy-load="true"></image>
|
||||||
|
<view>完善个人资料</view>
|
||||||
|
</view>
|
||||||
|
<view v-if="recommendData.profile == 2" class="u_bu etc ~f-fcc ~font_26 ~white" @tap="goto('审核中')">审核中</view>
|
||||||
|
<view v-else class="u_bu ~f-fcc ~font_26 ~white {{recommendData.profile == 1?'sel':''}}" @tap="goto('/pages/users/unmarriV2?progressShow=false', '去完善')">{{recommendData.info == 1?'已完善':'去完善'}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="realName_data ~f-fbc u_list border_bottom" v-if="recommendData.is_real_approved != 1">
|
||||||
|
<view class="~f-fc ~font_30 ~color333">
|
||||||
|
<image class="u_icom" src="https://images.ufutx.com/202105/14/f1adcb93599bd779b3ccfad8ea1f2d19.png" mode="aspectFill" lazy-load="true"></image>
|
||||||
|
<view>完成{{realityState == 0 ? '真人' : '实名'}}认证</view>
|
||||||
|
</view>
|
||||||
|
<view v-if="recommendData.is_real_approved == 2" class="u_bu etc ~f-fcc ~font_26 ~weight_500 ~white" @tap="goto('审核中')">审核中</view>
|
||||||
|
<view v-else class="u_bu ~f-fcc ~font_26 ~white {{recommendData.is_real_approved == 1?'sel':''}}" @tap="goto('/pages/users/realName', '去真人认证')">{{recommendData.is_real_approved == 1?'已认证':'去认证'}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="realName_data ~f-fbc u_list" v-if="(recommendData.is_educate_approved != 1 && id == 1) || (recommendData.is_educate_approved != 1 && id == 6)">
|
||||||
|
<view class="~f-fc ~font_30 ~color333">
|
||||||
|
<image class="u_icom" src="https://images.ufutx.com/202105/14/e44ac243bbbd2e5a6d1f5c1d2e650222.png" mode="aspectFill" lazy-load="true"></image>
|
||||||
|
<view>完成学历认证</view>
|
||||||
|
</view>
|
||||||
|
<view v-if="recommendData.is_educate_approved == 2" class="u_bu etc ~f-fcc ~font_26 ~white" @tap="goto('审核中')">审核中</view>
|
||||||
|
<view v-else class="u_bu ~f-fcc ~font_26 ~white {{recommendData.is_educate_approved == 1?'sel':''}}" @tap="goto('/pages/users/degreeCertificate', '去学历认证')">{{recommendData.is_educate_approved == 1?'已认证':'去认证'}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="~font_26 ~color999">资料越详细,优先入选{{title}}!</view>
|
||||||
|
<image class="actions" src="https://images.ufutx.com/202103/15/1033c7b52cacddcebe999cefc6ad2c9b.png" mode="widthFix" @tap.stop="hideModal"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="cu-modal {{intentionShow?'show':''}}">
|
||||||
|
<view class="intention_confirm_box animation-slide-top">
|
||||||
|
<view class="intentionContent font_32 color-333">是否确定申请“{{title}}”?</view>
|
||||||
|
<view class="intentionOperation">
|
||||||
|
<image @tap.stop="intentionModal" class="operationButton" src="https://images.ufutx.com/202103/17/4281e92bc8b727bae08099a3015225b1.png" mode="widthFix"></image>
|
||||||
|
<image @tap.stop="recommend" class="operationButton" src="https://images.ufutx.com/202103/17/91fea69fdff1cfeaac369ddd5dd591f0.png" mode="widthFix"></image>
|
||||||
|
</view>
|
||||||
|
<view style="height: 38rpx"></view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="cu-modal {{inreviewShow?'show':''}}">
|
||||||
|
<view class="intention_confirm_box animation-slide-top">
|
||||||
|
<view class="intentionContent_1 font_34 color-333 bold">你的资料正在审核中</view>
|
||||||
|
<view class="font_32 color-333" style="padding-bottom: 60rpx">如有紧急,请拨打<span style="color: #f33b6c;">18922809346</span></view>
|
||||||
|
<view class="intentionOperation">
|
||||||
|
<image @tap.stop="inreviewModal" class="operationButton" src="https://images.ufutx.com/202103/17/4281e92bc8b727bae08099a3015225b1.png" mode="widthFix"></image>
|
||||||
|
<image @tap.stop="clickPhone" class="operationButton" src="https://images.ufutx.com/202104/15/91fea69fdff1cfeaac369ddd5dd591f0.png" mode="widthFix"></image>
|
||||||
|
</view>
|
||||||
|
<view style="height: 38rpx"></view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import wepy from '@wepy/core'
|
||||||
|
import base from '../mixins/base'
|
||||||
|
import https from '../mixins/https'
|
||||||
|
import {service} from '../config'
|
||||||
|
|
||||||
|
wepy.component({
|
||||||
|
props: {
|
||||||
|
recommendShow: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
intentionShow: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
recommendData: {
|
||||||
|
type: Object,
|
||||||
|
default: {}
|
||||||
|
},
|
||||||
|
id: {
|
||||||
|
type: Number,
|
||||||
|
default: 1
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
type: String,
|
||||||
|
default: '置顶推荐'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
inreviewShow: false,
|
||||||
|
agreementShow: false,
|
||||||
|
isShow: false,
|
||||||
|
realityState: 0,
|
||||||
|
d_data: [
|
||||||
|
{text: '完整填写个人资料', value: 0},
|
||||||
|
{text: '生活照6张以上', value: 0},
|
||||||
|
{text: '兴趣爱好超过50字', value: 0},
|
||||||
|
{text: '自我描述超过200字', value: 0},
|
||||||
|
{text: '期望对方均超过200字', value: 0},
|
||||||
|
{text: '完成真人认证和学历认证', value: 0}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
mixins: [https, base],
|
||||||
|
methods: {
|
||||||
|
recommend() {
|
||||||
|
let vm = this
|
||||||
|
let data = {
|
||||||
|
area_id: vm.id
|
||||||
|
}
|
||||||
|
vm.$showLoading('')
|
||||||
|
vm.$post({url: `${service.host}/area/user`, data}).then(({code, data}) => {
|
||||||
|
wx.hideLoading()
|
||||||
|
if (code == 0) {
|
||||||
|
vm.$emit('intentionCut', false, '0')
|
||||||
|
vm.$showToast('申请提交成功,系统将在1-3天内审核')
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
wx.hideLoading()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
hideModal() {
|
||||||
|
let vm = this
|
||||||
|
vm.recommendShow = false
|
||||||
|
vm.$emit('recommendCut', false)
|
||||||
|
},
|
||||||
|
intentionModal() {
|
||||||
|
let vm = this
|
||||||
|
vm.intentionShow = false
|
||||||
|
vm.$emit('intentionCut', false)
|
||||||
|
},
|
||||||
|
inreviewModal() {
|
||||||
|
let vm = this
|
||||||
|
vm.inreviewShow = false
|
||||||
|
},
|
||||||
|
goto(url, name) {
|
||||||
|
let vm = this
|
||||||
|
if (name == '去完善') {
|
||||||
|
vm.$emit('squareCut_2')
|
||||||
|
} else if (name == '去真人认证') {
|
||||||
|
vm.$emit('squareCut')
|
||||||
|
} else if (name == '去学历认证') {
|
||||||
|
vm.$emit('squareCut_1')
|
||||||
|
}
|
||||||
|
if (url == '审核中') {
|
||||||
|
vm.inreviewShow = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
vm.hideModal()
|
||||||
|
vm.$goto(url)
|
||||||
|
},
|
||||||
|
clickPhone() {
|
||||||
|
wx.makePhoneCall({
|
||||||
|
phoneNumber: '18922809346'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
244
src/components/residenceDialog.wpy
Normal file
@ -0,0 +1,244 @@
|
|||||||
|
<style lang="less">
|
||||||
|
.ui-residenceDialog{
|
||||||
|
.cu-modal {
|
||||||
|
.cu-dialog {
|
||||||
|
border-radius: 16rpx 16rpx 0 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.m_dialog {
|
||||||
|
height: 478rpx !important;
|
||||||
|
padding: 30rpx;
|
||||||
|
border-radius: 32rpx;
|
||||||
|
.m_ct {
|
||||||
|
width: 400rpx;
|
||||||
|
height: 72rpx;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
border: 2rpx solid #999999;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
.m_ct.sel {
|
||||||
|
background: rgba(255, 83, 128, 0.06);
|
||||||
|
border: 2rpx solid #FF5380;
|
||||||
|
box-sizing: border-box;
|
||||||
|
.font_32.sel {
|
||||||
|
color: #FF5380;
|
||||||
|
}
|
||||||
|
.font_family.sel {
|
||||||
|
color: #FF5380;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.icon-location{
|
||||||
|
margin-top: 4rpx;
|
||||||
|
margin-right: 4rpx;
|
||||||
|
line-height: 32rpx;
|
||||||
|
}
|
||||||
|
.icon-locate{
|
||||||
|
margin-top: 2rpx;
|
||||||
|
margin-right: 8rpx;
|
||||||
|
line-height: 32rpx;
|
||||||
|
}
|
||||||
|
.m_cus {
|
||||||
|
margin: 56rpx 0 40rpx;
|
||||||
|
.u_cus_img {
|
||||||
|
width: 24rpx;
|
||||||
|
height: 32rpx;
|
||||||
|
margin-right: 6rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.m_aut {
|
||||||
|
margin-bottom: 40rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<template>
|
||||||
|
<view class="ui-residenceDialog">
|
||||||
|
<view class="~cu-modal ~bottom-modal" :class="{'~show' : residenceShow}" @tap="onModal">
|
||||||
|
<view class="~cu-dialog">
|
||||||
|
<view class="m_dialog">
|
||||||
|
<view class="~font_32 ~bold ~color333 ~f-fcc">请选择目前居住地</view>
|
||||||
|
<selectCity :multiIndex.sync="multiIndex" @selectCity="selectCity" @provinces="allProvinces">
|
||||||
|
<view class="~f-fcc">
|
||||||
|
<view class="m_cus m_ct ~f-fcc {{selectType == 'custom'?'sel':''}}">
|
||||||
|
<view class="~f-fcc">
|
||||||
|
<image class="u_cus_img" src="{{selectType == 'custom'?'https://images.ufutx.com/202105/13/9ac1cc6f1753832da16ce19e44f812b6.png':'https://images.ufutx.com/202105/13/687179ce81755d46d25038bd49acf203.png'}}" mode="scaleToFill" lazy-load="true"></image>
|
||||||
|
<view class="~font_32 black_6 {{selectType == 'custom'?'sel':''}}">{{selectType == 'custom'?address.province+' '+address.city:'自定义选择'}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</selectCity>
|
||||||
|
<view class="~f-fcc">
|
||||||
|
<view class="m_aut m_ct ~f-fcc {{selectType == 'automatic'?'sel':''}}" @tap="getCenterLocation">
|
||||||
|
<view class="font_family black_6 icon-locate ~font_32 {{selectType == 'automatic'?'sel':''}}"></view>
|
||||||
|
<view class="~font_32 black_6 {{selectType == 'automatic'?'sel':''}}">{{selectType == 'automatic'?address.province+' '+address.city:'获取地理位置'}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="~f-fcc ~font_32 ~color999">取消</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import wepy from '@wepy/core'
|
||||||
|
import base from '../mixins/base'
|
||||||
|
import https from '../mixins/https'
|
||||||
|
import {service} from '../config'
|
||||||
|
|
||||||
|
wepy.component({
|
||||||
|
props: {
|
||||||
|
residenceShow: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
address: {country: '', province: '', city: ''},
|
||||||
|
multiIndex: [0, 18, 2],
|
||||||
|
selectType: ''
|
||||||
|
},
|
||||||
|
mixins: [https, base],
|
||||||
|
methods: {
|
||||||
|
// 使用经纬度获取地址
|
||||||
|
getAddress(lat, lng) {
|
||||||
|
let vm = this
|
||||||
|
let data = {
|
||||||
|
local_latitude: lat,
|
||||||
|
local_longitude: lng
|
||||||
|
}
|
||||||
|
vm.$showLoading('定位中...')
|
||||||
|
vm.$get({url: `${service.host}/location/to/address`, data}).then(({code, data}) => {
|
||||||
|
if (code === 0) {
|
||||||
|
vm.address = {country: data.nation, province: data.province, city: data.city}
|
||||||
|
vm.selectType = 'automatic'
|
||||||
|
vm.multiCity()
|
||||||
|
vm.$emit('residenceCity', vm.address)
|
||||||
|
}
|
||||||
|
wx.hideLoading()
|
||||||
|
}).catch(err => {
|
||||||
|
wx.hideLoading()
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 回填选择城市组件所需下标
|
||||||
|
multiCity() {
|
||||||
|
let vm = this
|
||||||
|
vm.provinces.forEach((item, index) => {
|
||||||
|
if (item.name == vm.address.country) {
|
||||||
|
vm.multiIndex = [index, 0, 0]
|
||||||
|
item.son.forEach((res, indexA) => {
|
||||||
|
if (res.name == vm.address.province) {
|
||||||
|
vm.multiIndex = [index, indexA, 0]
|
||||||
|
res.son.forEach((data, indexB) => {
|
||||||
|
if (data.name == vm.address.city) {
|
||||||
|
vm.multiIndex = [index, indexA, indexB]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 授权获取定位地址
|
||||||
|
getCenterLocation() {
|
||||||
|
let vm = this
|
||||||
|
if (wx.getFuzzyLocation) {
|
||||||
|
wx.getSystemInfo({
|
||||||
|
success: (res) => {
|
||||||
|
console.log(res, 'GPS定位')
|
||||||
|
var isopendingwei = res.locationEnabled
|
||||||
|
console.log(res.locationEnabled)
|
||||||
|
if (isopendingwei == false) {
|
||||||
|
console.log('请先开启手机GPS定位,然后重新刷新')
|
||||||
|
wx.showToast({
|
||||||
|
title: '请打开GPS定位获取地理位置',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
wx.getSetting({
|
||||||
|
success: (res) => {
|
||||||
|
var statu = res.authSetting
|
||||||
|
if (!statu['scope.userFuzzyLocation'] && !statu['scope.userLocation']) {
|
||||||
|
wx.showModal({
|
||||||
|
title: '是否授权当前位置',
|
||||||
|
content: '需要获取您的地理位置,请确认授权',
|
||||||
|
confirmColor: '#f16765',
|
||||||
|
success: res => {
|
||||||
|
if (res.confirm) {
|
||||||
|
wx.openSetting({
|
||||||
|
success: data => {
|
||||||
|
if (data.authSetting['scope.userFuzzyLocation'] || data.authSetting['scope.userLocation']) {
|
||||||
|
wx.getFuzzyLocation({
|
||||||
|
type: 'gcj02',
|
||||||
|
success: function (res) {
|
||||||
|
console.log(res)
|
||||||
|
vm.getAddress(res.latitude, res.longitude)
|
||||||
|
wx.setStorageSync('myLong', res.longitude)
|
||||||
|
},
|
||||||
|
fail: function () {
|
||||||
|
vm.hide = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
wx.getFuzzyLocation({
|
||||||
|
type: 'gcj02',
|
||||||
|
success: function (res) {
|
||||||
|
console.log(res)
|
||||||
|
vm.getAddress(res.latitude, res.longitude)
|
||||||
|
wx.setStorageSync('myLong', res.longitude)
|
||||||
|
},
|
||||||
|
fail: function () {
|
||||||
|
vm.hide = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
wx.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 组件调用此方法返回所有城市地址
|
||||||
|
allProvinces(e) {
|
||||||
|
let vm = this
|
||||||
|
vm.provinces = e
|
||||||
|
},
|
||||||
|
// 组件调用此方法返回选中的居住地
|
||||||
|
selectCity(e, index) {
|
||||||
|
let vm = this
|
||||||
|
vm.address = {
|
||||||
|
country: e[0], province: e[1], city: e[2]
|
||||||
|
}
|
||||||
|
vm.$emit('residenceCity', vm.address)
|
||||||
|
console.log(e, index)
|
||||||
|
},
|
||||||
|
onModal() {
|
||||||
|
let vm = this
|
||||||
|
vm.$emit('closeResidenceShow', false)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<config>
|
||||||
|
{
|
||||||
|
usingComponents: {
|
||||||
|
selectCity: '~@/components/selectCity'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</config>
|
||||||
232
src/components/selectCity.wpy
Normal file
@ -0,0 +1,232 @@
|
|||||||
|
<template>
|
||||||
|
<picker mode="multiSelector" style="width:{{width}};height:{{height}};" @change="MultiPickerChange" @columnchange="MultiPickerColumnChange" value="{{multiIndex}}" range="{{objectArray}}">
|
||||||
|
<slot></slot>
|
||||||
|
</picker>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import wepy from '@wepy/core'
|
||||||
|
import base from '../mixins/base.js'
|
||||||
|
import https from '../mixins/https'
|
||||||
|
import {service} from '../config.js'
|
||||||
|
|
||||||
|
wepy.component({
|
||||||
|
mixins: [base, https],
|
||||||
|
options: {
|
||||||
|
multipleSlots: true // 在组件定义时的选项中启用多slot支持
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
region: [],
|
||||||
|
objectArray: [[], [], []],
|
||||||
|
provinces: [],
|
||||||
|
nationId: 0,
|
||||||
|
provinceId: 0,
|
||||||
|
cityId: 0
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
itemIndex: {
|
||||||
|
type: Number,
|
||||||
|
default: 0,
|
||||||
|
twoWay: true
|
||||||
|
},
|
||||||
|
selfTextareaShow: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
width: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
height: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
AddressValue: {
|
||||||
|
type: Array,
|
||||||
|
default: []
|
||||||
|
},
|
||||||
|
multiIndex: {
|
||||||
|
type: Array,
|
||||||
|
default: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
created() {
|
||||||
|
let vm = this
|
||||||
|
vm.$nextTick(() => {
|
||||||
|
vm.GetAddress()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
},
|
||||||
|
|
||||||
|
watch: {},
|
||||||
|
methods: {
|
||||||
|
GetAddress() {
|
||||||
|
let vm = this
|
||||||
|
let url = ``
|
||||||
|
console.log(vm.selfTextareaShow, vm.multiIndex, '88888888888888888')
|
||||||
|
if (vm.selfTextareaShow) {
|
||||||
|
url = `${service.host}/addresses`
|
||||||
|
} else {
|
||||||
|
url = `${service.host}/addresses/v2`
|
||||||
|
}
|
||||||
|
|
||||||
|
vm.$get({url: url}).then(({code, data}) => {
|
||||||
|
vm.provinces = data
|
||||||
|
console.log(vm.provinces, 'vm.provinces')
|
||||||
|
if (vm.AddressValue.length > 0) {
|
||||||
|
vm.provinces.forEach((item, index) => {
|
||||||
|
vm.objectArray[0].push(item.name)
|
||||||
|
if (item.name == vm.AddressValue[0]) {
|
||||||
|
vm.multiIndex[0] = index
|
||||||
|
}
|
||||||
|
})
|
||||||
|
vm.provinces[vm.multiIndex[0]].son.forEach((item, index) => {
|
||||||
|
vm.objectArray[1].push(item.name)
|
||||||
|
if (item.name == vm.AddressValue[1]) {
|
||||||
|
vm.multiIndex[1] = index
|
||||||
|
}
|
||||||
|
})
|
||||||
|
vm.provinces[vm.multiIndex[0]].son[vm.multiIndex[1]].son.forEach((item, index) => {
|
||||||
|
vm.objectArray[2].push(item.name)
|
||||||
|
if (item.name == vm.AddressValue[2]) {
|
||||||
|
vm.multiIndex[2] = index
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
for (let item of vm.provinces) {
|
||||||
|
vm.objectArray[0].push(item.name)
|
||||||
|
}
|
||||||
|
for (let item of vm.provinces[vm.provinceId].son) {
|
||||||
|
vm.objectArray[1].push(item.name)
|
||||||
|
}
|
||||||
|
for (let item of vm.provinces[vm.cityId].son[vm.selfTextareaShow ? 0 : 18].son) {
|
||||||
|
vm.objectArray[2].push(item.name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log(vm.provinces, 'provinces')
|
||||||
|
this.$emit('provinces', vm.provinces)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
MultiPickerChange(e) { // 地址确定
|
||||||
|
console.log(this.itemIndex)
|
||||||
|
console.log(e, 'e-----')
|
||||||
|
this.multiIndex = e.$wx.detail.value
|
||||||
|
console.log(this.provinces, this.multiIndex, 'gggg')
|
||||||
|
console.log(this.provinces[this.multiIndex[0]], '=1')
|
||||||
|
console.log(this.provinces[this.multiIndex[0]].son[this.multiIndex[1]], '=2')
|
||||||
|
console.log(this.provinces[this.multiIndex[0]].son[this.multiIndex[1]].son[this.multiIndex[2]], '=3')
|
||||||
|
this.region = [this.provinces[this.multiIndex[0]].name, this.provinces[this.multiIndex[0]].son[this.multiIndex[1]].name, this.provinces[this.multiIndex[0]].son[this.multiIndex[1]].son[this.multiIndex[2]].name]
|
||||||
|
this.$emit('multiCity', this.multiIndex)
|
||||||
|
this.$emit('selectCity', this.region, this.itemIndex)
|
||||||
|
},
|
||||||
|
MultiPickerColumnChange(e) { // 省
|
||||||
|
console.log(e, '---')
|
||||||
|
let that = this,
|
||||||
|
province = [],
|
||||||
|
city = []
|
||||||
|
switch (e.$wx.detail.column) {
|
||||||
|
case 0:
|
||||||
|
that.nationId = e.$wx.detail.value
|
||||||
|
for (let item of that.provinces[that.nationId].son) {
|
||||||
|
province.push(item.name)
|
||||||
|
}
|
||||||
|
for (let item of that.provinces[that.nationId].son[0].son) {
|
||||||
|
city.push(item.name)
|
||||||
|
}
|
||||||
|
that.objectArray = [that.objectArray[0], province, city]
|
||||||
|
|
||||||
|
that.multiIndex = [e.$wx.detail.value, 0, 0]
|
||||||
|
break
|
||||||
|
case 1:
|
||||||
|
that.provinceId = e.$wx.detail.value
|
||||||
|
for (let item of that.provinces[that.nationId].son[that.provinceId].son) {
|
||||||
|
city.push(item.name)
|
||||||
|
}
|
||||||
|
that.objectArray = [that.objectArray[0], that.objectArray[1], city]
|
||||||
|
that.multiIndex = [that.multiIndex[0], e.$wx.detail.value, 0]
|
||||||
|
|
||||||
|
break
|
||||||
|
case 2:
|
||||||
|
that.multiIndex = [that.multiIndex[0], that.multiIndex[1], e.$wx.detail.value]
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
.loading-box{
|
||||||
|
width: 100vw;height: 100vh;
|
||||||
|
background-image: url("http://images.ufutx.com/201901/14/ed1b2da08b3581efdc7372b26f1ba40b.png");
|
||||||
|
background-size: cover;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 1000;
|
||||||
|
.loading-image{
|
||||||
|
width: 500rpx;height: 500rpx;
|
||||||
|
margin: auto;
|
||||||
|
margin-top: 30vh;
|
||||||
|
z-index: -1;
|
||||||
|
}
|
||||||
|
.loading-item{
|
||||||
|
width: 100%;height: 400rpx;
|
||||||
|
position: relative;
|
||||||
|
position: absolute;
|
||||||
|
overflow: inherit;
|
||||||
|
left: 0 ;
|
||||||
|
top: 30vh;
|
||||||
|
.image{
|
||||||
|
width: 220rpx;
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
animation: opacity 1200ms ease-in;
|
||||||
|
animation-fill-mode: forwards;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cover-image,cover-view {
|
||||||
|
overflow: visible !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.animate{
|
||||||
|
-webkit-animation: move2 2s linear infinite;
|
||||||
|
}
|
||||||
|
.loading-icon {
|
||||||
|
width: 240rpx;
|
||||||
|
}
|
||||||
|
@-webkit-keyframes move2{
|
||||||
|
0%{-webkit-transform:rotate(0deg);}
|
||||||
|
|
||||||
|
50%{-webkit-transform:rotate(-180deg);}
|
||||||
|
|
||||||
|
100%{-webkit-transform:rotate(-360deg);}
|
||||||
|
}
|
||||||
|
.hide{
|
||||||
|
animation: opacity2 800ms ease-in;
|
||||||
|
animation-fill-mode: forwards;
|
||||||
|
}
|
||||||
|
@keyframes opacity{
|
||||||
|
0%{opacity: 0}
|
||||||
|
50%{opacity:.5;}
|
||||||
|
100%{opacity:1;}
|
||||||
|
}
|
||||||
|
@keyframes opacity2{
|
||||||
|
0%{opacity:1}
|
||||||
|
50%{opacity:.8;}
|
||||||
|
100%{opacity:0;}
|
||||||
|
}
|
||||||
|
@-webkit-keyframes move2{
|
||||||
|
0%{-webkit-transform:rotate(0deg);}
|
||||||
|
|
||||||
|
50%{-webkit-transform:rotate(-180deg);}
|
||||||
|
|
||||||
|
100%{-webkit-transform:rotate(-360deg);}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
195
src/components/uploadPic.wpy
Normal file
@ -0,0 +1,195 @@
|
|||||||
|
<style lang="less">
|
||||||
|
page {}
|
||||||
|
|
||||||
|
.upload_file {
|
||||||
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
._item {
|
||||||
|
padding: 32rpx;
|
||||||
|
border-bottom: 1rpx solid #f5f5f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
._cancel {
|
||||||
|
border-top: 16rpx solid #f8f8f8;
|
||||||
|
margin-bottom: 24rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
<template>
|
||||||
|
<view :class="{'~show': chooseShow}" class="~cu-modal ~bottom-modal">
|
||||||
|
<view class="~cu-dialog" style="border-radius: 32rpx 32rpx 0 0;">
|
||||||
|
<view class="~bg_f upload_file">
|
||||||
|
<view class="_title _item ~font_32" catchtap="onCamera">拍摄</view>
|
||||||
|
<view class="_title _item ~font_32" catchtap="chooseImageV2">从手机相册选择</view>
|
||||||
|
<view class="_title _item ~font_32 ~color333 _cancel" @tap="cancelFn">取消</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import wepy from '@wepy/core'
|
||||||
|
import {service} from '../config'
|
||||||
|
import base from '../mixins/base'
|
||||||
|
import https from '../mixins/https'
|
||||||
|
import utils from '../utils/util'
|
||||||
|
|
||||||
|
wepy.component({
|
||||||
|
props: {
|
||||||
|
chooseShow: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
uploadData: null,
|
||||||
|
uploader: {},
|
||||||
|
videos: [],
|
||||||
|
uploadFiles: []
|
||||||
|
},
|
||||||
|
mixins: [https, base],
|
||||||
|
methods: {
|
||||||
|
chooseImageV2() { // 上传照片
|
||||||
|
let vm = this
|
||||||
|
vm.$showLoading(`${vm.i18nL.components.uploadPic.Ace5}`)
|
||||||
|
vm.cancelFn()
|
||||||
|
wx.chooseMedia({
|
||||||
|
count: 1, // 上传视频的个数
|
||||||
|
mediaType: ['image'], // 限制上传的类型为image
|
||||||
|
sourceType: ['album'], // 可以指定来源是相册还是相机
|
||||||
|
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
||||||
|
success: (res) => { // 获取临时存放的视频资源
|
||||||
|
console.log(res.tempFiles)
|
||||||
|
console.log(res)
|
||||||
|
for (let item of res.tempFiles) {
|
||||||
|
console.log(item, '====')
|
||||||
|
let type = item.fileType == 'video' ? 'video' : 'img'
|
||||||
|
vm.uploadFile(item.tempFilePath, type, item.tempFilePath)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: () => {
|
||||||
|
vm.$emit('changeVal', '')
|
||||||
|
vm.modalName = ''
|
||||||
|
wx.hideLoading()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onCamera() {
|
||||||
|
let vm = this
|
||||||
|
vm.cancelFn()
|
||||||
|
wx.chooseMedia({
|
||||||
|
count: 1,
|
||||||
|
mediaType: ['image'], // 限制上传的类型为image
|
||||||
|
sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
||||||
|
sourceType: ['camera'], // 可以指定来源是相册还是相机
|
||||||
|
success: (res) => { // 获取临时存放的视频资源
|
||||||
|
vm.cancelFn()
|
||||||
|
for (let item of res.tempFiles) {
|
||||||
|
console.log(item, '====')
|
||||||
|
let type = item.fileType == 'video' ? 'video' : 'img'
|
||||||
|
vm.uploadFile(item.tempFilePath, type, item.tempFilePath)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: () => {
|
||||||
|
vm.$emit('changeVal', '')
|
||||||
|
vm.modalName = ''
|
||||||
|
wx.hideLoading()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
uploadFile(filePaths, type, name) {
|
||||||
|
let vm = this
|
||||||
|
console.log(filePaths, 'filePaths')
|
||||||
|
if (vm.uploadData) {
|
||||||
|
vm.$showLoading(`${vm.i18nL.components.uploadPic.Ace6}`)
|
||||||
|
let fileName = new Date().getTime() + Math.floor(Math.random() * 150) + '.' + type.split('/').pop().toLowerCase()
|
||||||
|
let filePath = vm.uploadData.host + '/' + vm.uploadData.dir + fileName
|
||||||
|
wx.uploadFile({
|
||||||
|
url: vm.uploadData.host,
|
||||||
|
filePath: filePaths,
|
||||||
|
name: 'file',
|
||||||
|
formData: {
|
||||||
|
key: vm.uploadData.dir + fileName,
|
||||||
|
policy: vm.uploadData.policy,
|
||||||
|
OSSAccessKeyId: vm.uploadData.access_id,
|
||||||
|
signature: vm.uploadData.signature
|
||||||
|
},
|
||||||
|
header: {
|
||||||
|
'Authorization': 'Bearer ' + wx.getStorageSync('token'),
|
||||||
|
// 'content-type': 'multipart/form-data',
|
||||||
|
'X-Requested-With': 'XMLHttpRequest'
|
||||||
|
},
|
||||||
|
success: (res) => {
|
||||||
|
if (res.statusCode === 204) {
|
||||||
|
console.log(filePath, '上传成功')
|
||||||
|
let dataV2 = {
|
||||||
|
filePath: filePath,
|
||||||
|
type: type,
|
||||||
|
name: name
|
||||||
|
}
|
||||||
|
wx.hideLoading()
|
||||||
|
vm.$emit('changeVal', dataV2)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
wx.showModal({ // 使用模态框提示用户进行操作
|
||||||
|
title: `${vm.i18nL.components.uploadPic.Ace7}:`,
|
||||||
|
content: `${vm.i18nL.components.uploadPic.Ace8}` + err,
|
||||||
|
showCancel: false,
|
||||||
|
confirmText: `${vm.i18nL.components.uploadPic.Ace12}`,
|
||||||
|
success: function (res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
vm.$gotoBack(1)
|
||||||
|
vm.$emit('changeVal', '')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
let vm = this
|
||||||
|
vm.$showToast(`${vm.i18nL.components.uploadPic.Ace15}`)
|
||||||
|
wx.request({
|
||||||
|
url: `${service.host}/get/oss/config`,
|
||||||
|
header: {
|
||||||
|
'Authorization': 'Bearer ' + wx.getStorageSync('token'),
|
||||||
|
'X-Requested-With': 'XMLHttpRequest'
|
||||||
|
},
|
||||||
|
method: 'get',
|
||||||
|
data: {},
|
||||||
|
success: ({code, data}) => {
|
||||||
|
vm.uploadData = data.data
|
||||||
|
vm.$app.$options.globalData.uploadData = data.data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
console.log('1111111111')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
cancelFn() { // 取消方法
|
||||||
|
wx.hideLoading()
|
||||||
|
this.$emit('closeUploadPic', '')
|
||||||
|
},
|
||||||
|
getOssConfig() {
|
||||||
|
let vm = this
|
||||||
|
wx.request({
|
||||||
|
url: `${service.host}/get/oss/config`,
|
||||||
|
header: {
|
||||||
|
'Authorization': 'Bearer ' + wx.getStorageSync('token'),
|
||||||
|
'X-Requested-With': 'XMLHttpRequest'
|
||||||
|
},
|
||||||
|
method: 'get',
|
||||||
|
data: {},
|
||||||
|
success: ({code, data}) => {
|
||||||
|
vm.uploadData = data.data
|
||||||
|
vm.$app.$options.globalData.uploadData = data.data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
let vm = this
|
||||||
|
vm.getOssConfig()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
211
src/components/uploadPics.wpy
Normal file
@ -0,0 +1,211 @@
|
|||||||
|
<style lang="less">
|
||||||
|
page {}
|
||||||
|
|
||||||
|
.upload_file {
|
||||||
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
._item {
|
||||||
|
padding: 32rpx;
|
||||||
|
border-bottom: 1rpx solid #f5f5f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
._cancel {
|
||||||
|
border-top: 16rpx solid #f8f8f8;
|
||||||
|
margin-bottom: 24rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
<template>
|
||||||
|
<view :class="{'~show': chooseShow}" class="~cu-modal ~bottom-modal">
|
||||||
|
<view class="~cu-dialog" style="border-radius: 32rpx 32rpx 0 0;">
|
||||||
|
<view class="~bg_f upload_file">
|
||||||
|
<view class="_title _item ~font_32" catchtap="onCamera">{{i18nL.components.uploadPic.Ace1}}</view>
|
||||||
|
<view class="_title _item ~font_32" catchtap="chooseImageV2">{{i18nL.components.uploadPic.Ace2}}</view>
|
||||||
|
<view class="_title _item ~font_32 ~color333 _cancel" @tap="cancelFn">{{i18nL.components.uploadPic.Ace3}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import wepy from '@wepy/core'
|
||||||
|
import {service} from '../config'
|
||||||
|
import base from '../mixins/base'
|
||||||
|
import https from '../mixins/https'
|
||||||
|
|
||||||
|
wepy.component({
|
||||||
|
props: {
|
||||||
|
chooseShow: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
num: {
|
||||||
|
type: Number,
|
||||||
|
default: 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
uploadData: null,
|
||||||
|
uploader: {},
|
||||||
|
videos: [],
|
||||||
|
uploadFiles: []
|
||||||
|
},
|
||||||
|
mixins: [https, base],
|
||||||
|
methods: {
|
||||||
|
chooseImageV2() { // 上传照片
|
||||||
|
let vm = this
|
||||||
|
vm.$showLoading(`${vm.i18nL.components.uploadPic.Ace5}`)
|
||||||
|
vm.cancelFn()
|
||||||
|
console.log(vm.num, '777777777777777777')
|
||||||
|
wx.chooseMedia({
|
||||||
|
count: vm.num, // 上传视频的个数
|
||||||
|
mediaType: ['image'], // 限制上传的类型为image
|
||||||
|
sourceType: ['album'], // 可以指定来源是相册还是相机
|
||||||
|
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
||||||
|
success: (res) => { // 获取临时存放的视频资源
|
||||||
|
console.log(res.tempFiles)
|
||||||
|
console.log(res)
|
||||||
|
for (let item of res.tempFiles) {
|
||||||
|
console.log(item, '====')
|
||||||
|
let type = item.fileType == 'video' ? 'video' : 'img'
|
||||||
|
if (!/\.(jpg|jpeg|png|JPG|PNG|JPEG)$/.test(item.tempFilePath)) {
|
||||||
|
vm.$showToast('上传图片只能是 jpg、png、jpeg 格式!')
|
||||||
|
} else {
|
||||||
|
vm.uploadFile(item.tempFilePath, type, item.tempFilePath)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: () => {
|
||||||
|
vm.$emit('changeVal', '')
|
||||||
|
vm.modalName = ''
|
||||||
|
wx.hideLoading()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onCamera() {
|
||||||
|
let vm = this
|
||||||
|
vm.cancelFn()
|
||||||
|
wx.chooseMedia({
|
||||||
|
count: 1,
|
||||||
|
mediaType: ['image'], // 限制上传的类型为image
|
||||||
|
sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
||||||
|
sourceType: ['camera'], // 可以指定来源是相册还是相机
|
||||||
|
success: (res) => { // 获取临时存放的视频资源
|
||||||
|
vm.cancelFn()
|
||||||
|
for (let item of res.tempFiles) {
|
||||||
|
console.log(item, '====')
|
||||||
|
let type = item.fileType == 'video' ? 'video' : 'img'
|
||||||
|
if (!/\.(jpg|jpeg|png|JPG|PNG|JPEG)$/.test(item.tempFilePath)) {
|
||||||
|
vm.$showToast('上传图片只能是 jpg、png、jpeg 格式!')
|
||||||
|
} else {
|
||||||
|
vm.uploadFile(item.tempFilePath, type, item.tempFilePath)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: () => {
|
||||||
|
vm.$emit('changeVal', '')
|
||||||
|
vm.modalName = ''
|
||||||
|
wx.hideLoading()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
uploadFile(filePaths, type, name) {
|
||||||
|
let vm = this
|
||||||
|
console.log(filePaths, 'filePaths')
|
||||||
|
if (vm.uploadData) {
|
||||||
|
vm.$showLoading(`${vm.i18nL.components.uploadPic.Ace6}`)
|
||||||
|
let fileName = new Date().getTime() + Math.floor(Math.random() * 150) + '.' + type.split('/').pop().toLowerCase()
|
||||||
|
let filePath = vm.uploadData.host + '/' + vm.uploadData.dir + fileName
|
||||||
|
wx.uploadFile({
|
||||||
|
url: vm.uploadData.host,
|
||||||
|
filePath: filePaths,
|
||||||
|
name: 'file',
|
||||||
|
formData: {
|
||||||
|
key: vm.uploadData.dir + fileName,
|
||||||
|
policy: vm.uploadData.policy,
|
||||||
|
OSSAccessKeyId: vm.uploadData.access_id,
|
||||||
|
signature: vm.uploadData.signature
|
||||||
|
},
|
||||||
|
header: {
|
||||||
|
'Authorization': 'Bearer ' + wx.getStorageSync('token'),
|
||||||
|
// 'content-type': 'multipart/form-data',
|
||||||
|
'X-Requested-With': 'XMLHttpRequest'
|
||||||
|
},
|
||||||
|
success: (res) => {
|
||||||
|
if (res.statusCode === 204) {
|
||||||
|
console.log(filePath, '上传成功')
|
||||||
|
let dataV2 = {
|
||||||
|
filePath: filePath,
|
||||||
|
type: type,
|
||||||
|
name: name
|
||||||
|
}
|
||||||
|
wx.hideLoading()
|
||||||
|
vm.$emit('changeVal', dataV2)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
wx.showModal({ // 使用模态框提示用户进行操作
|
||||||
|
title: `${vm.i18nL.components.uploadPic.Ace7}:`,
|
||||||
|
content: `${vm.i18nL.components.uploadPic.Ace8}` + err,
|
||||||
|
showCancel: false,
|
||||||
|
confirmText: `${vm.i18nL.components.uploadPic.Ace12}`,
|
||||||
|
success: function (res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
vm.$gotoBack(1)
|
||||||
|
vm.$emit('changeVal', '')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
let vm = this
|
||||||
|
vm.$showToast(`${vm.i18nL.components.uploadPic.Ace15}`)
|
||||||
|
wx.request({
|
||||||
|
url: `${service.host}/get/oss/config`,
|
||||||
|
header: {
|
||||||
|
'Authorization': 'Bearer ' + wx.getStorageSync('token'),
|
||||||
|
'X-Requested-With': 'XMLHttpRequest'
|
||||||
|
},
|
||||||
|
method: 'get',
|
||||||
|
data: {},
|
||||||
|
success: ({code, data}) => {
|
||||||
|
vm.uploadData = data.data
|
||||||
|
vm.$app.$options.globalData.uploadData = data.data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
console.log('1111111111')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
cancelFn() { // 取消方法
|
||||||
|
wx.hideLoading()
|
||||||
|
this.$emit('closeUploadPic', '')
|
||||||
|
},
|
||||||
|
getOssConfig() {
|
||||||
|
let vm = this
|
||||||
|
wx.request({
|
||||||
|
url: `${service.host}/get/oss/config`,
|
||||||
|
header: {
|
||||||
|
'Authorization': 'Bearer ' + wx.getStorageSync('token'),
|
||||||
|
'X-Requested-With': 'XMLHttpRequest'
|
||||||
|
},
|
||||||
|
method: 'get',
|
||||||
|
data: {},
|
||||||
|
success: ({code, data}) => {
|
||||||
|
vm.uploadData = data.data
|
||||||
|
vm.$app.$options.globalData.uploadData = data.data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
let vm = this
|
||||||
|
if (vm.$app.$options.globalData.uploadData) {
|
||||||
|
vm.uploadData = vm.$app.$options.globalData.uploadData
|
||||||
|
} else {
|
||||||
|
vm.getOssConfig()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
135
src/components/wxShareCom.wpy
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
<style lang="less" scoped>
|
||||||
|
._pic{
|
||||||
|
width: 100%;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
}
|
||||||
|
._icon_close{
|
||||||
|
z-index: 99999;
|
||||||
|
}
|
||||||
|
._save_btn{
|
||||||
|
width: 600rpx;
|
||||||
|
height: 80rpx;
|
||||||
|
background: linear-gradient(90deg, #9DC0F8 0%, #508AFC 100%);
|
||||||
|
border-radius: 40rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<template>
|
||||||
|
<view class="~cu-modal {{modalName=='Modal'?'~show':''}}">
|
||||||
|
<view class="~cu-dialog" style="padding: 50rpx 30rpx;">
|
||||||
|
<image class="~_icon_close" src="~@/images/icon/close_icon.png" mode="aspectFit" @tap="cancelFn"></image>
|
||||||
|
<view class="~_c ~font_32 ~color333 ~bold">分享至</view>
|
||||||
|
<view class="~f-fcc ~ui-mt-40">
|
||||||
|
<button class="~_wx_box ~color999 ~btn" open-type="share" @tap="cancelFn">
|
||||||
|
<image class="~_icon_wx" src="~@/images/icon/wx_icon.png" mode="aspectFit"></image>
|
||||||
|
<view class="~color666 ~font_24 ~ui-mt-10">微信好友</view>
|
||||||
|
</button>
|
||||||
|
<view class="~_wx_box ~color999 ~_wx_pyq" @tap="changeShare">
|
||||||
|
<image class="~_icon_wx" src="~@/images/icon/pyq_icon.png" mode="aspectFit"></image>
|
||||||
|
<view class="~color666 ~font_24 ~ui-mt-10">朋友圈</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="~cu-modal {{modalName=='showPic'?'~show':''}}">
|
||||||
|
<view class="~cu-dialog" style="padding: 0; background: none;border-radius: 0;">
|
||||||
|
<image class="~_icon_close_pic _icon_close" src="~@/images/icon/close_icon_v3.png" mode="aspectFit" @tap="cancelFn"></image>
|
||||||
|
<image class="_pic" src="{{sharePic}}" mode="widthFix" @tap="cancelFn"></image>
|
||||||
|
<view class="_save_btn ~spacing2 ~font_30 ~f-fcc ~ui-mt-24 ~white" @tap="saveImgFn()">保存至相册,分享给好友或朋友圈</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="~cu-modal {{modalName=='showSet'?'~show':''}}">
|
||||||
|
<view class="~cu-dialog" style="padding-top: 58rpx;">
|
||||||
|
<view class="~_t ~font_32 ~color333 ~text-center ~bold">提示</view>
|
||||||
|
<view class="~_c ~font_32 ~color333 ~text-center ~ui-mt-30">
|
||||||
|
需要你授权才能保存到相册哦
|
||||||
|
</view>
|
||||||
|
<view class="~f-fcc ~marginT12">
|
||||||
|
<view class="~cancel ~ui-mt-40 ~f-fcc ~color999 ~font_28" @tap="cancelFn">取消</view>
|
||||||
|
<button class="~btn ~confirm ~ui-mt-40 ~f-fcc ~white ~font_28" open-type="openSetting" @opensetting="openSetSaveImg($wx)">
|
||||||
|
打开设置
|
||||||
|
</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import wepy from '@wepy/core'
|
||||||
|
|
||||||
|
wepy.component({
|
||||||
|
props: {
|
||||||
|
modalName: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
twoWay: true
|
||||||
|
},
|
||||||
|
sharePic: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
twoWay: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
},
|
||||||
|
mixins: [],
|
||||||
|
methods: {
|
||||||
|
changeShare() {
|
||||||
|
this.modalName = 'showPic'
|
||||||
|
},
|
||||||
|
cancelFn() {
|
||||||
|
this.modalName = ''
|
||||||
|
this.$emit('modalFn', this.modalName)
|
||||||
|
},
|
||||||
|
openSetSaveImg(e) { // 打开设置,且保存到相册
|
||||||
|
let vm = this
|
||||||
|
if (e.detail.authSetting['scope.writePhotosAlbum']) {
|
||||||
|
vm.modalName = ''
|
||||||
|
wx.saveImageToPhotosAlbum({
|
||||||
|
filePath: vm.sharePic,
|
||||||
|
success: () => {
|
||||||
|
wx.showModal({
|
||||||
|
title: '保存成功',
|
||||||
|
content: '赶紧分享给你的朋友吧!',
|
||||||
|
showCancel: false
|
||||||
|
})
|
||||||
|
vm.$emit('modalFn', vm.modalName)
|
||||||
|
},
|
||||||
|
fail: () => {
|
||||||
|
console.log('取消了')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
saveImgFn() {
|
||||||
|
let vm = this
|
||||||
|
wx.saveImageToPhotosAlbum({
|
||||||
|
filePath: vm.sharePic,
|
||||||
|
success: () => {
|
||||||
|
vm.modalName = ''
|
||||||
|
vm.$emit('modalFn', vm.modalName)
|
||||||
|
wx.showModal({
|
||||||
|
title: '已保存在相册了!',
|
||||||
|
content: '赶紧分享给你的朋友吧!',
|
||||||
|
showCancel: false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
fail: () => {
|
||||||
|
wx.getSetting({
|
||||||
|
success(res) {
|
||||||
|
if (!res.authSetting['scope.writePhotosAlbum']) {
|
||||||
|
vm.modalName = 'showSet'
|
||||||
|
vm.$emit('modalFn', vm.modalName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
attached() {
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
34
src/config.js
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
/* ========================================================
|
||||||
|
小程序配置文件
|
||||||
|
======================================================== */
|
||||||
|
// 域名
|
||||||
|
var host = ''
|
||||||
|
var hostGo = ''
|
||||||
|
|
||||||
|
// if (_NODE_) {
|
||||||
|
host = 'https://love.ufutx.com/api' // 线上环境
|
||||||
|
hostGo = 'https://love.ufutx.com/go/api' // 线上环境
|
||||||
|
// host = 'http://health.ufutx.net/api' // 本地环境
|
||||||
|
// hostGo = 'http://health.ufutx.net/go/api' // 本地环境
|
||||||
|
// } else {
|
||||||
|
// host = 'https://love.ufutx.com/api' // 线上环境
|
||||||
|
// }
|
||||||
|
|
||||||
|
export const service = {
|
||||||
|
host: `${host}`,
|
||||||
|
// go语言接口
|
||||||
|
hostGo: `${hostGo}`,
|
||||||
|
// 登录接口
|
||||||
|
login: `${host}/login/wechat`,
|
||||||
|
|
||||||
|
// 绑定手机号
|
||||||
|
bindMobile: `${host}/bind/mobile`,
|
||||||
|
// 保存资料
|
||||||
|
saveBaseData: `${host}/user/info`,
|
||||||
|
// 获取手机号验证码
|
||||||
|
getMobileCode: `${host}/mobile/code`
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
service
|
||||||
|
}
|
||||||
8
src/i18n/index.js
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import zh from '../i18n/modules/zh.js'
|
||||||
|
import en from '../i18n/modules/en.js'
|
||||||
|
// import en from './modules/en.json'
|
||||||
|
const lang = {
|
||||||
|
zh_CN: zh,
|
||||||
|
en_US: en
|
||||||
|
}
|
||||||
|
export default lang
|
||||||
1133
src/i18n/modules/en.js
Normal file
1135
src/i18n/modules/zh.js
Normal file
BIN
src/images/icon/close_icon.png
Normal file
|
After Width: | Height: | Size: 500 B |
BIN
src/images/icon/close_icon_v3.png
Normal file
|
After Width: | Height: | Size: 987 B |
BIN
src/images/icon/pyq_icon.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
src/images/icon/selected.png
Normal file
|
After Width: | Height: | Size: 428 B |
BIN
src/images/icon/unselected.png
Normal file
|
After Width: | Height: | Size: 270 B |
BIN
src/images/icon/wx_icon.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
src/images/tabbar/activeHome.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
src/images/tabbar/activeMy.png
Normal file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
src/images/tabbar/activeServe.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
src/images/tabbar/inactiveHome.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
src/images/tabbar/inactiveMy.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
src/images/tabbar/inactiveServe.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
1
src/miniprogram-i18n/index.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
class t{locale;locales;context;constructor(t){this.locale="",this.locales=t||{}}setLocale(t){this.locale=t}getLocale(){return this.locale}loadTranslations(t){return this.locales=t,this.context&&this.effect(this.context)}mergeTranslations(t){for(const e in t)this.locales[e]?this.locales[e]={...this.locales[e],...t[e]}:this.locales[e]=t[e];return this.context&&this.effect(this.context)}getLanguage(){return this.locales[this.locale]}effect(t){if(this.context=t,t.setData)return new Promise((e=>{t.setData({$language:this.getLanguage()},(()=>{e(t.$language)}))}))}toggleLanguage(t){return this.setLocale(t),this.effect(this.context)}}const e=new t;export{t as I18n,e as default,e as i18nInstance};
|
||||||
285
src/mixins/base.js
Normal file
@ -0,0 +1,285 @@
|
|||||||
|
/* ========================================================
|
||||||
|
小程序基础公用方法,类似于弹框.....等
|
||||||
|
======================================================== */
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data: {
|
||||||
|
i18nL: null
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
$callPhone(mobile) {
|
||||||
|
wx.makePhoneCall({
|
||||||
|
phoneNumber: mobile,
|
||||||
|
success: function () {
|
||||||
|
console.log('拨打电话成功!')
|
||||||
|
},
|
||||||
|
fail: function () {
|
||||||
|
console.log('拨打电话失败!')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
$setTabBarItemI18n() { // 设置TabBar - I18N
|
||||||
|
wx.setTabBarItem({
|
||||||
|
index: 0,
|
||||||
|
'text': this.i18nL.pages.tabBar.home.Ace23
|
||||||
|
})
|
||||||
|
wx.setTabBarItem({
|
||||||
|
index: 1,
|
||||||
|
'text': this.i18nL.pages.tabBar.menu.menuData13
|
||||||
|
})
|
||||||
|
wx.setTabBarItem({
|
||||||
|
index: 2,
|
||||||
|
'text': this.i18nL.pages.tabBar.user.title
|
||||||
|
})
|
||||||
|
},
|
||||||
|
$setNavigationBarTitleI18n(title) { // 设置顶部title-i18n
|
||||||
|
wx.setNavigationBarTitle({
|
||||||
|
title: title
|
||||||
|
})
|
||||||
|
},
|
||||||
|
$showToast(title) {
|
||||||
|
wx.showToast({
|
||||||
|
title: title,
|
||||||
|
icon: 'none',
|
||||||
|
duration: 1200
|
||||||
|
})
|
||||||
|
},
|
||||||
|
$Toast_success(title) {
|
||||||
|
wx.showToast({
|
||||||
|
title: title,
|
||||||
|
icon: 'success',
|
||||||
|
duration: 1200
|
||||||
|
})
|
||||||
|
},
|
||||||
|
$isJson (str) {
|
||||||
|
if (isNaN(Number(str))) {
|
||||||
|
try {
|
||||||
|
JSON.parse(str)
|
||||||
|
return true
|
||||||
|
} catch (e) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
},
|
||||||
|
$isNull (str) {
|
||||||
|
if (str == '') return true
|
||||||
|
|
||||||
|
var regu = '^[ ]+$'
|
||||||
|
|
||||||
|
var re = new RegExp(regu)
|
||||||
|
|
||||||
|
return re.test(str)
|
||||||
|
},
|
||||||
|
$Toast_error(title) {
|
||||||
|
wx.showToast({
|
||||||
|
title: title,
|
||||||
|
icon: 'error',
|
||||||
|
duration: 1200
|
||||||
|
})
|
||||||
|
},
|
||||||
|
$showLoading(title) {
|
||||||
|
wx.showLoading({
|
||||||
|
title: title,
|
||||||
|
mask: true
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 跳转链接
|
||||||
|
$goto(url) { // 普通跳转,有路由栈限制
|
||||||
|
wx.navigateTo({url: url})
|
||||||
|
},
|
||||||
|
$gotoTab(url) { // 跳转至tabBar
|
||||||
|
wx.switchTab({url: url})
|
||||||
|
},
|
||||||
|
$redirectTo(url) { // 关闭当前页面
|
||||||
|
wx.redirectTo({url: url})
|
||||||
|
},
|
||||||
|
$reLaunchTo(url) { // 关闭所有页面
|
||||||
|
wx.redirectTo({url: url})
|
||||||
|
},
|
||||||
|
$gotoBack(num) {
|
||||||
|
wx.navigateBack({
|
||||||
|
delta: num
|
||||||
|
})
|
||||||
|
},
|
||||||
|
$goToService() {
|
||||||
|
wx.openCustomerServiceChat({
|
||||||
|
extInfo: {url: 'https://work.weixin.qq.com/kfid/kfcc9fc8ab1387b7e89'},
|
||||||
|
corpId: 'wwf4b1ba746056e63a',
|
||||||
|
success(res) {}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
$gotoH5(URL) {
|
||||||
|
console.log(encodeURIComponent(URL))
|
||||||
|
wx.navigateTo({url: '/pages/test?url=' + encodeURIComponent(URL)})
|
||||||
|
},
|
||||||
|
$createSelectorQuery(id) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
wx.createSelectorQuery().select(id).boundingClientRect(function (rect) {
|
||||||
|
resolve(rect)
|
||||||
|
// 节点的上边界坐标
|
||||||
|
// let top = rect.top // 节点的下边界坐标
|
||||||
|
// let bottom = rect.bottom
|
||||||
|
}).exec()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
$getCurrentPageUrl() { // 获取当前页面路由
|
||||||
|
const pages = getCurrentPages()
|
||||||
|
const currentPage = pages[pages.length - 1]
|
||||||
|
const url = `/${currentPage.route}`
|
||||||
|
return url
|
||||||
|
},
|
||||||
|
$getCurrentLastPageUrl() { // 获取上个页面路由
|
||||||
|
const pages = getCurrentPages()
|
||||||
|
const currentPage = pages[pages.length - 2]
|
||||||
|
const url = `/${currentPage.route}`
|
||||||
|
return url
|
||||||
|
},
|
||||||
|
// 预览单图
|
||||||
|
$previewImage(image) {
|
||||||
|
let imageArray = []
|
||||||
|
imageArray.push(image)
|
||||||
|
console.log(imageArray)
|
||||||
|
wx.previewImage({
|
||||||
|
current: image, // 当前显示图片的http链接
|
||||||
|
urls: imageArray // 需要预览的图片http链接列表
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 预览多图
|
||||||
|
$previewImages(image, imageArray) {
|
||||||
|
wx.previewImage({
|
||||||
|
current: image, // 当前显示图片的http链接
|
||||||
|
urls: imageArray // 需要预览的图片http链接列表
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 打开文档
|
||||||
|
$openDocument(url) {
|
||||||
|
wx.showLoading({
|
||||||
|
title: '正在打开文件',
|
||||||
|
mask: true
|
||||||
|
})
|
||||||
|
wx.downloadFile({
|
||||||
|
// 示例 url,并非真实存在
|
||||||
|
url: url,
|
||||||
|
success: function (res) {
|
||||||
|
const filePath = res.tempFilePath
|
||||||
|
wx.openDocument({
|
||||||
|
filePath: filePath,
|
||||||
|
success: function (res) {
|
||||||
|
console.log('打开文档成功')
|
||||||
|
wx.hideLoading()
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.log(err)
|
||||||
|
wx.hideLoading()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
$contrastTime(st, et) {
|
||||||
|
console.log(`开始${st}`, `结束${et}`)
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
if (st && et) {
|
||||||
|
var stdt = new Date(st.replace(/-/g, '/'))
|
||||||
|
var etdt = new Date(et.replace(/-/g, '/'))
|
||||||
|
console.log(stdt, etdt)
|
||||||
|
|
||||||
|
// let createTime = res.date.replace(/-/g, '/');
|
||||||
|
if (stdt > etdt) {
|
||||||
|
let vm = this
|
||||||
|
wx.showModal({ // 使用模态框提示用户进行操作
|
||||||
|
title: '温馨提示',
|
||||||
|
content: '开始时间必须小于结束时间,请重新选择!',
|
||||||
|
showCancel: false,
|
||||||
|
confirmText: `${vm.i18nL.components.uploadPic.Ace12}`,
|
||||||
|
success: function (res) {
|
||||||
|
reject(new Error(`开始时间需小于结束时间`))
|
||||||
|
// if (res.confirm) {
|
||||||
|
// vm.formData.link_file.splice(index, 1)
|
||||||
|
// } else if (res.cancel) {
|
||||||
|
// console.log('用户点击取消')
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// this.$showToast('')
|
||||||
|
|
||||||
|
// } else if (stdt == etdt) {
|
||||||
|
// this.$showToast('开始时间不能等于结束时间')
|
||||||
|
// reject(new Error(`开始时间不能等于结束时间`))
|
||||||
|
} else {
|
||||||
|
console.log('时间合理')
|
||||||
|
resolve()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
resolve()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
$getsubscription(ids) {
|
||||||
|
let subscriptionsSetting = wx.getStorageSync('subscriptionsSetting')
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
if (subscriptionsSetting && subscriptionsSetting == 'true') {
|
||||||
|
reject(resV)
|
||||||
|
} else {
|
||||||
|
wx.getSetting({
|
||||||
|
withSubscriptions: true,
|
||||||
|
success(resV) {
|
||||||
|
let {itemSettings, mainSwitch} = resV.subscriptionsSetting
|
||||||
|
if (!mainSwitch) {
|
||||||
|
resolve(resV)
|
||||||
|
return console.log('需要跳转到授权页面')
|
||||||
|
}
|
||||||
|
if (!itemSettings) {
|
||||||
|
wx.setStorageSync('subscriptionsSetting', 'false')
|
||||||
|
console.log('需要授权')
|
||||||
|
wx.requestSubscribeMessage({
|
||||||
|
tmplIds: ids, // 此处可填写多个模板 ID,但低版本微信不兼容只能授权一个
|
||||||
|
success(res) {
|
||||||
|
if (res[ids[0]] === 'accept') {
|
||||||
|
console.log('订阅成功')
|
||||||
|
} else {
|
||||||
|
console.log('拒绝授权')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
complete(res) {
|
||||||
|
resolve(res)
|
||||||
|
console.log('complete 调用完成')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
console.log('授权成功')
|
||||||
|
wx.setStorageSync('subscriptionsSetting', 'true')
|
||||||
|
reject(resV)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
$getSystemInfo() {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
wx.getSystemInfo({
|
||||||
|
success: (res) => {
|
||||||
|
console.log(res)
|
||||||
|
resolve(res)
|
||||||
|
// 获取可使用窗口宽度
|
||||||
|
// let clientHeight = res.windowHeight
|
||||||
|
// 获取可使用窗口高度
|
||||||
|
// let clientWidth = res.windowWidth
|
||||||
|
// 算出比例
|
||||||
|
// let ratio = 750 / clientWidth
|
||||||
|
// 算出高度(单位rpx)
|
||||||
|
// let height = clientHeight * ratio
|
||||||
|
// 设置高度
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.i18nL = this.$app.$options.globalData.i18nL
|
||||||
|
}
|
||||||
|
}
|
||||||
240
src/mixins/https.js
Normal file
@ -0,0 +1,240 @@
|
|||||||
|
import utils from '../utils/util'
|
||||||
|
import {service} from '../config'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data: {
|
||||||
|
errorOne: 1,
|
||||||
|
errorTwo: 1,
|
||||||
|
mixin: 'MixinText'
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/* =================== [$get 发起GET请求] =================== */
|
||||||
|
$get({url = '', headers = {}, data = {}, timeout = 8000}) {
|
||||||
|
let vm = this
|
||||||
|
const methods = 'GET'
|
||||||
|
vm.$showLoading('')
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
this.$ajax({url, headers, methods, data, timeout}).then(({code, data}) => {
|
||||||
|
resolve({code, data})
|
||||||
|
}).catch((err) => {
|
||||||
|
reject(err)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
$post({url = '', headers = {}, data = {}, timeout = 8000}) {
|
||||||
|
const methods = 'POST'
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
this.$ajax({url, headers, methods, data, timeout}).then(({code, data}) => {
|
||||||
|
resolve({code, data})
|
||||||
|
}).catch((err) => {
|
||||||
|
reject(err)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
$put({url = '', headers = {}, data = {}, timeout = 8000}) {
|
||||||
|
const methods = 'PUT'
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
this.$ajax({url, headers, methods, data, timeout}).then(({code, data}) => {
|
||||||
|
resolve({code, data})
|
||||||
|
}).catch((err) => {
|
||||||
|
reject(err)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
$delete({url = '', headers = {}, data = {}, timeout = 8000}) {
|
||||||
|
const methods = 'DELETE'
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
this.$ajax({url, headers, methods, data, timeout}).then(({code, data}) => {
|
||||||
|
resolve({code, data})
|
||||||
|
}).catch((err) => {
|
||||||
|
reject(err)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
$ajax({url = '', headers = {}, methods = 'GET', data = {}}) {
|
||||||
|
// 增强体验:顶部加载中
|
||||||
|
wx.showNavigationBarLoading()
|
||||||
|
let versions = this.$app.$options.globalData.versions
|
||||||
|
let params = {
|
||||||
|
XDEBUG_SESSION_START: '1',
|
||||||
|
version: versions,
|
||||||
|
from_user_id: wx.getStorageSync('from_user_id') || '',
|
||||||
|
agent_user_id: wx.getStorageSync('agent_user_id') || '',
|
||||||
|
agent: wx.getStorageSync('agent') || '',
|
||||||
|
from_source: 'mp',
|
||||||
|
from_type: wx.getStorageSync('fromType') || ''
|
||||||
|
}
|
||||||
|
// 构造请求体
|
||||||
|
let requestUrl = `${url}${url.includes('?') ? '&' : '?'}` + Object.keys(params).map(i => `${i}=${encodeURIComponent(params[i] || '')}`).join('&')
|
||||||
|
const request = {
|
||||||
|
url: requestUrl,
|
||||||
|
timeout: 10000,
|
||||||
|
method: ['GET', 'POST', 'PUT', 'DELETE'].indexOf(methods) > -1 ? methods : 'GET',
|
||||||
|
header: Object.assign({
|
||||||
|
'Authorization': 'Bearer ' + wx.getStorageSync('token'),
|
||||||
|
'X-Requested-With': 'XMLHttpRequest'
|
||||||
|
}, headers),
|
||||||
|
data: Object.assign({ // set something global
|
||||||
|
}, data)
|
||||||
|
}
|
||||||
|
// 控制台调试日志
|
||||||
|
// console.table(request)
|
||||||
|
// 发起请求
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
let vm = this
|
||||||
|
wx.request(Object.assign(request, {
|
||||||
|
success: ({statusCode, data}) => {
|
||||||
|
wx.hideNavigationBarLoading()
|
||||||
|
const {code, message, notice, operate, path} = data
|
||||||
|
wx.removeStorageSync('message')
|
||||||
|
wx.stopPullDownRefresh()
|
||||||
|
// 控制台调试日志
|
||||||
|
console.log('[SUCCESS]', statusCode, typeof data === 'object' ? data : data.toString().substring(0, 100))
|
||||||
|
// 状态码正常 & 确认有数据
|
||||||
|
if (data.code === 0) {
|
||||||
|
// 成功回调
|
||||||
|
wx.removeStorageSync('formId')
|
||||||
|
resolve({statusCode, ...data})
|
||||||
|
} else if (data.code === 1) {
|
||||||
|
resolve({statusCode, ...data})
|
||||||
|
console.error(data.message)
|
||||||
|
// console.log(this.$app.$options.globalData)
|
||||||
|
if (this.$is == 'pages/service/GroupChatPage' && data.message.includes('已断开连接')) {
|
||||||
|
let vm = this
|
||||||
|
wx.showModal({ // 使用模态框提示用户进行操作
|
||||||
|
title: `${this.i18nL.pages.service.healthMGT.otherShow1}`,
|
||||||
|
content: `${this.i18nL.UpdatePromptText5}`,
|
||||||
|
showCancel: false,
|
||||||
|
confirmText: `${this.i18nL.UpdatePromptText5}`,
|
||||||
|
success: function (res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
wx.hideLoading()
|
||||||
|
wx.navigateBack({
|
||||||
|
delta: 1
|
||||||
|
})
|
||||||
|
// console.log('开始尝试连接WebSocket!readyState=' + vm.$app.$options.globalData.localSocket.readyState)
|
||||||
|
vm.$app.initSocket('http')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
vm.errorOne += 1
|
||||||
|
if (vm.errorOne <= 2) {
|
||||||
|
wx.showModal({ // 使用模态框提示用户进行操作
|
||||||
|
title: `${this.i18nL.pages.service.healthMGT.otherShow1}`,
|
||||||
|
content: data.message,
|
||||||
|
showCancel: false,
|
||||||
|
confirmText: `${this.i18nL.appWpy.confirmText}`,
|
||||||
|
success: function (res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
vm.errorOne = 1
|
||||||
|
wx.hideLoading()
|
||||||
|
wx.navigateBack({
|
||||||
|
delta: 1
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
let errorMessage = {message: '错误,请寻找开发人员协助'}
|
||||||
|
throw errorMessage
|
||||||
|
}
|
||||||
|
wx.hideLoading()
|
||||||
|
} else if (data.code === 2) {
|
||||||
|
console.error(data.message)
|
||||||
|
vm.errorTwo += 1
|
||||||
|
if (vm.errorTwo <= 2) {
|
||||||
|
var pages = getCurrentPages() // 获取加载的页面
|
||||||
|
var currentPage = pages[pages.length - 1] // 获取当前页面的对象
|
||||||
|
var options = currentPage.options
|
||||||
|
let url = ''
|
||||||
|
for (var key in options) {
|
||||||
|
url = `${url}${key}=${options[key]}&`
|
||||||
|
}
|
||||||
|
utils.wx_login().then(({code, data}) => {
|
||||||
|
if (code === 0) {
|
||||||
|
vm.errorTwo = 1
|
||||||
|
if (currentPage.route == 'pages/service/healthMGT') {
|
||||||
|
wx.redirectTo({url: `/${currentPage.route}?${url}`})
|
||||||
|
} else if (data.mobile && data.is_complete_profile) {
|
||||||
|
if (currentPage.route == 'pages/tabBar/home') {
|
||||||
|
wx.reLaunch({url: '/pages/tabBar/home'})
|
||||||
|
} else {
|
||||||
|
wx.redirectTo({url: `/${currentPage.route}?${url}`})
|
||||||
|
}
|
||||||
|
} else if (!data.mobile) {
|
||||||
|
wx.redirectTo({url: `/pages/login`})
|
||||||
|
} else if (!data.is_complete_profile) {
|
||||||
|
wx.redirectTo({url: `/pages/user/registrationMaterial`})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
let errorMessage = {message: '错误,需要重新登录'}
|
||||||
|
throw errorMessage
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
// eslint-disable-next-line prefer-promise-reject-errors
|
||||||
|
reject(err)
|
||||||
|
console.error('[ERROR]', err)
|
||||||
|
},
|
||||||
|
complete: (res) => {
|
||||||
|
wx.hideLoading()
|
||||||
|
if (res.errMsg.indexOf('timeout') > -1) {
|
||||||
|
vm.errorOne += 1
|
||||||
|
let pages = getCurrentPages() // 获取加载的页面
|
||||||
|
if (vm.errorOne <= 2) {
|
||||||
|
wx.showModal({ // 使用模态框提示用户进行操作
|
||||||
|
title: `${this.i18nL.pages.service.healthMGT.otherShow1}`,
|
||||||
|
content: `${this.i18nL.pages.service.healthMGT.Ace26}`,
|
||||||
|
showCancel: false,
|
||||||
|
confirmText: `${this.i18nL.appWpy.confirmText}`,
|
||||||
|
success: function (res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
vm.errorOne = 1
|
||||||
|
wx.hideLoading()
|
||||||
|
if (pages.length > 1) {
|
||||||
|
wx.navigateBack({
|
||||||
|
delta: 1
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
wx.reLaunch({url: '/pages/tabBar/home'})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
console.log('当前网络不稳定!请重试...')
|
||||||
|
let errorMessage = {message: '当前网络不稳定!请重试'}
|
||||||
|
throw errorMessage
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
console.log(this.i18nL)
|
||||||
|
console.log('created in mixin', '插件打印')
|
||||||
|
let vm = this
|
||||||
|
let cacheBodyData = wx.getStorageSync('cacheBodyData')
|
||||||
|
if (cacheBodyData && vm.$app.$options.globalData.resubmit == 1) {
|
||||||
|
let data = {
|
||||||
|
data: cacheBodyData
|
||||||
|
}
|
||||||
|
vm.$app.$options.globalData.resubmit = 2
|
||||||
|
console.log(data, '提交数组数据***********')
|
||||||
|
vm.$post({url: `${service.host}/save/weak/network/fat`, data}).then(({code, data}) => {
|
||||||
|
if (code === 0) {
|
||||||
|
vm.app.globalData.bodyFatData = null
|
||||||
|
wx.setStorageSync('bodyFatData', '1')
|
||||||
|
wx.removeStorageSync('cacheBodyData')
|
||||||
|
}
|
||||||
|
wx.hideLoading()
|
||||||
|
}).catch(err => {
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
214
src/mixins/plugins.js
Normal file
@ -0,0 +1,214 @@
|
|||||||
|
// 转换时间
|
||||||
|
const getTime = (time) => {
|
||||||
|
function getTimeText(argument) {
|
||||||
|
let timeS = argument
|
||||||
|
let todayT = ''
|
||||||
|
let yestodayT = ''
|
||||||
|
let timeCha = getTimeS(timeS)
|
||||||
|
timeS = timeS.slice(-8)
|
||||||
|
todayT = new Date().getHours() * 60 * 60 * 1000 + new Date().getMinutes() * 60 * 1000 + new Date().getSeconds() * 1000
|
||||||
|
yestodayT = todayT + 24 * 60 * 60 * 1000
|
||||||
|
const date = new Date()
|
||||||
|
let year = date.getFullYear()
|
||||||
|
let yea = Number(argument.slice(0, 4))
|
||||||
|
if (timeCha > yestodayT) {
|
||||||
|
if (yea == year) {
|
||||||
|
return argument.slice(5, 11) + (timeS.slice(0, 2) >= 12 ? '下午' + (timeS.slice(0, 2) == 12 ? 12 : timeS.slice(0, 2) - 12) + timeS.slice(2, 5) : '上午' + timeS.slice(0, 5))
|
||||||
|
} else {
|
||||||
|
return timeS.slice(0, 2) >= 12 ? '下午' + (timeS.slice(0, 2) == 12 ? 12 : timeS.slice(0, 2) - 12) + timeS.slice(2, 5) : '上午' + timeS.slice(0, 5)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (timeCha > todayT && timeCha < yestodayT) {
|
||||||
|
return timeS.slice(0, 2) > 12 ? '昨天 下午' + (timeS.slice(0, 2) == 12 ? 12 : timeS.slice(0, 2) - 12) + timeS.slice(2, 5) : '昨天 上午' + timeS.slice(0, 5)
|
||||||
|
}
|
||||||
|
if (timeCha < todayT) {
|
||||||
|
return timeS.slice(0, 2) >= 12 ? '下午' + (timeS.slice(0, 2) == 12 ? 12 : timeS.slice(0, 2) - 12) + timeS.slice(2, 5) : '上午' + timeS.slice(0, 5)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 时间戳获取
|
||||||
|
function getTimeS(argument) {
|
||||||
|
let timeS = argument
|
||||||
|
timeS = timeS.replace(/[-]/g, '/').replace(/[-]/, '')
|
||||||
|
timeS = timeS.replace(/[年月]/g, '/').replace(/[日]/, '')
|
||||||
|
return new Date().getTime() - new Date(timeS).getTime() - 1000 // 有一秒的误差
|
||||||
|
}
|
||||||
|
|
||||||
|
let timeText = getTimeText(time)
|
||||||
|
return timeText
|
||||||
|
}
|
||||||
|
|
||||||
|
// 时间戳是整数,否则要parseInt转换
|
||||||
|
function add0(m) { return m < 10 ? '0' + m : m }
|
||||||
|
const format = (timestamp) => {
|
||||||
|
let time = new Date(timestamp)
|
||||||
|
let y = time.getFullYear()
|
||||||
|
let m = time.getMonth() + 1
|
||||||
|
let d = time.getDate()
|
||||||
|
let h = time.getHours()
|
||||||
|
let mm = time.getMinutes()
|
||||||
|
let s = time.getSeconds()
|
||||||
|
return y + '-' + add0(m) + '-' + add0(d) + ' ' + add0(h) + ':' + add0(mm) + ':' + add0(s)
|
||||||
|
}
|
||||||
|
|
||||||
|
const timeContrast = (startTime, endTime) => {
|
||||||
|
let dateEnd = new Date(endTime.replace(/-/g, '/'))
|
||||||
|
let dateBegin = new Date(startTime.replace(/-/g, '/'))
|
||||||
|
let retValue = {}
|
||||||
|
let date3 = dateEnd.getTime() - dateBegin.getTime() // 时间差的毫秒数
|
||||||
|
// 计算出相差天数
|
||||||
|
let days = Math.floor(date3 / (24 * 3600 * 1000))
|
||||||
|
retValue.Days = days
|
||||||
|
let years = Math.floor(days / 365)
|
||||||
|
retValue.Years = years
|
||||||
|
let months = Math.floor(days / 30)
|
||||||
|
retValue.Months = months
|
||||||
|
// 计算出小时数
|
||||||
|
let leave1 = date3 % (24 * 3600 * 1000) // 计算天数后剩余的毫秒数
|
||||||
|
let hours = Math.floor(leave1 / (3600 * 1000))
|
||||||
|
retValue.Hours = hours
|
||||||
|
// 计算相差分钟数
|
||||||
|
let leave2 = leave1 % (3600 * 1000) // 计算小时数后剩余的毫秒数
|
||||||
|
let minutes = Math.floor(leave2 / (60 * 1000))
|
||||||
|
retValue.Minutes = minutes
|
||||||
|
// 计算相差秒数
|
||||||
|
let leave3 = leave2 % (60 * 1000) // 计算分钟数后剩余的毫秒数
|
||||||
|
let seconds = Math.round(leave3 / 1000)
|
||||||
|
retValue.Seconds = seconds
|
||||||
|
let strTime = ''
|
||||||
|
if (years >= 1) {
|
||||||
|
strTime = years + '年前'
|
||||||
|
} else if (months >= 1) {
|
||||||
|
strTime = months + '个月前'
|
||||||
|
} else if (days >= 1) {
|
||||||
|
strTime = days + '天前'
|
||||||
|
} else if (hours >= 1) {
|
||||||
|
strTime = hours + '小时前'
|
||||||
|
} else {
|
||||||
|
strTime = minutes + '分钟前'
|
||||||
|
}
|
||||||
|
retValue.PubTime = strTime
|
||||||
|
return years >= 1 || months >= 1 || hours >= 1 || minutes >= 5
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取视频时间
|
||||||
|
const getVideoTime = (time) => {
|
||||||
|
let value = time / 1000
|
||||||
|
let theTime = value// 秒
|
||||||
|
let theTime1 = 0// 分
|
||||||
|
let theTime2 = 0// 小时
|
||||||
|
if (theTime > 60) {
|
||||||
|
theTime1 = parseInt(theTime / 60)
|
||||||
|
theTime = parseInt(theTime % 60)
|
||||||
|
if (theTime1 > 60) {
|
||||||
|
theTime2 = parseInt(theTime1 / 60)
|
||||||
|
theTime1 = parseInt(theTime1 % 60)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let result = '' + parseInt(theTime)
|
||||||
|
if (result < 10) {
|
||||||
|
result = '0' + result
|
||||||
|
}
|
||||||
|
if (theTime1 > 0) {
|
||||||
|
result = '' + parseInt(theTime1) + ':' + result
|
||||||
|
if (theTime1 < 10) {
|
||||||
|
result = '0' + result
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
result = '00:' + result
|
||||||
|
}
|
||||||
|
if (theTime2 > 0) {
|
||||||
|
result = '' + parseInt(theTime2) + ':' + result
|
||||||
|
if (theTime2 < 10) {
|
||||||
|
result = '0' + result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
Date.prototype.format = function (format) {
|
||||||
|
let o = {
|
||||||
|
'M+': this.getMonth() + 1, // month
|
||||||
|
'd+': this.getDate(), // day
|
||||||
|
'h+': this.getHours(), // hour
|
||||||
|
'm+': this.getMinutes(), // minute
|
||||||
|
's+': this.getSeconds(), // second
|
||||||
|
'q+': Math.floor((this.getMonth() + 3) / 3), // quarter
|
||||||
|
'S': this.getMilliseconds() // millisecond
|
||||||
|
}
|
||||||
|
if (/(y+)/.test(format)) {
|
||||||
|
format = format.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length))
|
||||||
|
}
|
||||||
|
for (let k in o) {
|
||||||
|
if (new RegExp('(' + k + ')').test(format)) {
|
||||||
|
format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return format
|
||||||
|
}
|
||||||
|
|
||||||
|
const getDiffTime = (recordTime, yearsFlag) => {
|
||||||
|
if (recordTime) {
|
||||||
|
recordTime = new Date(parseFloat(recordTime) * 1000)
|
||||||
|
let minute = 1000 * 60
|
||||||
|
let hour = minute * 60
|
||||||
|
let day = hour * 24
|
||||||
|
let now = new Date()
|
||||||
|
let diff = now - recordTime
|
||||||
|
let result = ''
|
||||||
|
if (diff < 0) {
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
let weekR = diff / (7 * day)
|
||||||
|
let dayC = diff / day
|
||||||
|
let hourC = diff / hour
|
||||||
|
let minC = diff / minute
|
||||||
|
let formate = ''
|
||||||
|
if (weekR >= 1) {
|
||||||
|
formate = 'MM-dd hh:mm'
|
||||||
|
if (yearsFlag) {
|
||||||
|
formate = 'yyyy-MM-dd hh:mm'
|
||||||
|
}
|
||||||
|
return recordTime.format(formate)
|
||||||
|
} else if (dayC == 1 || (hourC < 24 && recordTime.getDate() != now.getDate())) {
|
||||||
|
result = '昨天' + recordTime.format('hh:mm')
|
||||||
|
return result
|
||||||
|
} else if (dayC > 1) {
|
||||||
|
formate = 'MM-dd hh:mm'
|
||||||
|
if (yearsFlag) {
|
||||||
|
formate = 'yyyy-MM-dd hh:mm'
|
||||||
|
}
|
||||||
|
return recordTime.format(formate)
|
||||||
|
} else if (hourC >= 1) {
|
||||||
|
result = parseInt(hourC) + '小时前'
|
||||||
|
return result
|
||||||
|
} else if (minC >= 1) {
|
||||||
|
result = parseInt(minC) + '分钟前'
|
||||||
|
return result
|
||||||
|
} else {
|
||||||
|
result = '刚刚'
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return '数据异常'
|
||||||
|
}
|
||||||
|
|
||||||
|
const getElement_WH = (element) => { // 获取元素位置
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
let query = wx.createSelectorQuery()
|
||||||
|
query.select(element).boundingClientRect((rect) => {
|
||||||
|
if (typeof rect == 'object') {
|
||||||
|
resolve(rect)
|
||||||
|
}
|
||||||
|
}).exec()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
getTime,
|
||||||
|
format,
|
||||||
|
timeContrast,
|
||||||
|
getVideoTime,
|
||||||
|
getDiffTime,
|
||||||
|
getElement_WH
|
||||||
|
}
|
||||||
1201
src/pages/home/information.wpy
Normal file
281
src/pages/home/qualitySingle.wpy
Normal file
@ -0,0 +1,281 @@
|
|||||||
|
<style lang="less" scoped>
|
||||||
|
@import url(../../styles/theme.less);
|
||||||
|
page {
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
}
|
||||||
|
.ui-qualitySingle{
|
||||||
|
padding: 0 30rpx;
|
||||||
|
|
||||||
|
.sub_tab_box {
|
||||||
|
padding: 0 0 62rpx 0;
|
||||||
|
display: inline-flex;
|
||||||
|
._text{
|
||||||
|
width: 270rpx;
|
||||||
|
height: 180rpx;
|
||||||
|
background: rgba(0,0,0,0.2);
|
||||||
|
border-radius: 12rpx;
|
||||||
|
line-height: 180rpx;
|
||||||
|
letter-spacing: 2rpx;
|
||||||
|
}
|
||||||
|
.d_sub_tab {
|
||||||
|
width: 270rpx;
|
||||||
|
height: 180rpx;
|
||||||
|
margin-right: 26rpx;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
background-size: cover;
|
||||||
|
background-position: center;
|
||||||
|
.d_title {
|
||||||
|
margin-top: -4rpx;
|
||||||
|
}
|
||||||
|
.d_dot {
|
||||||
|
height: 32rpx;
|
||||||
|
line-height: 34rpx;
|
||||||
|
padding: 0 12rpx;
|
||||||
|
background: #F86868;
|
||||||
|
border-radius: 16rpx 16rpx 16rpx 0rpx;
|
||||||
|
font-size: 18rpx;
|
||||||
|
position: absolute;
|
||||||
|
right: -32rpx;
|
||||||
|
top: -14rpx;
|
||||||
|
z-index: 99;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-no-data-icon{
|
||||||
|
width: 250rpx;
|
||||||
|
height: 250rpx;
|
||||||
|
display: block;
|
||||||
|
vertical-align: top;
|
||||||
|
margin: 20vh auto 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.m_empty {
|
||||||
|
padding: 28rpx;
|
||||||
|
margin-bottom: 32rpx;
|
||||||
|
._text{position: relative;}
|
||||||
|
._text:after,._text:before{
|
||||||
|
content: "";
|
||||||
|
width: 52rpx;
|
||||||
|
height: 2rpx;
|
||||||
|
background: #d9d9d9;
|
||||||
|
position: absolute;
|
||||||
|
top: 16rpx;
|
||||||
|
right: 14vw;
|
||||||
|
}
|
||||||
|
._text:before{
|
||||||
|
left: 14vw;
|
||||||
|
}
|
||||||
|
.loading{
|
||||||
|
width: 22rpx;
|
||||||
|
height: 22rpx;
|
||||||
|
background: pink;
|
||||||
|
}
|
||||||
|
._btn {
|
||||||
|
width: 300rpx;
|
||||||
|
height: 72rpx;
|
||||||
|
background: linear-gradient(270deg, #FF85A5 0%, #FF5380 100%);
|
||||||
|
border-radius: 40rpx;
|
||||||
|
line-height: 72rpx;
|
||||||
|
margin: 32rpx auto;
|
||||||
|
letter-spacing: 2rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.userList{
|
||||||
|
.item_list {
|
||||||
|
width: 690rpx;
|
||||||
|
height: 208rpx;
|
||||||
|
background: #FFFFFF;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
padding: 22rpx;
|
||||||
|
margin-bottom: 32rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: self-start;
|
||||||
|
._user_name{
|
||||||
|
max-width: 360rpx;
|
||||||
|
}
|
||||||
|
._vipIcon{
|
||||||
|
width: 32rpx;
|
||||||
|
height: 28rpx;
|
||||||
|
margin-left: 6rpx;
|
||||||
|
margin-bottom: 8rpx;
|
||||||
|
}
|
||||||
|
.u_edu_img{
|
||||||
|
width: 80rpx;
|
||||||
|
height: 32rpx;
|
||||||
|
margin-left: 6rpx ;
|
||||||
|
margin-bottom: 8rpx;
|
||||||
|
}
|
||||||
|
._user_photo{
|
||||||
|
width: 160rpx;
|
||||||
|
height: 160rpx;
|
||||||
|
border-radius: 14rpx;
|
||||||
|
background-size: cover;
|
||||||
|
background-position: center;
|
||||||
|
}
|
||||||
|
._user_data{
|
||||||
|
width: 50vw;
|
||||||
|
}
|
||||||
|
._user_data, ._introduce{
|
||||||
|
margin-top: 12rpx;
|
||||||
|
}
|
||||||
|
._introduce{width: 58vw;}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<template>
|
||||||
|
<view class="ui-qualitySingle">
|
||||||
|
<view class="text-left ui-mb-12 color333 font_32 bold">专区推荐</view>
|
||||||
|
<scroll-view scroll-x="true" scroll-with-animation>
|
||||||
|
<view class="sub_tab_box">
|
||||||
|
<view class="d_sub_tab text-center" v-for="(item,index) in areasList" :key="index" @tap="jumpPaht(item, 'areas')" data-item="{{item}}" data-id="{{index}}" style="background-image: url({{item.pic}})">
|
||||||
|
<view class="_text">
|
||||||
|
<view class="white bold">{{ item.title }}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
<view class="text-left ui-mb-12 color333 font_32 bold">优质单身</view>
|
||||||
|
<view>
|
||||||
|
<view v-if="list.length == 0 && loading" class="text-center">
|
||||||
|
<image class="ui-no-data-icon" src="https://images.ufutx.com/202104/13/1737964f7c98cbf65d728137dc2792eb.png" mode="aspectFill"></image>
|
||||||
|
</view>
|
||||||
|
<block v-else>
|
||||||
|
<view class="userList f-fcc" v-for="(item,index) in list" :key="index">
|
||||||
|
<view class="item_list" @tap="jumpPaht(item, 'user')">
|
||||||
|
<view class="_user_photo" style="background-image: url({{item.photo ||item.avatar}})"></view>
|
||||||
|
<view class="ui-ml-22 ui-mt-4">
|
||||||
|
<view class="f-fcfe">
|
||||||
|
<view class="text-left bold _user_name">{{ item.nickname }}</view>
|
||||||
|
<image v-if="item.rank_id == 0" class="_vipIcon" src="https://images.ufutx.com/202103/17/bfad7e2a8e86cf7912ff280234a35606.png" mode="widthFix"></image>
|
||||||
|
<image v-else class="_vipIcon" src="https://images.ufutx.com/202103/17/d0913df8b234057229ab3dd102497a50.png" mode="widthFix"></image>
|
||||||
|
<image class="u_edu_img" v-if="item.is_real_approved == 1" src="https://image.fulllinkai.com/202206/10/279ade8a42810a91eb80a0717823dffa.png" mode="widthFix"></image>
|
||||||
|
</view>
|
||||||
|
<view class="_user_data font_26 color-333 text-left ellipsis_1">
|
||||||
|
<span v-if="item.year">{{ item.year || '未填写' }}</span>
|
||||||
|
<span v-if="item.year" class="ui-ml-4 ui-mr-4">·</span>
|
||||||
|
<span v-if="item.stature">{{ item.stature || '未填写' }}</span>
|
||||||
|
<span v-if="item.stature" class="ui-ml-4 ui-mr-4">·</span>
|
||||||
|
<span v-if="item.degree">{{ item.degree || '未填写' }}</span>
|
||||||
|
<span v-if="item.degree" class="ui-ml-4 ui-mr-4">·</span>
|
||||||
|
<span v-if="item.industry_sub">{{ item.industry_sub || '未填写' }}</span>
|
||||||
|
</view>
|
||||||
|
<view class="_introduce ellipsis_1 font_26 color-999 text-left">{{item.interest_hobby || '未填写' }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<pageScroll ref="pageScroll"></pageScroll>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import wepy from '@wepy/core'
|
||||||
|
import https from '../../mixins/https'
|
||||||
|
import base from '../../mixins/base'
|
||||||
|
import {service} from '../../config'
|
||||||
|
import {getDiffTime} from '../../mixins/plugins'
|
||||||
|
|
||||||
|
wepy.page({
|
||||||
|
config: {},
|
||||||
|
mixins: [https, base],
|
||||||
|
|
||||||
|
data: {
|
||||||
|
no_more: false,
|
||||||
|
loading: false,
|
||||||
|
page: 1,
|
||||||
|
list: [], // 列表数据
|
||||||
|
areasList: [] // 专区列表数据
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getList() {
|
||||||
|
let vm = this
|
||||||
|
let data = {
|
||||||
|
page: vm.page
|
||||||
|
}
|
||||||
|
vm.$showLoading('加载中...')
|
||||||
|
vm.$get({url: `${service.host}/quality/class/areas`, data}).then(({code, data}) => {
|
||||||
|
if (code === 0) {
|
||||||
|
if (vm.list.length === 0 || vm.page === 1) {
|
||||||
|
vm.list = data.data
|
||||||
|
} else {
|
||||||
|
data.data.map(function (item) {
|
||||||
|
vm.list.push(item)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (vm.list.length < 15 || data.data.length < 15) {
|
||||||
|
vm.no_more = true
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
vm.loading = true
|
||||||
|
}, 500)
|
||||||
|
vm.page++
|
||||||
|
}
|
||||||
|
wx.hideLoading()
|
||||||
|
}).catch(err => {
|
||||||
|
wx.hideLoading()
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getAreasClassList() {
|
||||||
|
let vm = this
|
||||||
|
vm.$get({url: `${service.host}/class/areas`}).then(({code, data}) => {
|
||||||
|
if (code === 0) {
|
||||||
|
vm.areasList = data
|
||||||
|
}
|
||||||
|
}).catch(err => {
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 跳转用户详情或专区推荐
|
||||||
|
jumpPaht(e, type) {
|
||||||
|
if (type == 'user') {
|
||||||
|
wx.navigateTo({url: `/pages/home/information?id=${item.id}`})
|
||||||
|
} else {
|
||||||
|
wx.navigateTo({url: `/pages/users/singleSquare?id=${item.id}&title=${item.title}`})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 上拉获取更多数据
|
||||||
|
onReachBottom() {
|
||||||
|
let vm = this
|
||||||
|
if (!vm.no_more) {
|
||||||
|
vm.getList()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 下拉刷新
|
||||||
|
onPullDownRefresh() {
|
||||||
|
let vm = this
|
||||||
|
vm.page = 1
|
||||||
|
vm.no_more = false
|
||||||
|
vm.getList()
|
||||||
|
},
|
||||||
|
onPageScroll(res) {
|
||||||
|
let vm = this
|
||||||
|
let top = res.scrollTop
|
||||||
|
vm.$refs.pageScroll.showBackTopBtn = top > 380
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
let vm = this
|
||||||
|
vm.getList()
|
||||||
|
vm.getAreasClassList()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<config>
|
||||||
|
{
|
||||||
|
navigationBarTitleText: '优质单身',
|
||||||
|
enablePullDownRefresh: true,
|
||||||
|
backgroundColorTop: '#f8f8f8',
|
||||||
|
backgroundColorBottom: '#f8f8f8',
|
||||||
|
usingComponents: {
|
||||||
|
pageScroll: '~@/components/pageScroll'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</config>
|
||||||
387
src/pages/home/registration.wpy
Normal file
@ -0,0 +1,387 @@
|
|||||||
|
<style lang="less" scoped>
|
||||||
|
@import url(../../styles/theme.less);
|
||||||
|
page {
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
.ui-registration{
|
||||||
|
padding-bottom: 60rpx;
|
||||||
|
}
|
||||||
|
.m_hp {
|
||||||
|
padding: 60rpx 0 20rpx;
|
||||||
|
.m_hp_img {
|
||||||
|
position: relative;
|
||||||
|
width: 176rpx;
|
||||||
|
height: 176rpx;
|
||||||
|
.u_hp_img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
.m_bianzu {
|
||||||
|
width: 56rpx;
|
||||||
|
height: 56rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background-color: #FF5380;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.u_hp {
|
||||||
|
width: 176rpx;
|
||||||
|
height: 176rpx;
|
||||||
|
background-color: #D8D8D8;
|
||||||
|
border-radius: 50%;
|
||||||
|
.icon-bianzu {
|
||||||
|
font-size: 64rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
._list{
|
||||||
|
padding: 0 50rpx;
|
||||||
|
margin-top: 80rpx;
|
||||||
|
.getMobile{
|
||||||
|
height: 55rpx;
|
||||||
|
padding: 0 16rpx !important;
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
bottom: 10rpx;
|
||||||
|
.wxIcon{
|
||||||
|
width: 42rpx;
|
||||||
|
height: 42rpx;
|
||||||
|
vertical-align: middle;
|
||||||
|
margin-right: 6rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
._listItem{
|
||||||
|
margin-top: 30rpx;
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 92rpx;
|
||||||
|
background: #F5F5F5;
|
||||||
|
border-radius: 46px;
|
||||||
|
padding: 0 40rpx 0 34rpx;
|
||||||
|
.name {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
.text{
|
||||||
|
text-align:right;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
.icon{
|
||||||
|
width: 48rpx;
|
||||||
|
height: 48rpx;
|
||||||
|
}
|
||||||
|
.m_ct {
|
||||||
|
width: 100%;
|
||||||
|
height: 92rpx;
|
||||||
|
}
|
||||||
|
.icon-jiantoubeifen7 {
|
||||||
|
margin-left: 20rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.g_gender {
|
||||||
|
.u_gender_tt {
|
||||||
|
padding: 40rpx 16rpx 44rpx;
|
||||||
|
}
|
||||||
|
.u_gender {
|
||||||
|
width: 180rpx;
|
||||||
|
height: 92rpx;
|
||||||
|
background: #F5F5F5;
|
||||||
|
border-radius: 100rpx;
|
||||||
|
margin-right: 30rpx;
|
||||||
|
}
|
||||||
|
.u_gender.male {
|
||||||
|
background: #63A5FF;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
.u_gender.female {
|
||||||
|
background: #FF5380;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.btn-box{
|
||||||
|
width: 100%;
|
||||||
|
height: 88rpx;
|
||||||
|
background: rgba(255, 83, 128, 0.6);
|
||||||
|
border-radius: 100rpx;
|
||||||
|
margin-top: 124rpx;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
}
|
||||||
|
.btn-box.sel {
|
||||||
|
background: #FF5380;
|
||||||
|
}
|
||||||
|
.phont{
|
||||||
|
height: 1.4rem;
|
||||||
|
line-height: 1.4rem;
|
||||||
|
color: #c5c5c5;
|
||||||
|
background: #fff;
|
||||||
|
font-weight: 400;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
button::after{
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<template>
|
||||||
|
<view class="ui-registration">
|
||||||
|
<view class="m_hp f-fcc">
|
||||||
|
<view class="u_hp f-fcc animation-slide-bottom" v-if="!photo" style="animation-delay: 0.2s;" @tap="chooseShow = true">
|
||||||
|
<view class="font_family icon-bianzu white"></view>
|
||||||
|
</view>
|
||||||
|
<view class="m_hp_img" v-else @tap="chooseShow = true">
|
||||||
|
<image class="u_hp_img" :src="photo" mode="aspectFill"></image>
|
||||||
|
<view class="m_bianzu f-fcc">
|
||||||
|
<view class="font_family icon-bianzu white font_24 ui-ml-4"></view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="_list">
|
||||||
|
<view class="_listItem animation-slide-bottom" style="animation-delay: 0.2s;">
|
||||||
|
<input type="text" class="font_28 color-333 name ui-mb-12" placeholder="昵称|请输入2-10个字符" @change="typeing('name', $wx)" maxlength="10" />
|
||||||
|
</view>
|
||||||
|
<picker mode="date" :value="startDate" end="{{endDate}}" @change="typeing('birthday', $wx)">
|
||||||
|
<view class="_listItem animation-slide-bottom f-fbc" style="animation-delay: 0.3s;">
|
||||||
|
<view class="font_28 color-333">你的生日</view>
|
||||||
|
<view class="f-fc">
|
||||||
|
<input type="text" class="font_28 color-333 text inline-block" placeholder-class="font_24" v-model="birthday" disabled placeholder="真实信息提高你的自身魅力" />
|
||||||
|
<view class="font_family icon-jiantoubeifen7 font_24 ui-mt-4"></view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</picker>
|
||||||
|
<button class="btn" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">
|
||||||
|
<view class="_listItem animation-slide-bottom f-fbc" style="animation-delay: 0.3s;">
|
||||||
|
<view class="font_28 color-333">绑定手机</view>
|
||||||
|
<view class="f-fc">
|
||||||
|
<input type="text" class="font_28 color-333 text inline-block" placeholder-class="font_24" v-model="mobile" disabled placeholder="获取微信绑定手机号" />
|
||||||
|
<view class="font_family icon-jiantoubeifen7 font_24 ui-mt-4"></view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</button>
|
||||||
|
<view class="g_gender animation-slide-bottom" style="animation-delay: 0.4s;">
|
||||||
|
<view class="u_gender_tt font_26 color999">性别|保存后不可更改</view>
|
||||||
|
<view class="f-fc font_28 color333">
|
||||||
|
<view class="u_gender f-fcc {{sex == '男' ? 'male' : ''}}" @tap="changeSex('男')">男</view>
|
||||||
|
<view class="u_gender f-fcc {{sex == '女' ? 'female' : ''}}" @tap="changeSex('女')">女</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="_listItem animation-slide-bottom f-fbc" style="animation-delay: 0.5s;">
|
||||||
|
<view class="f-fbc m_ct" @tap="residenceShow = true">
|
||||||
|
<view class="font_28 color-333">目前居住地</view>
|
||||||
|
<view class="f-fc">
|
||||||
|
<input type="text" class="font_28 color-333 text inline-block" placeholder-class="font_24" disabled placeholder="匹配度提高90%" value="{{displayCity}}"/>
|
||||||
|
<view class="font_family icon-jiantoubeifen7 font_24"></view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<picker :value="emotionIndex" range="{{emotionList}}" @change="typeListing('emotion', 'emotionList', $wx)" >
|
||||||
|
<view class="_listItem animation-slide-bottom f-fbc" style="animation-delay: 0.6s;">
|
||||||
|
<view class="font_28 color-333">情感状况</view>
|
||||||
|
<view class="f-fc">
|
||||||
|
<input type="text" class="font_28 color-333 text inline-block" disabled placeholder="请选择你的情感状况" v-model="emotion" />
|
||||||
|
<view class="font_family icon-jiantoubeifen7 font_24"></view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</picker>
|
||||||
|
<picker :value="beliefIndex" range="{{beliefList}}" @change="typeListing('belief', 'beliefList', $wx)" >
|
||||||
|
<view class="_listItem animation-slide-bottom f-fbc" style="animation-delay: 0.7s;">
|
||||||
|
<view class="font_28 color-333">信仰</view>
|
||||||
|
<view class="f-fc">
|
||||||
|
<input type="text" class="font_28 color-333 text inline-block" disabled placeholder="请选择你的信仰" v-model="belief" />
|
||||||
|
<view class="font_family icon-jiantoubeifen7 font_24"></view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</picker>
|
||||||
|
<view class="animation-slide-bottom noBorder" style="animation-delay: 0.7s;">
|
||||||
|
<button class="btn text-center font_32 bold btn-box white radius shadow bg-blue margin-top f-fcc sel" @tap="complete">完成
|
||||||
|
</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<residenceDialog :residenceShow.sync="residenceShow" @residenceCity="residenceCity" @closeResidenceShow="closeResidenceShow"></residenceDialog>
|
||||||
|
<uploadPic ref="uploadPic" :chooseShow.sync="chooseShow" @changeVal="changeVal" @closeUploadPic="closeUploadPic"></uploadPic>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import wepy from '@wepy/core'
|
||||||
|
import https from '../../mixins/https'
|
||||||
|
import base from '../../mixins/base'
|
||||||
|
import {getPhoneNumber} from '../../utils/util'
|
||||||
|
import {service} from '../../config'
|
||||||
|
|
||||||
|
wepy.page({
|
||||||
|
config: {},
|
||||||
|
mixins: [https, base],
|
||||||
|
|
||||||
|
data: {
|
||||||
|
photo: '',
|
||||||
|
chooseShow: false,
|
||||||
|
name: '',
|
||||||
|
|
||||||
|
birthday: '',
|
||||||
|
startDate: '1990-01-01',
|
||||||
|
beginData: '', // 出生日期最大时间
|
||||||
|
endDate: '', // 出生日期结束时间
|
||||||
|
|
||||||
|
mobile: '',
|
||||||
|
sex: '',
|
||||||
|
|
||||||
|
address: {country: '', province: '', city: ''},
|
||||||
|
displayCity: '',
|
||||||
|
residenceShow: false,
|
||||||
|
|
||||||
|
emotion: '',
|
||||||
|
emotionList: ['未婚', '离异', '丧偶', '已婚', '恋爱中'],
|
||||||
|
emotionIndex: 0,
|
||||||
|
|
||||||
|
belief: '',
|
||||||
|
beliefList: ['基督教', '佛教', '伊斯兰教', '其他'],
|
||||||
|
beliefIndex: 3,
|
||||||
|
|
||||||
|
throttle: true,
|
||||||
|
unionid: '',
|
||||||
|
enterprise: ''
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
complete() {
|
||||||
|
let vm = this
|
||||||
|
if (!vm.name) {
|
||||||
|
return vm.$showToast('请输入昵称')
|
||||||
|
} else if (vm.name.length < 2 || vm.name.length > 10) {
|
||||||
|
return vm.$showToast('昵称限制2-10个字')
|
||||||
|
}
|
||||||
|
if (vm.name.includes('福恋')) {
|
||||||
|
return vm.$showToast('请勿输入带“福恋”关键字的昵称!')
|
||||||
|
}
|
||||||
|
if (vm.photo == '') {
|
||||||
|
return vm.$showToast('请上传你的头像')
|
||||||
|
}
|
||||||
|
if (!vm.sex) {
|
||||||
|
return vm.$showToast('请选择你的性别')
|
||||||
|
}
|
||||||
|
if (!vm.phoneNumber) {
|
||||||
|
return vm.$showToast('请选择绑定手机号')
|
||||||
|
}
|
||||||
|
if (!vm.birthday) {
|
||||||
|
return vm.$showToast('请选择你的生日')
|
||||||
|
}
|
||||||
|
if (!vm.address.city) {
|
||||||
|
return vm.$showToast('请选择所在城市')
|
||||||
|
}
|
||||||
|
if (!vm.emotion) {
|
||||||
|
return vm.$showToast('请选择你的情感状况')
|
||||||
|
}
|
||||||
|
if (!vm.belief) {
|
||||||
|
return vm.$showToast('请选择你的信仰')
|
||||||
|
}
|
||||||
|
vm.$showLoading('')
|
||||||
|
let data = {
|
||||||
|
photo: vm.photo,
|
||||||
|
nickname: vm.name,
|
||||||
|
mobile: vm.mobile,
|
||||||
|
sex: vm.sex === '男' ? 1 : 2,
|
||||||
|
belief: vm.belief,
|
||||||
|
state: vm.emotion,
|
||||||
|
country: vm.address.country,
|
||||||
|
province: vm.address.province,
|
||||||
|
city: vm.address.city,
|
||||||
|
birthday: vm.birthday,
|
||||||
|
userInfo: vm.userInfo,
|
||||||
|
openid: vm.openid,
|
||||||
|
unionid: vm.unionid,
|
||||||
|
mark: vm.enterprise
|
||||||
|
}
|
||||||
|
vm.$put({url: `${service.host}/base/user/info`, data}).then(({code, data}) => {
|
||||||
|
if (code == 0) {
|
||||||
|
wx.switchTab({url: '/pages/tabBar/home'})
|
||||||
|
}
|
||||||
|
wx.hideLoading()
|
||||||
|
}).catch(err => {
|
||||||
|
wx.hideLoading()
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
typeing(type, e) {
|
||||||
|
let vm = this
|
||||||
|
vm[type] = e.detail.value
|
||||||
|
},
|
||||||
|
typeListing(type, list, e) {
|
||||||
|
let vm = this
|
||||||
|
vm[type] = vm[list][e.detail.value]
|
||||||
|
},
|
||||||
|
// 选择性别
|
||||||
|
changeSex(e) {
|
||||||
|
let vm = this
|
||||||
|
vm.sex = e
|
||||||
|
},
|
||||||
|
// 获取手机号
|
||||||
|
getPhoneNumber({$wx: e}) {
|
||||||
|
let vm = this
|
||||||
|
if (e.detail.iv) {
|
||||||
|
getPhoneNumber(e).then(({mobile}) => {
|
||||||
|
if (mobile) {
|
||||||
|
vm.mobile = mobile
|
||||||
|
}
|
||||||
|
}).catch((Error) => {
|
||||||
|
// 使用模态框提示用户进行操作
|
||||||
|
wx.showModal({
|
||||||
|
title: `温馨提示`,
|
||||||
|
content: Error,
|
||||||
|
showCancel: false,
|
||||||
|
confirmText: `确定`,
|
||||||
|
success: function (res) {
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 选择的图片和取消功能
|
||||||
|
changeVal(data) {
|
||||||
|
let vm = this
|
||||||
|
if (data) {
|
||||||
|
vm.photo = data.filePath
|
||||||
|
}
|
||||||
|
vm.chooseShow = false
|
||||||
|
},
|
||||||
|
// 关闭上传头像弹窗
|
||||||
|
closeUploadPic() {
|
||||||
|
let vm = this
|
||||||
|
vm.chooseShow = false
|
||||||
|
},
|
||||||
|
closeResidenceShow(e) {
|
||||||
|
let vm = this
|
||||||
|
vm.residenceShow = e
|
||||||
|
},
|
||||||
|
// 组件调用此方法返回选中的居住地
|
||||||
|
residenceCity(e) {
|
||||||
|
let vm = this
|
||||||
|
vm.displayCity = e.city.replace(/市/g, '')
|
||||||
|
vm.address = {country: e.country, province: e.province, city: e.city}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
let vm = this
|
||||||
|
let timestamp = Date.parse(new Date())
|
||||||
|
let date = new Date(timestamp)
|
||||||
|
let Y = date.getFullYear()
|
||||||
|
vm.endDate = `${Y - 12}-01-01`
|
||||||
|
vm.beginData = `${Y - 120}-01-01`
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<config>
|
||||||
|
{
|
||||||
|
navigationBarTitleText: '资料',
|
||||||
|
enablePullDownRefresh: false,
|
||||||
|
backgroundColorTop: '#ffffff',
|
||||||
|
backgroundColorBottom: '#ffffff',
|
||||||
|
usingComponents: {
|
||||||
|
residenceDialog: '~@/components/residenceDialog',
|
||||||
|
uploadPic: '~@/components/uploadPic',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</config>
|
||||||
349
src/pages/home/searchCondition.wpy
Normal file
@ -0,0 +1,349 @@
|
|||||||
|
<style lang="less" scoped>
|
||||||
|
@import url(../../styles/theme.less);
|
||||||
|
page {
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
.returnIcon{
|
||||||
|
width: 14rpx;
|
||||||
|
height: 28rpx;
|
||||||
|
margin-left: 30rpx;
|
||||||
|
margin-right: 22rpx;
|
||||||
|
vertical-align: middle;
|
||||||
|
margin-top: -6rpx;
|
||||||
|
}
|
||||||
|
.titleContent{
|
||||||
|
position: absolute;
|
||||||
|
text-align: center;
|
||||||
|
width: calc(100% - 340rpx);
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
top: 0;
|
||||||
|
margin: auto;
|
||||||
|
height: 60rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
|
line-height: 60rpx;
|
||||||
|
cursor: none;
|
||||||
|
pointer-events: none;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.certification{
|
||||||
|
margin-top: 36rpx;
|
||||||
|
margin-left: 30rpx;
|
||||||
|
margin-right: 30rpx;
|
||||||
|
height: 42rpx;
|
||||||
|
font-size: 30rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #333333;
|
||||||
|
line-height: 42rpx;
|
||||||
|
}
|
||||||
|
.select-big-box{
|
||||||
|
margin-top: 24rpx;
|
||||||
|
margin-left: 30rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
.select-box{
|
||||||
|
margin-right: 30rpx;
|
||||||
|
padding: 0 20rpx;
|
||||||
|
height: 56rpx;
|
||||||
|
line-height: 56rpx;
|
||||||
|
background: #F8F8F8;
|
||||||
|
color: #999999;
|
||||||
|
border-radius: 28rpx;
|
||||||
|
}
|
||||||
|
.true-select-box{
|
||||||
|
background-color: #FFF4F7;
|
||||||
|
color:#F33B6C;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.vertical-box{
|
||||||
|
margin-top: 36rpx;
|
||||||
|
margin-left: 30rpx;
|
||||||
|
margin-right: 30rpx;
|
||||||
|
height: 2rpx;
|
||||||
|
background: #F8F8F8;
|
||||||
|
}
|
||||||
|
.mainBtn{
|
||||||
|
width: 100vw;
|
||||||
|
height: 240rpx;
|
||||||
|
position: relative;
|
||||||
|
position: fixed;
|
||||||
|
bottom: 32rpx;
|
||||||
|
z-index: 9999;
|
||||||
|
.blurBox {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
background: white;
|
||||||
|
filter: blur(20rpx) contrast(1.2);
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
.btn-box{
|
||||||
|
width: 520rpx;
|
||||||
|
height: 80rpx;
|
||||||
|
background: linear-gradient(270deg, #FF85A5 0%, #FF5380 100%);
|
||||||
|
border-radius: 100rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.cuIcon-right {
|
||||||
|
margin-left: 16rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<template>
|
||||||
|
<view class="ui-searchCondition">
|
||||||
|
<view class="cu-custom">
|
||||||
|
<view class="cu-bar fixed" :style="{height: CustomBar + 'px', paddingTop: StatusBar + 'px',zIndex: 999}">
|
||||||
|
<view @tap="handleBack">
|
||||||
|
<image class="returnIcon" src="https://images.ufutx.com/202104/09/91c42ff8b2da0c0ac0576fbc4dc163f6.png" mode="widthFix"></image>
|
||||||
|
<text class="font_28">返回</text>
|
||||||
|
</view>
|
||||||
|
<view class="titleContent bold" :style="{top: StatusBar + 'px'}">筛选</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view :style="{height: navHeight + 'px'}"></view>
|
||||||
|
<view>
|
||||||
|
<view class="certification">实名认证</view>
|
||||||
|
<view class="select-big-box">
|
||||||
|
<view class="select-box {{realNameIndex == '0' ? 'true-select-box' : ''}}" @tap="changeSelect('0','0','未认证')">未认证</view>
|
||||||
|
<view class="select-box {{realNameIndex == '1' ? 'true-select-box' : ''}}" @tap="changeSelect('0','1','已认证')">已认证</view>
|
||||||
|
<view class="select-box {{realNameIndex == '2' ? 'true-select-box' : ''}}" @tap="changeSelect('0','2','')">不限</view>
|
||||||
|
</view>
|
||||||
|
<view class="vertical-box"></view>
|
||||||
|
<view class="certification">VIP会员</view>
|
||||||
|
<view class="select-big-box">
|
||||||
|
<view class="select-box {{vipIndex == '0' ? 'true-select-box' : ''}}" @tap="changeSelect('1','0','超级VIP')">超级VIP</view>
|
||||||
|
<view class="select-box {{vipIndex == '1' ? 'true-select-box' : ''}}" @tap="changeSelect('1','1','普通VIP')">普通VIP</view>
|
||||||
|
<view class="select-box {{vipIndex == '2' ? 'true-select-box' : ''}}" @tap="changeSelect('1','2','')">不限</view>
|
||||||
|
</view>
|
||||||
|
<view class="vertical-box"></view>
|
||||||
|
<view class="certification">学历</view>
|
||||||
|
<view class="select-big-box">
|
||||||
|
<view class="select-box {{educateIndex == '0' ? 'true-select-box' : ''}}" @tap="changeSelect('2','0','硕士以上')">硕士以上</view>
|
||||||
|
<view class="select-box {{educateIndex == '1' ? 'true-select-box' : ''}}" @tap="changeSelect('2','1','本科以上')">本科以上</view>
|
||||||
|
<view class="select-box {{educateIndex == '2' ? 'true-select-box' : ''}}" @tap="changeSelect('2','2','专科以上')">专科以上</view>
|
||||||
|
<view class="select-box {{educateIndex == '3' ? 'true-select-box' : ''}}" @tap="changeSelect('2','3','')">不限</view>
|
||||||
|
</view>
|
||||||
|
<view class="vertical-box"></view>
|
||||||
|
</view>
|
||||||
|
<view>
|
||||||
|
<view class="u_section certification">
|
||||||
|
<picker :value="beliefIndex" range="{{belief}}" bindchange="beliefChange">
|
||||||
|
<view class="m_secLst f-fbc">
|
||||||
|
<span class="font_28 color-333 bold">信仰</span>
|
||||||
|
<view class="font_28 f-fc">
|
||||||
|
<span class="color333" v-if="beliefIndex > -1">{{belief[beliefIndex]}}</span>
|
||||||
|
<span v-else class="color999">不限</span>
|
||||||
|
<text class="cuIcon-right lg text-gray"></text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</picker>
|
||||||
|
</view>
|
||||||
|
<view class="vertical-box"></view>
|
||||||
|
<view class="u_section certification">
|
||||||
|
<picker mode="multiSelector" @change="bindMultiPickerChange" @columnchange="bindMultiPickerColumnChange" :value="multiIndex" range="{{objectMultiArray}}" >
|
||||||
|
<view class="m_secLst f-fbc">
|
||||||
|
<span class="font_28 color-333 bold">职业</span>
|
||||||
|
<view class="font_28 f-fc">
|
||||||
|
<span class="color333" v-if="industry && industry !== '不限'">{{industry}} / {{industry_sub}}</span>
|
||||||
|
<span v-else-if="industry === '不限'" class="color333">不限</span>
|
||||||
|
<span v-else class="color999">不限</span>
|
||||||
|
<text class="cuIcon-right lg text-gray"></text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</picker>
|
||||||
|
</view>
|
||||||
|
<view class="vertical-box"></view>
|
||||||
|
<view class="u_section certification" >
|
||||||
|
<picker value="{{incomeIndex}}" range="{{incomeList}}" bindchange="incomeChange">
|
||||||
|
<view class="m_secLst f-fbc">
|
||||||
|
<span class="font_28 color-333 bold">年收入</span>
|
||||||
|
<view class="font_28 f-fc">
|
||||||
|
<span class="color333" v-if="incomeIndex > -1">{{incomeList[incomeIndex]}}</span>
|
||||||
|
<span v-else class="color999">不限</span>
|
||||||
|
<text class="cuIcon-right lg text-gray"></text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</picker>
|
||||||
|
</view>
|
||||||
|
<view class="vertical-box"></view>
|
||||||
|
</view>
|
||||||
|
<view class="mainBtn f-fcc">
|
||||||
|
<button class="btn font_30 btn-box white radius shadow bg-blue margin-top f-fcc" @tap="handleBack">保存</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import wepy from '@wepy/core'
|
||||||
|
import https from '../../mixins/https'
|
||||||
|
import base from '../../mixins/base'
|
||||||
|
import {service} from '../../config'
|
||||||
|
|
||||||
|
wepy.page({
|
||||||
|
config: {},
|
||||||
|
mixins: [https, base],
|
||||||
|
|
||||||
|
data: {
|
||||||
|
inputVal: '', // 上个页面搜索框内容
|
||||||
|
realNameIndex: '2', // 实名认证判断
|
||||||
|
realNameList: ['未认证', '已认证', '不限'], // 实名认证判断
|
||||||
|
is_approved: '', // 实名认证
|
||||||
|
vipIndex: '2', // vip判断
|
||||||
|
is_rank: '', // vip
|
||||||
|
is_rank_list: ['超级VIP', '普通VIP', '不限'], // vip
|
||||||
|
educateIndex: '3', // 学历判断
|
||||||
|
degree: '', // 学历
|
||||||
|
degreeList: ['硕士以上', '本科以上', '专科以上', '不限'], // 学历
|
||||||
|
belief: ['不限', '基督教', '佛教', '伊斯兰教', '其他'],
|
||||||
|
beliefIndex: -1,
|
||||||
|
industry: '',
|
||||||
|
industry_sub: '',
|
||||||
|
Business: [],
|
||||||
|
multiIndex: [0, 0],
|
||||||
|
objectMultiArray: [],
|
||||||
|
incomeList: ['不限', '5w以下', '5~10w', '10~15w', '15~30w', '30~50w', '50~100w', '100~500w', '500w以上'],
|
||||||
|
incomeIndex: -1,
|
||||||
|
|
||||||
|
sexIndex: '',
|
||||||
|
ageIndex: '',
|
||||||
|
region: '',
|
||||||
|
|
||||||
|
navHeight: 0,
|
||||||
|
StatusBar: 0,
|
||||||
|
CustomBar: 0,
|
||||||
|
Custom: 0
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 获取行业数据
|
||||||
|
getIndustry() {
|
||||||
|
let vm = this
|
||||||
|
vm.$get({url: `${service.host}/industry/json`}).then(({code, data}) => {
|
||||||
|
if (code === 0) {
|
||||||
|
vm.Business = data
|
||||||
|
vm.Business.unshift({title: '不限', items: ['不限']})
|
||||||
|
let IndustryArr = []
|
||||||
|
data.forEach(function (item, index, arr) {
|
||||||
|
IndustryArr.push(arr[index].title)
|
||||||
|
})
|
||||||
|
vm.objectMultiArray.push(IndustryArr)
|
||||||
|
vm.objectMultiArray.push(vm.Business[vm.multiIndex[0]].items)
|
||||||
|
}
|
||||||
|
wx.hideLoading()
|
||||||
|
}).catch(err => {
|
||||||
|
wx.hideLoading()
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 选中的实名认证、VIP会员、学历
|
||||||
|
changeSelect(type, index, value) {
|
||||||
|
let vm = this
|
||||||
|
if (type === '0') {
|
||||||
|
vm.realNameIndex = index
|
||||||
|
vm.is_approved = value
|
||||||
|
} else if (type === '1') {
|
||||||
|
vm.vipIndex = index
|
||||||
|
vm.is_rank = value
|
||||||
|
} else if (type === '2') {
|
||||||
|
vm.educateIndex = index
|
||||||
|
vm.degree = value
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 选中的信仰
|
||||||
|
beliefChange(e) {
|
||||||
|
let vm = this
|
||||||
|
vm.beliefIndex = e.$wx.detail.value
|
||||||
|
},
|
||||||
|
// 选中的行业
|
||||||
|
bindMultiPickerChange(e) {
|
||||||
|
let vm = this
|
||||||
|
vm.multiIndex = e.$wx.detail.value
|
||||||
|
vm.industry = vm.objectMultiArray[0][e.$wx.detail.value[0]]
|
||||||
|
vm.industry_sub = vm.objectMultiArray[1][e.$wx.detail.value[1]]
|
||||||
|
},
|
||||||
|
bindMultiPickerColumnChange(e) {
|
||||||
|
let vm = this
|
||||||
|
vm.show = false
|
||||||
|
vm.multiIndex[e.$wx.detail.column] = e.$wx.detail.value
|
||||||
|
for (let i = 0; i < vm.Business.length; i++) {
|
||||||
|
if (vm.multiIndex[0] === i) {
|
||||||
|
vm.objectMultiArray = [vm.objectMultiArray[0], vm.Business[i].items]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 选中的年收入
|
||||||
|
incomeChange(e) {
|
||||||
|
let vm = this
|
||||||
|
vm.incomeIndex = e.$wx.detail.value
|
||||||
|
},
|
||||||
|
// 返回搜索页
|
||||||
|
handleBack() {
|
||||||
|
let vm = this
|
||||||
|
let data = {
|
||||||
|
inputVal: vm.inputVal, // 上个页面搜索框内容
|
||||||
|
is_approved: vm.realNameList[parseInt(vm.realNameIndex)], // 实名认证
|
||||||
|
realNameIndex: vm.realNameIndex, // 实名认证
|
||||||
|
is_rank: vm.is_rank_list[parseInt(vm.vipIndex)], // vip会员
|
||||||
|
vipIndex: vm.vipIndex, // vip会员下标
|
||||||
|
degree: vm.degreeList[parseInt(vm.educateIndex)], // 学历
|
||||||
|
educateIndex: vm.educateIndex, // 学历下标
|
||||||
|
belief: vm.belief[vm.beliefIndex], // 信仰
|
||||||
|
beliefIndex: vm.beliefIndex, // 信仰下标
|
||||||
|
industry: vm.industry, // 职业
|
||||||
|
industry_sub: vm.industry_sub, // 副职业
|
||||||
|
multiIndex: vm.multiIndex, // 职业下标
|
||||||
|
income: vm.incomeList[vm.incomeIndex], // 年收入
|
||||||
|
incomeIndex: vm.incomeIndex, // 年收入下标
|
||||||
|
|
||||||
|
sexIndex: vm.sexIndex, // 性别下标
|
||||||
|
ageIndex: vm.ageIndex, // 年龄下标
|
||||||
|
region: vm.region // 城市
|
||||||
|
}
|
||||||
|
console.log(data, 'data-------------33---------------')
|
||||||
|
vm.$redirectTo(`/pages/home/searchUsers?params=${JSON.stringify(data)}`)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
let vm = this
|
||||||
|
let app = vm.$app.$options
|
||||||
|
vm.navHeight = app.globalData.navBarHeight
|
||||||
|
vm.StatusBar = app.globalData.StatusBar
|
||||||
|
vm.CustomBar = app.globalData.CustomBar
|
||||||
|
vm.Custom = app.globalData.Custom
|
||||||
|
},
|
||||||
|
onLoad(e) {
|
||||||
|
let vm = this
|
||||||
|
if (e.params) {
|
||||||
|
let params = JSON.parse(e.params)
|
||||||
|
vm.inputVal = params.inputVal
|
||||||
|
vm.realNameIndex = params.realNameIndex
|
||||||
|
vm.vipIndex = params.vipIndex
|
||||||
|
vm.educateIndex = params.educateIndex
|
||||||
|
vm.beliefIndex = params.beliefIndex ? parseInt(params.beliefIndex) : -1
|
||||||
|
vm.industry = params.industry
|
||||||
|
vm.industry_sub = params.industry_sub
|
||||||
|
vm.incomeIndex = params.incomeIndex ? parseInt(params.incomeIndex) : -1
|
||||||
|
vm.multiIndex = params.multiIndex
|
||||||
|
|
||||||
|
vm.sexIndex = params.sexIndex
|
||||||
|
vm.ageIndex = params.ageIndex
|
||||||
|
vm.region = params.region
|
||||||
|
}
|
||||||
|
vm.getIndustry()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<config>
|
||||||
|
{
|
||||||
|
navigationBarTitleText: '筛选',
|
||||||
|
navigationStyle: 'custom',
|
||||||
|
enablePullDownRefresh: false,
|
||||||
|
backgroundColorTop: '#ffffff',
|
||||||
|
backgroundColorBottom: '#ffffff',
|
||||||
|
usingComponents: {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</config>
|
||||||
489
src/pages/home/searchUsers.wpy
Normal file
@ -0,0 +1,489 @@
|
|||||||
|
<style lang="less" scoped>
|
||||||
|
@import url(../../styles/theme.less);
|
||||||
|
page {
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-top-box{
|
||||||
|
width: 100vw;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
padding: 0 24rpx 24rpx 24rpx;
|
||||||
|
background: #ffffff;
|
||||||
|
z-index: 99;
|
||||||
|
.ui-user-pic{
|
||||||
|
width: 68rpx;
|
||||||
|
height: 68rpx;
|
||||||
|
box-shadow: 1rpx 1rpx 12rpx #e7e7e7;
|
||||||
|
border: 4rpx solid #e7e7e7;
|
||||||
|
border-radius: 50%;
|
||||||
|
animation: myMove 2.5s .15s linear infinite;
|
||||||
|
}
|
||||||
|
.ui-search-icon{
|
||||||
|
width: 32rpx;
|
||||||
|
height: 32rpx;
|
||||||
|
position: absolute;
|
||||||
|
top: 30rpx;
|
||||||
|
left: 36rpx;
|
||||||
|
}
|
||||||
|
.ui-search-box{
|
||||||
|
width: 76vw;
|
||||||
|
height: 56rpx;
|
||||||
|
padding: 0 60rpx;
|
||||||
|
margin: 18rpx;
|
||||||
|
border: none;
|
||||||
|
background: #f5f5f5;
|
||||||
|
border-radius: 40rpx;
|
||||||
|
}
|
||||||
|
.ui-close-search-icon{
|
||||||
|
width: 26rpx;
|
||||||
|
height: 26rpx;
|
||||||
|
position: absolute;
|
||||||
|
right: 40rpx;
|
||||||
|
top: 34rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-item-Tab{
|
||||||
|
width: 25%;
|
||||||
|
height: 46rpx;
|
||||||
|
padding-top: 12rpx;
|
||||||
|
.ui-triangle-icon{
|
||||||
|
width: 32rpx;
|
||||||
|
height: 32rpx;
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-placeholder{
|
||||||
|
width: 100vw;
|
||||||
|
height: 180rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-no-data-icon{
|
||||||
|
width: 250rpx;
|
||||||
|
height: 250rpx;
|
||||||
|
display: block;
|
||||||
|
vertical-align: top;
|
||||||
|
margin: 26vh auto 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.love_user_list_1{
|
||||||
|
margin: 0 30rpx 34rpx 30rpx;
|
||||||
|
box-shadow: 6rpx 6rpx 40rpx rgba(0, 0, 0, 0.08);
|
||||||
|
border-radius: 24rpx;
|
||||||
|
.love_user_photo_1{
|
||||||
|
width: 100%;
|
||||||
|
height: 100vw;
|
||||||
|
border-radius: 24rpx 24rpx 0 0;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.user_data_box_1{
|
||||||
|
padding: 24rpx;
|
||||||
|
.text{
|
||||||
|
span{
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.user_data_name_1{
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
.name_1{
|
||||||
|
max-width: 300rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.vipIcon_1{
|
||||||
|
width: 32rpx;
|
||||||
|
height: 28rpx;
|
||||||
|
vertical-align: middle;
|
||||||
|
margin-left: 6rpx;
|
||||||
|
}
|
||||||
|
.realNameIcon_1{
|
||||||
|
width: 104rpx;
|
||||||
|
height: 36rpx;
|
||||||
|
vertical-align: middle;
|
||||||
|
margin-left: 8rpx;
|
||||||
|
}
|
||||||
|
.m_rpe {
|
||||||
|
margin-left: 8rpx;
|
||||||
|
.u_rpe_img {
|
||||||
|
width: 80rpx;
|
||||||
|
height: 32rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.m_edu {
|
||||||
|
margin-left: 8rpx;
|
||||||
|
.u_edu_img {
|
||||||
|
width: 80rpx;
|
||||||
|
height: 32rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.m_rpeAdd {
|
||||||
|
.u_rpeAdd_img {
|
||||||
|
width: 20rpx;
|
||||||
|
height: 24rpx;
|
||||||
|
margin-right: 2rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.user_data_age_1{
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 12rpx;
|
||||||
|
text-align: initial;
|
||||||
|
}
|
||||||
|
.introduce_1{
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 12rpx;
|
||||||
|
text-align: initial;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.love_user_list_1:nth-of-type(1){
|
||||||
|
margin: 50rpx 30rpx 34rpx 30rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<template>
|
||||||
|
<view class="ui-searchUsers">
|
||||||
|
<view class="ui-top-box">
|
||||||
|
<view class="f-fcl">
|
||||||
|
<image :src="userInfo.avatar || userInfo.photo" mode="aspectFill" class="ui-user-pic" @tap="jumpDetailPath(userInfo)"></image>
|
||||||
|
<view class="ui-relative">
|
||||||
|
<image class="ui-search-icon" src="https://image.fulllinkai.com/202405/13/629916bd281b7afa1a61ed099db182cf.png" mode="widthFix"></image>
|
||||||
|
<input type="text" placeholder="搜索昵称" class="text-left ui-search-box" confirm-type="search" v-model="inputVal" focus="{{inputShowed}}" @confirm="initData" />
|
||||||
|
<image v-if="inputVal" class="ui-close-search-icon" src="https://image.fulllinkai.com/202307/04/a7f548083c45667843828e7fccef7d8c.png" mode="widthFix"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="f-fbc">
|
||||||
|
<view class="ui-item-Tab text-center">
|
||||||
|
<picker :value="sexIndex" range="{{sexList}}" bindchange="sexChange" range-key="title">
|
||||||
|
<view class="title ellipsis_1">
|
||||||
|
{{sexIndex > 0 ? sexList[sexIndex].title : sexText}}
|
||||||
|
<image src="https://images.ufutx.com/202005/18/1a4515381adacd1fca67b3633320fb57.png" class="ui-triangle-icon" mode="aspectFit"></image>
|
||||||
|
</view>
|
||||||
|
</picker>
|
||||||
|
</view>
|
||||||
|
<view class="ui-item-Tab text-center">
|
||||||
|
<picker mode="multiSelector" value="{{ageIndex}}" range="{{ageList}}" bindchange="ageChange" bindcolumnchange="ageColumnChange">
|
||||||
|
<view class="ellipsis_1">
|
||||||
|
<block v-if="!ageIndex">{{ageText}}</block>
|
||||||
|
<block v-else>{{ageList[0][ageIndex[0]]}}-{{ageList[1][ageIndex[1]]}}岁</block>
|
||||||
|
<image src="https://images.ufutx.com/202005/18/1a4515381adacd1fca67b3633320fb57.png" class="ui-triangle-icon" mode="aspectFit"></image>
|
||||||
|
</view>
|
||||||
|
</picker>
|
||||||
|
</view>
|
||||||
|
<view class="ui-item-Tab text-center">
|
||||||
|
<selectCity :selfTextareaShow.sync="'1'" :multiIndex.sync="[0, 18, 2]" @selectCity="selectCity" style="height: 32rpx">
|
||||||
|
<view class="ellipsis_1">
|
||||||
|
<block v-if="region[2]">{{region[2]}}</block>
|
||||||
|
<block v-else>{{cityText}}</block>
|
||||||
|
<image src="https://images.ufutx.com/202005/18/1a4515381adacd1fca67b3633320fb57.png" class="ui-triangle-icon" mode="aspectFit"></image>
|
||||||
|
</view>
|
||||||
|
</selectCity>
|
||||||
|
</view>
|
||||||
|
<view class="ui-item-Tab text-center" @tap.stop="jumpPath">
|
||||||
|
<view class="ellipsis_1">
|
||||||
|
筛选
|
||||||
|
<image src="https://images.ufutx.com/202005/18/006685ede8d6fa8f965a4d4aaf12d469.png" class="ui-triangle-icon" mode="aspectFit"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="ui-placeholder"></view>
|
||||||
|
<image v-if="list.length == 0 && loading" class="ui-no-data-icon" src="https://images.ufutx.com/202104/13/1737964f7c98cbf65d728137dc2792eb.png" mode="aspectFill"></image>
|
||||||
|
<block v-else>
|
||||||
|
<view class="love_user_list_1" v-for="(item,index) in list" :key="index" @tap="jumpDetailPath(item)">
|
||||||
|
<view>
|
||||||
|
<image class="love_user_photo_1" :src="item.photo || item.avatar" mode="aspectFill"></image>
|
||||||
|
<view class="user_data_box_1">
|
||||||
|
<view class="user_data_name_1 f-fbc">
|
||||||
|
<view class="f-fc">
|
||||||
|
<view class="font_32 bold color333 name_1">{{item.nickname}}</view>
|
||||||
|
<image v-if="item.isSuperRank == 0" class="vipIcon_1" src="https://images.ufutx.com/202103/17/bfad7e2a8e86cf7912ff280234a35606.png" mode="widthFix"></image>
|
||||||
|
<image v-else class="vipIcon_1" src="https://images.ufutx.com/202103/17/d0913df8b234057229ab3dd102497a50.png" mode="widthFix"></image>
|
||||||
|
<view class="m_rpe f-fcc">
|
||||||
|
<image class="u_rpe_img" v-if="item.is_approved == 1" src="https://images.ufutx.com/202105/26/17b7eec949ba18e576d5de67bca00d94.png" mode="widthFix"></image>
|
||||||
|
<image class="u_rpe_img" v-else src="https://images.ufutx.com/202105/26/a221872980386016cabfa7b85a14daca.png" mode="widthFix"></image>
|
||||||
|
</view>
|
||||||
|
<view class="m_edu f-fcc">
|
||||||
|
<image class="u_edu_img" v-if="item.is_real_approved == 1" src="https://images.ufutx.com/202105/26/2213da011dbaa1dab3ed16bc623c56ce.png" mode="widthFix"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="m_rpeAdd f-fc" v-if="item.city">
|
||||||
|
<image class="u_rpeAdd_img" src="https://images.ufutx.com/202106/28/817a393539ee854226eef79defef2fc4.png" mode="widthFix"></image>
|
||||||
|
<view class="font_24 color333">{{item.city}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="user_data_age_1 font_28 color333 text ellipsis_1">
|
||||||
|
<span v-if="item.year">{{item.year || '未填写'}}</span>
|
||||||
|
<span v-if="item.stature" class="ui-ml-4 ui-mr-4">·</span>
|
||||||
|
<span v-if="item.stature">{{item.stature || '未填写'}}</span>
|
||||||
|
<span v-if="item.degree" class="ui-ml-4 ui-mr-4">·</span>
|
||||||
|
<span v-if="item.degree">{{item.degree || '未填写'}}</span>
|
||||||
|
<span v-if="item.industry_sub" class="ui-ml-4 ui-mr-4">·</span>
|
||||||
|
<span v-if="item.industry_sub">{{item.industry_sub || '未填写'}}</span>
|
||||||
|
</view>
|
||||||
|
<view class="introduce_1 ellipsis_1 font_26 color999">{{item.introduction || '未填写'}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
<pageScroll ref="pageScroll"></pageScroll>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import wepy from '@wepy/core'
|
||||||
|
import https from '../../mixins/https'
|
||||||
|
import base from '../../mixins/base'
|
||||||
|
import {service} from '../../config'
|
||||||
|
|
||||||
|
wepy.page({
|
||||||
|
config: {},
|
||||||
|
mixins: [https, base],
|
||||||
|
|
||||||
|
data: {
|
||||||
|
userInfo: {},
|
||||||
|
inputVal: '',
|
||||||
|
sexIndex: 0,
|
||||||
|
sexList: [
|
||||||
|
{title: '不限', value: '不限', active: true},
|
||||||
|
{title: '只看男', value: 'single_man', active: false},
|
||||||
|
{title: '只看女', value: 'single_woman', active: false}
|
||||||
|
],
|
||||||
|
approveList: [
|
||||||
|
{title: '不限', value: '不限', active: true},
|
||||||
|
{title: '已认证', value: '已认证', active: false},
|
||||||
|
{title: '未认证', value: '未认证', active: false}
|
||||||
|
],
|
||||||
|
region: ['', '', ''],
|
||||||
|
region_id: ['', '', ''],
|
||||||
|
ageIndex: 0,
|
||||||
|
ageList: [],
|
||||||
|
sexText: '性别',
|
||||||
|
ageText: '年龄',
|
||||||
|
cityText: '城市',
|
||||||
|
searchList: [
|
||||||
|
{title: '不限', value: '不限', active: true},
|
||||||
|
{title: '超级VIP', value: '超级VIP', active: false},
|
||||||
|
{title: '普通会员', value: '普通会员', active: false}
|
||||||
|
],
|
||||||
|
beliefList: [
|
||||||
|
{title: '不限', value: '不限', active: true},
|
||||||
|
{title: '基督教', value: '基督教', active: false},
|
||||||
|
{title: '其他', value: '其他', active: false}
|
||||||
|
],
|
||||||
|
is_approved: '',
|
||||||
|
is_VIP: '',
|
||||||
|
is_degree: '', // 选择的学历
|
||||||
|
is_industry: '', // 选择的行业
|
||||||
|
is_industry_sub: '', // 选择的副行业(传值)
|
||||||
|
multiIndex: [0, 0],
|
||||||
|
is_income: '', // 选择的年收入
|
||||||
|
realNameIndex: 2, // 实名认证
|
||||||
|
vipIndex: 2, // VIP会员
|
||||||
|
educateIndex: 3, // 学历
|
||||||
|
beliefIndex: -1, // 信仰
|
||||||
|
incomeIndex: -1, // 收入
|
||||||
|
|
||||||
|
no_more: false,
|
||||||
|
loading: false,
|
||||||
|
page: 1,
|
||||||
|
list: [] // 列表数据
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getList() {
|
||||||
|
let vm = this
|
||||||
|
let data = {
|
||||||
|
page: vm.page,
|
||||||
|
min_age: vm.ageIndex ? vm.ageList[0][vm.ageIndex[0]] : '不限',
|
||||||
|
max_age: vm.ageIndex ? vm.ageList[1][vm.ageIndex[1]] : '不限',
|
||||||
|
province: vm.region[1] ? vm.region[1] : '不限',
|
||||||
|
city: vm.region[2] ? vm.region[2] : '不限',
|
||||||
|
sex: vm.sexList[vm.sexIndex].value,
|
||||||
|
is_approved: vm.is_approved ? vm.is_approved : '不限',
|
||||||
|
is_rank: vm.is_VIP ? vm.is_VIP : '不限',
|
||||||
|
degree: vm.is_degree ? vm.is_degree : '不限',
|
||||||
|
belief: vm.belief ? vm.belief : '不限',
|
||||||
|
industry: vm.is_industry ? vm.is_industry : '不限',
|
||||||
|
industry_sub: vm.is_industry_sub ? vm.is_industry_sub : '不限',
|
||||||
|
income: vm.is_income ? vm.is_income : '不限'
|
||||||
|
}
|
||||||
|
console.log(data, '*/**********')
|
||||||
|
vm.$showLoading('加载中...')
|
||||||
|
vm.$get({url: `${service.host}/user/list?keyword=${vm.inputVal}`, data}).then(({code, data}) => {
|
||||||
|
if (code === 0) {
|
||||||
|
vm.userInfo = data.user
|
||||||
|
if (vm.list.length === 0 || vm.page === 1) {
|
||||||
|
vm.list = data.users.data
|
||||||
|
} else {
|
||||||
|
data.users.data.map(function (item) {
|
||||||
|
vm.list.push(item)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (vm.list.length < 15 || data.users.data.length < 15) {
|
||||||
|
vm.no_more = true
|
||||||
|
}
|
||||||
|
vm.record(data.users.data)
|
||||||
|
setTimeout(() => {
|
||||||
|
vm.loading = true
|
||||||
|
}, 500)
|
||||||
|
vm.page++
|
||||||
|
}
|
||||||
|
wx.hideLoading()
|
||||||
|
}).catch(err => {
|
||||||
|
wx.hideLoading()
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 记录用户浏览过的数据
|
||||||
|
record(e) {
|
||||||
|
let vm = this
|
||||||
|
let list = []
|
||||||
|
e.forEach((item) => {
|
||||||
|
list.push(item.id)
|
||||||
|
})
|
||||||
|
let data = {
|
||||||
|
user_ids: list.toString()
|
||||||
|
}
|
||||||
|
vm.$post({url: `${service.host}/users/browse`, data}).then(() => {
|
||||||
|
}).catch(() => {
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 初始化列表数据
|
||||||
|
initData() {
|
||||||
|
let vm = this
|
||||||
|
vm.page = 1
|
||||||
|
vm.list = []
|
||||||
|
vm.loading = false
|
||||||
|
vm.getList()
|
||||||
|
},
|
||||||
|
// 选中性别
|
||||||
|
sexChange(e) {
|
||||||
|
let vm = this
|
||||||
|
vm.sexIndex = e.$wx.detail.value
|
||||||
|
vm.initData()
|
||||||
|
},
|
||||||
|
// 选中年龄
|
||||||
|
ageChange(e) {
|
||||||
|
let vm = this
|
||||||
|
vm.ageIndex = e.$wx.detail.value
|
||||||
|
console.log(vm.ageIndex, 'vm.ageIndex')
|
||||||
|
vm.initData()
|
||||||
|
},
|
||||||
|
// 滑动年龄后计算最小或最大年龄
|
||||||
|
ageColumnChange (e) {
|
||||||
|
let vm = this
|
||||||
|
let heightPickerArr = []
|
||||||
|
if (e.$wx.detail.column == 0) {
|
||||||
|
for (let i = +vm.ageList[0][e.$wx.detail.value] + 1; i < 76; i++) {
|
||||||
|
heightPickerArr.push(i)
|
||||||
|
}
|
||||||
|
vm.ageList = [vm.ageList[0], heightPickerArr]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 年龄
|
||||||
|
getAgeList() {
|
||||||
|
let vm = this
|
||||||
|
let list = [[], []]
|
||||||
|
for (let num = 20; num < 75; num++) {
|
||||||
|
list[0].push(num)
|
||||||
|
list[1].push(num + 1)
|
||||||
|
}
|
||||||
|
vm.ageList = list
|
||||||
|
},
|
||||||
|
// 组件调用此方法返回选中的居住地
|
||||||
|
selectCity(e, index) {
|
||||||
|
let vm = this
|
||||||
|
vm.region = e
|
||||||
|
vm.initData()
|
||||||
|
console.log(e, index)
|
||||||
|
},
|
||||||
|
// 跳转筛选页面
|
||||||
|
jumpPath() {
|
||||||
|
let vm = this
|
||||||
|
let data = {
|
||||||
|
sexIndex: vm.sexIndex,
|
||||||
|
ageIndex: vm.ageIndex,
|
||||||
|
region: vm.region,
|
||||||
|
realNameIndex: vm.realNameIndex,
|
||||||
|
vipIndex: vm.vipIndex,
|
||||||
|
educateIndex: vm.educateIndex,
|
||||||
|
beliefIndex: vm.beliefIndex,
|
||||||
|
industry: vm.is_industry,
|
||||||
|
industry_sub: vm.is_industry_sub,
|
||||||
|
multiIndex: vm.multiIndex,
|
||||||
|
incomeIndex: vm.incomeIndex,
|
||||||
|
keyword: vm.inputVal
|
||||||
|
}
|
||||||
|
let url = `/pages/home/searchCondition?params=${JSON.stringify(data)}`
|
||||||
|
wx.redirectTo({url: url})
|
||||||
|
},
|
||||||
|
// 跳转用户详情
|
||||||
|
jumpDetailPath(e) {
|
||||||
|
wx.navigateTo({url: `/pages/home/information?id=${e.id}`})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 上拉获取更多数据
|
||||||
|
onReachBottom() {
|
||||||
|
let vm = this
|
||||||
|
if (!vm.no_more) {
|
||||||
|
vm.getList()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 下拉刷新
|
||||||
|
onPullDownRefresh() {
|
||||||
|
let vm = this
|
||||||
|
vm.page = 1
|
||||||
|
vm.no_more = false
|
||||||
|
vm.getList()
|
||||||
|
},
|
||||||
|
onPageScroll(res) {
|
||||||
|
let vm = this
|
||||||
|
let top = res.scrollTop
|
||||||
|
vm.$refs.pageScroll.showBackTopBtn = top > 380
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
},
|
||||||
|
onLoad(e) {
|
||||||
|
let vm = this
|
||||||
|
if (e.params) {
|
||||||
|
let params = JSON.parse(e.params)
|
||||||
|
vm.inputVal = params.inputVal
|
||||||
|
vm.belief = params.belief ? params.belief : '不限'
|
||||||
|
vm.is_approved = params.is_approved ? params.is_approved : '不限'
|
||||||
|
vm.is_VIP = params.is_rank ? params.is_rank : '不限'
|
||||||
|
vm.is_degree = params.degree ? params.degree : '不限'
|
||||||
|
vm.is_industry = params.industry ? params.industry : '不限'
|
||||||
|
vm.is_industry_sub = params.industry_sub ? params.industry_sub : ''
|
||||||
|
vm.multiIndex = params.multiIndex
|
||||||
|
vm.ageIndex = params.ageIndex
|
||||||
|
vm.realNameIndex = params.realNameIndex ? params.realNameIndex : 2
|
||||||
|
vm.vipIndex = params.vipIndex ? params.vipIndex : 2
|
||||||
|
vm.educateIndex = params.educateIndex ? params.educateIndex : 3
|
||||||
|
vm.beliefIndex = params.beliefIndex ? params.beliefIndex : 0
|
||||||
|
vm.incomeIndex = params.incomeIndex ? params.incomeIndex : 0
|
||||||
|
vm.sexIndex = params.sexIndex ? params.sexIndex : 0
|
||||||
|
vm.region = params.region
|
||||||
|
}
|
||||||
|
vm.getAgeList()
|
||||||
|
vm.getList()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<config>
|
||||||
|
{
|
||||||
|
navigationBarTitleText: '搜索',
|
||||||
|
enablePullDownRefresh: true,
|
||||||
|
backgroundColorTop: '#ffffff',
|
||||||
|
backgroundColorBottom: '#ffffff',
|
||||||
|
usingComponents: {
|
||||||
|
selectCity: '~@/components/selectCity',
|
||||||
|
pageScroll: '~@/components/pageScroll'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</config>
|
||||||
289
src/pages/home/singleSquare.wpy
Normal file
@ -0,0 +1,289 @@
|
|||||||
|
<style lang="less" scoped>
|
||||||
|
@import url(../../styles/theme.less);
|
||||||
|
page {
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-singleSquare{
|
||||||
|
.m_rec {
|
||||||
|
width: 100%;
|
||||||
|
height: 80rpx;
|
||||||
|
background-color: #FFF4F7;
|
||||||
|
color: #F33B6C;
|
||||||
|
padding: 0 30rpx;
|
||||||
|
.u_rec_bu {
|
||||||
|
border-radius: 100rpx;
|
||||||
|
padding: 2rpx 16rpx;
|
||||||
|
border: 2rpx solid #FF95B1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-no-data-icon{
|
||||||
|
width: 250rpx;
|
||||||
|
height: 250rpx;
|
||||||
|
display: block;
|
||||||
|
vertical-align: top;
|
||||||
|
margin: 26vh auto 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.recommended_user_data_box{
|
||||||
|
padding-top: 20rpx;
|
||||||
|
padding-bottom: 60rpx;
|
||||||
|
margin: 0 30rpx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
.recommended_user{
|
||||||
|
position: relative;
|
||||||
|
width: 336rpx;
|
||||||
|
height: 336rpx;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
.icon{
|
||||||
|
width: 160rpx;
|
||||||
|
height: 42rpx;
|
||||||
|
top: 12rpx;
|
||||||
|
right: 12rpx;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
.userPhoto{
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 336rpx;
|
||||||
|
height: 336rpx;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
}
|
||||||
|
.mask{
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 336rpx;
|
||||||
|
height: 336rpx;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.7) 100%);
|
||||||
|
}
|
||||||
|
.recommended_user_data{
|
||||||
|
color: #fff;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 16rpx;
|
||||||
|
left: 20rpx;
|
||||||
|
.recommended_user_name{
|
||||||
|
width: 230rpx;
|
||||||
|
letter-spacing: 1rpx;
|
||||||
|
}
|
||||||
|
.age_address{
|
||||||
|
overflow: hidden;
|
||||||
|
.address_icon{
|
||||||
|
width: 20rpx;
|
||||||
|
height: 24rpx;
|
||||||
|
vertical-align: middle;
|
||||||
|
margin: 0 4rpx 0 16rpx;
|
||||||
|
}
|
||||||
|
.address_text{
|
||||||
|
display: inline-block;
|
||||||
|
width: 200rpx;
|
||||||
|
vertical-align: middle;
|
||||||
|
margin-left: 2rpx;
|
||||||
|
margin-top: 2rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<template>
|
||||||
|
<view class="ui-singleSquare">
|
||||||
|
<view class="m_rec font_26 f-fbc" v-if="recommendData.apply_state.has_apply_area != 1 && type != 'marriage'">
|
||||||
|
<view>上专区推荐,还可进入群聊,更容易脱单哦~</view>
|
||||||
|
<view class="u_rec_bu" bindtap="getRecommend">去申请</view>
|
||||||
|
</view>
|
||||||
|
<view v-if="list.length == 0 && loading" class="text-center">
|
||||||
|
<image class="ui-no-data-icon" src="https://images.ufutx.com/202104/13/1737964f7c98cbf65d728137dc2792eb.png" mode="aspectFill"></image>
|
||||||
|
</view>
|
||||||
|
<block v-else>
|
||||||
|
<view class="ui-pb-20">
|
||||||
|
<view class="recommended_user_data_box">
|
||||||
|
<view class="recommended_user" v-for="(item,index) in list" :key="index">
|
||||||
|
<image class="userPhoto" :src="item.photo" mode="aspectFill"></image>
|
||||||
|
<view class="mask"></view>
|
||||||
|
<view class="recommended_user_data">
|
||||||
|
<view class="font28 bold recommended_user_name ellipsis_1">{{item.nickname}}</view>
|
||||||
|
<view class="age_address">
|
||||||
|
<view class="flo_l font26 ui-mt-4">{{item.year}}</view>
|
||||||
|
<view class="flo_l">
|
||||||
|
<image class="address_icon" src="https://images.ufutx.com/202012/04/9fd9ec3ebabffa12e4527ed8e0664473.png" mode="widthFix"></image>
|
||||||
|
<view class="address_text ellipsis_1 font24">{{item.city?item.city:'--'}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
<pageScroll ref="pageScroll"></pageScroll>
|
||||||
|
<recommendDialog :recommendShow.sync="recommendShow" :title.sync="title" :id.sync="id" :recommendData.sync="recommendData" :intentionShow.sync="intentionShow" @recommendCut.user="recommendCut" @intentionCut.user="intentionCut" @squareCut.user="squareCut" @squareCut_1.user="squareCut_1" @squareCut_2.user="squareCut_2" @squareCut_3.user="squareCut_3" @squareCut_4.user="squareCut_4" @squareCut_5.user="squareCut_5"></recommendDialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import wepy from '@wepy/core'
|
||||||
|
import https from '../../mixins/https'
|
||||||
|
import base from '../../mixins/base'
|
||||||
|
import {service} from '../../config'
|
||||||
|
import {getDiffTime} from '../../mixins/plugins'
|
||||||
|
|
||||||
|
wepy.page({
|
||||||
|
config: {},
|
||||||
|
mixins: [https, base],
|
||||||
|
|
||||||
|
data: {
|
||||||
|
id: '',
|
||||||
|
title: '',
|
||||||
|
no_more: false,
|
||||||
|
loading: false,
|
||||||
|
page: 1,
|
||||||
|
list: [], // 列表数据
|
||||||
|
verify: {},
|
||||||
|
recommendShow: true,
|
||||||
|
intentionShow: false,
|
||||||
|
recommendData: {}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getList() {
|
||||||
|
let vm = this
|
||||||
|
let data = {
|
||||||
|
area_id: vm.id,
|
||||||
|
page: vm.page
|
||||||
|
}
|
||||||
|
vm.$showLoading('加载中...')
|
||||||
|
vm.$get({url: `${service.host}/area/users/v2`, data}).then(({code, data}) => {
|
||||||
|
if (code === 0) {
|
||||||
|
if (vm.list.length === 0 || vm.page === 1) {
|
||||||
|
vm.list = data.data
|
||||||
|
} else {
|
||||||
|
data.data.map(function (item) {
|
||||||
|
vm.list.push(item)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (vm.list.length < 15 || data.data.length < 15) {
|
||||||
|
vm.no_more = true
|
||||||
|
}
|
||||||
|
vm.record(data.data)
|
||||||
|
setTimeout(() => {
|
||||||
|
vm.loading = true
|
||||||
|
}, 500)
|
||||||
|
vm.page++
|
||||||
|
}
|
||||||
|
wx.hideLoading()
|
||||||
|
}).catch(err => {
|
||||||
|
wx.hideLoading()
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 记录用户浏览过的数据
|
||||||
|
record(e) {
|
||||||
|
let vm = this
|
||||||
|
let list = []
|
||||||
|
e.forEach((item) => {
|
||||||
|
list.push(item.id)
|
||||||
|
})
|
||||||
|
let data = {
|
||||||
|
user_ids: list.toString()
|
||||||
|
}
|
||||||
|
vm.$post({url: `${service.host}/users/browse`, data}).then(() => {
|
||||||
|
}).catch(() => {
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 去申请上专区推荐
|
||||||
|
getRecommend() {
|
||||||
|
let vm = this
|
||||||
|
vm.$showLoading('')
|
||||||
|
vm.$get({url: `${service.host}/area/user/condition`}).then(({code, data}) => {
|
||||||
|
if (code === 0) {
|
||||||
|
vm.recommendData = data
|
||||||
|
if (data.profile == 1 && data.is_educate_approved == 1 && data.is_real_approved == 1) {
|
||||||
|
vm.intentionShow = true
|
||||||
|
} else {
|
||||||
|
vm.recommendShow = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
wx.hideLoading()
|
||||||
|
}).catch(err => {
|
||||||
|
console.log(err)
|
||||||
|
wx.hideLoading()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
statePost() {
|
||||||
|
let vm = this
|
||||||
|
let data = {
|
||||||
|
area_id: vm.id
|
||||||
|
}
|
||||||
|
vm.$post({url: `${service.host}/recommend/state`, data}).then(({code, data}) => {
|
||||||
|
if (code == 0) {
|
||||||
|
vm.recommendData = data
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
})
|
||||||
|
},
|
||||||
|
recommendCut(e) {
|
||||||
|
let vm = this
|
||||||
|
vm.recommendShow = e
|
||||||
|
},
|
||||||
|
intentionCut(e, state) {
|
||||||
|
let vm = this
|
||||||
|
vm.intentionShow = e
|
||||||
|
if (state) {
|
||||||
|
vm.verify.has_apply_area = state
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 上拉获取更多数据
|
||||||
|
onReachBottom() {
|
||||||
|
let vm = this
|
||||||
|
if (!vm.no_more) {
|
||||||
|
vm.getList()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 下拉刷新
|
||||||
|
onPullDownRefresh() {
|
||||||
|
let vm = this
|
||||||
|
vm.page = 1
|
||||||
|
vm.no_more = false
|
||||||
|
vm.getList()
|
||||||
|
},
|
||||||
|
onPageScroll(res) {
|
||||||
|
let vm = this
|
||||||
|
let top = res.scrollTop
|
||||||
|
vm.$refs.pageScroll.showBackTopBtn = top > 380
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
let vm = this
|
||||||
|
vm.statePost()
|
||||||
|
},
|
||||||
|
onLoad(e) {
|
||||||
|
let vm = this
|
||||||
|
vm.id = e.id
|
||||||
|
vm.titl = e.title
|
||||||
|
if (e.title) {
|
||||||
|
wx.setNavigationBarTitle({
|
||||||
|
title: e.title
|
||||||
|
})
|
||||||
|
}
|
||||||
|
vm.getList()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<config>
|
||||||
|
{
|
||||||
|
navigationBarTitleText: '专区推荐',
|
||||||
|
enablePullDownRefresh: true,
|
||||||
|
backgroundColorTop: '#ffffff',
|
||||||
|
backgroundColorBottom: '#ffffff',
|
||||||
|
usingComponents: {
|
||||||
|
pageScroll: '~@/components/pageScroll',
|
||||||
|
recommendDialog: '~@/components/recommendDialog'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</config>
|
||||||
416
src/pages/login.wpy
Normal file
@ -0,0 +1,416 @@
|
|||||||
|
<style lang="less" scoped>
|
||||||
|
@import url(../styles/theme.less);
|
||||||
|
page {
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
.login-container{
|
||||||
|
height: 100vh;
|
||||||
|
width: 100vw;
|
||||||
|
background-color: #ffffff;
|
||||||
|
overflow: hidden;
|
||||||
|
.ui-tabBar-box{
|
||||||
|
width: 100vw;
|
||||||
|
.ui-tabBar-list{
|
||||||
|
padding: 100rpx 142rpx 80rpx 142rpx;
|
||||||
|
.ui-tabBar-line{
|
||||||
|
position: absolute;
|
||||||
|
bottom: 8rpx;
|
||||||
|
z-index: 2;
|
||||||
|
width: 100%;
|
||||||
|
height: 10rpx;
|
||||||
|
background: linear-gradient(90deg, rgba(95,226,175,0.1) 0%, #41D5A9 100%);
|
||||||
|
border-radius: 5rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.ui-icon-box{
|
||||||
|
margin-left: 184rpx;
|
||||||
|
width: 100vw;
|
||||||
|
.ui-radio-icon{
|
||||||
|
height: 120rpx;
|
||||||
|
width: 120rpx;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: cover;
|
||||||
|
}
|
||||||
|
.ui-next-icon{
|
||||||
|
margin: 0 50rpx;
|
||||||
|
width: 56rpx;
|
||||||
|
height: 32rpx;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: cover;
|
||||||
|
}
|
||||||
|
.ui-next-img{
|
||||||
|
background-image: url("https://image.fulllinkai.com/202211/22/57641b9443b43fa228b393ba4c346897.png");
|
||||||
|
}
|
||||||
|
.ui-wx-img{
|
||||||
|
background-image: url("https://image.fulllinkai.com/202307/08/b8e7997ac2ff19757a56a72f282abc28.png");
|
||||||
|
}
|
||||||
|
.ui-wxapp-img{
|
||||||
|
background-image: url("https://image.fulllinkai.com/202211/22/28c5c5401a7b35da09ac5c079a861819.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
.ui-btn{
|
||||||
|
margin: 150rpx 40rpx 0;
|
||||||
|
height: 100rpx;
|
||||||
|
line-height: 100rpx;
|
||||||
|
border: none;
|
||||||
|
color: #e3fbf3;
|
||||||
|
background-color: @theme_color;
|
||||||
|
border-radius: 50rpx;
|
||||||
|
}
|
||||||
|
.ui-btn-v2{
|
||||||
|
background-color: #c2c2c2;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
.m_inp {
|
||||||
|
margin: 0 40rpx 40rpx 40rpx;
|
||||||
|
padding: 0 20rpx;
|
||||||
|
height: 98rpx;
|
||||||
|
border: 2rpx solid #ededed;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
position: relative;
|
||||||
|
input{
|
||||||
|
width: 284rpx;
|
||||||
|
}
|
||||||
|
.m_wo {
|
||||||
|
white-space: pre-wrap;
|
||||||
|
word-break: break-all;
|
||||||
|
.u_coll_img {
|
||||||
|
height: 12rpx;
|
||||||
|
width: 20rpx;
|
||||||
|
margin: 0rpx 20rpx 0 8rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.m_woPho {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 78rpx;
|
||||||
|
width: 210rpx;
|
||||||
|
padding-left: 10rpx;
|
||||||
|
//height: 416rpx;
|
||||||
|
background: #fff;
|
||||||
|
border: 2rpx solid #f5f5f5;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
z-index: 222;
|
||||||
|
overflow-y: scroll;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.ui-input-box{
|
||||||
|
padding: 0 40rpx;
|
||||||
|
position: relative;
|
||||||
|
.ui-input-class{
|
||||||
|
padding: 0 246rpx 0 20rpx;
|
||||||
|
height: 98rpx;
|
||||||
|
border: 2rpx solid #ededed;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
}
|
||||||
|
.ui-code-box{
|
||||||
|
position: absolute;
|
||||||
|
top: 24rpx;
|
||||||
|
right: 64rpx;
|
||||||
|
padding: 0 20rpx;
|
||||||
|
height: 52rpx;
|
||||||
|
border-radius: 26rpx;
|
||||||
|
border: 2rpx solid #B2E3D2;
|
||||||
|
z-index: 22;
|
||||||
|
}
|
||||||
|
.ui-code-border{
|
||||||
|
border: 2rpx solid #ececec;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.ui-code-btn-box{
|
||||||
|
width: 650rpx;
|
||||||
|
height: 100rpx;
|
||||||
|
border-radius: 50rpx;
|
||||||
|
background: #5AC7A0;
|
||||||
|
margin: 90rpx auto 0 auto;
|
||||||
|
}
|
||||||
|
.ui-agree-box{
|
||||||
|
margin: 50rpx auto;
|
||||||
|
padding: 0 90rpx;
|
||||||
|
display: flex;
|
||||||
|
justify-items: left;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
word-break: break-all;
|
||||||
|
word-wrap: break-word;
|
||||||
|
.ui-agree-icon{
|
||||||
|
margin-right: 16rpx;
|
||||||
|
margin-top: 2rpx;
|
||||||
|
height: 32rpx;
|
||||||
|
width: 32rpx;
|
||||||
|
min-width: 32rpx;
|
||||||
|
background-image: url("https://image.fulllinkai.com/202211/24/6ecbd7d3cb7c8d5bfcea6546dc6d7af0.png");
|
||||||
|
background-size: 100% 100%;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
}
|
||||||
|
.ui-agree-icon-change{
|
||||||
|
background-image: url("https://image.fulllinkai.com/202211/24/1956379959ca1cc109880daaa97ce70a.png");
|
||||||
|
}
|
||||||
|
.ui-agree-text{
|
||||||
|
color: @theme_color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
</style>
|
||||||
|
<template>
|
||||||
|
<view class="login-container">
|
||||||
|
<view class="ui-tabBar-box">
|
||||||
|
<view class="ui-tabBar-list f-fbc">
|
||||||
|
<view class="font_30 ui-relative {{tabBarIndex == index ? 'color-theme bold' : 'color666'}}" v-for="(item,index) in tabBarList" :key="index" @tap="selectTabBar(index)">
|
||||||
|
{{item}}
|
||||||
|
<view class="ui-tabBar-line" v-if="tabBarIndex == index"></view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<block v-if="tabBarIndex == 0">
|
||||||
|
<view class="ui-icon-box f-fc">
|
||||||
|
<view class="ui-radio-icon ui-wx-img"></view>
|
||||||
|
<view class="ui-next-icon ui-next-img"></view>
|
||||||
|
<view class="ui-radio-icon ui-wxapp-img"></view>
|
||||||
|
</view>
|
||||||
|
<button v-if="selectIcon" class="ui-btn font_32" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">
|
||||||
|
{{ i18nL.login.Ace2 }}
|
||||||
|
</button>
|
||||||
|
<view v-else class="ui-btn ui-btn-v2 text-c colorfff font_32" @tap="toSelect">{{ i18nL.login.Ace2 }}</view>
|
||||||
|
</block>
|
||||||
|
<block v-else>
|
||||||
|
<view class="m_inp f-fc">
|
||||||
|
<scroll-view scroll-into-view="{{toView}}" scroll-y class="m_woPho" v-if="!showChooseArea">
|
||||||
|
<block v-for="(item,index) in areaList" wx:key="index">
|
||||||
|
<view id="in_{{index}}" class="font_28 {{item.nation_code == AreaValue ? 'color-theme' : 'color333'}}" style="text-align: left;padding: 12rpx 10rpx;" @tap="selectedArea(item, index)">{{item.nation_code}} {{item.nation_name}}</view>
|
||||||
|
</block>
|
||||||
|
</scroll-view>
|
||||||
|
<view class="m_wo f-fcl" @tap.stop="showWorldPhone">
|
||||||
|
<view>{{AreaValue}}</view>
|
||||||
|
<image class="u_coll_img" v-if="showChooseArea" src="https://image.fulllinkai.com/202111/29/526faa3d99616f1faba1cde44c7ee204.png" mode="aspectFill"></image>
|
||||||
|
<image class="u_coll_img" v-else src="https://image.fulllinkai.com/202111/29/f1e9aff7554cb0207f045b9d15388f61.png" mode="aspectFill"></image>
|
||||||
|
</view>
|
||||||
|
<input class="font_30 ui-input-class color333 ui-letter-2" v-model="mobile" type="number" maxlength="16" :placeholder="i18nL.pages.service.detail.inputMobile" />
|
||||||
|
</view>
|
||||||
|
<view class="ui-input-box">
|
||||||
|
<input style="margin-left: 0;" :placeholder="i18nL.pages.user.bindMobile.Ace10" type="number" v-model="code" maxlength="6" class="font_30 ui-input-class color333 ui-letter-2"/>
|
||||||
|
<view class="font_24 ui-code-box f-fcc {{time == 0 ? 'color-theme' : 'color999 ui-code-border'}}" @tap="getCode">{{time == 0 ? i18nL.pages.user.bindMobile.Ace7 : btnText}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="font_32 f-fcc ui-code-btn-box white" @tap="bindMobile">{{i18nL.pages.user.bindMobile.Ace16}}</view>
|
||||||
|
</block>
|
||||||
|
<view class="ui-agree-box">
|
||||||
|
<view class="ui-agree-icon {{selectIcon ? 'ui-agree-icon-change': ''}}" @tap="selectDegree"></view>
|
||||||
|
<view class="f-fc">
|
||||||
|
<view class="color999 font_26" @tap="selectDegree">{{ i18nL.login.Ace3 }}《<span class="ui-agree-text font_26" @tap.stop="gotoH5('https://love.ufutx.com/h5/#/healthAgreement')">{{ i18nL.login.Ace4 }}</span>》</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import wepy from '@wepy/core'
|
||||||
|
import https from '../mixins/https'
|
||||||
|
import base from '../mixins/base'
|
||||||
|
import {getPhoneNumber} from '../utils/util'
|
||||||
|
import {service} from '../config'
|
||||||
|
|
||||||
|
wepy.page({
|
||||||
|
config: {},
|
||||||
|
mixins: [https, base],
|
||||||
|
|
||||||
|
data: {
|
||||||
|
modalName: '',
|
||||||
|
fileList: [],
|
||||||
|
tabBarList: ['微信快捷登录', '手机号登录'],
|
||||||
|
tabBarIndex: 0,
|
||||||
|
showChooseArea: true,
|
||||||
|
AreaIndex: 0,
|
||||||
|
areaList: [
|
||||||
|
{nation_code: '86', nation_name: '中国大陆'},
|
||||||
|
{nation_code: '886', nation_name: '中国台湾'},
|
||||||
|
{nation_code: '852', nation_name: '中国香港'},
|
||||||
|
{nation_code: '853', nation_name: '中国澳门'},
|
||||||
|
{nation_code: '65', nation_name: '新加坡'},
|
||||||
|
{nation_code: '66', nation_name: '泰国'},
|
||||||
|
{nation_code: '61', nation_name: '澳大利亚'}
|
||||||
|
],
|
||||||
|
toView: 'in_',
|
||||||
|
AreaValue: '中国大陆 86',
|
||||||
|
code: '',
|
||||||
|
time: 0,
|
||||||
|
timer: null,
|
||||||
|
loading: false,
|
||||||
|
btnText: '',
|
||||||
|
photo: '',
|
||||||
|
list: [],
|
||||||
|
mobile: '',
|
||||||
|
nickName: '',
|
||||||
|
phoneNumber: '',
|
||||||
|
user: {},
|
||||||
|
selectIcon: false
|
||||||
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
btnText() {
|
||||||
|
if (this.i18nL) {
|
||||||
|
return +this.time > 0 ? `${this.time}s ${this.i18nL.pages.user.bindMobile.Ace6}` : `${this.i18nL.pages.user.bindMobile.Ace7}`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
getPhoneNumber({$wx: e}) { // 获取手机号
|
||||||
|
let vm = this
|
||||||
|
if (e.detail.iv) {
|
||||||
|
getPhoneNumber(e).then(({mobile}) => {
|
||||||
|
console.log(mobile, '11111')
|
||||||
|
if (mobile) {
|
||||||
|
vm.mobile = mobile
|
||||||
|
console.log(vm.mobile)
|
||||||
|
vm.bindMobile()
|
||||||
|
}
|
||||||
|
}).catch((Error) => {
|
||||||
|
wx.showModal({ // 使用模态框提示用户进行操作
|
||||||
|
title: `${this.i18nL.pages.user.user1ace13}`,
|
||||||
|
content: Error,
|
||||||
|
showCancel: false,
|
||||||
|
confirmText: `${this.i18nL.pages.user.user1ace15}`,
|
||||||
|
success: function (res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
wx.navigateBack({
|
||||||
|
delta: 1
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
bindMobile() {
|
||||||
|
let vm = this
|
||||||
|
let data = {
|
||||||
|
mobile: vm.mobile,
|
||||||
|
type: vm.tabBarIndex == 0 ? 'wechat' : 'code',
|
||||||
|
code: vm.tabBarIndex == 0 ? '' : vm.code
|
||||||
|
}
|
||||||
|
if (!vm.mobile) {
|
||||||
|
vm.$showToast(`${vm.i18nL.pages.user.bindMobile.Ace3}`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (vm.AreaIndex == 0 && (!(/^1(3|4|5|6|7|8|9)\d{9}$/.test(vm.mobile)))) {
|
||||||
|
this.$showToast(`${this.i18nL.pages.user.bindMobile.Ace8}`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (vm.tabBarIndex == 1 && !vm.code) {
|
||||||
|
vm.$showToast(`${vm.i18nL.pages.user.bindMobile.Ace10}`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!vm.selectIcon) {
|
||||||
|
vm.$showToast(`${vm.i18nL.login.Ace6}`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
vm.$showLoading(`${vm.i18nL.pages.tabBar.home.Ace26}`)
|
||||||
|
vm.$post({url: service.bindMobile, data}).then(res => {
|
||||||
|
wx.hideLoading()
|
||||||
|
if (res.code === 1) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
wx.setStorageSync('mobile', vm.mobile)
|
||||||
|
vm.$showToast(`${vm.i18nL.login.Ace5}`)
|
||||||
|
setTimeout(() => {
|
||||||
|
vm.$redirectTo(`/pages/user/registrationMaterial`)
|
||||||
|
}, 1200)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
selectTabBar(index) {
|
||||||
|
let vm = this
|
||||||
|
vm.tabBarIndex = index
|
||||||
|
},
|
||||||
|
// 获取验证码
|
||||||
|
getCode() {
|
||||||
|
let vm = this
|
||||||
|
if (!vm.mobile) {
|
||||||
|
vm.$showToast(`${vm.i18nL.pages.user.bindMobile.Ace3}`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 防抖
|
||||||
|
if (vm.loading || vm.time > 0) return
|
||||||
|
// 开防抖
|
||||||
|
vm.loading = true
|
||||||
|
// 根据业务接口处理:发送验证码
|
||||||
|
let data = {
|
||||||
|
mobile: vm.mobile,
|
||||||
|
area_code: vm.areaList[vm.AreaIndex].nation_code
|
||||||
|
}
|
||||||
|
vm.$showLoading(`${vm.i18nL.pages.tabBar.home.Ace26}`)
|
||||||
|
vm.$get({url: `${service.host}/mobile/code`, data}).then(res => {
|
||||||
|
wx.hideLoading()
|
||||||
|
if (res.code === 1) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 开倒计时
|
||||||
|
vm.timing(60)
|
||||||
|
vm.$showToast(`${vm.i18nL.pages.user.bindMobile.Ace9}`)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
timing(time) {
|
||||||
|
this.time = time
|
||||||
|
this.timer = setTimeout(() => {
|
||||||
|
if (time > 0) {
|
||||||
|
this.timing(time - 1)
|
||||||
|
} else {
|
||||||
|
this.loading = false
|
||||||
|
}
|
||||||
|
}, 1000)
|
||||||
|
},
|
||||||
|
showWorldPhone() {
|
||||||
|
this.toView = `in_${this.AreaIndex}`
|
||||||
|
this.showChooseArea = !this.showChooseArea
|
||||||
|
},
|
||||||
|
selectedArea(e, index) {
|
||||||
|
this.AreaValue = `${e.nation_name} ${e.nation_code}`
|
||||||
|
this.AreaIndex = index
|
||||||
|
this.showChooseArea = !this.showChooseArea
|
||||||
|
},
|
||||||
|
selectDegree() {
|
||||||
|
this.selectIcon = !this.selectIcon
|
||||||
|
},
|
||||||
|
toSelect() {
|
||||||
|
this.$showToast(`${this.i18nL.login.Ace6}`)
|
||||||
|
},
|
||||||
|
gotoH5(item) {
|
||||||
|
wx.navigateTo({ url: '/pages/sub_page/bookDetail?url=' + encodeURIComponent(item) })
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onPullDownRefresh() { // 下拉刷新
|
||||||
|
// this.getUserInfo()
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
this.i18nL = this.$app.$options.globalData.i18nL // 切换赋值- 娄底
|
||||||
|
this.$setNavigationBarTitleI18n(this.i18nL.login.title) // 设置顶部title
|
||||||
|
this.tabBarList[0] = this.i18nL.login.Ace7
|
||||||
|
this.tabBarList[1] = this.i18nL.login.Ace8
|
||||||
|
this.tabBarList = JSON.parse(JSON.stringify(this.tabBarList))
|
||||||
|
this.areaList[0].nation_name = this.i18nL.pages.user.bindMobile.Ace12
|
||||||
|
this.areaList[1].nation_name = this.i18nL.pages.user.bindMobile.Ace13
|
||||||
|
this.areaList[2].nation_name = this.i18nL.pages.user.bindMobile.Ace14
|
||||||
|
this.areaList[3].nation_name = this.i18nL.pages.user.bindMobile.Ace15
|
||||||
|
this.areaList[4].nation_name = this.i18nL.pages.user.bindMobile.Ace18
|
||||||
|
this.areaList[5].nation_name = this.i18nL.pages.user.bindMobile.Ace17
|
||||||
|
this.areaList[6].nation_name = this.i18nL.pages.user.bindMobile.Ace19
|
||||||
|
this.areaList = JSON.parse(JSON.stringify(this.areaList))
|
||||||
|
this.AreaValue = `${this.i18nL.pages.user.bindMobile.Ace12} 86`
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<config>
|
||||||
|
{
|
||||||
|
navigationBarTitleText: '友福DMA',
|
||||||
|
<!--navigationStyle: 'custom',-->
|
||||||
|
enablePullDownRefresh: false,
|
||||||
|
backgroundColorTop: '#F4F7FC',
|
||||||
|
backgroundColorBottom: '#F4F7FC'
|
||||||
|
}
|
||||||
|
</config>
|
||||||
1531
src/pages/news/chitchat.wpy
Normal file
721
src/pages/news/friendRequest.wpy
Normal file
@ -0,0 +1,721 @@
|
|||||||
|
<style lang="less" scoped>
|
||||||
|
@import url(../../styles/theme.less);
|
||||||
|
page {
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
}
|
||||||
|
.ui-tabBar-box{
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 99;
|
||||||
|
background: #f5f5f5;
|
||||||
|
|
||||||
|
.ui-tabBar-box{
|
||||||
|
width: 100%;
|
||||||
|
padding: 28rpx 200rpx 40rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
.ui-nav {
|
||||||
|
height: 42rpx;
|
||||||
|
font-size: 30rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #999999;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.ui-active {
|
||||||
|
font-size: 30rpx;
|
||||||
|
line-height: 42rpx;
|
||||||
|
color: #333333;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.ui-active::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
left: 50%;
|
||||||
|
bottom: -14rpx;
|
||||||
|
width: 40rpx;
|
||||||
|
height: 8rpx;
|
||||||
|
background: #FF5380;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-placeholder{
|
||||||
|
width: 100vw;
|
||||||
|
height: 110rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-container {
|
||||||
|
padding-bottom: 100rpx;
|
||||||
|
|
||||||
|
.ui-no-data-icon{
|
||||||
|
width: 250rpx;
|
||||||
|
height: 250rpx;
|
||||||
|
display: block;
|
||||||
|
vertical-align: top;
|
||||||
|
margin: 36vh auto 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-list-items {
|
||||||
|
height: 136rpx;
|
||||||
|
position: relative;
|
||||||
|
margin: 0 30rpx 24rpx 30rpx;
|
||||||
|
|
||||||
|
.ui-item-data {
|
||||||
|
width: 100%;
|
||||||
|
display: inline-flex;
|
||||||
|
height: 136rpx;
|
||||||
|
background: #ffffff;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
padding: 22rpx;
|
||||||
|
.weuis{
|
||||||
|
height: 92rpx;
|
||||||
|
position: relative;
|
||||||
|
.title{
|
||||||
|
width: 100%;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.name{
|
||||||
|
max-width: 50%;
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
height: 44rpx;
|
||||||
|
font-size: 30rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #333333;
|
||||||
|
line-height: 44rpx;
|
||||||
|
}
|
||||||
|
.dist {
|
||||||
|
width: 20rpx;
|
||||||
|
height: 20rpx;
|
||||||
|
background: #F33B6C;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
.dot{
|
||||||
|
position: absolute;
|
||||||
|
background: #F1013D;
|
||||||
|
border: 2rpx solid #FFFFFF;
|
||||||
|
z-index: 99;
|
||||||
|
right: 13rpx;
|
||||||
|
top: 7rpx;
|
||||||
|
}
|
||||||
|
.referencesIcon {
|
||||||
|
width: 124rpx;
|
||||||
|
height: 36rpx;
|
||||||
|
display: block;
|
||||||
|
margin-left: 16rpx;
|
||||||
|
margin-top: 2rpx;
|
||||||
|
}
|
||||||
|
.Vip{
|
||||||
|
width: 32rpx;
|
||||||
|
height: 28rpx;
|
||||||
|
margin: 0 8rpx;
|
||||||
|
}
|
||||||
|
.age {
|
||||||
|
width: 76rpx;
|
||||||
|
height: 32rpx;
|
||||||
|
line-height: 32rpx;
|
||||||
|
background: #fff4f7;
|
||||||
|
border-radius: 50rpx;
|
||||||
|
color: #f33b6c;
|
||||||
|
font-size: 22rpx;
|
||||||
|
border: 2rpx solid #ff95b1;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
.img {
|
||||||
|
width: 22rpx;
|
||||||
|
height: 22rpx;
|
||||||
|
margin-right: 4rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.sex1 {
|
||||||
|
background: #EDFAFF;
|
||||||
|
border: 2rpx solid #63A5FF;
|
||||||
|
color: #4191FD;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.rit{
|
||||||
|
width: 84%;
|
||||||
|
display: inline-flex;
|
||||||
|
flex-flow: column;
|
||||||
|
align-items: center;
|
||||||
|
.friend-text{
|
||||||
|
width: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
height: 40rpx;
|
||||||
|
font-size: 26rpx;
|
||||||
|
font-weight: 400;
|
||||||
|
color: #333333;
|
||||||
|
line-height: 40rpx;
|
||||||
|
margin-top: 8rpx;
|
||||||
|
background: #ffffff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.bc_acatar {
|
||||||
|
width: 92rpx;
|
||||||
|
height: 92rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin-right: 14rpx;
|
||||||
|
}
|
||||||
|
.time {
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
.bc_right {
|
||||||
|
width: 32rpx;
|
||||||
|
height: 32rpx;
|
||||||
|
image {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.cu-modal {
|
||||||
|
.cu-dialog {
|
||||||
|
width: 600rpx;
|
||||||
|
background: #ffffff;
|
||||||
|
border-radius: 32rpx;
|
||||||
|
position: relative;
|
||||||
|
overflow:initial;
|
||||||
|
}
|
||||||
|
.cu-bar {
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.contents-img{
|
||||||
|
width:54rpx;
|
||||||
|
height: 54rpx;
|
||||||
|
margin-right: 10rpx;
|
||||||
|
}
|
||||||
|
.contents {
|
||||||
|
display: flex;
|
||||||
|
.name{
|
||||||
|
max-width: 180rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.m_tips_tt {
|
||||||
|
margin-top: -20rpx;
|
||||||
|
.u_tips_icon {
|
||||||
|
width: 24rpx;
|
||||||
|
height: 24rpx;
|
||||||
|
margin-left: 8rpx;
|
||||||
|
position: relative;
|
||||||
|
background-image: url('https://images.ufutx.com/202108/12/31e5b71695c85452c8aa928cf8f0032d.png');
|
||||||
|
background-size: 100% 100%;
|
||||||
|
.u_tips_img {
|
||||||
|
position: absolute;
|
||||||
|
max-width: 406rpx;
|
||||||
|
height: 226rpx;
|
||||||
|
z-index: 999999999;
|
||||||
|
right: -116rpx;
|
||||||
|
top: 30rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.friendAddition {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
flex-flow: column;
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
padding: 0 50rpx 40rpx 50rpx;
|
||||||
|
background: #ffffff;
|
||||||
|
position: relative;
|
||||||
|
.header {
|
||||||
|
width: 112rpx;
|
||||||
|
height: 112rpx;
|
||||||
|
background: #F6FDF6;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin-bottom: 24rpx;
|
||||||
|
margin-top: 30rpx;
|
||||||
|
position: relative;
|
||||||
|
background-size: cover;
|
||||||
|
background-position: center;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
.texts {
|
||||||
|
font-size: 30rpx;
|
||||||
|
font-weight: 400;
|
||||||
|
color: #333333;
|
||||||
|
}
|
||||||
|
.sex{
|
||||||
|
width: 30rpx;
|
||||||
|
height:30rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
position: absolute;
|
||||||
|
top: 110rpx;
|
||||||
|
right: 250rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.action {
|
||||||
|
padding-bottom: 50rpx;
|
||||||
|
.deny {
|
||||||
|
width: 192rpx;
|
||||||
|
height: 68rpx;
|
||||||
|
border-radius: 34rpx;
|
||||||
|
border: 2rpx solid #D8D8D8;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #999999;
|
||||||
|
background: #ffffff;
|
||||||
|
}
|
||||||
|
.agreed {
|
||||||
|
width: 192rpx;
|
||||||
|
height: 68rpx;
|
||||||
|
background: #FF5380;
|
||||||
|
border-radius: 34rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #ffffff;
|
||||||
|
margin-left: 64rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.actions {
|
||||||
|
position: absolute;
|
||||||
|
bottom: -100rpx;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
margin: auto;
|
||||||
|
width: 48rpx;
|
||||||
|
height: 48rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-reject{
|
||||||
|
padding: 44rpx 40rpx 50rpx;
|
||||||
|
border-radius: 24rpx;
|
||||||
|
.ui-reject-title{
|
||||||
|
margin: 0 auto;
|
||||||
|
width: 128rpx;
|
||||||
|
height: 44rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #333333;
|
||||||
|
line-height: 44rpx;
|
||||||
|
}
|
||||||
|
.ui-reject-text-box{
|
||||||
|
padding: 20rpx 24rpx 0;
|
||||||
|
width: 520rpx;
|
||||||
|
height: 256rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
background: #F5F5F5;
|
||||||
|
margin-top: 30rpx;
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
border-radius: 32rpx;
|
||||||
|
}
|
||||||
|
.ui-reject-textarea{
|
||||||
|
width: 100%;
|
||||||
|
text-align: left;
|
||||||
|
min-height: 40rpx;
|
||||||
|
height: 256rpx;
|
||||||
|
line-height: 1.5
|
||||||
|
}
|
||||||
|
.ui-reject-modal{
|
||||||
|
padding-top: 20rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
.ui-reject-list{
|
||||||
|
margin: 0 24rpx 20rpx 0;
|
||||||
|
padding: 12rpx 24rpx;
|
||||||
|
width: 178rpx;
|
||||||
|
height: 60rpx;
|
||||||
|
color: #666666;
|
||||||
|
background: #F5F5F5;
|
||||||
|
border-radius: 34rpx;
|
||||||
|
}
|
||||||
|
.ui-select-eject{
|
||||||
|
color: #F33B6C;
|
||||||
|
background: #FFF4F7;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.ui-reject-btn{
|
||||||
|
margin: 30rpx auto 0;
|
||||||
|
width: 400rpx;
|
||||||
|
height: 80rpx;
|
||||||
|
background: linear-gradient(90deg,#ff5380 0%, #ff85a5 100%);
|
||||||
|
border-radius: 40rpx;
|
||||||
|
color: #FFFFFF;
|
||||||
|
line-height: 80rpx;
|
||||||
|
letter-spacing: 2rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<template>
|
||||||
|
<view class="ui-friendRequest">
|
||||||
|
<view class="ui-tabBar-box">
|
||||||
|
<view class="ui-tabBar-box f-fbc">
|
||||||
|
<view v-for="(item,index) in tabBarList" :key="index" data-index="{{index}}" class="ui-nav {{tabBarIndex == index ? 'ui-active' : ''}}" @tap="changeTab(index)">{{item}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="ui-placeholder"></view>
|
||||||
|
<view class="ui-container">
|
||||||
|
<image v-if="list.length == 0 && loading" class="ui-no-data-icon" src="https://images.ufutx.com/202104/13/1737964f7c98cbf65d728137dc2792eb.png" mode="aspectFill"></image>
|
||||||
|
<block v-else>
|
||||||
|
<view class="ui-list-items" v-for="(item, index) in list" :key="index">
|
||||||
|
<view class="ui-item-data" @tap="jumpPath(item)">
|
||||||
|
<view class="weuis" @tap.stop="jumpDetailPath(item)">
|
||||||
|
<view class="dist dot" v-if="item.status == 0"></view>
|
||||||
|
<image :src="tabBarIndex === 0 ? (item.other_user.avatar || item.other_user.photo) : (item.receive_user.avatar || item.receive_user.photo)" mode="aspectFill" class="bc_acatar"></image>
|
||||||
|
</view>
|
||||||
|
<view class="rit weuis">
|
||||||
|
<view class="title">
|
||||||
|
<view class="font_32 color333 bold name">
|
||||||
|
{{tabBarIndex === 0 ? item.other_user.nickname :item.receive_user.nickname }}
|
||||||
|
</view>
|
||||||
|
<block v-if="tabBarIndex === 0 ? item.other_user.type !== 'single' :item.receive_user.type !== 'single'">
|
||||||
|
<image class="referencesIcon" src="https://image.fulllinkai.com/202207/15/7e78a1dd367f1250d4cba4e85bfd60f1.png" mode="widthFix"></image>
|
||||||
|
</block>
|
||||||
|
<view class="font_24 time">{{ item.created_at }}</view>
|
||||||
|
<block v-if="tabBarIndex === 0 ? item.other_user.type == 'single' : item.receive_user.type == 'single'">
|
||||||
|
<image v-if="tabBarIndex === 0 ? item.other_user.is_super_rank == 0 : item.receive_user.is_super_rank == 0" class="Vip flo_l bg-img" src="https://images.ufutx.com/202102/04/bfad7e2a8e86cf7912ff280234a35606.png"></image>
|
||||||
|
<image v-else class="Vip flo_l bg-img" src="https://images.ufutx.com/202102/04/d0913df8b234057229ab3dd102497a50.png"></image>
|
||||||
|
<view class="age {{tabBarIndex === 0 ? (item.other_user.sex == 1?'sex1':'') : (item.receive_user.sex == 1?'sex1':'') }}">
|
||||||
|
<image v-if="tabBarIndex === 0 ? item.other_user.sex == 1 : item.receive_user.sex == 1" class="img" src="https://images.ufutx.com/202101/27/1fc8381ccac933612936bb617a5ae906.png" alt=""/>
|
||||||
|
<image v-else class="img" src="https://images.ufutx.com/202101/27/f17913a8fc57de75dc0046db6c317b35.png" alt=""/>
|
||||||
|
<view v-if="tabBarIndex === 0 ? item.other_user.age == null : item.receive_user.age == null">0</view>
|
||||||
|
<view v-else>{{ tabBarIndex === 0 ? item.other_user.age : item.receive_user.age }}</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
<block v-if="tabBarIndex === 0">
|
||||||
|
<block v-if="item.status == 0">
|
||||||
|
<view class="friend-text">{{item.message}}</view>
|
||||||
|
</block>
|
||||||
|
<block v-if="item.status == 1">
|
||||||
|
<view class="friend-text {{item.status == '1'?'text-green':'red'}}">已接受</view>
|
||||||
|
</block>
|
||||||
|
<block v-if="item.status == '-1'">
|
||||||
|
<view class="friend-text {{item.status == '1'?'text-green':'red'}}">{{'已拒绝' + (item.reply? (',理由:' +item.reply) :item.refuse_tag ?(',理由:' +item.refuse_tag) :'') }}</view>
|
||||||
|
</block>
|
||||||
|
<block v-if="item.status == 2">
|
||||||
|
<view class="friend-text {{item.status == '1'?'text-green':'red'}}">已过期</view>
|
||||||
|
</block>
|
||||||
|
</block>
|
||||||
|
<block v-else>
|
||||||
|
<block v-if="item.status == 0">
|
||||||
|
<view class="friend-text">{{item.read_status == 0 ? '对方未读' : '对方未处理'}}</view>
|
||||||
|
</block>
|
||||||
|
<block v-if="item.status == 1">
|
||||||
|
<view class="friend-text {{item.status == '1'?'text-green':'red'}}">对方已接受</view>
|
||||||
|
</block>
|
||||||
|
<block v-if="item.status == '-1'">
|
||||||
|
<view class="friend-text {{item.status == '1'?'text-green':'red'}}">{{'对方已拒绝' + (item.reply? (',理由:' +item.reply) :item.refuse_tag ?(',理由:' +item.refuse_tag) :'') }}</view>
|
||||||
|
</block>
|
||||||
|
<block v-if="item.status == 2">
|
||||||
|
<view class="friend-text {{item.status == '1'?'text-green':'red'}}">已过期</view>
|
||||||
|
</block>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="cu-modal" :class="{'show' : applyForShow}" @tap="approveTips = false">
|
||||||
|
<view class="cu-dialog">
|
||||||
|
<view class="cu-bar">
|
||||||
|
<image class="contents-img" src="https://images.ufutx.com/202103/17/5b034eee6a40e8a01c0bcc2f566b7bec.png"></image>
|
||||||
|
<view class="contents font_32 color333"><view class="name">{{name}}</view>向你申请加为好友</view>
|
||||||
|
</view>
|
||||||
|
<view v-if="approveState" class="m_tips_tt f-fcc" @tap.stop="approveTips = !approveTips">
|
||||||
|
<view class="font_24 color-666">对方未真人认证,请谨防</view>
|
||||||
|
<view class="u_tips_icon">
|
||||||
|
<image v-if="approveTips" class="u_tips_img" mode="aspectFill" src="https://images.ufutx.com/202108/12/8110271f597604081605b4809fcde6dd.png"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="friendAddition">
|
||||||
|
<image class="header" :src="pic" mode="aspectFill"></image>
|
||||||
|
<view class="texts">{{msg || 'hi'}}</view>
|
||||||
|
<image v-if="sex == 1" class="sex" src="https://images.ufutx.com/202103/23/3e7ac93e7bff26a9b62fe3232c776a96.png"></image>
|
||||||
|
<image v-else class="sex" src="https://images.ufutx.com/202103/23/4fd7a85e7073152fde91190b8957910e.png"></image>
|
||||||
|
</view>
|
||||||
|
<view class="cu-bar">
|
||||||
|
<view class="action">
|
||||||
|
<button class="cu-btn deny" @tap.stop="rejectShow = true">拒绝</button>
|
||||||
|
<button class="cu-btn agreed" @tap.stop="submit(1)">同意</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<image class="actions" src="https://images.ufutx.com/202103/15/1033c7b52cacddcebe999cefc6ad2c9b.png" mode="widthFix" @tap.stop="applyForShow = false"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="cu-modal" :class="{'show' : rejectShow}">
|
||||||
|
<view class="cu-dialog">
|
||||||
|
<view class="ui-reject">
|
||||||
|
<view class="ui-reject-title">拒绝理由</view>
|
||||||
|
<view class="ui-reject-text-box">
|
||||||
|
<textarea :disabled="rejectDisabled" class="ui-reject-textarea font_28" placeholder="请填写你的拒绝理由" max="800" v-model="rejectText"></texTarea>
|
||||||
|
</view>
|
||||||
|
<view class="ui-reject-modal">
|
||||||
|
<view v-for="(item,index) in rejectList" :key="index" class="ui-reject-list font_26 {{ item.labelSel ? 'ui-select-eject' : ''}}" @tap.stop="addReject(index)">{{item.label}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="ui-reject-btn font_32 bold" @tap.stop="submit(0)">{{ rejectDisabled ? '我知道了' : '确认' }}</view>
|
||||||
|
</view>
|
||||||
|
<image class="actions" src="https://images.ufutx.com/202103/15/1033c7b52cacddcebe999cefc6ad2c9b.png" mode="widthFix" @tap.stop="rejectShow = false"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<pageScroll ref="pageScroll"></pageScroll>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import wepy from '@wepy/core'
|
||||||
|
import https from '../../mixins/https'
|
||||||
|
import base from '../../mixins/base'
|
||||||
|
import {service} from '../../config'
|
||||||
|
import {getDiffTime} from '../../mixins/plugins'
|
||||||
|
|
||||||
|
wepy.page({
|
||||||
|
config: {},
|
||||||
|
mixins: [https, base],
|
||||||
|
|
||||||
|
data: {
|
||||||
|
tabBarList: ['收到的', '发出的'],
|
||||||
|
tabBarIndex: 0,
|
||||||
|
throttle: true,
|
||||||
|
no_more: false,
|
||||||
|
loading: false,
|
||||||
|
page: 1,
|
||||||
|
list: [], // 消息列表数据
|
||||||
|
|
||||||
|
name: '',
|
||||||
|
pic: '',
|
||||||
|
msg: '',
|
||||||
|
sex: '',
|
||||||
|
id: '',
|
||||||
|
userId: '',
|
||||||
|
userType: '',
|
||||||
|
approveTips: false,
|
||||||
|
approveState: false,
|
||||||
|
applyForShow: false,
|
||||||
|
|
||||||
|
rejectText: '', // 拒绝理由
|
||||||
|
rejectDisabled: false, // 是否已经填写过拒绝理由
|
||||||
|
rejectShow: false,
|
||||||
|
rejectList: [
|
||||||
|
{label: '年龄不合适', labelSel: false},
|
||||||
|
{label: '身高不合适', labelSel: false},
|
||||||
|
{label: '地域不合适', labelSel: false},
|
||||||
|
{label: '信仰不合适', labelSel: false},
|
||||||
|
{label: '学历不合适', labelSel: false}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getList() {
|
||||||
|
let vm = this
|
||||||
|
let data = {
|
||||||
|
page: vm.page
|
||||||
|
}
|
||||||
|
vm.$showLoading('加载中...')
|
||||||
|
vm.$get({url: `${service.host}/friend/request/logs/v2?type=${vm.tabBarIndex === 0 ? 'receive' : 'send'}`, data}).then(({code, data}) => {
|
||||||
|
if (code === 0) {
|
||||||
|
data.data.forEach((item) => {
|
||||||
|
item.created_at = item.created_at.split(' ', 1)
|
||||||
|
})
|
||||||
|
if (vm.list.length === 0 || vm.page === 1) {
|
||||||
|
vm.list = data.data
|
||||||
|
} else {
|
||||||
|
data.data.map(function (item) {
|
||||||
|
vm.list.push(item)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (vm.list.length < 15 || data.data.length < 15) {
|
||||||
|
vm.no_more = true
|
||||||
|
}
|
||||||
|
let obj = {}
|
||||||
|
let peon = []
|
||||||
|
// 去除重复数据保留最后一条
|
||||||
|
if (vm.tabBarIndex == 0) {
|
||||||
|
peon = vm.list.reduce((cur, next) => {
|
||||||
|
obj[next.user_linking_id] ? '' : obj[next.user_linking_id] = true && cur.push(next)
|
||||||
|
return cur
|
||||||
|
}, [])
|
||||||
|
} else {
|
||||||
|
peon = vm.list.reduce((cur, next) => {
|
||||||
|
obj[next.user_id] ? '' : obj[next.user_id] = true && cur.push(next)
|
||||||
|
return cur
|
||||||
|
}, [])
|
||||||
|
}
|
||||||
|
vm.list = peon
|
||||||
|
setTimeout(() => {
|
||||||
|
vm.loading = true
|
||||||
|
}, 500)
|
||||||
|
vm.page++
|
||||||
|
}
|
||||||
|
wx.hideLoading()
|
||||||
|
}).catch(err => {
|
||||||
|
wx.hideLoading()
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 申请提交
|
||||||
|
submit(e) {
|
||||||
|
let vm = this
|
||||||
|
let reject = []
|
||||||
|
let data = {}
|
||||||
|
// 已经处理过的就关闭弹框
|
||||||
|
if (vm.rejectDisabled) {
|
||||||
|
vm.rejectShow = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (e) {
|
||||||
|
data = {
|
||||||
|
id: vm.id,
|
||||||
|
status: 1
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
data = {
|
||||||
|
id: vm.id,
|
||||||
|
status: -1,
|
||||||
|
reply: vm.rejectText,
|
||||||
|
refuse_tag: reject
|
||||||
|
}
|
||||||
|
vm.rejectList.forEach(item => {
|
||||||
|
if (item.labelSel) {
|
||||||
|
reject.push(item.label)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (!vm.rejectText && reject.length == 0) {
|
||||||
|
vm.$showToast('请输入或选择原因')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (vm.throttle) {
|
||||||
|
vm.throttle = false
|
||||||
|
vm.$post({url: `${service.host}/deal/friend/request/v2`, data}).then(({code, data}) => {
|
||||||
|
if (code == 0) {
|
||||||
|
if (e) {
|
||||||
|
vm.$showToast('已添加为好友')
|
||||||
|
let url = `/pages/news/chitchat?id=${vm.userId}&name=${encodeURIComponent(vm.name)}&type=${vm.userType}&icon=${vm.pic}`
|
||||||
|
wx.redirectTo({url: url})
|
||||||
|
} else {
|
||||||
|
vm.$showToast('已拒绝')
|
||||||
|
vm.loading = false
|
||||||
|
vm.no_more = false
|
||||||
|
vm.page = 1
|
||||||
|
vm.getList()
|
||||||
|
vm.applyForShow = false
|
||||||
|
vm.rejectShow = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
vm.throttle = true
|
||||||
|
}).catch(() => {
|
||||||
|
vm.throttle = true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 选择拒绝选项
|
||||||
|
addReject(index) {
|
||||||
|
let vm = this
|
||||||
|
if (vm.tabBarIndex == 1 || vm.rejectDisabled) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
vm.rejectList[index].labelSel = !vm.rejectList[index].labelSel
|
||||||
|
},
|
||||||
|
changeTab(index) {
|
||||||
|
let vm = this
|
||||||
|
if (vm.tabBarIndex == index) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
vm.tabBarIndex = index
|
||||||
|
vm.list = []
|
||||||
|
vm.loading = false
|
||||||
|
vm.no_more = false
|
||||||
|
vm.page = 1
|
||||||
|
vm.getList()
|
||||||
|
},
|
||||||
|
jumpPath(e) {
|
||||||
|
let vm = this
|
||||||
|
let url = ``
|
||||||
|
let rejectList = []
|
||||||
|
// 已经拒绝了好友申请回填数据
|
||||||
|
if (e.status == -1) {
|
||||||
|
vm.rejectText = e.reply
|
||||||
|
vm.rejectList.forEach(item => {
|
||||||
|
if (e.refuse_tag.indexOf(item.label) >= 0) {
|
||||||
|
rejectList.push(item)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
vm.rejectList = rejectList
|
||||||
|
vm.rejectDisabled = true
|
||||||
|
vm.rejectShow = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if ((vm.tabBarIndex == 0 && e.status != '0') || (vm.tabBarIndex == 1 && e.status != '-1')) {
|
||||||
|
url = `/pages/home/information?id=${vm.tabBarIndex == 0 ? e.other_user.id : e.receive_user.id}`
|
||||||
|
wx.navigateTo({url: url})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 好友申请是否已经真人认证
|
||||||
|
if (e.other_user.is_real_approved != 1) {
|
||||||
|
vm.approveTips = true
|
||||||
|
vm.approveState = true
|
||||||
|
}
|
||||||
|
// 真人认证提示定时隐藏
|
||||||
|
setTimeout(() => {
|
||||||
|
vm.approveTips = false
|
||||||
|
}, 1800)
|
||||||
|
// 好友申请获取申请用户数据
|
||||||
|
vm.msg = e.message
|
||||||
|
vm.id = e.id
|
||||||
|
vm.name = e.other_user.nickname
|
||||||
|
vm.sex = e.other_user.sex
|
||||||
|
vm.userId = e.other_user.id
|
||||||
|
vm.userType = e.other_user.type
|
||||||
|
vm.pic = e.other_user.avatar || e.other_user.photo
|
||||||
|
vm.applyForShow = true
|
||||||
|
},
|
||||||
|
jumpDetailPath(e) {
|
||||||
|
let vm = this
|
||||||
|
wx.navigateTo({url: `/pages/home/information?id=${vm.tabBarIndex == 0 ? e.other_user.id : e.receive_user.id}`})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 上拉获取更多数据
|
||||||
|
onReachBottom() {
|
||||||
|
let vm = this
|
||||||
|
if (!vm.no_more) {
|
||||||
|
vm.getList()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 下拉刷新
|
||||||
|
onPullDownRefresh() {
|
||||||
|
let vm = this
|
||||||
|
vm.page = 1
|
||||||
|
vm.no_more = false
|
||||||
|
vm.getList()
|
||||||
|
},
|
||||||
|
onPageScroll(res) {
|
||||||
|
let vm = this
|
||||||
|
let top = res.scrollTop
|
||||||
|
vm.$refs.pageScroll.showBackTopBtn = top > 380
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<config>
|
||||||
|
{
|
||||||
|
navigationBarTitleText: '好友申请',
|
||||||
|
enablePullDownRefresh: true,
|
||||||
|
backgroundColorTop: '#f5f5f5',
|
||||||
|
backgroundColorBottom: '#f5f5f5',
|
||||||
|
usingComponents: {
|
||||||
|
pageScroll: '~@/components/pageScroll'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</config>
|
||||||
1506
src/pages/news/groupChitchat.wpy
Normal file
428
src/pages/news/groupChitchatDetail.wpy
Normal file
@ -0,0 +1,428 @@
|
|||||||
|
<style lang="less" scoped>
|
||||||
|
@import url(../../styles/theme.less);
|
||||||
|
page {
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-member-data-box{
|
||||||
|
padding: 30rpx 40rpx 0;
|
||||||
|
background: #FFFFFF;
|
||||||
|
width: 100vw;
|
||||||
|
|
||||||
|
.ui-member-list{
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
.ui-member-box{
|
||||||
|
margin: 0 52rpx 42rpx 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
.ui-member-pic{
|
||||||
|
margin-bottom: 10rpx;
|
||||||
|
width: 92rpx;
|
||||||
|
height: 92rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
.ui-member-name{
|
||||||
|
max-width: 88rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.ui-member-block:nth-child(5n) .ui-member-box{
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-more-list{
|
||||||
|
margin-left: 234rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding-bottom: 30rpx;
|
||||||
|
.ui-more-pic{
|
||||||
|
margin-left: 10rpx;
|
||||||
|
width: 12rpx;
|
||||||
|
height: 24rpx;
|
||||||
|
}
|
||||||
|
.ui-more-pic-v1{
|
||||||
|
margin-right: 10rpx;
|
||||||
|
width: 24rpx;
|
||||||
|
height: 12rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.ui-more-list-v1{
|
||||||
|
margin-left: 274rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-group-detail{
|
||||||
|
margin-top: 12rpx;
|
||||||
|
padding: 22rpx 40rpx;
|
||||||
|
width: 100vw;
|
||||||
|
background: #ffffff;
|
||||||
|
.ui-detail-list{
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
.ui-detail-title{
|
||||||
|
width: 400rpx;
|
||||||
|
}
|
||||||
|
.ui-detail-name{
|
||||||
|
//text-align: right;
|
||||||
|
max-width: 430rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
.ui-detail-name-text{
|
||||||
|
margin-right: 10rpx;
|
||||||
|
text-align: right;
|
||||||
|
width: 420rpx;
|
||||||
|
}
|
||||||
|
.ui-detail-name-icon{
|
||||||
|
width: 28rpx;
|
||||||
|
height: 28rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.ui-detail-pic{
|
||||||
|
width: 60rpx;
|
||||||
|
height: 60rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.ui-detail-line{
|
||||||
|
margin: 20rpx 0 30rpx;
|
||||||
|
width: 670rpx;
|
||||||
|
height: 2rpx;
|
||||||
|
background: #F8F8F8;
|
||||||
|
}
|
||||||
|
.ui-detail-intro{
|
||||||
|
margin-top: 20rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-group-quit{
|
||||||
|
margin-top: 12rpx;
|
||||||
|
padding: 30rpx 0;
|
||||||
|
color: #FF3051;
|
||||||
|
background: #ffffff;
|
||||||
|
text-align: center;
|
||||||
|
button::after{
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.ui-group-join{
|
||||||
|
margin-top: 12rpx;
|
||||||
|
padding: 30rpx 0;
|
||||||
|
color: #2d8cf0;
|
||||||
|
background: #ffffff;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-server{
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background: #ffffff;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
.service {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 12vh;
|
||||||
|
right: 5vw;
|
||||||
|
image {
|
||||||
|
width: 130rpx;
|
||||||
|
height: 130rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
<template>
|
||||||
|
<view class="ui-groupChitchatDetail">
|
||||||
|
<view class="ui-member-data-box">
|
||||||
|
<view class="ui-member-list">
|
||||||
|
<view class="ui-member-block" v-for="(item,index) in detail.members" :key="index">
|
||||||
|
<block v-if="hidden">
|
||||||
|
<view class="ui-member-box">
|
||||||
|
<image @tap.stop="jumpPath(item)" class="ui-member-pic" :src="item.avatar === 'https://image.fulllinkai.com/202207/04/1fa9a906b956efa26852fb685a845fff.png?x-oss-process=style/scale1' ? defaultImg : item.avatar" mode="aspectFill"></image>
|
||||||
|
<view class="ui-member-name color-666 font_22 ellipsis_1">{{item.pivot.nick ? item.pivot.nick :item.nickname}}</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<block v-if="detail.members.length > 20 && !hidden">
|
||||||
|
<view class="ui-more-list" @tap="moreMembers">
|
||||||
|
<view class="color-666 font_26">查看更多群成员</view>
|
||||||
|
<image class="ui-more-pic" src="https://image.fulllinkai.com/202307/24/8c1a30360cf0c55605ae784dd47022e0.png" mode="scaleToFill"></image>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
<block v-else-if="detail.members.length > 20 && hidden">
|
||||||
|
<view class="ui-more-list ui-more-list-v1" @tap="moreMembers">
|
||||||
|
<image class="ui-more-pic-v1" src="https://image.fulllinkai.com/202307/28/a9ab5fc1b5c91a01df47de4473bdbeb6.png" mode="scaleToFill"></image>
|
||||||
|
<view class="color-666 font_26">收起</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
<view class="ui-group-detail">
|
||||||
|
<view class="ui-detail-list">
|
||||||
|
<view class="ui-detail-title bold font30 color-333">群聊头像</view>
|
||||||
|
<image class="ui-detail-pic" :src="detail.icon" mode="aspectFill"></image>
|
||||||
|
</view>
|
||||||
|
<view class="ui-detail-line"></view>
|
||||||
|
<view class="ui-detail-list">
|
||||||
|
<view class="ui-detail-title bold font30 color-333">群聊名称</view>
|
||||||
|
<view class="ui-detail-name ellipsis_1 font30 color-666">{{ detail.tname }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="ui-detail-line"></view>
|
||||||
|
<view class="ui-detail-list" v-if="detail.is_join == 1">
|
||||||
|
<view class="ui-detail-title bold font30 color-333">我在本群的昵称</view>
|
||||||
|
<view class="ui-detail-name ellipsis_1 font30 color-666">
|
||||||
|
<input class=" ui-detail-name-text" adjust-position="{{true}}" type="text" confirm-type="done" placeholder="请输入不超过12个字符" @enter="changeGroupName" maxlength="12" cursor-spacing="20" v-model="detail.user_team.nick" @confirm="changeGroupName"/>
|
||||||
|
<image id="img" class="ui-detail-name-icon" src="https://image.fulllinkai.com/202308/11/54e725db8277cce7c2803070aa3eb289.png" mode="aspectFill" lazy-load="true"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="ui-detail-line"></view>
|
||||||
|
<view class="font30 color-333 bold">群聊简介</view>
|
||||||
|
<view class="ui-detail-intro color-666 font_26">{{ detail.intro }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="ui-group-detail" v-if="detail.is_join == 1">
|
||||||
|
<view class="ui-detail-list">
|
||||||
|
<view class="ui-detail-title bold font30 color-333">显示群成员昵称</view>
|
||||||
|
<switch checked="{{detail.user_team.show_other_nick}}" @change="changeShowNick" color="#d92553" style="margin-right: -2rpx;margin-top: -6rpx;"/>
|
||||||
|
</view>
|
||||||
|
<view class="ui-detail-line"></view>
|
||||||
|
<view class="ui-detail-list">
|
||||||
|
<view class="ui-detail-title bold font30 color-333">消息免打扰</view>
|
||||||
|
<switch checked="{{notiTypeData.muteNotiType}}" @change="changeMutenotiType" color="#d92553" style="margin-right: -2rpx;margin-top: -6rpx;"/>
|
||||||
|
</view>
|
||||||
|
<view class="ui-detail-line"></view>
|
||||||
|
<view class="ui-detail-list">
|
||||||
|
<view class="ui-detail-title bold font30 color-333">置顶聊天</view>
|
||||||
|
<switch checked="{{detail.user_team.is_top}}" @change="changeShowTop" color="#d92553" class="flo_r" style="margin-right: -2rpx;margin-top: -6rpx;"/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="ui-group-quit font_30 color-333" @tap.stop="handleContact" >
|
||||||
|
<button class="btn ui-server text-center font_30" hover-class="btn_active" @tap.stop="handleContact">
|
||||||
|
联系客服
|
||||||
|
</button>
|
||||||
|
</view>
|
||||||
|
<view class="ui-group-quit font_30" v-if="detail.is_join == 1" @tap.stop="quitGroup">退出群聊</view>
|
||||||
|
<view class="ui-group-join font_30" v-else-if="detail.is_join == 0" @tap.stop="joinGroup">加入群聊</view>
|
||||||
|
<view class="btn service" v-if="detail.is_join == 1 && isCodeIn" @tap.stop="backChat">
|
||||||
|
<image src="https://image.fulllinkai.com/202309/19/de337109d51243a3b3e8acaa79bbbc27.png" mode="aspectFit"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import wepy from '@wepy/core'
|
||||||
|
import https from '../../mixins/https'
|
||||||
|
import base from '../../mixins/base'
|
||||||
|
import {service} from '../../config'
|
||||||
|
import {getDiffTime} from '../../mixins/plugins'
|
||||||
|
|
||||||
|
wepy.page({
|
||||||
|
config: {},
|
||||||
|
mixins: [https, base],
|
||||||
|
|
||||||
|
data: {
|
||||||
|
id: '',
|
||||||
|
defaultImg: 'https://image.fulllinkai.com/202307/18/449c3253ca2bbed9314d39977a486d0e.png', // 默认头像
|
||||||
|
detail: {},
|
||||||
|
notiTypeList: [],
|
||||||
|
notiTypeData: {muteNotiType: 0},
|
||||||
|
notiTypeIndex: null,
|
||||||
|
hidden: true,
|
||||||
|
throttle: true,
|
||||||
|
isCodeIn: false // 是否扫码进入详情
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getDetail() {
|
||||||
|
let vm = this
|
||||||
|
vm.$showLoading('')
|
||||||
|
vm.$post({url: `${service.host}/chat/group/detail?team_id=${vm.id}`}).then(({code, data}) => {
|
||||||
|
if (code === 0) {
|
||||||
|
vm.detail = data
|
||||||
|
}
|
||||||
|
wx.hideLoading()
|
||||||
|
}).catch(err => {
|
||||||
|
wx.hideLoading()
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 修改群昵称
|
||||||
|
changeGroupName() {
|
||||||
|
let vm = this
|
||||||
|
let data = {
|
||||||
|
team_id: vm.id,
|
||||||
|
nick: vm.detail.user_team.nick
|
||||||
|
}
|
||||||
|
if (!vm.detail.user_team.nick) {
|
||||||
|
vm.$showToast('请输入昵称')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (vm.throttle) {
|
||||||
|
vm.throttle = false
|
||||||
|
vm.$showLoading('更改中')
|
||||||
|
vm.$post({url: `${service.host}/chat/group/update/nick`, data}).then(({code, data}) => {
|
||||||
|
wx.hideLoading()
|
||||||
|
if (code == 0) {
|
||||||
|
vm.$showToast(`群昵称已修改`)
|
||||||
|
}
|
||||||
|
vm.throttle = true
|
||||||
|
}).catch(() => {
|
||||||
|
wx.hideLoading()
|
||||||
|
vm.throttle = true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 是否展示成员昵称
|
||||||
|
changeShowNick(e) {
|
||||||
|
let vm = this
|
||||||
|
let data = {
|
||||||
|
team_id: vm.id,
|
||||||
|
show_other_nick: e.$wx.detail.value ? 1 : 0
|
||||||
|
}
|
||||||
|
if (vm.throttle) {
|
||||||
|
vm.throttle = false
|
||||||
|
vm.$showLoading('')
|
||||||
|
vm.$post({url: `${service.host}/chat/group/update/show_other_nick`, data}).then(({code, data}) => {
|
||||||
|
if (code == 0) {
|
||||||
|
vm.detail.user_team.show_other_nick = e.detail.value ? 1 : 0
|
||||||
|
}
|
||||||
|
wx.hideLoading()
|
||||||
|
vm.throttle = true
|
||||||
|
}).catch(() => {
|
||||||
|
wx.hideLoading()
|
||||||
|
vm.throttle = true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 消息免打扰设置
|
||||||
|
changeMutenotiType(e) {
|
||||||
|
let vm = this
|
||||||
|
vm.$showLoading('')
|
||||||
|
let muteNotiType = null
|
||||||
|
let muteTeam = null
|
||||||
|
if (!e.$wx.detail.value) {
|
||||||
|
muteNotiType = 0
|
||||||
|
muteTeam = false
|
||||||
|
} else {
|
||||||
|
muteNotiType = 1
|
||||||
|
muteTeam = true
|
||||||
|
}
|
||||||
|
vm.$app.$options.globalData.nim.team.updateMyMemberInfo({
|
||||||
|
teamId: vm.id,
|
||||||
|
bitConfigMask: muteNotiType
|
||||||
|
}).then((res) => {
|
||||||
|
if (res) {
|
||||||
|
vm.notiTypeData.muteNotiType = muteNotiType
|
||||||
|
vm.notiTypeData.muteTeam = muteTeam
|
||||||
|
if (vm.notiTypeIndex !== null) {
|
||||||
|
vm.notiTypeList[vm.notiTypeIndex].muteNotiType = muteNotiType
|
||||||
|
vm.notiTypeList[vm.notiTypeIndex].muteTeam = muteTeam
|
||||||
|
} else {
|
||||||
|
vm.notiTypeList.push({
|
||||||
|
teamId: vm.detail.tid,
|
||||||
|
muteNotiType: muteNotiType,
|
||||||
|
muteTeam: muteTeam
|
||||||
|
})
|
||||||
|
vm.notiTypeIndex = vm.notiTypeList.length - 1
|
||||||
|
}
|
||||||
|
if (!e.$wx.detail.value) {
|
||||||
|
vm.notiTypeList.splice(vm.notiTypeIndex, 1)
|
||||||
|
}
|
||||||
|
wx.setStorageSync('muteNotList', vm.notiTypeList)
|
||||||
|
}
|
||||||
|
wx.hideLoading()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 退出群聊
|
||||||
|
quitGroup() {
|
||||||
|
let vm = this
|
||||||
|
wx.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: `是否确认退出该群聊吗?`,
|
||||||
|
success: function (res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
vm.$showLoading('')
|
||||||
|
vm.$post({url: `${service.host}/chat/group/out?team_id=${vm.id}`}).then(({code, data}) => {
|
||||||
|
if (code == 0) {
|
||||||
|
wx.switchTab({url: '/pages/tabBar/news'})
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
})
|
||||||
|
} else if (res.cancel) {
|
||||||
|
console.log('用户点击取消')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 加入群聊
|
||||||
|
joinGroup() {
|
||||||
|
let vm = this
|
||||||
|
wx.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: `是否确认加入该群聊吗?`,
|
||||||
|
success: function (res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
vm.$showLoading('')
|
||||||
|
vm.$post({url: `${service.host}/chat/group/join?team_id=${vm.id}`}).then(({code, data}) => {
|
||||||
|
if (code == 0) {
|
||||||
|
vm.getDetail()
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
})
|
||||||
|
} else if (res.cancel) {
|
||||||
|
console.log('用户点击取消')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 返回群聊天
|
||||||
|
backChat() {
|
||||||
|
let vm = this
|
||||||
|
wx.redirectTo({url: `/pages/news/groupChitchat?id=${vm.id}&name=${encodeURIComponent(vm.detail.tname)}`})
|
||||||
|
},
|
||||||
|
// 展示、收起更多成员
|
||||||
|
moreMembers() {
|
||||||
|
let vm = this
|
||||||
|
vm.hidden = !vm.hidden
|
||||||
|
},
|
||||||
|
jumpPath(e) {
|
||||||
|
wx.navigateTo({url: `/pages/home/information?id=${e.id}`})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad(e) {
|
||||||
|
let vm = this
|
||||||
|
if (e.scene) {
|
||||||
|
let newScene = decodeURIComponent(e.scene)
|
||||||
|
vm.id = newScene.split('=')[1]
|
||||||
|
vm.isCodeIn = true
|
||||||
|
} else {
|
||||||
|
vm.id = e.id
|
||||||
|
vm.isCodeIn = false
|
||||||
|
}
|
||||||
|
if (wx.getStorageSync('muteNotList')) {
|
||||||
|
vm.notiTypeList = wx.getStorageSync('muteNotList')
|
||||||
|
vm.notiTypeList.forEach((item, index) => {
|
||||||
|
if (item.teamId == vm.id) {
|
||||||
|
vm.notiTypeData = item
|
||||||
|
vm.notiTypeData.muteNotiType = vm.notiTypeData.muteNotiType * 1
|
||||||
|
vm.notiTypeIndex = index
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
vm.getDetail()
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<config>
|
||||||
|
{
|
||||||
|
navigationBarTitleText: '群聊详情',
|
||||||
|
enablePullDownRefresh: false,
|
||||||
|
backgroundColorTop: '#f5f5f5',
|
||||||
|
backgroundColorBottom: '#f5f5f5',
|
||||||
|
}
|
||||||
|
</config>
|
||||||
432
src/pages/news/review.wpy
Normal file
@ -0,0 +1,432 @@
|
|||||||
|
<style lang="less" scoped>
|
||||||
|
@import url(../../styles/theme.less);
|
||||||
|
page {
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-container{
|
||||||
|
.ui-no-data-icon{
|
||||||
|
width: 250rpx;
|
||||||
|
height: 250rpx;
|
||||||
|
display: block;
|
||||||
|
vertical-align: top;
|
||||||
|
margin: 36vh auto 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.m_vc_lst {
|
||||||
|
padding: 30rpx 30rpx 60rpx;
|
||||||
|
|
||||||
|
.u_vc_lst {
|
||||||
|
border-radius: 16rpx;
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
|
||||||
|
.u_box {
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: start;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-visitor-detail-btn {
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u_vclst_img {
|
||||||
|
width: 100rpx;
|
||||||
|
height: 100rpx;
|
||||||
|
border-radius: 200rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u_vclst_t_box {
|
||||||
|
margin-left: 16rpx;
|
||||||
|
|
||||||
|
.u_vclst_name {
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #333333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u_vclst_a_box {
|
||||||
|
margin-left: 6rpx;
|
||||||
|
padding: 0 12rpx;
|
||||||
|
height: 36rpx;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.age_g {
|
||||||
|
color: #ED3866;
|
||||||
|
background: #FFF4F7;
|
||||||
|
border: 2rpx solid #FFA9C0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.age_b {
|
||||||
|
color: #2AAFF5;
|
||||||
|
background: #EEF9FF;
|
||||||
|
border: 2rpx solid #80D3FF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.a_sex_img {
|
||||||
|
margin-right: 4rpx;
|
||||||
|
height: 20rpx;
|
||||||
|
width: 20rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.u_vertical {
|
||||||
|
margin-top: 20rpx;
|
||||||
|
margin-left: 116rpx;
|
||||||
|
width: 546rpx;
|
||||||
|
height: 2rpx;
|
||||||
|
background-color: #F5F5F5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u_vclst_img.blur {
|
||||||
|
-webkit-filter: blur(8px);
|
||||||
|
-moz-filter: blur(8px);
|
||||||
|
-ms-filter: blur(8px);
|
||||||
|
filter: blur(8px);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.m_fans_lst {
|
||||||
|
padding: 0 30rpx 60rpx;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-content: stretch;
|
||||||
|
.u_fans_lst:nth-child(3n+2) {
|
||||||
|
margin-left: 22rpx;
|
||||||
|
margin-right: 22rpx;
|
||||||
|
}
|
||||||
|
.u_fans_lst {
|
||||||
|
width: 215rpx;
|
||||||
|
height: 215rpx;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
position: relative;
|
||||||
|
.u_fans_img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background-size: cover;
|
||||||
|
background-position: center;
|
||||||
|
}
|
||||||
|
.u_fans_img.blur {
|
||||||
|
-webkit-filter: blur(8px);
|
||||||
|
-moz-filter: blur(8px);
|
||||||
|
-ms-filter: blur(8px);
|
||||||
|
filter: blur(8px);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.ui-fans-icon{
|
||||||
|
width: 140rpx;
|
||||||
|
height: 34rpx;
|
||||||
|
top: 12rpx;
|
||||||
|
right: 12rpx;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
.u_vclst_ct {
|
||||||
|
position: absolute;
|
||||||
|
padding: 6rpx 0 0 12rpx;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 78rpx;
|
||||||
|
background: linear-gradient(180deg, rgba(0, 0, 0, 0) 10%, rgba(0, 0, 0, 0.4) 100%);
|
||||||
|
z-index: 99;
|
||||||
|
.u_vclst_name {
|
||||||
|
line-height: 28rpx;
|
||||||
|
width: 190rpx;
|
||||||
|
}
|
||||||
|
.u_vclst_add {
|
||||||
|
width: 150rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow:ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
padding-left: 10rpx;
|
||||||
|
.icon-location {
|
||||||
|
padding-right: 2rpx;
|
||||||
|
font-size: 18rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.cu-dialog{
|
||||||
|
width: 600rpx;
|
||||||
|
height: 660rpx;
|
||||||
|
border-radius: 30rpx;
|
||||||
|
position: relative;
|
||||||
|
overflow:initial;
|
||||||
|
.main{
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
flex-flow: column;
|
||||||
|
.header{
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
flex-flow: column;
|
||||||
|
.header-img{
|
||||||
|
width: 180rpx;
|
||||||
|
height: 180rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
vertical-align: middle;
|
||||||
|
filter:blur(4px) contrast(.8);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.ui-city{
|
||||||
|
height: 40rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333333;
|
||||||
|
line-height: 40rpx;
|
||||||
|
margin-top: 16rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.ui-text{
|
||||||
|
height: 44rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #333333;
|
||||||
|
line-height: 44rpx;
|
||||||
|
text-align: center;
|
||||||
|
margin-top: 84rpx;
|
||||||
|
}
|
||||||
|
.ui-img{
|
||||||
|
width: 418rpx;
|
||||||
|
height: 120rpx;
|
||||||
|
margin-top: 74rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.actions {
|
||||||
|
position: absolute;
|
||||||
|
bottom: -100rpx;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
margin: auto;
|
||||||
|
width: 48rpx;
|
||||||
|
height: 48rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.m_unl_bu {
|
||||||
|
width: 100%;
|
||||||
|
position: fixed;
|
||||||
|
bottom: 60rpx;
|
||||||
|
left: 0;
|
||||||
|
z-index: 0;
|
||||||
|
.u_unl_img {
|
||||||
|
width: 616rpx;
|
||||||
|
height: 120rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
<template>
|
||||||
|
<view class="ui-visitor">
|
||||||
|
<view class="ui-placeholder"></view>
|
||||||
|
<view class="ui-container">
|
||||||
|
<image v-if="list.length == 0 && loading" class="ui-no-data-icon" src="https://images.ufutx.com/202104/13/1737964f7c98cbf65d728137dc2792eb.png" mode="aspectFill"></image>
|
||||||
|
<block v-else>
|
||||||
|
<view class="m_vc_lst">
|
||||||
|
<block v-for="(item,index) in list" :key="index">
|
||||||
|
<view v-if="item.other_user" class="u_vc_lst" :style="{'filter:blur(4px) contrast(.8)' : index >= 3 && userInfo.rank_id == 0}" @longpress="deleteRecord(item, index)" @tap="jumpPath(item, index)">
|
||||||
|
<view class="f-fc u_box">
|
||||||
|
<view class="f-fc">
|
||||||
|
<image class="u_vclst_img" :src="item.other_user.avatar || item.other_user.photo" mode="aspectFill" @tap.stop="gotofriends(item, index)"></image>
|
||||||
|
<view class="u_vclst_t_box">
|
||||||
|
<view class="f-fc">
|
||||||
|
<view class="u_vclst_name">{{item.other_user.nickname}}</view>
|
||||||
|
<view class="u_vclst_a_box f-fc age_g font_22" v-if="item.other_user.sex === 2">
|
||||||
|
<image class="a_sex_img" src="https://image.fulllinkai.com/202208/09/dfed05b3e1e1880a3a6f81806d99e9de.png" mode="widthFix"></image>
|
||||||
|
<view>{{item.other_user.year}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="u_vclst_a_box f-fc age_b font_22" v-if="item.other_user.sex === 1">
|
||||||
|
<image class="a_sex_img" src="https://image.fulllinkai.com/202208/09/77cd63f40e622e54a859e751269eb920.png" mode="widthFix"></image>
|
||||||
|
<view>{{item.other_user.age}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="f-fc">
|
||||||
|
<view class="u_state">{{item.other_user.stature || ''}} {{item.other_user.city || ''}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="color999">{{item.created_at}}</view>
|
||||||
|
<view class="ui-visitor-detail-btn font_26 color999" v-if="userInfo.rank_id == 9 && type != 'review' && type !='fans'">来访{{item.count}}次</view>
|
||||||
|
</view>
|
||||||
|
<view class="u_vertical"></view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="m_unl_bu f-fcc" v-if="list.length > 3 && userInfo.rank_id == 0">
|
||||||
|
<image class="u_unl_img" @tap="handleVip" :src="buImg" mode="aspectFit" lazy-load="false"></image>
|
||||||
|
</view>
|
||||||
|
<view class="cu-modal" :class="{'show' : tipsShow}">
|
||||||
|
<view class="cu-dialog">
|
||||||
|
<view class="padding-xl text-left main">
|
||||||
|
<view class="header">
|
||||||
|
<image class="header-img" :src="pic" mode="aspectFill"></image>
|
||||||
|
<view class="ui-city">{{age}} · {{city}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="ui-text">成为会员可以解锁所有访客</view>
|
||||||
|
<image class="ui-img" :src="dialogIng" mode="widthFix" @tap="handleVip"></image>
|
||||||
|
</view>
|
||||||
|
<image class="actions" src="https://images.ufutx.com/202103/15/1033c7b52cacddcebe999cefc6ad2c9b.png" mode="widthFix" @tap="tipsShow = false"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<pageScroll ref="pageScroll"></pageScroll>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import wepy from '@wepy/core'
|
||||||
|
import https from '../../mixins/https'
|
||||||
|
import base from '../../mixins/base'
|
||||||
|
import utils from '../../utils/util'
|
||||||
|
import {service} from '../../config'
|
||||||
|
|
||||||
|
wepy.page({
|
||||||
|
config: {},
|
||||||
|
mixins: [https, base],
|
||||||
|
|
||||||
|
data: {
|
||||||
|
userInfo: {},
|
||||||
|
buImg: '',
|
||||||
|
dialogIng: '',
|
||||||
|
type: '',
|
||||||
|
pic: '',
|
||||||
|
city: '',
|
||||||
|
age: '',
|
||||||
|
tipsShow: false,
|
||||||
|
|
||||||
|
no_more: false,
|
||||||
|
loading: false,
|
||||||
|
page: 1,
|
||||||
|
list: []
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getList() {
|
||||||
|
let vm = this
|
||||||
|
let url = ``
|
||||||
|
if (vm.type == 'fans') {
|
||||||
|
url = `${service.host}/followers`
|
||||||
|
} else if (vm.type == 'friend') {
|
||||||
|
url = `${service.host}/friends/v2`
|
||||||
|
} else if (vm.type == 'review') {
|
||||||
|
url = `${service.host}/my/preview/histroies`
|
||||||
|
} else if (vm.type == 'visitor') {
|
||||||
|
url = `${service.host}/user/preview/histroies`
|
||||||
|
} else {
|
||||||
|
url = `${service.host}/followers`
|
||||||
|
}
|
||||||
|
let data = {
|
||||||
|
page: vm.page,
|
||||||
|
type: 'single',
|
||||||
|
size: 15
|
||||||
|
}
|
||||||
|
vm.$showLoading('加载中...')
|
||||||
|
vm.$get({url: url, data}).then(({code, data}) => {
|
||||||
|
if (code === 0) {
|
||||||
|
data.data.forEach((item) => {
|
||||||
|
item.created_at = item.updated_at ? utils.commentTimeHandle(item.updated_at) : utils.commentTimeHandle(item.created_at)
|
||||||
|
})
|
||||||
|
if (vm.list.length === 0 || vm.page === 1) {
|
||||||
|
vm.list = data.data
|
||||||
|
} else {
|
||||||
|
data.data.map(function (item) {
|
||||||
|
vm.list.push(item)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (vm.list.length < 15 || data.data.length < 15) {
|
||||||
|
vm.no_more = true
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
vm.loading = true
|
||||||
|
}, 500)
|
||||||
|
vm.page++
|
||||||
|
}
|
||||||
|
wx.hideLoading()
|
||||||
|
}).catch(err => {
|
||||||
|
wx.hideLoading()
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 跳转购买vip
|
||||||
|
handleVip() {
|
||||||
|
let vm = this
|
||||||
|
vm.tipsShow = false
|
||||||
|
wx.navigateTo({url: '/pages/users/upgradeVIP'})
|
||||||
|
},
|
||||||
|
// 跳转用户详情,没有vip时点击第四个用户弹框提示
|
||||||
|
jumpPath(e, index) {
|
||||||
|
let vm = this
|
||||||
|
if (index >= 3 && vm.userInfo.rank_id == 0) {
|
||||||
|
vm.pic = e.other_user.photo || e.other_user.avatar
|
||||||
|
vm.city = e.other_user.city
|
||||||
|
vm.age = e.other_user.year
|
||||||
|
vm.tipsShow = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
wx.navigateTo({url: `/pages/home/information?id=${e.id}`})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 上拉获取更多数据
|
||||||
|
onReachBottom() {
|
||||||
|
let vm = this
|
||||||
|
if (!vm.no_more) {
|
||||||
|
vm.getList()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 下拉刷新
|
||||||
|
onPullDownRefresh() {
|
||||||
|
let vm = this
|
||||||
|
vm.page = 1
|
||||||
|
vm.no_more = false
|
||||||
|
vm.getList()
|
||||||
|
},
|
||||||
|
onPageScroll(res) {
|
||||||
|
let vm = this
|
||||||
|
let top = res.scrollTop
|
||||||
|
vm.$refs.pageScroll.showBackTopBtn = top > 380
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
},
|
||||||
|
onLoad(e) {
|
||||||
|
let vm = this
|
||||||
|
vm.type = e.type
|
||||||
|
if (vm.type == 'fans') { // 我的粉丝
|
||||||
|
vm.buImg = 'https://images.ufutx.com/202106/21/b056766538c70151dc2d37b118ea6ce4.png'
|
||||||
|
vm.dialogIng = 'https://images.ufutx.com/202106/21/f678acbbde4c175bef005b960de0f6c3.png'
|
||||||
|
} else if (vm.type == 'review') { // 回看
|
||||||
|
vm.buImg = 'https://images.ufutx.com/202106/21/42c2796abf4217cd79871c29ec794ca4.png'
|
||||||
|
vm.dialogIng = 'https://images.ufutx.com/202106/21/0e7d701cd1280a9b2ecffd1287c9abd1.png'
|
||||||
|
} else if (vm.type == 'visitor') { // 访客
|
||||||
|
vm.buImg = 'https://images.ufutx.com/202106/21/efbb981085024321ef3ff0a1c7999ab4.png'
|
||||||
|
vm.dialogIng = 'https://images.ufutx.com/202103/19/d50225289964b293f34ded71a30ae691.png'
|
||||||
|
}
|
||||||
|
wx.setNavigationBarTitle({
|
||||||
|
title: e.title,
|
||||||
|
success: function () {}
|
||||||
|
})
|
||||||
|
vm.getList()
|
||||||
|
vm.userInfo = wx.getStorageSync('userInfo')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<config>
|
||||||
|
{
|
||||||
|
navigationBarTitleText: '',
|
||||||
|
enablePullDownRefresh: true,
|
||||||
|
backgroundColorTop: '#ffffff',
|
||||||
|
backgroundColorBottom: '#ffffff',
|
||||||
|
usingComponents: {
|
||||||
|
pageScroll: '~@/components/pageScroll'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</config>
|
||||||
330
src/pages/news/systemNews.wpy
Normal file
@ -0,0 +1,330 @@
|
|||||||
|
<style lang="less" scoped>
|
||||||
|
@import url(../../styles/theme.less);
|
||||||
|
page {
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-container{
|
||||||
|
.ui-no-data-icon{
|
||||||
|
width: 250rpx;
|
||||||
|
height: 250rpx;
|
||||||
|
display: block;
|
||||||
|
vertical-align: top;
|
||||||
|
margin: 36vh auto 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-list-items {
|
||||||
|
margin: 30rpx;
|
||||||
|
|
||||||
|
.ui-item-data {
|
||||||
|
width: 100%;
|
||||||
|
display: inline-flex;
|
||||||
|
|
||||||
|
.ui-dist{
|
||||||
|
width: 20rpx;
|
||||||
|
height: 20rpx;
|
||||||
|
background: #F33B6C;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-dot{
|
||||||
|
position: absolute;
|
||||||
|
background: #F1013D;
|
||||||
|
border: 2rpx solid #FFFFFF;
|
||||||
|
z-index: 99;
|
||||||
|
right: 22rpx;
|
||||||
|
top: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title{
|
||||||
|
width: 100%;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.name{
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #000000;
|
||||||
|
letter-spacing: 2rpx;
|
||||||
|
line-height: 42rpx;
|
||||||
|
word-break:break-all; // 纯数字、单词换行
|
||||||
|
}
|
||||||
|
.ui-moment-btn-box{
|
||||||
|
width: 100%;
|
||||||
|
padding: 20rpx 26rpx 0 26rpx;
|
||||||
|
}
|
||||||
|
.ui-unoperated-btn, .ui-unoperated-btnV2{
|
||||||
|
width: 200rpx;
|
||||||
|
height: 52rpx;
|
||||||
|
border-radius: 26rpx;
|
||||||
|
border: 2rpx solid #FF5380;
|
||||||
|
}
|
||||||
|
.ui-unoperated-btnV2{
|
||||||
|
border: 2rpx solid #D8D8D8;
|
||||||
|
}
|
||||||
|
.ui-operated-btn{
|
||||||
|
width: 100%;
|
||||||
|
height: 52rpx;
|
||||||
|
border-radius: 26rpx;
|
||||||
|
border: 2rpx solid #D8D8D8;
|
||||||
|
}
|
||||||
|
.marketing{
|
||||||
|
margin-top: 4rpx;
|
||||||
|
float: left;
|
||||||
|
margin-right: 10rpx;
|
||||||
|
width: 68rpx;
|
||||||
|
height: 32rpx;
|
||||||
|
}
|
||||||
|
.sys-pic{
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.sys-pic-pic{
|
||||||
|
margin-top: 12rpx;
|
||||||
|
margin-bottom: 8rpx;
|
||||||
|
height: 120rpx;
|
||||||
|
width: 120rpx;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
}
|
||||||
|
.rit{
|
||||||
|
width: 540rpx;
|
||||||
|
padding: 20rpx;
|
||||||
|
display: inline-flex;
|
||||||
|
flex-flow: column;
|
||||||
|
align-items: center;
|
||||||
|
background: #ffffff;
|
||||||
|
border-radius: 0 32rpx 32rpx 32rpx;
|
||||||
|
.friend-text{
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 8rpx;
|
||||||
|
min-height: 36rpx;
|
||||||
|
font-size: 26rpx;
|
||||||
|
font-weight: 400;
|
||||||
|
color: #666666;
|
||||||
|
line-height: 36rpx;
|
||||||
|
margin-left: 8rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.bc_acatar {
|
||||||
|
width: 96rpx;
|
||||||
|
height: 96rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin-right: 12rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
<template>
|
||||||
|
<view class="ui-systemNews">
|
||||||
|
<view class="ui-container">
|
||||||
|
<image v-if="list.length == 0 && loading" class="ui-no-data-icon" src="https://images.ufutx.com/202104/13/1737964f7c98cbf65d728137dc2792eb.png" mode="aspectFill"></image>
|
||||||
|
<block v-else>
|
||||||
|
<view class="ui-list-items" v-for="(item,index) in list" :key="index">
|
||||||
|
<view class="font_24 color999 text-center ui-pb-24 ui-pt-4">{{item.created_at}}</view>
|
||||||
|
<view class="ui-item-data">
|
||||||
|
<view class="ui-relative">
|
||||||
|
<view class="ui-dist ui-dot" v-if="item.status == 0"></view>
|
||||||
|
<image src="https://images.ufutx.com/202103/18/4e10f400b6b2992e07e95f470dfa7feb.png" mode="aspectFill" class="bc_acatar"></image>
|
||||||
|
</view>
|
||||||
|
<view class="rit ui-relative" @tap="jumpPath(item)">
|
||||||
|
<view class="title">
|
||||||
|
<view v-if="item.type =='remind_profile'" class="name">交友卡片-补充信息提醒通知</view>
|
||||||
|
<view v-else class="name">
|
||||||
|
<image class="marketing" v-if="item.type == 'marketing'" src="https://image.fulllinkai.com/202209/20/d618e8ad5dc8ea7ff0a211751242164d.png" mode="aspectFill"></image>
|
||||||
|
<block v-if="item.type != 'change_moment_topic'">{{item.content}}</block>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<block v-if="item.pic">
|
||||||
|
<view class="sys-pic" >
|
||||||
|
<image class="sys-pic-pic" @tap.stop="previewImage(item.pic)" :src="item.pic" mode="aspectFill"></image>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
<block v-if="item.type == 'system'">
|
||||||
|
<view v-if="item.has_unionid && item.path_url" class="font_24 color-666 friend-text" @tap.stop="jumpH5(item)">点击查看>></view>
|
||||||
|
</block>
|
||||||
|
<block v-else-if="item.type == 'change_moment_topic'">
|
||||||
|
<view class="font_30 name">{{item.message}}</view>
|
||||||
|
<view class="f-fbc ui-moment-btn-box">
|
||||||
|
<block v-if="item.operate_status == '0'">
|
||||||
|
<view class="ui-unoperated-btn color-theme f-fcc font_28" @tap.stop="dynamicChange(item.id, '1', index)">同意</view>
|
||||||
|
<view class="ui-unoperated-btnV2 color-666 f-fcc font_28" @tap.stop="dynamicChange(item.id, '-1', index)">拒绝</view>
|
||||||
|
</block>
|
||||||
|
<block v-else>
|
||||||
|
<view v-if="item.operate_status == '-1'" class="ui-operated-btn f-fcc font_28 color-666">已拒绝</view>
|
||||||
|
<view v-if="item.operate_status == '1'" class="ui-operated-btn f-fcc font_28 color-666">已同意</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
<block v-else>
|
||||||
|
<block v-if="item.type != 'friend' && item.type != 'marketing'">
|
||||||
|
<view v-if="item.type == 'remind_profile'" class="font_24 color-666 friend-text">{{item.content}}>>点击查看</view>
|
||||||
|
<view v-else class="font_24 color-666 friend-text">点击查看>></view>
|
||||||
|
</block>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<pageScroll ref="pageScroll"></pageScroll>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import wepy from '@wepy/core'
|
||||||
|
import https from '../../mixins/https'
|
||||||
|
import base from '../../mixins/base'
|
||||||
|
import {service} from '../../config'
|
||||||
|
import {getDiffTime} from '../../mixins/plugins'
|
||||||
|
|
||||||
|
wepy.page({
|
||||||
|
config: {},
|
||||||
|
mixins: [https, base],
|
||||||
|
|
||||||
|
data: {
|
||||||
|
no_more: false,
|
||||||
|
loading: false,
|
||||||
|
page: 1,
|
||||||
|
list: []
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getList() {
|
||||||
|
let vm = this
|
||||||
|
let data = {
|
||||||
|
page: vm.page
|
||||||
|
}
|
||||||
|
vm.$showLoading('加载中...')
|
||||||
|
vm.$get({url: `${service.host}/notices`, data}).then(({code, data}) => {
|
||||||
|
if (code === 0) {
|
||||||
|
data.data.forEach((item) => {
|
||||||
|
let endTime = item.created_at.replace(/-/g, '/')
|
||||||
|
let recordTime = parseFloat(new Date(endTime).getTime()) / 1000
|
||||||
|
item.created_at = getDiffTime(recordTime, false)
|
||||||
|
})
|
||||||
|
if (vm.list.length === 0 || vm.page === 1) {
|
||||||
|
vm.list = data.data
|
||||||
|
} else {
|
||||||
|
data.data.map(function (item) {
|
||||||
|
vm.list.push(item)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (vm.list.length < 15 || data.data.length < 15) {
|
||||||
|
vm.no_more = true
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
vm.loading = true
|
||||||
|
}, 500)
|
||||||
|
vm.page++
|
||||||
|
}
|
||||||
|
wx.hideLoading()
|
||||||
|
}).catch(err => {
|
||||||
|
wx.hideLoading()
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
dynamicChange(id, state, index) {
|
||||||
|
let vm = this
|
||||||
|
let data = {
|
||||||
|
operate_status: state
|
||||||
|
}
|
||||||
|
let text = state === '1' ? '同意' : '拒绝'
|
||||||
|
wx.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: `是否确认${text}本次系统修改?`,
|
||||||
|
success: function (res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
vm.$post({url: `${service.host}/operate/notices/${id}`, data}).then(({code, data}) => {
|
||||||
|
if (code == 0) {
|
||||||
|
vm.list[index].operate_status = state
|
||||||
|
vm.$showToast(`已${text}修改`)
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
})
|
||||||
|
} else if (res.cancel) {
|
||||||
|
console.log('用户点击取消')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
jumpH5({path_url, path_type}) {
|
||||||
|
let vm = this
|
||||||
|
wx.login({
|
||||||
|
success: () => {
|
||||||
|
let data = {code: code}
|
||||||
|
vm.$post({url: `${service.host}/chat/message/send`, data}).then(({code, data}) => {
|
||||||
|
if (code == 0) {
|
||||||
|
if (path_type == 2) {
|
||||||
|
wx.navigateTo({url: `/pages/books/bookDetail?url=${encodeURIComponent(path_url)}`})
|
||||||
|
} else {
|
||||||
|
wx.navigateTo({url: path_url})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
})
|
||||||
|
},
|
||||||
|
fail: () => {
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
jumpPath(e) {
|
||||||
|
let url = ``
|
||||||
|
if (e.type == 'system' || e.type == 'gift' || e.type == 'marketing') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (e.type == 'follow' || e.type == 'friend' || e.type == 'remind_profile') {
|
||||||
|
url = `/pages/home/information?id=${e.other_user.id}`
|
||||||
|
} else if (e.type == 'temp') {
|
||||||
|
url = `/pages/users/tempMember`
|
||||||
|
} else if (e.type == 'moment' || e.type == 'change_moment_topic') {
|
||||||
|
url = `/pages/dynamic/feedDetail?id=${e.type_id}`
|
||||||
|
}
|
||||||
|
wx.navigateTo({url: url})
|
||||||
|
},
|
||||||
|
// 预览单图
|
||||||
|
previewImage(image) {
|
||||||
|
let vm = this
|
||||||
|
vm.$previewImage(image)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 上拉获取更多数据
|
||||||
|
onReachBottom() {
|
||||||
|
let vm = this
|
||||||
|
if (!vm.no_more) {
|
||||||
|
vm.getList()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 下拉刷新
|
||||||
|
onPullDownRefresh() {
|
||||||
|
let vm = this
|
||||||
|
vm.page = 1
|
||||||
|
vm.no_more = false
|
||||||
|
vm.getList()
|
||||||
|
},
|
||||||
|
onPageScroll(res) {
|
||||||
|
let vm = this
|
||||||
|
let top = res.scrollTop
|
||||||
|
vm.$refs.pageScroll.showBackTopBtn = top > 380
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<config>
|
||||||
|
{
|
||||||
|
navigationBarTitleText: '系统通知',
|
||||||
|
enablePullDownRefresh: true,
|
||||||
|
backgroundColorTop: '#f5f5f5',
|
||||||
|
backgroundColorBottom: '#f5f5f5',
|
||||||
|
usingComponents: {
|
||||||
|
pageScroll: '~@/components/pageScroll'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</config>
|
||||||
579
src/pages/news/visitor.wpy
Normal file
@ -0,0 +1,579 @@
|
|||||||
|
<style lang="less" scoped>
|
||||||
|
@import url(../../styles/theme.less);
|
||||||
|
page {
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-tabBar-box{
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 99;
|
||||||
|
background: #ffffff;
|
||||||
|
|
||||||
|
.ui-tabBar-box{
|
||||||
|
width: 100%;
|
||||||
|
padding: 28rpx 200rpx 40rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
.ui-nav {
|
||||||
|
height: 42rpx;
|
||||||
|
font-size: 30rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #999999;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.ui-active {
|
||||||
|
font-size: 30rpx;
|
||||||
|
line-height: 42rpx;
|
||||||
|
color: #333333;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.ui-active::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
left: 50%;
|
||||||
|
bottom: -14rpx;
|
||||||
|
width: 40rpx;
|
||||||
|
height: 8rpx;
|
||||||
|
background: #FF5380;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-placeholder{
|
||||||
|
width: 100vw;
|
||||||
|
height: 110rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-container{
|
||||||
|
.ui-no-data-icon{
|
||||||
|
width: 250rpx;
|
||||||
|
height: 250rpx;
|
||||||
|
display: block;
|
||||||
|
vertical-align: top;
|
||||||
|
margin: 36vh auto 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.m_vc_lst {
|
||||||
|
padding: 0 30rpx 60rpx;
|
||||||
|
|
||||||
|
.u_vc_lst {
|
||||||
|
border-radius: 16rpx;
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
|
||||||
|
.u_box {
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: start;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-visitor-detail-btn {
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u_vclst_img {
|
||||||
|
width: 100rpx;
|
||||||
|
height: 100rpx;
|
||||||
|
border-radius: 200rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u_vclst_t_box {
|
||||||
|
margin-left: 16rpx;
|
||||||
|
|
||||||
|
.u_vclst_name {
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #333333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u_vclst_a_box {
|
||||||
|
margin-left: 6rpx;
|
||||||
|
padding: 0 12rpx;
|
||||||
|
height: 36rpx;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.age_g {
|
||||||
|
color: #ED3866;
|
||||||
|
background: #FFF4F7;
|
||||||
|
border: 2rpx solid #FFA9C0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.age_b {
|
||||||
|
color: #2AAFF5;
|
||||||
|
background: #EEF9FF;
|
||||||
|
border: 2rpx solid #80D3FF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.a_sex_img {
|
||||||
|
margin-right: 4rpx;
|
||||||
|
height: 20rpx;
|
||||||
|
width: 20rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.u_vertical {
|
||||||
|
margin-top: 20rpx;
|
||||||
|
margin-left: 116rpx;
|
||||||
|
width: 546rpx;
|
||||||
|
height: 2rpx;
|
||||||
|
background-color: #F5F5F5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.u_vclst_img.blur {
|
||||||
|
-webkit-filter: blur(8px);
|
||||||
|
-moz-filter: blur(8px);
|
||||||
|
-ms-filter: blur(8px);
|
||||||
|
filter: blur(8px);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.m_fans_lst {
|
||||||
|
padding: 0 30rpx 60rpx;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-content: stretch;
|
||||||
|
.u_fans_lst:nth-child(3n+2) {
|
||||||
|
margin-left: 22rpx;
|
||||||
|
margin-right: 22rpx;
|
||||||
|
}
|
||||||
|
.u_fans_lst {
|
||||||
|
width: 215rpx;
|
||||||
|
height: 215rpx;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
position: relative;
|
||||||
|
.u_fans_img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background-size: cover;
|
||||||
|
background-position: center;
|
||||||
|
}
|
||||||
|
.u_fans_img.blur {
|
||||||
|
-webkit-filter: blur(8px);
|
||||||
|
-moz-filter: blur(8px);
|
||||||
|
-ms-filter: blur(8px);
|
||||||
|
filter: blur(8px);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.ui-fans-icon{
|
||||||
|
width: 140rpx;
|
||||||
|
height: 34rpx;
|
||||||
|
top: 12rpx;
|
||||||
|
right: 12rpx;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
.u_vclst_ct {
|
||||||
|
position: absolute;
|
||||||
|
padding: 6rpx 0 0 12rpx;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 78rpx;
|
||||||
|
background: linear-gradient(180deg, rgba(0, 0, 0, 0) 10%, rgba(0, 0, 0, 0.4) 100%);
|
||||||
|
z-index: 99;
|
||||||
|
.u_vclst_name {
|
||||||
|
line-height: 28rpx;
|
||||||
|
width: 190rpx;
|
||||||
|
}
|
||||||
|
.u_vclst_add {
|
||||||
|
width: 150rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow:ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
padding-left: 10rpx;
|
||||||
|
.icon-location {
|
||||||
|
padding-right: 2rpx;
|
||||||
|
font-size: 18rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.cu-dialog{
|
||||||
|
width: 600rpx;
|
||||||
|
height: 660rpx;
|
||||||
|
border-radius: 30rpx;
|
||||||
|
position: relative;
|
||||||
|
overflow:initial;
|
||||||
|
.main{
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
flex-flow: column;
|
||||||
|
.header{
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
flex-flow: column;
|
||||||
|
.header-img{
|
||||||
|
width: 180rpx;
|
||||||
|
height: 180rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
vertical-align: middle;
|
||||||
|
filter:blur(4px) contrast(.8);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.ui-city{
|
||||||
|
height: 40rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #333333;
|
||||||
|
line-height: 40rpx;
|
||||||
|
margin-top: 16rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.ui-text{
|
||||||
|
height: 44rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #333333;
|
||||||
|
line-height: 44rpx;
|
||||||
|
text-align: center;
|
||||||
|
margin-top: 84rpx;
|
||||||
|
}
|
||||||
|
.ui-img{
|
||||||
|
width: 418rpx;
|
||||||
|
height: 120rpx;
|
||||||
|
margin-top: 74rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.actions {
|
||||||
|
position: absolute;
|
||||||
|
bottom: -100rpx;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
margin: auto;
|
||||||
|
width: 48rpx;
|
||||||
|
height: 48rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.m_unl_bu {
|
||||||
|
width: 100%;
|
||||||
|
position: fixed;
|
||||||
|
bottom: 60rpx;
|
||||||
|
left: 0;
|
||||||
|
z-index: 0;
|
||||||
|
.u_unl_img {
|
||||||
|
width: 616rpx;
|
||||||
|
height: 120rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
<template>
|
||||||
|
<view class="ui-visitor">
|
||||||
|
<view class="ui-tabBar-box">
|
||||||
|
<view class="ui-tabBar-box f-fbc">
|
||||||
|
<view v-for="(item,index) in tabBarList" :key="index" data-index="{{index}}" class="ui-nav {{tabBarIndex == index ? 'ui-active' : ''}}" @tap="changeTab(index)">{{item}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="ui-placeholder"></view>
|
||||||
|
<view class="ui-container">
|
||||||
|
<block v-if="tabBarIndex == 0">
|
||||||
|
<image v-if="list.length == 0 && loading" class="ui-no-data-icon" src="https://images.ufutx.com/202104/13/1737964f7c98cbf65d728137dc2792eb.png" mode="aspectFill"></image>
|
||||||
|
<block v-else>
|
||||||
|
<view class="m_vc_lst">
|
||||||
|
<block v-for="(item,index) in list" :key="index">
|
||||||
|
<view v-if="item.other_user" class="u_vc_lst" :style="{'filter:blur(4px) contrast(.8)' : index >= 3 && userInfo.rank_id == 0}" @longpress="deleteRecord(item, index)" @tap="jumpPath(item, index)">
|
||||||
|
<view class="f-fc u_box">
|
||||||
|
<view class="f-fc">
|
||||||
|
<image class="u_vclst_img" :src="item.other_user.avatar || item.other_user.photo" mode="aspectFill" @tap.stop="gotofriends(item, index)"></image>
|
||||||
|
<view class="u_vclst_t_box">
|
||||||
|
<view class="f-fc">
|
||||||
|
<view class="u_vclst_name">{{item.other_user.nickname}}</view>
|
||||||
|
<view class="u_vclst_a_box f-fc age_g font_22" v-if="item.other_user.sex === 2">
|
||||||
|
<image class="a_sex_img" src="https://image.fulllinkai.com/202208/09/dfed05b3e1e1880a3a6f81806d99e9de.png" mode="widthFix"></image>
|
||||||
|
<view>{{item.other_user.year}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="u_vclst_a_box f-fc age_b font_22" v-if="item.other_user.sex === 1">
|
||||||
|
<image class="a_sex_img" src="https://image.fulllinkai.com/202208/09/77cd63f40e622e54a859e751269eb920.png" mode="widthFix"></image>
|
||||||
|
<view>{{item.other_user.age}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="f-fc">
|
||||||
|
<view class="u_state">{{item.other_user.stature || ''}} {{item.other_user.city || ''}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="color-999">{{item.created_at}}</view>
|
||||||
|
<view class="ui-visitor-detail-btn font_26 color999" v-if="userInfo.rank_id == 9">来访{{item.count}}次</view>
|
||||||
|
</view>
|
||||||
|
<view class="u_vertical"></view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</block>
|
||||||
|
<block v-else>
|
||||||
|
<image v-if="fansList.length == 0 && fans_loading" class="ui-no-data-icon" src="https://images.ufutx.com/202104/13/1737964f7c98cbf65d728137dc2792eb.png" mode="aspectFill"></image>
|
||||||
|
<block v-else>
|
||||||
|
<view class="m_fans_lst f-fc">
|
||||||
|
<view class="u_fans_lst" v-for="(item,index) in fansList" :key="index" @tap="jumpPath(item, index)">
|
||||||
|
<image class="u_fans_img {{index >= 3 && user.rank_id == 0 ? 'blur' : ''}}" :src="item.avatar" mode="aspectFill"></image>
|
||||||
|
<image class="ui-fans-icon" v-if="item.hidden_profile != 'NONE'" src="https://image.fulllinkai.com/202203/22/7a244fa7e39105c3f9cb9d951dcd5664.png" mode="aspectFit"></image>
|
||||||
|
<view class="u_vclst_ct">
|
||||||
|
<view class="u_vclst_name white bold font_24 ellipsis_1">{{item.nickname}}</view>
|
||||||
|
<view class="white f-fc">
|
||||||
|
<view class="font_20" style="min-width: 62rpx" v-if="item.year == '未填写'">{{item.year || ''}}</view>
|
||||||
|
<view class="font_20" v-else>{{item.year || ''}}</view>
|
||||||
|
<view class="u_vclst_add f-fc">
|
||||||
|
<view class="font_family icon-location"></view>
|
||||||
|
<view class=" font_20">{{item.city || ''}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="m_unl_bu f-fcc" v-if="tabBarIndex == 0 && list.length > 3 && userInfo.rank_id == 0}}">
|
||||||
|
<image class="u_unl_img" @tap="handleVip" src="https://images.ufutx.com/202106/21/efbb981085024321ef3ff0a1c7999ab4.png" mode="aspectFit" lazy-load="false"></image>
|
||||||
|
</view>
|
||||||
|
<view class="m_unl_bu f-fcc" v-if="tabBarIndex == 1 && fansList.length > 3 && userInfo.rank_id == 0">
|
||||||
|
<image class="u_unl_img" @tap="handleVip" src="https://images.ufutx.com/202106/21/b056766538c70151dc2d37b118ea6ce4.png" mode="aspectFit" lazy-load="false"></image>
|
||||||
|
</view>
|
||||||
|
<view class="cu-modal" :class="{'show' : tipsShow}">
|
||||||
|
<view class="cu-dialog">
|
||||||
|
<view class="padding-xl text-left main">
|
||||||
|
<view class="header">
|
||||||
|
<image class="header-img" :src="pic" mode="aspectFill"></image>
|
||||||
|
<view class="ui-city">{{age}} · {{city}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="ui-text">成为会员可以解锁{{tabBarIndex == 1 ? '所有粉丝' : '所有访客'}}</view>
|
||||||
|
<image v-if="tabBarIndex == 1" class="ui-img" src="https://images.ufutx.com/202103/19/d50225289964b293f34ded71a30ae691.png" mode="widthFix" @tap="handleVip"></image>
|
||||||
|
<image v-else class="ui-img" src="https://images.ufutx.com/202103/19/d50225289964b293f34ded71a30ae691.png" mode="widthFix" @tap="handleVip"></image>
|
||||||
|
</view>
|
||||||
|
<image class="actions" src="https://images.ufutx.com/202103/15/1033c7b52cacddcebe999cefc6ad2c9b.png" mode="widthFix" @tap="tipsShow = false"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import wepy from '@wepy/core'
|
||||||
|
import https from '../../mixins/https'
|
||||||
|
import base from '../../mixins/base'
|
||||||
|
import utils from '../../utils/util'
|
||||||
|
import {service} from '../../config'
|
||||||
|
|
||||||
|
wepy.page({
|
||||||
|
config: {},
|
||||||
|
mixins: [https, base],
|
||||||
|
|
||||||
|
data: {
|
||||||
|
tabBarIndex: 0,
|
||||||
|
tabBarList: ['访客', '粉丝'],
|
||||||
|
userInfo: {},
|
||||||
|
|
||||||
|
pic: '',
|
||||||
|
city: '',
|
||||||
|
age: '',
|
||||||
|
tipsShow: false,
|
||||||
|
|
||||||
|
no_more: false,
|
||||||
|
loading: false,
|
||||||
|
page: 1,
|
||||||
|
list: [],
|
||||||
|
scroll: 0,
|
||||||
|
|
||||||
|
fans_no_more: [],
|
||||||
|
fans_loading: false,
|
||||||
|
fans_page: 1,
|
||||||
|
fansList: [],
|
||||||
|
fansScroll: 0
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 访客列表
|
||||||
|
getList() {
|
||||||
|
let vm = this
|
||||||
|
let data = {
|
||||||
|
page: vm.page,
|
||||||
|
type: 'single',
|
||||||
|
size: 15
|
||||||
|
}
|
||||||
|
vm.$showLoading('加载中...')
|
||||||
|
vm.$get({url: `${service.host}/user/preview/histroies`, data}).then(({code, data}) => {
|
||||||
|
if (code === 0) {
|
||||||
|
data.data.forEach((item) => {
|
||||||
|
item.created_at = utils.commentTimeHandle(item.created_at)
|
||||||
|
})
|
||||||
|
if (vm.list.length === 0 || vm.page === 1) {
|
||||||
|
vm.list = data.data
|
||||||
|
} else {
|
||||||
|
data.data.map(function (item) {
|
||||||
|
vm.list.push(item)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (vm.list.length < 15 || data.data.length < 15) {
|
||||||
|
vm.no_more = true
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
vm.loading = true
|
||||||
|
}, 500)
|
||||||
|
vm.page++
|
||||||
|
}
|
||||||
|
wx.hideLoading()
|
||||||
|
}).catch(err => {
|
||||||
|
wx.hideLoading()
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 粉丝列表
|
||||||
|
getFansList() {
|
||||||
|
let vm = this
|
||||||
|
let data = {
|
||||||
|
page: vm.fans_page,
|
||||||
|
type: 'single',
|
||||||
|
size: 15
|
||||||
|
}
|
||||||
|
vm.$showLoading('加载中...')
|
||||||
|
vm.$get({url: `${service.host}/followers`, data}).then(({code, data}) => {
|
||||||
|
if (code === 0) {
|
||||||
|
data.data.forEach((item) => {
|
||||||
|
item.nickname = `${item.nickname.substring(0, 1)}***`
|
||||||
|
})
|
||||||
|
if (vm.list.length === 0 || vm.page === 1) {
|
||||||
|
vm.fansList = data.data
|
||||||
|
} else {
|
||||||
|
data.data.map(function (item) {
|
||||||
|
vm.fansList.push(item)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (vm.fansList.length < 15 || data.data.length < 15) {
|
||||||
|
vm.fans_no_more = true
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
vm.fans_loading = true
|
||||||
|
}, 500)
|
||||||
|
vm.fans_page++
|
||||||
|
wx.hideLoading()
|
||||||
|
}
|
||||||
|
}).catch(err => {
|
||||||
|
wx.hideLoading()
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
deleteRecord(e, index) {
|
||||||
|
let vm = this
|
||||||
|
let data = {
|
||||||
|
user_id: e.preview_user_id
|
||||||
|
}
|
||||||
|
wx.showModal({
|
||||||
|
title: '来访记录',
|
||||||
|
content: `是否确认删除Ta的来访记录?`,
|
||||||
|
success: function (res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
vm.$delete({url: `${service.host}/delete/preview/history`, data}).then(({code, data}) => {
|
||||||
|
if (code == 0) {
|
||||||
|
vm.list.splice(index, 1)
|
||||||
|
vm.$showToast(`来访记录已删除`)
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
})
|
||||||
|
} else if (res.cancel) {
|
||||||
|
console.log('用户点击取消')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 切换tab
|
||||||
|
changeTab(index) {
|
||||||
|
let vm = this
|
||||||
|
let top = 0
|
||||||
|
if (vm.tabBarIndex == index) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
vm.tabBarIndex = index
|
||||||
|
if (vm.tabBarIndex == 0) {
|
||||||
|
top = vm.scroll
|
||||||
|
} else {
|
||||||
|
top = vm.fansScroll
|
||||||
|
}
|
||||||
|
wx.pageScrollTo({
|
||||||
|
scrollTop: top,
|
||||||
|
duration: 0
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 跳转购买vip
|
||||||
|
handleVip() {
|
||||||
|
let vm = this
|
||||||
|
vm.tipsShow = false
|
||||||
|
wx.navigateTo({url: '/pages/users/upgradeVIP'})
|
||||||
|
},
|
||||||
|
// 跳转用户详情,没有vip时点击第四个用户弹框提示
|
||||||
|
jumpPath(e, index) {
|
||||||
|
let vm = this
|
||||||
|
if (index >= 3 && vm.userInfo.rank_id == 0) {
|
||||||
|
vm.pic = e.photo || e.avatar || e.other_user.photo || e.other_user.avatar
|
||||||
|
vm.city = e.city || e.other_user.city
|
||||||
|
vm.age = e.year || e.other_user.year
|
||||||
|
vm.tipsShow = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
wx.navigateTo({url: `/pages/home/information?id=${e.id}`})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 上拉获取更多数据
|
||||||
|
onReachBottom() {
|
||||||
|
let vm = this
|
||||||
|
if (vm.tabBarIndex == 0) {
|
||||||
|
if (!vm.no_more) {
|
||||||
|
vm.getList()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!vm.fans_no_more) {
|
||||||
|
vm.getFansList()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 下拉刷新
|
||||||
|
onPullDownRefresh() {
|
||||||
|
let vm = this
|
||||||
|
if (vm.tabBarIndex == 0) {
|
||||||
|
vm.page = 1
|
||||||
|
vm.no_more = false
|
||||||
|
vm.getList()
|
||||||
|
} else {
|
||||||
|
vm.fans_page = 1
|
||||||
|
vm.fans_no_more = false
|
||||||
|
vm.getFansList()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onPageScroll(res) {
|
||||||
|
let vm = this
|
||||||
|
let top = res.scrollTop
|
||||||
|
if (vm.tabBarIndex == 0) {
|
||||||
|
vm.scroll = top
|
||||||
|
} else {
|
||||||
|
vm.fansScroll = top
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
let vm = this
|
||||||
|
vm.getList()
|
||||||
|
vm.getFansList()
|
||||||
|
vm.userInfo = wx.getStorageSync('userInfo')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<config>
|
||||||
|
{
|
||||||
|
navigationBarTitleText: '访客/粉丝',
|
||||||
|
enablePullDownRefresh: true,
|
||||||
|
backgroundColorTop: '#ffffff',
|
||||||
|
backgroundColorBottom: '#ffffff',
|
||||||
|
}
|
||||||
|
</config>
|
||||||
430
src/pages/tabBar/home.wpy
Normal file
@ -0,0 +1,430 @@
|
|||||||
|
<style lang="less" scoped>
|
||||||
|
@import url(../../styles/theme.less);
|
||||||
|
page {
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-top-menu-list{
|
||||||
|
padding: 0 20rpx;
|
||||||
|
margin: 30rpx 0 20rpx 0;
|
||||||
|
|
||||||
|
.ui-top-menu-item{
|
||||||
|
width: 25%;
|
||||||
|
|
||||||
|
.ui-top-menu-icon{
|
||||||
|
width: 120rpx;
|
||||||
|
height: 120rpx;
|
||||||
|
|
||||||
|
.ui-top-menu-count{
|
||||||
|
position: absolute;
|
||||||
|
top: 12rpx;
|
||||||
|
right: 2rpx;
|
||||||
|
margin: auto;
|
||||||
|
width: 36rpx;
|
||||||
|
height: 36rpx;
|
||||||
|
line-height: 30rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
font-size: 22rpx;
|
||||||
|
color: #ffffff;
|
||||||
|
background: #F1013D;
|
||||||
|
border: 4rpx solid #ffffff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-top-menu-title{
|
||||||
|
margin-top: -20rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-container{
|
||||||
|
.ui-touch-item {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
width: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
padding: 24rpx 0 24rpx 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-content {
|
||||||
|
width: 100%;
|
||||||
|
margin-right: 0;
|
||||||
|
-webkit-transition: all 0.4s;
|
||||||
|
transition: all 0.4s;
|
||||||
|
-webkit-transform: translateX(90px);
|
||||||
|
transform: translateX(90px);
|
||||||
|
margin-left: -90px;
|
||||||
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
.ui-messageBox {
|
||||||
|
margin-top: 2rpx;
|
||||||
|
margin-left: 16rpx;
|
||||||
|
|
||||||
|
.ui-is-top{
|
||||||
|
margin-left: 16rpx;
|
||||||
|
padding-left: 8rpx;
|
||||||
|
width: 76rpx;
|
||||||
|
height: 32rpx;
|
||||||
|
background: linear-gradient(90deg, #FFD18D 0%, #FFA564 100%);
|
||||||
|
border-radius: 8rpx;
|
||||||
|
line-height: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-name {
|
||||||
|
width: 400rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-message {
|
||||||
|
width: 524rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-unreadBox {
|
||||||
|
position: absolute;
|
||||||
|
right: 30rpx;
|
||||||
|
top: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
.ui-lastTime {
|
||||||
|
margin-top: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-no-disturbing {
|
||||||
|
width: 32rpx;
|
||||||
|
height: 32rpx;
|
||||||
|
margin-top: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-unreadNum, .ui-unreadNum_1 {
|
||||||
|
float: right;
|
||||||
|
width: 28rpx;
|
||||||
|
height: 28rpx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
border-radius: 50%;
|
||||||
|
font-size: 20rpx;
|
||||||
|
background: #f1013D;
|
||||||
|
color: #fff;
|
||||||
|
margin-top: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-unreadNum_1 {
|
||||||
|
width: 44rpx;
|
||||||
|
border-radius: 14rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-del-box {
|
||||||
|
background: #f1013D;
|
||||||
|
width: 90px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: #fff;
|
||||||
|
-webkit-transform: translateX(90px);
|
||||||
|
transform: translateX(90px);
|
||||||
|
-webkit-transition: all 0.4s;
|
||||||
|
transition: all 0.4s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.touch-move-active .ui-content,
|
||||||
|
.touch-move-active .ui-del-box {
|
||||||
|
-webkit-transform: translateX(0);
|
||||||
|
transform: translateX(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<template>
|
||||||
|
<view class="ui-news">
|
||||||
|
<cuCustom></cuCustom>
|
||||||
|
<view class="ui-top-menu-list f-fbc">
|
||||||
|
<view class="text-center ui-top-menu-item ui-relative" v-for="(item,index) in menuList" :key="index" @tap="jumpPath(item)">
|
||||||
|
<image class="ui-top-menu-icon ui-relative" :src="item.icon" mode="aspectFit">
|
||||||
|
<view class="ui-top-menu-count" wx:if="{{item.count}}">{{item.count}}</view>
|
||||||
|
</image>
|
||||||
|
<view class="color666 font_24 ui-top-menu-title">{{item.title}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="ui-container">
|
||||||
|
<view class="ui-touch-item" :class="{'touch-move-active' : item.isTouchMove}" data-index="{{index}}" bindtouchstart="touchstart" bindtouchmove="touchmove" v-for="(item,index) in list" :key="index" @tap="jumpChatPath(item)">
|
||||||
|
<view class="ui-content">
|
||||||
|
<image class="cu-avatar round lg flo_l" :src="item.icon" mode="aspectFit" @tap.stop="jumpDetailPath(item)"></image>
|
||||||
|
<view class="ui-messageBox flo_l">
|
||||||
|
<view class="font_30 color333 ui-name ellipsis_1 f-fcl">
|
||||||
|
{{item.title}}
|
||||||
|
<view v-if="item.is_top == 1" class="ui-is-top font_20 white">已置顶</view>
|
||||||
|
</view>
|
||||||
|
<view class="ui-message ellipsis_1 font_24 color666">
|
||||||
|
<span v-if="item.at_show" class="red">[有人@你]</span>
|
||||||
|
{{item.content}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="ui-unreadBox color999 text-right">
|
||||||
|
<view class="ui-lastTime font_22">{{item.last_time}}</view>
|
||||||
|
<block v-if="item.muteTeam">
|
||||||
|
<image class="ui-no-disturbing" src="https://image.fulllinkai.com/202406/29/c682c95e835831195a5af75c303a9720.png" mode="widthFix"></image>
|
||||||
|
</block>
|
||||||
|
<block v-else>
|
||||||
|
<view class="ui-unreadNum" v-if="item.new_count && item.new_count <= 99">{{item.new_count}}</view>
|
||||||
|
<view class="ui-unreadNum_1" v-if="item.new_count && item.new_count > 99">{{item.new_count}}</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="ui-del-box">退出</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import wepy from '@wepy/core'
|
||||||
|
import https from '../../mixins/https'
|
||||||
|
import base from '../../mixins/base'
|
||||||
|
import {service} from '../../config'
|
||||||
|
|
||||||
|
wepy.page({
|
||||||
|
config: {},
|
||||||
|
mixins: [https, base],
|
||||||
|
|
||||||
|
data: {
|
||||||
|
menuList: [
|
||||||
|
{
|
||||||
|
icon: 'https://image.fulllinkai.com/202201/21/a2a7445a8b70694056dd7795ef5ecc4e.png',
|
||||||
|
title: '系统通知',
|
||||||
|
path: '/pages/news/systemNews',
|
||||||
|
count: ''
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: 'https://image.fulllinkai.com/202201/21/1d8c26aa4e48a965bab9eb000db8d054.png',
|
||||||
|
title: '好友申请',
|
||||||
|
path: '/pages/news/friendRequest',
|
||||||
|
count: ''
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: 'https://image.fulllinkai.com/202201/21/1715406efd38dfe258b23f632b9c16eb.png',
|
||||||
|
title: '访客/粉丝',
|
||||||
|
path: '/pages/news/visitor?type=fans',
|
||||||
|
count: ''
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: 'https://image.fulllinkai.com/202201/21/9571a0bdddf66ea097eecd5a4a601436.png',
|
||||||
|
title: '我看过谁',
|
||||||
|
path: '/pages/news/review?type=review&title=我看过谁',
|
||||||
|
count: ''
|
||||||
|
}
|
||||||
|
],
|
||||||
|
index: null, // 滑动删除聊天消息下标
|
||||||
|
groupSessionsCount: [], // 群聊消息未读数
|
||||||
|
teamAtList: [], // 群聊@
|
||||||
|
list: [] // 消息列表数据
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getList() {
|
||||||
|
let vm = this
|
||||||
|
let data = {
|
||||||
|
page: vm.page
|
||||||
|
}
|
||||||
|
vm.$showLoading('加载中...')
|
||||||
|
vm.$get({url: `${service.host}/message/sessionV2`, data}).then(({code, data}) => {
|
||||||
|
if (code === 0) {
|
||||||
|
vm.teamAtList = wx.getStorageSync('teamAtList') || []
|
||||||
|
vm.groupSessionsCount = wx.getStorageSync('teamsSessionsCount') || []
|
||||||
|
|
||||||
|
vm.menuList[0].count = data.system_count
|
||||||
|
vm.menuList[1].count = data.friend_count
|
||||||
|
vm.menuList[2].count = data.follow_count + data.preview_count
|
||||||
|
let {session} = data
|
||||||
|
let arrList = []
|
||||||
|
if (session.data && session.data.length > 0) {
|
||||||
|
session.data.forEach((item) => {
|
||||||
|
if (item.chat_type == 'group_chat') {
|
||||||
|
arrList.push({
|
||||||
|
chat_type: item.chat_type,
|
||||||
|
icon: item.team.icon,
|
||||||
|
title: item.team.tname,
|
||||||
|
is_top: item.is_top,
|
||||||
|
content: item.last_message ? item.last_message.body.msg ? item.last_message.other_user.nickname ? (item.last_message.other_user.nickname + ':' + item.last_message.body.msg) : (item.last_message.other_user.name + ':' + item.last_message.body.msg) : '' : '',
|
||||||
|
last_time: item.last_message ? item.last_message.last_time : '',
|
||||||
|
id: item.team_id,
|
||||||
|
hidden_profile: 'NONE',
|
||||||
|
msgId: item.id,
|
||||||
|
isTouchMove: false,
|
||||||
|
new_count: wx.getStorageSync('muteNotList') && wx.getStorageSync('muteNotList').length > 0 ? 0 : vm.getGroupCount(item.team_id)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
if (item.other_user) {
|
||||||
|
arrList.push({
|
||||||
|
chat_type: item.chat_type,
|
||||||
|
icon: item.other_user.avatar || item.other_user.circle_avatar,
|
||||||
|
title: item.other_user.nickname || item.other_user.name,
|
||||||
|
is_top: item.is_top,
|
||||||
|
content: item.last_message ? item.last_message.content : '',
|
||||||
|
last_time: item.last_message ? item.last_message.last_time : '',
|
||||||
|
id: item.other_user.id,
|
||||||
|
hidden_profile: item.other_user.hidden_profile,
|
||||||
|
type: item.other_user.type,
|
||||||
|
msgId: item.id,
|
||||||
|
isTouchMove: false,
|
||||||
|
new_count: item.new_count
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
vm.list = [...arrList]
|
||||||
|
// 赋值所在群组已开启消息免打扰字段
|
||||||
|
if (wx.getStorageSync('muteNotList') && wx.getStorageSync('muteNotList').length > 0) {
|
||||||
|
let arr = wx.getStorageSync('muteNotList')
|
||||||
|
arr.forEach((i) => {
|
||||||
|
vm.list.forEach((j) => {
|
||||||
|
if (j.chat_type == 'group_chat' && i.teamId == j.id && !j.muteState) {
|
||||||
|
j.new_count = 0
|
||||||
|
j.muteTeam = i.muteTeam
|
||||||
|
j.muteState = true
|
||||||
|
} else if (j.chat_type == 'group_chat') {
|
||||||
|
j.new_count = vm.getGroupCount(j.id)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
console.log(vm.list, '777')
|
||||||
|
if (vm.list.length < 15 || session.data.length < 15) {
|
||||||
|
vm.no_more = true
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
vm.loading = true
|
||||||
|
}, 500)
|
||||||
|
vm.page++
|
||||||
|
}
|
||||||
|
wx.hideLoading()
|
||||||
|
}).catch(err => {
|
||||||
|
wx.hideLoading()
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
getNewCount() {
|
||||||
|
let vm = this
|
||||||
|
vm.$get({url: `${service.host}/new/message/count`}).then(({code, data}) => {
|
||||||
|
if (code === 0) {
|
||||||
|
let {new_count} = data
|
||||||
|
let groupCountList = wx.getStorageSync('teamsSessionsCount') || []
|
||||||
|
let groupCount = 0
|
||||||
|
if (groupCountList.length > 0) {
|
||||||
|
for (let i = 0; i < groupCountList.length; i++) {
|
||||||
|
groupCount += groupCountList[i].unread
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((new_count + groupCount) > 0) {
|
||||||
|
wx.setTabBarBadge({
|
||||||
|
index: 0,
|
||||||
|
text: `${new_count + groupCount}`
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
wx.removeTabBarBadge({
|
||||||
|
index: 0
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).catch(err => {
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获取群未读数
|
||||||
|
getGroupCount(id) {
|
||||||
|
let newCount = this.groupSessionsCount.filter(item => {
|
||||||
|
return item.id == id
|
||||||
|
})
|
||||||
|
if (newCount.length === 0) {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return newCount[0].unread
|
||||||
|
},
|
||||||
|
|
||||||
|
touchstart (e) {
|
||||||
|
let vm = this
|
||||||
|
vm.list.forEach(function (v, i) {
|
||||||
|
if (v.isTouchMove) { v.isTouchMove = false }
|
||||||
|
})
|
||||||
|
vm.startX = e.changedTouches[0].clientX
|
||||||
|
vm.startY = e.changedTouches[0].clientY
|
||||||
|
},
|
||||||
|
|
||||||
|
touchmove (e) {
|
||||||
|
let vm = this
|
||||||
|
vm.index = e.currentTarget.dataset.index
|
||||||
|
let startX = vm.startX
|
||||||
|
let startY = vm.startY
|
||||||
|
let touchMoveX = e.changedTouches[0].clientX
|
||||||
|
let touchMoveY = e.changedTouches[0].clientY
|
||||||
|
let angle = vm.angle({ X: startX, Y: startY }, { X: touchMoveX, Y: touchMoveY })
|
||||||
|
vm.list.forEach(function (v, i) {
|
||||||
|
v.isTouchMove = false
|
||||||
|
if (Math.abs(angle) > 30) return
|
||||||
|
if (i == vm.index) {
|
||||||
|
v.isTouchMove = touchMoveX <= startX
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
angle(start, end) {
|
||||||
|
let _X = end.X - start.X
|
||||||
|
let _Y = end.Y - start.Y
|
||||||
|
return 360 * Math.atan(_Y / _X) / (2 * Math.PI)
|
||||||
|
},
|
||||||
|
|
||||||
|
// 聊天对话
|
||||||
|
jumpChatPath(e) {
|
||||||
|
let url = ``
|
||||||
|
if (e.chat_type === 'group_chat') {
|
||||||
|
url = `/pages/news/groupChitchat?id=${e.id}&name=${encodeURIComponent(e.title)}&pic=${e.icon}`
|
||||||
|
} else {
|
||||||
|
url = `/pages/news/chitchat?id=${e.id}&name=${encodeURIComponent(e.title)}&type=${e.type}&pic=${e.icon}`
|
||||||
|
}
|
||||||
|
wx.navigateTo({url: url})
|
||||||
|
},
|
||||||
|
// 用户详情
|
||||||
|
jumpDetailPath(e) {
|
||||||
|
let url = ``
|
||||||
|
if (e.chat_type === 'group_chat') {
|
||||||
|
url = `/pages/news/groupChitchat?id=${e.id}&name=${encodeURIComponent(e.title)}&pic=${e.icon}`
|
||||||
|
} else {
|
||||||
|
url = `/pages/home/information?id=${e.id}`
|
||||||
|
}
|
||||||
|
wx.navigateTo({url: url})
|
||||||
|
},
|
||||||
|
jumpPath(e) {
|
||||||
|
wx.navigateTo({url: e.path})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 上拉获取更多数据
|
||||||
|
onReachBottom() {
|
||||||
|
},
|
||||||
|
// 下拉刷新
|
||||||
|
onPullDownRefresh() {
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
let vm = this
|
||||||
|
vm.getList()
|
||||||
|
vm.getNewCount()
|
||||||
|
},
|
||||||
|
created() {}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<config>
|
||||||
|
{
|
||||||
|
navigationBarTitleText: '消息',
|
||||||
|
navigationStyle: 'custom',
|
||||||
|
enablePullDownRefresh: true,
|
||||||
|
backgroundColorTop: '#ffffff',
|
||||||
|
backgroundColorBottom: '#ffffff',
|
||||||
|
usingComponents: {
|
||||||
|
cuCustom: '~@/components/cuCustom'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</config>
|
||||||
425
src/pages/tabBar/news.wpy
Normal file
@ -0,0 +1,425 @@
|
|||||||
|
<style lang="less" scoped>
|
||||||
|
@import url(../../styles/theme.less);
|
||||||
|
page {
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-top-menu-list{
|
||||||
|
padding: 0 20rpx;
|
||||||
|
margin: 30rpx 0 20rpx 0;
|
||||||
|
|
||||||
|
.ui-top-menu-item{
|
||||||
|
width: 25%;
|
||||||
|
|
||||||
|
.ui-top-menu-icon{
|
||||||
|
width: 120rpx;
|
||||||
|
height: 120rpx;
|
||||||
|
|
||||||
|
.ui-top-menu-count{
|
||||||
|
position: absolute;
|
||||||
|
top: 12rpx;
|
||||||
|
right: 2rpx;
|
||||||
|
margin: auto;
|
||||||
|
width: 36rpx;
|
||||||
|
height: 36rpx;
|
||||||
|
line-height: 30rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
font-size: 22rpx;
|
||||||
|
color: #ffffff;
|
||||||
|
background: #F1013D;
|
||||||
|
border: 4rpx solid #ffffff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-top-menu-title{
|
||||||
|
margin-top: -20rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-container{
|
||||||
|
.ui-touch-item {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
width: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
padding: 24rpx 0 24rpx 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-content {
|
||||||
|
width: 100%;
|
||||||
|
margin-right: 0;
|
||||||
|
-webkit-transition: all 0.4s;
|
||||||
|
transition: all 0.4s;
|
||||||
|
-webkit-transform: translateX(90px);
|
||||||
|
transform: translateX(90px);
|
||||||
|
margin-left: -90px;
|
||||||
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
.ui-messageBox {
|
||||||
|
margin-top: 2rpx;
|
||||||
|
margin-left: 16rpx;
|
||||||
|
|
||||||
|
.ui-is-top{
|
||||||
|
margin-left: 16rpx;
|
||||||
|
padding-left: 8rpx;
|
||||||
|
width: 76rpx;
|
||||||
|
height: 32rpx;
|
||||||
|
background: linear-gradient(90deg, #FFD18D 0%, #FFA564 100%);
|
||||||
|
border-radius: 8rpx;
|
||||||
|
line-height: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-name {
|
||||||
|
width: 400rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-message {
|
||||||
|
width: 524rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-unreadBox {
|
||||||
|
position: absolute;
|
||||||
|
right: 30rpx;
|
||||||
|
top: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
.ui-lastTime {
|
||||||
|
margin-top: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-no-disturbing {
|
||||||
|
width: 32rpx;
|
||||||
|
height: 32rpx;
|
||||||
|
margin-top: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-unreadNum, .ui-unreadNum_1 {
|
||||||
|
float: right;
|
||||||
|
width: 28rpx;
|
||||||
|
height: 28rpx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
border-radius: 50%;
|
||||||
|
font-size: 20rpx;
|
||||||
|
background: #f1013D;
|
||||||
|
color: #fff;
|
||||||
|
margin-top: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-unreadNum_1 {
|
||||||
|
width: 44rpx;
|
||||||
|
border-radius: 14rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-del-box {
|
||||||
|
background: #f1013D;
|
||||||
|
width: 90px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: #fff;
|
||||||
|
-webkit-transform: translateX(90px);
|
||||||
|
transform: translateX(90px);
|
||||||
|
-webkit-transition: all 0.4s;
|
||||||
|
transition: all 0.4s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.touch-move-active .ui-content,
|
||||||
|
.touch-move-active .ui-del-box {
|
||||||
|
-webkit-transform: translateX(0);
|
||||||
|
transform: translateX(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<template>
|
||||||
|
<view class="ui-news">
|
||||||
|
<cuCustom></cuCustom>
|
||||||
|
<view class="ui-top-menu-list f-fbc">
|
||||||
|
<view class="text-center ui-top-menu-item ui-relative" v-for="(item,index) in menuList" :key="index" @tap="close">
|
||||||
|
<image class="ui-top-menu-icon ui-relative" :src="item.icon" mode="aspectFit">
|
||||||
|
<view class="ui-top-menu-count" wx:if="{{item.count}}">{{item.count}}</view>
|
||||||
|
</image>
|
||||||
|
<view class="color666 font_24 ui-top-menu-title">{{item.title}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="ui-container">
|
||||||
|
<view class="ui-touch-item" :class="{'touch-move-active' : item.isTouchMove}" data-index="{{index}}" bindtouchstart="touchstart" bindtouchmove="touchmove" v-for="(item,index) in list" :key="index" @tap="jumpPath(item)">
|
||||||
|
<view class="ui-content">
|
||||||
|
<image class="cu-avatar round lg flo_l" :src="item.icon" mode="aspectFit" @tap.stop="jumpDetailPath(item)"></image>
|
||||||
|
<view class="ui-messageBox flo_l">
|
||||||
|
<view class="font_30 color333 ui-name ellipsis_1 f-fcl">
|
||||||
|
{{item.title}}
|
||||||
|
<view v-if="item.is_top == 1" class="ui-is-top font_20 white">已置顶</view>
|
||||||
|
</view>
|
||||||
|
<view class="ui-message ellipsis_1 font_24 color666">
|
||||||
|
<span v-if="item.at_show" class="red">[有人@你]</span>
|
||||||
|
{{item.content}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="ui-unreadBox color999 text-right">
|
||||||
|
<view class="ui-lastTime font_22">{{item.last_time}}</view>
|
||||||
|
<block v-if="item.muteTeam">
|
||||||
|
<image class="ui-no-disturbing" src="https://image.fulllinkai.com/202406/29/c682c95e835831195a5af75c303a9720.png" mode="widthFix"></image>
|
||||||
|
</block>
|
||||||
|
<block v-else>
|
||||||
|
<view class="ui-unreadNum" v-if="item.new_count && item.new_count <= 99">{{item.new_count}}</view>
|
||||||
|
<view class="ui-unreadNum_1" v-if="item.new_count && item.new_count > 99">{{item.new_count}}</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="ui-del-box">退出</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import wepy from '@wepy/core'
|
||||||
|
import https from '../../mixins/https'
|
||||||
|
import base from '../../mixins/base'
|
||||||
|
import {service} from '../../config'
|
||||||
|
|
||||||
|
wepy.page({
|
||||||
|
config: {},
|
||||||
|
mixins: [https, base],
|
||||||
|
|
||||||
|
data: {
|
||||||
|
menuList: [
|
||||||
|
{
|
||||||
|
icon: 'https://image.fulllinkai.com/202201/21/a2a7445a8b70694056dd7795ef5ecc4e.png',
|
||||||
|
title: '系统通知',
|
||||||
|
path: '/pages/users/myNews',
|
||||||
|
count: ''
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: 'https://image.fulllinkai.com/202201/21/1d8c26aa4e48a965bab9eb000db8d054.png',
|
||||||
|
title: '好友申请',
|
||||||
|
path: '/pages/users/friendRequest',
|
||||||
|
count: ''
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: 'https://image.fulllinkai.com/202201/21/1715406efd38dfe258b23f632b9c16eb.png',
|
||||||
|
title: '访客/粉丝',
|
||||||
|
path: '/pages/users/visitorFriendlist?type=fans',
|
||||||
|
count: ''
|
||||||
|
},
|
||||||
|
{
|
||||||
|
icon: 'https://image.fulllinkai.com/202201/21/9571a0bdddf66ea097eecd5a4a601436.png',
|
||||||
|
title: '我看过谁',
|
||||||
|
path: '/pages/users/review?type=review&title=我看过谁',
|
||||||
|
count: ''
|
||||||
|
}
|
||||||
|
],
|
||||||
|
index: null, // 滑动删除聊天消息下标
|
||||||
|
groupSessionsCount: [], // 群聊消息未读数
|
||||||
|
teamAtList: [], // 群聊@
|
||||||
|
list: [] // 消息列表数据
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getList() {
|
||||||
|
let vm = this
|
||||||
|
let data = {
|
||||||
|
page: vm.page
|
||||||
|
}
|
||||||
|
vm.$showLoading('加载中...')
|
||||||
|
vm.$get({url: `${service.host}/message/sessionV2`, data}).then(({code, data}) => {
|
||||||
|
if (code === 0) {
|
||||||
|
vm.menuList[0].count = data.system_count
|
||||||
|
vm.menuList[1].count = data.friend_count
|
||||||
|
vm.menuList[2].count = data.follow_count + data.preview_count
|
||||||
|
let {session} = data
|
||||||
|
let arrList = []
|
||||||
|
if (session.data && session.data.length > 0) {
|
||||||
|
session.data.forEach((item) => {
|
||||||
|
if (item.chat_type == 'group_chat') {
|
||||||
|
arrList.push({
|
||||||
|
chat_type: item.chat_type,
|
||||||
|
icon: item.team.icon,
|
||||||
|
title: item.team.tname,
|
||||||
|
is_top: item.is_top,
|
||||||
|
content: item.last_message ? item.last_message.body.msg ? item.last_message.other_user.nickname ? (item.last_message.other_user.nickname + ':' + item.last_message.body.msg) : (item.last_message.other_user.name + ':' + item.last_message.body.msg) : '' : '',
|
||||||
|
last_time: item.last_message ? item.last_message.last_time : '',
|
||||||
|
id: item.team_id,
|
||||||
|
hidden_profile: 'NONE',
|
||||||
|
msgId: item.id,
|
||||||
|
isTouchMove: false,
|
||||||
|
new_count: wx.getStorageSync('muteNotList') && wx.getStorageSync('muteNotList').length > 0 ? 0 : this.getGroupCount(item.team_id),
|
||||||
|
path: `/pages/home/groupChitchat?id=${item.team_id}&name=` + encodeURIComponent(`${item.team.tname}`)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
console.log(item.new_count, '///////****')
|
||||||
|
arrList.push({
|
||||||
|
chat_type: item.chat_type,
|
||||||
|
icon: item.other_user ? item.other_user.avatar || item.other_user.circle_avatar : '',
|
||||||
|
title: item.other_user ? item.other_user.nickname || item.other_user.name : '',
|
||||||
|
is_top: item.is_top,
|
||||||
|
content: item.last_message ? item.last_message.content : '',
|
||||||
|
last_time: item.last_message ? item.last_message.last_time : '',
|
||||||
|
id: item.other_user ? item.other_user.id : '',
|
||||||
|
hidden_profile: item.other_user ? item.other_user.hidden_profile : '',
|
||||||
|
msgId: item.id,
|
||||||
|
isTouchMove: false,
|
||||||
|
new_count: item.new_count,
|
||||||
|
path: item.other_user ? `/pages/home/chitchat?id=${item.other_user.id}&name=` + encodeURIComponent(`${item.other_user.nickname ? item.other_user.nickname : item.other_user.name}`) + `&type=${item.other_user.type}` : ''
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
vm.list = [...arrList]
|
||||||
|
// 赋值所在群组已开启消息免打扰字段
|
||||||
|
if (wx.getStorageSync('muteNotList') && wx.getStorageSync('muteNotList').length > 0) {
|
||||||
|
let arr = wx.getStorageSync('muteNotList')
|
||||||
|
arr.forEach((i) => {
|
||||||
|
vm.list.forEach((j) => {
|
||||||
|
if (j.chat_type == 'group_chat' && i.teamId == j.id && !j.muteState) {
|
||||||
|
j.new_count = 0
|
||||||
|
j.muteTeam = i.muteTeam
|
||||||
|
j.muteState = true
|
||||||
|
} else if (j.chat_type == 'group_chat') {
|
||||||
|
j.new_count = this.getGroupCount(j.id)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
console.log(vm.list, '777')
|
||||||
|
if (vm.list.length < 15 || session.data.length < 15) {
|
||||||
|
vm.no_more = true
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
vm.loading = true
|
||||||
|
}, 500)
|
||||||
|
vm.page++
|
||||||
|
}
|
||||||
|
wx.hideLoading()
|
||||||
|
}).catch(err => {
|
||||||
|
wx.hideLoading()
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
getNewCount() {
|
||||||
|
let vm = this
|
||||||
|
vm.$get({url: `${service.host}/new/message/count`}).then(({code, data}) => {
|
||||||
|
if (code === 0) {
|
||||||
|
let {new_count} = data
|
||||||
|
let groupCountList = wx.getStorageSync('teamsSessionsCount') || []
|
||||||
|
let groupCount = 0
|
||||||
|
if (groupCountList.length > 0) {
|
||||||
|
for (let i = 0; i < groupCountList.length; i++) {
|
||||||
|
groupCount += groupCountList[i].unread
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((new_count + groupCount) > 0) {
|
||||||
|
wx.setTabBarBadge({
|
||||||
|
index: 0,
|
||||||
|
text: `${new_count + groupCount}`
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
wx.removeTabBarBadge({
|
||||||
|
index: 0
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).catch(err => {
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获取群未读数
|
||||||
|
getGroupCount(id) {
|
||||||
|
let newCount = this.groupSessionsCount.filter(item => {
|
||||||
|
return item.id == id
|
||||||
|
})
|
||||||
|
if (newCount.length === 0) {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return newCount[0].unread
|
||||||
|
},
|
||||||
|
|
||||||
|
touchstart (e) {
|
||||||
|
let vm = this
|
||||||
|
vm.list.forEach(function (v, i) {
|
||||||
|
if (v.isTouchMove) { v.isTouchMove = false }
|
||||||
|
})
|
||||||
|
vm.startX = e.changedTouches[0].clientX
|
||||||
|
vm.startY = e.changedTouches[0].clientY
|
||||||
|
},
|
||||||
|
|
||||||
|
touchmove (e) {
|
||||||
|
let vm = this
|
||||||
|
vm.index = e.currentTarget.dataset.index
|
||||||
|
let startX = vm.startX
|
||||||
|
let startY = vm.startY
|
||||||
|
let touchMoveX = e.changedTouches[0].clientX
|
||||||
|
let touchMoveY = e.changedTouches[0].clientY
|
||||||
|
let angle = vm.angle({ X: startX, Y: startY }, { X: touchMoveX, Y: touchMoveY })
|
||||||
|
vm.list.forEach(function (v, i) {
|
||||||
|
v.isTouchMove = false
|
||||||
|
if (Math.abs(angle) > 30) return
|
||||||
|
if (i == vm.index) {
|
||||||
|
v.isTouchMove = touchMoveX <= startX
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
angle(start, end) {
|
||||||
|
let _X = end.X - start.X
|
||||||
|
let _Y = end.Y - start.Y
|
||||||
|
return 360 * Math.atan(_Y / _X) / (2 * Math.PI)
|
||||||
|
},
|
||||||
|
|
||||||
|
close () {
|
||||||
|
console.log('2222222')
|
||||||
|
this.$app.$options.globalData.nim.team.updateMyMemberInfo({
|
||||||
|
teamId: '23903306874',
|
||||||
|
bitConfigMask: 1
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
jumpPath(e) {
|
||||||
|
console.log(e, '8888888888')
|
||||||
|
wx.navigateTo({
|
||||||
|
url: `${e.path}&pic=${e.icon}`
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
jumpDetailPath(e) {
|
||||||
|
wx.navigateTo({
|
||||||
|
url: `${e.path}&pic=${e.icon}`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 上拉获取更多数据
|
||||||
|
onReachBottom() {
|
||||||
|
},
|
||||||
|
// 下拉刷新
|
||||||
|
onPullDownRefresh() {
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
this.teamAtList = wx.getStorageSync('teamAtList') || []
|
||||||
|
this.groupSessionsCount = wx.getStorageSync('teamsSessionsCount') || []
|
||||||
|
this.getList()
|
||||||
|
this.getNewCount()
|
||||||
|
},
|
||||||
|
created() {}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<config>
|
||||||
|
{
|
||||||
|
navigationBarTitleText: '消息',
|
||||||
|
navigationStyle: 'custom',
|
||||||
|
enablePullDownRefresh: true,
|
||||||
|
backgroundColorTop: '#ffffff',
|
||||||
|
backgroundColorBottom: '#ffffff',
|
||||||
|
usingComponents: {
|
||||||
|
cuCustom: '~@/components/cuCustom'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</config>
|
||||||
801
src/pages/tabBar/user.wpy
Normal file
@ -0,0 +1,801 @@
|
|||||||
|
<style lang="less" scoped>
|
||||||
|
@import url(../../styles/theme.less);
|
||||||
|
page {
|
||||||
|
._dayMotion{
|
||||||
|
position: fixed;
|
||||||
|
right: 0;
|
||||||
|
top: 42vw;
|
||||||
|
padding: 8rpx 22rpx;
|
||||||
|
background: #FFFFFF;
|
||||||
|
border-top-left-radius: 42rpx;
|
||||||
|
border-bottom-left-radius: 42rpx;
|
||||||
|
box-shadow: 1rpx 1rpx 12rpx #d0d0d0;
|
||||||
|
._icon{
|
||||||
|
width: 28rpx;
|
||||||
|
height: 28rpx;
|
||||||
|
margin-right: 8rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.ui-my{
|
||||||
|
position: relative;
|
||||||
|
background-color: #f4f4f4!important;
|
||||||
|
width: 100vw;
|
||||||
|
height:100vh;
|
||||||
|
padding-top: 1rpx;
|
||||||
|
.ui-my-top{
|
||||||
|
width: 100vw;
|
||||||
|
/*height: 490rpx;*/
|
||||||
|
padding-top: 1rpx;
|
||||||
|
background: @theme_color;
|
||||||
|
background-image: url("https://image.fulllinkai.com/202401/04/fe9e791027aeec5509358f995c676e84.png");
|
||||||
|
background-size: cover;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.ui-top-color{
|
||||||
|
color:#e6f7f3;
|
||||||
|
}
|
||||||
|
.ui-top{
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
.ui-top-img{
|
||||||
|
width: 132rpx;
|
||||||
|
height: 132rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
display: block;
|
||||||
|
margin: 60rpx auto 26rpx auto;
|
||||||
|
}
|
||||||
|
.ui-top-name{
|
||||||
|
margin: 10rpx 0;
|
||||||
|
color:#e6f7f3;
|
||||||
|
}
|
||||||
|
.ui-edit-icon{
|
||||||
|
width: 28rpx;
|
||||||
|
height: 28rpx;
|
||||||
|
display: block;
|
||||||
|
margin-left: 8rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.ui-no-login{
|
||||||
|
margin: 26rpx 0 30rpx;
|
||||||
|
.ui-no-login-vertical{
|
||||||
|
width: 100vw;
|
||||||
|
height: 1rpx;
|
||||||
|
background-color: #e6f7f3;
|
||||||
|
}
|
||||||
|
.ui-no-login-color{
|
||||||
|
color: #e6f7f3;
|
||||||
|
}
|
||||||
|
.ui-login-title{
|
||||||
|
margin-top: 14rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.ui-margin-t, .ui-unit-container{
|
||||||
|
margin-top: 20rpx;
|
||||||
|
}
|
||||||
|
.ui-unit-box{
|
||||||
|
width: 190rpx;
|
||||||
|
border-radius: 40rpx;
|
||||||
|
border: 2rpx solid @theme_color;
|
||||||
|
margin-right: 30rpx;
|
||||||
|
.ui-unit, .ui-unit_1{
|
||||||
|
color: @theme_color;
|
||||||
|
background: #ffffff;
|
||||||
|
width: 50%;
|
||||||
|
height: 48rpx;
|
||||||
|
border-radius: 40rpx 0 0 40rpx;
|
||||||
|
}
|
||||||
|
.ui-unit_1{
|
||||||
|
border-radius: 0 40rpx 40rpx 0;
|
||||||
|
}
|
||||||
|
.ui-unit-select{
|
||||||
|
color: #ffffff;
|
||||||
|
background: @theme_color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.ui-list{
|
||||||
|
position: relative;
|
||||||
|
width: 100vw;
|
||||||
|
height: 106rpx;
|
||||||
|
background-color: #ffffff;
|
||||||
|
.ui-left-icon{
|
||||||
|
margin: 0 30rpx;
|
||||||
|
height: 42rpx;
|
||||||
|
width:42rpx;
|
||||||
|
}
|
||||||
|
.ui-right-icon{
|
||||||
|
margin: 0 30rpx 0 20rpx;
|
||||||
|
width: 12rpx;
|
||||||
|
height: 26rpx;
|
||||||
|
}
|
||||||
|
.ui-new-icon{
|
||||||
|
width: 64rpx;
|
||||||
|
height: 36rpx;
|
||||||
|
margin-top: -14rpx;
|
||||||
|
}
|
||||||
|
.ui-bottom-vertical{
|
||||||
|
position: absolute;
|
||||||
|
padding-left: 100rpx;
|
||||||
|
width: 560rpx;
|
||||||
|
height: 1px;
|
||||||
|
background-color: #ededed;
|
||||||
|
bottom: 0;
|
||||||
|
right: 0;
|
||||||
|
box-sizing: content-box;
|
||||||
|
}
|
||||||
|
.ui-bottom-vertical-three{
|
||||||
|
height: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.hei100{
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
.ui-mobile-red{
|
||||||
|
color: #DD6A5B;
|
||||||
|
}
|
||||||
|
.ui-login-out{
|
||||||
|
margin-top: 20rpx;
|
||||||
|
line-height: 106rpx;
|
||||||
|
padding-bottom: 80rpx;
|
||||||
|
}
|
||||||
|
.ui-login-out-color{
|
||||||
|
color: #DD6A5B;
|
||||||
|
}
|
||||||
|
.ui-attention{
|
||||||
|
width: 650rpx;
|
||||||
|
height: 80rpx;
|
||||||
|
padding: 0 20rpx;
|
||||||
|
background: #FFFFFF;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
opacity: 0.8;
|
||||||
|
margin: 34rpx 0 -20rpx 0;
|
||||||
|
.ui-attention-clear-icon{
|
||||||
|
width: 24rpx;
|
||||||
|
height: 24rpx;
|
||||||
|
display: block;
|
||||||
|
margin-right: 12rpx;
|
||||||
|
}
|
||||||
|
.ui-attention-btn{
|
||||||
|
width: 104rpx;
|
||||||
|
height: 44rpx;
|
||||||
|
border-radius: 26rpx;
|
||||||
|
border: 2rpx solid #B2E3D2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.ui-login-model{
|
||||||
|
position: absolute;
|
||||||
|
top:50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%,-50%);
|
||||||
|
.ui-model-box{
|
||||||
|
position: relative;
|
||||||
|
width: 600rpx;
|
||||||
|
height:860rpx;
|
||||||
|
.ui-model-img{
|
||||||
|
width: 600rpx;
|
||||||
|
height:860rpx;
|
||||||
|
}
|
||||||
|
.ui-model-btn{
|
||||||
|
position: absolute;
|
||||||
|
top: 660rpx;
|
||||||
|
left: 80rpx;
|
||||||
|
width: 460rpx;
|
||||||
|
height: 74rpx;
|
||||||
|
line-height: 70rpx;
|
||||||
|
border-radius: 40rpx;
|
||||||
|
color: #e6f7f3;
|
||||||
|
background-color: @theme_color;
|
||||||
|
}
|
||||||
|
.ui-close-icon{
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
bottom: 0;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
height: 50rpx;
|
||||||
|
width: 50rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.ui-letter-space-1{
|
||||||
|
letter-spacing: 1rpx;
|
||||||
|
}
|
||||||
|
.ui-user-btn{
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
background-color: #ffffff;
|
||||||
|
border: none!important;
|
||||||
|
border-color: #ffffff;
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
button::after{
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
.ui-service-model{
|
||||||
|
position: absolute;
|
||||||
|
top:50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%,-50%);
|
||||||
|
.ui-model-box{
|
||||||
|
position: relative;
|
||||||
|
width: 600rpx;
|
||||||
|
padding: 50rpx 0;
|
||||||
|
border-radius: 24rpx;
|
||||||
|
background: #ffffff;
|
||||||
|
.ui-service-subText{
|
||||||
|
margin-top: 20rpx;
|
||||||
|
}
|
||||||
|
.ui-qrCode-icon{
|
||||||
|
border: 4rpx solid #d8d8d8;
|
||||||
|
width: 280rpx;
|
||||||
|
height: 280rpx;
|
||||||
|
display: block;
|
||||||
|
margin: 50rpx auto;
|
||||||
|
}
|
||||||
|
.ui-service-icon{
|
||||||
|
width: 352rpx;
|
||||||
|
height: 220rpx;
|
||||||
|
display: block;
|
||||||
|
margin: 40rpx auto;
|
||||||
|
}
|
||||||
|
.ui-mobile-text{
|
||||||
|
text-decoration: underline;
|
||||||
|
margin-left: 8rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.ui-motion-model{
|
||||||
|
position: absolute;
|
||||||
|
top:50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%,-50%);
|
||||||
|
.ui-model-box {
|
||||||
|
position: relative;
|
||||||
|
width: 600rpx;
|
||||||
|
padding: 50rpx 0;
|
||||||
|
border-radius: 24rpx;
|
||||||
|
background: #ffffff;
|
||||||
|
.ui-motion-subText{
|
||||||
|
margin: 40rpx auto;
|
||||||
|
padding: 0 20rpx;
|
||||||
|
}
|
||||||
|
.ui-motion-btn{
|
||||||
|
width: 472rpx;
|
||||||
|
height: 76rpx;
|
||||||
|
border-radius: 38rpx;
|
||||||
|
background: #5ac7a0;
|
||||||
|
margin: 60rpx auto 0 auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.cancel_icon{
|
||||||
|
width: 48rpx;
|
||||||
|
height: 48rpx;
|
||||||
|
position: fixed;
|
||||||
|
margin-top: 40rpx;
|
||||||
|
margin-left: -24rpx;
|
||||||
|
z-index: 99;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
<template>
|
||||||
|
<view class="ui-my">
|
||||||
|
<view class="ui-my-top">
|
||||||
|
<view class="font_32 ui-top-color text-center" style="margin-top: {{navTop}}px">{{ i18nL.pages.tabBar.user.title }}</view>
|
||||||
|
<!-- <view class="_dayMotion f-fbc">-->
|
||||||
|
<!-- <image mode="widthFix" class="_icon" src="https://image.fulllinkai.com/202401/04/0355395a1b21f16f43bfcb01edf318d0.png"></image>-->
|
||||||
|
<!-- <p class="font_28 color-theme">全民运动</p>-->
|
||||||
|
<!-- </view>-->
|
||||||
|
<view class="f-fc f-fdc ui-top" v-if="registerState">
|
||||||
|
<view class="ui-attention f-fbc" v-if="!userInfo.is_subscribe && showSubscribe">
|
||||||
|
<view class="f-fcl">
|
||||||
|
<image mode="widthFix" class="ui-attention-clear-icon" src="https://image.fulllinkai.com/202302/22/0fb3ec31f29628d09d18135a826154fe.png" @tap="showSubscribe = false"></image>
|
||||||
|
<view class="font_26 color333">{{ i18nL.pages.tabBar.user.user1ace1 }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="ui-attention-btn f-fcc color-theme font_24" @tap="hideModal">{{ i18nL.pages.tabBar.user.user1ace2 }}</view>
|
||||||
|
</view>
|
||||||
|
<view @tap="goToDetail('/pages/sub_page/baseInfo')">
|
||||||
|
<image mode="aspectFill" class="ui-top-img" :src="userInfo.avatar" ></image>
|
||||||
|
<view class="f-fcc">
|
||||||
|
<view class="font_30 ui-letter-space-1 white">{{userInfo.name|| i18nL.pages.tabBar.user.user1ace3}}</view>
|
||||||
|
<image class="ui-edit-icon" src="https://image.fulllinkai.com/202306/09/cbf39c9c48c2ef1cb10abb14929011f3.png" mode="widthFix"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="ui-top-name font_26">ID:{{userInfo.showId}}</view>
|
||||||
|
</view>
|
||||||
|
<view v-else class="ui-no-login" @tap="gotoLogin">
|
||||||
|
<view class="ui-login-title ui-no-login-color text-c font_30">{{i18nL.pages.tabBar.user.user1ace4}}</view>
|
||||||
|
<view class="ui-no-login-color text-c font_30">{{i18nL.pages.tabBar.user.user1ace5}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="ui-margin-t">
|
||||||
|
<view class="ui-list" v-for="(item,index) in list">
|
||||||
|
<view class="f-fbc hei100" @tap="goToDetail(item.toPath)" v-if="!item.buttonType">
|
||||||
|
<view class="f-fc">
|
||||||
|
<image mode="widthFix" class="ui-left-icon" :src="item.icon"></image>
|
||||||
|
<view class="ui-left-text black font_32 ui-letter-space-1">{{item.title}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="f-fc">
|
||||||
|
<view class="color999 font_32 {{userInfo[item.rightValue]? '':'ui-mobile-red'}}" v-if="item.rightValue == 'mobile'">{{userInfo[item.rightValue] || i18nL.pages.tabBar.user.user1ace6}}</view>
|
||||||
|
<image model="widthFix" src="https://image.fulllinkai.com/202211/22/8cf3979193db3796fe4ca3b3b9be00f7.png" class="ui-right-icon"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="ui-bottom-vertical {{index ===(list.length -1) ? 'ui-bottom-vertical-three' :''}}"></view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="ui-margin-t">
|
||||||
|
<view class="ui-list" v-for="(item,index) in listV2">
|
||||||
|
<view class="f-fbc hei100" @tap="jumpPath(item.toPath)" v-if="!item.buttonType">
|
||||||
|
<view class="f-fc">
|
||||||
|
<image mode="widthFix" class="ui-left-icon" :src="item.icon"></image>
|
||||||
|
<view class="ui-left-text black font_32 ui-letter-space-1">{{item.title}}</view>
|
||||||
|
<image class="ui-new-icon" v-if="index==0" src="https://image.fulllinkai.com/202310/12/b7a9a0af3aad279e4d71bc7db5366470.png" mode="widthFix"></image>
|
||||||
|
</view>
|
||||||
|
<image model="widthFix" src="https://image.fulllinkai.com/202211/22/8cf3979193db3796fe4ca3b3b9be00f7.png" class="ui-right-icon"></image>
|
||||||
|
</view>
|
||||||
|
<view class="ui-bottom-vertical" v-if="index + 1 != listV2.length"></view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="ui-unit-container">
|
||||||
|
<view class="ui-list">
|
||||||
|
<view class="f-fbc hei100">
|
||||||
|
<view class="f-fc">
|
||||||
|
<image mode="widthFix" class="ui-left-icon" src="https://image.fulllinkai.com/202302/22/d0a40863080a033bfcd1a5369cdfaa97.png"></image>
|
||||||
|
<view class="ui-left-text black font_32 ui-letter-space-1">{{i18nL.pages.tabBar.user.user1ace7}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="ui-unit-box f-fbc" @tap="chooseUnit">
|
||||||
|
<view class="ui-unit f-fcc font_28 {{userInfo.unitType != 'kg' ? 'ui-unit-select' : ''}}">{{i18nL.pages.tabBar.user.user1ace8}}</view>
|
||||||
|
<view class="ui-unit_1 f-fcc font_28 {{userInfo.unitType == 'kg' ? 'ui-unit-select' : ''}}">kg</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="ui-unit-container">
|
||||||
|
<view class="ui-list">
|
||||||
|
<view class="f-fbc hei100" @tap="switchScale">
|
||||||
|
<view class="f-fc ui-relative">
|
||||||
|
<image mode="widthFix" class="ui-left-icon" src="https://image.fulllinkai.com/202310/12/47a1e7a1dc1e1f1d7dd4cd4f834cc030.png"></image>
|
||||||
|
<view class="ui-left-text black font_32 ui-letter-space-1">{{ i18nL.pages.sub_page.onMeasure.tips11 }}</view>
|
||||||
|
</view>
|
||||||
|
<image model="widthFix" src="https://image.fulllinkai.com/202211/22/8cf3979193db3796fe4ca3b3b9be00f7.png" class="ui-right-icon"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="ui-login-out">
|
||||||
|
|
||||||
|
<view class="ui-list" v-for="(item,index) in wxTypeList">
|
||||||
|
<block v-if="index == 0">
|
||||||
|
<view class="f-fbc" @tap="goToWeXin">
|
||||||
|
<view class="f-fcl">
|
||||||
|
<image mode="widthFix" class="ui-left-icon" :src="item.icon"></image>
|
||||||
|
<view class="ui-left-text black font_32 ui-letter-space-1">{{item.title}}</view>
|
||||||
|
</view>
|
||||||
|
<image model="widthFix" src="https://image.fulllinkai.com/202211/22/8cf3979193db3796fe4ca3b3b9be00f7.png" class="ui-right-icon"></image>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
<block v-if="index == 2">
|
||||||
|
<view class="f-fbc" @tap="jumpPath(item.toPath)">
|
||||||
|
<view class="f-fcl">
|
||||||
|
<image mode="widthFix" class="ui-left-icon" :src="item.icon"></image>
|
||||||
|
<view class="ui-left-text black font_32 ui-letter-space-1">{{item.title}}</view>
|
||||||
|
</view>
|
||||||
|
<image model="widthFix" src="https://image.fulllinkai.com/202211/22/8cf3979193db3796fe4ca3b3b9be00f7.png" class="ui-right-icon"></image>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
<block v-else>
|
||||||
|
<button class="ui-user-btn f-fbc hei100" :open-type="!registerState ? '' :item.buttonType" @tap="goToDetail(item.toPath)">
|
||||||
|
<view class="f-fc">
|
||||||
|
<image mode="widthFix" class="ui-left-icon" :src="item.icon"></image>
|
||||||
|
<view class="ui-left-text black font_32 ui-letter-space-1">{{item.title}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="f-fc">
|
||||||
|
<view class="color999 font_32 {{userInfo[item.rightValue]? '':'ui-mobile-red'}}" v-if="item.rightValue == 'mobile'">{{userInfo[item.rightValue] || i18nL.pages.tabBar.user.user1ace6}}</view>
|
||||||
|
<image model="widthFix" src="https://image.fulllinkai.com/202211/22/8cf3979193db3796fe4ca3b3b9be00f7.png" class="ui-right-icon"></image>
|
||||||
|
</view>
|
||||||
|
</button>
|
||||||
|
</block>
|
||||||
|
<view class="ui-bottom-vertical" v-if="index + 1 != wxTypeList.length"></view>
|
||||||
|
</view>
|
||||||
|
<view class="font_24 color999 text-center" v-if="versions">{{versions}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="cu-modal {{showLogin?'show':''}}">
|
||||||
|
<!-- 授权弹框-->
|
||||||
|
<view class="ui-login-model">
|
||||||
|
<view class="ui-model-box">
|
||||||
|
<image class="ui-model-img" src="https://image.fulllinkai.com/202211/24/e71ec3e58d4c32263c47c24f2c0b57d2.png"></image>
|
||||||
|
<view class="ui-model-btn font_32" @tap="gotoLogin">{{ i18nL.pages.tabBar.user.user1ace10 }}
|
||||||
|
</view>
|
||||||
|
<view class="ui-close-icon" @tap="showLogin = false"></view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="cu-modal {{showService?'show':''}}">
|
||||||
|
<view class="ui-service-model">
|
||||||
|
<view class="ui-model-box">
|
||||||
|
<view class="font_36 color333 bold">{{ i18nL.pages.tabBar.user.user1ace11 }}</view>
|
||||||
|
<image class="ui-qrCode-icon" src="https://image.fulllinkai.com/202302/22/02dedc5cf98b79db9fc7ade15925da64.jpeg" mode="widthFix" :show-menu-by-longpress="1"></image>
|
||||||
|
<view class="font_28 color666 ui-service-subText">{{i18nL.pages.tabBar.user.user1ace12}}</view>
|
||||||
|
</view>
|
||||||
|
<image src="https://images.ufutx.com/202012/24/1033c7b52cacddcebe999cefc6ad2c9b.png" mode="widthFix" class="cancel_icon" @tap="hideModal"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="cu-modal {{showMotionRecord?'show':''}}">
|
||||||
|
<view class="ui-motion-model">
|
||||||
|
<view class="ui-model-box">
|
||||||
|
<block wx:if="{{isMotionRecord == '3'}}">
|
||||||
|
<view class="font_36 color333 bold">{{ i18nL.pages.tabBar.user.user1ace24 }}</view>
|
||||||
|
<view class="font_30 color666 ui-motion-subText">{{ i18nL.pages.tabBar.user.user1ace25 }}</view>
|
||||||
|
<view class="ui-motion-btn ~font_30 ~colorfff ~f-fcc" @tap="toAudit">{{ i18nL.pages.tabBar.user.user1ace26 }}</view>
|
||||||
|
</block>
|
||||||
|
<block wx:if="{{isMotionRecord == '0'}}">
|
||||||
|
<view class="font_36 color333 bold">{{ i18nL.pages.tabBar.user.user1ace27 }}</view>
|
||||||
|
<view class="font_28 color666 ui-motion-subText">{{ i18nL.pages.tabBar.user.user1ace28 }}</view>
|
||||||
|
<view class="ui-motion-btn ~font_30 ~colorfff ~f-fcc" @tap="hideModalV2">{{ i18nL.pages.tabBar.user.user1ace29 }}</view>
|
||||||
|
</block>
|
||||||
|
<block wx:if="{{isMotionRecord == '2'}}">
|
||||||
|
<view class="font_36 color333 bold">{{ i18nL.pages.tabBar.user.user1ace30 }}</view>
|
||||||
|
<view class="font_28 color666 ui-motion-subText">{{ i18nL.pages.tabBar.user.user1ace31 }}:{{rejectReason}}</view>
|
||||||
|
<view class="ui-motion-btn ~font_30 ~colorfff ~f-fcc" @tap="toAudit">{{ i18nL.pages.tabBar.user.user1ace32 }}</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
<image src="https://images.ufutx.com/202012/24/1033c7b52cacddcebe999cefc6ad2c9b.png" mode="widthFix" class="cancel_icon" @tap="hideModalV2"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<!--x-->
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import wepy from '@wepy/core'
|
||||||
|
import https from '../../mixins/https'
|
||||||
|
import base from '../../mixins/base'
|
||||||
|
import utils from '../../utils/util'
|
||||||
|
import {service} from '../../config'
|
||||||
|
|
||||||
|
wepy.page({
|
||||||
|
config: {},
|
||||||
|
mixins: [https, base],
|
||||||
|
|
||||||
|
data: {
|
||||||
|
navTop: '',
|
||||||
|
versions: '',
|
||||||
|
statisticsWebUrl: '',
|
||||||
|
showHeight: 0,
|
||||||
|
indicatorsLocation: 0,
|
||||||
|
indicatorsColor: '',
|
||||||
|
modalName: '',
|
||||||
|
showSubscribe: true,
|
||||||
|
showService: false,
|
||||||
|
throttling: true,
|
||||||
|
list: [
|
||||||
|
// {title: '编辑资料', icon: 'https://image.fulllinkai.com/202211/22/46fe9cf2d318bc6515bc3508ed1ca425.png', rightValue: '', toPath: '/pages/sub_page/baseInfo', buttonType: ''},
|
||||||
|
{title: `手机号`, icon: 'https://image.fulllinkai.com/202211/22/856342e56bb52f62aaf865d4bf37c0f2.png', rightValue: 'mobile', toPath: '/pages/user/bindMobile', buttonType: ''},
|
||||||
|
{title: '测量记录', icon: 'https://image.fulllinkai.com/202211/22/856424fce58d0862b88a5d3b4adb0bfa.png', rightValue: '', toPath: '/pages/user/measuringRecord', buttonType: ''},
|
||||||
|
{title: '我的订单', icon: 'https://image.fulllinkai.com/202301/09/940f1b6891b98e0cf473a1cfa61ab54c.png', rightValue: '', toPath: '/pages/user/myOrder', buttonType: ''}
|
||||||
|
// {title: '我的用户', icon: 'https://image.fulllinkai.com/202301/09/4a32f53440534e3f616045cbd003b7f7.png', rightValue: '', toPath: '/pages/user/myUser', buttonType: ''}
|
||||||
|
],
|
||||||
|
listV2: [
|
||||||
|
// {title: '体检报告', icon: 'https://image.fulllinkai.com/202306/09/cd248ca8d4e189b9a9f764c068a7d88f.png', rightValue: '', toPath: '/pages/service/healthMGT?index=2', buttonType: ''},
|
||||||
|
{title: '运动记录', icon: 'https://image.fulllinkai.com/202401/04/aa1532d927a97995927795388970a2fd.png', rightValue: '', toPath: '/pages/user/motionRecord', buttonType: ''},
|
||||||
|
{title: '个人信息', icon: 'https://image.fulllinkai.com/202306/09/f7b997ee48e0eb919db148a9df521852.png', rightValue: '', toPath: '/pages/service/healthMGT?index=0', buttonType: ''},
|
||||||
|
{title: '数据统计', icon: 'https://image.fulllinkai.com/202306/09/f32c85e6ed075f39bef031bd83734eec.png', rightValue: '', toPath: '', buttonType: ''},
|
||||||
|
{title: '数据对比', icon: 'https://image.fulllinkai.com/202402/29/d075710849525aff0f4f941cc4869fae.png', rightValue: '', toPath: '/pages/service/statistics', buttonType: ''}
|
||||||
|
],
|
||||||
|
wxTypeList: [
|
||||||
|
{title: '联系我们', icon: 'https://image.fulllinkai.com/202212/03/ede80096c152293a9817b95082c39dc9.png', rightValue: '', toPath: '', buttonType: 'contact'},
|
||||||
|
{title: '意见反馈', icon: 'https://image.fulllinkai.com/202212/03/e9869752fa7f375f30f4113cebde2448.png', rightValue: '', toPath: '', buttonType: 'feedback'},
|
||||||
|
{title: '语言设置', icon: 'https://image.fulllinkai.com/202308/10/b6b3e32922b8ac36e83b6faf71dd7650.png', rightValue: '', toPath: '/pages/user/languageSettings', buttonType: ''}
|
||||||
|
],
|
||||||
|
userInfo: {
|
||||||
|
mobile: ''
|
||||||
|
},
|
||||||
|
registerState: true,
|
||||||
|
showLogin: false,
|
||||||
|
subscribe: [], // 订阅id
|
||||||
|
isMotionRecord: '3', // 微信步数是否通过审核
|
||||||
|
showMotionRecord: false, // 微信步数审核弹窗
|
||||||
|
rejectReason: ''
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
getSubscribe() {
|
||||||
|
let vm = this
|
||||||
|
vm.$showLoading('')
|
||||||
|
vm.$get({url: `${service.host}/get/subscribe/template/id`}).then(({code, data}) => {
|
||||||
|
setTimeout(() => {
|
||||||
|
wx.hideLoading()
|
||||||
|
}, 500)
|
||||||
|
vm.subscribe.push(data.step_submit_notice) // 微信步数通知
|
||||||
|
vm.subscribe.push('_aJLlK-mh_a2nKobQHPhl1OQXFFaM8lwj-355HR8A5g') // 订单通知
|
||||||
|
// vm.subscribe.push(data.task_notice)
|
||||||
|
console.log(vm.subscribe, '***************-*-')
|
||||||
|
}).catch(err => {
|
||||||
|
wx.hideLoading()
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 选择测量单位
|
||||||
|
chooseUnit() {
|
||||||
|
if (!this.registerState) {
|
||||||
|
this.showLogin = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!this.throttling) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (this.userInfo.unitType === 'kg') {
|
||||||
|
this.userInfo.unitType = `${this.i18nL.pages.tabBar.user.user1ace8}`
|
||||||
|
wx.setStorageSync('userInfo', this.userInfo)
|
||||||
|
this.changeUnit(`${this.i18nL.pages.tabBar.user.user1ace8}`)
|
||||||
|
} else {
|
||||||
|
this.userInfo.unitType = 'kg'
|
||||||
|
wx.setStorageSync('userInfo', this.userInfo)
|
||||||
|
this.changeUnit('kg')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
previewImageV2(image) { // 预览单图
|
||||||
|
console.log(image)
|
||||||
|
this.$previewImage(image)
|
||||||
|
},
|
||||||
|
// 跳转地址和未登录弹窗
|
||||||
|
goToDetail(item) {
|
||||||
|
if (!this.registerState) {
|
||||||
|
this.showLogin = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!item) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (this.userInfo.order_status === 'NOORDER' && item == '/pages/user/measuringRecord') {
|
||||||
|
wx.showModal({ // 使用模态框提示用户进行操作
|
||||||
|
title: `${this.i18nL.pages.tabBar.user.user1ace13}`,
|
||||||
|
content: `${this.i18nL.pages.tabBar.user.user1ace14}`,
|
||||||
|
cancelText: `${this.i18nL.appWpy.cancelText}`,
|
||||||
|
confirmText: `${this.i18nL.pages.tabBar.user.user1ace15}`,
|
||||||
|
success: function (res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
wx.navigateTo({url: `/pages/service/detail`})
|
||||||
|
console.log('用户点击确定')
|
||||||
|
} else if (res.cancel) {
|
||||||
|
console.log('用户点击取消')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.$goto(item)
|
||||||
|
},
|
||||||
|
jumpPath(url) {
|
||||||
|
let vm = this
|
||||||
|
// 点击进入微信运动步数,授权订阅通知
|
||||||
|
if (url == '/pages/user/motionRecord') {
|
||||||
|
console.log(vm.isMotionRecord, 'vm.isMotionRecord -')
|
||||||
|
if (vm.isMotionRecord != '1') {
|
||||||
|
vm.showMotionRecord = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
vm.$getsubscription(vm.subscribe).then((res) => {
|
||||||
|
vm.$goto(url)
|
||||||
|
}).catch(() => {
|
||||||
|
vm.$goto(url)
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!this.registerState) {
|
||||||
|
this.showLogin = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (this.userInfo.order_status === 'NOORDER' && url == '/pages/service/statistics') {
|
||||||
|
wx.showModal({ // 使用模态框提示用户进行操作
|
||||||
|
title: `${this.i18nL.pages.tabBar.user.user1ace13}`,
|
||||||
|
content: `${this.i18nL.pages.tabBar.user.user1ace14}`,
|
||||||
|
cancelText: `${this.i18nL.appWpy.cancelText}`,
|
||||||
|
confirmText: `${this.i18nL.pages.tabBar.user.user1ace15}`,
|
||||||
|
success: function (res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
wx.navigateTo({url: `/pages/service/detail`})
|
||||||
|
console.log('用户点击确定')
|
||||||
|
} else if (res.cancel) {
|
||||||
|
console.log('用户点击取消')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.$goto(url)
|
||||||
|
},
|
||||||
|
// 测量单位提交
|
||||||
|
changeUnit(e) {
|
||||||
|
let vm = this
|
||||||
|
let data = {
|
||||||
|
unit: e
|
||||||
|
}
|
||||||
|
vm.$showLoading(`${vm.i18nL.pages.tabBar.user.user1ace22}`)
|
||||||
|
vm.$put({url: service.saveBaseData, data})
|
||||||
|
.then(res => {
|
||||||
|
if (res.code === 0) {
|
||||||
|
vm.$showToast(`${this.i18nL.pages.tabBar.user.user1ace17}`)
|
||||||
|
}
|
||||||
|
wx.setStorageSync('switchUnit', '1')
|
||||||
|
vm.throttling = true
|
||||||
|
setTimeout(() => {
|
||||||
|
wx.hideLoading()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 获取是否订阅
|
||||||
|
viewAttention () {
|
||||||
|
let vm = this
|
||||||
|
vm.$get({url: service.saveBaseData}).then(({code, data}) => {
|
||||||
|
if (code === 0) {
|
||||||
|
if (data.is_subscribe) {
|
||||||
|
vm.showService = false
|
||||||
|
vm.showSubscribe = false
|
||||||
|
wx.removeStorageSync('showService')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).catch(err => {
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 登录
|
||||||
|
gotoLogin() {
|
||||||
|
console.log('123210-00')
|
||||||
|
this.showLogin = false
|
||||||
|
wx.removeStorageSync('loginStatus')
|
||||||
|
utils.wx_login().then((data) => {
|
||||||
|
const new_registerState = wx.getStorageSync('is_complete_profile') === false ? true : false
|
||||||
|
if (!wx.getStorageSync('mobile')) {
|
||||||
|
wx.hideLoading()
|
||||||
|
this.$goto('/pages/login')
|
||||||
|
} else if (new_registerState) {
|
||||||
|
wx.hideLoading()
|
||||||
|
this.$goto('/pages/user/registrationMaterial')
|
||||||
|
} else {
|
||||||
|
this.$showLoading(`${this.i18nL.pages.tabBar.user.user1ace18}`)
|
||||||
|
setTimeout(() => {
|
||||||
|
wx.hideLoading()
|
||||||
|
this.$gotoTab('/pages/tabBar/home')
|
||||||
|
}, 600)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
hideModal() {
|
||||||
|
this.showService = !this.showService
|
||||||
|
if (this.showService) {
|
||||||
|
wx.setStorageSync('showService', 1)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
switchScale() {
|
||||||
|
if (!this.registerState) {
|
||||||
|
this.showLogin = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.modalName = 'bindModal'
|
||||||
|
},
|
||||||
|
// 取消绑定弹框
|
||||||
|
closeFn() {
|
||||||
|
this.modalName = ''
|
||||||
|
},
|
||||||
|
goToWeXin() {
|
||||||
|
if (!this.registerState) {
|
||||||
|
this.showLogin = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.$goToService()
|
||||||
|
},
|
||||||
|
getStepStatus() {
|
||||||
|
let vm = this
|
||||||
|
vm.$get({url: `${service.host}/get/my/info`}).then(({code, data}) => {
|
||||||
|
if (code == 0) {
|
||||||
|
if (!data.step_apply_status && data.step_apply_status != 0) { // 没有值给3判断
|
||||||
|
vm.isMotionRecord = '3'
|
||||||
|
} else {
|
||||||
|
vm.isMotionRecord = data.step_apply_status + ''
|
||||||
|
}
|
||||||
|
vm.rejectReason = data.step_reject_reason
|
||||||
|
console.log(vm.rejectReason, 'vm.rejectReason====')
|
||||||
|
}
|
||||||
|
// if (code === 0) {
|
||||||
|
// if (data.is_subscribe) {
|
||||||
|
// vm.showService = false
|
||||||
|
// vm.showSubscribe = false
|
||||||
|
// wx.removeStorageSync('showService')
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}).catch(err => {
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
toAudit() { // 提交微信步数审核
|
||||||
|
let vm = this
|
||||||
|
vm.$showLoading(`${vm.i18nL.pages.tabBar.user.user1ace23}`)
|
||||||
|
vm.$post({url: `${service.host}/step/apply`})
|
||||||
|
.then(res => {
|
||||||
|
vm.showMotionRecord = false
|
||||||
|
wx.showToast({
|
||||||
|
title: `${this.i18nL.pages.tabBar.user.user1ace33}`,
|
||||||
|
icon: 'success',
|
||||||
|
duration: 800
|
||||||
|
})
|
||||||
|
vm.getStepStatus()
|
||||||
|
// vm.throttling = true
|
||||||
|
// setTimeout(() => {
|
||||||
|
// wx.hideLoading()
|
||||||
|
// })
|
||||||
|
}).catch(() => {
|
||||||
|
|
||||||
|
}).finally(() => {
|
||||||
|
wx.hideLoading()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
hideModalV2() {
|
||||||
|
this.showMotionRecord = !this.showMotionRecord
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onShareAppMessage() {
|
||||||
|
return {
|
||||||
|
title: `${this.i18nL.pages.tabBar.user.user1ace20}`,
|
||||||
|
path: `/pages/tabBar/home?from_user_id=${wx.getStorageSync('user_id')}`,
|
||||||
|
imageUrl: 'https://image.fulllinkai.com/202212/03/4fd3187e97528415ee23aa6c6d353e7b.png',
|
||||||
|
success: function(res) {
|
||||||
|
wx.showToast({
|
||||||
|
title: `${this.i18nL.pages.tabBar.user.user1ace21}`,
|
||||||
|
icon: 'success',
|
||||||
|
duration: 1500
|
||||||
|
})
|
||||||
|
var shareTickets = res.shareTickets
|
||||||
|
if (shareTickets.length == 0) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: function(res) {
|
||||||
|
// 转发失败
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad() {},
|
||||||
|
onShow() {
|
||||||
|
this.versions = this.$app.$options.globalData.versions
|
||||||
|
this.i18nL = this.$app.$options.globalData.i18nL // 切换赋值- 娄底
|
||||||
|
this.$setNavigationBarTitleI18n(this.i18nL.pages.tabBar.user.title) // 设置顶部title
|
||||||
|
this.$setTabBarItemI18n() // 设置tabBar - i18n
|
||||||
|
this.userInfo = wx.getStorageSync('userInfo') || {mobile: ''}
|
||||||
|
this.userInfo.mobile = wx.getStorageSync('mobile') || ''
|
||||||
|
this.registerState = this.userInfo.is_complete_profile
|
||||||
|
this.statisticsWebUrl = `/pages/sub_page/bookDetail?url=${encodeURIComponent(`https://health.ufutx.com/work/#/h5/mpStatistics?id=${wx.getStorageSync('user_id')}`)}`
|
||||||
|
this.list[0].title = `${this.i18nL.pages.tabBar.user.list.mobile}`
|
||||||
|
this.list[1].title = `${this.i18nL.pages.tabBar.user.list.measureLog}`
|
||||||
|
this.list[2].title = `${this.i18nL.pages.tabBar.user.list.myOrder}`
|
||||||
|
this.listV2[0].title = `${this.i18nL.pages.tabBar.user.listV2.listV2ace3}`
|
||||||
|
this.listV2[1].title = `${this.i18nL.pages.tabBar.user.listV2.listV2ace1}`
|
||||||
|
this.listV2[2].title = `${this.i18nL.pages.tabBar.user.listV2.listV2ace2}`
|
||||||
|
this.listV2[2].toPath = this.statisticsWebUrl
|
||||||
|
console.log(this.listV2[2].toPath)
|
||||||
|
this.listV2[3].title = `${this.i18nL.pages.service.statistics.v7}`
|
||||||
|
this.wxTypeList[0].title = `${this.i18nL.pages.tabBar.user.wxTypeList.wxTypeList1ace1}`
|
||||||
|
this.wxTypeList[1].title = `${this.i18nL.pages.tabBar.user.wxTypeList.wxTypeList1ace2}`
|
||||||
|
this.wxTypeList[2].title = `${this.i18nL.pages.tabBar.user.wxTypeList.wxTypeList1ace3}`
|
||||||
|
if (wx.getStorageSync('showService')) {
|
||||||
|
this.viewAttention()
|
||||||
|
}
|
||||||
|
let capsule = wx.getMenuButtonBoundingClientRect()
|
||||||
|
this.navTop = capsule.top
|
||||||
|
this.getStepStatus()
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getSubscribe()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<config>
|
||||||
|
{
|
||||||
|
navigationBarTitleText: '我的',
|
||||||
|
navigationStyle: 'custom',
|
||||||
|
enablePullDownRefresh: false,
|
||||||
|
backgroundColorTop: '#F4F7FC',
|
||||||
|
backgroundColorBottom: '#F4F7FC',
|
||||||
|
usingComponents: {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</config>
|
||||||
39
src/pages/tabBar/welcome.wpy
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<style lang="less">
|
||||||
|
page {
|
||||||
|
background-color: #F8F8F8 !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<template>
|
||||||
|
<view></view>
|
||||||
|
</template>
|
||||||
|
<!--x-->
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import wepy from '@wepy/core'
|
||||||
|
import https from '../../mixins/https'
|
||||||
|
import base from '../../mixins/base'
|
||||||
|
|
||||||
|
wepy.page({
|
||||||
|
config: {},
|
||||||
|
mixins: [https, base],
|
||||||
|
|
||||||
|
data: {},
|
||||||
|
watch: {},
|
||||||
|
methods: {},
|
||||||
|
onLoad() {},
|
||||||
|
onShow() {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.$gotoTab('/pages/tabBar/home')
|
||||||
|
}, 1000)
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<config>
|
||||||
|
{
|
||||||
|
navigationBarTitleText: '加载中...',
|
||||||
|
navigationBarBackgroundColor: '#f8f8f8',
|
||||||
|
enablePullDownRefresh: true,
|
||||||
|
}
|
||||||
|
</config>
|
||||||
95
src/pages/user/test.wpy
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
<style lang="less" scoped>
|
||||||
|
@import url(../../styles/theme.less);
|
||||||
|
page {
|
||||||
|
background-color: #f8f8f8;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<template>
|
||||||
|
<view class="ui-test"></view>
|
||||||
|
<pageScroll ref="pageScroll"></pageScroll>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import wepy from '@wepy/core'
|
||||||
|
import https from '../../mixins/https'
|
||||||
|
import base from '../../mixins/base'
|
||||||
|
import {service} from '../../config'
|
||||||
|
|
||||||
|
wepy.page({
|
||||||
|
config: {},
|
||||||
|
mixins: [https, base],
|
||||||
|
|
||||||
|
data: {
|
||||||
|
no_more: false,
|
||||||
|
loading: false,
|
||||||
|
page: 1,
|
||||||
|
list: [] // 列表数据
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getList() {
|
||||||
|
let vm = this
|
||||||
|
let data = {
|
||||||
|
page: vm.page
|
||||||
|
}
|
||||||
|
vm.$showLoading('加载中...')
|
||||||
|
vm.$get({url: `${service.host}/friend/request/logs/v2`, data}).then(({code, data}) => {
|
||||||
|
if (code === 0) {
|
||||||
|
if (vm.list.length === 0 || vm.page === 1) {
|
||||||
|
vm.list = data.data
|
||||||
|
} else {
|
||||||
|
data.data.map(function (item) {
|
||||||
|
vm.list.push(item)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (vm.list.length < 15 || data.data.length < 15) {
|
||||||
|
vm.no_more = true
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
vm.loading = true
|
||||||
|
}, 500)
|
||||||
|
vm.page++
|
||||||
|
}
|
||||||
|
wx.hideLoading()
|
||||||
|
}).catch(err => {
|
||||||
|
wx.hideLoading()
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 上拉获取更多数据
|
||||||
|
onReachBottom() {
|
||||||
|
let vm = this
|
||||||
|
if (!vm.no_more) {
|
||||||
|
vm.getList()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 下拉刷新
|
||||||
|
onPullDownRefresh() {
|
||||||
|
let vm = this
|
||||||
|
vm.page = 1
|
||||||
|
vm.no_more = false
|
||||||
|
vm.getList()
|
||||||
|
},
|
||||||
|
onPageScroll(res) {
|
||||||
|
let vm = this
|
||||||
|
let top = res.scrollTop
|
||||||
|
vm.$refs.pageScroll.showBackTopBtn = top > 380
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
this.getList()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<config>
|
||||||
|
{
|
||||||
|
navigationBarTitleText: '优质单身',
|
||||||
|
enablePullDownRefresh: true,
|
||||||
|
backgroundColorTop: '#f8f8f8',
|
||||||
|
backgroundColorBottom: '#f8f8f8',
|
||||||
|
usingComponents: {
|
||||||
|
pageScroll: '~@/components/pageScroll'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</config>
|
||||||
28
src/store/index.js
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import Vuex from '@wepy/x';
|
||||||
|
|
||||||
|
export default new Vuex.Store({
|
||||||
|
state: {
|
||||||
|
counter: 0
|
||||||
|
},
|
||||||
|
mutations: {
|
||||||
|
increment (state) {
|
||||||
|
state.counter++;
|
||||||
|
},
|
||||||
|
decrement (state) {
|
||||||
|
state.counter--;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
increment ({ commit }) {
|
||||||
|
commit('increment');
|
||||||
|
},
|
||||||
|
decrement ({ commit }) {
|
||||||
|
commit('decrement');
|
||||||
|
},
|
||||||
|
incrementAsync ({ commit }) {
|
||||||
|
setTimeout(() => {
|
||||||
|
commit('increment');
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
184
src/styles/animation.wxss
Normal file
@ -0,0 +1,184 @@
|
|||||||
|
/*
|
||||||
|
Animation 微动画
|
||||||
|
基于ColorUI组建库的动画模块 by Mamba 2022年11月21日12:52:28
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* css 滤镜 控制黑白底色gif的 */
|
||||||
|
.gif-black{
|
||||||
|
mix-blend-mode: screen;
|
||||||
|
}
|
||||||
|
.gif-white{
|
||||||
|
mix-blend-mode: multiply;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Animation css */
|
||||||
|
[class*=animation-] {
|
||||||
|
animation-duration: .5s;
|
||||||
|
animation-timing-function: ease-out;
|
||||||
|
animation-fill-mode: both
|
||||||
|
}
|
||||||
|
|
||||||
|
.animation-fade {
|
||||||
|
animation-name: fade;
|
||||||
|
animation-duration: .8s;
|
||||||
|
animation-timing-function: linear
|
||||||
|
}
|
||||||
|
|
||||||
|
.animation-scale-up {
|
||||||
|
animation-name: scale-up
|
||||||
|
}
|
||||||
|
|
||||||
|
.animation-scale-down {
|
||||||
|
animation-name: scale-down
|
||||||
|
}
|
||||||
|
|
||||||
|
.animation-slide-top {
|
||||||
|
animation-name: slide-top
|
||||||
|
}
|
||||||
|
|
||||||
|
.animation-slide-bottom {
|
||||||
|
animation-name: slide-bottom
|
||||||
|
}
|
||||||
|
|
||||||
|
.animation-slide-left {
|
||||||
|
animation-name: slide-left
|
||||||
|
}
|
||||||
|
|
||||||
|
.animation-slide-right {
|
||||||
|
animation-name: slide-right
|
||||||
|
}
|
||||||
|
|
||||||
|
.animation-shake {
|
||||||
|
animation-name: shake
|
||||||
|
}
|
||||||
|
|
||||||
|
.animation-reverse {
|
||||||
|
animation-direction: reverse
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes fade {
|
||||||
|
0% {
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
100% {
|
||||||
|
opacity: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes scale-up {
|
||||||
|
0% {
|
||||||
|
opacity: 0;
|
||||||
|
transform: scale(.2)
|
||||||
|
}
|
||||||
|
|
||||||
|
100% {
|
||||||
|
opacity: 1;
|
||||||
|
transform: scale(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes scale-down {
|
||||||
|
0% {
|
||||||
|
opacity: 0;
|
||||||
|
transform: scale(1.8)
|
||||||
|
}
|
||||||
|
|
||||||
|
100% {
|
||||||
|
opacity: 1;
|
||||||
|
transform: scale(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes slide-top {
|
||||||
|
0% {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(-100%)
|
||||||
|
}
|
||||||
|
|
||||||
|
100% {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateY(0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes slide-bottom {
|
||||||
|
0% {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(100%)
|
||||||
|
}
|
||||||
|
|
||||||
|
100% {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateY(0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes shake {
|
||||||
|
|
||||||
|
0%,
|
||||||
|
100% {
|
||||||
|
transform: translateX(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
10% {
|
||||||
|
transform: translateX(-9px)
|
||||||
|
}
|
||||||
|
|
||||||
|
20% {
|
||||||
|
transform: translateX(8px)
|
||||||
|
}
|
||||||
|
|
||||||
|
30% {
|
||||||
|
transform: translateX(-7px)
|
||||||
|
}
|
||||||
|
|
||||||
|
40% {
|
||||||
|
transform: translateX(6px)
|
||||||
|
}
|
||||||
|
|
||||||
|
50% {
|
||||||
|
transform: translateX(-5px)
|
||||||
|
}
|
||||||
|
|
||||||
|
60% {
|
||||||
|
transform: translateX(4px)
|
||||||
|
}
|
||||||
|
|
||||||
|
70% {
|
||||||
|
transform: translateX(-3px)
|
||||||
|
}
|
||||||
|
|
||||||
|
80% {
|
||||||
|
transform: translateX(2px)
|
||||||
|
}
|
||||||
|
|
||||||
|
90% {
|
||||||
|
transform: translateX(-1px)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes slide-left {
|
||||||
|
0% {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateX(-100%)
|
||||||
|
}
|
||||||
|
|
||||||
|
100% {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateX(0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes slide-right {
|
||||||
|
0% {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateX(100%)
|
||||||
|
}
|
||||||
|
|
||||||
|
100% {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateX(0)
|
||||||
|
}
|
||||||
|
}
|
||||||
179
src/styles/flex.wxss
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
.relative {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.absolute {
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fixed {
|
||||||
|
position: fixed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fixed-bottom {
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
position: fixed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.inline-block {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hide {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.show {
|
||||||
|
display: block !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.autowrap {
|
||||||
|
word-wrap: break-word;
|
||||||
|
word-break: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-center {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-right {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.over-hidden {
|
||||||
|
overflow: hidden !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scroll-y {
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 小曲的样式 */
|
||||||
|
.min100 {
|
||||||
|
min-height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.w100 {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.h100 {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.line-1 {
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 两行超出显示省略号 */
|
||||||
|
.line-2 {
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
display: -webkit-box;
|
||||||
|
-webkit-line-clamp: 2;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex {
|
||||||
|
justify-content: space-between;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex_l {
|
||||||
|
justify-content: flex-start;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex_r {
|
||||||
|
justify-content: flex-end;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.center {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex1 {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex-inline {
|
||||||
|
display: inline-flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex::before, .flex::after, .flex-inline::before, .flex-inline::after {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex-left {
|
||||||
|
justify-content: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex-center {
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex-right {
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex-between {
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex-around {
|
||||||
|
justify-content: space-around;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex-stretch {
|
||||||
|
align-items: stretch;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex-top {
|
||||||
|
align-items: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex-middle {
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex-bottom {
|
||||||
|
align-items: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex-row {
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex-row-reverse {
|
||||||
|
flex-direction: row-reverse;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex-column {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex-column-reverse {
|
||||||
|
flex-direction: column-reverse;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex-nowrap {
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex-wrap {
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex-wrap-reverse {
|
||||||
|
flex-wrap: wrap-reverse;
|
||||||
|
}
|
||||||
68
src/styles/index.less
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
@import url(./theme.less);
|
||||||
|
@import url(./reset.less);
|
||||||
|
@import url(./flex.wxss);
|
||||||
|
@import url(./animation.wxss);
|
||||||
|
@import url(./main.wxss);
|
||||||
|
|
||||||
|
@colors: black, white, gray-1, gray-2, gray-3, gray-4, red, blue, yellow;
|
||||||
|
each(@colors, {
|
||||||
|
.@{value} {
|
||||||
|
color: @@value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
each(@colors, {
|
||||||
|
.bg-@{value} {
|
||||||
|
background-color: @@value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
each(range(10, 100, 2), {
|
||||||
|
.size-@{value} {
|
||||||
|
font-size: @value*1rpx;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
each(range(5, 30, 5), {
|
||||||
|
.radius-@{value} {
|
||||||
|
border-radius: @value*1rpx;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
each(range(100), {
|
||||||
|
.pd-@{value}, .ptb-@{value}, .pt-@{value} {
|
||||||
|
padding-top: @value*1rpx;
|
||||||
|
}
|
||||||
|
.pd-@{value}, .ptb-@{value}, .pb-@{value} {
|
||||||
|
padding-bottom: @value*1rpx;
|
||||||
|
}
|
||||||
|
.pd-@{value}, .plr-@{value}, .pl-@{value} {
|
||||||
|
padding-left: @value*1rpx;
|
||||||
|
}
|
||||||
|
.pd-@{value}, .plr-@{value}, .pr-@{value} {
|
||||||
|
padding-right: @value*1rpx;
|
||||||
|
}
|
||||||
|
.mg-@{value}, .mtb-@{value}, .mt-@{value} {
|
||||||
|
margin-top: @value*1rpx;
|
||||||
|
}
|
||||||
|
.mg-@{value}, .mtb-@{value}, .mb-@{value} {
|
||||||
|
margin-bottom: @value*1rpx;
|
||||||
|
}
|
||||||
|
.mg-@{value}, .mlr-@{value}, .ml-@{value} {
|
||||||
|
margin-left: @value*1rpx;
|
||||||
|
}
|
||||||
|
.mg-@{value}, .mlr-@{value}, .mr-@{value} {
|
||||||
|
margin-right: @value*1rpx;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
each(range(12), {
|
||||||
|
.flex-@{value} {
|
||||||
|
flex: @value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
.bg {
|
||||||
|
background-color: @gray-5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bold {
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
3990
src/styles/main.wxss
Normal file
1000
src/styles/reset.less
Normal file
18
src/styles/theme.less
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
// less变量
|
||||||
|
|
||||||
|
// 定义主题色
|
||||||
|
|
||||||
|
@theme_color: #5ac7a0;
|
||||||
|
@black: #000;
|
||||||
|
@white: #fff;
|
||||||
|
@gray-1: #333;
|
||||||
|
@gray-2: #666;
|
||||||
|
@gray-3: #999;
|
||||||
|
@gray-4: #eee;
|
||||||
|
@gray-5: #f8f8f8;
|
||||||
|
@red: #E91010;
|
||||||
|
@yellow: #FB8D32;
|
||||||
|
@blue: #2E93FF;
|
||||||
|
// border
|
||||||
|
@border-color: @gray-4;
|
||||||
|
@border-width-base: 1rpx;
|
||||||
87
src/utils/comment.js
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
|
||||||
|
// 解释:聊天的时间逻辑
|
||||||
|
// 传递 timeValue的格式为 2021/03/24 13:56:00
|
||||||
|
// 如果数据是'2015-08-18 15:13:15';参考下述进行转换
|
||||||
|
// var str ='2015-08-18 15:13:15';
|
||||||
|
// str = str.replace(/-/g,"/");
|
||||||
|
// var date = new Date(str );
|
||||||
|
|
||||||
|
function timeChange(timeValue) {
|
||||||
|
// timeValue = timeValue.replace(/-/g, '/')
|
||||||
|
timeValue = new Date(timeValue).getTime()
|
||||||
|
var timeNew = new Date().getTime() // 当前时间
|
||||||
|
// console.log('传入的时间', timeValue, timeNew)
|
||||||
|
var timeDiffer = timeNew - timeValue // 与当前时间误差
|
||||||
|
// console.log('时间差', timeDiffer)
|
||||||
|
var returnTime = ''
|
||||||
|
if (timeDiffer <= 60000) { // 一分钟内
|
||||||
|
returnTime = '刚刚'
|
||||||
|
} else if (timeDiffer > 60000 && timeDiffer < 3600000) { // 1小时内
|
||||||
|
returnTime = Math.floor(timeDiffer / 60000) + '分钟前'
|
||||||
|
} else if (timeDiffer >= 3600000 && timeDiffer < 86400000 && isYestday(timeValue) === false) { // 今日
|
||||||
|
returnTime = formatTime(timeValue).substr(11, 5)
|
||||||
|
} else if (timeDiffer > 3600000 && isYestday(timeValue) === true) { // 昨天
|
||||||
|
// console.log(昨天)
|
||||||
|
returnTime = '昨天' + formatTime(timeValue).substr(11, 5)
|
||||||
|
} else if (timeDiffer > 86400000 && isYestday(timeValue) === false && isYear(timeValue) === true) { // 今年
|
||||||
|
returnTime = formatTime(timeValue).substr(5, 11)
|
||||||
|
} else if (timeDiffer > 86400000 && isYestday(timeValue) === false && isYear(timeValue) === false) { // 不属于今年
|
||||||
|
returnTime = formatTime(timeValue).substr(0, 16)
|
||||||
|
}
|
||||||
|
// console.log(returnTime)
|
||||||
|
return returnTime
|
||||||
|
}
|
||||||
|
|
||||||
|
// 函数isYestday:是否为昨天 返回 true or false
|
||||||
|
// 这里根据日期进行判断,而非时间戳数值,因为数值计算涉及到大数有一定的误差
|
||||||
|
|
||||||
|
function isYestday(timeValue) { // 是否为昨天
|
||||||
|
const date = new Date(timeValue)
|
||||||
|
const today = new Date()
|
||||||
|
if (date.getFullYear() === today.getFullYear() && date.getMonth() === today.getMonth()) {
|
||||||
|
if (date.getDate() - today.getDate() === 1) {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function isYear(timeValue) { // 是否为今年
|
||||||
|
const dateyear = new Date(timeValue).getFullYear()
|
||||||
|
const toyear = new Date().getFullYear()
|
||||||
|
// console.log(dateyear, toyear)
|
||||||
|
if (dateyear === toyear) {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 函数:formatTime 格式化时间 返回时间字符串如 2018-07-06 11:11:37
|
||||||
|
function formatTime(date) {
|
||||||
|
var t = getTimeArray(date)
|
||||||
|
return [t[0], t[1], t[2]].map(formatNumber).join('-') + ' ' + [t[3], t[4], t[5]].map(formatNumber).join(':')
|
||||||
|
}
|
||||||
|
|
||||||
|
function getTimeArray(date) {
|
||||||
|
date = new Date(date)
|
||||||
|
var year = date.getFullYear()
|
||||||
|
var month = date.getMonth() + 1
|
||||||
|
var day = date.getDate()
|
||||||
|
var hour = date.getHours()
|
||||||
|
var minute = date.getMinutes()
|
||||||
|
var second = date.getSeconds()
|
||||||
|
return [year, month, day, hour, minute, second].map(formatNumber)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 转化日期 如2018-7-6 -->(2018-07-06)
|
||||||
|
function formatNumber(n) {
|
||||||
|
n = n.toString()
|
||||||
|
return n[1] ? n : '0' + n
|
||||||
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
|
timeChange
|
||||||
|
}
|
||||||
172
src/utils/dateTimeFormat.js
Normal file
@ -0,0 +1,172 @@
|
|||||||
|
// 循环处理时间
|
||||||
|
import dayjs from 'dayjs'
|
||||||
|
|
||||||
|
const dateTimeFormat = (arr, key) => {
|
||||||
|
/**
|
||||||
|
* 参数
|
||||||
|
* arr:数据数组
|
||||||
|
* key:数组中对象的时间key键。
|
||||||
|
* 新增属性
|
||||||
|
* show_time_type:时间的类型
|
||||||
|
* show_time:页面展示输出的时间
|
||||||
|
* is_show_time:间隔上个时间是否大于5分钟,大于则显示当前时间,反之。
|
||||||
|
**/
|
||||||
|
// function checkShowRule(arr, key) {
|
||||||
|
var newArr = arr.map((item, index, array) => {
|
||||||
|
var obj = toggleTime(item[key])
|
||||||
|
item['show_time_type'] = obj.type
|
||||||
|
item['show_time'] = obj.time
|
||||||
|
if (index > 0) {
|
||||||
|
item['is_show_time'] = compareTimeInterval(array[index - 1][key], array[index][key])
|
||||||
|
} else {
|
||||||
|
item['is_show_time'] = true
|
||||||
|
}
|
||||||
|
return item
|
||||||
|
})
|
||||||
|
return newArr
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 根据不同时间的消息,输出不同的时间格式
|
||||||
|
function toggleTime(date) {
|
||||||
|
var time
|
||||||
|
var type = getDateDiff(date)
|
||||||
|
// 1:新消息,2:当天消息,3:昨天消息,4:今年消息,5:其他消息
|
||||||
|
if (type == 1) {
|
||||||
|
time = '以下为最新消息'// 新消息,不显示时间,但是要显示"以下为最新消息"
|
||||||
|
} else if (type == 2) {
|
||||||
|
time = dayjs(date).format('H:mm')// 当天消息,显示:10:22
|
||||||
|
} else if (type == 3) {
|
||||||
|
time = dayjs(date).format('昨天 H:mm')// 昨天消息,显示:昨天 20:41
|
||||||
|
} else if (type == 4) {
|
||||||
|
time = dayjs(date).format('M月D日 AH:mm').replace('AM', '上午').replace('PM', '下午')// 今年消息,上午下午,显示:3月17日 下午16:45
|
||||||
|
} else if (type == 5) {
|
||||||
|
time = dayjs(date).format('YYYY年M月D日 AH:mm').replace('AM', '上午').replace('PM', '下午')// 其他消息,上午下午,显示:2020年11月2日 下午15:17
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
time: time,
|
||||||
|
type: type
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 判断消息类型
|
||||||
|
function getDateDiff(date) {
|
||||||
|
var nowDate = dayjs(new Date())// 当前时间
|
||||||
|
var oldDate = dayjs(new Date(date))// 参数时间
|
||||||
|
var timeTemp = dayjs(getThisTime().now.split(' ')[0] + '00:00').diff(oldDate, 'hour')
|
||||||
|
var result
|
||||||
|
// 优先判断昨天消息。今年的日期00:00的时间与上一个时间的时间戳小于1天,那就判断为昨天消息
|
||||||
|
if ((nowDate.year() - oldDate.year() == 1 || nowDate.month() - oldDate.month() == 1) && timeTemp >= 0 && timeTemp <= 24) {
|
||||||
|
result = 3
|
||||||
|
} else if (nowDate.year() - oldDate.year() >= 1) {
|
||||||
|
result = 5
|
||||||
|
} else if (nowDate.month() - oldDate.month() >= 1 || nowDate.date() - oldDate.date() >= 2) {
|
||||||
|
result = 4
|
||||||
|
} else if (nowDate.date() - oldDate.date() >= 1) {
|
||||||
|
result = 3
|
||||||
|
} else if (nowDate.hour() - oldDate.hour() >= 1 || nowDate.minute() - oldDate.minute() >= 5) {
|
||||||
|
result = 2
|
||||||
|
} else {
|
||||||
|
result = 1
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
// 判断两个时间差是否大于5分钟
|
||||||
|
function compareTimeInterval(t1, t2) {
|
||||||
|
// console.log(t1,t2,dayjs(t2)-dayjs(t1));
|
||||||
|
return dayjs(t2) - dayjs(t1) >= 300000 ? true : false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取当前时间,当前日期
|
||||||
|
function getThisTime(timeStamp) {
|
||||||
|
var myDate = timeStamp ? new Date(parseInt(timeStamp) * 1000) : new Date()
|
||||||
|
|
||||||
|
function p(s) {
|
||||||
|
return s < 10 ? '0' + s : s
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
'year': myDate.getFullYear(),
|
||||||
|
'month': myDate.getMonth() + 1,
|
||||||
|
'date': myDate.getDate(),
|
||||||
|
'h': myDate.getHours(),
|
||||||
|
'm': myDate.getMinutes(),
|
||||||
|
's': myDate.getSeconds(),
|
||||||
|
'now': myDate.getFullYear() + '-' + p(myDate.getMonth() + 1) + '-' + p(myDate.getDate()) + ' ' + p(myDate.getHours()) + ':' + p(myDate.getMinutes()) + ':' + p(myDate.getSeconds())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const toggleTime = (date) => {
|
||||||
|
// 根据不同时间的消息,输出不同的时间格式
|
||||||
|
// function toggleTime() {
|
||||||
|
var time
|
||||||
|
var type = getDateDiff(date)
|
||||||
|
// 1:新消息,2:当天消息,3:昨天消息,4:今年消息,5:其他消息
|
||||||
|
if (type == 1) {
|
||||||
|
time = '以下为最新消息'// 新消息,不显示时间,但是要显示"以下为最新消息"
|
||||||
|
} else if (type == 2) {
|
||||||
|
time = dayjs(date).format('H:mm')// 当天消息,显示:10:22
|
||||||
|
} else if (type == 3) {
|
||||||
|
time = dayjs(date).format('昨天 H:mm')// 昨天消息,显示:昨天 20:41
|
||||||
|
} else if (type == 4) {
|
||||||
|
time = dayjs(date).format('M月D日 AH:mm').replace('AM', '上午').replace('PM', '下午')// 今年消息,上午下午,显示:3月17日 下午16:45
|
||||||
|
} else if (type == 5) {
|
||||||
|
time = dayjs(date).format('YYYY年M月D日 AH:mm').replace('AM', '上午').replace('PM', '下午')// 其他消息,上午下午,显示:2020年11月2日 下午15:17
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
time: time,
|
||||||
|
type: type
|
||||||
|
}
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 判断消息类型
|
||||||
|
function getDateDiff(date) {
|
||||||
|
var nowDate = dayjs(new Date())// 当前时间
|
||||||
|
var oldDate = dayjs(new Date(date))// 参数时间
|
||||||
|
var timeTemp = dayjs(getThisTime().now.split(' ')[0] + '00:00').diff(oldDate, 'hour')
|
||||||
|
var result
|
||||||
|
// 优先判断昨天消息。今年的日期00:00的时间与上一个时间的时间戳小于1天,那就判断为昨天消息
|
||||||
|
if ((nowDate.year() - oldDate.year() == 1 || nowDate.month() - oldDate.month() == 1) && timeTemp >= 0 && timeTemp <= 24) {
|
||||||
|
result = 3
|
||||||
|
} else if (nowDate.year() - oldDate.year() >= 1) {
|
||||||
|
result = 5
|
||||||
|
} else if (nowDate.month() - oldDate.month() >= 1 || nowDate.date() - oldDate.date() >= 2) {
|
||||||
|
result = 4
|
||||||
|
} else if (nowDate.date() - oldDate.date() >= 1) {
|
||||||
|
result = 3
|
||||||
|
} else if (nowDate.hour() - oldDate.hour() >= 1 || nowDate.minute() - oldDate.minute() >= 5) {
|
||||||
|
result = 2
|
||||||
|
} else {
|
||||||
|
result = 1
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
// 判断两个时间差是否大于5分钟
|
||||||
|
function compareTimeInterval(t1, t2) {
|
||||||
|
// console.log(t1,t2,dayjs(t2)-dayjs(t1));
|
||||||
|
return dayjs(t2) - dayjs(t1) >= 300000 ? true : false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取当前时间,当前日期
|
||||||
|
function getThisTime(timeStamp) {
|
||||||
|
var myDate = timeStamp ? new Date(parseInt(timeStamp) * 1000) : new Date()
|
||||||
|
|
||||||
|
function p(s) {
|
||||||
|
return s < 10 ? '0' + s : s
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
'year': myDate.getFullYear(),
|
||||||
|
'month': myDate.getMonth() + 1,
|
||||||
|
'date': myDate.getDate(),
|
||||||
|
'h': myDate.getHours(),
|
||||||
|
'm': myDate.getMinutes(),
|
||||||
|
's': myDate.getSeconds(),
|
||||||
|
'now': myDate.getFullYear() + '-' + p(myDate.getMonth() + 1) + '-' + p(myDate.getDate()) + ' ' + p(myDate.getHours()) + ':' + p(myDate.getMinutes()) + ':' + p(myDate.getSeconds())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
module.exports = {
|
||||||
|
dateTimeFormat, toggleTime
|
||||||
|
}
|
||||||
196
src/utils/im.js
Normal file
@ -0,0 +1,196 @@
|
|||||||
|
import NIM from 'nim-web-sdk-ng/dist/v2/NIM_MINIAPP_SDK'
|
||||||
|
import { service } from '../config.js'
|
||||||
|
|
||||||
|
const IM = (account, token) => {
|
||||||
|
console.log(account, token, '8888888888888888')
|
||||||
|
let nim = NIM.getInstance({
|
||||||
|
debugLevel: 'off',
|
||||||
|
appkey: '9bc3ed1f7d8197b6b69f8f5b742824b1',
|
||||||
|
account: account,
|
||||||
|
token: token,
|
||||||
|
lbsUrls: [
|
||||||
|
'https://lbs.netease.im/lbs/wxwebconf.jsp'
|
||||||
|
],
|
||||||
|
linkUrl: 'wlnimsc0.netease.im'
|
||||||
|
})
|
||||||
|
|
||||||
|
const eventList = [
|
||||||
|
'logined', 'willReconnect', 'disconnect', 'msg', 'syncdone', 'syncRoamingMsgs', 'sessions', 'updateMuteList', 'friends', 'updateSession', 'teams', 'myTeamMembers', 'updateMyMemberInfo', 'sendTeamMsg'
|
||||||
|
]
|
||||||
|
|
||||||
|
eventList.forEach((key) => {
|
||||||
|
nim.on(key, (res) => {
|
||||||
|
console.log(`Receive ${key} event:`, res ? JSON.parse(JSON.stringify(res)) : res)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
nim.connect()
|
||||||
|
|
||||||
|
nim.on('logined', function () {
|
||||||
|
console.log('连接成功')
|
||||||
|
})
|
||||||
|
|
||||||
|
nim.on('willReconnect', function (e) {
|
||||||
|
console.log(e, '即将重连')
|
||||||
|
})
|
||||||
|
|
||||||
|
nim.on('disconnect', function (e) {
|
||||||
|
console.log(e, '丢失连接')
|
||||||
|
})
|
||||||
|
|
||||||
|
nim.on('sessions', function(e) {
|
||||||
|
console.log(e, '会话消息')
|
||||||
|
// 如果群是开启了免打扰自动标记未读数已读
|
||||||
|
let mute = wx.getStorageSync('muteNotList') || []
|
||||||
|
if (mute && mute.length > 0) {
|
||||||
|
mute.forEach((j) => {
|
||||||
|
nim.session.resetSessionUnreadCount({
|
||||||
|
id: `team-${j.teamId}`
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 获取群消息未读数并赋值在tabBar显示
|
||||||
|
let teamsSsions = []
|
||||||
|
e.forEach((i) => {
|
||||||
|
if (i.scene === 'team') {
|
||||||
|
teamsSsions.push({id: i.to, unread: i.unread})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
wx.setStorageSync('teamsSessionsCount', teamsSsions)
|
||||||
|
let groupCount = 0
|
||||||
|
if (teamsSsions.length > 0) {
|
||||||
|
for (let i = 0; i < teamsSsions.length; i++) {
|
||||||
|
groupCount += teamsSsions[i].unread
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (groupCount > 0) {
|
||||||
|
wx.setTabBarBadge({
|
||||||
|
index: 0,
|
||||||
|
text: `${groupCount}`
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
wx.removeTabBarBadge({
|
||||||
|
index: 0
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
nim.on('msg', function (e) {
|
||||||
|
console.log(e, '收到最新消息')
|
||||||
|
let pages = getCurrentPages()
|
||||||
|
let currentPage = pages[pages.length - 1]
|
||||||
|
let notiTypeData = { muteTeam: false }
|
||||||
|
if (wx.getStorageSync('nuteNotList') && wx.getStorageSync('nuteNotList').length > 0) {
|
||||||
|
notiTypeData = wx.getStorageSync('nuteNotList').find((item) => item.teamId == e.to)
|
||||||
|
}
|
||||||
|
// 如果是开启了免打扰的群消息,自动调用群消息已读接口
|
||||||
|
if (notiTypeData.muteTeam) {
|
||||||
|
wx.request({
|
||||||
|
url: `${service.host}/chat/group/read`,
|
||||||
|
header: {
|
||||||
|
'Authorization': 'Bearer ' + wx.getStorageSync('token'),
|
||||||
|
'X-Requested-With': 'XMLHttpRequest'
|
||||||
|
},
|
||||||
|
method: 'post',
|
||||||
|
data: {team_id: notiTypeData.teamId},
|
||||||
|
success: ({data}) => {
|
||||||
|
console.log(data, '已读')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (e.scene == 'team') {
|
||||||
|
// 判断是否是@功能
|
||||||
|
if (e.apns) {
|
||||||
|
let teamAt = wx.getStorageSync('teamAtList') || []
|
||||||
|
let userInfo = wx.getStorageSync('userInfo') || {nickName: ''}
|
||||||
|
if (!e.apns.accounts || e.apns.accounts.indexOf(userInfo.id + '') >= 0) { // 存入@
|
||||||
|
if (teamAt.indexOf(e.to + '') < 0) {
|
||||||
|
teamAt.push(e.to)
|
||||||
|
wx.setStorageSync('teamAtList', teamAt)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 群消息未读数增加逻辑
|
||||||
|
let teamCount = wx.getStorageSync('teamsSessionsCount') || []
|
||||||
|
let newTeamCount = teamCount.filter(item => { return item.id == e.to })
|
||||||
|
if (e.attach && (e.attach.type === 'leaveTeam' || e.attach.type === 'dismissTeam' || e.attach.type === 'removeTeamMembers' || e.attach.type === 'addTeamMembers')) {
|
||||||
|
} else {
|
||||||
|
if (newTeamCount.length > 0) {
|
||||||
|
console.log(newTeamCount, '2222')
|
||||||
|
teamCount = teamCount.map(item => {
|
||||||
|
if (item.id == newTeamCount[0].id && !notiTypeData.muteTeam) {
|
||||||
|
item.unread += 1
|
||||||
|
}
|
||||||
|
return item
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
teamCount.push({id: e.to, unread: notiTypeData.muteTeam === false ? 0 : 1})
|
||||||
|
}
|
||||||
|
wx.setStorageSync('teamsSessionsCount', teamCount)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (currentPage.route == 'pages/tabBar/home') {
|
||||||
|
wx.request({
|
||||||
|
url: `${service.host}/new/message/count`,
|
||||||
|
header: {
|
||||||
|
'Authorization': 'Bearer ' + wx.getStorageSync('token'),
|
||||||
|
'X-Requested-With': 'XMLHttpRequest'
|
||||||
|
},
|
||||||
|
method: 'get',
|
||||||
|
success: ({data}) => {
|
||||||
|
let { new_count } = data.data
|
||||||
|
console.log(new_count, '新的未读数')
|
||||||
|
let groupCountList = wx.getStorageSync('teamsSessionsCount') || []
|
||||||
|
let groupCount = 0
|
||||||
|
if (groupCountList.length > 0) {
|
||||||
|
for (let i = 0; i < groupCountList.length; i++) {
|
||||||
|
groupCount += groupCountList[i].unread
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((new_count + groupCount) > 0) {
|
||||||
|
wx.setTabBarBadge({
|
||||||
|
index: 0,
|
||||||
|
text: `${new_count + groupCount}`
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
wx.removeTabBarBadge({
|
||||||
|
index: 0
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
currentPage.onShow()
|
||||||
|
wx.vibrateLong({
|
||||||
|
success: () => {
|
||||||
|
console.log('来消息了,震动~~')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}, 800)
|
||||||
|
})
|
||||||
|
|
||||||
|
nim.on('myTeamMembers', function (e) {
|
||||||
|
console.log(e, nim.session, '/////////////')
|
||||||
|
let muteNotList = []
|
||||||
|
if (e && e.length > 0) {
|
||||||
|
e.forEach((i) => {
|
||||||
|
if (i.muteTeam) {
|
||||||
|
muteNotList.push({
|
||||||
|
teamId: i.teamId,
|
||||||
|
muteNotiType: i.muteTeam ? 1 : 0,
|
||||||
|
muteTeam: i.muteTeam
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
wx.setStorageSync('muteNotList', muteNotList)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return nim
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
IM
|
||||||
|
}
|
||||||
201
src/utils/util.js
Normal file
@ -0,0 +1,201 @@
|
|||||||
|
/* ========================================================
|
||||||
|
小程序公共方法
|
||||||
|
======================================================== */
|
||||||
|
const {service} = require('../config')
|
||||||
|
const base = require('../mixins/base')
|
||||||
|
const wx_modal_loading = (text = '加载中') => {
|
||||||
|
wx.showLoading({
|
||||||
|
title: '',
|
||||||
|
mask: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const getUpdateManager = () => { // 版本自动触发更新
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
if (wx.canIUse('getUpdateManager')) {
|
||||||
|
const updateManager = wx.getUpdateManager()
|
||||||
|
updateManager.onCheckForUpdate(function (res) {
|
||||||
|
if (res.hasUpdate) {
|
||||||
|
updateManager.onUpdateReady(function () {
|
||||||
|
resolve('onUpdateReady')
|
||||||
|
})
|
||||||
|
updateManager.onUpdateFailed(function () {
|
||||||
|
resolve('onUpdateFailed')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
// eslint-disable-next-line prefer-promise-reject-errors
|
||||||
|
reject('error')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const wx_login = () => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
wx.login({
|
||||||
|
success: (res) => {
|
||||||
|
let data = {
|
||||||
|
code: res.code,
|
||||||
|
version: getApp().$wepy.$options.globalData.versions
|
||||||
|
}
|
||||||
|
wx.request({
|
||||||
|
url: `${service.host}/login/wechat/v2`,
|
||||||
|
data: data,
|
||||||
|
method: 'post',
|
||||||
|
success: ({data: res}) => {
|
||||||
|
let {code, data} = res
|
||||||
|
switch (code) {
|
||||||
|
case 0:
|
||||||
|
wx.setStorageSync('is_servicer', data.is_servicer)
|
||||||
|
wx.setStorageSync('token', data.token)
|
||||||
|
wx.setStorageSync('openid', (!!data.wechat && data.wechat.openid))
|
||||||
|
wx.setStorageSync('user_id', data.user.id) // 用户id
|
||||||
|
wx.setStorageSync('mobile', data.user.mobile) // 用户手机号
|
||||||
|
let userInfo = {
|
||||||
|
name: data.user.nickname,
|
||||||
|
avatar: data.user.avatar || 'https://image.fulllinkai.com/202203/09/cc1c73eb1a4941fef25a15cd1ff2f9df.png',
|
||||||
|
showId: data.user.id,
|
||||||
|
id: data.user.id,
|
||||||
|
type: data.user.type
|
||||||
|
}
|
||||||
|
console.log(userInfo, '7777------')
|
||||||
|
wx.setStorageSync('userInfo', userInfo) // 用户基本信息
|
||||||
|
resolve(res)
|
||||||
|
break
|
||||||
|
case 1:
|
||||||
|
reject(res.messag)
|
||||||
|
break
|
||||||
|
case 2:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (Error) => {
|
||||||
|
reject(Error)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
fail: (res) => {
|
||||||
|
console.error('wx.login登录失败', res)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const getPhoneNumber = ({detail}) => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
if (detail.iv) {
|
||||||
|
let data = {
|
||||||
|
code: detail.code
|
||||||
|
}
|
||||||
|
console.log(data)
|
||||||
|
wx.request({
|
||||||
|
url: `${service.host}/code/to/mobile`,
|
||||||
|
header: {
|
||||||
|
'Authorization': 'Bearer ' + wx.getStorageSync('token'),
|
||||||
|
'X-Requested-With': 'XMLHttpRequest'
|
||||||
|
},
|
||||||
|
data: data,
|
||||||
|
method: 'post',
|
||||||
|
success: ({data: res}) => {
|
||||||
|
let {code, data} = res
|
||||||
|
switch (code) {
|
||||||
|
case 0:
|
||||||
|
resolve(data) // 返回参数
|
||||||
|
break
|
||||||
|
case 1:
|
||||||
|
reject(res.message)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (Error) => {
|
||||||
|
reject(Error)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const logger = () => {
|
||||||
|
const wxlogger =
|
||||||
|
wx.getLogManager &&
|
||||||
|
wx.getLogManager({
|
||||||
|
level: 0
|
||||||
|
})
|
||||||
|
const log = (...params) => {
|
||||||
|
console.log(...params)
|
||||||
|
wxlogger && wxlogger.log(...params)
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
log
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var timeout
|
||||||
|
|
||||||
|
function throttle(func, wait, immediate) {
|
||||||
|
return fun(func, wait, immediate)
|
||||||
|
}
|
||||||
|
|
||||||
|
function fun(func, wait, immediate) {
|
||||||
|
var context = this,
|
||||||
|
args = arguments
|
||||||
|
var later = function later() {
|
||||||
|
timeout = null
|
||||||
|
if (!immediate) func.apply(context, args)
|
||||||
|
}
|
||||||
|
var callNow = immediate && !timeout
|
||||||
|
if (!timeout) {
|
||||||
|
clearTimeout(timeout)
|
||||||
|
|
||||||
|
timeout = setTimeout(later, wait)
|
||||||
|
}
|
||||||
|
if (callNow) func.apply(context, args)
|
||||||
|
}
|
||||||
|
|
||||||
|
const getNowTime = () => { // 获取现在时间
|
||||||
|
let now = new Date()
|
||||||
|
let year = now.getFullYear()
|
||||||
|
let month = (now.getMonth() + 1).toString().padStart(2, '0')
|
||||||
|
let date = (now.getDate()).toString().padStart(2, '0')
|
||||||
|
let hh = (now.getHours()).toString().padStart(2, '0')
|
||||||
|
let mm = (now.getMinutes()).toString().padStart(2, '0')
|
||||||
|
let ss = (now.getSeconds()).toString().padStart(2, '0')
|
||||||
|
return `${year}-${month}-${date} ${hh}:${mm}:${ss}`
|
||||||
|
}
|
||||||
|
|
||||||
|
let commentTimeHandle = (timeStamp) => {
|
||||||
|
timeStamp = timeStamp.replace(/-/g, '/')
|
||||||
|
var dateTime = new Date(timeStamp)
|
||||||
|
console.log(dateTime)
|
||||||
|
var no1new = dateTime.valueOf()
|
||||||
|
var year = dateTime.getFullYear()
|
||||||
|
var month = dateTime.getMonth() + 1
|
||||||
|
var day = dateTime.getDate()
|
||||||
|
var hour = dateTime.getHours()
|
||||||
|
var minute = dateTime.getMinutes()
|
||||||
|
var second = dateTime.getSeconds()
|
||||||
|
var now = new Date()
|
||||||
|
var now_new = now.valueOf()
|
||||||
|
var milliseconds = 0
|
||||||
|
var timeSpanStr
|
||||||
|
|
||||||
|
milliseconds = now_new - no1new
|
||||||
|
|
||||||
|
if (milliseconds <= 1000 * 60 * 1) {
|
||||||
|
timeSpanStr = '刚刚'
|
||||||
|
} else if (1000 * 60 * 1 < milliseconds && milliseconds <= 1000 * 60 * 60) {
|
||||||
|
timeSpanStr = Math.round((milliseconds / (1000 * 60))) + '分钟前'
|
||||||
|
} else if (1000 * 60 * 60 * 1 < milliseconds && milliseconds <= 1000 * 60 * 60 * 24) {
|
||||||
|
timeSpanStr = Math.round(milliseconds / (1000 * 60 * 60)) + '小时前'
|
||||||
|
} else if (1000 * 60 * 60 * 24 < milliseconds && milliseconds <= 1000 * 60 * 60 * 24 * 15) {
|
||||||
|
timeSpanStr = Math.round(milliseconds / (1000 * 60 * 60 * 24)) + '天前'
|
||||||
|
} else if (milliseconds > 1000 * 60 * 60 * 24 * 15 && year == now.getFullYear()) {
|
||||||
|
timeSpanStr = year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second
|
||||||
|
} else {
|
||||||
|
timeSpanStr = year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second
|
||||||
|
}
|
||||||
|
|
||||||
|
return timeSpanStr
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
wx_login, throttle, getPhoneNumber, logger, getNowTime, commentTimeHandle, getUpdateManager
|
||||||
|
}
|
||||||
0
static/.gitignore
vendored
Normal file
39
wepy.config.js
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
const path = require('path')
|
||||||
|
const cliExt = require('wepy-cli-extend')
|
||||||
|
var prod = process.env.NODE_ENV === 'production'
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
wpyExt: '.wpy',
|
||||||
|
// eslint: true,
|
||||||
|
cliLogs: !prod,
|
||||||
|
static: ['./src/images'],
|
||||||
|
build: {},
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
counter: path.join(__dirname, 'src/components/counter'),
|
||||||
|
'@': path.join(__dirname, 'src')
|
||||||
|
},
|
||||||
|
aliasFields: ['wepy', 'weapp'],
|
||||||
|
modules: ['node_modules']
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
cliExt()
|
||||||
|
],
|
||||||
|
compilers: {
|
||||||
|
less: {
|
||||||
|
compress: prod
|
||||||
|
},
|
||||||
|
babel: {
|
||||||
|
sourceMap: true,
|
||||||
|
presets: [
|
||||||
|
'@babel/preset-env'
|
||||||
|
],
|
||||||
|
plugins: [
|
||||||
|
'@wepy/babel-plugin-import-regenerator'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
appConfig: {
|
||||||
|
noPromiseAPI: ['createSelectorQuery']
|
||||||
|
}
|
||||||
|
}
|
||||||