gemercheung 11 ماه پیش
والد
کامیت
2de31dd594

+ 3 - 1
pages/course/course.wxml

@@ -17,7 +17,9 @@
     <view class="list" wx:if="{{list.length>0}}">
       <view class="item" wx:for="{{list}}" wx:for-item="item" wx:key="index" data-id="{{item.id}}"
         bindtap="handleVRDetail">
-        <t-image class="cover" mode="scaleToFill" src="https://sit-daikan.4dage.com/{{item.thumb}}" />
+        <t-image class="cover" mode="scaleToFill"   error="slot" src="{{item.thumb}}">
+          <text class="error-text" slot="error">加载失败</text>
+        </t-image>
 
         <view class="title">{{item.title}}</view>
 

+ 5 - 4
pages/course_detail/course_detail.wxml

@@ -1,8 +1,9 @@
 <!--pages/course_detail/course_detail.wxml-->
 <view class="detail-container">
-  <t-image class="banner" id="loading-img" shape="round" mode="scaleToFill" loading="slot"
-    src="https://sit-daikan.4dage.com/{{detail.thumb}}">
+  <t-image class="banner" id="loading-img" shape="round" mode="scaleToFill"  error="slot"  loading="slot"
+    src="{{detail.thumb}}">
     <t-loading slot="loading" theme="spinner" size="40rpx" loading />
+    <text class="error-text" slot="error">加载失败</text>
   </t-image>
 
   <view class="detail-content">
@@ -68,9 +69,9 @@
   </view>
   <t-dialog visible="{{imageOnTop}}" title="限时免费" content="当前课堂限时免费啦!!"
     confirm-btn="{{ {content: '抢购', variant: 'base', theme: 'danger' } }}"
-    cancel-btn="{{ {content: '取消', variant: 'base', theme: 'default' } }}" bind:confirm="confirmDialog"
+    cancel-btn="{{ {content: '关闭', variant: 'base', theme: 'default' } }}" bind:confirm="confirmDialog"
     bind:cancel="closeDialog">
-    <t-image slot="top" t-class="dialog-image" src="https://tdesign.gtimg.com/mobile/demos/dialog1.png" />
+    <!-- <t-image slot="top" t-class="dialog-image" src="https://tdesign.gtimg.com/mobile/demos/dialog1.png" /> -->
   </t-dialog>
   <t-toast id="t-toast" />
 </view>

+ 4 - 3
pages/user/my_course/my_course.wxml

@@ -4,10 +4,11 @@
   <!-- 包裹页面全部内容 -->
   <view class="container">
     <view class="list" wx:if="{{list.length > 0}}">
-      <view class="course_item " wx:for="{{list}}" wx:for-item="item" wx:key="index"  bindtap="handleOpenDetail"
+      <view class="course_item " wx:for="{{list}}" wx:for-item="item" wx:key="index" bindtap="handleOpenDetail"
         data-detail="{{item}}">
-        <t-image class="cover" src="https://sit-daikan.4dage.com/{{item.thumb}}" mode="aspectFill"
-          aria-label="{{item.title}}" />
+        <t-image class="cover" src="{{item.thumb}}" error="slot"  mode="aspectFill" aria-label="{{item.title}}">
+          <text class="error-text" slot="error">加载失败</text>
+        </t-image>
         <view class="content">
           <view class="title">
             {{item.title}}

+ 4 - 2
pages/user/my_host_course/index.wxml

@@ -6,8 +6,10 @@
     <view class="list" wx:if="{{list.length>0}}">
       <view class="course_item_container" wx:for="{{list}}" wx:for-item="item" wx:key="index">
         <view class="course_item ">
-          <t-image class="cover" src="https://sit-daikan.4dage.com/{{item.thumb}}" mode="aspectFill"
-            aria-label="{{item.title}}" />
+    
+            <t-image class="cover" src="{{item.thumb}}" error="slot"  mode="aspectFill" aria-label="{{item.title}}">
+              <text class="error-text" slot="error">加载失败</text>
+            </t-image>
           <view class="content">
             <view class="title">
               {{item.title}}

+ 16 - 10
pages/user/personal/personal.js

