From e6dccb3b16847f4bda31f305113070596677caff Mon Sep 17 00:00:00 2001 From: zhangwei <1504152376@qq.com> Date: 星期五, 23 八月 2024 17:13:25 +0800 Subject: [PATCH] - --- src/pages/enterprise/enterprise.vue | 64 ++++++++++++++++++++++++-------- 1 files changed, 48 insertions(+), 16 deletions(-) diff --git a/src/pages/enterprise/enterprise.vue b/src/pages/enterprise/enterprise.vue index 5c895da..9639b8e 100644 --- a/src/pages/enterprise/enterprise.vue +++ b/src/pages/enterprise/enterprise.vue @@ -41,7 +41,7 @@ maxlength='800'></up-textarea> </up-form-item> <view class="tabbtns"> - <up-button color='#fece01' class="text-69" text="淇濆瓨"></up-button> + <up-button color='#fece01' class="text-69" text="淇濆瓨" @click="saveUserCompany"></up-button> </view> </up-form> </view> @@ -54,20 +54,35 @@ apiBaseUrl } from '@/common/setting/constVarsHelper.js'; import { + onLoad, + onShow + } from "@dcloudio/uni-app"; + + import { ref, - reactive + reactive, + getCurrentInstance } from 'vue'; - - // 浣跨敤 reactive 鍒涘缓鍝嶅簲寮忕姸鎬� - const state = reactive({ - showSex: false, - - - - radio: '', - switchVal: false, - }); - + const { + $upload, + $api, + $util, + $db + } = getCurrentInstance().appContext.config.globalProperties + onLoad(() => { + let data = JSON.parse($db.get('userInfo')).userCompany + if (data) { + enterpriseInfo.businessLicense = data.businessLicense + enterpriseInfo.suppliername = data.suppliername //浼佷笟鍚嶇О + enterpriseInfo.regtime = data.regtime //娉ㄥ唽鏃堕棿 + enterpriseInfo.address = data.address //鑱旂郴鍦板潃 + enterpriseInfo.suppliercode = data.suppliercode //浼佷笟娉ㄥ唽鍙� + enterpriseInfo.contact = data.contact //鑱旂郴浜� + enterpriseInfo.phone = data.phone //鑱旂郴鐢佃瘽 + enterpriseInfo.id = data.id + enterpriseInfo.resume = data.resume + } + }) // 浣跨敤 ref 鍒涘缓鍝嶅簲寮忓紩鐢� const formRef = ref(null); const enterpriseInfo = reactive({ @@ -83,14 +98,18 @@ }) //涓婁紶鎴愬姛鏃惰Е鍙� - const success = (text, e) => { + const success = (e) => { //e.res 涓烘湇鍔″櫒杩斿洖鏁版嵁 //涓婁紶鎴愬姛鍥炶皟锛屽鐞嗘湇鍔″櫒杩斿洖鏁版嵁銆愭澶勬牴鎹疄闄呰繑鍥炴暟鎹繘琛屽鐞嗐�� let res = JSON.parse(e.res.data.replace(/\ufeff/g, "") || "{}") - console.log(res.data, 'res.data'); + console.log(res.data); if (res.data.url) { enterpriseInfo.businessLicense = res.data.url - + enterpriseInfo.suppliername = res.data.info.name //浼佷笟鍚嶇О + enterpriseInfo.regtime = res.data.info.setDate //娉ㄥ唽鏃堕棿 + enterpriseInfo.address = res.data.info.address //鑱旂郴鍦板潃 + enterpriseInfo.suppliercode = res.data.info.regNum //浼佷笟娉ㄥ唽鍙� + enterpriseInfo.contact = res.data.info.person //鑱旂郴浜� } } //涓婁紶澶辫触鏃惰Е鍙� @@ -103,6 +122,19 @@ console.log(e, '鍒犻櫎') } + const saveUserCompany = () => { + $api.saveUserCompany(enterpriseInfo).then(res => { + if (res.code == 1) { + $api.getUser().then(res => { + $db.set('userInfo', JSON.stringify(res.data)) + }) + $util.showToast({ + title: "淇濆瓨鎴愬姛锛�", + icon: "success" + }) + } + }) + } </script> <style> -- Gitblit v1.9.1