@@ -23,6 +23,7 @@ declare module 'vue' { | |||
NutCol: typeof import('@nutui/nutui-taro')['Col'] | |||
NutCollapse: typeof import('@nutui/nutui-taro')['Collapse'] | |||
NutCollapseItem: typeof import('@nutui/nutui-taro')['CollapseItem'] | |||
NutDatePicker: typeof import('@nutui/nutui-taro')['DatePicker'] | |||
NutDivider: typeof import('@nutui/nutui-taro')['Divider'] | |||
NutElevator: typeof import('@nutui/nutui-taro')['Elevator'] | |||
NutEmpty: typeof import('@nutui/nutui-taro')['Empty'] | |||
@@ -30,6 +31,7 @@ declare module 'vue' { | |||
NutFormItem: typeof import('@nutui/nutui-taro')['FormItem'] | |||
NutInput: typeof import('@nutui/nutui-taro')['Input'] | |||
NutNavbar: typeof import('@nutui/nutui-taro')['Navbar'] | |||
NutPopup: typeof import('@nutui/nutui-taro')['Popup'] | |||
NutRow: typeof import('@nutui/nutui-taro')['Row'] | |||
NutSearchbar: typeof import('@nutui/nutui-taro')['Searchbar'] | |||
NutSkeleton: typeof import('@nutui/nutui-taro')['Skeleton'] | |||
@@ -20,7 +20,7 @@ const config = { | |||
outputRoot: 'dist', | |||
plugins: ['@tarojs/plugin-html', 'tarojs-router-next-plugin'], | |||
defineConstants: { | |||
SERVER_URL: '"https://test.digimeta.com.cn"', | |||
SERVER_URL: '"https://weapp.digimeta.com.cn"', | |||
}, | |||
copy: { | |||
patterns: [ | |||
@@ -33,6 +33,7 @@ | |||
"pinia": "^2.1.7", | |||
"taro-icons": "^0.4.0", | |||
"tarojs-router-next": "^3.4.0", | |||
"vconsole": "^3.15.1", | |||
"vue": "^3.3.8" | |||
}, | |||
"devDependencies": { | |||
@@ -7352,6 +7353,17 @@ | |||
"url": "https://github.com/sponsors/mesqueeb" | |||
} | |||
}, | |||
"node_modules/copy-text-to-clipboard": { | |||
"version": "3.2.0", | |||
"resolved": "https://registry.npmjs.org/copy-text-to-clipboard/-/copy-text-to-clipboard-3.2.0.tgz", | |||
"integrity": "sha512-RnJFp1XR/LOBDckxTib5Qjr/PMfkatD0MUCQgdpqS8MdKiNUzBjAQBEN6oUy+jW7LI93BBG3DtMB2KOOKpGs2Q==", | |||
"engines": { | |||
"node": ">=12" | |||
}, | |||
"funding": { | |||
"url": "https://github.com/sponsors/sindresorhus" | |||
} | |||
}, | |||
"node_modules/copy-webpack-plugin": { | |||
"version": "10.2.0", | |||
"resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-10.2.0.tgz", | |||
@@ -7489,7 +7501,6 @@ | |||
"version": "3.35.0", | |||
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.35.0.tgz", | |||
"integrity": "sha512-ntakECeqg81KqMueeGJ79Q5ZgQNR+6eaE8sxGCx62zMbAIj65q+uYvatToew3m6eAGdU4gNZwpZ34NMe4GYswg==", | |||
"dev": true, | |||
"hasInstallScript": true, | |||
"funding": { | |||
"type": "opencollective", | |||
@@ -13898,6 +13909,11 @@ | |||
"node": "*" | |||
} | |||
}, | |||
"node_modules/mutation-observer": { | |||
"version": "1.0.3", | |||
"resolved": "https://registry.npmjs.org/mutation-observer/-/mutation-observer-1.0.3.tgz", | |||
"integrity": "sha512-M/O/4rF2h776hV7qGMZUH3utZLO/jK7p8rnNgGkjKUw8zCGjRQPxB8z6+5l8+VjRUQ3dNYu4vjqXYLr+U8ZVNA==" | |||
}, | |||
"node_modules/mute-stream": { | |||
"version": "0.0.8", | |||
"resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", | |||
@@ -19669,6 +19685,17 @@ | |||
"node": ">= 0.8" | |||
} | |||
}, | |||
"node_modules/vconsole": { | |||
"version": "3.15.1", | |||
"resolved": "https://registry.npmjs.org/vconsole/-/vconsole-3.15.1.tgz", | |||
"integrity": "sha512-KH8XLdrq9T5YHJO/ixrjivHfmF2PC2CdVoK6RWZB4yftMykYIaXY1mxZYAic70vADM54kpMQF+dYmvl5NRNy1g==", | |||
"dependencies": { | |||
"@babel/runtime": "^7.17.2", | |||
"copy-text-to-clipboard": "^3.0.1", | |||
"core-js": "^3.11.0", | |||
"mutation-observer": "^1.0.3" | |||
} | |||
}, | |||
"node_modules/verror": { | |||
"version": "1.10.0", | |||
"resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", | |||
@@ -26123,6 +26150,11 @@ | |||
"is-what": "^3.14.1" | |||
} | |||
}, | |||
"copy-text-to-clipboard": { | |||
"version": "3.2.0", | |||
"resolved": "https://registry.npmjs.org/copy-text-to-clipboard/-/copy-text-to-clipboard-3.2.0.tgz", | |||
"integrity": "sha512-RnJFp1XR/LOBDckxTib5Qjr/PMfkatD0MUCQgdpqS8MdKiNUzBjAQBEN6oUy+jW7LI93BBG3DtMB2KOOKpGs2Q==" | |||
}, | |||
"copy-webpack-plugin": { | |||
"version": "10.2.0", | |||
"resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-10.2.0.tgz", | |||
@@ -26216,8 +26248,7 @@ | |||
"core-js": { | |||
"version": "3.35.0", | |||
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.35.0.tgz", | |||
"integrity": "sha512-ntakECeqg81KqMueeGJ79Q5ZgQNR+6eaE8sxGCx62zMbAIj65q+uYvatToew3m6eAGdU4gNZwpZ34NMe4GYswg==", | |||
"dev": true | |||
"integrity": "sha512-ntakECeqg81KqMueeGJ79Q5ZgQNR+6eaE8sxGCx62zMbAIj65q+uYvatToew3m6eAGdU4gNZwpZ34NMe4GYswg==" | |||
}, | |||
"core-js-compat": { | |||
"version": "3.35.0", | |||
@@ -30866,6 +30897,11 @@ | |||
} | |||
} | |||
}, | |||
"mutation-observer": { | |||
"version": "1.0.3", | |||
"resolved": "https://registry.npmjs.org/mutation-observer/-/mutation-observer-1.0.3.tgz", | |||
"integrity": "sha512-M/O/4rF2h776hV7qGMZUH3utZLO/jK7p8rnNgGkjKUw8zCGjRQPxB8z6+5l8+VjRUQ3dNYu4vjqXYLr+U8ZVNA==" | |||
}, | |||
"mute-stream": { | |||
"version": "0.0.8", | |||
"resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", | |||
@@ -35157,6 +35193,17 @@ | |||
"integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", | |||
"dev": true | |||
}, | |||
"vconsole": { | |||
"version": "3.15.1", | |||
"resolved": "https://registry.npmjs.org/vconsole/-/vconsole-3.15.1.tgz", | |||
"integrity": "sha512-KH8XLdrq9T5YHJO/ixrjivHfmF2PC2CdVoK6RWZB4yftMykYIaXY1mxZYAic70vADM54kpMQF+dYmvl5NRNy1g==", | |||
"requires": { | |||
"@babel/runtime": "^7.17.2", | |||
"copy-text-to-clipboard": "^3.0.1", | |||
"core-js": "^3.11.0", | |||
"mutation-observer": "^1.0.3" | |||
} | |||
}, | |||
"verror": { | |||
"version": "1.10.0", | |||
"resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", | |||
@@ -60,6 +60,7 @@ | |||
"pinia": "^2.1.7", | |||
"taro-icons": "^0.4.0", | |||
"tarojs-router-next": "^3.4.0", | |||
"vconsole": "^3.15.1", | |||
"vue": "^3.3.8" | |||
}, | |||
"devDependencies": { | |||
@@ -27,9 +27,9 @@ export default defineAppConfig({ | |||
list: [ | |||
{ | |||
pagePath: 'pages/index/index', | |||
selectedIconPath: 'images/calendar-plus-solid-397ef5.png', | |||
iconPath: 'images/calendar-plus-regular-797979.png', | |||
text: '邀约' | |||
selectedIconPath: 'images/home-blue-397ef5.png', | |||
iconPath: 'images/home-gray-797979.png', | |||
text: '首页' | |||
}, | |||
{ | |||
pagePath: 'pages/notifications/index', | |||
@@ -47,7 +47,7 @@ export default defineAppConfig({ | |||
pagePath: 'pages/settings/index', | |||
selectedIconPath: 'images/user-solid-397ef5.png', | |||
iconPath: 'images/user-regular-797979.png', | |||
text: '个人中心' | |||
text: '您的信息' | |||
} | |||
] | |||
} | |||
@@ -1,11 +1,13 @@ | |||
import { createApp } from 'vue' | |||
import { createPinia } from 'pinia' | |||
import {createApp} from 'vue' | |||
import {createPinia} from 'pinia' | |||
import './app.scss' | |||
import '@nutui/touch-emulator' | |||
import 'taro-icons/scss/FontAwesome.scss' | |||
const App = createApp({ | |||
onShow (options) {}, | |||
onShow (options) { | |||
}, | |||
// 入口组件不需要实现 render 方法,即使实现了也会被 taro 所覆盖 | |||
}) | |||
App.use(createPinia()) | |||
@@ -84,7 +84,7 @@ const onNickNameSelected = (value) => { | |||
</nut-avatar> | |||
</view> | |||
<view class="d-flex justify-content-center pt-3"> | |||
<view class="btn-sm btn btn-secondary badge-pill" @tap="updateFacePhoto">{{contact.contact.avatar || state.newAvatar ?'更换':'添加'}}面部识别照片</view> | |||
<view class="btn-sm btn btn-secondary badge-pill" @tap="updateFacePhoto">{{contact.contact.avatar || state.newAvatar ?'更换':'添加'}}面部照片,让我认识您</view> | |||
</view> | |||
</view> | |||
</nut-form-item> | |||
@@ -154,11 +154,13 @@ const onNickNameSelected = (value) => { | |||
</nut-calendar> | |||
<nut-action-sheet v-model:visible="onShowSuggestionsMenu" title="您可以从列表中选择称呼或直接填写" | |||
:menu-items="[ | |||
:menu-items="contact.contact.name=='' ? [ | |||
{name: BjxHelper.getBJXFirstChar(contact.contact.name) + '先生'}, | |||
{name: BjxHelper.getBJXFirstChar(contact.contact.name) + '女士'}, | |||
{name: BjxHelper.getBJXFirstChar(contact.contact.name) + '小姐'}, | |||
]" cancel-txt="取消" @choose="onNickNameSelected"> | |||
]:[{name: BjxHelper.getBJXFirstChar(contact.contact.name) + '先生'}, | |||
{name: contact.contact.name+ '先生'}, | |||
{name: BjxHelper.getBJXFirstChar(contact.contact.name) + '女士'}, | |||
{name: contact.contact.name+ '女士'}]" cancel-txt="取消" @choose="onNickNameSelected"> | |||
</nut-action-sheet> | |||
</template> |
@@ -1,20 +1,47 @@ | |||
<script setup lang="ts"> | |||
import "./index.scss"; | |||
import Taro from "@tarojs/taro"; | |||
import {reactive, ref} from 'vue'; | |||
import {ScreenHelper, Session} from "../../utils"; | |||
import {reactive,ref} from 'vue'; | |||
import {ScreenHelper, Session, DateHelper} from "../../utils"; | |||
import {useStaffItemStore} from "../../stores/my-info"; | |||
const me = Session.get("staff") | |||
const staff = useStaffItemStore() | |||
const screenWidth = ScreenHelper.getScreenWidth() | |||
//js获取当前日期格式字符串,用中横线分割 | |||
const cuDate = Taro.getStorageSync("cuDate") || DateHelper.formatYmd(new Date()) | |||
console.log(cuDate) | |||
const openSwitch = (active,param) => { | |||
state[`${param}`] = true; | |||
state[`active`] = active; | |||
}; | |||
const closeSwitch = (param) => { | |||
state[`${param}`] = false; | |||
} | |||
const setChooseDate = ({selectedValue}) => { | |||
state[`${state.active}`] = selectedValue.join('-'); | |||
state[`isDateSelectorVisible`] = false; | |||
me[`${state.active}`] = selectedValue.join('-'); | |||
} | |||
const state = reactive({ | |||
newAvatar: undefined | |||
newAvatar: undefined, | |||
isDateSelectorVisible: false, | |||
hireDate: me.hireDate, | |||
birthDate: me.birthDate, | |||
active: 'hireDate', | |||
}); | |||
const val = ref(new Date(2022, 4, 10)); | |||
const updateFacePhoto = () => { | |||
Taro.chooseImage({ | |||
count: 1, // 默认9 | |||
@@ -22,6 +49,7 @@ const updateFacePhoto = () => { | |||
success: function (res) { | |||
// 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片 | |||
state.newAvatar = res.tempFilePaths | |||
staff.setNewAvatar( res.tempFilePaths[0]) | |||
console.log(state.newAvatar) | |||
}, | |||
}) | |||
@@ -43,7 +71,7 @@ const updateFacePhoto = () => { | |||
</nut-avatar> | |||
</view> | |||
<view class="d-flex justify-content-center pt-3"> | |||
<view class="btn-sm btn btn-secondary badge-pill" @tap="updateFacePhoto">{{me.avatar || state.newAvatar ?'更换':'添加'}}面部识别照片</view> | |||
<view class="btn-sm btn btn-secondary badge-pill" @tap="updateFacePhoto">{{me.avatar || state.newAvatar ?'更换':'添加'}}面部照片,让我认识您</view> | |||
</view> | |||
</view> | |||
</nut-form-item> | |||
@@ -55,9 +83,36 @@ const updateFacePhoto = () => { | |||
</nut-input> | |||
</nut-form-item> | |||
<nut-form-item label="电话"> | |||
<nut-input v-model="staff.staff.phone" class="nut-input-text" type="number" /> | |||
<nut-input v-model="staff.staff.phone" readonly class="nut-input-text nut-cell__value" type="number" /> | |||
</nut-form-item> | |||
<nut-form-item label="生日"> | |||
<view class="d-flex calendar"> | |||
<view class="flex-grow-1"></view> | |||
<view class="text-dark" @tap="openSwitch('birthDate','isDateSelectorVisible')"> | |||
{{state.birthDate ? state.birthDate : '请选择'}} | |||
</view> | |||
</view> | |||
</nut-form-item> | |||
<nut-form-item label="入职日期"> | |||
<view class="d-flex calendar"> | |||
<view class="flex-grow-1"></view> | |||
<view class="text-dark" @tap="openSwitch('hireDate','isDateSelectorVisible')"> | |||
{{state.hireDate ? state.hireDate : '请选择'}} | |||
</view> | |||
</view> | |||
</nut-form-item> | |||
</nut-form> | |||
<nut-popup v-model:visible="state.isDateSelectorVisible" position="bottom"> | |||
<nut-date-picker | |||
v-model="val" | |||
@confirm="setChooseDate" | |||
@cancel="closeSwitch('isDateSelectorVisible')" | |||
:max-date="new Date()" | |||
:min-date="new Date(1930, 0, 1)" | |||
:three-dimensional="false" | |||
></nut-date-picker> | |||
</nut-popup> | |||
</template> |
@@ -10,6 +10,13 @@ | |||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" > | |||
<title>jsx</title> | |||
<script><%= htmlWebpackPlugin.options.script %></script> | |||
<script type="text/javascript" src="https://cdn.bootcss.com/vConsole/3.3.0/vconsole.min.js"></script> | |||
<script> | |||
// 初始化 | |||
var vConsole = new VConsole(); | |||
console.log('Hello world'); | |||
</script> | |||
</head> | |||
<body> | |||
<div id="app"></div> | |||
@@ -140,7 +140,8 @@ const onSaveAndSendMessage = () => { | |||
return | |||
} | |||
if (contactData.phone.length !== 11){ | |||
const regex = /^1[3-9]\d{9}$/; | |||
if (!regex.test(contactData.phone)){ | |||
Taro.showToast({ | |||
title: '请正确填写手机号', | |||
icon: 'none', | |||
@@ -68,7 +68,9 @@ const onSaveAndSendMessage = () => { | |||
duration: 2000}) | |||
return | |||
} | |||
if (contact.contact.phone.length !== 11){ | |||
const regex = /^1[3-9]\d{9}$/; | |||
if (!regex.test(contact.contact.phone)){ | |||
Taro.showToast({ | |||
title: '请正确填写手机号', | |||
icon: 'none', | |||
@@ -69,13 +69,13 @@ const setChooseDate = (param) => { | |||
} | |||
const onSmsSend = () => { | |||
console.log(contactVisitRecord.visitRecord) | |||
if (contactVisitRecord.visitRecord == null){ | |||
console.log(contact.contact) | |||
if (contactVisitRecord.visitRecord == null && !contact.contact.flexVisit){//如果不是随时可拜访的访客,则需要有邀约信息(日期) | |||
Taro.showToast({ | |||
title: '请选择邀请到访的日期', | |||
icon: 'none', | |||
duration: 2000}) | |||
} | |||
else { | |||
} else { | |||
Taro.request({ | |||
method: 'GET', | |||
url: SERVER_URL + '/system/visitor/sms/send-sms', | |||
@@ -83,7 +83,8 @@ const onSmsSend = () => { | |||
Authorization: 'Bearer ' + Session.get('access_token'), | |||
}, | |||
data: { | |||
visitRecordId: contactVisitRecord.visitRecord.id, | |||
visitRecordId: (contactVisitRecord.visitRecord ? contactVisitRecord.visitRecord.id : -1), | |||
visitorId: contact.contact.id, | |||
staffId: Session.get("staff").id | |||
}, | |||
success: result => { | |||
@@ -1,18 +1,21 @@ | |||
<script lang="ts" setup> | |||
import Contact from "../../components/contact" | |||
import { Router } from 'tarojs-router-next' | |||
import {reactive, ref} from 'vue'; | |||
import {registerRouterBackListener, Router} from 'tarojs-router-next' | |||
import {reactive} from 'vue'; | |||
import './index.scss' | |||
import { useContactsStore, ContactData } from '../../stores/contacts' | |||
import { registerRouterBackListener } from 'tarojs-router-next' | |||
import {BjxHelper} from "../../utils"; | |||
import {ContactData, useContactsStore} from '../../stores/contacts' | |||
import {BjxHelper, weappAuth} from "../../utils"; | |||
import Taro, {useLoad} from '@tarojs/taro' | |||
import {gql} from "graphql-tag"; | |||
import {PinyinHelper, GQLRequest, weappAuth} from "../../utils"; | |||
import {useAuthStore} from "../../stores/auth"; | |||
useLoad((query) =>{ | |||
console.log("index useLoad"); | |||
}) | |||
// defineExpose({ | |||
// loadContactsFromServer, | |||
@@ -114,7 +117,7 @@ const goToContactEditPage = (item) => { | |||
<NutNavbar title=""></NutNavbar> | |||
<view class="pl-3 pt-3 pr-3 h3 d-flex"> | |||
<view class="flex-grow-1"> | |||
我的邀约 | |||
您的邀约 | |||
</view> | |||
</view> | |||
<View class="scroll 100vh w-100"> | |||
@@ -152,7 +155,7 @@ const goToContactEditPage = (item) => { | |||
<View class="h4 text-muted">还没有邀约</View> | |||
</View> | |||
<View class="d-flex justify-content-center"> | |||
<View class="text-muted" >添加您邀约的访客,让数字人认识他</View> | |||
<View class="text-muted" >添加您邀约的访客,让我认识他</View> | |||
</View> | |||
</View> | |||
</View> | |||
@@ -177,7 +180,7 @@ const goToContactEditPage = (item) => { | |||
</NutBadge> | |||
</View> | |||
<View class="d-flex justify-content-center small b pt-2 text-nowrap overflow-hidden"> | |||
{{item.name}} | |||
{{item.name.length>3?item.name.substring(0,3)+'...':item.name}} | |||
</View> | |||
</View> | |||
@@ -1,6 +1,6 @@ | |||
<script setup> | |||
import './index.scss' | |||
import Taro from "@tarojs/taro"; | |||
import Taro, {useLoad} from "@tarojs/taro"; | |||
import {Route, Session} from "../../utils"; | |||
import { Router } from "tarojs-router-next"; | |||
@@ -10,6 +10,11 @@ import ExternalLink from "../../components/ExternalLink"; | |||
const params = Router.getParams() | |||
const data = Router.getData() | |||
useLoad((query) =>{ | |||
console.log(JSON.stringify(query)); | |||
}) | |||
console.log("data", data) | |||
const isBackendErrorShowed = ref(false) | |||
const isWxUserNotStaff = ref(false) | |||
@@ -89,11 +94,11 @@ const getPhoneNumber = (e) => { | |||
服务器错误,请稍后重试 | |||
</View> | |||
<View class="text-center text-black-50 p-5" v-show="isWxUserNotStaff"> | |||
您还不是数字人产品中注册的企业员工,请联系您的公司管理员开通,或<ExternalLink class="text-primary" href="https://www.digimeta.com.cn/contact">与缔智元联系</ExternalLink>。 | |||
您还不是我所服务的企业里的员工,请联系您的公司管理员把我带回家吧,或<ExternalLink class="text-primary" href="https://www.digimeta.com.cn/contact">与缔智元联系</ExternalLink>。 | |||
</View> | |||
<View class="w-100 d-flex justify-content-center position-absolute"> | |||
<NutButton type="success" @click="clickPhoneNumberButton" openType='getPhoneNumber' @getphonenumber="getPhoneNumber"> | |||
<Text className='text-white'>微信用户一键登录</Text> | |||
<Text className='text-white'>手机用户一键登录</Text> | |||
</NutButton> | |||
</View> | |||
</View> | |||
@@ -9,7 +9,6 @@ const staffData = Router.getData() | |||
const staff = useStaffItemStore() | |||
const myData = Session.get("staff") | |||
console.log(myData); | |||
staff.setStaff(myData) | |||
const goBack = () => { | |||
@@ -33,7 +32,9 @@ const onSaveClicked = () => { | |||
console.log(staff.staff) | |||
staff.updateStaff().then(r => { | |||
console.log("updateStaff", r) | |||
Taro.hideLoading() | |||
// goBack() | |||
wx.reLaunch({url:"/pages/settings/index"}) | |||
}).catch(error => { | |||
Taro.hideLoading() | |||
if (error) { | |||
@@ -70,7 +71,7 @@ const onSaveClicked = () => { | |||
<view class="flex-grow-1"> | |||
<view class="h3"> | |||
<view class="fas fa-chevron-left text-primary" @tap="goBack()" hover-class="btn-hover-primary"/> | |||
更新个人信息 | |||
更新您的信息 | |||
</view> | |||
<view class="text-black-50"></view> | |||
</view> | |||
@@ -3,4 +3,5 @@ export default definePageConfig({ | |||
navigationStyle: 'custom', | |||
disableScroll: true, | |||
usingComponents: {}, | |||
enablePullDownRefresh: true | |||
}) |
@@ -1,7 +1,7 @@ | |||
<script setup lang="ts"> | |||
import { reactive } from 'vue' | |||
import { View } from '@tarojs/components' | |||
import {onMounted, reactive} from 'vue' | |||
import {View} from '@tarojs/components' | |||
import Taro from "@tarojs/taro"; | |||
import './index.scss' | |||
import {weappAuth} from "../../utils"; | |||
import {GroupedPassRecords, usePassRecordsStore} from "../../stores/pass-records"; | |||
@@ -20,7 +20,9 @@ const passRecords = usePassRecordsStore() | |||
const contacts = useContactsStore() | |||
init() | |||
onMounted(() => { | |||
init(); | |||
}); | |||
function init() { | |||
state.isAuthError = false | |||
@@ -32,6 +34,7 @@ function init() { | |||
console.log("aaa",state.groupedPassRecords ) | |||
// console.log(state.groupedPassRecords) | |||
state.isPageDataLoading = false | |||
Taro.stopPullDownRefresh(); | |||
}) | |||
.catch(error => { | |||
console.log("error", error) | |||
@@ -48,20 +51,16 @@ function init() { | |||
const onAuthErrorRefresh = () => { | |||
init() | |||
} | |||
function onPullDownRefresh (e) { | |||
console.log("onPullDownRefresh", e) | |||
} | |||
const onPullDownRefresh = async () => { | |||
console.log('onPullDownRefresh'); | |||
await Taro.startPullDownRefresh(); // 停止下拉刷新动画 | |||
await init(); | |||
}; | |||
</script> | |||
<template> | |||
<view class="h-100 d-flex flex-column"> | |||
<view class="h-100 d-flex flex-column" enablePullDownRefresh @onPullDownRefresh="onPullDownRefresh"> | |||
<!-- ... 省略其他内容 ... --> | |||
<BackgroundBasic/> | |||
<NutNavbar title=""></NutNavbar> | |||
<View class="w-100" style="overflow-x: hidden"> | |||
@@ -72,7 +71,7 @@ function onPullDownRefresh (e) { | |||
</View> | |||
<View class="d-flex text-black-50 pb-2 pr-3"> | |||
<View class="flex-grow-1"></View> | |||
<View>最近30天的来访</View> | |||
<View>最近30天的来访</View><!--<button @click="onPullDownRefresh">点击刷新</button>--> | |||
</View> | |||
</View> | |||
@@ -102,7 +101,7 @@ function onPullDownRefresh (e) { | |||
</View> | |||
<View v-else> | |||
<Scroll-View style="height: 100vh" :scrollY="true"> | |||
<Scroll-View style="height: 100vh" :scrollY="true" :bindscrolltoupper="onPullDownRefresh"> | |||
<Notification v-for="item in state.groupedPassRecords" :item="item"/> | |||
<view class="container pt-5 pb-3"> | |||
@@ -1,27 +1,49 @@ | |||
<script setup> | |||
import './index.scss' | |||
import Taro from "@tarojs/taro"; | |||
import Taro, {onAppShow,useDidShow} from "@tarojs/taro"; | |||
import {Route, Session, weappAuth} from "../../utils"; | |||
import { Router } from "tarojs-router-next"; | |||
import {reactive, ref} from "vue"; | |||
import {onMounted, reactive, ref, provide} from "vue"; | |||
const params = Router.getParams() | |||
const data = Router.getData() | |||
const staff = Session.get("staff") | |||
let me = reactive(staff) | |||
const state = reactive<{ | |||
isPageDataLoading: boolean, | |||
isAuthError: boolean, | |||
}>({ | |||
isPageDataLoading: true, | |||
isAuthError: false | |||
isAuthError: false, | |||
}) | |||
console.log("data", data) | |||
const isBackendErrorShowed = ref(false) | |||
init() | |||
onMounted(() => { | |||
console.log("onMounted"); | |||
// loadData() | |||
}) | |||
onAppShow(() => { | |||
console.log("onAppShow"); | |||
// loadData() | |||
}) | |||
function loadData() { | |||
state.isPageDataLoading = true | |||
state.isAuthError = false | |||
// 加载数据 | |||
// ... | |||
state.isPageDataLoading = false | |||
} | |||
function init() { | |||
state.isPageDataLoading = true | |||
state.isAuthError = false | |||
@@ -35,6 +57,11 @@ function init() { | |||
}) | |||
} | |||
onMounted(() => { | |||
console.log("onMounted -----setting") | |||
state.me = Session.get("staff") | |||
}); | |||
const onAvatarClick = () => { | |||
Router.toMyInfo(Session.get("staff")) | |||
} | |||
@@ -69,6 +96,7 @@ const onExitLoginButtonClicked = () => { | |||
} | |||
const onAboutUsClicked = () => { | |||
Route.navigateTo({url: '/pages/web-view/index'}, {data: {href: "https://www.digimeta.com.cn/contact"}}) | |||
console.log("onAboutUsClicked") | |||
@@ -113,16 +141,29 @@ const goToMyInfoEditPage = (item) => { | |||
<View v-else class="w-100" style="overflow-x: hidden"> | |||
<View class="d-flex justify-content-center pt-5 pb-3"> | |||
<NutAvatar size="large" class="overflow-hidden" @click="onAvatarClick"> | |||
<img :src="Session.get('staff').avatar" alt=""/> | |||
<img :src="me.avatar" alt=""/> | |||
</NutAvatar> | |||
</View> | |||
<View class="text-center h4"> | |||
{{ Session.get('staff').userName }} | |||
{{ me.userName }} | |||
</View> | |||
<View class="text-center text-black-50"> | |||
{{ Session.get('enterpriseName')}} | |||
</View> | |||
<View class="p-3"> | |||
<nut-cell title="称呼" :desc="me.nickName" @tap="Router.toMyInfo(me)"> | |||
<template #icon> | |||
<Text className="fas fa-user"/> | |||
</template> | |||
<template #link> | |||
<Text className="fas fa-chevron-right" style="line-height: 3vh;"/> | |||
</template> | |||
</nut-cell> | |||
<nut-cell title="电话" :desc="me.phone" > | |||
<template #icon> | |||
<Text className="fas fa-phone"/> | |||
</template> | |||
</nut-cell> | |||
<nut-cell title="关于我们" @tap="onAboutUsClicked"> | |||
<template #icon> | |||
<Text className="fas fa-info-circle"/> | |||
@@ -133,7 +174,7 @@ const goToMyInfoEditPage = (item) => { | |||
</nut-cell> | |||
<nut-cell title="版本信息" desc="1.0"> | |||
<template #icon> | |||
<Text className="fas fa-user"/> | |||
<Text className="fas fa-registered"/> | |||
</template> | |||
</nut-cell> | |||
</View> | |||
@@ -5,6 +5,8 @@ import {gql} from "graphql-tag"; | |||
import {ref, Ref, UnwrapRef} from "vue"; | |||
import Taro from "@tarojs/taro"; | |||
const me = Session.get("staff") | |||
export const useStaffItemStore = defineStore('my-info', () => { | |||
@@ -19,6 +21,8 @@ export const useStaffItemStore = defineStore('my-info', () => { | |||
deptId: string | |||
resourceId: number | |||
delFlag: number | |||
hireDate: string | |||
birthDate: string | |||
} | |||
const staff: Ref<UnwrapRef<Staff>> = ref(getEmptyStaffData()) | |||
@@ -42,17 +46,19 @@ export const useStaffItemStore = defineStore('my-info', () => { | |||
phone: "", | |||
sex: "", | |||
deptId: "", | |||
hireDate:"", | |||
birthDate:"", | |||
resourceId: undefined, | |||
delFlag: 0 | |||
} | |||
} | |||
const UPDATE_STAFF = gql` | |||
mutation UpdateStaff($staffId: ID!, $id: ID!, $userName: String!, $nickName: String, $phone: String, $resourceId: ID ) { | |||
updateStaff( staffId: $staffId, input: { | |||
mutation UpdateStaff($id: ID!, $userName: String!, $nickName: String, $phone: String, $resourceId: ID ) { | |||
updateStaff( input: { | |||
id: $id, | |||
userName: $userName, | |||
nickname: $nickName, | |||
nickName: $nickName, | |||
phone: $phone, | |||
resourceId: $resourceId | |||
} ) { | |||
@@ -74,13 +80,20 @@ export const useStaffItemStore = defineStore('my-info', () => { | |||
const userName = staff.value.userName | |||
const nickName = staff.value.nickName | |||
const phone = staff.value.phone | |||
const hireDate = staff.value.hireDate | |||
const birthDate = staff.value.birthDate | |||
console.log("hireDate", hireDate); | |||
console.log("birthDate", birthDate); | |||
//TODO. 增加修改入职日期和生日 | |||
return new Promise((resolve, reject) => { | |||
if (staffNewAvatar.value !== "") { | |||
uploadFace().then(r => { | |||
console.log(r) | |||
console.log("update face:",r) | |||
console.log("update face origin staff:",Session.get("staff")) | |||
const resourceId = r.data.resourceId | |||
Session.get("staff").avatar = r.data.url | |||
Session.set("staff", Session.get("staff")) | |||
GQLRequest.query(UPDATE_STAFF, { id, userName, nickName, phone, resourceId }) | |||
.then(r=> { | |||
// contact.value.id = r.data.updateStaff.id | |||
@@ -88,6 +101,7 @@ export const useStaffItemStore = defineStore('my-info', () => { | |||
}) | |||
.catch(e=> reject(e)) | |||
}).catch(e => { | |||
console.log("upload face error:", e) | |||
reject(e.msg) | |||
}) | |||
} | |||