@@ -11,7 +11,8 @@ import ActionSheet, {
 // } from '../../api/user'
 import {
   decrptPhone,
-  updateUserInfo
+  updateUserInfo,
+  updateAvatar
 } from '../../../utils/request'
 let genderHandler = null
 
@@ -141,16 +142,17 @@ Page({
         console.log('decrptPhone', code)
         const res = await decrptPhone(code)
         console.log('手机号', res.data.phoneNumber)
+        const phone = res.data.phoneNumber;
         if (res.code === 0) {
           const res = await updateUserInfo({
-            phone: res.data.phoneNumber
+            phone: phone
           })
           console.log('更新后', res)
           wx.showToast({
             title: '更新成功!',
           })
           this.syncUserInfo({
-            phone: res.data.phoneNumber
+            phone: phone
           });
         }
       }
@@ -198,16 +200,20 @@ Page({
       avatarUrl
     } = e.detail
 
-    console.log('e', e)
+    console.log("微信tmp-file", avatarUrl)
     const url = await updateAvatar(avatarUrl)
-
-    const res = await updateUserInfo({
-      avatarUrl: url
-    })
-    if (res.code === 0) {
-      this.syncUserInfo({
+    console.log('上传后URL',
+      url)
+    if (url) {
+      const res = await updateUserInfo({
         avatarUrl: url
       })
+      if (res.code === 0) {
+        this.syncUserInfo({
+          avatarUrl: url
+        })
+      }
+
     }
 
   },

+ 5 - 1
pages/user/personal/personal.wxml

@@ -34,7 +34,11 @@
 
   <t-cell title="绑定手机" hover arrow>
     <view slot='note'>
-      <text wx:if="{{userInfo.phone}}">{{userInfo.phone}}</text>
+      <!-- <text wx:if="{{userInfo.phone}}">{{userInfo.phone}}</text>
+      
+      -->
+      <t-button wx:if="{{userInfo.phone}}" class="phone" variant="text" size="small" open-type="getPhoneNumber"
+      bindgetphonenumber="handleGetPhoneNumber">{{userInfo.phone}}</t-button>
       <t-button wx:else class="phone" variant="text" size="small" open-type="getPhoneNumber"
         bindgetphonenumber="handleGetPhoneNumber">点击绑定</t-button>
     </view>

+ 4 - 3
pages/yuezhan/search/index.wxml

@@ -3,7 +3,8 @@
   <view class='search-bar'>
     <view class='search-wrapper'>
       <text class='iconfont icon-sousuo fix-icon-search' bindtap='searchByText'></text>
-      <input placeholder="输入关键词" bindconfirm="searchByText" bindinput="bindInput" value="{{searchText}}" data-key="searchText" class='search-input' focus="{{focus}}" />
+      <input placeholder="输入关键词" bindconfirm="searchByText" bindinput="bindInput" value="{{searchText}}"
+        data-key="searchText" class='search-input' focus="{{focus}}" />
     </view>
   </view>
   <view class='hot-search'>
@@ -11,8 +12,8 @@
       <text class='hot-search-title-txt'>热门搜索</text>
     </view>
     <view class='hot-tag'>
-       <text wx:for="{{keyword}}" wx:key="{{index}}" bindtap='keywordSearch' data-keyword='{{item.dataValue}}' class='hot-tag-item'>{{item.dataValue}}</text>
-
+      <text wx:for="{{keyword}}" wx:key="{{index}}" bindtap='keywordSearch' data-keyword='{{item.dataValue}}'
+        class='hot-tag-item'>{{item.dataValue}}</text>
     </view>
   </view>
 </view>

+ 5 - 2
utils/request.js

@@ -1,5 +1,5 @@
 import wxRequest from 'wechat-request';
-
+const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
 
 const urls = {
   //VR课堂
@@ -20,6 +20,8 @@ const urls = {
   wxLogin: "/api/show/wxLogin/{code}",
   //免费限时
   freeBuy: "/api/payment/freeBuy",
+  // 上传
+  upload: '/api/wxUser/upload'
 }
 
 wxRequest.defaults.baseURL = 'https://sit-daikan.4dage.com';
@@ -63,8 +65,9 @@ export async function updateUserInfo(info) {
   return await (await wxRequest.post(urls.updateWxUser, info)).data;
 }
 export const updateAvatar = async (avatarUrl) => {
+  // const WX_UPLOAD_URL = wxRequest.defaults.baseURL + urls.upload
 
-  const WX_UPLOAD_URL = ''
+  const WX_UPLOAD_URL = 'https://v4-test.4dkankan.com/takelook/upload/file'
   let url = ''
   wx.uploadFile({
     filePath: avatarUrl,